diff --git a/src/d_player.h b/src/d_player.h index 8eba378ff..b9ca4d532 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/k_kart.c b/src/k_kart.c index b3b0956a4..99483e230 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 7cd2ef130..5cba9fa62 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 1325c7440..0b0aeab9b 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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);