Merge branch 'ultra-die' into 'master'

When hit at -20 rings, die

See merge request KartKrew/Kart!1261
This commit is contained in:
Oni 2023-06-02 04:44:59 +00:00
commit 1ee6d196aa
6 changed files with 33 additions and 1 deletions

View file

@ -750,6 +750,8 @@ struct player_t
INT16 incontrol; // -1 to -175 when spinning out or tumbling, 1 to 175 when not. Use to check for combo hits or emergency inputs.
boolean markedfordeath;
uint8_t public_key[PUBKEYLENGTH];
#ifdef HWRENDER

View file

@ -4170,6 +4170,14 @@ static void K_HandleTumbleBounce(player_t *player)
player->tumbleHeight = (player->tumbleHeight * ((player->tumbleHeight > 100) ? 3 : 4)) / 5;
player->pflags &= ~PF_TUMBLESOUND;
if (player->markedfordeath)
{
player->markedfordeath = false;
P_StartQuakeFromMobj(5, 32 * player->mo->scale, 512 * player->mo->scale, player->mo);
P_KillMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
return;
}
if (player->tumbleHeight < 10)
{
// 10 minimum bounce height

View file

@ -249,6 +249,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->justDI);
else if (fastcmp(field,"flipDI"))
lua_pushboolean(L, plr->flipDI);
else if (fastcmp(field,"markedfordeath"))
lua_pushboolean(L, plr->markedfordeath);
else if (fastcmp(field,"drift"))
lua_pushinteger(L, plr->drift);
else if (fastcmp(field,"driftcharge"))
@ -647,6 +649,8 @@ static int player_set(lua_State *L)
plr->justDI = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flipDI"))
plr->flipDI = luaL_checkboolean(L, 3);
else if (fastcmp(field,"markedfordeath"))
plr->markedfordeath = luaL_checkboolean(L, 3);
else if (fastcmp(field,"drift"))
plr->drift = luaL_checkinteger(L, 3);
else if (fastcmp(field,"driftcharge"))

View file

@ -2179,7 +2179,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
else
{
const UINT8 type = (damagetype & DMG_TYPEMASK);
UINT8 type = (damagetype & DMG_TYPEMASK);
const boolean hardhit = (type == DMG_EXPLODE || type == DMG_KARMA || type == DMG_TUMBLE); // This damage type can do evil stuff like ALWAYS combo
INT16 ringburst = 5;
@ -2398,6 +2398,15 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
}
if (player->rings <= -20)
{
player->markedfordeath = true;
damagetype = DMG_TUMBLE;
type = DMG_TUMBLE;
P_StartQuakeFromMobj(5, 32 * player->mo->scale, 512 * player->mo->scale, player->mo);
//P_KillPlayer(player, inflictor, source, damagetype);
}
switch (type)
{
case DMG_STING:

View file

@ -431,6 +431,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].guardCooldown);
WRITEINT16(save->p, players[i].incontrol);
WRITEUINT8(save->p, players[i].markedfordeath);
// respawnvars_t
WRITEUINT8(save->p, players[i].respawn.state);
WRITEUINT32(save->p, K_GetWaypointHeapIndex(players[i].respawn.wp));
@ -824,6 +826,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].guardCooldown = READUINT8(save->p);
players[i].incontrol = READINT16(save->p);
players[i].markedfordeath = READUINT8(save->p);
// respawnvars_t
players[i].respawn.state = READUINT8(save->p);
players[i].respawn.wp = (waypoint_t *)(size_t)READUINT32(save->p);

View file

@ -4372,10 +4372,15 @@ void P_PlayerThink(player_t *player)
K_RespawnChecker(player);
player->rmomx = player->rmomy = 0;
player->markedfordeath = false; // In case we got here via a death sector or something.
if (player->respawn.state == RESPAWNST_DROP)
{
// Allows some turning
P_MovePlayer(player);
if (player->rings <= -20) // We got here from death, so give the player a fresh start.
player->rings = 5;
}
}
else if (player->mo->reactiontime)