diff options
author | Simon Howard | 2008-10-09 19:40:04 +0000 |
---|---|---|
committer | Simon Howard | 2008-10-09 19:40:04 +0000 |
commit | d053170646190f31263ae1ed75ad8cbf95409e91 (patch) | |
tree | 8fdabc0b2008e5be729965db7043d28d8cb59365 /src/hexen | |
parent | 88dd6235bcf78c545796795ac6a1f0732e4fab9e (diff) | |
download | chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.tar.gz chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.tar.bz2 chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.zip |
Fix crashes when loading the same level twice.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1348
Diffstat (limited to 'src/hexen')
-rw-r--r-- | src/hexen/p_acs.c | 8 | ||||
-rw-r--r-- | src/hexen/p_mobj.c | 15 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c index 0cd85219..9ab86160 100644 --- a/src/hexen/p_acs.c +++ b/src/hexen/p_acs.c @@ -342,11 +342,13 @@ void P_LoadACScripts(int lump) } } ACStringCount = *buffer++; - ACStrings = (char **) buffer; - for (i = 0; i < ACStringCount; i++) + ACStrings = Z_Malloc(ACStringCount * sizeof(char *), PU_LEVEL, NULL); + + for (i=0; i<ACStringCount; ++i) { - ACStrings[i] += (int) ActionCodeBase; + ACStrings[i] = (char *) ActionCodeBase + buffer[i]; } + memset(MapVars, 0, sizeof(MapVars)); } diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c index a99b6a65..4accc36b 100644 --- a/src/hexen/p_mobj.c +++ b/src/hexen/p_mobj.c @@ -1446,11 +1446,18 @@ void P_SpawnMapThing(mapthing_t * mthing) // Check for player starts 5 to 8 if (mthing->type >= 9100 && mthing->type <= 9103) { - mthing->type = 5 + mthing->type - 9100; // Translate to 5 - 8 - playerstarts[mthing->arg1][mthing->type - 1] = *mthing; - if (!deathmatch && !mthing->arg1) + mapthing_t *player_start; + int player; + + player = 4 + mthing->type - 9100; + + player_start = &playerstarts[mthing->arg1][player]; + memcpy(player_start, mthing, sizeof(mapthing_t)); + player_start->type = player + 1; + + if (!deathmatch && !player_start->arg1) { - P_SpawnPlayer(mthing); + P_SpawnPlayer(player_start); } return; } |