Merge branch 'ballhog-limited-tapfire' into 'master'

Easier ballhog tapfire

See merge request KartKrew/Kart!1594
This commit is contained in:
Oni 2023-11-09 12:28:54 +00:00
commit cd06b34cd1
4 changed files with 20 additions and 2 deletions

View file

@ -716,6 +716,7 @@ struct player_t
UINT8 flamelength; // Flame Shield dash meter, number of segments
UINT16 ballhogcharge; // Ballhog charge up -- the higher this value, the more projectiles
boolean ballhogtap; // Ballhog released during charge: used to allow semirapid tapfire
UINT16 hyudorotimer; // Duration of the Hyudoro offroad effect itself
SINT8 stealingtimer; // if >0 you are stealing, if <0 you are being stolen from

View file

@ -11507,8 +11507,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
INT32 ballhogmax = (player->itemamount) * BALLHOGINCREMENT;
if ((cmd->buttons & BT_ATTACK) && (player->pflags & PF_HOLDREADY)
&& (player->ballhogcharge < ballhogmax))
// This construct looks a little goofy, but we're basically just
// trying to prevent rapid taps from restarting a charge, while
// still allowing quick tapfire.
// (The player still has to pace their shots like this, it's not
// semi-auto, but that's probably kind of okay.)
if (player->ballhogcharge && !(cmd->buttons & BT_ATTACK))
player->ballhogtap = true;
if (player->ballhogcharge == 0)
player->ballhogtap = false;
boolean realcharge = (cmd->buttons & BT_ATTACK) && (player->pflags & PF_HOLDREADY) && (player->ballhogcharge < ballhogmax);
if ((realcharge && !player->ballhogtap) || (player->ballhogtap && player->ballhogcharge < BALLHOGINCREMENT))
{
player->ballhogcharge++;
if (player->ballhogcharge % BALLHOGINCREMENT == 0)

View file

@ -383,6 +383,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->flamelength);
else if (fastcmp(field,"ballhogcharge"))
lua_pushinteger(L, plr->ballhogcharge);
else if (fastcmp(field,"ballhogtap"))
lua_pushinteger(L, plr->ballhogtap);
else if (fastcmp(field,"hyudorotimer"))
lua_pushinteger(L, plr->hyudorotimer);
else if (fastcmp(field,"stealingtimer"))
@ -867,6 +869,8 @@ static int player_set(lua_State *L)
plr->flamelength = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ballhogcharge"))
plr->ballhogcharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ballhogtap"))
plr->ballhogtap = luaL_checkinteger(L, 3);
else if (fastcmp(field,"hyudorotimer"))
plr->hyudorotimer = luaL_checkinteger(L, 3);
else if (fastcmp(field,"stealingtimer"))

View file

@ -478,6 +478,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].flamelength);
WRITEUINT16(save->p, players[i].ballhogcharge);
WRITEUINT8(save->p, players[i].ballhogtap);
WRITEUINT16(save->p, players[i].hyudorotimer);
WRITESINT8(save->p, players[i].stealingtimer);
@ -994,6 +995,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].flamelength = READUINT8(save->p);
players[i].ballhogcharge = READUINT16(save->p);
players[i].ballhogtap = READUINT8(save->p);
players[i].hyudorotimer = READUINT16(save->p);
players[i].stealingtimer = READSINT8(save->p);