mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 22:00:50 +00:00
Offroad code cleanup
This commit is contained in:
parent
6a14d79cf0
commit
d9f16d2aaf
1 changed files with 7 additions and 18 deletions
25
src/k_kart.c
25
src/k_kart.c
|
@ -1239,9 +1239,8 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo, sector_t *sec)
|
||||||
for (i = 2; i < 5; i++)
|
for (i = 2; i < 5; i++)
|
||||||
{
|
{
|
||||||
if ((sec2 && GETSECSPECIAL(sec2->special, 1) == i)
|
if ((sec2 && GETSECSPECIAL(sec2->special, 1) == i)
|
||||||
|| (P_IsObjectOnRealGround(mo, sec)
|
|| (P_IsObjectOnRealGround(mo, sec) && GETSECSPECIAL(sec->special, 1) == i))
|
||||||
&& GETSECSPECIAL(sec->special, 1) == i))
|
return i-1;
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1258,19 +1257,9 @@ static void K_UpdateOffroad(player_t *player)
|
||||||
fixed_t offroad;
|
fixed_t offroad;
|
||||||
sector_t *nextsector = R_PointInSubsector(
|
sector_t *nextsector = R_PointInSubsector(
|
||||||
player->mo->x + player->mo->momx*2, player->mo->y + player->mo->momy*2)->sector;
|
player->mo->x + player->mo->momx*2, player->mo->y + player->mo->momy*2)->sector;
|
||||||
|
UINT8 offroadstrength = K_CheckOffroadCollide(player->mo, nextsector);
|
||||||
|
|
||||||
fixed_t offroadstrength = 0;
|
// If you are in offroad, a timer starts.
|
||||||
|
|
||||||
if (K_CheckOffroadCollide(player->mo, nextsector) == 2) // Weak Offroad
|
|
||||||
offroadstrength = 1;
|
|
||||||
else if (K_CheckOffroadCollide(player->mo, nextsector) == 3) // Mid Offroad
|
|
||||||
offroadstrength = 2;
|
|
||||||
else if (K_CheckOffroadCollide(player->mo, nextsector) == 4) // Strong Offroad
|
|
||||||
offroadstrength = 3;
|
|
||||||
|
|
||||||
// If you are offroad, a timer starts. Depending on your weight value, the timer increments differently.
|
|
||||||
//if ((nextsector->special & 256) && nextsector->special != 768
|
|
||||||
// && nextsector->special != 1024 && nextsector->special != 4864)
|
|
||||||
if (offroadstrength)
|
if (offroadstrength)
|
||||||
{
|
{
|
||||||
if (K_CheckOffroadCollide(player->mo, player->mo->subsector->sector) && player->kartstuff[k_offroad] == 0)
|
if (K_CheckOffroadCollide(player->mo, player->mo->subsector->sector) && player->kartstuff[k_offroad] == 0)
|
||||||
|
@ -1278,7 +1267,7 @@ static void K_UpdateOffroad(player_t *player)
|
||||||
|
|
||||||
if (player->kartstuff[k_offroad] > 0)
|
if (player->kartstuff[k_offroad] > 0)
|
||||||
{
|
{
|
||||||
offroad = (FRACUNIT * offroadstrength) / (TICRATE/2);
|
offroad = (offroadstrength << FRACBITS) / (TICRATE/2);
|
||||||
|
|
||||||
//if (player->kartstuff[k_growshrinktimer] > 1) // grow slows down half as fast
|
//if (player->kartstuff[k_growshrinktimer] > 1) // grow slows down half as fast
|
||||||
// offroad /= 2;
|
// offroad /= 2;
|
||||||
|
@ -1286,8 +1275,8 @@ static void K_UpdateOffroad(player_t *player)
|
||||||
player->kartstuff[k_offroad] += offroad;
|
player->kartstuff[k_offroad] += offroad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_offroad] > FRACUNIT*offroadstrength)
|
if (player->kartstuff[k_offroad] > (offroadstrength << FRACBITS))
|
||||||
player->kartstuff[k_offroad] = FRACUNIT*offroadstrength;
|
player->kartstuff[k_offroad] = (offroadstrength << FRACBITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player->kartstuff[k_offroad] = 0;
|
player->kartstuff[k_offroad] = 0;
|
||||||
|
|
Loading…
Reference in a new issue