Skip to content

Commit

Permalink
Fixed (all games): "Map crash when you reload after death" (see here h…
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed Jun 23, 2009
1 parent 34fd5d4 commit 1ab7821
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 30 deletions.
15 changes: 0 additions & 15 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -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.
*
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/common/src/p_start.c
Expand Up @@ -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);
Expand Down
18 changes: 15 additions & 3 deletions doomsday/plugins/jdoom/src/p_mobj.c
Expand Up @@ -1028,16 +1028,28 @@ 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)
{
for(i = 0; i < NUM_KEY_TYPES; ++i)
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.
Expand Down
3 changes: 2 additions & 1 deletion doomsday/plugins/jdoom/src/p_pspr.c
Expand Up @@ -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);
}

Expand Down
18 changes: 15 additions & 3 deletions doomsday/plugins/jdoom64/src/p_mobj.c
Expand Up @@ -1055,16 +1055,28 @@ 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)
{
for(i = 0; i < NUM_KEY_TYPES; ++i)
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.
Expand Down
3 changes: 2 additions & 1 deletion doomsday/plugins/jdoom64/src/p_pspr.c
Expand Up @@ -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);
}

Expand Down
18 changes: 15 additions & 3 deletions doomsday/plugins/jheretic/src/p_mobj.c
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion doomsday/plugins/jheretic/src/p_pspr.c
Expand Up @@ -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);
}

Expand Down
18 changes: 16 additions & 2 deletions doomsday/plugins/jhexen/src/p_mobj.c
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion doomsday/plugins/jhexen/src/p_pspr.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 1ab7821

Please sign in to comment.