mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-24 00:42:32 +00:00
Enforce const in bot ticcmds
There were a few remaining cases of bot ticcmd generation editing player structures directly. Fix all of this and make as much of it pass const player pointers so this physically can't be allowed to happen ever again. Appears to improve bot sync in netgames & demos bot support, but I have not tested extensively.
This commit is contained in:
parent
2d4cc49101
commit
abde576c58
15 changed files with 518 additions and 309 deletions
|
|
@ -61,9 +61,10 @@ typedef enum
|
|||
#define TICCMD_LATENCYMASK 0xFF
|
||||
|
||||
// ticcmd flags
|
||||
#define TICCMD_RECEIVED 1
|
||||
#define TICCMD_TYPING 2/* chat window or console open */
|
||||
#define TICCMD_KEYSTROKE 4/* chat character input */
|
||||
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
|
||||
#define TICCMD_TYPING (0x02) /* chat window or console open */
|
||||
#define TICCMD_KEYSTROKE (0x04) /* chat character input */
|
||||
#define TICCMD_BOT (0x80) /* generated by bot, demos write bot variables */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
|
|
@ -79,6 +80,12 @@ struct ticcmd_t
|
|||
UINT16 buttons;
|
||||
UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
|
||||
UINT8 flags;
|
||||
struct
|
||||
{
|
||||
SINT8 turnconfirm;
|
||||
SINT8 spindashconfirm;
|
||||
SINT8 itemconfirm;
|
||||
} bot;
|
||||
} ATTRPACK;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
|
|
|||
68
src/g_demo.c
68
src/g_demo.c
|
|
@ -139,8 +139,13 @@ demoghost *ghosts = NULL;
|
|||
#define ZT_AIMING 0x0040
|
||||
#define ZT_LATENCY 0x0080
|
||||
#define ZT_FLAGS 0x0100
|
||||
#define ZT_BOT 0x8000
|
||||
// Ziptics are UINT16 now, go nuts
|
||||
|
||||
#define ZT_BOT_TURN 0x0001
|
||||
#define ZT_BOT_SPINDASH 0x0002
|
||||
#define ZT_BOT_ITEM 0x0004
|
||||
|
||||
#define DEMOMARKER 0x80 // demobuf.end
|
||||
|
||||
UINT8 demo_extradata[MAXPLAYERS];
|
||||
|
|
@ -544,6 +549,18 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
|||
if (ziptic & ZT_FLAGS)
|
||||
oldcmd[playernum].flags = READUINT8(demobuf.p);
|
||||
|
||||
if (ziptic & ZT_BOT)
|
||||
{
|
||||
UINT16 botziptic = READUINT16(demobuf.p);
|
||||
|
||||
if (botziptic & ZT_BOT_TURN)
|
||||
oldcmd[playernum].bot.turnconfirm = READSINT8(demobuf.p);
|
||||
if (botziptic & ZT_BOT_SPINDASH)
|
||||
oldcmd[playernum].bot.spindashconfirm = READSINT8(demobuf.p);
|
||||
if (botziptic & ZT_BOT_ITEM)
|
||||
oldcmd[playernum].bot.itemconfirm = READSINT8(demobuf.p);
|
||||
}
|
||||
|
||||
G_CopyTiccmd(cmd, &oldcmd[playernum], 1);
|
||||
|
||||
if (!(demoflags & DF_GHOST) && *demobuf.p == DEMOMARKER)
|
||||
|
|
@ -558,10 +575,12 @@ void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
|||
{
|
||||
UINT16 ziptic = 0;
|
||||
UINT8 *ziptic_p;
|
||||
(void)playernum;
|
||||
|
||||
//(void)playernum;
|
||||
|
||||
if (!demobuf.p)
|
||||
return;
|
||||
|
||||
ziptic_p = demobuf.p; // the ziptic, written at the end of this function
|
||||
demobuf.p += 2;
|
||||
|
||||
|
|
@ -621,8 +640,45 @@ void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
|||
ziptic |= ZT_FLAGS;
|
||||
}
|
||||
|
||||
if (cmd->flags & TICCMD_BOT)
|
||||
{
|
||||
ziptic |= ZT_BOT;
|
||||
}
|
||||
|
||||
WRITEUINT16(ziptic_p, ziptic);
|
||||
|
||||
if (ziptic & ZT_BOT)
|
||||
{
|
||||
UINT16 botziptic = 0;
|
||||
UINT8 *botziptic_p;
|
||||
|
||||
botziptic_p = demobuf.p; // the ziptic, written at the end of this function
|
||||
demobuf.p += 2;
|
||||
|
||||
if (cmd->bot.turnconfirm != oldcmd[playernum].bot.turnconfirm)
|
||||
{
|
||||
WRITESINT8(demobuf.p, cmd->bot.turnconfirm);
|
||||
oldcmd[playernum].bot.turnconfirm = cmd->bot.turnconfirm;
|
||||
botziptic |= ZT_BOT_TURN;
|
||||
}
|
||||
|
||||
if (cmd->bot.spindashconfirm != oldcmd[playernum].bot.spindashconfirm)
|
||||
{
|
||||
WRITESINT8(demobuf.p, cmd->bot.spindashconfirm);
|
||||
oldcmd[playernum].bot.spindashconfirm = cmd->bot.spindashconfirm;
|
||||
botziptic |= ZT_BOT_SPINDASH;
|
||||
}
|
||||
|
||||
if (cmd->bot.itemconfirm != oldcmd[playernum].bot.itemconfirm)
|
||||
{
|
||||
WRITESINT8(demobuf.p, cmd->bot.itemconfirm);
|
||||
oldcmd[playernum].bot.itemconfirm = cmd->bot.itemconfirm;
|
||||
botziptic |= ZT_BOT_ITEM;
|
||||
}
|
||||
|
||||
WRITEUINT16(botziptic_p, botziptic);
|
||||
}
|
||||
|
||||
// attention here for the ticcmd size!
|
||||
// latest demos with mouse aiming byte in ticcmd
|
||||
if (!(demoflags & DF_GHOST) && ziptic_p > demobuf.end - 9)
|
||||
|
|
@ -1243,6 +1299,16 @@ readghosttic:
|
|||
g->p++;
|
||||
if (ziptic & ZT_FLAGS)
|
||||
g->p++;
|
||||
if (ziptic & ZT_BOT)
|
||||
{
|
||||
UINT16 botziptic = READUINT16(g->p);
|
||||
if (botziptic & ZT_BOT_TURN)
|
||||
g->p++;
|
||||
if (botziptic & ZT_BOT_SPINDASH)
|
||||
g->p++;
|
||||
if (botziptic & ZT_BOT_ITEM)
|
||||
g->p++;
|
||||
}
|
||||
|
||||
// Grab ghost data.
|
||||
ziptic = READUINT8(g->p);
|
||||
|
|
|
|||
|
|
@ -997,6 +997,11 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
|
|||
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
|
||||
dest[i].latency = src[i].latency;
|
||||
dest[i].flags = src[i].flags;
|
||||
|
||||
if (dest[i].flags & TICCMD_BOT)
|
||||
{
|
||||
dest[i].bot.itemconfirm = src[i].bot.itemconfirm;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
|
|
|||
110
src/k_bot.cpp
110
src/k_bot.cpp
|
|
@ -331,11 +331,11 @@ void K_UpdateMatchRaceBots(void)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_PlayerUsesBotMovement(player_t *player)
|
||||
boolean K_PlayerUsesBotMovement(const player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_PlayerUsesBotMovement(player_t *player)
|
||||
boolean K_PlayerUsesBotMovement(const player_t *player)
|
||||
{
|
||||
if (K_PodiumSequence() == true)
|
||||
return true;
|
||||
|
|
@ -354,7 +354,7 @@ boolean K_PlayerUsesBotMovement(player_t *player)
|
|||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_BotCanTakeCut(player_t *player)
|
||||
boolean K_BotCanTakeCut(const player_t *player)
|
||||
{
|
||||
if (
|
||||
#if 1
|
||||
|
|
@ -374,7 +374,7 @@ boolean K_BotCanTakeCut(player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed)
|
||||
static fixed_t K_BotSpeedScaled(const player_t *player, fixed_t speed)
|
||||
|
||||
What the bot "thinks" their speed is, for predictions.
|
||||
Mainly to make bots brake earlier when on friction sectors.
|
||||
|
|
@ -386,7 +386,7 @@ boolean K_BotCanTakeCut(player_t *player)
|
|||
Return:-
|
||||
The bot's speed value for calculations.
|
||||
--------------------------------------------------*/
|
||||
static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed)
|
||||
static fixed_t K_BotSpeedScaled(const player_t *player, fixed_t speed)
|
||||
{
|
||||
fixed_t result = speed;
|
||||
|
||||
|
|
@ -441,11 +441,11 @@ static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
const botcontroller_t *K_GetBotController(mobj_t *mobj)
|
||||
const botcontroller_t *K_GetBotController(const mobj_t *mobj)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
const botcontroller_t *K_GetBotController(mobj_t *mobj)
|
||||
const botcontroller_t *K_GetBotController(const mobj_t *mobj)
|
||||
{
|
||||
botcontroller_t *ret = nullptr;
|
||||
|
||||
|
|
@ -507,7 +507,7 @@ fixed_t K_BotMapModifier(void)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static UINT32 K_BotRubberbandDistance(player_t *player)
|
||||
static UINT32 K_BotRubberbandDistance(const player_t *player)
|
||||
|
||||
Calculates the distance away from 1st place that the
|
||||
bot should rubberband to.
|
||||
|
|
@ -518,7 +518,7 @@ fixed_t K_BotMapModifier(void)
|
|||
Return:-
|
||||
Distance to add, as an integer.
|
||||
--------------------------------------------------*/
|
||||
static UINT32 K_BotRubberbandDistance(player_t *player)
|
||||
static UINT32 K_BotRubberbandDistance(const player_t *player)
|
||||
{
|
||||
const UINT32 spacing = FixedDiv(640 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)) / FRACUNIT;
|
||||
const UINT8 portpriority = player - players;
|
||||
|
|
@ -560,11 +560,11 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
fixed_t K_BotRubberband(player_t *player)
|
||||
fixed_t K_BotRubberband(const player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
fixed_t K_BotRubberband(player_t *player)
|
||||
fixed_t K_BotRubberband(const player_t *player)
|
||||
{
|
||||
constexpr fixed_t rubberdeltabase = FRACUNIT / 4; // +/- x0.25
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ static fixed_t K_ScaleWPDistWithSlope(fixed_t disttonext, angle_t angletonext, c
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static botprediction_t *K_CreateBotPrediction(player_t *player)
|
||||
static botprediction_t *K_CreateBotPrediction(const player_t *player)
|
||||
|
||||
Calculates a point further along the track to attempt to drive towards.
|
||||
|
||||
|
|
@ -794,7 +794,7 @@ static fixed_t K_ScaleWPDistWithSlope(fixed_t disttonext, angle_t angletonext, c
|
|||
Return:-
|
||||
Bot prediction struct.
|
||||
--------------------------------------------------*/
|
||||
static botprediction_t *K_CreateBotPrediction(player_t *player)
|
||||
static botprediction_t *K_CreateBotPrediction(const player_t *player)
|
||||
{
|
||||
const precise_t time = I_GetPreciseTime();
|
||||
|
||||
|
|
@ -915,7 +915,7 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static UINT8 K_TrySpindash(player_t *player)
|
||||
static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
|
||||
|
||||
Determines conditions where the bot should attempt to spindash.
|
||||
|
||||
|
|
@ -926,7 +926,7 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
|
|||
0 to make the bot drive normally, 1 to e-brake, 2 to e-brake & charge spindash.
|
||||
(TODO: make this an enum)
|
||||
--------------------------------------------------*/
|
||||
static UINT8 K_TrySpindash(player_t *player)
|
||||
static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
const tic_t difficultyModifier = (TICRATE/6);
|
||||
|
||||
|
|
@ -939,7 +939,7 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
if (player->spindashboost || player->tiregrease // You just released a spindash, you don't need to try again yet, jeez.
|
||||
|| P_IsObjectOnGround(player->mo) == false) // Not in a state where we want 'em to spindash.
|
||||
{
|
||||
player->botvars.spindashconfirm = 0;
|
||||
cmd->bot.spindashconfirm = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -997,7 +997,7 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
anyCondition = true;\
|
||||
if (player->botvars.spindashconfirm < BOTSPINDASHCONFIRM) \
|
||||
{ \
|
||||
player->botvars.spindashconfirm++; \
|
||||
cmd->bot.spindashconfirm++; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1039,7 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
{
|
||||
if (player->botvars.spindashconfirm > 0)
|
||||
{
|
||||
player->botvars.spindashconfirm--;
|
||||
cmd->bot.spindashconfirm--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1049,7 +1049,7 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static boolean K_TryRingShooter(player_t *player)
|
||||
static boolean K_TryRingShooter(const player_t *player)
|
||||
|
||||
Determines conditions where the bot should attempt to respawn.
|
||||
|
||||
|
|
@ -1059,7 +1059,7 @@ static UINT8 K_TrySpindash(player_t *player)
|
|||
Return:-
|
||||
true if we want to hold the respawn button, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
static boolean K_TryRingShooter(player_t *player)
|
||||
static boolean K_TryRingShooter(const player_t *player)
|
||||
{
|
||||
if (player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
|
|
@ -1079,15 +1079,11 @@ static boolean K_TryRingShooter(player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Our anti-grief system is already a perfect system
|
||||
// for determining if we're not making progress, so
|
||||
// lets reuse it for bot respawning!
|
||||
P_IncrementGriefValue(player, &player->botvars.respawnconfirm, BOTRESPAWNCONFIRM);
|
||||
return (player->botvars.respawnconfirm >= BOTRESPAWNCONFIRM);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
|
||||
static void K_DrawPredictionDebug(botprediction_t *predict, const player_t *player)
|
||||
|
||||
Draws objects to show where the viewpoint bot is trying to go.
|
||||
|
||||
|
|
@ -1098,7 +1094,7 @@ static boolean K_TryRingShooter(player_t *player)
|
|||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
|
||||
static void K_DrawPredictionDebug(botprediction_t *predict, const player_t *player)
|
||||
{
|
||||
mobj_t *debugMobj = nullptr;
|
||||
angle_t sideAngle = ANGLE_MAX;
|
||||
|
|
@ -1151,7 +1147,7 @@ static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_BotTrick(player_t *player, ticcmd_t *cmd, const botcontroller_t *botController)
|
||||
static void K_BotTrick(const player_t *player, ticcmd_t *cmd, const botcontroller_t *botController)
|
||||
|
||||
Determines inputs for trick panels.
|
||||
|
||||
|
|
@ -1163,7 +1159,7 @@ static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
|
|||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void K_BotTrick(player_t *player, ticcmd_t *cmd, const botcontroller_t *botController)
|
||||
static void K_BotTrick(const player_t *player, ticcmd_t *cmd, const botcontroller_t *botController)
|
||||
{
|
||||
// Trick panel state -- do nothing until a controller line is found, in which case do a trick.
|
||||
if (botController == nullptr)
|
||||
|
|
@ -1192,7 +1188,7 @@ static void K_BotTrick(player_t *player, ticcmd_t *cmd, const botcontroller_t *b
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static angle_t K_BotSmoothLanding(player_t *player, angle_t destangle)
|
||||
static angle_t K_BotSmoothLanding(const player_t *player, angle_t destangle)
|
||||
|
||||
Calculates a new destination angle while in the air,
|
||||
to be able to successfully smooth land.
|
||||
|
|
@ -1204,7 +1200,7 @@ static void K_BotTrick(player_t *player, ticcmd_t *cmd, const botcontroller_t *b
|
|||
Return:-
|
||||
New destination angle.
|
||||
--------------------------------------------------*/
|
||||
static angle_t K_BotSmoothLanding(player_t *player, angle_t destangle)
|
||||
static angle_t K_BotSmoothLanding(const player_t *player, angle_t destangle)
|
||||
{
|
||||
angle_t newAngle = destangle;
|
||||
boolean air = !P_IsObjectOnGround(player->mo);
|
||||
|
|
@ -1241,7 +1237,7 @@ static angle_t K_BotSmoothLanding(player_t *player, angle_t destangle)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *predict)
|
||||
static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botprediction_t *predict)
|
||||
|
||||
Determines inputs for standard track driving.
|
||||
|
||||
|
|
@ -1253,7 +1249,7 @@ static angle_t K_BotSmoothLanding(player_t *player, angle_t destangle)
|
|||
Return:-
|
||||
New value for turn amount.
|
||||
--------------------------------------------------*/
|
||||
static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||
static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||
{
|
||||
// Handle steering towards waypoints!
|
||||
INT32 turnamt = 0;
|
||||
|
|
@ -1341,7 +1337,7 @@ static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static INT32 K_HandleBotReverse(player_t *player, ticcmd_t *cmd, botprediction_t *predict)
|
||||
static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botprediction_t *predict)
|
||||
|
||||
Determines inputs for reversing.
|
||||
|
||||
|
|
@ -1353,7 +1349,7 @@ static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *
|
|||
Return:-
|
||||
New value for turn amount.
|
||||
--------------------------------------------------*/
|
||||
static INT32 K_HandleBotReverse(player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||
static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||
{
|
||||
// Handle steering towards waypoints!
|
||||
INT32 turnamt = 0;
|
||||
|
|
@ -1486,11 +1482,11 @@ static INT32 K_HandleBotReverse(player_t *player, ticcmd_t *cmd, botprediction_t
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_BotPodiumTurning(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BotPodiumTurning(const player_t *player, ticcmd_t *cmd)
|
||||
|
||||
Calculates bot turning for the podium cutscene.
|
||||
--------------------------------------------------*/
|
||||
static void K_BotPodiumTurning(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BotPodiumTurning(const player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
const angle_t destAngle = R_PointToAngle2(
|
||||
player->mo->x, player->mo->y,
|
||||
|
|
@ -1514,11 +1510,11 @@ static void K_BotPodiumTurning(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_BuildBotPodiumTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BuildBotPodiumTiccmd(const player_t *player, ticcmd_t *cmd)
|
||||
|
||||
Calculates all bot movement for the podium cutscene.
|
||||
--------------------------------------------------*/
|
||||
static void K_BuildBotPodiumTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BuildBotPodiumTiccmd(const player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
if (player->currentwaypoint == nullptr)
|
||||
{
|
||||
|
|
@ -1543,11 +1539,11 @@ static void K_BuildBotPodiumTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BuildBotTiccmdNormal(const player_t *player, ticcmd_t *cmd)
|
||||
|
||||
Build ticcmd for bots with a style of BOT_STYLE_NORMAL
|
||||
--------------------------------------------------*/
|
||||
static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
||||
static void K_BuildBotTiccmdNormal(const player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
precise_t t = 0;
|
||||
|
||||
|
|
@ -1597,7 +1593,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (K_TryRingShooter(player) == true)
|
||||
if (K_TryRingShooter(player) == true && player->botvars.respawnconfirm >= BOTRESPAWNCONFIRM)
|
||||
{
|
||||
// We want to respawn. Simply hold Y and stop here!
|
||||
cmd->buttons |= (BT_RESPAWN | BT_EBRAKEMASK);
|
||||
|
|
@ -1751,7 +1747,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
if (trySpindash == true)
|
||||
{
|
||||
// Spindashing
|
||||
spindash = K_TrySpindash(player);
|
||||
spindash = K_TrySpindash(player, cmd);
|
||||
|
||||
if (spindash > 0)
|
||||
{
|
||||
|
|
@ -1790,7 +1786,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
// Count up
|
||||
if (player->botvars.turnconfirm < BOTTURNCONFIRM)
|
||||
{
|
||||
player->botvars.turnconfirm++;
|
||||
cmd->bot.turnconfirm++;
|
||||
}
|
||||
}
|
||||
else if (turnamt < 0)
|
||||
|
|
@ -1798,7 +1794,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
// Count down
|
||||
if (player->botvars.turnconfirm > -BOTTURNCONFIRM)
|
||||
{
|
||||
player->botvars.turnconfirm--;
|
||||
cmd->bot.turnconfirm--;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1806,11 +1802,11 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
// Back to neutral
|
||||
if (player->botvars.turnconfirm < 0)
|
||||
{
|
||||
player->botvars.turnconfirm++;
|
||||
cmd->bot.turnconfirm++;
|
||||
}
|
||||
else if (player->botvars.turnconfirm > 0)
|
||||
{
|
||||
player->botvars.turnconfirm--;
|
||||
cmd->bot.turnconfirm--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1836,7 +1832,9 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
void K_BuildBotTiccmd(
|
||||
player_t *player, // annoyingly NOT const because of LUA_HookTiccmd... grumble grumble
|
||||
ticcmd_t *cmd)
|
||||
{
|
||||
// Remove any existing controls
|
||||
memset(cmd, 0, sizeof(ticcmd_t));
|
||||
|
|
@ -1855,9 +1853,12 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
// their own :)
|
||||
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)) == true)
|
||||
{
|
||||
cmd->flags |= TICCMD_BOT;
|
||||
return;
|
||||
}
|
||||
|
||||
cmd->flags |= TICCMD_BOT;
|
||||
|
||||
if (K_PodiumSequence() == true)
|
||||
{
|
||||
K_BuildBotPodiumTiccmd(player, cmd);
|
||||
|
|
@ -1895,4 +1896,17 @@ void K_UpdateBotGameplayVars(player_t *player)
|
|||
}
|
||||
|
||||
player->botvars.rubberband = K_UpdateRubberband(player);
|
||||
|
||||
player->botvars.turnconfirm += player->cmd.bot.turnconfirm;
|
||||
player->botvars.spindashconfirm += player->cmd.bot.spindashconfirm;
|
||||
|
||||
if (K_TryRingShooter(player) == true)
|
||||
{
|
||||
// Our anti-grief system is already a perfect system
|
||||
// for determining if we're not making progress, so
|
||||
// lets reuse it for bot respawning!
|
||||
P_IncrementGriefValue(player, &player->botvars.respawnconfirm, BOTRESPAWNCONFIRM);
|
||||
}
|
||||
|
||||
K_UpdateBotGameplayVarsItemUsage(player);
|
||||
}
|
||||
|
|
|
|||
45
src/k_bot.h
45
src/k_bot.h
|
|
@ -56,7 +56,7 @@ struct botprediction_t
|
|||
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_PlayerUsesBotMovement(player_t *player);
|
||||
boolean K_PlayerUsesBotMovement(const player_t *player);
|
||||
|
||||
Tells if this player is being controlled via bot movement code (is a bot, or is exiting).
|
||||
|
||||
|
|
@ -67,11 +67,11 @@ struct botprediction_t
|
|||
true if using bot movement code, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_PlayerUsesBotMovement(player_t *player);
|
||||
boolean K_PlayerUsesBotMovement(const player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_BotCanTakeCut(player_t *player);
|
||||
boolean K_BotCanTakeCut(const player_t *player);
|
||||
|
||||
Tells if this bot is able to take shortcuts (currently unaffected by offroad,
|
||||
or has certain items ready).
|
||||
|
|
@ -83,11 +83,11 @@ boolean K_PlayerUsesBotMovement(player_t *player);
|
|||
true if able to take shortcuts, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_BotCanTakeCut(player_t *player);
|
||||
boolean K_BotCanTakeCut(const player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
const botcontroller_t *K_GetBotController(mobj_t *mobj);
|
||||
const botcontroller_t *K_GetBotController(const mobj_t *mobj);
|
||||
|
||||
Retrieves the current bot controller values from
|
||||
the player's current sector.
|
||||
|
|
@ -99,7 +99,7 @@ boolean K_BotCanTakeCut(player_t *player);
|
|||
Pointer to the sector's bot controller struct.
|
||||
--------------------------------------------------*/
|
||||
|
||||
const botcontroller_t *K_GetBotController(mobj_t *mobj);
|
||||
const botcontroller_t *K_GetBotController(const mobj_t *mobj);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -123,7 +123,7 @@ fixed_t K_BotMapModifier(void);
|
|||
|
||||
|
||||
/*--------------------------------------------------
|
||||
fixed_t K_BotRubberband(player_t *player);
|
||||
fixed_t K_BotRubberband(const player_t *player);
|
||||
|
||||
Gives a multiplier for a bot's rubberbanding.
|
||||
Meant to be used for acceleration and handling.
|
||||
|
|
@ -135,7 +135,7 @@ fixed_t K_BotMapModifier(void);
|
|||
A multiplier in fixed point scale.
|
||||
--------------------------------------------------*/
|
||||
|
||||
fixed_t K_BotRubberband(player_t *player);
|
||||
fixed_t K_BotRubberband(const player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -259,7 +259,7 @@ UINT8 K_EggboxStealth(fixed_t x, fixed_t y);
|
|||
true if avoiding this sector, false otherwise.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x, fixed_t y);
|
||||
boolean K_BotHatesThisSector(const player_t *player, sector_t *sec, fixed_t x, fixed_t y);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -275,11 +275,11 @@ boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x, fixed_t
|
|||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player);
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
INT32 K_PositionBully(player_t *player)
|
||||
INT32 K_PositionBully(const player_t *player)
|
||||
|
||||
Calculates a turn value to reach a player that can be bullied.
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player)
|
|||
INT32_MAX if couldn't find anything, otherwise a steering value.
|
||||
--------------------------------------------------*/
|
||||
|
||||
INT32 K_PositionBully(player_t *player);
|
||||
INT32 K_PositionBully(const player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -310,6 +310,23 @@ INT32 K_PositionBully(player_t *player);
|
|||
void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_UpdateBotGameplayVarsItemUsage(player_t *player)
|
||||
|
||||
Updates gamestate affecting botvars, relating to
|
||||
item usage. This must be called for both client
|
||||
and server.
|
||||
|
||||
Input Arguments:-
|
||||
player - Player to whom to update the botvars.
|
||||
|
||||
Return:-
|
||||
N/A
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_UpdateBotGameplayVarsItemUsage(player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_UpdateBotGameplayVars(player_t *player);
|
||||
|
||||
|
|
@ -327,7 +344,7 @@ void K_UpdateBotGameplayVars(player_t *player);
|
|||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt);
|
||||
void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt);
|
||||
|
||||
Item usage part of ticcmd generation.
|
||||
|
||||
|
|
@ -340,7 +357,7 @@ void K_UpdateBotGameplayVars(player_t *player);
|
|||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt);
|
||||
void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
364
src/k_botitem.c
364
src/k_botitem.c
File diff suppressed because it is too large
Load diff
|
|
@ -117,7 +117,7 @@ UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static boolean K_BotHatesThisSectorsSpecial(player_t *player, sector_t *sec)
|
||||
static boolean K_BotHatesThisSectorsSpecial(const player_t *player, sector_t *sec)
|
||||
|
||||
Tells us if a bot will play more careful around
|
||||
this sector's special type.
|
||||
|
|
@ -129,7 +129,7 @@ UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
|
|||
Return:-
|
||||
true if avoiding this sector special, false otherwise.
|
||||
--------------------------------------------------*/
|
||||
static boolean K_BotHatesThisSectorsSpecial(player_t *player, sector_t *sec, const boolean flip)
|
||||
static boolean K_BotHatesThisSectorsSpecial(const player_t *player, sector_t *sec, const boolean flip)
|
||||
{
|
||||
terrain_t *terrain = K_GetTerrainForFlatNum(flip ? sec->ceilingpic : sec->floorpic);
|
||||
|
||||
|
|
@ -162,11 +162,11 @@ static boolean K_BotHatesThisSectorsSpecial(player_t *player, sector_t *sec, con
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x, fixed_t y)
|
||||
boolean K_BotHatesThisSector(const player_t *player, sector_t *sec, fixed_t x, fixed_t y)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
boolean K_BotHatesThisSector(player_t *player, sector_t *sec, fixed_t x, fixed_t y)
|
||||
boolean K_BotHatesThisSector(const player_t *player, sector_t *sec, fixed_t x, fixed_t y)
|
||||
{
|
||||
const boolean flip = (player->mo->eflags & MFE_VERTICALFLIP);
|
||||
fixed_t highestfloor = INT32_MAX;
|
||||
|
|
@ -664,11 +664,11 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player)
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player)
|
||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *player)
|
||||
{
|
||||
const precise_t time = I_GetPreciseTime();
|
||||
|
||||
|
|
@ -948,11 +948,11 @@ static BlockItReturn_t K_FindPlayersToBully(mobj_t *thing)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
INT32 K_PositionBully(player_t *player)
|
||||
INT32 K_PositionBully(const player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
INT32 K_PositionBully(player_t *player)
|
||||
INT32 K_PositionBully(const player_t *player)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
|
||||
|
|
|
|||
102
src/k_kart.c
102
src/k_kart.c
|
|
@ -2830,7 +2830,7 @@ void K_MomentumToFacing(player_t *player)
|
|||
player->mo->momy = FixedMul(player->mo->momy - player->cmomy, player->mo->friction) + player->cmomy;
|
||||
}
|
||||
|
||||
boolean K_ApplyOffroad(player_t *player)
|
||||
boolean K_ApplyOffroad(const player_t *player)
|
||||
{
|
||||
if (player->invincibilitytimer || player->hyudorotimer || player->sneakertimer)
|
||||
return false;
|
||||
|
|
@ -2839,7 +2839,7 @@ boolean K_ApplyOffroad(player_t *player)
|
|||
return true;
|
||||
}
|
||||
|
||||
boolean K_SlopeResistance(player_t *player)
|
||||
boolean K_SlopeResistance(const player_t *player)
|
||||
{
|
||||
if (player->invincibilitytimer || player->sneakertimer || player->tiregrease || player->flamedash)
|
||||
return true;
|
||||
|
|
@ -2848,7 +2848,7 @@ boolean K_SlopeResistance(player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
tripwirepass_t K_TripwirePassConditions(player_t *player)
|
||||
tripwirepass_t K_TripwirePassConditions(const player_t *player)
|
||||
{
|
||||
if (
|
||||
player->invincibilitytimer ||
|
||||
|
|
@ -2871,7 +2871,7 @@ tripwirepass_t K_TripwirePassConditions(player_t *player)
|
|||
return TRIPWIRE_NONE;
|
||||
}
|
||||
|
||||
boolean K_TripwirePass(player_t *player)
|
||||
boolean K_TripwirePass(const player_t *player)
|
||||
{
|
||||
return (player->tripwirePass != TRIPWIRE_NONE);
|
||||
}
|
||||
|
|
@ -3156,7 +3156,7 @@ void K_SpawnWaterRunParticles(mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
|
||||
boolean K_IsRidingFloatingTop(player_t *player)
|
||||
boolean K_IsRidingFloatingTop(const player_t *player)
|
||||
{
|
||||
if (player->curshield != KSHIELD_TOP)
|
||||
{
|
||||
|
|
@ -3166,7 +3166,7 @@ boolean K_IsRidingFloatingTop(player_t *player)
|
|||
return !Obj_GardenTopPlayerIsGrinding(player);
|
||||
}
|
||||
|
||||
boolean K_IsHoldingDownTop(player_t *player)
|
||||
boolean K_IsHoldingDownTop(const player_t *player)
|
||||
{
|
||||
if (player->curshield != KSHIELD_TOP)
|
||||
{
|
||||
|
|
@ -3181,7 +3181,7 @@ boolean K_IsHoldingDownTop(player_t *player)
|
|||
return true;
|
||||
}
|
||||
|
||||
mobj_t *K_GetGardenTop(player_t *player)
|
||||
mobj_t *K_GetGardenTop(const player_t *player)
|
||||
{
|
||||
if (player->curshield != KSHIELD_TOP)
|
||||
{
|
||||
|
|
@ -3202,14 +3202,14 @@ static fixed_t K_FlameShieldDashVar(INT32 val)
|
|||
return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE));
|
||||
}
|
||||
|
||||
INT16 K_GetSpindashChargeTime(player_t *player)
|
||||
INT16 K_GetSpindashChargeTime(const player_t *player)
|
||||
{
|
||||
// more charge time for higher speed
|
||||
// Tails = 1.7s, Knuckles = 2.2s, Metal = 2.7s
|
||||
return ((player->kartspeed + 8) * TICRATE) / 6;
|
||||
}
|
||||
|
||||
fixed_t K_GetSpindashChargeSpeed(player_t *player)
|
||||
fixed_t K_GetSpindashChargeSpeed(const player_t *player)
|
||||
{
|
||||
// more speed for higher weight & speed
|
||||
// Tails = +16.94%, Fang = +34.94%, Mighty = +34.94%, Metal = +43.61%
|
||||
|
|
@ -3406,7 +3406,7 @@ static void K_GetKartBoostPower(player_t *player)
|
|||
player->numboosts = numboosts;
|
||||
}
|
||||
|
||||
fixed_t K_GrowShrinkSpeedMul(player_t *player)
|
||||
fixed_t K_GrowShrinkSpeedMul(const player_t *player)
|
||||
{
|
||||
fixed_t scaleDiff = player->mo->scale - mapobjectscale;
|
||||
fixed_t playerScale = FixedDiv(player->mo->scale, mapobjectscale);
|
||||
|
|
@ -3442,7 +3442,7 @@ fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed)
|
|||
return finalspeed;
|
||||
}
|
||||
|
||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower, boolean dorubberband)
|
||||
fixed_t K_GetKartSpeed(const player_t *player, boolean doboostpower, boolean dorubberband)
|
||||
{
|
||||
const boolean mobjValid = (player->mo != NULL && P_MobjWasRemoved(player->mo) == false);
|
||||
const fixed_t physicsScale = mobjValid ? K_GrowShrinkSpeedMul(player) : FRACUNIT;
|
||||
|
|
@ -3506,7 +3506,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower, boolean dorubberb
|
|||
return finalspeed;
|
||||
}
|
||||
|
||||
fixed_t K_GetKartAccel(player_t *player)
|
||||
fixed_t K_GetKartAccel(const player_t *player)
|
||||
{
|
||||
fixed_t k_accel = 121;
|
||||
UINT8 stat = (9 - player->kartspeed);
|
||||
|
|
@ -3537,7 +3537,7 @@ fixed_t K_GetKartAccel(player_t *player)
|
|||
return k_accel;
|
||||
}
|
||||
|
||||
UINT16 K_GetKartFlashing(player_t *player)
|
||||
UINT16 K_GetKartFlashing(const player_t *player)
|
||||
{
|
||||
UINT16 tics = flashingtics;
|
||||
|
||||
|
|
@ -3555,7 +3555,7 @@ UINT16 K_GetKartFlashing(player_t *player)
|
|||
return tics;
|
||||
}
|
||||
|
||||
boolean K_PlayerShrinkCheat(player_t *player)
|
||||
boolean K_PlayerShrinkCheat(const player_t *player)
|
||||
{
|
||||
return (
|
||||
(player->pflags & PF_SHRINKACTIVE)
|
||||
|
|
@ -3583,20 +3583,20 @@ void K_UpdateShrinkCheat(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
boolean K_KartKickstart(player_t *player)
|
||||
boolean K_KartKickstart(const player_t *player)
|
||||
{
|
||||
return ((player->pflags & PF_KICKSTARTACCEL)
|
||||
&& (!K_PlayerUsesBotMovement(player))
|
||||
&& (player->kickstartaccel >= ACCEL_KICKSTART));
|
||||
}
|
||||
|
||||
UINT16 K_GetKartButtons(player_t *player)
|
||||
UINT16 K_GetKartButtons(const player_t *player)
|
||||
{
|
||||
return (player->cmd.buttons |
|
||||
(K_KartKickstart(player) ? BT_ACCELERATE : 0));
|
||||
}
|
||||
|
||||
SINT8 K_GetForwardMove(player_t *player)
|
||||
SINT8 K_GetForwardMove(const player_t *player)
|
||||
{
|
||||
SINT8 forwardmove = player->cmd.forwardmove;
|
||||
|
||||
|
|
@ -3644,7 +3644,7 @@ SINT8 K_GetForwardMove(player_t *player)
|
|||
return forwardmove;
|
||||
}
|
||||
|
||||
fixed_t K_GetNewSpeed(player_t *player)
|
||||
fixed_t K_GetNewSpeed(const player_t *player)
|
||||
{
|
||||
const fixed_t accelmax = 4000;
|
||||
fixed_t p_speed = K_GetKartSpeed(player, true, true);
|
||||
|
|
@ -3675,7 +3675,7 @@ fixed_t K_GetNewSpeed(player_t *player)
|
|||
return finalspeed;
|
||||
}
|
||||
|
||||
fixed_t K_3dKartMovement(player_t *player)
|
||||
fixed_t K_3dKartMovement(const player_t *player)
|
||||
{
|
||||
fixed_t finalspeed = K_GetNewSpeed(player);
|
||||
|
||||
|
|
@ -8128,7 +8128,7 @@ static void K_UpdateTripwire(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
boolean K_PressingEBrake(player_t *player)
|
||||
boolean K_PressingEBrake(const player_t *player)
|
||||
{
|
||||
return ((K_GetKartButtons(player) & BT_EBRAKEMASK) == BT_EBRAKEMASK);
|
||||
}
|
||||
|
|
@ -9607,7 +9607,7 @@ void K_UpdateDistanceFromFinishLine(player_t *const player)
|
|||
}
|
||||
}
|
||||
|
||||
INT32 K_GetKartRingPower(player_t *player, boolean boosted)
|
||||
INT32 K_GetKartRingPower(const player_t *player, boolean boosted)
|
||||
{
|
||||
fixed_t ringPower = ((9 - player->kartspeed) + (9 - player->kartweight)) * (FRACUNIT/2);
|
||||
fixed_t basePower = ringPower;
|
||||
|
|
@ -9657,7 +9657,7 @@ boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y)
|
|||
|
||||
// countersteer is how strong the controls are telling us we are turning
|
||||
// turndir is the direction the controls are telling us to turn, -1 if turning right and 1 if turning left
|
||||
static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||
static INT16 K_GetKartDriftValue(const player_t *player, fixed_t countersteer)
|
||||
{
|
||||
INT16 basedrift, driftadjust;
|
||||
fixed_t driftweight = player->kartweight*14; // 12
|
||||
|
|
@ -9733,7 +9733,7 @@ INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering)
|
|||
return outputSteering;
|
||||
}
|
||||
|
||||
static fixed_t K_GetUnderwaterStrafeMul(player_t *player)
|
||||
static fixed_t K_GetUnderwaterStrafeMul(const player_t *player)
|
||||
{
|
||||
const fixed_t minSpeed = 11 * player->mo->scale;
|
||||
fixed_t baseline = INT32_MAX;
|
||||
|
|
@ -9743,7 +9743,7 @@ static fixed_t K_GetUnderwaterStrafeMul(player_t *player)
|
|||
return max(0, FixedDiv(player->speed - minSpeed, baseline - minSpeed));
|
||||
}
|
||||
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
||||
INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue)
|
||||
{
|
||||
fixed_t turnfixed = turnvalue * FRACUNIT;
|
||||
|
||||
|
|
@ -9877,7 +9877,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||
return (turnfixed / FRACUNIT);
|
||||
}
|
||||
|
||||
INT32 K_GetUnderwaterTurnAdjust(player_t *player)
|
||||
INT32 K_GetUnderwaterTurnAdjust(const player_t *player)
|
||||
{
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
{
|
||||
|
|
@ -9893,12 +9893,12 @@ INT32 K_GetUnderwaterTurnAdjust(player_t *player)
|
|||
return 0;
|
||||
}
|
||||
|
||||
INT32 K_GetKartDriftSparkValue(player_t *player)
|
||||
INT32 K_GetKartDriftSparkValue(const player_t *player)
|
||||
{
|
||||
return (26*4 + player->kartspeed*2 + (9 - player->kartweight))*8;
|
||||
}
|
||||
|
||||
INT32 K_GetKartDriftSparkValueForStage(player_t *player, UINT8 stage)
|
||||
INT32 K_GetKartDriftSparkValueForStage(const player_t *player, UINT8 stage)
|
||||
{
|
||||
fixed_t mul = FRACUNIT;
|
||||
|
||||
|
|
@ -10625,7 +10625,7 @@ static INT32 K_FlameShieldMax(player_t *player)
|
|||
return min(FLAMESHIELD_MAX, (FLAMESHIELD_MAX / 16) + (disttofinish / distv)); // Ditto for this minimum, old value was 1/16
|
||||
}
|
||||
|
||||
boolean K_PlayerEBrake(player_t *player)
|
||||
boolean K_PlayerEBrake(const player_t *player)
|
||||
{
|
||||
if (player->respawn.state != RESPAWNST_NONE
|
||||
&& (player->respawn.init == true || player->respawn.fromRingShooter == true))
|
||||
|
|
@ -10656,7 +10656,7 @@ boolean K_PlayerEBrake(player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean K_PlayerGuard(player_t *player)
|
||||
boolean K_PlayerGuard(const player_t *player)
|
||||
{
|
||||
if (player->guardCooldown != 0)
|
||||
{
|
||||
|
|
@ -10697,7 +10697,7 @@ boolean K_PlayerGuard(player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
SINT8 K_Sliptiding(player_t *player)
|
||||
SINT8 K_Sliptiding(const player_t *player)
|
||||
{
|
||||
/*
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
|
|
@ -11197,7 +11197,7 @@ static void K_AirFailsafe(player_t *player)
|
|||
//
|
||||
// K_PlayerBaseFriction
|
||||
//
|
||||
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original)
|
||||
fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original)
|
||||
{
|
||||
const fixed_t factor = FixedMul(
|
||||
FixedDiv(FRACUNIT - original, FRACUNIT - ORIG_FRICTION),
|
||||
|
|
@ -11567,6 +11567,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
{
|
||||
whip->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
else if (!(player->instaWhipCharge >= INSTAWHIP_CHARGETIME && P_PlayerInPain(player))) // Allow reversal whip
|
||||
|
|
@ -11599,7 +11601,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
if (player->eggmanexplode)
|
||||
{
|
||||
if (ATTACK_IS_DOWN && player->eggmanexplode <= 3*TICRATE && player->eggmanexplode > 1)
|
||||
{
|
||||
player->eggmanexplode = 1;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
// Eggman Monitor throwing
|
||||
else if (player->itemflags & IF_EGGMANOUT)
|
||||
|
|
@ -11610,6 +11615,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_PlayAttackTaunt(player->mo);
|
||||
player->itemflags &= ~IF_EGGMANOUT;
|
||||
K_UpdateHnextList(player, true);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
// Rocket Sneaker usage
|
||||
|
|
@ -11623,6 +11629,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->rocketsneakertimer = 1;
|
||||
else
|
||||
player->rocketsneakertimer -= 3*TICRATE;
|
||||
player->botvars.itemconfirm = 2*TICRATE;
|
||||
}
|
||||
}
|
||||
else if (player->itemamount == 0)
|
||||
|
|
@ -11639,6 +11646,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_DoSneaker(player, 1);
|
||||
K_PlayBoostTaunt(player->mo);
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_ROCKETSNEAKER:
|
||||
|
|
@ -11672,6 +11680,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&prev->hnext, mo);
|
||||
prev = mo;
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_INVINCIBILITY:
|
||||
|
|
@ -11680,6 +11689,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_DoInvincibility(player, 10 * TICRATE);
|
||||
K_PlayPowerGloatSound(player->mo);
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_BANANA:
|
||||
|
|
@ -11711,6 +11721,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&prev->hnext, mo);
|
||||
prev = mo;
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && (player->itemflags & IF_ITEMOUT)) // Banana x3 thrown
|
||||
{
|
||||
|
|
@ -11718,6 +11729,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_PlayAttackTaunt(player->mo);
|
||||
player->itemamount--;
|
||||
K_UpdateHnextList(player, false);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_EGGMAN:
|
||||
|
|
@ -11739,6 +11751,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&mo->target, player->mo);
|
||||
P_SetTarget(&player->mo->hnext, mo);
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_ORBINAUT:
|
||||
|
|
@ -11774,6 +11787,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&prev->hnext, mo);
|
||||
prev = mo;
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && (player->itemflags & IF_ITEMOUT)) // Orbinaut x3 thrown
|
||||
{
|
||||
|
|
@ -11781,6 +11795,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_PlayAttackTaunt(player->mo);
|
||||
player->itemamount--;
|
||||
K_UpdateHnextList(player, false);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_JAWZ:
|
||||
|
|
@ -11815,6 +11830,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&prev->hnext, mo);
|
||||
prev = mo;
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && HOLDING_ITEM && (player->itemflags & IF_ITEMOUT)) // Jawz thrown
|
||||
{
|
||||
|
|
@ -11822,6 +11838,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_PlayAttackTaunt(player->mo);
|
||||
player->itemamount--;
|
||||
K_UpdateHnextList(player, false);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_MINE:
|
||||
|
|
@ -11841,6 +11858,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&mo->target, player->mo);
|
||||
P_SetTarget(&player->mo->hnext, mo);
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && (player->itemflags & IF_ITEMOUT))
|
||||
{
|
||||
|
|
@ -11849,6 +11867,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->itemamount--;
|
||||
player->itemflags &= ~IF_ITEMOUT;
|
||||
K_UpdateHnextList(player, true);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_LANDMINE:
|
||||
|
|
@ -11857,6 +11876,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->itemamount--;
|
||||
K_ThrowLandMine(player);
|
||||
K_PlayAttackTaunt(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_DROPTARGET:
|
||||
|
|
@ -11876,6 +11896,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&mo->target, player->mo);
|
||||
P_SetTarget(&player->mo->hnext, mo);
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && (player->itemflags & IF_ITEMOUT))
|
||||
{
|
||||
|
|
@ -11884,6 +11905,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->itemamount--;
|
||||
player->itemflags &= ~IF_ITEMOUT;
|
||||
K_UpdateHnextList(player, true);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_BALLHOG:
|
||||
|
|
@ -11966,6 +11988,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|
||||
player->ballhogcharge = 0;
|
||||
player->itemflags &= ~IF_HOLDREADY;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11976,6 +11999,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->itemamount--;
|
||||
K_ThrowKartItem(player, true, MT_SPB, 1, 0, 0);
|
||||
K_PlayAttackTaunt(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_GROW:
|
||||
|
|
@ -12011,6 +12035,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
S_StartSound(player->mo, sfx_kc5a);
|
||||
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_SHRINK:
|
||||
|
|
@ -12019,6 +12044,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_DoShrink(player);
|
||||
player->itemamount--;
|
||||
K_PlayPowerGloatSound(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_LIGHTNINGSHIELD:
|
||||
|
|
@ -12043,6 +12069,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
// ...:dumbestass:
|
||||
player->itemamount--;
|
||||
K_PlayAttackTaunt(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -12050,6 +12077,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
if (player->curshield == KSHIELD_TOP && K_GetGardenTop(player) == NULL)
|
||||
{
|
||||
Obj_GardenTopDeploy(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && NO_HYUDORO)
|
||||
{
|
||||
|
|
@ -12085,6 +12113,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
K_PlayAttackTaunt(player->mo);
|
||||
}
|
||||
}
|
||||
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_BUBBLESHIELD:
|
||||
|
|
@ -12121,6 +12151,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->bubblecool = 0;
|
||||
player->itemflags &= ~IF_HOLDREADY;
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -12207,6 +12238,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
else
|
||||
{
|
||||
player->itemflags |= IF_HOLDREADY;
|
||||
player->botvars.itemconfirm = 3*flamemax/4;
|
||||
|
||||
if (!(gametyperules & GTR_CLOSERPLAYERS) || leveltime % 6 == 0)
|
||||
{
|
||||
|
|
@ -12216,7 +12248,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
if (!player->flamemeter)
|
||||
S_StopSoundByID(player->mo, sfx_fshld3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (player->flamelength > destlen)
|
||||
|
|
@ -12240,6 +12271,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
//K_DoHyudoroSteal(player); // yes. yes they do.
|
||||
Obj_HyudoroDeploy(player->mo);
|
||||
K_PlayAttackTaunt(player->mo);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_POGOSPRING:
|
||||
|
|
@ -12249,6 +12281,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
//K_DoPogoSpring(player->mo, 32<<FRACBITS, 2);
|
||||
P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_POGOSPRING);
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_SUPERRING:
|
||||
|
|
@ -12256,6 +12289,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
{
|
||||
K_AwardPlayerRings(player, 20, true);
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_KITCHENSINK:
|
||||
|
|
@ -12275,6 +12309,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&mo->target, player->mo);
|
||||
P_SetTarget(&player->mo->hnext, mo);
|
||||
}
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
else if (ATTACK_IS_DOWN && HOLDING_ITEM && (player->itemflags & IF_ITEMOUT)) // Sink thrown
|
||||
{
|
||||
|
|
@ -12283,6 +12318,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->itemamount--;
|
||||
player->itemflags &= ~IF_ITEMOUT;
|
||||
K_UpdateHnextList(player, true);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_GACHABOM:
|
||||
|
|
@ -12296,6 +12332,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
? 1 : 0xFF
|
||||
);
|
||||
K_UpdateHnextList(player, false);
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
case KITEM_SAD:
|
||||
|
|
@ -12304,6 +12341,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
{
|
||||
player->sadtimer = stealtime;
|
||||
player->itemamount--;
|
||||
player->botvars.itemconfirm = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
58
src/k_kart.h
58
src/k_kart.h
|
|
@ -99,7 +99,7 @@ void K_SpawnBumpEffect(mobj_t *mo);
|
|||
void K_KartMoveAnimation(player_t *player);
|
||||
void K_KartPlayerHUDUpdate(player_t *player);
|
||||
void K_KartResetPlayerColor(player_t *player);
|
||||
boolean K_PressingEBrake(player_t *player);
|
||||
boolean K_PressingEBrake(const player_t *player);
|
||||
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
||||
void K_KartPlayerAfterThink(player_t *player);
|
||||
angle_t K_MomentumAngleEx(const mobj_t *mo, const fixed_t threshold);
|
||||
|
|
@ -151,15 +151,15 @@ void K_DropHnextList(player_t *player);
|
|||
void K_RepairOrbitChain(mobj_t *orbit);
|
||||
void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player);
|
||||
mobj_t *K_FindJawzTarget(mobj_t *actor, player_t *source, angle_t range);
|
||||
INT32 K_GetKartRingPower(player_t *player, boolean boosted);
|
||||
INT32 K_GetKartRingPower(const player_t *player, boolean boosted);
|
||||
void K_UpdateDistanceFromFinishLine(player_t *const player);
|
||||
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
|
||||
INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering);
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
||||
INT32 K_GetUnderwaterTurnAdjust(player_t *player);
|
||||
INT32 K_GetKartDriftSparkValue(player_t *player);
|
||||
INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue);
|
||||
INT32 K_GetUnderwaterTurnAdjust(const player_t *player);
|
||||
INT32 K_GetKartDriftSparkValue(const player_t *player);
|
||||
INT32 K_StairJankFlip(INT32 value);
|
||||
INT32 K_GetKartDriftSparkValueForStage(player_t *player, UINT8 stage);
|
||||
INT32 K_GetKartDriftSparkValueForStage(const player_t *player, UINT8 stage);
|
||||
void K_SpawnDriftBoostExplosion(player_t *player, int stage);
|
||||
void K_SpawnDriftElectricSparks(player_t *player, int color, boolean shockwave);
|
||||
void K_KartUpdatePosition(player_t *player);
|
||||
|
|
@ -175,37 +175,37 @@ void K_DropKitchenSink(player_t *player);
|
|||
void K_StripItems(player_t *player);
|
||||
void K_StripOther(player_t *player);
|
||||
void K_MomentumToFacing(player_t *player);
|
||||
boolean K_ApplyOffroad(player_t *player);
|
||||
boolean K_SlopeResistance(player_t *player);
|
||||
tripwirepass_t K_TripwirePassConditions(player_t *player);
|
||||
boolean K_TripwirePass(player_t *player);
|
||||
boolean K_ApplyOffroad(const player_t *player);
|
||||
boolean K_SlopeResistance(const player_t *player);
|
||||
tripwirepass_t K_TripwirePassConditions(const player_t *player);
|
||||
boolean K_TripwirePass(const player_t *player);
|
||||
boolean K_MovingHorizontally(mobj_t *mobj);
|
||||
boolean K_WaterRun(mobj_t *mobj);
|
||||
boolean K_WaterSkip(mobj_t *mobj);
|
||||
void K_SpawnWaterRunParticles(mobj_t *mobj);
|
||||
boolean K_IsRidingFloatingTop(player_t *player);
|
||||
boolean K_IsHoldingDownTop(player_t *player);
|
||||
mobj_t *K_GetGardenTop(player_t *player);
|
||||
boolean K_IsRidingFloatingTop(const player_t *player);
|
||||
boolean K_IsHoldingDownTop(const player_t *player);
|
||||
mobj_t *K_GetGardenTop(const player_t *player);
|
||||
void K_ApplyTripWire(player_t *player, tripwirestate_t state);
|
||||
INT16 K_GetSpindashChargeTime(player_t *player);
|
||||
fixed_t K_GetSpindashChargeSpeed(player_t *player);
|
||||
fixed_t K_GrowShrinkSpeedMul(player_t *player);
|
||||
INT16 K_GetSpindashChargeTime(const player_t *player);
|
||||
fixed_t K_GetSpindashChargeSpeed(const player_t *player);
|
||||
fixed_t K_GrowShrinkSpeedMul(const player_t *player);
|
||||
fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed);
|
||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower, boolean dorubberbanding);
|
||||
fixed_t K_GetKartAccel(player_t *player);
|
||||
UINT16 K_GetKartFlashing(player_t *player);
|
||||
boolean K_PlayerShrinkCheat(player_t *player);
|
||||
fixed_t K_GetKartSpeed(const player_t *player, boolean doboostpower, boolean dorubberbanding);
|
||||
fixed_t K_GetKartAccel(const player_t *player);
|
||||
UINT16 K_GetKartFlashing(const player_t *player);
|
||||
boolean K_PlayerShrinkCheat(const player_t *player);
|
||||
void K_UpdateShrinkCheat(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);
|
||||
boolean K_PlayerGuard(player_t *player);
|
||||
SINT8 K_Sliptiding(player_t *player);
|
||||
boolean K_KartKickstart(const player_t *player);
|
||||
UINT16 K_GetKartButtons(const player_t *player);
|
||||
SINT8 K_GetForwardMove(const player_t *player);
|
||||
fixed_t K_GetNewSpeed(const player_t *player);
|
||||
fixed_t K_3dKartMovement(const player_t *player);
|
||||
boolean K_PlayerEBrake(const player_t *player);
|
||||
boolean K_PlayerGuard(const player_t *player);
|
||||
SINT8 K_Sliptiding(const player_t *player);
|
||||
boolean K_FastFallBounce(player_t *player);
|
||||
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original);
|
||||
fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original);
|
||||
void K_AdjustPlayerFriction(player_t *player);
|
||||
void K_MoveKartPlayer(player_t *player, boolean onground);
|
||||
void K_CheckSpectateStatus(boolean considermapreset);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ mobj_t *Obj_GardenTopDestroy(player_t *player);
|
|||
void Obj_GardenTopThink(mobj_t *top);
|
||||
void Obj_GardenTopSparkThink(mobj_t *spark);
|
||||
void Obj_GardenTopArrowThink(mobj_t *arrow);
|
||||
boolean Obj_GardenTopPlayerIsGrinding(player_t *player);
|
||||
boolean Obj_GardenTopPlayerIsGrinding(const player_t *player);
|
||||
|
||||
/* Shrink */
|
||||
void Obj_PohbeeThinker(mobj_t *pohbee);
|
||||
|
|
@ -135,7 +135,7 @@ void Obj_ChargeExtraThink(mobj_t *extra);
|
|||
|
||||
/* Ring Shooter */
|
||||
boolean Obj_RingShooterThinker(mobj_t *mo);
|
||||
boolean Obj_PlayerRingShooterFreeze(player_t *const player);
|
||||
boolean Obj_PlayerRingShooterFreeze(const player_t *player);
|
||||
void Obj_RingShooterInput(player_t *player);
|
||||
void Obj_PlayerUsedRingShooter(mobj_t *base, player_t *player);
|
||||
void Obj_RingShooterDelete(mobj_t *mo);
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ Obj_GardenTopArrowThink (mobj_t *arrow)
|
|||
}
|
||||
|
||||
boolean
|
||||
Obj_GardenTopPlayerIsGrinding (player_t *player)
|
||||
Obj_GardenTopPlayerIsGrinding (const player_t *player)
|
||||
{
|
||||
mobj_t *top = K_GetGardenTop(player);
|
||||
|
||||
|
|
|
|||
|
|
@ -638,7 +638,7 @@ static void SpawnRingShooter(player_t *player)
|
|||
rs_base_playerface(base) = (player - players);
|
||||
}
|
||||
|
||||
static boolean AllowRingShooter(player_t *player)
|
||||
static boolean AllowRingShooter(const player_t *player)
|
||||
{
|
||||
const fixed_t minSpeed = 6 * player->mo->scale;
|
||||
|
||||
|
|
@ -667,9 +667,9 @@ static boolean AllowRingShooter(player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean Obj_PlayerRingShooterFreeze(player_t *const player)
|
||||
boolean Obj_PlayerRingShooterFreeze(const player_t *player)
|
||||
{
|
||||
mobj_t *const base = player->ringShooter;
|
||||
const mobj_t *base = player->ringShooter;
|
||||
|
||||
if (AllowRingShooter(player) == true
|
||||
&& (player->cmd.buttons & BT_RESPAWN) == BT_RESPAWN
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void P_DemoCameraMovement(camera_t *cam, UINT8 num);
|
|||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
void P_ToggleDemoCamera(UINT8 viewnum);
|
||||
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
boolean P_PlayerInPain(const player_t *player);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
boolean P_PlayerCanDamage(player_t *player, mobj_t *thing);
|
||||
|
||||
|
|
@ -166,12 +166,12 @@ void P_SetPlayerAngle(player_t *player, angle_t angle);
|
|||
void P_ForceLocalAngle(player_t *player, angle_t angle);
|
||||
boolean P_PlayerFullbright(player_t *player);
|
||||
|
||||
boolean P_IsObjectInGoop(mobj_t *mo);
|
||||
boolean P_IsObjectOnGround(mobj_t *mo);
|
||||
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec);
|
||||
boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec); // SRB2Kart
|
||||
boolean P_IsObjectInGoop(const mobj_t *mo);
|
||||
boolean P_IsObjectOnGround(const mobj_t *mo);
|
||||
boolean P_IsObjectOnGroundIn(const mobj_t *mo, const sector_t *sec);
|
||||
boolean P_IsObjectOnRealGround(const mobj_t *mo, const sector_t *sec); // SRB2Kart
|
||||
#define P_IsObjectFlipped(o) (((o)->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP)
|
||||
boolean P_InQuicksand(mobj_t *mo);
|
||||
boolean P_InQuicksand(const mobj_t *mo);
|
||||
boolean P_PlayerHitFloor(player_t *player, boolean fromAir, angle_t oldPitch, angle_t oldRoll);
|
||||
|
||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||
|
|
@ -276,8 +276,8 @@ void P_PushableThinker(mobj_t *mobj);
|
|||
void P_SceneryThinker(mobj_t *mobj);
|
||||
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjFloorZ(const mobj_t *mobj, const sector_t *sector, const sector_t *boundsec, fixed_t x, fixed_t y, const line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(const mobj_t *mobj, const sector_t *sector, const sector_t *boundsec, fixed_t x, fixed_t y, const line_t *line, boolean lowest, boolean perfect);
|
||||
#define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(mobj, sector, NULL, x, y, line, false, false)
|
||||
#define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(mobj, sector, NULL, x, y, line, true, false)
|
||||
#define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|
|||
// Supply boundsec ONLY when checking for specials! It should be the "in-level" sector, and sector the control sector (if separate).
|
||||
// If set, then this function will iterate through boundsec's linedefs to find the highest contact point on the slope. Non-special-checking
|
||||
// usage will handle that later.
|
||||
static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line, pslope_t *slope, boolean actuallylowest)
|
||||
static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, const line_t *line, const pslope_t *slope, boolean actuallylowest)
|
||||
{
|
||||
// Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching...
|
||||
// The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box
|
||||
|
|
@ -731,7 +731,7 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
|
|||
);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
fixed_t P_MobjFloorZ(const mobj_t *mobj, const sector_t *sector, const sector_t *boundsec, fixed_t x, fixed_t y, const line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
|
@ -808,7 +808,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
fixed_t P_MobjCeilingZ(const mobj_t *mobj, const sector_t *sector, const sector_t *boundsec, fixed_t x, fixed_t y, const line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
|
|
|||
12
src/p_user.c
12
src/p_user.c
|
|
@ -459,7 +459,7 @@ UINT8 P_FindHighestLap(void)
|
|||
// Is player in pain??
|
||||
// Checks for painstate and flashing, if both found return true
|
||||
//
|
||||
boolean P_PlayerInPain(player_t *player)
|
||||
boolean P_PlayerInPain(const player_t *player)
|
||||
{
|
||||
if (player->spinouttimer || (player->tumbleBounces > 0) || (player->pflags & PF_FAULT) || player->icecube.frozen)
|
||||
return true;
|
||||
|
|
@ -831,7 +831,7 @@ void P_InvincGrowMusic(void)
|
|||
// Returns true if the object is inside goop water.
|
||||
// (Spectators and objects otherwise without gravity cannot have goop gravity!)
|
||||
//
|
||||
boolean P_IsObjectInGoop(mobj_t *mo)
|
||||
boolean P_IsObjectInGoop(const mobj_t *mo)
|
||||
{
|
||||
if (mo->player && mo->player->spectator)
|
||||
return false;
|
||||
|
|
@ -849,7 +849,7 @@ boolean P_IsObjectInGoop(mobj_t *mo)
|
|||
// on the ground. Takes reverse
|
||||
// gravity and FOFs into account.
|
||||
//
|
||||
boolean P_IsObjectOnGround(mobj_t *mo)
|
||||
boolean P_IsObjectOnGround(const mobj_t *mo)
|
||||
{
|
||||
if (P_IsObjectInGoop(mo))
|
||||
{
|
||||
|
|
@ -894,7 +894,7 @@ boolean P_IsObjectOnGround(mobj_t *mo)
|
|||
// on the ground in a specific sector. Takes reverse
|
||||
// gravity and FOFs into account.
|
||||
//
|
||||
boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
||||
boolean P_IsObjectOnGroundIn(const mobj_t *mo, const sector_t *sec)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
|
|
@ -981,7 +981,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
|
|||
// Really simple, but personally I think it's also incredibly helpful. I think this is fine in p_user.c
|
||||
// -- Sal
|
||||
|
||||
boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec)
|
||||
boolean P_IsObjectOnRealGround(const mobj_t *mo, const sector_t *sec)
|
||||
{
|
||||
// Is the object in reverse gravity?
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
|
|
@ -1471,7 +1471,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir, angle_t oldPitch, an
|
|||
return clipmomz;
|
||||
}
|
||||
|
||||
boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
||||
boolean P_InQuicksand(const mobj_t *mo) // Returns true if you are in quicksand
|
||||
{
|
||||
sector_t *sector = mo->subsector->sector;
|
||||
fixed_t topheight, bottomheight;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue