Allow reading and writing *time variables from SOC and Lua

This should also for simple edits such as extending hyudoro length without janky lua scripts
This commit is contained in:
NepDisk 2025-06-24 10:40:21 -04:00
parent fec3c19bd0
commit 02196b622c
6 changed files with 128 additions and 9 deletions

View file

@ -3209,6 +3209,47 @@ void readmaincfg(MYFILE *f)
{
ammoremovaltics = get_number(word2);
}
// BlanKart: Easy ways to set these for balance purposes
else if (fastcmp(word, "HYUDOROTIME"))
{
hyudorotime = get_number(word2);
}
else if (fastcmp(word, "STEALTIME"))
{
stealtime = get_number(word2);
}
else if (fastcmp(word, "WATERPANELTIME"))
{
waterpaneltime = get_number(word2);
}
else if (fastcmp(word, "SNEAKERTIME"))
{
sneakertime = get_number(word2);
}
else if (fastcmp(word, "BUBBLETIME"))
{
bubbletime = get_number(word2);
}
else if (fastcmp(word, "COMEBACKTIME"))
{
comebacktime = get_number(word2);
}
else if (fastcmp(word, "GREASETICS"))
{
greasetics = get_number(word2);
}
else if (fastcmp(word, "WIPEOUTSLOWTIME"))
{
wipeoutslowtime = get_number(word2);
}
else if (fastcmp(word, "WANTEDREDUCE"))
{
wantedreduce = get_number(word2);
}
else if (fastcmp(word, "WANTEDFREQUENCY"))
{
wantedfrequency = get_number(word2);
}
else if (fastcmp(word, "INTROTOPLAY"))
{
introtoplay = (UINT8)get_number(word2);
@ -3224,10 +3265,6 @@ void readmaincfg(MYFILE *f)
if (creditscutscene > 128)
creditscutscene = 128;
}
else if (fastcmp(word, "USEBLACKROCK"))
{
useBlackRock = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "LOOPTITLE"))
{
looptitle = (value || word2[0] == 'T' || word2[0] == 'Y');

View file

@ -609,6 +609,7 @@ extern tic_t battleexittime;
extern INT32 hyudorotime;
extern INT32 stealtime;
extern INT32 sneakertime;
extern INT32 waterpaneltime;
extern INT32 itemtime;
extern INT32 bubbletime;
extern INT32 comebacktime;
@ -620,7 +621,6 @@ extern INT32 wantedfrequency;
extern UINT8 introtoplay;
extern UINT8 creditscutscene;
extern UINT8 useBlackRock;
extern UINT8 use1upSound;
extern UINT8 maxXtraLife; // Max extra lives from rings

View file

@ -240,6 +240,7 @@ tic_t battleexittime = 8*TICRATE;
INT32 hyudorotime = 7*TICRATE;
INT32 stealtime = TICRATE/2;
INT32 sneakertime = TICRATE + (TICRATE/3);
INT32 waterpaneltime = TICRATE*2;
INT32 itemtime = 8*TICRATE;
INT32 bubbletime = TICRATE/2;
INT32 comebacktime = 3*TICRATE;
@ -254,7 +255,6 @@ UINT8 maxXtraLife = 2; // Max extra lives from rings
UINT8 introtoplay;
UINT8 creditscutscene;
UINT8 useBlackRock = 1;
// Emerald locations
mobj_t *hunt1;

View file

@ -5535,7 +5535,7 @@ static void K_SneakerPanelEffect(player_t *player, INT32 type)
void K_DoSneaker(player_t *player, INT32 type)
{
const fixed_t intendedboost = K_GetSneakerBoostSpeed();
const tic_t sneakerduration = (type == 3) ? TICRATE*2 : sneakertime;
const tic_t sneakerduration = (type == SNEAKERTYPE_WATERPANEL) ? waterpaneltime : sneakertime;
if (player->floorboost == 0 || player->floorboost == 3)
{
@ -5548,7 +5548,7 @@ void K_DoSneaker(player_t *player, INT32 type)
K_SneakerPanelEffect(player, type);
if (type != 0 && type != 3)
if (type != SNEAKERTYPE_PANEL && type != SNEAKERTYPE_WATERPANEL)
{
K_PlayBoostTaunt(player->mo);
}
@ -5561,7 +5561,7 @@ void K_DoSneaker(player_t *player, INT32 type)
player->numsneakers = CLAMP(player->numsneakers+1, 0, stackingactive ? MAXSNEAKERSTACK : 1);
}
if (type == 3)
if (type == SNEAKERTYPE_WATERPANEL)
{
// Water Running please!
player->mo->flags2 |= MF2_WATERRUN;

View file

@ -365,6 +365,12 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word,"gamespeed")) {
lua_pushinteger(L, gamespeed);
return 1;
} else if (fastcmp(word,"nummapboxes")) {
lua_pushinteger(L, nummapboxes);
return 1;
} else if (fastcmp(word,"numgotboxes")) {
lua_pushinteger(L, numgotboxes);
return 1;
} else if (fastcmp(word,"itembreaker")) {
lua_pushinteger(L, itembreaker);
return 1;
@ -428,6 +434,36 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word, "compatmode")) {
lua_pushboolean(L, lua_compatmode);
return 1;
} else if (fastcmp(word, "hyudorotime")) {
lua_pushinteger(L, hyudorotime);
return 1;
} else if (fastcmp(word, "stealtime")) {
lua_pushinteger(L, stealtime);
return 1;
} else if (fastcmp(word, "sneakertime")) {
lua_pushinteger(L, sneakertime);
return 1;
} else if (fastcmp(word, "waterpaneltime")) {
lua_pushinteger(L, waterpaneltime);
return 1;
} else if (fastcmp(word, "bubbletime")) {
lua_pushinteger(L, bubbletime);
return 1;
} else if (fastcmp(word, "comebacktime")) {
lua_pushinteger(L, comebacktime);
return 1;
} else if (fastcmp(word, "greasetics")) {
lua_pushinteger(L, greasetics);
return 1;
} else if (fastcmp(word, "wipeoutslowtime")) {
lua_pushinteger(L, wipeoutslowtime);
return 1;
} else if (fastcmp(word, "wantedreduce")) {
lua_pushinteger(L, wantedreduce);
return 1;
} else if (fastcmp(word, "wantedfrequency")) {
lua_pushinteger(L, wantedfrequency);
return 1;
} else if (fastcmp(word, "mapnamespace")) {
lua_pushstring(L, P_MapNamespaceString(mapnamespace));
return 1;
@ -513,6 +549,26 @@ int LUA_WriteGlobals(lua_State *L, const char *word)
nummapboxes = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word,"numgotboxes"))
numgotboxes = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "hyudorotime"))
hyudorotime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "stealtime"))
stealtime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "sneakertime"))
sneakertime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "waterpaneltime"))
waterpaneltime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "bubbletime"))
bubbletime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "comebacktime"))
comebacktime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "greasetics"))
greasetics = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "wipeoutslowtime"))
wipeoutslowtime = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "wantedreduce"))
wantedreduce = (INT32)luaL_checkinteger(L, 2);
else if (fastcmp(word, "wantedfrequency"))
wantedfrequency = (INT32)luaL_checkinteger(L, 2);
else
return 0;

View file

@ -5209,6 +5209,7 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
WRITEFIXED(save->p, mapobjectscale);
// SRB2kart
WRITEINT32(save->p, nummapboxes);
WRITEINT32(save->p, numgotboxes);
WRITEUINT8(save->p, numtargets);
WRITEUINT8(save->p, itembreaker);
@ -5239,6 +5240,18 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
WRITEUINT32(save->p, introtime);
WRITEUINT32(save->p, starttime);
WRITEINT32(save->p, hyudorotime);
WRITEINT32(save->p, stealtime);
WRITEINT32(save->p, sneakertime);
WRITEINT32(save->p, itemtime);
WRITEINT32(save->p, bubbletime);
WRITEINT32(save->p, comebacktime);
WRITEINT32(save->p, bumptime);
WRITEINT32(save->p, greasetics);
WRITEINT32(save->p, wipeoutslowtime);
WRITEINT32(save->p, wantedreduce);
WRITEINT32(save->p, wantedfrequency);
WRITEUINT32(save->p, timelimitintics);
WRITEUINT32(save->p, extratimeintics);
WRITEUINT32(save->p, secretextratime);
@ -5379,6 +5392,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
mapobjectscale = READFIXED(save->p);
// SRB2kart
nummapboxes = READINT32(save->p);
numgotboxes = READINT32(save->p);
numtargets = READUINT8(save->p);
itembreaker = (boolean)READUINT8(save->p);
@ -5408,6 +5422,18 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
introtime = READUINT32(save->p);
starttime = READUINT32(save->p);
hyudorotime = READINT32(save->p);
stealtime = READINT32(save->p);
sneakertime = READINT32(save->p);
itemtime = READINT32(save->p);
bubbletime = READINT32(save->p);
comebacktime = READINT32(save->p);
bumptime = READINT32(save->p);
greasetics = READINT32(save->p);
wipeoutslowtime = READINT32(save->p);
wantedreduce = READINT32(save->p);
wantedfrequency = READINT32(save->p);
timelimitintics = READUINT32(save->p);
extratimeintics = READUINT32(save->p);