mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Made P_SwitchShield take into account the force shield, then made A_ForceShield take the number of bonus hitpoints as its var1. (Also, drowning timer is properly reset by ALL protectwater shields, not just elemental.)
This commit is contained in:
parent
ace44df8b4
commit
2acfc72d86
3 changed files with 35 additions and 58 deletions
|
@ -1670,7 +1670,7 @@ state_t states[NUMSTATES] =
|
|||
{SPR_TVAT, 2, 18, {A_RingShield},0, 0, S_NULL}, // S_ATTRACT_ICON2
|
||||
|
||||
{SPR_TVFO, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_FORCE_ICON2}, // S_FORCE_ICON1
|
||||
{SPR_TVFO, 2, 18, {A_ForceShield}, 0, 0, S_NULL}, // S_FORCE_ICON2
|
||||
{SPR_TVFO, 2, 18, {A_ForceShield}, 1, 0, S_NULL}, // S_FORCE_ICON2
|
||||
|
||||
{SPR_TVAR, FF_ANIMATE|2, 18, {NULL}, 3, 4, S_ARMAGEDDON_ICON2}, // S_ARMAGEDDON_ICON1
|
||||
{SPR_TVAR, 2, 18, {A_BombShield}, 0, 0, S_NULL}, // S_ARMAGEDDON_ICON2
|
||||
|
|
|
@ -3324,29 +3324,19 @@ void A_WaterShield(mobj_t *actor)
|
|||
S_StartSound(player->mo, actor->info->seesound);
|
||||
else
|
||||
S_StartSound(player->mo, sfx_itemup);
|
||||
|
||||
if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);
|
||||
|
||||
player->powers[pw_underwater] = 0;
|
||||
|
||||
if (player->powers[pw_spacetime] > 1)
|
||||
{
|
||||
player->powers[pw_spacetime] = 0;
|
||||
P_RestoreMusic(player);
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_ForceShield
|
||||
//
|
||||
// Description: Awards the player a force shield.
|
||||
//
|
||||
// var1 = unused
|
||||
// var1 = Number of additional hitpoints to give
|
||||
// var2 = unused
|
||||
//
|
||||
void A_ForceShield(mobj_t *actor)
|
||||
{
|
||||
player_t *player;
|
||||
INT32 locvar1 = var1;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ForceShield", actor))
|
||||
|
@ -3358,51 +3348,18 @@ void A_ForceShield(mobj_t *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
if (locvar1 < 0 || locvar1 > SH_FORCEHP)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Invalid number of additional hitpoints.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
player = actor->target->player;
|
||||
|
||||
//can't use P_SwitchShield(player, SH_FORCE) - special case
|
||||
|
||||
if (mariomode)
|
||||
{
|
||||
mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE);
|
||||
P_SetMobjState(scoremobj, mobjinfo[MT_SCORE].spawnstate+3); // 1000
|
||||
P_AddPlayerScore(player, 1000);
|
||||
}
|
||||
|
||||
if (!(player->powers[pw_shield] & SH_FORCE))
|
||||
{
|
||||
// Just in case.
|
||||
if (player->pflags & PF_SHIELDABILITY)
|
||||
{
|
||||
player->pflags &= ~PF_SHIELDABILITY;
|
||||
player->homing = 0;
|
||||
}
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER
|
||||
&& !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability])))
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
}
|
||||
else if (!mariomode)
|
||||
if (P_SwitchShield(player, SH_FORCE|locvar1))
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
else
|
||||
S_StartSound(player->mo, sfx_itemup);
|
||||
|
||||
if ((player->powers[pw_shield] & SH_FORCE) && (player->powers[pw_shield] & SH_FORCEHP))
|
||||
return; // if you have a force shield with at least 2hp already, let's not go any further.
|
||||
|
||||
if (mariomode)
|
||||
{
|
||||
player->mo->movecount = player->powers[pw_shield];
|
||||
player->powers[pw_marioflashing] = MARIOFLASHINGTICS;
|
||||
}
|
||||
|
||||
player->powers[pw_shield] = SH_FORCE|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK)|0x01;
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
|
||||
// Function: A_PityShield
|
||||
|
|
30
src/p_user.c
30
src/p_user.c
|
@ -1443,10 +1443,16 @@ void P_SpawnShieldOrb(player_t *player)
|
|||
//
|
||||
// Returns whether to play a normal sound or an itemup.
|
||||
//
|
||||
// Not for use if shieldtype would be SH_FORCE.
|
||||
//
|
||||
boolean P_SwitchShield(player_t *player, UINT16 shieldtype)
|
||||
{
|
||||
boolean donthavealready = (shieldtype & SH_FORCE)
|
||||
? (!(player->powers[pw_shield] & SH_FORCE) || (player->powers[pw_shield] & SH_FORCEHP) < (shieldtype & ~SH_FORCE))
|
||||
: ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype);
|
||||
|
||||
boolean stopshieldability = (shieldtype & SH_FORCE)
|
||||
? (!(player->powers[pw_shield] & SH_FORCE))
|
||||
: true;
|
||||
|
||||
if (mariomode)
|
||||
{
|
||||
mobj_t *scoremobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (player->mo->height / 2), MT_SCORE);
|
||||
|
@ -1454,7 +1460,7 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype)
|
|||
P_AddPlayerScore(player, 1000);
|
||||
}
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype)
|
||||
if (donthavealready)
|
||||
{
|
||||
if (mariomode)
|
||||
{
|
||||
|
@ -1463,9 +1469,9 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype)
|
|||
}
|
||||
|
||||
// Just in case.
|
||||
if (player->pflags & PF_SHIELDABILITY)
|
||||
if (stopshieldability && player->pflags & PF_SHIELDABILITY)
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING|PF_SHIELDABILITY; // They'll still have PF_THOKKED...
|
||||
player->pflags &= ~(PF_SPINNING|PF_SHIELDABILITY); // They'll still have PF_THOKKED...
|
||||
player->homing = 0;
|
||||
if (player->powers[pw_shield] & SH_FORCE) // Dash.
|
||||
{
|
||||
|
@ -1486,6 +1492,20 @@ boolean P_SwitchShield(player_t *player, UINT16 shieldtype)
|
|||
|
||||
player->powers[pw_shield] = shieldtype|(mariomode ? SH_MUSHROOM : player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
|
||||
if (shieldtype & SH_PROTECTWATER)
|
||||
{
|
||||
if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);
|
||||
|
||||
player->powers[pw_underwater] = 0;
|
||||
|
||||
if (player->powers[pw_spacetime] > 1)
|
||||
{
|
||||
player->powers[pw_spacetime] = 0;
|
||||
P_RestoreMusic(player);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return (!mariomode);
|
||||
|
|
Loading…
Reference in a new issue