- refactored some of WW2GI's gamewar stuff so that it is accessible to ZScript as well.

The features here are useful, the way they were handled not so much. What is there now can also be set from proper definition files instead of CON hacks.
This commit is contained in:
Christoph Oelckers 2022-12-23 10:53:13 +01:00
parent ac1d1a90e0
commit 1462cb5e9d
5 changed files with 24 additions and 6 deletions

View file

@ -3272,6 +3272,11 @@ void loadcons()
}
}
gs.tripbombcontrol = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, nullptr, -1).value();
gs.stickybomb_lifetime = GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, 0).value();
gs.stickybomb_lifetime_var = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, 0).value();
if (isWorldTour())
{
// fix broken secret exit in WT's super secret map.

View file

@ -1181,12 +1181,6 @@ void AddSystemVars()
AddGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar("WEAPON", 0, GAMEVAR_FLAG_READONLY | GAMEVAR_FLAG_SYSTEM);
AddGameVar("WORKSLIKE", 0, GAMEVAR_FLAG_READONLY | GAMEVAR_FLAG_SYSTEM);
AddGameVar("RETURN", 0, GAMEVAR_FLAG_SYSTEM);

View file

@ -44,6 +44,13 @@ struct DukeGameInfo
int16_t max_ammo_amount[MAX_WEAPONS];
int16_t weaponsandammosprites[15];
int displayflags;
// global gamevars from WW2GI. Put here so we can modify these values without having to depend on CON.
int tripbombcontrol;
int stickybomb_lifetime;
int stickybomb_lifetime_var;
int grenade_lifetime;
int grenade_lifetime_var;
};
extern DukeGameInfo gs;

View file

@ -1426,6 +1426,12 @@ DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, impact_damage);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, playerheight);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, gutsscale);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, displayflags);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, tripbombcontrol);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, stickybomb_lifetime);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, stickybomb_lifetime_var);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, grenade_lifetime);
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, grenade_lifetime_var);
DEFINE_GLOBAL_UNSIZED(gs)
DEFINE_FIELD_X(DukeUserDefs, user_defs, god);

View file

@ -462,6 +462,12 @@ struct DukeGameInfo native
readonly native double playerheight;
readonly native double gutsscale;
readonly native int displayflags;
readonly native int tripbombcontrol;
readonly native int stickybomb_lifetime;
readonly native int stickybomb_lifetime_var;
readonly native int grenade_lifetime;
readonly native int grenade_lifetime_var;
}