Restore power giving for some effects

This commit is contained in:
NepDisk 2025-04-08 12:18:12 -04:00
parent c1047bee92
commit a53c2d87da
6 changed files with 38 additions and 10 deletions

View file

@ -111,8 +111,9 @@ typedef enum
PF_SHRINKME = 1<<25, // "Shrink me" cheat preference
PF_SHRINKACTIVE = 1<<26, // "Shrink me" cheat is in effect. (Can't be disabled mid-race)
// up to 1<<30 is free
PF_SLIDING = 1<<31,
// up to 1<<29 is free
PF_ATTACKDOWN = 1<<30, // For lua compat, don't use!
PF_SLIDING = 1<<31, // For lua compat, don't use!
} pflags_t;
typedef enum

View file

@ -7644,7 +7644,7 @@ void K_KartResetPlayerColor(player_t *player)
}
}
if (player->invincibilitytimer) // You're gonna kiiiiill
if (player->invincibilitytimer || player->powers[pw_invulnerability]) // You're gonna kiiiiill
{
boolean skip = false;

View file

@ -908,6 +908,9 @@ static int player_get(lua_State *L)
if (lua_compatmode && (plr->carry & CR_SLIDING) == CR_SLIDING)
pflags |= PF_SLIDING;
if (lua_compatmode && (plr->oldcmd.buttons & BT_ATTACK))
pflags |= PF_ATTACKDOWN;
lua_pushinteger(L, pflags);
break;
}
@ -1189,6 +1192,11 @@ static int player_set(lua_State *L)
plr->carry |= CR_SLIDING;
else
plr->carry &= ~CR_SLIDING;
if (pflags & PF_ATTACKDOWN)
plr->oldcmd.buttons |= BT_ATTACK;
else
plr->oldcmd.buttons &= ~BT_ATTACK;
}
plr->pflags = pflags;

View file

@ -6081,20 +6081,21 @@ static void P_ConvertBinaryLinedefTypes(void)
case 433: //Enable/disable gravity flip
lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB);
break;
/*case 434: //Award power-up
case 434: //Award power-up
if (sides[lines[i].sidenum[0]].text)
{
lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1);
}
if (lines[i].sidenum[1] != 0xffff && lines[i].flags & ML_BLOCKMONSTERS) // read power from back sidedef
{
lines[i].stringargs[1] = Z_Malloc(strlen(sides[lines[i].sidenum[1]].text) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[1], sides[lines[i].sidenum[1]].text, strlen(sides[lines[i].sidenum[1]].text) + 1);
}
else
P_WriteConstant((lines[i].flags & ML_NOCLIMB) ? -1 : (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS), &lines[i].stringargs[1]);
break;*/
P_WriteConstant((lines[i].flags & ML_NOCLIMB) ? -1 : (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS), &lines[i].stringargs[1], "Powers", i);
break;
case 435: //Change plane scroller direction
lines[i].args[0] = tag;
lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;

View file

@ -3208,6 +3208,18 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
//bot->flags2 = (bot->flags2 & ~MF2_OBJECTFLIP) | (mo->flags2 & MF2_OBJECTFLIP);
break;
case 434: // Custom Power
if (mo && mo->player)
{
powertype_t power = line->stringargs[0] ? get_number(line->stringargs[0]) : 0;
INT32 value = line->stringargs[1] ? get_number(line->stringargs[1]) : 0;
if (value == -1) // 'Infinite'
value = UINT16_MAX;
mo->player->powers[power] = value;
}
break;
case 435: // Change scroller direction
{
scroll_t *scroller;

View file

@ -1683,11 +1683,11 @@ static void P_CheckQuicksand(player_t *player)
//
static void P_CheckInvincibilityTimer(player_t *player)
{
if (!player->invincibilitytimer)
if (!player->powers[pw_invulnerability] && !player->invincibilitytimer)
return;
// Resume normal music stuff.
if (player->invincibilitytimer == 1)
if (player->invincibilitytimer == 1 || player->powers[pw_invulnerability] == 1)
{
//K_KartResetPlayerColor(player); -- this gets called every tic anyways
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
@ -4078,7 +4078,7 @@ void P_PlayerThink(player_t *player)
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
// "Blur" a bit when you have speed shoes and are going fast enough
if ((player->driftboost || player->sneakertimer || player->startboost || player->ringboost) && !player->invincibilitytimer // SRB2kart
if ((player->powers[pw_super] || player->powers[pw_sneakers] || player->driftboost || player->sneakertimer || player->startboost || player->ringboost) && !player->invincibilitytimer // SRB2kart
&& (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale))
{
UINT8 i;
@ -4110,7 +4110,13 @@ void P_PlayerThink(player_t *player)
if (player->bumpertime)
player->bumpertime--;
// Strength counts up to diminish fade.
// Strength counts up to diminish fade
if (player->powers[pw_sneakers] && player->powers[pw_sneakers] < UINT16_MAX)
player->powers[pw_sneakers]--;
if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX)
player->powers[pw_invulnerability]--;
if (player->flashing && player->flashing < UINT16_MAX &&
(player->spectator || player->flashing < K_GetKartFlashing(player)))
player->flashing--;