mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Remove PF_ATTACKDOWN/PF_ACCELDOWN/PF_BRAKEDOWN, use oldcmd.buttons
This commit is contained in:
parent
7251ed5d9e
commit
bcdf41ec64
6 changed files with 31 additions and 38 deletions
|
|
@ -58,10 +58,7 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// True if button down last tic.
|
||||
PF_ATTACKDOWN = 1,
|
||||
PF_ACCELDOWN = 1<<1,
|
||||
PF_BRAKEDOWN = 1<<2,
|
||||
// free: 1<<0 to 1<<2
|
||||
|
||||
// Look back VFX has been spawned
|
||||
// TODO: Is there a better way to track this?
|
||||
|
|
|
|||
|
|
@ -2410,11 +2410,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
// ^ Not necessary anyway since it will be respawned regardless considering it doesn't exist anymore.
|
||||
|
||||
|
||||
// Don't do anything immediately
|
||||
p->pflags |= PF_BRAKEDOWN;
|
||||
p->pflags |= PF_ATTACKDOWN;
|
||||
p->pflags |= PF_ACCELDOWN;
|
||||
|
||||
p->playerstate = PST_LIVE;
|
||||
p->panim = PA_STILL; // standing animation
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,23 @@
|
|||
#include "m_random.h"
|
||||
#include "r_things.h" // numskins
|
||||
|
||||
/*--------------------------------------------------
|
||||
static inline boolean K_ItemButtonWasDown(player_t *player)
|
||||
|
||||
Looks for players around the bot, and presses the item button
|
||||
if there is one in range.
|
||||
|
||||
Input Arguments:-
|
||||
player - Bot to check.
|
||||
|
||||
Return:-
|
||||
true if the item button was pressed last tic, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
static inline boolean K_ItemButtonWasDown(player_t *player)
|
||||
{
|
||||
return (player->oldcmd.buttons & BT_ATTACK);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static boolean K_BotUseItemNearPlayer(player_t *player, ticcmd_t *cmd, fixed_t radius)
|
||||
|
||||
|
|
@ -45,7 +62,7 @@ static boolean K_BotUseItemNearPlayer(player_t *player, ticcmd_t *cmd, fixed_t r
|
|||
{
|
||||
UINT8 i;
|
||||
|
||||
if (player->pflags & PF_ATTACKDOWN)
|
||||
if (K_ItemButtonWasDown(player) == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -327,7 +344,7 @@ static void K_ItemConfirmForTarget(player_t *bot, player_t *target, UINT16 amoun
|
|||
--------------------------------------------------*/
|
||||
static boolean K_BotGenericPressItem(player_t *player, ticcmd_t *cmd, SINT8 dir)
|
||||
{
|
||||
if (player->pflags & PF_ATTACKDOWN)
|
||||
if (K_ItemButtonWasDown(player) == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -352,7 +369,7 @@ static boolean K_BotGenericPressItem(player_t *player, ticcmd_t *cmd, SINT8 dir)
|
|||
--------------------------------------------------*/
|
||||
static void K_BotItemGenericTap(player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
if (!(player->pflags & PF_ATTACKDOWN))
|
||||
if (K_ItemButtonWasDown(player) == false)
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
player->botvars.itemconfirm = 0;
|
||||
|
|
@ -475,7 +492,7 @@ static void K_BotItemSneaker(player_t *player, ticcmd_t *cmd)
|
|||
|| player->speedboost > (FRACUNIT/8) // Have another type of boost (tethering)
|
||||
|| player->botvars.itemconfirm > 4*TICRATE) // Held onto it for too long
|
||||
{
|
||||
if (!player->sneakertimer && !(player->pflags & PF_ATTACKDOWN))
|
||||
if (player->sneakertimer == 0 && K_ItemButtonWasDown(player) == false)
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
player->botvars.itemconfirm = 2*TICRATE;
|
||||
|
|
@ -503,7 +520,7 @@ static void K_BotItemRocketSneaker(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
if (player->botvars.itemconfirm > TICRATE)
|
||||
{
|
||||
if (!player->sneakertimer && !(player->pflags & PF_ATTACKDOWN))
|
||||
if (player->sneakertimer == 0 && K_ItemButtonWasDown(player) == false)
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
player->botvars.itemconfirm = 0;
|
||||
|
|
@ -1193,7 +1210,7 @@ static void K_BotItemRouletteMash(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
boolean mash = false;
|
||||
|
||||
if (player->pflags & PF_ATTACKDOWN)
|
||||
if (K_ItemButtonWasDown(player) == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9883,7 +9883,7 @@ void K_UnsetItemOut(player_t *player)
|
|||
void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
boolean ATTACK_IS_DOWN = ((cmd->buttons & BT_ATTACK) && !(player->pflags & PF_ATTACKDOWN));
|
||||
boolean ATTACK_IS_DOWN = ((cmd->buttons & BT_ATTACK) && !(player->oldcmd.buttons & BT_ATTACK));
|
||||
boolean HOLDING_ITEM = (player->pflags & (PF_ITEMOUT|PF_EGGMANOUT));
|
||||
boolean NO_HYUDORO = (player->stealingtimer == 0);
|
||||
|
||||
|
|
@ -9918,11 +9918,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->pflags &= ~PF_USERINGS;
|
||||
}
|
||||
|
||||
if ((player->pflags & PF_ATTACKDOWN) && !(cmd->buttons & BT_ATTACK))
|
||||
player->pflags &= ~PF_ATTACKDOWN;
|
||||
else if (cmd->buttons & BT_ATTACK)
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
if (player && player->mo && player->mo->health > 0 && !player->spectator && !P_PlayerInPain(player) && !mapreset && leveltime > introtime)
|
||||
{
|
||||
// First, the really specific, finicky items that function without the item being directly in your item slot.
|
||||
|
|
|
|||
|
|
@ -1053,11 +1053,11 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
}
|
||||
|
||||
|
||||
if (player->pflags & PF_ATTACKDOWN)
|
||||
if (player->pflags & PF_STASIS)
|
||||
{
|
||||
// Are ANY objectplace buttons pressed? If no, remove flag.
|
||||
if (!(cmd->buttons & (BT_ATTACK|BT_DRIFT)))
|
||||
player->pflags &= ~PF_ATTACKDOWN;
|
||||
player->pflags &= ~PF_STASIS;
|
||||
|
||||
// Do nothing.
|
||||
return;
|
||||
|
|
@ -1066,12 +1066,12 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
/*if (cmd->buttons & BT_FORWARD)
|
||||
{
|
||||
OP_CycleThings(-1);
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
player->pflags |= PF_STASIS;
|
||||
}
|
||||
else*/ if (cmd->buttons & BT_DRIFT)
|
||||
{
|
||||
OP_CycleThings(1);
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
player->pflags |= PF_STASIS;
|
||||
}
|
||||
|
||||
// Place an object and add it to the maplist
|
||||
|
|
@ -1082,7 +1082,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
mobjtype_t spawnthing = op_currentdoomednum;
|
||||
boolean ceiling;
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
player->pflags |= PF_STASIS;
|
||||
|
||||
if (cv_mapthingnum.value > 0 && cv_mapthingnum.value < 4096)
|
||||
{
|
||||
|
|
|
|||
13
src/p_user.c
13
src/p_user.c
|
|
@ -4186,7 +4186,7 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
else if (cmd->buttons & BT_ACCELERATE)
|
||||
{
|
||||
if (!player->exiting && !(player->pflags & PF_ACCELDOWN))
|
||||
if (!player->exiting && !(player->oldcmd.buttons & BT_ACCELERATE))
|
||||
{
|
||||
player->kickstartaccel = 0;
|
||||
}
|
||||
|
|
@ -4394,17 +4394,6 @@ void P_PlayerThink(player_t *player)
|
|||
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
|
||||
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
|
||||
|
||||
// check for buttons
|
||||
if (cmd->buttons & BT_ACCELERATE)
|
||||
player->pflags |= PF_ACCELDOWN;
|
||||
else
|
||||
player->pflags &= ~PF_ACCELDOWN;
|
||||
|
||||
if (cmd->buttons & BT_BRAKE)
|
||||
player->pflags |= PF_BRAKEDOWN;
|
||||
else
|
||||
player->pflags &= ~PF_BRAKEDOWN;
|
||||
|
||||
// Counters, time dependent power ups.
|
||||
// Time Bonus & Ring Bonus count settings
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue