mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add required speed percent
This commit is contained in:
parent
9bc48762a8
commit
c6f69e8f59
4 changed files with 26 additions and 8 deletions
|
|
@ -618,16 +618,29 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs)
|
|||
angle_t pushAngle = ANGLE_MAX;
|
||||
angle_t tireAngle = ANGLE_MAX;
|
||||
fixed_t momentum = INT32_MAX;
|
||||
fixed_t speedValue = INT32_MAX;
|
||||
fixed_t momH = INT32_MAX;
|
||||
fixed_t momV = INT32_MAX;
|
||||
|
||||
momentum = P_AproxDistance(mo->momx, mo->momy);
|
||||
|
||||
if (mo->player != NULL)
|
||||
{
|
||||
tireAngle = (mo->player->drawangle + ANGLE_180);
|
||||
speedValue = K_GetKartSpeedFromStat(mo->player->kartspeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
tireAngle = (mo->angle + ANGLE_180);
|
||||
speedValue = K_GetKartSpeedFromStat(5);
|
||||
}
|
||||
|
||||
speedValue = FixedMul(speedValue, mo->scale);
|
||||
speedValue = FixedMul(speedValue, fs->requiredSpeed);
|
||||
|
||||
if (momentum < speedValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pushAngle = K_MomentumAngle(mo) + ANGLE_180;
|
||||
|
|
@ -662,7 +675,6 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs)
|
|||
dust->momy = mo->momy;
|
||||
dust->momz = P_GetMobjZMovement(mo) / 2;
|
||||
|
||||
momentum = P_AproxDistance(mo->momx, mo->momy);
|
||||
momH = FixedMul(momentum, fs->pushH);
|
||||
momV = FixedMul(momentum, fs->pushV);
|
||||
|
||||
|
|
@ -872,6 +884,8 @@ static void K_FootstepDefaults(t_footstep_t *footstep)
|
|||
footstep->cone = ANGLE_11hh;
|
||||
|
||||
footstep->sfxFreq = 6;
|
||||
footstep->frequency = 1;
|
||||
footstep->requiredSpeed = 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -946,6 +960,14 @@ static void K_ParseFootstepParameter(size_t i, char *param, char *val)
|
|||
{
|
||||
footstep->sfxFreq = (tic_t)atoi(val);
|
||||
}
|
||||
else if (stricmp(param, "frequency") == 0)
|
||||
{
|
||||
footstep->frequency = (tic_t)atoi(val);
|
||||
}
|
||||
else if (stricmp(param, "requiredSpeed") == 0)
|
||||
{
|
||||
footstep->requiredSpeed = FLOAT_TO_FIXED(atof(val));
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ typedef struct t_footstep_s
|
|||
angle_t cone; // Randomized angle of the push-out.
|
||||
|
||||
tic_t sfxFreq; // How frequently to play the sound.
|
||||
tic_t frequency; // How frequently to spawn the particles.
|
||||
fixed_t requiredSpeed; // Speed percentage you need to be at to trigger the particles.
|
||||
} t_footstep_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
|||
|
|
@ -494,9 +494,6 @@ static int mobj_set(lua_State *L)
|
|||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter mobj_t in CMD building code!");
|
||||
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter mobj_t in BuildCMD code!");
|
||||
|
||||
switch(field)
|
||||
{
|
||||
case mobj_valid:
|
||||
|
|
|
|||
|
|
@ -499,9 +499,6 @@ static int player_set(lua_State *L)
|
|||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in CMD building code!");
|
||||
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in BuildCMD code!");
|
||||
|
||||
if (fastcmp(field,"mo")) {
|
||||
mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
plr->mo->player = NULL; // remove player pointer from old mobj
|
||||
|
|
@ -861,7 +858,7 @@ static int karthud_set(lua_State *L)
|
|||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||
if (hook_cmd_running)
|
||||
return luaL_error(L, "Do not alter player_t in BuildCMD code!");
|
||||
return luaL_error(L, "Do not alter player_t in CMD building code!");
|
||||
karthud[ks] = i;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue