Be more consistent with how we lock kartspeed/kartweight

- The skin values are now locked between 1 and 9.
- kartspeed & kartweight are no longer locked on skin-switch. Combined with the above, this results in no gameplay change, other than the character select showing the proper value.
- Values used for the engine sounds are locked. No longer can overflow into character voices or freeslotted sounds.
- Removed the overzealous weight locking when in offroad.

If we want to ACTUALLY lock speed/weight for Lua too then we should do that in the Lua stuff.
This commit is contained in:
TehRealSalt 2018-11-20 02:59:10 -05:00
parent 9a4ebb916a
commit b03d87c80a
2 changed files with 24 additions and 14 deletions

View File

@ -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)
{

View File

@ -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);