diff --git a/src/k_kart.c b/src/k_kart.c index 998da51a..90b4837b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1257,8 +1257,6 @@ static void K_UpdateOffroad(player_t *player) if (player->kartstuff[k_offroad] > 0) { - if (kartweight < 1) { kartweight = 1; } if (kartweight > 9) { kartweight = 9; } // Safety Net - // 1872 is the magic number - 35 frames adds up to approximately 65536. 1872/4 = 468/3 = 156 // A higher kart weight means you can stay offroad for longer without losing speed offroad = (1872 + 5*156 - kartweight*156)*offroadstrength; @@ -3871,12 +3869,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source) static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) { const INT32 numsnds = 13; - INT32 class = ((player->kartspeed-1)/3) + (3*((player->kartweight-1)/3)); // engine class number + INT32 class, s, w; // engine class number UINT8 volume = 255; fixed_t volumedampen = 0; INT32 targetsnd = 0; INT32 i; + s = (player->kartspeed-1)/3; + w = (player->kartweight-1)/3; + +#define LOCKSTAT(stat) \ + if (stat < 0) { stat = 0; } \ + if (stat > 2) { stat = 2; } + LOCKSTAT(s); + LOCKSTAT(w); +#undef LOCKSTAT + + class = s+(3*w); + // Silence the engines if (leveltime < 8 || player->spectator || player->exiting) { diff --git a/src/r_things.c b/src/r_things.c index 54b20e17..0ef8ca20 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2680,13 +2680,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) // SRB2kart player->kartspeed = skin->kartspeed; player->kartweight = skin->kartweight; - - // Cheat Checks - if (player->kartspeed < 1) player->kartspeed = 1; - if (player->kartspeed > 9) player->kartspeed = 9; - if (player->kartweight < 1) player->kartweight = 1; - if (player->kartweight > 9) player->kartweight = 9; - // player->normalspeed = skin->normalspeed; player->runspeed = skin->runspeed; @@ -2911,15 +2904,22 @@ void R_AddSkins(UINT16 wadnum) #undef GETSPEED #define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value); - // SRB2kart - GETINT(kartspeed) - GETINT(kartweight) - // GETINT(thrustfactor) GETINT(accelstart) GETINT(acceleration) #undef GETINT +#define GETKARTSTAT(field) \ + else if (!stricmp(stoken, #field)) \ + { \ + skin->field = atoi(value); \ + if (skin->field < 1) skin->field = 1; \ + if (skin->field > 9) skin->field = 9; \ + } + GETKARTSTAT(kartspeed) + GETKARTSTAT(kartweight) +#undef GETKARTSTAT + // custom translation table else if (!stricmp(stoken, "startcolor")) skin->starttranscolor = atoi(value);