mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-13 06:13:18 +00:00
Re-add P_DoSuperDetransformation
This commit is contained in:
parent
a9cff13a1c
commit
746a014ad1
3 changed files with 64 additions and 42 deletions
|
@ -2513,6 +2513,17 @@ static int lib_pDoSuperTransformation(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pDoSuperDetransformation(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_DoSuperDetransformation(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pExplodeMissile(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -4521,6 +4532,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_VectorInstaThrust",lib_pVectorInstaThrust},
|
||||
{"P_SetMobjStateNF",lib_pSetMobjStateNF},
|
||||
{"P_DoSuperTransformation",lib_pDoSuperTransformation},
|
||||
{"P_DoSuperDetransformation",lib_pDoSuperDetransformation},
|
||||
{"P_ExplodeMissile",lib_pExplodeMissile},
|
||||
{"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial},
|
||||
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
|
||||
|
|
|
@ -544,6 +544,7 @@ void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
|||
void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
|
||||
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo);
|
||||
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
||||
void P_DoSuperDetransformation(player_t *player);
|
||||
void P_ExplodeMissile(mobj_t *mo);
|
||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
|
||||
|
|
93
src/p_user.c
93
src/p_user.c
|
@ -1390,6 +1390,56 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
|
|||
P_PlayerFlagBurst(player, false);
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoSuperDetransformation
|
||||
//
|
||||
// Detransform into regular Sonic!
|
||||
void P_DoSuperDetransformation(player_t *player)
|
||||
{
|
||||
player->powers[pw_emeralds] = 0; // lost the power stones
|
||||
P_SpawnGhostMobj(player->mo);
|
||||
|
||||
player->powers[pw_super] = 0;
|
||||
|
||||
// Restore color
|
||||
if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER)
|
||||
{
|
||||
player->mo->color = SKINCOLOR_WHITE;
|
||||
G_GhostAddColor(GHC_FIREFLOWER);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
if (!G_CoopGametype())
|
||||
player->powers[pw_flashing] = flashingtics-1;
|
||||
|
||||
if (player->mo->sprite2 & FF_SPR2SUPER)
|
||||
P_SetMobjState(player->mo, player->mo->state-states);
|
||||
|
||||
// Inform the netgame that the champion has fallen in the heat of battle.
|
||||
if (!G_CoopGametype())
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k66); //let all players hear it.
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players]));
|
||||
}
|
||||
|
||||
// Resume normal music if you're the console player
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
music_stack_noposition = true; // HACK: Do not reposition next music
|
||||
music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music
|
||||
}
|
||||
P_RestoreMusic(player);
|
||||
|
||||
// If you had a shield, restore its visual significance.
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
|
||||
// Adds to the player's score
|
||||
void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||
{
|
||||
|
@ -4404,48 +4454,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
// Ran out of rings while super!
|
||||
if (player->rings <= 0 || player->exiting)
|
||||
{
|
||||
player->powers[pw_emeralds] = 0; // lost the power stones
|
||||
P_SpawnGhostMobj(player->mo);
|
||||
|
||||
player->powers[pw_super] = 0;
|
||||
|
||||
// Restore color
|
||||
if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER)
|
||||
{
|
||||
player->mo->color = SKINCOLOR_WHITE;
|
||||
G_GhostAddColor(GHC_FIREFLOWER);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
if (!G_CoopGametype())
|
||||
player->powers[pw_flashing] = flashingtics-1;
|
||||
|
||||
if (player->mo->sprite2 & FF_SPR2SUPER)
|
||||
P_SetMobjState(player->mo, player->mo->state-states);
|
||||
|
||||
// Inform the netgame that the champion has fallen in the heat of battle.
|
||||
if (!G_CoopGametype())
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k66); //let all players hear it.
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players]));
|
||||
}
|
||||
|
||||
// Resume normal music if you're the console player
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
music_stack_noposition = true; // HACK: Do not reposition next music
|
||||
music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music
|
||||
}
|
||||
P_RestoreMusic(player);
|
||||
|
||||
// If you had a shield, restore its visual significance.
|
||||
P_SpawnShieldOrb(player);
|
||||
P_DoSuperDetransformation(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue