From 06790ce0cdfeff84b8a92ede5c03cfd48342fcb4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 24 Oct 2008 18:03:18 +0000 Subject: Further fixes to stop lumps being modified. Subversion-branch: /branches/raven-branch Subversion-revision: 1363 --- src/heretic/p_setup.c | 14 ++++++++------ src/hexen/p_setup.c | 25 +++++++++++++++++-------- src/hexen/po_man.c | 35 +++++++++++++++++++---------------- 3 files changed, 44 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/heretic/p_setup.c b/src/heretic/p_setup.c index 8e93fe04..ed45353a 100644 --- a/src/heretic/p_setup.c +++ b/src/heretic/p_setup.c @@ -268,6 +268,7 @@ void P_LoadThings(int lump) { byte *data; int i; + mapthing_t spawnthing; mapthing_t *mt; int numthings; @@ -277,12 +278,12 @@ void P_LoadThings(int lump) 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 @@ void P_LoadBlockMap(int lump) 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: diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index 653080e2..e5708e63 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -355,6 +355,7 @@ void P_LoadThings(int lump) { byte *data; int i; + mapthing_t spawnthing; mapthing_t *mt; int numthings; int playerCount; @@ -366,14 +367,22 @@ void P_LoadThings(int lump) 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 diff --git a/src/hexen/po_man.c b/src/hexen/po_man.c index ec5bb621..20da66e5 100644 --- a/src/hexen/po_man.c +++ b/src/hexen/po_man.c @@ -1435,6 +1435,7 @@ void PO_Init(int lump) { byte *data; int i; + mapthing_t spawnthing; mapthing_t *mt; int numthings; int polyIndex; @@ -1449,32 +1450,34 @@ void PO_Init(int lump) // 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++; } } 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); -- cgit v1.2.3