mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Merge branch 'move-bot-ice-cube-code' into 'master'
Move Ice Cube mashing code to bot AI See merge request KartKrew/Kart!2031
This commit is contained in:
commit
958b2c68da
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