Implement PF_SLIDING support

This commit is contained in:
NepDisk 2025-02-21 18:41:18 -05:00
parent 842b7e85b3
commit 437bd25157
3 changed files with 52 additions and 27 deletions

View file

@ -110,7 +110,8 @@ typedef enum
PF_SHRINKME = 1<<24, // "Shrink me" cheat preference
PF_SHRINKACTIVE = 1<<25, // "Shrink me" cheat is in effect. (Can't be disabled mid-race)
// up to 1<<31 is free
// up to 1<<30 is free
PF_SLIDING = 1<<31,
} pflags_t;
typedef enum

View file

@ -236,47 +236,52 @@ const char *const MAPTHINGFLAG_LIST[4] = {
};
const char *const PLAYERFLAG_LIST[] = {
"GODMODE",
"GODMODE", // Immortal.
// free: 1<<1 and 1<<2 (name un-matchable)
"\x01",
"\x01",
// Look back VFX has been spawned
// TODO: Is there a better way to track this?
"GAINAX",
"KICKSTARTACCEL", // Accessibility feature: Is accelerate in kickstart mode?
"\x01",
"\x01",
// Accessibility and cheats
"KICKSTARTACCEL", // Is accelerate in kickstart mode?
"GODMODE",
"NOCLIP",
"WANTSTOJOIN", // Spectator that wants to join
"WANTSTOJOIN", // Spectator that wants to join
"STASIS", // Player is not allowed to move
"SKIDDOWN", // SKIDDOWN
"ELIMINATED", // Battle-style elimination, no extra penalty
"NOCONTEST", // Did not finish (last place explosion)
"LOSTLIFE", // Do not lose life more than once
"STASIS", // Player is not allowed to move
"SKIDDOWN", // SKIDDOWN
"ELIMINATED", // Battle-style elimination, no extra penalty
"NOCONTEST", // Did not finish (last place explosion)
"LOSTLIFE", // Do not lose life more than once
"RINGLOCK", // Prevent picking up rings while locked. Mostly for lua use since SPB no longer locks
"RINGLOCK", // Prevent picking up rings while SPB is locked on
"DRIFTINPUT", // Drifting!
"GETSPARKS", // Can get sparks
"DRIFTEND", // Drift has ended, used to adjust character angle after drift
"BRAKEDRIFT", // Helper for brake-drift spark spawning
"DRIFTINPUT", // Drifting!
"GETSPARKS", // Can get sparks
"DRIFTEND", // Drift has ended, used to adjust character angle after drift
"BRAKEDRIFT", // Helper for brake-drift spark spawning
"AIRFAILSAFE", // Whenever or not try the air boost
"AIRFAILSAFE", // Whenever or not try the air boost
"UPDATEMYRESPAWN",
"FLIPCAM",
"\x01",
"HITFINISHLINE", // Already hit the finish line this tic
"WRONGWAY", // Moving the wrong way with respect to waypoints?
"HITFINISHLINE", // Already hit the finish line this tic
"WRONGWAY", // Moving the wrong way with respect to waypoints?
"SHRINKME",
"SHRINKACTIVE",
"SHRINKME", // "Shrink me" cheat preference
"SHRINKACTIVE", // "Shrink me" cheat is in effect. (Can't be disabled mid-race)
"\x01",
"\x01",
"\x01",
"\x01",
"\x01",
"SLIDING",
NULL // stop loop here.
};

View file

@ -393,7 +393,14 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"spheredigestion"))
lua_pushinteger(L, plr->spheredigestion);
else if (fastcmp(field,"pflags"))
lua_pushinteger(L, plr->pflags);
{
UINT32 pflags = plr->pflags;
if (lua_compatmode && (plr->carry & CR_SLIDING) == CR_SLIDING)
pflags |= PF_SLIDING;
lua_pushinteger(L, pflags);
}
else if (fastcmp(field,"panim"))
lua_pushinteger(L, plr->panim);
else if (fastcmp(field,"flashcount"))
@ -589,7 +596,19 @@ static int player_set(lua_State *L)
plr->drawangle = angle;
}
else if (fastcmp(field,"pflags"))
plr->pflags = luaL_checkinteger(L, 3);
{
UINT32 pflags = luaL_checkinteger(L, 3);
if (lua_compatmode)
{
if (pflags & PF_SLIDING)
plr->carry |= CR_SLIDING;
else
plr->carry &= ~CR_SLIDING;
}
plr->pflags = pflags;
}
else if (fastcmp(field,"panim"))
plr->panim = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flashcount"))