mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'dynamic-roulette' into 'race-checkpoint'
Dynamic Roulette See merge request KartKrew/Kart!2420
This commit is contained in:
commit
e5e3f5b6da
9 changed files with 668 additions and 519 deletions
|
|
@ -819,7 +819,7 @@ consvar_t cv_fuzz = OnlineCheat("fuzz", "Off").on_off().description("Human playe
|
||||||
|
|
||||||
consvar_t cv_kartdebugamount = OnlineCheat("debugitemamount", "1").min_max(1, 255).description("If debugitem, give multiple copies of an item");
|
consvar_t cv_kartdebugamount = OnlineCheat("debugitemamount", "1").min_max(1, 255).description("If debugitem, give multiple copies of an item");
|
||||||
consvar_t cv_kartdebugbots = OnlineCheat("debugbots", "Off").on_off().description("Bot AI debugger");
|
consvar_t cv_kartdebugbots = OnlineCheat("debugbots", "Off").on_off().description("Bot AI debugger");
|
||||||
consvar_t cv_kartdebugdistribution = OnlineCheat("debugitemodds", "Off").on_off().description("Show items that the roulette can roll");
|
consvar_t cv_kartdebugdistribution = OnlineCheat("debugitemodds", "0").min_max(0, 2).description("Show items that the roulette can roll");
|
||||||
consvar_t cv_kartdebughuddrop = OnlineCheat("debugitemdrop", "Off").on_off().description("Players drop paper items when damaged in any way");
|
consvar_t cv_kartdebughuddrop = OnlineCheat("debugitemdrop", "Off").on_off().description("Players drop paper items when damaged in any way");
|
||||||
|
|
||||||
consvar_t cv_kartdebugbotwhip = OnlineCheat("debugbotwhip", "Off").on_off().description("Disable bot ring and item pickups");
|
consvar_t cv_kartdebugbotwhip = OnlineCheat("debugbotwhip", "Off").on_off().description("Disable bot ring and item pickups");
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,6 @@ struct itemroulette_t
|
||||||
SINT8 *itemList;
|
SINT8 *itemList;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT8 preexpuseOdds, useOdds;
|
|
||||||
UINT8 playing, exiting;
|
UINT8 playing, exiting;
|
||||||
UINT32 preexpdist, dist, baseDist;
|
UINT32 preexpdist, dist, baseDist;
|
||||||
UINT32 firstDist, secondDist;
|
UINT32 firstDist, secondDist;
|
||||||
|
|
|
||||||
|
|
@ -1061,7 +1061,7 @@ static patch_t *K_GetCachedItemPatch(INT32 item, UINT8 offset)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static patch_t *K_GetSmallStaticCachedItemPatch(kartitems_t item)
|
patch_t *K_GetSmallStaticCachedItemPatch(kartitems_t item)
|
||||||
{
|
{
|
||||||
UINT8 offset;
|
UINT8 offset;
|
||||||
|
|
||||||
|
|
@ -5684,60 +5684,28 @@ static void K_drawDistributionDebugger(void)
|
||||||
itemroulette_t rouletteData = {0};
|
itemroulette_t rouletteData = {0};
|
||||||
|
|
||||||
const fixed_t scale = (FRACUNIT >> 1);
|
const fixed_t scale = (FRACUNIT >> 1);
|
||||||
const fixed_t space = 24 * scale;
|
|
||||||
const fixed_t pad = 9 * scale;
|
const fixed_t pad = 9 * scale;
|
||||||
|
|
||||||
fixed_t x = -pad;
|
fixed_t x = -pad;
|
||||||
fixed_t y = -pad;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (R_GetViewNumber() != 0) // only for p1
|
if (R_GetViewNumber() != 0) // only for p1
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
K_FillItemRouletteData(stplyr, &rouletteData, false);
|
K_FillItemRouletteData(stplyr, &rouletteData, false, true);
|
||||||
|
|
||||||
for (i = 0; i < rouletteData.itemListLen; i++)
|
if (cv_kartdebugdistribution.value <= 1)
|
||||||
{
|
return;
|
||||||
const kartitems_t item = static_cast<kartitems_t>(rouletteData.itemList[i]);
|
|
||||||
UINT8 amount = 1;
|
|
||||||
|
|
||||||
if (y > (BASEVIDHEIGHT << FRACBITS) - space - pad)
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+10, V_SNAPTOTOP|V_SNAPTORIGHT, va("speed = %u", rouletteData.speed));
|
||||||
{
|
|
||||||
x += space;
|
|
||||||
y = -pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
V_DrawFixedPatch(x, y, scale, V_SNAPTOTOP,
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+22, V_SNAPTOTOP|V_SNAPTORIGHT, va("baseDist = %u", rouletteData.baseDist));
|
||||||
K_GetSmallStaticCachedItemPatch(item), NULL);
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+30, V_SNAPTOTOP|V_SNAPTORIGHT, va("dist = %u", rouletteData.dist));
|
||||||
|
|
||||||
// Display amount for multi-items
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+42, V_SNAPTOTOP|V_SNAPTORIGHT, va("firstDist = %u", rouletteData.firstDist));
|
||||||
amount = K_ItemResultToAmount(item);
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+50, V_SNAPTOTOP|V_SNAPTORIGHT, va("secondDist = %u", rouletteData.secondDist));
|
||||||
if (amount > 1)
|
V_DrawRightAlignedThinString(320-(x >> FRACBITS), 100+58, V_SNAPTOTOP|V_SNAPTORIGHT, va("secondToFirst = %u", rouletteData.secondToFirst));
|
||||||
{
|
|
||||||
V_DrawStringScaled(
|
|
||||||
x + (18 * scale),
|
|
||||||
y + (23 * scale),
|
|
||||||
scale, FRACUNIT, FRACUNIT,
|
|
||||||
V_SNAPTOTOP,
|
|
||||||
NULL, HU_FONT,
|
|
||||||
va("x%d", amount)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
y += space;
|
|
||||||
}
|
|
||||||
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 2, V_SNAPTOTOP, va("useOdds[%u]", rouletteData.useOdds));
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 10, V_SNAPTOTOP, va("speed = %u", rouletteData.speed));
|
|
||||||
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 22, V_SNAPTOTOP, va("baseDist = %u", rouletteData.baseDist));
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 30, V_SNAPTOTOP, va("dist = %u", rouletteData.dist));
|
|
||||||
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 42, V_SNAPTOTOP, va("firstDist = %u", rouletteData.firstDist));
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 50, V_SNAPTOTOP, va("secondDist = %u", rouletteData.secondDist));
|
|
||||||
V_DrawString((x >> FRACBITS) + 20, 58, V_SNAPTOTOP, va("secondToFirst = %u", rouletteData.secondToFirst));
|
|
||||||
|
|
||||||
#ifndef ITEM_LIST_SIZE
|
#ifndef ITEM_LIST_SIZE
|
||||||
Z_Free(rouletteData.itemList);
|
Z_Free(rouletteData.itemList);
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,8 @@ void K_ClearPersistentMessages(void);
|
||||||
void K_ClearPersistentMessageForPlayer(player_t *player);
|
void K_ClearPersistentMessageForPlayer(player_t *player);
|
||||||
void K_TickMessages(void);
|
void K_TickMessages(void);
|
||||||
|
|
||||||
|
patch_t *K_GetSmallStaticCachedItemPatch(kartitems_t item);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
PLAYERTAG_NONE,
|
PLAYERTAG_NONE,
|
||||||
|
|
|
||||||
31
src/k_kart.c
31
src/k_kart.c
|
|
@ -4007,8 +4007,10 @@ void K_SpawnAmps(player_t *player, UINT8 amps, mobj_t *impact)
|
||||||
if (gametyperules & GTR_SPHERES)
|
if (gametyperules & GTR_SPHERES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Give that Sonic guy some help.
|
UINT16 scaledamps = min(amps, amps * (10 + (9-player->kartspeed) - (9-player->kartweight)) / 10);
|
||||||
UINT16 scaledamps = min(amps, amps * (10 + player->kartspeed - player->kartweight) / 10);
|
|
||||||
|
if (player->position <= 1)
|
||||||
|
scaledamps /= 2;
|
||||||
|
|
||||||
for (int i = 0; i < (scaledamps/2); i++)
|
for (int i = 0; i < (scaledamps/2); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -4052,6 +4054,13 @@ void K_AwardPlayerAmps(player_t *player, UINT8 amps)
|
||||||
|
|
||||||
if (player->rings <= 0 && player->ampspending == 0)
|
if (player->rings <= 0 && player->ampspending == 0)
|
||||||
{
|
{
|
||||||
|
// Auto Overdrive!
|
||||||
|
// If this is a fresh OD, give 'em some extra juice to make up for lack of flexibility.
|
||||||
|
if (!player->overdrive && player->mo && !P_MobjWasRemoved(player->mo))
|
||||||
|
{
|
||||||
|
S_StartSound(player->mo, sfx_gshac);
|
||||||
|
player->amps *= 2;
|
||||||
|
}
|
||||||
K_Overdrive(player);
|
K_Overdrive(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7424,7 +7433,7 @@ SINT8 K_GetTotallyRandomResult(UINT8 useodds)
|
||||||
// Avoid calling K_FillItemRouletteData since that
|
// Avoid calling K_FillItemRouletteData since that
|
||||||
// function resets PR_ITEM_ROULETTE.
|
// function resets PR_ITEM_ROULETTE.
|
||||||
spawnchance[i] = (
|
spawnchance[i] = (
|
||||||
totalspawnchance += K_KartGetItemOdds(NULL, NULL, useodds, i)
|
totalspawnchance += K_KartGetBattleOdds(NULL, useodds, i)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -12974,6 +12983,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
else
|
else
|
||||||
player->rocketsneakertimer -= 3*TICRATE;
|
player->rocketsneakertimer -= 3*TICRATE;
|
||||||
player->botvars.itemconfirm = 2*TICRATE;
|
player->botvars.itemconfirm = 2*TICRATE;
|
||||||
|
player->overshield += TICRATE/2; // TEMP prototype
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player->itemamount == 0)
|
else if (player->itemamount == 0)
|
||||||
|
|
@ -12989,6 +12999,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
{
|
{
|
||||||
K_DoSneaker(player, 1);
|
K_DoSneaker(player, 1);
|
||||||
K_PlayBoostTaunt(player->mo);
|
K_PlayBoostTaunt(player->mo);
|
||||||
|
player->overshield += TICRATE/2; // TEMP prototype
|
||||||
|
player->sneakertimer += TICRATE; // TEMP prototype
|
||||||
player->itemamount--;
|
player->itemamount--;
|
||||||
player->botvars.itemconfirm = 0;
|
player->botvars.itemconfirm = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -14777,13 +14789,24 @@ fixed_t K_GetExpAdjustment(player_t *player)
|
||||||
|
|
||||||
INT32 live_players = 0;
|
INT32 live_players = 0;
|
||||||
|
|
||||||
// Increase XP for each player you're beating...
|
|
||||||
for (INT32 i = 0; i < MAXPLAYERS; i++)
|
for (INT32 i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i] || players[i].spectator || player == players+i)
|
if (!playeringame[i] || players[i].spectator || player == players+i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
live_players++;
|
live_players++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (live_players < 8)
|
||||||
|
{
|
||||||
|
exp_power += (8 - live_players) * exp_power/4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase XP for each player you're beating...
|
||||||
|
for (INT32 i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (!playeringame[i] || players[i].spectator || player == players+i)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (player->position < players[i].position)
|
if (player->position < players[i].position)
|
||||||
result += exp_power;
|
result += exp_power;
|
||||||
|
|
|
||||||
1074
src/k_roulette.c
1074
src/k_roulette.c
File diff suppressed because it is too large
Load diff
|
|
@ -78,17 +78,14 @@ botItemPriority_e K_GetBotItemPriority(kartitems_t result);
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette, UINT8 pos, kartitems_t item);
|
INT32 K_KartGetBattleOdds(const player_t *player, itemroulette_t *const roulette, UINT8 pos, kartitems_t item);
|
||||||
|
|
||||||
Gets the frequency an item should show up in
|
Gets legacy item priority.
|
||||||
an item bracket, and adjusted for special
|
Currently used only for Battle monitors/spawners.
|
||||||
factors (such as Frantic Items).
|
|
||||||
|
|
||||||
Input Arguments:-
|
Input Arguments:-
|
||||||
player - The player we intend to give the item to later.
|
player - The player we intend to give the item to later.
|
||||||
Can be NULL for generic use.
|
Can be NULL for generic use.
|
||||||
roulette - The roulette data that we intend to
|
|
||||||
insert this item into.
|
|
||||||
pos - The item bracket we are in.
|
pos - The item bracket we are in.
|
||||||
item - The item to give.
|
item - The item to give.
|
||||||
|
|
||||||
|
|
@ -97,11 +94,11 @@ botItemPriority_e K_GetBotItemPriority(kartitems_t result);
|
||||||
into the roulette.
|
into the roulette.
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
|
|
||||||
INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette, UINT8 pos, kartitems_t item);
|
INT32 K_KartGetBattleOdds(const player_t *player, UINT8 pos, kartitems_t item);
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette, boolean ringbox);
|
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette, boolean ringbox, boolean dryrun);
|
||||||
|
|
||||||
Fills out the item roulette struct when it is
|
Fills out the item roulette struct when it is
|
||||||
initially created. This function needs to be
|
initially created. This function needs to be
|
||||||
|
|
@ -113,12 +110,13 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
|
||||||
Can be NULL for generic use.
|
Can be NULL for generic use.
|
||||||
roulette - The roulette data struct to fill out.
|
roulette - The roulette data struct to fill out.
|
||||||
ringbox - Is this roulette fill triggered by a just-respawned Ring Box?
|
ringbox - Is this roulette fill triggered by a just-respawned Ring Box?
|
||||||
|
dryrun - Are we calling this from the distribution debugger? Don't call RNG or write roulette data!
|
||||||
|
|
||||||
Return:-
|
Return:-
|
||||||
N/A
|
N/A
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
|
|
||||||
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette, boolean ringbox);
|
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette, boolean ringbox, boolean dryrun);
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -3092,11 +3092,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||||
{
|
{
|
||||||
K_DoPowerClash(target, inflictor);
|
K_DoPowerClash(target, inflictor);
|
||||||
|
|
||||||
if (inflictor->type != MT_PLAYER)
|
|
||||||
{
|
|
||||||
K_SpawnAmps(player, 5, inflictor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inflictor->type == MT_SUPER_FLICKY)
|
if (inflictor->type == MT_SUPER_FLICKY)
|
||||||
{
|
{
|
||||||
Obj_BlockSuperFlicky(inflictor);
|
Obj_BlockSuperFlicky(inflictor);
|
||||||
|
|
|
||||||
|
|
@ -744,8 +744,6 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WRITEUINT8(save->p, players[i].itemRoulette.preexpuseOdds);
|
|
||||||
WRITEUINT8(save->p, players[i].itemRoulette.useOdds);
|
|
||||||
WRITEUINT32(save->p, players[i].itemRoulette.preexpdist);
|
WRITEUINT32(save->p, players[i].itemRoulette.preexpdist);
|
||||||
WRITEUINT32(save->p, players[i].itemRoulette.dist);
|
WRITEUINT32(save->p, players[i].itemRoulette.dist);
|
||||||
WRITEUINT32(save->p, players[i].itemRoulette.index);
|
WRITEUINT32(save->p, players[i].itemRoulette.index);
|
||||||
|
|
@ -1370,8 +1368,6 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
players[i].itemRoulette.preexpuseOdds = READUINT8(save->p);
|
|
||||||
players[i].itemRoulette.useOdds = READUINT8(save->p);
|
|
||||||
players[i].itemRoulette.preexpdist = READUINT32(save->p);
|
players[i].itemRoulette.preexpdist = READUINT32(save->p);
|
||||||
players[i].itemRoulette.dist = READUINT32(save->p);
|
players[i].itemRoulette.dist = READUINT32(save->p);
|
||||||
players[i].itemRoulette.index = (size_t)READUINT32(save->p);
|
players[i].itemRoulette.index = (size_t)READUINT32(save->p);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue