Split ringbox stuff from itembox stuff

This commit is contained in:
Sally Coolatta 2023-06-16 05:55:33 -04:00
parent a18f84255b
commit 7842032eee
7 changed files with 173 additions and 133 deletions

View file

@ -398,13 +398,7 @@ consvar_t cv_items[NUMKARTRESULTS-1] = {
CVAR_INIT ("tripleorbinaut", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("quadorbinaut", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("dualjawz", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("triplegachabom", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("bar", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("doublebar", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("triplebar", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("slotring", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("seven", "On", CV_NETVAR, CV_OnOff, NULL),
CVAR_INIT ("jackpot", "On", CV_NETVAR, CV_OnOff, NULL)
CVAR_INIT ("triplegachabom", "On", CV_NETVAR, CV_OnOff, NULL)
};
consvar_t cv_kartspeed = CVAR_INIT ("gamespeed", "Auto", CV_NETVAR|CV_CALL|CV_NOINIT, kartspeed_cons_t, KartSpeed_OnChange);

View file

@ -160,13 +160,7 @@ Run this macro, then #undef FOREACH afterward
FOREACH (KITCHENSINK, 20),\
FOREACH (DROPTARGET, 21),\
FOREACH (GARDENTOP, 22),\
FOREACH (GACHABOM, 23),\
FOREACH (BAR, 24),\
FOREACH (DOUBLEBAR, 25),\
FOREACH (TRIPLEBAR, 26),\
FOREACH (SLOTRING, 27),\
FOREACH (SEVEN, 28),\
FOREACH (JACKPOT, 29)
FOREACH (GACHABOM, 23)
typedef enum
{
@ -198,6 +192,17 @@ typedef enum
NUMKARTSHIELDS
} kartshields_t;
typedef enum
{
KSM_BAR,
KSM_DOUBLEBAR,
KSM_TRIPLEBAR,
KSM_RING,
KSM_SEVEN,
KSM_JACKPOT,
KSM__MAX,
} kartslotmachine_t;
typedef enum
{
KSPIN_THRUST = (1<<0),

View file

@ -866,12 +866,6 @@ static patch_t *K_GetCachedItemPatch(INT32 item, UINT8 offset)
kp_droptarget,
kp_gardentop,
kp_gachabom,
kp_bar,
kp_doublebar,
kp_triplebar,
kp_slotring,
kp_seven,
kp_jackpot,
};
if (item == KITEM_SAD || (item > KITEM_NONE && item < NUMKARTITEMS))
@ -903,6 +897,23 @@ static patch_t *K_GetSmallStaticCachedItemPatch(kartitems_t item)
return K_GetCachedItemPatch(item, offset);
}
static patch_t *K_GetCachedSlotMachinePatch(INT32 item, UINT8 offset)
{
patch_t **kp[KSM__MAX] = {
kp_bar,
kp_doublebar,
kp_triplebar,
kp_slotring,
kp_seven,
kp_jackpot,
};
if (item >= 0 && item < KSM__MAX)
return kp[item][offset];
else
return NULL;
}
//}
INT32 ITEM_X, ITEM_Y; // Item Window
@ -1567,6 +1578,99 @@ static void K_drawKartItem(void)
}
}
static void K_drawKartSlotMachine(void)
{
// ITEM_X = BASEVIDWIDTH-50; // 270
// ITEM_Y = 24; // 24
// Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no item' just in case.
const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0);
patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw };
patch_t *localbg = offset ? kp_ringbg[1] : kp_ringbg[0];
INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
UINT16 localcolor[3] = { stplyr->skincolor };
SINT8 colormode[3] = { TC_RAINBOW };
fixed_t rouletteOffset = 0;
fixed_t rouletteSpace = ROULETTE_SPACING;
vector2_t rouletteCrop = {7, 7};
INT32 i;
if (stplyr->itemRoulette.itemListLen > 0)
{
// Init with item roulette stuff.
for (i = 0; i < 3; i++)
{
const SINT8 indexOfs = i-1;
const size_t index = (stplyr->itemRoulette.index + indexOfs) % stplyr->itemRoulette.itemListLen;
const SINT8 result = stplyr->itemRoulette.itemList[index];
localpatch[i] = K_GetCachedSlotMachinePatch(result, offset);
}
}
if (stplyr->itemRoulette.active == true)
{
rouletteOffset = K_GetRouletteOffset(&stplyr->itemRoulette, rendertimefrac);
}
// pain and suffering defined below
if (offset)
{
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = ITEM_X;
fy = ITEM_Y;
fflags = V_SNAPTOLEFT|V_SNAPTOTOP|V_SPLITSCREEN;
}
else // else, that means we're P2 or P4.
{
fx = ITEM2_X;
fy = ITEM2_Y;
fflags = V_SNAPTORIGHT|V_SNAPTOTOP|V_SPLITSCREEN;
}
rouletteSpace = ROULETTE_SPACING_SPLITSCREEN;
rouletteOffset = FixedMul(rouletteOffset, FixedDiv(ROULETTE_SPACING_SPLITSCREEN, ROULETTE_SPACING));
rouletteCrop.x = 16;
rouletteCrop.y = 15;
}
else
{
fx = ITEM_X;
fy = ITEM_Y;
fflags = V_SNAPTOTOP|V_SNAPTOLEFT|V_SPLITSCREEN;
}
V_DrawScaledPatch(fx, fy, V_HUDTRANS|V_SLIDEIN|fflags, localbg);
V_SetClipRect(
(fx + rouletteCrop.x) << FRACBITS, (fy + rouletteCrop.y) << FRACBITS,
rouletteSpace, rouletteSpace,
V_SLIDEIN|fflags
);
// item box has special layering, transparency, different sized patches, other fucked up shit
// ring box is evenly spaced and easy
rouletteOffset += rouletteSpace;
for (i = 0; i < 3; i++)
{
V_DrawFixedPatch(
fx<<FRACBITS, (fy<<FRACBITS) + rouletteOffset,
FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags,
localpatch[i], (localcolor[i] ? R_GetTranslationColormap(colormode[i], localcolor[i], GTC_CACHE) : NULL)
);
rouletteOffset -= rouletteSpace;
}
V_ClearClipRect();
}
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, UINT8 mode)
{
// TIME_X = BASEVIDWIDTH-124; // 196
@ -5234,7 +5338,16 @@ void K_drawKartHUD(void)
// Draw the item window
if (LUA_HudEnabled(hud_item) && !freecam)
K_drawKartItem();
{
if (stplyr->itemRoulette.ringbox)
{
K_drawKartSlotMachine();
}
else
{
K_drawKartItem();
}
}
if (demo.title)
;

View file

@ -6595,7 +6595,7 @@ void K_DropItems(player_t *player)
{
K_DropHnextList(player);
if (player->mo && !P_MobjWasRemoved(player->mo) && player->itemamount > 0 && !K_IsRingBoxItem(player->itemtype))
if (player->mo && !P_MobjWasRemoved(player->mo) && player->itemamount > 0)
{
mobj_t *drop = K_CreatePaperItem(
player->mo->x, player->mo->y, player->mo->z + player->mo->height/2,
@ -11430,48 +11430,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
K_UpdateHnextList(player, false);
}
break;
case KITEM_BAR:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 10, true);
player->itemamount--;
}
break;
case KITEM_DOUBLEBAR:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 20, true);
player->itemamount--;
}
break;
case KITEM_TRIPLEBAR:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 30, true);
player->itemamount--;
}
break;
case KITEM_SLOTRING:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 50, true);
player->itemamount--;
}
break;
case KITEM_SEVEN:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 77, true);
player->itemamount--;
}
break;
case KITEM_JACKPOT:
if (player->karthud[khud_itemblink] < 1)
{
K_AwardPlayerRings(player, 150, true);
player->itemamount--;
}
break;
case KITEM_SAD:
if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO
&& !player->sadtimer)
@ -12135,20 +12093,4 @@ boolean K_Cooperative(void)
return false;
}
boolean K_IsRingBoxItem(SINT8 itemtype)
{
switch (itemtype)
{
case KITEM_BAR:
case KITEM_DOUBLEBAR:
case KITEM_TRIPLEBAR:
case KITEM_SLOTRING:
case KITEM_SEVEN:
case KITEM_JACKPOT:
return true;
default:
return true;
}
}
//}

View file

@ -220,7 +220,6 @@ tic_t K_TimeLimitForGametype(void);
UINT32 K_PointLimitForGametype(void);
boolean K_Cooperative(void);
boolean K_IsRingBoxItem(SINT8 itemtype);
#ifdef __cplusplus
} // extern "C"

View file

@ -100,12 +100,6 @@ static UINT8 K_KartItemOddsRace[NUMKARTRESULTS-1][8] =
{ 3, 0, 0, 0, 0, 0, 0, 0 }, // Drop Target
{ 0, 0, 0, 1, 2, 2, 0, 0 }, // Garden Top
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Gachabom
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Bar
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Double Bar
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Bar
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Slot Ring
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Seven
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // Jackpot
{ 0, 0, 2, 3, 3, 1, 0, 0 }, // Sneaker x2
{ 0, 0, 0, 0, 4, 4, 4, 0 }, // Sneaker x3
{ 0, 1, 1, 0, 0, 0, 0, 0 }, // Banana x3
@ -140,12 +134,6 @@ static UINT8 K_KartItemOddsBattle[NUMKARTRESULTS-1][2] =
{ 2, 0 }, // Drop Target
{ 4, 0 }, // Garden Top
{ 0, 0 }, // Gachabom
{ 0, 0 }, // Bar
{ 0, 0 }, // Double Bar
{ 0, 0 }, // Triple Bar
{ 0, 0 }, // Slot Ring
{ 0, 0 }, // Seven
{ 0, 0 }, // Jackpot
{ 0, 0 }, // Sneaker x2
{ 0, 1 }, // Sneaker x3
{ 0, 0 }, // Banana x3
@ -180,12 +168,6 @@ static UINT8 K_KartItemOddsSpecial[NUMKARTRESULTS-1][4] =
{ 0, 0, 0, 0 }, // Drop Target
{ 0, 0, 0, 0 }, // Garden Top
{ 0, 0, 0, 0 }, // Gachabom
{ 0, 0, 0, 0 }, // Bar
{ 0, 0, 0, 0 }, // Double Bar
{ 0, 0, 0, 0 }, // Triple Bar
{ 0, 0, 0, 0 }, // Slot Ring
{ 0, 0, 0, 0 }, // Seven
{ 0, 0, 0, 0 }, // Jackpot
{ 0, 1, 1, 0 }, // Sneaker x2
{ 0, 0, 1, 1 }, // Sneaker x3
{ 0, 0, 0, 0 }, // Banana x3
@ -236,15 +218,15 @@ static kartitems_t K_KartItemReelBoss[] =
KITEM_NONE
};
static kartitems_t K_KartItemReelRingBox[] =
static kartslotmachine_t K_KartItemReelRingBox[] =
{
KITEM_BAR,
KITEM_DOUBLEBAR,
KITEM_TRIPLEBAR,
KITEM_SLOTRING,
KITEM_SEVEN,
KITEM_JACKPOT,
KITEM_NONE
KSM_BAR,
KSM_DOUBLEBAR,
KSM_TRIPLEBAR,
KSM_RING,
KSM_SEVEN,
KSM_JACKPOT,
KSM__MAX
};
/*--------------------------------------------------
@ -1134,19 +1116,20 @@ static void K_InitRoulette(itemroulette_t *const roulette)
}
/*--------------------------------------------------
static void K_PushToRouletteItemList(itemroulette_t *const roulette, kartitems_t item)
static void K_PushToRouletteItemList(itemroulette_t *const roulette, INT32 item)
Pushes a new item to the end of the item
roulette's item list.
roulette's item list. Also accepts slot machine
values instead of items.
Input Arguments:-
roulette - The item roulette data to modify.
item - The item to push to the list.
item - The item / slot machine index to push to the list.
Return:-
N/A
--------------------------------------------------*/
static void K_PushToRouletteItemList(itemroulette_t *const roulette, kartitems_t item)
static void K_PushToRouletteItemList(itemroulette_t *const roulette, INT32 item)
{
#ifdef ITEM_LIST_SIZE
if (roulette->itemListLen >= ITEM_LIST_SIZE)
@ -1283,7 +1266,7 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette)
}
/*--------------------------------------------------
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette)
void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulette, boolean ringbox)
See header file for description.
--------------------------------------------------*/
@ -1306,6 +1289,20 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet
K_CalculateRouletteSpeed(roulette);
}
if (ringbox == true)
{
// If this is being invoked by a Ring Box, it should literally never produce items.
kartslotmachine_t *presetlist = K_KartItemReelRingBox;
roulette->ringbox = true;
for (i = 0; presetlist[i] != KSM__MAX; i++)
{
K_PushToRouletteItemList(roulette, presetlist[i]);
}
return;
}
// SPECIAL CASE No. 1:
// Give only the debug item if specified
if (cv_kartdebugitem.value != KITEM_NONE)
@ -1314,22 +1311,6 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet
return;
}
// SPECIAL CASE No. 1.5:
// If this is being invoked by a Ring Box, it should literally never produce items.
if (ringbox)
{
kartitems_t *presetlist = K_KartItemReelRingBox;
roulette->ringbox = true;
for (i = 0; presetlist[i] != KITEM_NONE; i++)
{
K_PushToRouletteItemList(roulette, presetlist[i]);
}
return;
}
// SPECIAL CASE No. 2:
// Use a special, pre-determined item reel for Time Attack / Free Play / End of Sealed Stars
if (specialstageinfo.valid)
@ -1618,9 +1599,18 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd)
// And one more nudge for the remaining delay.
roulette->tics = (roulette->tics + fudgedDelay) % roulette->speed;
kartitems_t finalItem = roulette->itemList[ roulette->index ];
INT32 finalItem = roulette->itemList[ roulette->index ];
K_KartGetItemResult(player, finalItem);
if (roulette->ringbox == true)
{
// TODO: add logic to make it give you the rings
//player->slotMachineType = finalItem;
//player->slotMachineDelay = TICRATE;
}
else
{
K_KartGetItemResult(player, finalItem);
}
player->karthud[khud_itemblink] = TICRATE;
player->karthud[khud_itemblinkmode] = 0;

View file

@ -446,9 +446,6 @@ hyudoro_patrol_hit_player
if (!player->itemamount)
return false;
if (K_IsRingBoxItem(player->itemtype))
return false;
K_AddHitLag(toucher, TICRATE/2, false);
hyudoro_mode(hyu) = HYU_RETURN;