From 1ab782163f394a13a9602f87b94bffbbe0f8b74a Mon Sep 17 00:00:00 2001 From: danij Date: Tue, 23 Jun 2009 21:50:19 +0000 Subject: [PATCH] Fixed (all games): "Map crash when you reload after death" (see here http://sourceforge.net/tracker/index.php?func=detail&aid=2810953&group_id=74815&atid=542099). --- doomsday/plugins/common/src/g_game.c | 15 --------------- doomsday/plugins/common/src/p_start.c | 1 + doomsday/plugins/jdoom/src/p_mobj.c | 18 +++++++++++++++--- doomsday/plugins/jdoom/src/p_pspr.c | 3 ++- doomsday/plugins/jdoom64/src/p_mobj.c | 18 +++++++++++++++--- doomsday/plugins/jdoom64/src/p_pspr.c | 3 ++- doomsday/plugins/jheretic/src/p_mobj.c | 18 +++++++++++++++--- doomsday/plugins/jheretic/src/p_pspr.c | 3 ++- doomsday/plugins/jhexen/src/p_mobj.c | 18 ++++++++++++++++-- doomsday/plugins/jhexen/src/p_pspr.c | 3 ++- 10 files changed, 70 insertions(+), 30 deletions(-) diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index 17c7aa8a44..0e29d15cc3 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -1229,21 +1229,6 @@ Con_Message("G_Ticker: Removing player %i's mobj.\n", i); oldGameState = gameState; } -/** - * Called at the start. - * Called by the game initialization functions. - */ -void G_InitPlayer(int player) -{ - player_t *p; - - // set up the saved info - p = &players[player]; - - // clear everything else to defaults - G_PlayerReborn(player); -} - /** * Called when a player leaves a map. * diff --git a/doomsday/plugins/common/src/p_start.c b/doomsday/plugins/common/src/p_start.c index 8c5136db6b..1d78ad9547 100644 --- a/doomsday/plugins/common/src/p_start.c +++ b/doomsday/plugins/common/src/p_start.c @@ -661,6 +661,7 @@ boolean P_CheckSpot(float x, float y) if(!(dummy = P_SpawnMobj3fv(DUMMY_TYPE, pos, 0, MSF_Z_FLOOR))) Con_Error("P_CheckSpot: Failed creating dummy mobj."); + dummy->flags &= ~MF_PICKUP; dummy->flags2 &= ~MF2_PASSMOBJ; result = P_CheckPosition3fv(dummy, pos); diff --git a/doomsday/plugins/jdoom/src/p_mobj.c b/doomsday/plugins/jdoom/src/p_mobj.c index 7e2374139f..ed502788da 100644 --- a/doomsday/plugins/jdoom/src/p_mobj.c +++ b/doomsday/plugins/jdoom/src/p_mobj.c @@ -1028,9 +1028,6 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, p->class = PCLASS_PLAYER; - // Setup gun psprite. - P_SetupPsprites(p); - // Give all cards in death match mode. if(deathmatch) { @@ -1038,6 +1035,21 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, p->keys[i] = true; } + p->pendingWeapon = WT_NOCHANGE; + + // Finally, check the current position so that any interactions + // which would occur as a result of collision happen immediately + // (e.g., weapon pickups at the current position will be collected). + P_CheckPosition3fv(mo, mo->pos); + + if(p->pendingWeapon != WT_NOCHANGE) + p->readyWeapon = p->pendingWeapon; + else + p->pendingWeapon = p->readyWeapon; + + // Setup gun psprite. + P_SetupPsprites(p); + // Wake up the status bar. ST_Start(p - players); // Wake up the heads up text. diff --git a/doomsday/plugins/jdoom/src/p_pspr.c b/doomsday/plugins/jdoom/src/p_pspr.c index 557eb0f126..c659918ba6 100644 --- a/doomsday/plugins/jdoom/src/p_pspr.c +++ b/doomsday/plugins/jdoom/src/p_pspr.c @@ -714,7 +714,8 @@ void P_SetupPsprites(player_t* player) } // Bring up the new weapon. - player->pendingWeapon = player->readyWeapon; + if(player->pendingWeapon == WT_NOCHANGE) + player->pendingWeapon = player->readyWeapon; P_BringUpWeapon(player); } diff --git a/doomsday/plugins/jdoom64/src/p_mobj.c b/doomsday/plugins/jdoom64/src/p_mobj.c index b52e9bbc05..c860b0b1dd 100644 --- a/doomsday/plugins/jdoom64/src/p_mobj.c +++ b/doomsday/plugins/jdoom64/src/p_mobj.c @@ -1055,9 +1055,6 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, p->class = PCLASS_PLAYER; - // Setup gun psprite. - P_SetupPsprites(p); - // Give all cards in death match mode. if(deathmatch) { @@ -1065,6 +1062,21 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, p->keys[i] = true; } + p->pendingWeapon = WT_NOCHANGE; + + // Finally, check the current position so that any interactions + // which would occur as a result of collision happen immediately + // (e.g., weapon pickups at the current position will be collected). + P_CheckPosition3fv(mo, mo->pos); + + if(p->pendingWeapon != WT_NOCHANGE) + p->readyWeapon = p->pendingWeapon; + else + p->pendingWeapon = p->readyWeapon; + + // Setup gun psprite. + P_SetupPsprites(p); + // Wake up the status bar. ST_Start(p - players); // Wake up the heads up text. diff --git a/doomsday/plugins/jdoom64/src/p_pspr.c b/doomsday/plugins/jdoom64/src/p_pspr.c index 7e89619cac..f30a4f0e81 100644 --- a/doomsday/plugins/jdoom64/src/p_pspr.c +++ b/doomsday/plugins/jdoom64/src/p_pspr.c @@ -833,7 +833,8 @@ void P_SetupPsprites(player_t *player) player->pSprites[i].state = NULL; // Spawn the gun. - player->pendingWeapon = player->readyWeapon; + if(player->pendingWeapon == WT_NOCHANGE) + player->pendingWeapon = player->readyWeapon; P_BringUpWeapon(player); } diff --git a/doomsday/plugins/jheretic/src/p_mobj.c b/doomsday/plugins/jheretic/src/p_mobj.c index 75dbad5615..7332f238d9 100644 --- a/doomsday/plugins/jheretic/src/p_mobj.c +++ b/doomsday/plugins/jheretic/src/p_mobj.c @@ -1259,8 +1259,6 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, else p->plr->viewHeight = (float) cfg.plrViewHeight; - P_SetupPsprites(p); // Setup gun psprite. - p->class = PCLASS_PLAYER; if(deathmatch) @@ -1271,9 +1269,23 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, } } + p->pendingWeapon = WT_NOCHANGE; + + // Finally, check the current position so that any interactions + // which would occur as a result of collision happen immediately + // (e.g., weapon pickups at the current position will be collected). + P_CheckPosition3fv(mo, mo->pos); + + if(p->pendingWeapon != WT_NOCHANGE) + p->readyWeapon = p->pendingWeapon; + else + p->pendingWeapon = p->readyWeapon; + + // Setup gun psprite. + P_SetupPsprites(p); + // Wake up the status bar. ST_Start(p - players); - // Wake up the heads up text. HU_Start(p - players); } diff --git a/doomsday/plugins/jheretic/src/p_pspr.c b/doomsday/plugins/jheretic/src/p_pspr.c index 8d89daa8e8..0a119731a7 100644 --- a/doomsday/plugins/jheretic/src/p_pspr.c +++ b/doomsday/plugins/jheretic/src/p_pspr.c @@ -1801,7 +1801,8 @@ void P_SetupPsprites(player_t *player) } // Spawn the ready weapon. - player->pendingWeapon = player->readyWeapon; + if(player->pendingWeapon == WT_NOCHANGE) + player->pendingWeapon = player->readyWeapon; P_BringUpWeapon(player); } diff --git a/doomsday/plugins/jhexen/src/p_mobj.c b/doomsday/plugins/jhexen/src/p_mobj.c index 3c9f9bef0e..089a4dbe96 100644 --- a/doomsday/plugins/jhexen/src/p_mobj.c +++ b/doomsday/plugins/jhexen/src/p_mobj.c @@ -1436,15 +1436,29 @@ void P_SpawnPlayer2(int plrNum, playerclass_t pClass, float x, float y, p->plr->viewHeight = cfg.plrViewHeight; p->plr->lookDir = 0; - P_SetupPsprites(p); + if(deathmatch) { // Give all keys in death match mode. p->keys = 2047; } + p->pendingWeapon = WT_NOCHANGE; + + // Finally, check the current position so that any interactions + // which would occur as a result of collision happen immediately + // (e.g., weapon pickups at the current position will be collected). + P_CheckPosition3fv(mo, mo->pos); + + if(p->pendingWeapon != WT_NOCHANGE) + p->readyWeapon = p->pendingWeapon; + else + p->pendingWeapon = p->readyWeapon; + + // Setup gun psprite. + P_SetupPsprites(p); + // Wake up the status bar. ST_Start(p - players); - // Wake up the heads up text. HU_Start(p - players); } diff --git a/doomsday/plugins/jhexen/src/p_pspr.c b/doomsday/plugins/jhexen/src/p_pspr.c index 436f184c7b..73ca1a42d3 100644 --- a/doomsday/plugins/jhexen/src/p_pspr.c +++ b/doomsday/plugins/jhexen/src/p_pspr.c @@ -2041,7 +2041,8 @@ void P_SetupPsprites(player_t *plr) } // Spawn the ready weapon - plr->pendingWeapon = plr->readyWeapon; + if(plr->pendingWeapon == WT_NOCHANGE) + plr->pendingWeapon = plr->readyWeapon; P_BringUpWeapon(plr); }