From 53c7999a1496bf4c049bec717346cb92dafe9f68 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 2 Dec 2023 16:44:07 -0600 Subject: [PATCH] Hardcoding: Cloud player struct variables --- src/d_player.h | 10 ++++++++++ src/lua_playerlib.c | 24 ++++++++++++++++++++++++ src/p_saveg.c | 16 ++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/src/d_player.h b/src/d_player.h index 2f27838bf..711d2c4b3 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -849,6 +849,16 @@ struct player_t fixed_t turbineheight; // height around the turbine boolean turbinespd; // if true, we used a sneaker and get the altpath. + // clouds (AGZ, AHZ, SSZ) + tic_t cloud; // timer while on cloud before launch + tic_t cloudlaunch; // timer set after launch for visuals + tic_t cloudbuf; // make sure we can't bounce off another cloud straight away + + // tulips (AGZ) + tic_t tulip; // timer before you get launched + tic_t tuliplaunch; // timer set after launch for visuals + tic_t tulipbuf; // make sure we can't enter another tulip straight away + // SINT8 lives; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index e7d603c6f..3e706fdab 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -552,6 +552,22 @@ static int player_get(lua_State *L) else if (fastcmp(field,"turbinespd")) lua_pushinteger(L, plr->turbinespd); + //clouds + else if (fastcmp(field,"cloud")) + lua_pushinteger(L, plr->cloud); + else if (fastcmp(field,"cloudlaunch")) + lua_pushinteger(L, plr->cloudlaunch); + else if (fastcmp(field,"cloudbuf")) + lua_pushinteger(L, plr->cloudbuf); + + //tulips + else if (fastcmp(field,"tulip")) + lua_pushinteger(L, plr->tulip); + else if (fastcmp(field,"tuliplaunch")) + lua_pushinteger(L, plr->tuliplaunch); + else if (fastcmp(field,"tulipbuf")) + lua_pushinteger(L, plr->tulipbuf); + else if (fastcmp(field,"charflags")) lua_pushinteger(L, plr->charflags); else if (fastcmp(field,"followitem")) @@ -1035,6 +1051,14 @@ static int player_set(lua_State *L) else if (fastcmp(field,"turbinespd")) plr->turbinespd = luaL_checkinteger(L, 3); + // clouds + else if (fastcmp(field,"cloud")) + plr->cloud = luaL_checkinteger(L, 3); + else if (fastcmp(field,"cloudlaunch")) + plr->cloudlaunch = luaL_checkinteger(L, 3); + else if (fastcmp(field,"cloudbuf")) + plr->cloudbuf = luaL_checkinteger(L, 3); + // else if (fastcmp(field,"charflags")) plr->charflags = (UINT32)luaL_checkinteger(L, 3); diff --git a/src/p_saveg.c b/src/p_saveg.c index 88bb493d7..69fde5aa7 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -625,6 +625,14 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEFIXED(save->p, players[i].turbineheight); WRITEUINT8(save->p, players[i].turbinespd); + WRITEUINT32(save->p, players[i].cloud); + WRITEUINT32(save->p, players[i].cloudlaunch); + WRITEUINT32(save->p, players[i].cloudbuf); + + WRITEUINT32(save->p, players[i].tulip); + WRITEUINT32(save->p, players[i].tuliplaunch); + WRITEUINT32(save->p, players[i].tulipbuf); + // respawnvars_t WRITEUINT8(save->p, players[i].respawn.state); WRITEUINT32(save->p, K_GetWaypointHeapIndex(players[i].respawn.wp)); @@ -1186,6 +1194,14 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].turbineheight = READFIXED(save->p); players[i].turbinespd = (boolean)READUINT8(save->p); + players[i].cloud = (tic_t)READUINT32(save->p); + players[i].cloudlaunch = (tic_t)READUINT32(save->p); + players[i].cloudbuf = (tic_t)READUINT32(save->p); + + players[i].tulip = (tic_t)READUINT32(save->p); + players[i].tuliplaunch = (tic_t)READUINT32(save->p); + players[i].tulipbuf = (tic_t)READUINT32(save->p); + // respawnvars_t players[i].respawn.state = READUINT8(save->p); players[i].respawn.wp = (waypoint_t *)(size_t)READUINT32(save->p);