Skip to content

Commit

Permalink
Fixed (All games): On entering a map after having left a previous one…
Browse files Browse the repository at this point in the history
…, the player's HUD weapon would be visible briefly before raising from the lowered position as expected.
  • Loading branch information
danij-deng committed Mar 2, 2010
1 parent 187d3eb commit db16391
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 17 deletions.
13 changes: 10 additions & 3 deletions doomsday/plugins/jdoom/src/p_pspr.c
Expand Up @@ -685,18 +685,25 @@ void C_DECL A_BFGsound(player_t* player, pspdef_t* psp)
*/
void P_SetupPsprites(player_t* player)
{
int i;
int i;

// Remove all psprites.
for(i = 0; i < NUMPSPRITES; ++i)
{
player->pSprites[i].state = NULL;
}

// Bring up the new weapon.
if(player->pendingWeapon == WT_NOCHANGE)
player->pendingWeapon = player->readyWeapon;
P_BringUpWeapon(player);

/// Ensure the engine-side state matches.
/// \fixme Is this duplication still necessary?
for(i = 0; i < NUMPSPRITES; ++i)
{
player->plr->pSprites[i].pos[0] = player->pSprites[i].pos[0];
player->plr->pSprites[i].pos[1] = player->pSprites[i].pos[1];
player->plr->pSprites[i].tics = player->pSprites[i].tics;
}
}

/**
Expand Down
13 changes: 11 additions & 2 deletions doomsday/plugins/jdoom64/src/p_pspr.c
Expand Up @@ -807,9 +807,9 @@ void C_DECL A_BFGsound(player_t *player, pspdef_t *psp)
/**
* Called at start of level for each player.
*/
void P_SetupPsprites(player_t *player)
void P_SetupPsprites(player_t* player)
{
int i;
int i;

// Remove all psprites.
for(i = 0; i < NUMPSPRITES; ++i)
Expand All @@ -819,6 +819,15 @@ void P_SetupPsprites(player_t *player)
if(player->pendingWeapon == WT_NOCHANGE)
player->pendingWeapon = player->readyWeapon;
P_BringUpWeapon(player);

/// Ensure the engine-side state matches.
/// \fixme Is this duplication still necessary?
for(i = 0; i < NUMPSPRITES; ++i)
{
player->plr->pSprites[i].pos[0] = player->pSprites[i].pos[0];
player->plr->pSprites[i].pos[1] = player->pSprites[i].pos[1];
player->plr->pSprites[i].tics = player->pSprites[i].tics;
}
}

/**
Expand Down
14 changes: 12 additions & 2 deletions doomsday/plugins/jheretic/src/p_pspr.c
Expand Up @@ -1790,9 +1790,9 @@ void C_DECL A_Light2(player_t *player, pspdef_t *psp)
/**
* Called at start of level for each player.
*/
void P_SetupPsprites(player_t *player)
void P_SetupPsprites(player_t* player)
{
int i;
int i;

// Remove all psprites.
for(i = 0; i < NUMPSPRITES; ++i)
Expand All @@ -1804,6 +1804,16 @@ void P_SetupPsprites(player_t *player)
if(player->pendingWeapon == WT_NOCHANGE)
player->pendingWeapon = player->readyWeapon;
P_BringUpWeapon(player);

/// Ensure the engine-side state matches.
/// \fixme Is this duplication still necessary?
for(i = 0; i < NUMPSPRITES; ++i)
{
player->plr->pSprites[i].pos[0] = player->pSprites[i].pos[0];
player->plr->pSprites[i].pos[1] = player->pSprites[i].pos[1];
player->plr->pSprites[i].state = player->pSprites[i].state;
player->plr->pSprites[i].tics = player->pSprites[i].tics;
}
}

/**
Expand Down
25 changes: 15 additions & 10 deletions doomsday/plugins/jhexen/src/p_pspr.c
Expand Up @@ -2025,24 +2025,29 @@ void C_DECL A_Light0(player_t *plr, pspdef_t *psp)
/**
* Called at start of the map for each player.
*/
void P_SetupPsprites(player_t *plr)
void P_SetupPsprites(player_t* player)
{
int i;

#if _DEBUG
Con_Message("P_SetupPsprites: Player %i.\n", plr - players);
#endif
int i;

// Remove all psprites.
for(i = 0; i < NUMPSPRITES; ++i)
{
plr->pSprites[i].state = NULL;
player->pSprites[i].state = NULL;
}

// Spawn the ready weapon
if(plr->pendingWeapon == WT_NOCHANGE)
plr->pendingWeapon = plr->readyWeapon;
P_BringUpWeapon(plr);
if(player->pendingWeapon == WT_NOCHANGE)
player->pendingWeapon = player->readyWeapon;
P_BringUpWeapon(player);

/// Ensure the engine-side state matches.
/// \fixme Is this duplication still necessary?
for(i = 0; i < NUMPSPRITES; ++i)
{
player->plr->pSprites[i].pos[0] = player->pSprites[i].pos[0];
player->plr->pSprites[i].pos[1] = player->pSprites[i].pos[1];
player->plr->pSprites[i].tics = player->pSprites[i].tics;
}
}

/**
Expand Down

0 comments on commit db16391

Please sign in to comment.