Reset After Death

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Reset After Death

Re: Reset After Death

by PKr » Wed Feb 09, 2022 9:08 am

May I ask someone knowledgeable what exactly is the issue with pistol start support and why it cannot be added to GZDoom?

I am looking at g_game.cpp in GZDoom 4.7.1 right now:

Code: Select all

void FLevelLocals::DoReborn (int playernum, bool freshbot)
{
	if (!multiplayer && !(flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn &&
		!G_SkillProperty(SKILLP_PlayerRespawn))
	{
		if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()))
		{ // Load game from the last point it was saved
			savename = BackupSaveName;
			gameaction = ga_autoloadgame;
		}
		else
		{ // Reload the level from scratch
			bool indemo = demoplayback;
			BackupSaveName = "";
			G_InitNew (MapName, false);
			demoplayback = indemo;
		}
	}
Why exactly can't this solution work?

if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()) && Options.getSomeNewRandomCvar() == 0)
{ // Load game from the last point it was saved
savename = BackupSaveName;
gameaction = ga_autoloadgame;
}

For example... I've added

Code: Select all

CVAR(Bool, pistolstartafterdeath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
doommenu.cpp

and changed g_game.cpp to

Code: Select all

//
// G_DoReborn
//
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
EXTERN_CVAR(Bool, pistolstartafterdeath)
void FLevelLocals::DoReborn (int playernum, bool freshbot)
{
	if (!multiplayer && !(flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn &&
		!G_SkillProperty(SKILLP_PlayerRespawn))
	{
		if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()) && !pistolstartafterdeath)
		{ // Load game from the last point it was saved
			savename = BackupSaveName;
			gameaction = ga_autoloadgame;
		}
...and everything works perfectly? And if I'll ever play mods/wads which would require to start the game from the save file, I would just set pistolstartafterdeath to 0.

I am not a coder, so please explain what's wrong with this solution?

Re: Reset After Death

by DovahClown » Tue Jan 14, 2020 2:20 pm

Apeirogon wrote:Gzdoom autosaves at the beginning of the each level, except first, so you could just load last autosave. If you dont turn it off of course.
Load last autosave is the issue. I want the ability to autosave or manual without it using that save when I die. Say i have a shotgun, a pistol, and 100 armor in E4M1. Then I beat that level and move on to E4M2. I still have the pistol, shotgun, and 100 armor. Then I die and restart E4M2 with no armor, no shotgun, and only a pistol. That's what I want GZDoom to do.

Edit: The only thing I've been able to find is to turn off auto saves and then make a manual save when I'm done playing for the day, then delete it right after loading up. That seems to be the only way to avoid reloading after death and have correct PAR Times.

Edit Edit: Nevermind. PAR Times are incorrect even with the "Save, Load, Delete Save" Method. It seems the only way to get correct PAR Times is to allow the game to load from the last save upon death. I was never big into PAR times anyway. I'll just use the "Bind X map *" that was suggested instead. Even if the DEVs don't implement my suggestion, this is still the best source port. It puts all Bethesda's official Ports to shame. Even their new Unity Port isn't nearly as good as GZDoom.

Re: Reset After Death

by Apeirogon » Tue Jan 14, 2020 1:41 pm

Gzdoom autosaves at the beginning of the each level, except first, so you could just load last autosave. If you dont turn it off of course.

Re: Reset After Death

by Matt » Tue Jan 14, 2020 1:34 pm

This does seem like the sort of very well known, intentional original behaviour that doesn't get in the way of any other stuff (rendering, etc.) that seems like GZDoom should support natively without requiring the user to load third-party software... half the time I'm even reminded to think about this I'm not 100% sure it isn't an option already.

Re: Reset After Death

by DovahClown » Mon Jan 13, 2020 10:32 pm

m8f wrote:Just noting that this probably could be done in a mod. It would consist of two main parts:
1. A script that toggles a user cvar according to current dead/alive status.
2. Assignable key that checks that cvar and calls "map *" or "+use" ("-use" must be accounted here, too).

Or, maybe just binding "map *" to a key in console would suffice:

Code: Select all

bind X "map *"
and hit that key instead of space after death.

Anyway, I wouldn't hold high hopes for this option to be added to the engine. It's up to engine devs, of course.
I hope the devs add it, but in the meantime I will take your suggestion on binding.
Edit: Only issue I found with Map * is the PAR time Counter is reset after using it. PAR times have never been a big deal, but it would still be better if there was a mod that could enable restart after death or if the devs put it in the engine.

Re: Reset After Death

by m8f » Mon Jan 13, 2020 10:23 pm

Just noting that this probably could be done in a mod. It would consist of two main parts:
1. A script that toggles a user cvar according to current dead/alive status.
2. Assignable key that checks that cvar and calls "map *" or "+use" ("-use" must be accounted here, too).

Or, maybe just binding "map *" to a key in console would suffice:

Code: Select all

bind X "map *"
and hit that key instead of space after death.

Anyway, I wouldn't hold high hopes for this option to be added to the engine. It's up to engine devs, of course.

Reset After Death

by DovahClown » Mon Jan 13, 2020 9:49 pm

Currently if you die, you press the spacebar and you reload the last save. I think there should be an option to restart instead. Yes, you could warp to the current map or don't save at all, but I feel there should be an option in the settings that allows you to choose whether you want to reload from last save upon death or restart the map. There are many features I find GZDoom has that is a significant improvement over the original DOS version, but there are also feel there are features in the DOS version that was done perfectly. Restarting the map and losing all equipment as a punishment for dying was one feature DOS did perfectly. It made me want to avoid death at all costs so I could take my equipment to the next level. I only used saving for when I wanted to stop playing for the day or had to do something. There is a mod that allows you to do a pistol start, but it doesn't affect the death restart mechanic at all. It just makes it so you only have a pistol at the start of each level. I want to keep my equipment when I go to the next level and lose it if I die. That mod did the reverse of what I wanted. Any chance this can be added as an option?

Top