shithub: choc

Download patch

ref: 06790ce0cdfeff84b8a92ede5c03cfd48342fcb4
parent: 80eacd13f9d4e7111893de511d0b5ecd5402ee74
author: Simon Howard <[email protected]>
date: Fri Oct 24 14:03:18 EDT 2008

Further fixes to stop lumps being modified.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1363

--- a/src/heretic/p_setup.c
+++ b/src/heretic/p_setup.c
@@ -268,6 +268,7 @@
 {
     byte *data;
     int i;
+    mapthing_t spawnthing;
     mapthing_t *mt;
     int numthings;
 
@@ -277,12 +278,12 @@
     mt = (mapthing_t *) data;
     for (i = 0; i < numthings; i++, mt++)
     {
-        mt->x = SHORT(mt->x);
-        mt->y = SHORT(mt->y);
-        mt->angle = SHORT(mt->angle);
-        mt->type = SHORT(mt->type);
-        mt->options = SHORT(mt->options);
-        P_SpawnMapThing(mt);
+        spawnthing.x = SHORT(mt->x);
+        spawnthing.y = SHORT(mt->y);
+        spawnthing.angle = SHORT(mt->angle);
+        spawnthing.type = SHORT(mt->type);
+        spawnthing.options = SHORT(mt->options);
+        P_SpawnMapThing(&spawnthing);
     }
 
     W_ReleaseLumpNum(lump);
@@ -424,6 +425,7 @@
     lumplen = W_LumpLength(lump);
 
     blockmaplump = Z_Malloc(lumplen, PU_LEVEL, NULL);
+    W_ReadLump(lump, blockmaplump);
     blockmap = blockmaplump + 4;
 
     // Swap all short integers to native byte ordering:
--- a/src/hexen/p_setup.c
+++ b/src/hexen/p_setup.c
@@ -355,6 +355,7 @@
 {
     byte *data;
     int i;
+    mapthing_t spawnthing;
     mapthing_t *mt;
     int numthings;
     int playerCount;
@@ -366,14 +367,22 @@
     mt = (mapthing_t *) data;
     for (i = 0; i < numthings; i++, mt++)
     {
-        mt->tid = SHORT(mt->tid);
-        mt->x = SHORT(mt->x);
-        mt->y = SHORT(mt->y);
-        mt->height = SHORT(mt->height);
-        mt->angle = SHORT(mt->angle);
-        mt->type = SHORT(mt->type);
-        mt->options = SHORT(mt->options);
-        P_SpawnMapThing(mt);
+        spawnthing.tid = SHORT(mt->tid);
+        spawnthing.x = SHORT(mt->x);
+        spawnthing.y = SHORT(mt->y);
+        spawnthing.height = SHORT(mt->height);
+        spawnthing.angle = SHORT(mt->angle);
+        spawnthing.type = SHORT(mt->type);
+        spawnthing.options = SHORT(mt->options);
+
+        spawnthing.special = mt->special;
+        spawnthing.arg1 = mt->arg1;
+        spawnthing.arg2 = mt->arg2;
+        spawnthing.arg3 = mt->arg3;
+        spawnthing.arg4 = mt->arg4;
+        spawnthing.arg5 = mt->arg5;
+
+        P_SpawnMapThing(&spawnthing);
     }
     P_CreateTIDList();
     P_InitCreatureCorpseQueue(false);   // false = do NOT scan for corpses
--- a/src/hexen/po_man.c
+++ b/src/hexen/po_man.c
@@ -1435,6 +1435,7 @@
 {
     byte *data;
     int i;
+    mapthing_t spawnthing;
     mapthing_t *mt;
     int numthings;
     int polyIndex;
@@ -1449,18 +1450,19 @@
     // Find the startSpot points, and spawn each polyobj
     for (i = 0; i < numthings; i++, mt++)
     {
-        mt->x = SHORT(mt->x);
-        mt->y = SHORT(mt->y);
-        mt->angle = SHORT(mt->angle);
-        mt->type = SHORT(mt->type);
+        spawnthing.x = SHORT(mt->x);
+        spawnthing.y = SHORT(mt->y);
+        spawnthing.angle = SHORT(mt->angle);
+        spawnthing.type = SHORT(mt->type);
 
         // 3001 = no crush, 3002 = crushing
-        if (mt->type == PO_SPAWN_TYPE || mt->type == PO_SPAWNCRUSH_TYPE)
+        if (spawnthing.type == PO_SPAWN_TYPE
+         || spawnthing.type == PO_SPAWNCRUSH_TYPE)
         {                       // Polyobj StartSpot Pt.
-            polyobjs[polyIndex].startSpot.x = mt->x << FRACBITS;
-            polyobjs[polyIndex].startSpot.y = mt->y << FRACBITS;
-            SpawnPolyobj(polyIndex, mt->angle,
-                         (mt->type == PO_SPAWNCRUSH_TYPE));
+            polyobjs[polyIndex].startSpot.x = spawnthing.x << FRACBITS;
+            polyobjs[polyIndex].startSpot.y = spawnthing.y << FRACBITS;
+            SpawnPolyobj(polyIndex, spawnthing.angle,
+                         (spawnthing.type == PO_SPAWNCRUSH_TYPE));
             polyIndex++;
         }
     }
@@ -1467,14 +1469,15 @@
     mt = (mapthing_t *) data;
     for (i = 0; i < numthings; i++, mt++)
     {
-        mt->x = SHORT(mt->x);
-        mt->y = SHORT(mt->y);
-        mt->angle = SHORT(mt->angle);
-        mt->type = SHORT(mt->type);
-        if (mt->type == PO_ANCHOR_TYPE)
+        spawnthing.x = SHORT(mt->x);
+        spawnthing.y = SHORT(mt->y);
+        spawnthing.angle = SHORT(mt->angle);
+        spawnthing.type = SHORT(mt->type);
+        if (spawnthing.type == PO_ANCHOR_TYPE)
         {                       // Polyobj Anchor Pt.
-            TranslateToStartSpot(mt->angle, mt->x << FRACBITS,
-                                 mt->y << FRACBITS);
+            TranslateToStartSpot(spawnthing.angle,
+                                 spawnthing.x << FRACBITS,
+                                 spawnthing.y << FRACBITS);
         }
     }
     W_ReleaseLumpNum(lump);