mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-04 22:16:35 +00:00
Merge branch 'oldcmd'
This commit is contained in:
commit
ac55987d6b
10 changed files with 61 additions and 63 deletions
|
|
@ -58,11 +58,11 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// True if button down last tic.
|
||||
PF_ATTACKDOWN = 1,
|
||||
PF_ACCELDOWN = 1<<1,
|
||||
PF_BRAKEDOWN = 1<<2,
|
||||
PF_LOOKDOWN = 1<<3,
|
||||
// free: 1<<0 to 1<<2
|
||||
|
||||
// Look back VFX has been spawned
|
||||
// TODO: Is there a better way to track this?
|
||||
PF_GAINAX = 1<<3,
|
||||
|
||||
// Accessibility and cheats
|
||||
PF_KICKSTARTACCEL = 1<<4, // Is accelerate in kickstart mode?
|
||||
|
|
@ -330,6 +330,7 @@ typedef struct player_s
|
|||
|
||||
// Caveat: ticcmd_t is ATTRPACK! Be careful what precedes it.
|
||||
ticcmd_t cmd;
|
||||
ticcmd_t oldcmd; // from the previous tic
|
||||
|
||||
playerstate_t playerstate;
|
||||
|
||||
|
|
|
|||
|
|
@ -5725,11 +5725,14 @@ const char *const MAPTHINGFLAG_LIST[4] = {
|
|||
};
|
||||
|
||||
const char *const PLAYERFLAG_LIST[] = {
|
||||
// True if button down last tic.
|
||||
"ATTACKDOWN",
|
||||
"ACCELDOWN",
|
||||
"BRAKEDOWN",
|
||||
"LOOKDOWN",
|
||||
// free: 1<<0 to 1<<2 (name un-matchable)
|
||||
"\x01",
|
||||
"\x01",
|
||||
"\x01",
|
||||
|
||||
// Look back VFX has been spawned
|
||||
// TODO: Is there a better way to track this?
|
||||
"GAINAX",
|
||||
|
||||
// Accessibility and cheats
|
||||
"KICKSTARTACCEL", // Is accelerate in kickstart mode?
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
28
src/k_kart.c
28
src/k_kart.c
|
|
@ -1008,9 +1008,6 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
else if (!(player->itemroulette >= (TICRATE*3)))
|
||||
return;
|
||||
|
||||
if (cmd->buttons & BT_ATTACK)
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator
|
||||
|
|
@ -2540,7 +2537,7 @@ void K_KartMoveAnimation(player_t *player)
|
|||
|
||||
if (!lookback)
|
||||
{
|
||||
player->pflags &= ~PF_LOOKDOWN;
|
||||
player->pflags &= ~PF_GAINAX;
|
||||
|
||||
// Uses turning over steering -- it's important to show player feedback immediately.
|
||||
if (player->cmd.turning < -minturn)
|
||||
|
|
@ -2564,7 +2561,7 @@ void K_KartMoveAnimation(player_t *player)
|
|||
destGlanceDir = -(2*intsign(player->aizdriftturn));
|
||||
player->glanceDir = destGlanceDir;
|
||||
drift = turndir = 0;
|
||||
player->pflags &= ~PF_LOOKDOWN;
|
||||
player->pflags &= ~PF_GAINAX;
|
||||
}
|
||||
else if (player->aizdriftturn)
|
||||
{
|
||||
|
|
@ -2610,14 +2607,14 @@ void K_KartMoveAnimation(player_t *player)
|
|||
gainaxstate = S_GAINAX_MID1;
|
||||
}
|
||||
|
||||
if (destGlanceDir && !(player->pflags & PF_LOOKDOWN))
|
||||
if (destGlanceDir && !(player->pflags & PF_GAINAX))
|
||||
{
|
||||
mobj_t *gainax = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_GAINAX);
|
||||
gainax->movedir = (destGlanceDir < 0) ? (ANGLE_270-ANG10) : (ANGLE_90+ANG10);
|
||||
P_SetTarget(&gainax->target, player->mo);
|
||||
P_SetMobjState(gainax, gainaxstate);
|
||||
gainax->flags2 |= MF2_AMBUSH;
|
||||
player->pflags |= PF_LOOKDOWN;
|
||||
player->pflags |= PF_GAINAX;
|
||||
}
|
||||
}
|
||||
else if (K_GetForwardMove(player) < 0 && destGlanceDir == 0)
|
||||
|
|
@ -2874,7 +2871,7 @@ void K_KartMoveAnimation(player_t *player)
|
|||
}
|
||||
|
||||
if (!player->glanceDir)
|
||||
player->pflags &= ~PF_LOOKDOWN;
|
||||
player->pflags &= ~PF_GAINAX;
|
||||
|
||||
// Update lastspeed value -- we use to display slow driving frames instead of fast driving when slowing down.
|
||||
player->lastspeed = player->speed;
|
||||
|
|
@ -5899,11 +5896,6 @@ void K_DoSneaker(player_t *player, INT32 type)
|
|||
}
|
||||
}
|
||||
|
||||
if (type != 0)
|
||||
{
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
}
|
||||
|
||||
player->sneakertimer = sneakertime;
|
||||
|
||||
// set angle for spun out players:
|
||||
|
|
@ -5915,7 +5907,6 @@ static void K_DoShrink(player_t *user)
|
|||
mobj_t *mobj, *next;
|
||||
|
||||
S_StartSound(user->mo, sfx_kc46); // Sound the BANG!
|
||||
user->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
Obj_CreateShrinkPohbees(user);
|
||||
|
||||
|
|
@ -9935,7 +9926,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);
|
||||
|
||||
|
|
@ -9970,11 +9961,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.
|
||||
|
|
@ -9982,7 +9968,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
// Ring boosting
|
||||
if (player->pflags & PF_USERINGS)
|
||||
{
|
||||
if ((player->pflags & PF_ATTACKDOWN) && !player->ringdelay && player->rings > 0)
|
||||
if ((cmd->buttons & BT_ATTACK) && !player->ringdelay && player->rings > 0)
|
||||
{
|
||||
mobj_t *ring = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_RING);
|
||||
P_SetMobjState(ring, S_FASTRING1);
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ static int player_get(lua_State *L)
|
|||
LUA_PushUserdata(L, plr->mo, META_MOBJ);
|
||||
else if (fastcmp(field,"cmd"))
|
||||
LUA_PushUserdata(L, &plr->cmd, META_TICCMD);
|
||||
else if (fastcmp(field,"oldcmd"))
|
||||
LUA_PushUserdata(L, &plr->oldcmd, META_TICCMD);
|
||||
else if (fastcmp(field,"respawn"))
|
||||
LUA_PushUserdata(L, &plr->respawn, META_RESPAWN);
|
||||
else if (fastcmp(field,"playerstate"))
|
||||
|
|
@ -526,6 +528,8 @@ static int player_set(lua_State *L)
|
|||
}
|
||||
else if (fastcmp(field,"cmd"))
|
||||
return NOSET;
|
||||
else if (fastcmp(field,"oldcmd"))
|
||||
return NOSET;
|
||||
else if (fastcmp(field,"respawn"))
|
||||
return NOSET;
|
||||
else if (fastcmp(field,"playerstate"))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2062,7 +2062,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
player->driftboost = player->strongdriftboost = 0;
|
||||
player->ringboost = 0;
|
||||
player->glanceDir = 0;
|
||||
player->pflags &= ~PF_LOOKDOWN;
|
||||
player->pflags &= ~PF_GAINAX;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -768,6 +768,11 @@ void P_Ticker(boolean run)
|
|||
K_TimerInit();
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
G_CopyTiccmd(&players[i].oldcmd, &players[i].cmd, 1);
|
||||
}
|
||||
|
||||
// Z_CheckMemCleanup();
|
||||
}
|
||||
|
||||
|
|
|
|||
17
src/p_user.c
17
src/p_user.c
|
|
@ -2218,7 +2218,7 @@ void P_MovePlayer(player_t *player)
|
|||
player->drawangle -= ANGLE_22h;
|
||||
player->mo->rollangle = 0;
|
||||
player->glanceDir = 0;
|
||||
player->pflags &= ~PF_LOOKDOWN;
|
||||
player->pflags &= ~PF_GAINAX;
|
||||
}
|
||||
else if ((player->pflags & PF_FAULT) || (player->spinouttimer > 0))
|
||||
{
|
||||
|
|
@ -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,19 +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;
|
||||
|
||||
// PF_LOOKDOWN handled in K_KartMoveAnimation
|
||||
|
||||
// Counters, time dependent power ups.
|
||||
// Time Bonus & Ring Bonus count settings
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue