mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart.git into structgunch
# Conflicts: # src/k_bot.c
This commit is contained in:
commit
d9c9456798
7 changed files with 50 additions and 10 deletions
|
|
@ -274,6 +274,8 @@ typedef struct botvars_s
|
|||
tic_t itemconfirm; // When high enough, they will use their item
|
||||
|
||||
SINT8 turnconfirm; // Confirm turn direction
|
||||
|
||||
tic_t spindashconfirm; // When high enough, they will try spindashing
|
||||
} botvars_t;
|
||||
|
||||
// ========================================================================
|
||||
|
|
|
|||
23
src/k_bot.c
23
src/k_bot.c
|
|
@ -716,9 +716,14 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
{
|
||||
const tic_t difficultyModifier = (TICRATE/6);
|
||||
|
||||
const fixed_t oldSpeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
||||
const fixed_t baseAccel = K_GetNewSpeed(player) - oldSpeed;
|
||||
const fixed_t speedDiff = player->speed - player->lastspeed;
|
||||
|
||||
if (player->spindashboost || player->tiregrease)
|
||||
{
|
||||
// You just released a spindash, you don't need to try again yet, jeez.
|
||||
player->botvars.spindashconfirm = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -756,8 +761,22 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (player->speed < 10*mapobjectscale // Below the speed threshold
|
||||
&& player->speedboost < (FRACUNIT/8)) // If you have other boosts, you can probably trust it.
|
||||
if (speedDiff < (3 * baseAccel / 4))
|
||||
{
|
||||
if (player->botvars.spindashconfirm < BOTSPINDASHCONFIRM)
|
||||
{
|
||||
player->botvars.spindashconfirm++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->botvars.spindashconfirm > 0)
|
||||
{
|
||||
player->botvars.spindashconfirm--;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->botvars.spindashconfirm >= BOTSPINDASHCONFIRM)
|
||||
{
|
||||
INT32 chargingPoint = (K_GetSpindashChargeTime(player) + difficultyModifier);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
// Made it as small as possible without making it look like the bots are twitching constantly.
|
||||
#define BOTTURNCONFIRM 4
|
||||
|
||||
// How many tics without being able to accelerate before we'll let you spindash.
|
||||
#define BOTSPINDASHCONFIRM (TICRATE/4)
|
||||
|
||||
// Point for bots to aim for
|
||||
typedef struct botprediction_s {
|
||||
fixed_t x, y;
|
||||
|
|
|
|||
17
src/k_kart.c
17
src/k_kart.c
|
|
@ -2698,22 +2698,20 @@ SINT8 K_GetForwardMove(player_t *player)
|
|||
return forwardmove;
|
||||
}
|
||||
|
||||
fixed_t K_3dKartMovement(player_t *player)
|
||||
fixed_t K_GetNewSpeed(player_t *player)
|
||||
{
|
||||
const fixed_t accelmax = 4000;
|
||||
const fixed_t p_speed = K_GetKartSpeed(player, true);
|
||||
const fixed_t p_accel = K_GetKartAccel(player);
|
||||
|
||||
fixed_t newspeed, oldspeed, finalspeed;
|
||||
fixed_t movemul = FRACUNIT;
|
||||
fixed_t orig = ORIG_FRICTION;
|
||||
SINT8 forwardmove = K_GetForwardMove(player);
|
||||
|
||||
if (K_PlayerUsesBotMovement(player))
|
||||
{
|
||||
orig = K_BotFrictionRubberband(player, ORIG_FRICTION);
|
||||
}
|
||||
|
||||
// ACCELCODE!!!1!11!
|
||||
oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale);
|
||||
// Don't calculate the acceleration as ever being above top speed
|
||||
if (oldspeed > p_speed)
|
||||
|
|
@ -2721,6 +2719,17 @@ fixed_t K_3dKartMovement(player_t *player)
|
|||
newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), orig);
|
||||
|
||||
finalspeed = newspeed - oldspeed;
|
||||
|
||||
return finalspeed;
|
||||
}
|
||||
|
||||
fixed_t K_3dKartMovement(player_t *player)
|
||||
{
|
||||
fixed_t finalspeed = K_GetNewSpeed(player);
|
||||
|
||||
fixed_t movemul = FRACUNIT;
|
||||
SINT8 forwardmove = K_GetForwardMove(player);
|
||||
|
||||
movemul = abs(forwardmove * FRACUNIT) / 50;
|
||||
|
||||
// forwardmove is:
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ UINT16 K_GetKartFlashing(player_t *player);
|
|||
boolean K_KartKickstart(player_t *player);
|
||||
UINT16 K_GetKartButtons(player_t *player);
|
||||
SINT8 K_GetForwardMove(player_t *player);
|
||||
fixed_t K_GetNewSpeed(player_t *player);
|
||||
fixed_t K_3dKartMovement(player_t *player);
|
||||
boolean K_PlayerEBrake(player_t *player);
|
||||
SINT8 K_Sliptiding(player_t *player);
|
||||
|
|
|
|||
12
src/p_mobj.c
12
src/p_mobj.c
|
|
@ -4878,6 +4878,10 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
case MT_HIDDEN_SLING:
|
||||
P_MaceSceneryThink(mobj);
|
||||
break;
|
||||
case MT_SMALLMACE:
|
||||
case MT_BIGMACE:
|
||||
P_SpawnGhostMobj(mobj)->tics = 8;
|
||||
break;
|
||||
case MT_HOOP:
|
||||
if (mobj->fuse > 1)
|
||||
P_MoveHoop(mobj);
|
||||
|
|
@ -8464,15 +8468,15 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
{
|
||||
if (mobj->flags2 & MF2_BOSSNOTRAP) // "fast" flag
|
||||
{
|
||||
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - (2*mobj->fuse)/3)
|
||||
if ((signed)((mobj->renderflags & RF_TRANSMASK) >> RF_TRANSSHIFT) < (NUMTRANSMAPS-1) - (2*mobj->fuse)/3)
|
||||
// fade out when nearing the end of fuse...
|
||||
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - (2*mobj->fuse)/3) << FF_TRANSSHIFT);
|
||||
mobj->renderflags = (mobj->renderflags & ~RF_TRANSMASK) | (((NUMTRANSMAPS-1) - (2*mobj->fuse)/3) << RF_TRANSSHIFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - mobj->fuse / 2)
|
||||
if ((signed)((mobj->renderflags & RF_TRANSMASK) >> RF_TRANSSHIFT) < (NUMTRANSMAPS-1) - mobj->fuse / 2)
|
||||
// fade out when nearing the end of fuse...
|
||||
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
|
||||
mobj->renderflags = (mobj->frame & ~RF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << RF_TRANSSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -339,6 +339,7 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT32(save_p, players[i].botvars.itemdelay);
|
||||
WRITEUINT32(save_p, players[i].botvars.itemconfirm);
|
||||
WRITESINT8(save_p, players[i].botvars.turnconfirm);
|
||||
WRITEUINT32(save_p, players[i].botvars.spindashconfirm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -589,6 +590,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].botvars.itemdelay = READUINT32(save_p);
|
||||
players[i].botvars.itemconfirm = READUINT32(save_p);
|
||||
players[i].botvars.turnconfirm = READSINT8(save_p);
|
||||
players[i].botvars.spindashconfirm = READUINT32(save_p);
|
||||
|
||||
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue