| 1 |
// |
| 2 |
// Copyright(C) 2021 by Ryan Krafnick |
| 3 |
// |
| 4 |
// This program is free software; you can redistribute it and/or |
| 5 |
// modify it under the terms of the GNU General Public License |
| 6 |
// as published by the Free Software Foundation; either version 2 |
| 7 |
// of the License, or (at your option) any later version. |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU General Public License for more details. |
| 13 |
// |
| 14 |
// DESCRIPTION: |
| 15 |
// DSDA Death |
| 16 |
// |
| 17 |
|
| 18 |
#include "doomstat.h" |
| 19 |
#include "d_player.h" |
| 20 |
#include "v_video.h" |
| 21 |
|
| 22 |
#include "dsda/configuration.h" |
| 23 |
#include "dsda/excmd.h" |
| 24 |
#include "dsda/mapinfo.h" |
| 25 |
#include "dsda/save.h" |
| 26 |
#include "dsda/skill_info.h" |
| 27 |
|
| 28 |
#include "death.h" |
| 29 |
|
| 30 |
extern int inv_ptr; |
| 31 |
extern int curpos; |
| 32 |
extern int newtorch; |
| 33 |
extern int newtorchdelta; |
| 34 |
|
| 35 |
typedef enum { |
| 36 |
death_use_default, |
| 37 |
death_use_nothing, |
| 38 |
death_use_reload, |
| 39 |
} death_use_action_t; |
| 40 |
|
| 41 |
static int dsda_DeathUseAction(void) |
| 42 |
{ |
| 43 |
if (demorecording || |
| 44 |
demoplayback || |
| 45 |
map_info.flags & MI_ALLOW_RESPAWN || |
| 46 |
skill_info.flags & SI_PLAYER_RESPAWN) |
| 47 |
return death_use_default; |
| 48 |
|
| 49 |
return dsda_IntConfig(dsda_config_death_use_action); |
| 50 |
} |
| 51 |
|
| 52 |
void dsda_DeathUse(player_t* player) { |
| 53 |
switch (dsda_DeathUseAction()) |
| 54 |
{ |
| 55 |
case death_use_default: |
| 56 |
default: |
| 57 |
if (raven) |
| 58 |
{ |
| 59 |
if (player == &players[consoleplayer]) |
| 60 |
{ |
| 61 |
V_SetPalette(0); |
| 62 |
inv_ptr = 0; |
| 63 |
curpos = 0; |
| 64 |
newtorch = 0; |
| 65 |
newtorchdelta = 0; |
| 66 |
} |
| 67 |
|
| 68 |
if (hexen) |
| 69 |
{ |
| 70 |
player->mo->special1.i = player->pclass; |
| 71 |
if (player->mo->special1.i > 2) |
| 72 |
{ |
| 73 |
player->mo->special1.i = 0; |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
// Let the mobj know the player has entered the reborn state. Some |
| 78 |
// mobjs need to know when it's ok to remove themselves. |
| 79 |
player->mo->special2.i = 666; |
| 80 |
} |
| 81 |
|
| 82 |
player->playerstate = PST_REBORN; |
| 83 |
break; |
| 84 |
case death_use_nothing: |
| 85 |
break; |
| 86 |
case death_use_reload: |
| 87 |
{ |
| 88 |
int slot = dsda_LastSaveSlot(); |
| 89 |
static int last_load_tic; |
| 90 |
|
| 91 |
if (slot >= 0 && gametic > last_load_tic + 1) { |
| 92 |
last_load_tic = gametic; |
| 93 |
dsda_QueueExCmdLoad(slot); |
| 94 |
} |
| 95 |
} |
| 96 |
break; |
| 97 |
} |
| 98 |
} |