diff --git a/src/d_player.h b/src/d_player.h index 09fcd8eb0..877f65c59 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/k_kart.c b/src/k_kart.c index ef1e3d18b..90a7bd9ba 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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 diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 60f7959b5..9ea6e7399 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) diff --git a/src/p_inter.c b/src/p_inter.c index cf8333dfb..83c58a398 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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: diff --git a/src/p_saveg.c b/src/p_saveg.c index 12afcc5f5..fb767f1d8 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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); diff --git a/src/p_user.c b/src/p_user.c index dd2179fce..a5e9df25a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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)