mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-23 16:32:36 +00:00
Move Ice Cube mashing code to bot AI
- It was hacked in outside of it before, so the normal item button AI was running simultaneously
This commit is contained in:
parent
198f80e20d
commit
3d1d8283a5
2 changed files with 41 additions and 27 deletions
|
|
@ -1560,6 +1560,40 @@ static void K_BotItemInstashield(const player_t *player, ticcmd_t *cmd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
static void K_BotItemIceCube(player_t *player, ticcmd_t *cmd)
|
||||||
|
|
||||||
|
Item usage for ice cubes.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
player - Bot to do this for.
|
||||||
|
cmd - Bot's ticcmd to edit.
|
||||||
|
|
||||||
|
Return:-
|
||||||
|
None
|
||||||
|
--------------------------------------------------*/
|
||||||
|
static void K_BotItemIceCube(const player_t *player, ticcmd_t *cmd)
|
||||||
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
|
if (leveltime % 7)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->sneakertimer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!P_IsObjectOnGround(player->mo))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd->buttons |= BT_DRIFT;
|
||||||
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
static tic_t K_BotItemRouletteMashConfirm(const player_t *player)
|
static tic_t K_BotItemRouletteMashConfirm(const player_t *player)
|
||||||
|
|
||||||
|
|
@ -1617,6 +1651,12 @@ void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
ZoneScoped;
|
ZoneScoped;
|
||||||
|
|
||||||
|
if (player->icecube.frozen)
|
||||||
|
{
|
||||||
|
K_BotItemIceCube(player, cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->itemflags & IF_USERINGS)
|
if (player->itemflags & IF_USERINGS)
|
||||||
{
|
{
|
||||||
if (player->rings > 0)
|
if (player->rings > 0)
|
||||||
|
|
|
||||||
|
|
@ -357,35 +357,9 @@ boolean Obj_IceCubeThink(mobj_t* mo)
|
||||||
|
|
||||||
void Obj_IceCubeInput(player_t* player)
|
void Obj_IceCubeInput(player_t* player)
|
||||||
{
|
{
|
||||||
// FIXME: this should be in the bot ticcmd code
|
|
||||||
auto bot_hack = [player]
|
|
||||||
{
|
|
||||||
if (!K_PlayerUsesBotMovement(player))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (leveltime % 7)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->sneakertimer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!P_IsObjectOnGround(player->mo))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Must be mashing some buttons
|
// Must be mashing some buttons
|
||||||
auto press = [player](buttoncode_t bt) { return (player->cmd.buttons & ~player->oldcmd.buttons) & bt; };
|
auto press = [player](buttoncode_t bt) { return (player->cmd.buttons & ~player->oldcmd.buttons) & bt; };
|
||||||
if (!(press(BT_ACCELERATE) || press(BT_ATTACK) || press(BT_DRIFT) || bot_hack()))
|
if (!(press(BT_ACCELERATE) || press(BT_ATTACK) || press(BT_DRIFT)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue