Toggle for bananadrag (trailslow)
This commit is contained in:
parent
01ce7b0221
commit
b622ed1333
10 changed files with 76 additions and 2 deletions
|
|
@ -179,6 +179,7 @@ static void KartAntiBump_OnChange(void);
|
|||
static void KartItemBreaker_OnChange(void);
|
||||
static void KartBumpSpark_OnChange(void);
|
||||
static void KartItemList_OnChange(void);
|
||||
static void KartTrailSlow_OnChange(void);
|
||||
|
||||
static void Schedule_OnChange(void);
|
||||
|
||||
|
|
@ -676,6 +677,8 @@ consvar_t cv_kartrecoverydash_spinspeed = CVAR_INIT ("kartrecoverydash_spinspeed
|
|||
|
||||
consvar_t cv_kartkeepstuff = CVAR_INIT ("kartkeepstuff", "No", CV_NETVAR|CV_CALL|CV_NOINIT|CV_GUARD, CV_YesNo, KartKeepStuff_OnChange);
|
||||
|
||||
consvar_t cv_trailslow = CVAR_INIT ("trailslow", "Yes", CV_NETVAR|CV_CALL|CV_NOINIT|CV_GUARD, CV_YesNo, KartTrailSlow_OnChange);
|
||||
|
||||
|
||||
#define ANTIBUMP_MAX (UINT32_MAX / TICRATE)
|
||||
static CV_PossibleValue_t antibump_cons_t[] = {{0, "MIN"}, {ANTIBUMP_MAX, "MAX"}, {0, NULL}};
|
||||
|
|
@ -9917,6 +9920,39 @@ static void KartItemList_OnChange(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void KartTrailSlow_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules(false) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!K_TrailSlowActive() && cv_trailslow.value)
|
||||
{
|
||||
if (leveltime < starttime)
|
||||
{
|
||||
trailslow_active = true;
|
||||
CONS_Printf(M_GetText("Trailing slowdown has been turned \"On\".\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Trailing slowdown will be turned \"On\" Next Round.\n"));
|
||||
}
|
||||
}
|
||||
else if (K_TrailSlowActive() && !cv_trailslow.value)
|
||||
{
|
||||
if (leveltime < starttime)
|
||||
{
|
||||
trailslow_active = false;
|
||||
CONS_Printf(M_GetText("Trailing slowdown has been turned \"Off\".\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Trailing slowdown will be turned \"Off\" next round.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Schedule_OnChange(void)
|
||||
{
|
||||
size_t i;
|
||||
|
|
|
|||
|
|
@ -262,6 +262,8 @@ extern consvar_t cv_kartitemlitter, cv_kartitempush;
|
|||
|
||||
extern consvar_t cv_kartantibump;
|
||||
|
||||
extern consvar_t cv_trailslow;
|
||||
|
||||
extern consvar_t cv_kartforcelegacyodds;
|
||||
|
||||
extern consvar_t cv_handleboostslip;
|
||||
|
|
|
|||
|
|
@ -2683,7 +2683,7 @@ void K_SetScoreboardModStatus(const char *name, SINT8 active)
|
|||
CONS_Alert(CONS_WARNING, "Server mod '%s' does not exist so status cannot be changed.\n", name);
|
||||
}
|
||||
|
||||
#define BASEMODS 20
|
||||
#define BASEMODS 21
|
||||
static void K_DrawServerMods(INT32 x, INT32 y)
|
||||
{
|
||||
UINT8 i, j;
|
||||
|
|
@ -2712,6 +2712,7 @@ static void K_DrawServerMods(INT32 x, INT32 y)
|
|||
{"Bump Spark", 0, NULL, K_GetBumpSpark() > BUMPSPARK_NOCHARGE, true},
|
||||
{"Bump Spring", 0, &cv_kartbumpspring, -1, true},
|
||||
{"Keep Stuff", 0, NULL, K_KeepStuffActive() > 0, true},
|
||||
{"No BananaDrag", 0, NULL, K_TrailSlowActive() < 1, true},
|
||||
//TODO: separate drawer that enumerates item changes?
|
||||
};
|
||||
|
||||
|
|
|
|||
14
src/k_kart.c
14
src/k_kart.c
|
|
@ -490,6 +490,7 @@ void K_RegisterKartStuff(void)
|
|||
CV_RegisterVar(&cv_kartthunder_radius);
|
||||
|
||||
CV_RegisterVar(&cv_kartkeepstuff);
|
||||
CV_RegisterVar(&cv_trailslow);
|
||||
}
|
||||
|
||||
//}
|
||||
|
|
@ -6122,7 +6123,7 @@ static void K_MoveHeldObjects(player_t *player)
|
|||
mobj_t *targ = player->mo;
|
||||
UINT16 pcolor = player->skincolor;
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0)
|
||||
if (P_IsObjectOnGround(player->mo) && player->speed > 0 && trailslow_active)
|
||||
player->bananadrag++;
|
||||
|
||||
while (cur && !P_MobjWasRemoved(cur))
|
||||
|
|
@ -11899,6 +11900,17 @@ boolean K_ItemPushingActive(void)
|
|||
return itempushing;
|
||||
}
|
||||
|
||||
boolean K_TrailSlowActive(void)
|
||||
{
|
||||
if (trailslow_active)
|
||||
{
|
||||
// Trailing slowdown is enabled! (what a drag...)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean K_UsingLegacyCheckpoints(void)
|
||||
{
|
||||
if (K_UsingPatchedMap() && waypointcap != NULL)
|
||||
|
|
|
|||
|
|
@ -389,6 +389,7 @@ boolean K_KeepStuffActive(void);
|
|||
boolean K_ItemLitterActive(void);
|
||||
boolean K_ItemListActive(void);
|
||||
boolean K_ItemPushingActive(void);
|
||||
boolean K_TrailSlowActive(void);
|
||||
INT32 K_GetBumpSpark(void);
|
||||
boolean K_BoostChain(player_t *player, INT32 timer, boolean chainsound);
|
||||
INT32 K_ChainOrDeincrementTime(player_t *player, INT32 timer, INT32 deincrement, boolean chainsound);
|
||||
|
|
|
|||
|
|
@ -4588,6 +4588,13 @@ static int lib_kItemListActive(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Checks if trailing slowdown is active.
|
||||
static int lib_kTrailSlowActive(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, K_TrailSlowActive());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Gets the currently active bumpspark type.
|
||||
static int lib_kGetBumpSpark(lua_State *L)
|
||||
{
|
||||
|
|
@ -5952,6 +5959,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_KeepStuffActive",lib_kKeepStuffActive},
|
||||
{"K_ItemLitterActive",lib_kItemLitterActive},
|
||||
{"K_ItemListActive", lib_kItemListActive},
|
||||
{"K_TrailSlowActive", lib_kTrailSlowActive},
|
||||
{"K_GetBumpSpark",lib_kGetBumpSpark},
|
||||
{"K_UsingLegacyCheckpoints",lib_kUsingLegacyCheckpoints},
|
||||
{"K_DoBoost",lib_kDoBoost},
|
||||
|
|
|
|||
|
|
@ -432,6 +432,9 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
} else if (fastcmp(word,"itempushing")) {
|
||||
lua_pushboolean(L, itempushing); // hmm... i think this should be a boolean
|
||||
return 1;
|
||||
} else if (fastcmp(word,"trailslow_active") || fastcmp(word,"trailslowactive")) {
|
||||
lua_pushinteger(L, trailslow_active);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"hyubgone")) {
|
||||
lua_pushinteger(L, K_GetKartResult("hyudoro")->cooldown);
|
||||
return 1;
|
||||
|
|
@ -614,6 +617,10 @@ int LUA_WriteGlobals(lua_State *L, const char *word)
|
|||
keepstuffactive = (boolean)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word,"itempushing"))
|
||||
itempushing = (boolean)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word,"trailslowactive"))
|
||||
trailslow_active = (boolean)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word,"trailslow_active"))
|
||||
trailslow_active = (boolean)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word,"gamespeed"))
|
||||
gamespeed = (UINT8)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word,"nummapboxes"))
|
||||
|
|
|
|||
|
|
@ -634,6 +634,7 @@ extern boolean itemlittering;
|
|||
extern boolean itempushing;
|
||||
extern UINT8 bumpsparkactive;
|
||||
extern boolean itemlistactive;
|
||||
extern boolean trailslow_active;
|
||||
extern UINT16 bossdisabled;
|
||||
extern boolean stoppedclock;
|
||||
|
||||
|
|
|
|||
|
|
@ -4348,6 +4348,7 @@ static boolean P_NetSyncMisc(savebuffer_t *save, boolean resending)
|
|||
SYNCBOOLEAN(itemlittering);
|
||||
SYNCBOOLEAN(itempushing);
|
||||
SYNCBOOLEAN(itemlistactive);
|
||||
SYNCBOOLEAN(trailslow_active);
|
||||
SYNC(airdropactive);
|
||||
SYNC(bumpsparkactive);
|
||||
SYNC(antibumptime);
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ boolean itemlittering;
|
|||
boolean itempushing;
|
||||
UINT8 bumpsparkactive;
|
||||
boolean itemlistactive;
|
||||
boolean trailslow_active = false;
|
||||
UINT16 bossdisabled;
|
||||
boolean stoppedclock;
|
||||
boolean levelloading;
|
||||
|
|
@ -8251,6 +8252,7 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
|
|||
itemlittering = false;
|
||||
itempushing = false;
|
||||
itemlistactive = false;
|
||||
trailslow_active = false;
|
||||
bumpsparkactive = 0;
|
||||
antibumptime = 0;
|
||||
|
||||
|
|
@ -8298,6 +8300,9 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
|
|||
if (cv_itemlist.value)
|
||||
itemlistactive = true;
|
||||
|
||||
if (cv_trailslow.value)
|
||||
trailslow_active = true;
|
||||
|
||||
bumpsparkactive = (UINT8)cv_kartbumpspark.value;
|
||||
|
||||
antibumptime = (tic_t)cv_kartantibump.value * TICRATE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue