WIP: Alternate lightning

This commit is contained in:
Antonio Martinez 2025-05-29 21:22:04 -04:00 committed by AJ Martinez
parent 4c65960095
commit 7adde499c7
5 changed files with 39 additions and 2 deletions

View file

@ -833,6 +833,7 @@ struct player_t
UINT16 flamedash; // Flame Shield dash power
UINT16 flamemeter; // Flame Shield dash meter left
UINT8 flamelength; // Flame Shield dash meter, number of segments
UINT8 lightningcharge; // Lightning Shield attack timer
UINT16 counterdash; // Flame Shield boost without the flame, largely. Used in places where awarding thrust would affect player control.

View file

@ -1480,6 +1480,9 @@ static boolean K_HasInfiniteTether(player_t *player)
return true;
}
if (player->lightningcharge)
return true;
if (player->eggmanexplode > 0)
return true;
@ -1610,7 +1613,7 @@ static boolean K_TryDraft(player_t *player, mobj_t *dest, fixed_t minDist, fixed
player->draftpower -= 3*add/4;
}
if (gametyperules & GTR_CLOSERPLAYERS)
if (gametyperules & GTR_CLOSERPLAYERS || player->curshield == KSHIELD_LIGHTNING || player->lightningcharge)
{
// Double speed in smaller environments
player->draftpower += add;
@ -10687,6 +10690,28 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_FlameDashLeftoverSmoke(player->mo);
}
if (player->lightningcharge)
{
player->lightningcharge++;
/*
if (onground)
P_Thrust(player->mo, player->mo->angle, player->mo->scale);
*/
if (player->lightningcharge == LIGHTNING_CHARGE)
{
K_DoLightningShield(player);
P_Thrust(player->mo, player->mo->angle, 100*player->mo->scale);
player->tiregrease = TICRATE/4;
player->lightningcharge = 0;
}
}
else
{
S_StopSoundByID(player->mo, LIGHTNING_SOUND);
}
if (P_IsObjectOnGround(player->mo) && player->trickpanel != TRICKSTATE_NONE)
{
if (P_MobjFlip(player->mo) * player->mo->momz <= 0)
@ -14721,7 +14746,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO)
{
K_DoLightningShield(player);
// K_DoLightningShield(player);
player->lightningcharge = 1;
S_StartSound(player->mo, LIGHTNING_SOUND);
if (player->itemamount > 0)
{
// Why is this a conditional?

View file

@ -59,6 +59,9 @@ Make sure this matches the actual number of states
#define TIMEATTACK_START (TICRATE*10)
#define LIGHTNING_CHARGE (TICRATE*2)
#define LIGHTNING_SOUND (sfx_s3k84)
#define OVERDRIVE_STARTUP (0)
#define AMPLEVEL (15)

View file

@ -494,6 +494,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->flamemeter);
else if (fastcmp(field,"flamelength"))
lua_pushinteger(L, plr->flamelength);
else if (fastcmp(field,"lightningcharge"))
lua_pushinteger(L, plr->lightningcharge);
else if (fastcmp(field,"ballhogcharge"))
lua_pushinteger(L, plr->ballhogcharge);
else if (fastcmp(field,"ballhogtap"))
@ -1133,6 +1135,8 @@ static int player_set(lua_State *L)
plr->flamemeter = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flamelength"))
plr->flamelength = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lightningcharge"))
plr->lightningcharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ballhogcharge"))
plr->ballhogcharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ballhogtap"))

View file

@ -560,6 +560,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT16(save->p, players[i].counterdash);
WRITEUINT16(save->p, players[i].flamemeter);
WRITEUINT8(save->p, players[i].flamelength);
WRITEUINT8(save->p, players[i].lightningcharge);
WRITEUINT16(save->p, players[i].ballhogcharge);
WRITEUINT8(save->p, players[i].ballhogtap);
@ -1225,6 +1226,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].counterdash = READUINT16(save->p);
players[i].flamemeter = READUINT16(save->p);
players[i].flamelength = READUINT8(save->p);
players[i].lightningcharge = READUINT8(save->p);
players[i].ballhogcharge = READUINT16(save->p);
players[i].ballhogtap = READUINT8(save->p);