Merge pull request #160 from mateusfavarin/main

Rewrite Box_DrawSolidBox
This commit is contained in:
mateusfavarin 2024-06-24 19:43:32 -03:00 committed by GitHub
commit a53b8c88e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 287 additions and 304 deletions

View File

@ -46,31 +46,31 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
u_int characterSelectString;
short playerIcon;
int direction;
short* psVar22;
struct CharacterSelectMeta* csm_Active;
struct GameTracker* gGT = sdata->gGT;
for (i = 0; i < 4; i++)
{
globalIconPerPlayer[i] = D230.characterMenuID[data.characterIDs[i]];
}
// if menu is not in focus
if (D230.isMenuTransitioning != 1)
if (D230.isMenuTransitioning != 1)
{
DECOMP_MM_TransitionInOut(D230.ptrTransitionMeta, (int)D230.transitionFrames, FPS_DOUBLE(8));
}
DECOMP_MM_Characters_SetMenuLayout();
DECOMP_MM_Characters_DrawWindows(1);
// if transitioning in
if (D230.isMenuTransitioning == 0)
if (D230.isMenuTransitioning == 0)
{
// if no more frames
if (D230.transitionFrames == 0)
if (D230.transitionFrames == 0)
{
// menu is now in focus
D230.isMenuTransitioning = 1;
@ -82,35 +82,35 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
}
// if transitioning out
if (D230.isMenuTransitioning == 2)
if (D230.isMenuTransitioning == 2)
{
// increase frame
D230.transitionFrames++;
// if more than 12 frames
if (D230.transitionFrames > FPS_DOUBLE(12))
if (D230.transitionFrames > FPS_DOUBLE(12))
{
// Make a backup of the characters
// you selected in character selection screen
DECOMP_MM_Characters_BackupIDs();
DECOMP_MM_Characters_HideDrivers();
// if returning to main menu
if (D230.movingToTrackMenu == 0)
if (D230.movingToTrackMenu == 0)
{
DECOMP_MM_JumpTo_Title_Returning();
return;
}
// if you are in a cup
if ((gGT->gameMode2 & CUP_ANY_KIND) != 0)
if ((gGT->gameMode2 & CUP_ANY_KIND) != 0)
{
sdata->ptrDesiredMenu = &D230.menuCupSelect;
DECOMP_MM_CupSelect_Init();
return;
}
// if going to track selection
sdata->ptrDesiredMenu = &D230.menuTrackSelect;
DECOMP_MM_TrackSelect_Init();
@ -122,10 +122,10 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
{
// 3P character selection
case 2:
// If you have a lot of characters unlocked, do not draw SELECT CHARACTER
if (D230.isRosterExpanded) goto dontDrawSelectCharacter;
// SELECT
DECOMP_DecalFont_DrawLine
(
@ -135,20 +135,20 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
FONT_BIG, (JUSTIFY_CENTER | ORANGE)
);
characterSelectType = FONT_BIG;
// CHARACTER
characterSelectString = sdata->lngStrings[97];
posX = D230.ptrTransitionMeta[15].currX + 0x9c;
posY = D230.ptrTransitionMeta[15].currY + 0x26;
break;
// 4P character selection
case 3:
// If Fake Crash is unlocked, do not draw "Select Character"
if (sdata->gameProgress.unlocks[0] & 0x800) goto dontDrawSelectCharacter;
// SELECT
DECOMP_DecalFont_DrawLine
(
@ -158,34 +158,34 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
FONT_CREDITS, (JUSTIFY_CENTER | ORANGE)
);
characterSelectType = FONT_CREDITS;
// CHARACTER
characterSelectString = sdata->lngStrings[97];
posX = D230.ptrTransitionMeta[15].currX + 0xfc;
posY = D230.ptrTransitionMeta[15].currY + 0x18;
break;
// If you are in 1P or 2P character selection,
// when you do NOT have a lot of characters selected
case 4:
case 5:
characterSelectType = FONT_BIG;
// SELECT CHARACTER
characterSelectString = sdata->lngStrings[95];
posX = D230.ptrTransitionMeta[15].currX + 0xfc;
posY = D230.ptrTransitionMeta[15].currY + 10;
break;
default:
goto dontDrawSelectCharacter;
}
// Draw String
DECOMP_DecalFont_DrawLine(characterSelectString, posX, posY, characterSelectType, (JUSTIFY_CENTER | ORANGE));
dontDrawSelectCharacter:
globalIconPerPlayerPtr = &globalIconPerPlayer[0];
@ -195,18 +195,18 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
characterSelectFlags5bit = (u_short)(1 << i);
globalIconPerPlayerCopy = globalIconPerPlayerPtr[i];
globalIconPerPlayerCopy2 = globalIconPerPlayerCopy;
DECOMP_MM_Characters_AnimateColors(auStack120, i, (int)(short)(sdata->characterSelectFlags & characterSelectFlags5bit));
puVar26 = &D230.csm_Active[globalIconPerPlayerCopy];
if
(
(D230.isMenuTransitioning == 1) &&
(D230.isMenuTransitioning == 1) &&
(
// get input from this player
button = sdata->buttonTapPerPlayer[i],
button = sdata->buttonTapPerPlayer[i],
// If you press the D-Pad, or Cross, Square, Triangle, Circle
button & (BTN_TRIANGLE | BTN_CIRCLE | BTN_SQUARE_one | BTN_CROSS_one | BTN_RIGHT | BTN_LEFT | BTN_DOWN | BTN_UP)
)
@ -216,58 +216,58 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
if (((int)(short)sdata->characterSelectFlags >> i & 1U) == 0)
{
// If you pressed any of the D-pad buttons
if ((button & (BTN_RIGHT | BTN_LEFT | BTN_DOWN | BTN_UP)) != 0)
if ((button & (BTN_RIGHT | BTN_LEFT | BTN_DOWN | BTN_UP)) != 0)
{
local_50 = 0;
// If you do not press Up
if ((button & BTN_UP) == 0)
{
if ((button & BTN_UP) == 0)
{
// If you do not press Down
if ((button & BTN_DOWN) == 0)
if ((button & BTN_DOWN) == 0)
{
// This must be if you press Left,
// because the variable will change
// if it is anything that isn't Left
// Left
direction = 2;
// If you press Left
if ((button & BTN_LEFT) != 0) goto LAB_800aec08;
// At this point, you must have pressed Right
// Right
direction = 3;
// Move down character selection list
D230.characterSelect_MoveDir[i] = 1;
}
// If you pressed Down
else
else
{
// Down
direction = 1;
// Move down character selection list
D230.characterSelect_MoveDir[i] = 1;
}
}
// If you pressed Up
else
else
{
// Up
direction = 0;
LAB_800aec08:
// If you press Up or Left
// Move up character selection list
(D230.characterSelect_MoveDir)[i] = 0xffff;
}
j = i;
globalIconPerPlayerPtr2 = &globalIconPerPlayerPtr[j];
globalIconPerPlayerCopy3 = globalIconPerPlayerCopy2;
@ -275,8 +275,8 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
{
globalIconPerPlayerCopy2 = DECOMP_MM_Characters_GetNextDriver(direction, globalIconPerPlayerCopy3);
globalIconPerPlayerCopy4 = globalIconPerPlayerCopy2;
if (globalIconPerPlayerCopy2 == globalIconPerPlayerCopy3)
if (globalIconPerPlayerCopy2 == globalIconPerPlayerCopy3)
{
local_50 = 1;
nextDriver = DECOMP_MM_Characters_GetNextDriver(direction, (int)(short)*globalIconPerPlayerPtr2);
@ -318,7 +318,7 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
(button = DECOMP_MM_Characters_boolIsInvalid(globalIconPerPlayerPtr, globalIconPerPlayerCopy4, j), (button & 0xffff) != 0)
)
)
)
)
{
nextDriver = DECOMP_MM_Characters_GetNextDriver((u_int)(u_char)D230.getNextDriver2[direction], (int)(short)*globalIconPerPlayerPtr2);
globalIconPerPlayerCopy5 = (int)nextDriver;
@ -338,7 +338,7 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
}
}
bVar2 = false;
for (k = 0; k < gGT->numPlyrNextGame; k++)
{
if((k != j) && ((short)globalIconPerPlayerCopy2 == globalIconPerPlayerPtr[k]))
@ -347,8 +347,8 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
break;
}
}
if (globalIconPerPlayerCopy3 << 0x10 != globalIconPerPlayerCopy2 << 0x10)
if (globalIconPerPlayerCopy3 << 0x10 != globalIconPerPlayerCopy2 << 0x10)
{
// Play sound
DECOMP_OtherFX_Play(0, 1);
@ -364,7 +364,7 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
} while (bVar2);
}
globalIconPerPlayerCopy = (u_short)globalIconPerPlayerCopy2;
for (j = 0; j < gGT->numPlyrNextGame; j++)
{
if ((j != i) && ((short)globalIconPerPlayerCopy2 == globalIconPerPlayerPtr[j]))
@ -373,66 +373,66 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
}
globalIconPerPlayerCopy = (u_short)globalIconPerPlayerCopy2;
}
// If this player pressed Cross or Circle
if (((sdata->buttonTapPerPlayer)[i] & (BTN_CIRCLE | BTN_CROSS_one)) != 0)
if (((sdata->buttonTapPerPlayer)[i] & (BTN_CIRCLE | BTN_CROSS_one)) != 0)
{
// this player has now selected a character
sdata->characterSelectFlags = sdata->characterSelectFlags | (u_short)(1 << i);
numPlyrNextGame = gGT->numPlyrNextGame;
// Play sound
DECOMP_OtherFX_Play(1,1);
// if all players have selected their characters
if ((int)(short)sdata->characterSelectFlags == (1 << numPlyrNextGame)-1)
if ((int)(short)sdata->characterSelectFlags == (1 << numPlyrNextGame)-1)
{
// move to track selection
D230.movingToTrackMenu = 1;
D230.isMenuTransitioning = 2;
}
}
if
(
// if this is the first iteration of the loop
((i & 0xffff) == 0) &&
((i & 0xffff) == 0) &&
// if you press Square or Triangle
((sdata->buttonTapPerPlayer[0] & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
)
)
{
// return to main menu
D230.movingToTrackMenu = 0;
D230.isMenuTransitioning = 2;
// Play sound
DECOMP_OtherFX_Play(2, 1);
}
}
else
else
{
// if you press Square or Triangle
if ((button & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
if ((button & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
{
// Play sound
DECOMP_OtherFX_Play(2, 1);
// this player has de-selected their character
sdata->characterSelectFlags = sdata->characterSelectFlags & ~characterSelectFlags5bit;
}
}
// clear input
sdata->buttonTapPerPlayer[i] = 0;
}
globalIconPerPlayerPtr[i] = globalIconPerPlayerCopy;
// transition of each icon
iVar24 = &D230.ptrTransitionMeta[globalIconPerPlayerCopy];
#ifdef USE_OXIDE
if (globalIconPerPlayerCopy == NITROS_OXIDE)
{
@ -440,14 +440,14 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
iVar24 = &D230.ptrTransitionMeta[FAKE_CRASH];
}
#endif
r80.x = ((struct TransitionMeta*)iVar24)->currX + *puVar26;
r80.y = ((struct TransitionMeta*)iVar24)->currY + puVar26[1];
r80.w = 0x34;
r80.h = 0x21;
// if player has not selected a character
if (((sdata->characterSelectFlags >> i) & 1U) == 0)
if (((sdata->characterSelectFlags >> i) & 1U) == 0)
{
// draw string
// "1", "2", "3", "4", above the character icon
@ -464,22 +464,22 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
{
puVar12 = &D230.characterSelect_Outline;
}
DECOMP_RECTMENU_DrawOuterRect_HighLevel(
&r80, puVar12, 0,
&r80, puVar12, 0,
gGT->backBuffer->otMem.startPlusFour);
}
DECOMP_MM_Characters_PreventOverlap();
csm_Active = D230.csm_Active;
#ifndef USE_OXIDE
#define NUM_ICONS 0xF
#else
#define NUM_ICONS 0x10
#endif
// loop through character icons
for (i = 0; i < NUM_ICONS; i++)
{
@ -489,12 +489,12 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
// If Icon is unlocked by default,
// dont use iVar8, must be interpeted as "short"
((short)csm_Active->unlockFlags == -1) ||
// if character is unlocked
// from 4-byte variable that handles all rewards
// also the variable written by cheats
(((sdata->gameProgress.unlocks[iVar8>>5] >> (iVar8&0x1f)) & 1) != 0)
)
)
{
iconColor = D230.characterSelect_NeutralColor;
@ -503,7 +503,7 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
if
(
((short)i == globalIconPerPlayer[j]) &&
// if player selected a character
(((int)(short)sdata->characterSelectFlags >> (j & 0x1fU) & 1U) != 0)
)
@ -511,9 +511,9 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
iconColor = D230.characterSelect_ChosenColor;
}
}
iVar8 = &D230.ptrTransitionMeta[i];
#ifdef USE_OXIDE
if (i == NITROS_OXIDE)
{
@ -534,41 +534,41 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
iconColor, iconColor, iconColor, iconColor, TRANS_50_DECAL, FP(1.0)
);
}
csm_Active++;
}
// reset
csm_Active = D230.csm_Active;
for (i = 0; i < 4; i++)
{
data.characterIDs[i] = csm_Active[(int)globalIconPerPlayer[i]].characterID;
}
for (i = 0; i < gGT->numPlyrNextGame; i++)
{
j = i;
playerIcon = globalIconPerPlayer[j];
csm_Active = &D230.csm_Active[playerIcon];
// if player has not selected a character
if (((int)(short)sdata->characterSelectFlags >> j & 1U) == 0)
if (((int)(short)sdata->characterSelectFlags >> j & 1U) == 0)
{
DECOMP_MM_Characters_AnimateColors
(
&colorRGBA, j,
// flags of which characters are selected
(int)(short)(sdata->characterSelectFlags & (u_short)(1 << j))
);
colorRGBA[0] = (u_char)((int)((u_int)colorRGBA[0] << 2) / 5);
colorRGBA[1] = (u_char)((int)((u_int)colorRGBA[1] << 2) / 5);
colorRGBA[2] = (u_char)((int)((u_int)colorRGBA[2] << 2) / 5);
iVar8 = &D230.ptrTransitionMeta[playerIcon];
#ifdef USE_OXIDE
if (playerIcon == NITROS_OXIDE)
{
@ -576,42 +576,38 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
iVar8 = &D230.ptrTransitionMeta[FAKE_CRASH];
}
#endif
r80.x = ((struct TransitionMeta*)iVar8)->currX + csm_Active->posX + 3;
r80.y = ((struct TransitionMeta*)iVar8)->currY + csm_Active->posY + 2;
r80.w = 0x2e;
r80.h = 0x1d;
Color color = *(Color *) &colorRGBA;
// this draws the flashing blue square that appears when you highlight a character in the character select screen
DECOMP_CTR_Box_DrawSolidBox
(
&r80, &colorRGBA,
gGT->backBuffer->otMem.startPlusFour,
&gGT->backBuffer->primMem
);
DECOMP_CTR_Box_DrawSolidBox(&r80, color, gGT->backBuffer->otMem.startPlusFour);
}
if
(
(D230.timerPerPlayer[j] == 0) &&
(D230.characterSelect_charIDs_curr[j] == data.characterIDs[j])
)
)
{
// get number of players
numPlyrNextGame = gGT->numPlyrNextGame;
// if number of players is 1 or 2
fontType = FONT_CREDITS;
// if number of players is 3 or 4
if (numPlyrNextGame >= 3) fontType = FONT_SMALL;
iVar8 = &D230.ptrTransitionMeta[j+0x10];
sVar10 = ((struct TransitionMeta*)iVar8)->currY + D230.characterSelect_ptrWindowXY[j*2+1];
sVar6 = (short)((((u_int)(numPlyrNextGame < 3) ^ 1) << 0x12) >> 0x10);
if ((numPlyrNextGame == 4) && (j > 1)) sVar6 = sVar10 + sVar6 - 6;
else sVar6 = sVar10 + D230.textPos + sVar6;
// draw string
DECOMP_DecalFont_DrawLine
(
@ -620,11 +616,11 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
(int)sVar6, fontType, (JUSTIFY_CENTER | ORANGE)
);
}
// spin the character
D230.characterSelect_angle[i] += FPS_HALF(0x40);
}
// reset
csm_Active = D230.csm_Active;
@ -632,17 +628,17 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
for (i = 0; i < NUM_ICONS; i++)
{
iVar8 = csm_Active[i].unlockFlags;
if
(
// If Icon is unlocked (from array of icons)
((short)csm_Active[i].unlockFlags == -1) ||
// if character is unlocked
// from 4-byte variable that handles all rewards
// also the variable written by cheats
((sdata->gameProgress.unlocks[iVar8 >> 5] >> (iVar8 & 0x1fU) & 1) != 0)
)
)
{
iVar8 = &D230.ptrTransitionMeta[i];
@ -659,15 +655,15 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
r68.w = 0x34;
r68.h = 0x21;
// Draw 2D Menu rectangle background
DECOMP_RECTMENU_DrawInnerRect(
&r68, 0, gGT->backBuffer->otMem.startPlusFour);
}
}
// if number of players is not zero
if (gGT->numPlyrNextGame != 0)
if (gGT->numPlyrNextGame != 0)
{
psVar22 = D230.characterSelect_ptrWindowXY;
@ -675,60 +671,60 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
{
j = i;
iVar8 = &D230.ptrTransitionMeta[j];
// store window width and height in one 4-byte variable
r60.x = *(short *)(iVar8 + 0xa6) + *psVar22;
r60.y = *(short *)(iVar8 + 0xa8) + psVar22[1];
r60.w = D230.characterSelect_sizeX;
r60.h = D230.characterSelect_sizeY;
DECOMP_MM_Characters_AnimateColors
(
&colorRGBA, j,
&colorRGBA, j,
// flags of which characters are selected
((int)(short)sdata->characterSelectFlags >> j ^ 1U) & 1
);
DECOMP_RECTMENU_DrawOuterRect_HighLevel(
&r60, &colorRGBA, 0,
&r60, &colorRGBA, 0,
gGT->backBuffer->otMem.startPlusFour);
// if player selected a character
if (((int)(short)sdata->characterSelectFlags >> j & 1U) != 0)
if (((int)(short)sdata->characterSelectFlags >> j & 1U) != 0)
{
r58.x = r60.x;
r58.y = r60.y;
r58.w = r60.w;
r58.h = r60.h;
for (iVar8 = 0; iVar8 < 2; iVar8++)
{
r58.x += 3;
r58.y += 2;
r58.w -= 6;
r58.h -= 4;
colorRGBA[0] = (u_char)((int)((u_int)colorRGBA[0] << 2) / 5);
colorRGBA[1] = (u_char)((int)((u_int)colorRGBA[1] << 2) / 5);
colorRGBA[2] = (u_char)((int)((u_int)colorRGBA[2] << 2) / 5);
DECOMP_RECTMENU_DrawOuterRect_HighLevel(
&r58, &colorRGBA, 0,
&r58, &colorRGBA, 0,
gGT->backBuffer->otMem.startPlusFour);
}
}
psVar22 = psVar22 + 2;
// Draw 2D Menu rectangle background
DECOMP_RECTMENU_DrawInnerRect(
&r60, 9, &gGT->backBuffer->otMem.startPlusFour[3]);
// not screen-space anymore,
// this is viewport-space
r60.x = 0;
r60.y = 0;
DECOMP_RECTMENU_DrawRwdBlueRect
(
&r60.x, &D230.characterSelect_BlueRectColors[0],

View File

@ -29,7 +29,7 @@ force_inline int GETNEXTCHARACTER_MM_Characters_MenuProc(int idx, u_int button,
if (drtnChrFromCurrPos == currCharacter)
{
isDrtnChrFromCurrPosUnavailable = true;
// directional character from original position //
// adjacent character slot in the direction pressed, from the position of the slot highlighted prior to the execution of this function
int drtnChrFromOGPos = DECOMP_MM_Characters_GetNextDriver(direction, characterMenuIDCurrPlayer);
@ -54,7 +54,7 @@ force_inline int GETNEXTCHARACTER_MM_Characters_MenuProc(int idx, u_int button,
// perpendicular character from original position //
// character slot perpendicular from the slot highlighted prior to this function
int perpChrFromOGPos = DECOMP_MM_Characters_GetNextDriver(D230.getNextDriver1[direction], characterMenuIDCurrPlayer);
// character directional to perpendicular character from original position //
// adjacent character slot in the direction pressed, from the one perpendicular to the slot highlighted prior to this function
int chrDrtnToPerpFromOGPos = DECOMP_MM_Characters_GetNextDriver(direction, perpChrFromOGPos);
@ -168,11 +168,11 @@ force_inline void PROCESSINPUTS_MM_Characters_MenuProc(int idx, int characterSel
if
(
(D230.isMenuTransitioning == IN_MENU) &&
(D230.isMenuTransitioning == IN_MENU) &&
(
// get input from this player
button = sdata->buttonTapPerPlayer[idx],
button = sdata->buttonTapPerPlayer[idx],
// If you press the D-Pad, or Cross, Square, Triangle, Circle
button & (BTN_TRIANGLE | BTN_CIRCLE | BTN_SQUARE_one | BTN_CROSS_one | BTN_RIGHT | BTN_LEFT | BTN_DOWN | BTN_UP)
)
@ -216,38 +216,38 @@ force_inline void PROCESSINPUTS_MM_Characters_MenuProc(int idx, int characterSel
}
// If this player pressed Cross or Circle
if (((sdata->buttonTapPerPlayer)[idx] & (BTN_CIRCLE | BTN_CROSS_one)) != 0)
if (((sdata->buttonTapPerPlayer)[idx] & (BTN_CIRCLE | BTN_CROSS_one)) != 0)
{
// this player has now selected a character
sdata->characterSelectFlags |= (1 << idx);
int numPlyrNextGame = gGT->numPlyrNextGame;
// Play sound
DECOMP_OtherFX_Play(1,1);
// if all players have selected their characters
if (sdata->characterSelectFlags == (1 << numPlyrNextGame)-1)
if (sdata->characterSelectFlags == (1 << numPlyrNextGame)-1)
{
// move to track selection
D230.movingToTrackMenu = true;
D230.isMenuTransitioning = EXITING_MENU;
}
}
if
(
// if this is the first iteration of the loop
(idx == 0) &&
(idx == 0) &&
// if you press Square or Triangle
((sdata->buttonTapPerPlayer[0] & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
)
)
{
// return to main menu
D230.movingToTrackMenu = false;
D230.isMenuTransitioning = EXITING_MENU;
// Play sound
DECOMP_OtherFX_Play(2, 1);
}
@ -255,11 +255,11 @@ force_inline void PROCESSINPUTS_MM_Characters_MenuProc(int idx, int characterSel
else
{
// if you press Square or Triangle
if ((button & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
if ((button & (BTN_TRIANGLE | BTN_SQUARE_one)) != 0)
{
// Play sound
DECOMP_OtherFX_Play(2, 1);
// this player has de-selected their character
sdata->characterSelectFlags &= ~characterSelectPlayerID;
}
@ -301,7 +301,7 @@ force_inline void PLAYERPOLLING_MM_Characters_MenuProc(struct CharacterSelectMet
characterSlotTransition = &D230.ptrTransitionMeta[14]; // fake crash
}
#endif
RECT r80 =
{
.x = characterSlotTransition->currX + playerCSM->posX,
@ -311,7 +311,7 @@ force_inline void PLAYERPOLLING_MM_Characters_MenuProc(struct CharacterSelectMet
};
// if player has not selected a character
if (((sdata->characterSelectFlags >> i) & 1) == 0)
if (((sdata->characterSelectFlags >> i) & 1) == 0)
{
// draw string
// "1", "2", "3", "4", above the character icon
@ -328,10 +328,10 @@ force_inline void PLAYERPOLLING_MM_Characters_MenuProc(struct CharacterSelectMet
{
characterSlotHighlightColor = &D230.characterSelect_Outline;
}
DECOMP_RECTMENU_DrawOuterRect_HighLevel
(
&r80, characterSlotHighlightColor, 0,
&r80, characterSlotHighlightColor, 0,
gGT->backBuffer->otMem.startPlusFour
);
}
@ -364,7 +364,7 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
{
// 3P character selection
case 2:
// SELECT
DECOMP_DecalFont_DrawLine
(
@ -374,17 +374,17 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
FONT_BIG, (JUSTIFY_CENTER | ORANGE)
);
characterSelectFontType = FONT_BIG;
// CHARACTER
selectCharacterString = sdata->lngStrings[97];
selectCharacterPosX = D230.ptrTransitionMeta[15].currX + 156;
selectCharacterPosY = D230.ptrTransitionMeta[15].currY + 38;
break;
// 4P character selection
case 3:
// SELECT
DECOMP_DecalFont_DrawLine
(
@ -394,28 +394,28 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
FONT_CREDITS, (JUSTIFY_CENTER | ORANGE)
);
characterSelectFontType = FONT_CREDITS;
// CHARACTER
selectCharacterString = sdata->lngStrings[97];
selectCharacterPosX = D230.ptrTransitionMeta[15].currX + 252;
selectCharacterPosY = D230.ptrTransitionMeta[15].currY + 24;
break;
// If you are in 1P or 2P character selection,
// when you do NOT have a lot of characters selected
case 4:
case 5:
characterSelectFontType = FONT_BIG;
// SELECT CHARACTER
selectCharacterString = sdata->lngStrings[95];
selectCharacterPosX = D230.ptrTransitionMeta[15].currX + 252;
selectCharacterPosY = D230.ptrTransitionMeta[15].currY + 10;
break;
}
// Draw String
DECOMP_DecalFont_DrawLine
(
@ -442,12 +442,12 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
// If character slot is unlocked by default, don't use characterSelectUnlockFlags
// must be cast as signed
((short)csm_Active->unlockFlags == -1) ||
// if character is unlocked
// from 4-byte variable that handles all rewards
// also the variable written by cheats
(((sdata->gameProgress.unlocks[characterSelectUnlockFlags>>5] >> (characterSelectUnlockFlags&0x1f)) & 1) != 0)
)
)
{
u_int iconColor = D230.characterSelect_NeutralColor;
@ -456,7 +456,7 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
if
(
((short)i == characterMenuIDPerPlayer[j]) &&
// if player selected a character
(((int)(short)sdata->characterSelectFlags >> (j & 0x1fU) & 1U) != 0)
)
@ -464,9 +464,9 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
iconColor = D230.characterSelect_ChosenColor;
}
}
struct TransitionMeta* characterSlotTransition = &D230.ptrTransitionMeta[i];
#ifdef USE_OXIDE
// can't actually use the characters enum here since these use a different order
if (i == 15) // nitros oxide
@ -496,24 +496,24 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
{
int characterMenuIDCurrPlayer = characterMenuIDPerPlayer[i];
struct CharacterSelectMeta* csm_Active = &D230.csm_Active[characterMenuIDCurrPlayer];
// if player has not selected a character
if (((int)(short)sdata->characterSelectFlags >> i & 1U) == 0)
if (((int)(short)sdata->characterSelectFlags >> i & 1U) == 0)
{
DECOMP_MM_Characters_AnimateColors
(
&colorRGBA, i,
// flags of which characters are selected
(int)(short)(sdata->characterSelectFlags & (u_short)(1 << i))
);
colorRGBA[0] = (u_char)((int)((u_int)colorRGBA[0] << 2) / 5);
colorRGBA[1] = (u_char)((int)((u_int)colorRGBA[1] << 2) / 5);
colorRGBA[2] = (u_char)((int)((u_int)colorRGBA[2] << 2) / 5);
struct TransitionMeta* characterSlotTransition = &D230.ptrTransitionMeta[characterMenuIDCurrPlayer];
#ifdef USE_OXIDE
// can't actually use the characters enum here since these use a different order
if (characterMenuIDCurrPlayer == 15) // nitros oxide
@ -522,7 +522,7 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
characterSlotTransition = &D230.ptrTransitionMeta[14]; // fake crash
}
#endif
RECT r80 =
{
.x = characterSlotTransition->currX + csm_Active->posX + 3,
@ -531,37 +531,33 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
.h = 29,
};
Color color = *(Color *) &colorRGBA;
// this draws the flashing square that appears when you highlight a character in the character select screen
DECOMP_CTR_Box_DrawSolidBox
(
&r80, &colorRGBA,
gGT->backBuffer->otMem.startPlusFour,
&gGT->backBuffer->primMem
);
DECOMP_CTR_Box_DrawSolidBox(&r80, color, gGT->backBuffer->otMem.startPlusFour);
}
if
(
(D230.timerPerPlayer[i] == 0) &&
(D230.characterSelect_charIDs_curr[i] == data.characterIDs[i])
)
)
{
// get number of players
int numPlyrNextGame = gGT->numPlyrNextGame;
// if number of players is 1 or 2
int fontType = FONT_CREDITS;
// if number of players is 3 or 4
if (numPlyrNextGame >= 3) fontType = FONT_SMALL;
struct TransitionMeta* transitionMeta = &D230.ptrTransitionMeta[i+0x10];
short sVar10 = transitionMeta->currY + D230.characterSelect_ptrWindowXY[i*2+1];
short sVar6 = (short)((((u_int)(numPlyrNextGame < 3) ^ 1) << 0x12) >> 0x10);
if ((numPlyrNextGame == 4) && (i > 1)) sVar6 = sVar10 + sVar6 - 6;
else sVar6 = sVar10 + D230.textPos + sVar6;
// draw character name string
DECOMP_DecalFont_DrawLine
(
@ -570,7 +566,7 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
(int)sVar6, fontType, (JUSTIFY_CENTER | ORANGE)
);
}
// spin the character
D230.characterSelect_angle[i] += FPS_HALF(0x40);
}
@ -582,17 +578,17 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
for (int i = 0; i < NUM_ICONS; i++)
{
u_short characterSelectUnlockFlags = csm_Active[i].unlockFlags;
if
(
// If Icon is unlocked (from array of icons)
((short)csm_Active[i].unlockFlags == -1) ||
// if character is unlocked
// from 4-byte variable that handles all rewards
// also the variable written by cheats
((sdata->gameProgress.unlocks[characterSelectUnlockFlags >> 5] >> (characterSelectUnlockFlags & 0x1fU) & 1) != 0)
)
)
{
struct TransitionMeta* characterSlotTransition = &D230.ptrTransitionMeta[i];
@ -619,14 +615,14 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
}
// if number of players is not zero
if (gGT->numPlyrNextGame != 0)
if (gGT->numPlyrNextGame != 0)
{
short* characterSelect_ptrWindowXY = D230.characterSelect_ptrWindowXY;
for (int i = 0; i < gGT->numPlyrNextGame; i++)
{
struct TransitionMeta* transitionMeta = &D230.ptrTransitionMeta[i];
// store window width and height in one 4-byte variable
RECT r60 =
@ -639,18 +635,18 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
DECOMP_MM_Characters_AnimateColors
(
&colorRGBA, i,
&colorRGBA, i,
// flags of which characters are selected
((int)(short)sdata->characterSelectFlags >> i ^ 1U) & 1
);
DECOMP_RECTMENU_DrawOuterRect_HighLevel(
&r60, &colorRGBA, 0,
&r60, &colorRGBA, 0,
gGT->backBuffer->otMem.startPlusFour);
// if player selected a character
if (((int)(short)sdata->characterSelectFlags >> i & 1U) != 0)
if (((int)(short)sdata->characterSelectFlags >> i & 1U) != 0)
{
RECT r58 =
{
@ -659,34 +655,34 @@ force_inline void DISPLAYRECTMENU_MM_Characters_MenuProc(int* characterMenuIDPer
.w = r60.w,
.h = r60.h,
};
for (int j = 0; j < 2; j++)
{
r58.x += 3;
r58.y += 2;
r58.w -= 6;
r58.h -= 4;
colorRGBA[0] = (u_char)((int)((u_int)colorRGBA[0] << 2) / 5);
colorRGBA[1] = (u_char)((int)((u_int)colorRGBA[1] << 2) / 5);
colorRGBA[2] = (u_char)((int)((u_int)colorRGBA[2] << 2) / 5);
DECOMP_RECTMENU_DrawOuterRect_HighLevel(
&r58, &colorRGBA, 0,
&r58, &colorRGBA, 0,
gGT->backBuffer->otMem.startPlusFour);
}
}
characterSelect_ptrWindowXY = characterSelect_ptrWindowXY + 2;
// Draw 2D Menu rectangle background
DECOMP_RECTMENU_DrawInnerRect(
&r60, 9, &gGT->backBuffer->otMem.startPlusFour[3]);
// not screen-space anymore,
// this is viewport-space
r60.x = 0;
r60.y = 0;
DECOMP_RECTMENU_DrawRwdBlueRect
(
&r60.x, &D230.characterSelect_BlueRectColors[0],
@ -708,19 +704,19 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
}
// if menu is not in focus
if (D230.isMenuTransitioning != IN_MENU)
if (D230.isMenuTransitioning != IN_MENU)
{
DECOMP_MM_TransitionInOut(D230.ptrTransitionMeta, (int)D230.transitionFrames, FPS_DOUBLE(8));
}
DECOMP_MM_Characters_SetMenuLayout();
DECOMP_MM_Characters_DrawWindows(1);
// if transitioning in
if (D230.isMenuTransitioning == ENTERING_MENU)
if (D230.isMenuTransitioning == ENTERING_MENU)
{
// if no more frames
if (D230.transitionFrames == 0)
if (D230.transitionFrames == 0)
{
// menu is now in focus
D230.isMenuTransitioning = IN_MENU;
@ -732,35 +728,35 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused)
}
// if transitioning out
if (D230.isMenuTransitioning == EXITING_MENU)
if (D230.isMenuTransitioning == EXITING_MENU)
{
// increase frame
D230.transitionFrames++;
// if more than 12 frames
if (D230.transitionFrames > FPS_DOUBLE(12))
if (D230.transitionFrames > FPS_DOUBLE(12))
{
// Make a backup of the characters
// you selected in character selection screen
DECOMP_MM_Characters_BackupIDs();
DECOMP_MM_Characters_HideDrivers();
// if returning to main menu
if (D230.movingToTrackMenu == 0)
if (D230.movingToTrackMenu == 0)
{
DECOMP_MM_JumpTo_Title_Returning();
return;
}
// if you are in a cup
if ((gGT->gameMode2 & CUP_ANY_KIND) != 0)
if ((gGT->gameMode2 & CUP_ANY_KIND) != 0)
{
sdata->ptrDesiredMenu = &D230.menuCupSelect;
DECOMP_MM_CupSelect_Init();
return;
}
// if going to track selection
sdata->ptrDesiredMenu = &D230.menuTrackSelect;
DECOMP_MM_TrackSelect_Init();

View File

@ -123,7 +123,7 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
}
// optimization, dont do this here, it's duplicated in the OG game
// in MainStats_RestartRaceCountLoss, which happens at the start of
// in MainStats_RestartRaceCountLoss, which happens at the start of
// battle, not just when you restart a race
#if 0
// Reset team points
@ -168,16 +168,16 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
{
// play sound
DECOMP_OtherFX_Play(0, 1);
// Move your icon to the left
gGT->battleSetup.teamOfEachPlayer[i]--;
}
// clear the gamepad input so that it
// does not use this frame's input on the next frame
sdata->buttonTapPerPlayer[i] = 0;
}
// If you press Right on D-Pad or move stick to the Right
if ((sdata->buttonTapPerPlayer[i] & 8) != 0)
{
@ -187,11 +187,11 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
{
// play sound
DECOMP_OtherFX_Play(0, 1);
// Move your icon to the right
gGT->battleSetup.teamOfEachPlayer[i]++;
}
// clear the gamepad input so that it
// does not use this frame's input on the next frame
sdata->buttonTapPerPlayer[i] = 0;
@ -212,7 +212,7 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
if ((short)sdata->battleSetupExpandMenu < 0)
{
int buttonTapP1 = sdata->buttonTapPerPlayer[0];
// If you dont press Up
if ((buttonTapP1 & 1) == 0)
{
@ -540,7 +540,7 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
DECOMP_RECTMENU_ClearInput();
}
struct TransitionMeta* tmbattle =
struct TransitionMeta* tmbattle =
&D230.transitionMeta_battle[0];
// "SETUP BATTLE"
@ -568,10 +568,10 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
}
DECOMP_RECTMENU_DrawSelf(
&D230.menuBattleType,
&D230.menuBattleType,
tmbattle[0].currX + 0x9c + WIDE_PICK(0,25),
tmbattle[0].currY + 0x24, WIDE_34(0x134));
local_38 = 0xd;
DECOMP_RECTMENU_GetHeight(&D230.menuBattleType, &local_38, 0);
sVar6 = local_38 + 0x20;
@ -594,7 +594,7 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
if (D230.menuBattleType.rowSelected == 2)
{
D230.menuBattleLengthLifeTime.state &= ~(0x100 | SHOW_ONLY_HIGHLIT_ROW);
if (sdata->battleSetupExpandMenu != 1)
{
D230.menuBattleLengthLifeTime.state |= 0x40;
@ -603,13 +603,13 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
{
D230.menuBattleLengthLifeTime.state |= 0x100;
}
DECOMP_RECTMENU_DrawSelf(&D230.menuBattleLengthLifeTime,
tmbattle[2].currX + 0x9c + WIDE_PICK(0,25),
tmbattle[2].currY + sVar6 + 4, WIDE_34(0x8e));
D230.menuBattleLengthLifeLife.state &= ~(0x100 | SHOW_ONLY_HIGHLIT_ROW);
if (sdata->battleSetupExpandMenu != 10)
{
D230.menuBattleLengthLifeLife.state |= 0x40;
@ -618,11 +618,11 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
{
D230.menuBattleLengthLifeLife.state |= 0x100;
}
DECOMP_RECTMENU_DrawSelf(&D230.menuBattleLengthLifeLife,
tmbattle[2].currX + 0x142 - WIDE_PICK(0,16),
tmbattle[2].currY + sVar6 + 4, WIDE_34(0x8e));
local_38 = 0xd;
DECOMP_RECTMENU_GetHeight(&D230.menuBattleLengthLifeTime, &local_38, 0);
local_36 = 0xd;
@ -639,9 +639,9 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
goto LAB_800b25f0;
box = &D230.menuBattleLengthPoints;
}
box->state &= ~(0x100 | SHOW_ONLY_HIGHLIT_ROW);
if (sdata->battleSetupExpandMenu != 1)
{
box->state |= 0x40;
@ -650,17 +650,17 @@ void DECOMP_MM_Battle_MenuProc(struct RectMenu* unused)
{
box->state |= 0x100;
}
DECOMP_RECTMENU_DrawSelf(box,
DECOMP_RECTMENU_DrawSelf(box,
tmbattle[2].currX + 0x9c + WIDE_PICK(0,25),
tmbattle[2].currY + sVar6 + 4, WIDE_34(0x134));
local_38 = 0xd;
DECOMP_RECTMENU_GetHeight(box, &local_38, 0);
sVar20 = local_38 + sVar6;
LAB_800b25f0:
iVar8 = 0x9f;
// "TEAMS:"
@ -687,7 +687,7 @@ LAB_800b25f0:
iVar16 = iVar16 + WIDE_34(0x2a);
}
}
i = iVar16 + 4;
}
@ -726,7 +726,7 @@ LAB_800b25f0:
gGT->ptrIcons[data.MetaDataCharacters[data.characterIDs[iVar16]].iconID],
(int)tmbattle[4].currX + (int)sVar6 + WIDE_PICK(0,25),
(int)tmbattle[4].currY + (int)sVar20 + 6,
&gGT->backBuffer->primMem,
gGT->pushBuffer_UI.ptrOT,
1, 0x1000);
@ -737,13 +737,14 @@ LAB_800b25f0:
local_48.x = tmbattle[4].currX + (short)iVar8 + WIDE_PICK(0,25);
local_48.y = tmbattle[4].currY + sVar20 + 5;
iVar8 = iVar8 + (u_int)uVar4;
local_48.w = uVar4;
Color color;
color.self = data.ptrColor[PLAYER_BLUE+i];
DECOMP_CTR_Box_DrawSolidBox(
&local_48, data.ptrColor[PLAYER_BLUE+i],
gGT->backBuffer->otMem.startPlusFour,
&gGT->backBuffer->primMem);
&local_48, color,
gGT->backBuffer->otMem.startPlusFour);
}
if (sdata->battleSetupRowHighlighted == 2)
@ -758,7 +759,7 @@ LAB_800b25f0:
gGT->backBuffer->otMem.startPlusFour,
&gGT->backBuffer->primMem);
}
local_40.w = WIDE_34(0x140);
local_40.h = 0x24;
local_40.x = tmbattle[4].currX + 0x96 + WIDE_PICK(0,25);
@ -820,8 +821,8 @@ LAB_800b25f0:
// the player from starting the Battle
if (j == 0)
{
D230.menuBattleStartGame.state &= ~(0x100 | SHOW_ONLY_HIGHLIT_ROW);
D230.menuBattleStartGame.state &= ~(0x100 | SHOW_ONLY_HIGHLIT_ROW);
if (sdata->battleSetupExpandMenu != 5)
{
D230.menuBattleStartGame.state |= SHOW_ONLY_HIGHLIT_ROW;
@ -830,10 +831,10 @@ LAB_800b25f0:
{
D230.menuBattleStartGame.state |= 0x100;
}
DECOMP_RECTMENU_DrawSelf(&D230.menuBattleStartGame,
DECOMP_RECTMENU_DrawSelf(&D230.menuBattleStartGame,
tmbattle[8].currX + 0x9c + WIDE_PICK(0,25),
tmbattle[8].currY + sVar20 + 0x78, WIDE_34(0x134));
local_38 = 0xd;
DECOMP_RECTMENU_GetHeight(&D230.menuBattleStartGame, &local_38, 0);
}
@ -858,7 +859,7 @@ LAB_800b25f0:
// Loop through all 11 weapon icons
for (i = 0; i < 11; i++)
{
{
iVar8 = (int)(short)i;
j = (iVar8 / 6);
@ -874,10 +875,10 @@ LAB_800b25f0:
// iVar4 % 6
// Go to 2nd row after 6th icon
iVar13 = (u_int)local_40.x + 6 +
(iVar8 % 6) * WIDE_34(0x34) +
iVar13 = (u_int)local_40.x + 6 +
(iVar8 % 6) * WIDE_34(0x34) +
j * WIDE_34(0x1a);
j = (u_int)local_40.y + 2 +
j * 0x20;

View File

@ -1,33 +1,23 @@
#include <common.h>
void DECOMP_CTR_Box_DrawSolidBox(RECT* r, u_int* colorPtr, u_long* otMem, struct PrimMem* primMem)
void DECOMP_CTR_Box_DrawSolidBox(RECT * r, Color color, u_long * ot)
{
struct PrimMem* primmemCurr = (struct PrimMem*)primMem->curr;
POLY_F4* p = NULL;
if (primmemCurr <= (struct PrimMem*)primMem->endMin100)
{
p = (POLY_F4*)primmemCurr;
primMem->curr = p + 1;
}
PolyF4 * p;
GetPrimMem(p);
if (p == nullptr) { return; }
if (p == NULL) return;
const PrimCode primCode = { .poly = { .renderCode = RenderCode_Polygon, .quad = 1 } };
color.code = primCode;
*(int*)&p->r0 = *colorPtr;
p->code = 0x28;
p->x0 = r->x;
p->y0 = r->y;
p->colorCode = color;
p->v[0].pos.x = r->x;
p->v[0].pos.y = r->y;
p->v[1].pos.x = r->x + r->w;
p->v[1].pos.y = r->y;
p->v[2].pos.x = r->x;
p->v[2].pos.y = r->y + r->h;
p->v[3].pos.x = r->x + r->w;
p->v[3].pos.y = r->y + r->h;
p->x1 = (r->x + r->w);
p->y1 = r->y;
p->x2 = r->x;
p->y2 = (r->y + r->h);
p->x3 = (r->x + r->w);
p->y3 = (r->y + r->h);
p->tag = *otMem & 0xffffff | 0x5000000;
*otMem = (u_int)p & 0xffffff;
AddPrimitive(p, ot);
}

View File

@ -2,9 +2,9 @@
/**
* @brief Draws an inner rectangle for a menu box with various styles depending on the type.
* This function is part of the UI system for drawing menu boxes and allows for different
* This function is part of the UI system for drawing menu boxes and allows for different
* styles like transparent or solid black, as well as additional customizations.
* The function adjusts the dimensions and style of the rectangle based on type
* The function adjusts the dimensions and style of the rectangle based on type
* and then draws it using specific graphical functions.
* Byte budget: 508/572
* Function Identifier: FUN_800457b0
@ -43,9 +43,9 @@ void DECOMP_RECTMENU_DrawInnerRect(RECT *r, int type, void *ot)
adjustedRect.w = r->w;
adjustedRect.h = r->h;
if ((type & 8) == 0)
if ((type & 8) == 0)
{
if ((type & 2) == 0)
if ((type & 2) == 0)
{
// Modify RECT components directly
adjustedRect.x += 3;
@ -54,7 +54,7 @@ void DECOMP_RECTMENU_DrawInnerRect(RECT *r, int type, void *ot)
adjustedRect.h -= 4;
}
if ((type & 1) == 0)
if ((type & 1) == 0)
{
drawMode = ((type & 0x100) != 0) ? 2 : 0;
colorDataSpecial = ((type & 0x100) != 0) ? &sdata->DrawSolidBoxData[1] : &sdata->DrawSolidBoxData[2];
@ -64,25 +64,23 @@ void DECOMP_RECTMENU_DrawInnerRect(RECT *r, int type, void *ot)
&adjustedRect, colorDataSpecial, drawMode, ot,
&sdata->gGT->backBuffer->primMem
);
}
else
}
else
{
DECOMP_CTR_Box_DrawSolidBox
(
&adjustedRect, &sdata->DrawSolidBoxData[0], ot,
&sdata->gGT->backBuffer->primMem
);
Color color;
color.self = sdata->DrawSolidBoxData[0];
DECOMP_CTR_Box_DrawSolidBox(&adjustedRect, color, ot);
}
}
// Draw shadow under the menu
if ((type & 4) == 0)
if ((type & 4) == 0)
{
short horizontalOffset = ((type & 0x80) != 0) ? WIDE_34(4) : WIDE_34(0xc);
short verticalOffset = ((type & 0x40) != 0) ? 2 : 6;
adjustedRect.x = r->x + r->w;
adjustedRect.y = r->y + verticalOffset;
adjustedRect.y = r->y + verticalOffset;
adjustedRect.w = horizontalOffset;
adjustedRect.h = r->h;
@ -94,7 +92,7 @@ void DECOMP_RECTMENU_DrawInnerRect(RECT *r, int type, void *ot)
);
adjustedRect.x = r->x + horizontalOffset;
adjustedRect.y = r->y + r->h;
adjustedRect.y = r->y + r->h;
adjustedRect.w = r->w - horizontalOffset;
adjustedRect.h = verticalOffset;

View File

@ -5,7 +5,9 @@ void DECOMP_RECTMENU_DrawOuterRect_Edge(RECT* r, u_int* rgb, u_int param_3, u_lo
if ((param_3 & 0x20) == 0)
{
// solid border
DECOMP_CTR_Box_DrawSolidBox(r, rgb, otMem, &sdata->gGT->backBuffer->primMem);
Color color;
color.self = *rgb;
DECOMP_CTR_Box_DrawSolidBox(r, color, otMem);
}
else
{

View File

@ -7,7 +7,7 @@ void DECOMP_UI_DrawSpeedNeedle(short posX, short posY, struct Driver * driver)
int maxScale = 100; // USF
int speed = MATH_FastSqrt((driver->xSpeed * driver->xSpeed) + (driver->zSpeed * driver->zSpeed), 0);
#else
int maxScale = accelSpeed + FP8_INT(driver->const_SacredFireSpeed);
int maxScale = driver->const_AccelSpeed_ClassStat + FP8_INT(driver->const_SacredFireSpeed);
int speed = driver->unk36E; // is this actually speed?
#endif
int minAngle, maxAngle;
@ -16,7 +16,7 @@ void DECOMP_UI_DrawSpeedNeedle(short posX, short posY, struct Driver * driver)
#ifdef USE_ONLINE
maxAngle = ANG(67.5);
#else
maxRange = ANG(157.5);
maxAngle = ANG(157.5);
#endif
minAngle = ANG(213.75);
minScale = (accelSpeedInt * 108000) / 64000;

View File

@ -33,7 +33,7 @@ void DECOMP_CTR_CycleTex_Model(struct AnimTex* animtex, int timer);
void DECOMP_CTR_Box_DrawWireBox(RECT * r, Color color, void * ot);
void DECOMP_CTR_Box_DrawClearBox(RECT* r, u_int* colorPtr, int transparency, u_long* ot, struct PrimMem* primMem);
void DECOMP_CTR_Box_DrawSolidBox(RECT* r, u_int* colorPtr, u_long* otMem, struct PrimMem* primMem);
void DECOMP_CTR_Box_DrawSolidBox(RECT * r, Color color, u_long * ot);
// decal
void DECOMP_DecalFont_DrawLine(char* str, int posX, int posY, short fontType, int flags);