Character Select PC port

This commit is contained in:
Niko 2023-11-16 01:26:47 -05:00
parent b076b16775
commit 80cbff5c9e
17 changed files with 179 additions and 28 deletions

View File

@ -85,6 +85,7 @@ void DECOMP_MM_Characters_DrawWindows(char wheelFlag)
tileview->rot[1] = 0;
tileview->rot[2] = 0;
#ifndef REBUILD_PS1
// player -> instance
iVar10 = gGT->drivers[iVar14]->instSelf;
@ -97,9 +98,11 @@ void DECOMP_MM_Characters_DrawWindows(char wheelFlag)
// You are an AI (I think)
iVar10->flags |= 0x80;
}
#endif
iVar6 = iVar14;
#ifndef REBUILD_PS1
struct InstDrawPerPlayer* idpp =
INST_GETIDPP(iVar10);
@ -112,8 +115,9 @@ void DECOMP_MM_Characters_DrawWindows(char wheelFlag)
// set tileView in InstDrawPerPlayer,
// so that each camera can only see one driver
idpp[iVar6].tileView = tileview;
ptrCurr = &D230.characterSelect_charIDs_curr[iVar6];
iVar10->animFrame = 0;
iVar10->vertSplit = 0;
@ -168,8 +172,10 @@ void DECOMP_MM_Characters_DrawWindows(char wheelFlag)
iVar8 = D230.characterSelect_MoveDir[iVar6];
iVar6 = (0x1000 - iVar5) * (int)D230.unkCharacterWindows >> 0xc;
}
#ifndef REBUILD_PS1
iVar10->matrix.t[0] += iVar6 * iVar8;
#endif
}
// driver rotation
@ -177,7 +183,6 @@ void DECOMP_MM_Characters_DrawWindows(char wheelFlag)
rot[1] = D230.csm_instRot[1] + D230.characterSelect_angle[iVar14];
rot[2] = D230.csm_instRot[2];
#ifndef REBUILD_PS1
// convert 3 rotation shorts into rotation matrix
ConvertRotToMatrix(&iVar10->matrix.m[0][0], &rot[0]);
#endif

View File

@ -632,7 +632,7 @@ void DECOMP_MM_Characters_MenuBox(struct MenuBox* unused)
r68.h = 0x21;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&r68, 0, gGT->backBuffer->otMem.startPlusFour);
}
}
@ -692,7 +692,7 @@ void DECOMP_MM_Characters_MenuBox(struct MenuBox* unused)
psVar22 = psVar22 + 2;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&r60, 9, &gGT->backBuffer->otMem.startPlusFour[3]);
r60.x = 0;

View File

@ -126,6 +126,6 @@ void DECOMP_MM_TrackSelect_Video_Draw(RECT *r, struct MainMenu_LevelRow *selectM
D230.trackSel_unk = D230.trackSel_video_state;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
r, (short)(param_5 | 1), gGT->backBuffer->otMem.startPlusFour);
}

View File

@ -243,7 +243,7 @@ void DECOMP_MM_TrackSelect_MenuBox(struct MenuBox *mb)
lapSelTransitionState = DECOMP_MENUBOX_ProcessInput(&D230.menubox_LapSel);
}
MENUBOX_DrawSelf
DECOMP_MENUBOX_DrawSelf
(
&D230.menubox_LapSel,
D230.transitionMeta_trackSel[2].currX,
@ -510,7 +510,7 @@ void DECOMP_MM_TrackSelect_MenuBox(struct MenuBox *mb)
uVar15 = (u_int)numTracks;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&r, 0, gGT->backBuffer->otMem.startPlusFour);
do

View File

@ -195,7 +195,7 @@ void DECOMP_MM_CupSelect_MenuBox(struct MenuBox *mb)
cupBox.w = 180;
cupBox.h = 78;
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&cupBox, 0, gGT->backBuffer->otMem.startPlusFour);
}
}

View File

@ -584,7 +584,7 @@ void DECOMP_MM_Battle_MenuBox(struct MenuBox* unused)
D230.battleType_box.state |= 0x100;
}
MENUBOX_DrawSelf(&D230.battleType_box,
DECOMP_MENUBOX_DrawSelf(&D230.battleType_box,
D230.transitionMeta_battle[0].currX + 0x9c,
D230.transitionMeta_battle[0].currY + 0x24, 0x134);
@ -619,7 +619,7 @@ void DECOMP_MM_Battle_MenuBox(struct MenuBox* unused)
D230.battleLengthLifeTime_box.state |= 0x100;
}
MENUBOX_DrawSelf(&D230.battleLengthLifeTime_box,
DECOMP_MENUBOX_DrawSelf(&D230.battleLengthLifeTime_box,
D230.transitionMeta_battle[2].currX + 0x9c,
D230.transitionMeta_battle[2].currY + sVar6 + 4, 0x8e);
@ -634,7 +634,7 @@ void DECOMP_MM_Battle_MenuBox(struct MenuBox* unused)
D230.battleLengthLifeLife_box.state |= 0x100;
}
MENUBOX_DrawSelf(&D230.battleLengthLifeLife_box,
DECOMP_MENUBOX_DrawSelf(&D230.battleLengthLifeLife_box,
D230.transitionMeta_battle[2].currX + 0x142,
D230.transitionMeta_battle[2].currY + sVar6 + 4, 0x8e);
@ -666,7 +666,7 @@ void DECOMP_MM_Battle_MenuBox(struct MenuBox* unused)
box->state |= 0x100;
}
MENUBOX_DrawSelf(box,
DECOMP_MENUBOX_DrawSelf(box,
D230.transitionMeta_battle[2].currX + 0x9c,
D230.transitionMeta_battle[2].currY + sVar6 + 4, 0x134);
@ -783,7 +783,7 @@ LAB_800b25f0:
local_40.y = D230.transitionMeta_battle[4].currY + sVar20;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&local_40, 0, gGT->backBuffer->otMem.startPlusFour);
// "WEAPONS:"
@ -849,7 +849,7 @@ LAB_800b25f0:
{
D230.battleStartGame_box.state |= 0x100;
}
MENUBOX_DrawSelf(&D230.battleStartGame_box,
DECOMP_MENUBOX_DrawSelf(&D230.battleStartGame_box,
D230.transitionMeta_battle[8].currX + 0x9c,
D230.transitionMeta_battle[8].currY + sVar20 + 0x78, 0x134);
@ -939,7 +939,7 @@ LAB_800b25f0:
gGT->backBuffer->otMem.startPlusFour,
&gGT->backBuffer->primMem);
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&local_40, 0, gGT->backBuffer->otMem.startPlusFour);
// save all five battle settings

View File

@ -226,7 +226,7 @@ DRAW_MENU:
}
}
MENUBOX_DrawSelf(&D230.highScoreBox, D230.transitionMeta_HighScores[0xA].currX, D230.transitionMeta_HighScores[0xA].currY, 0xa4);
DECOMP_MENUBOX_DrawSelf(&D230.highScoreBox, D230.transitionMeta_HighScores[0xA].currX, D230.transitionMeta_HighScores[0xA].currY, 0xa4);
iVar8 = 0;
iVar7 = 0;
@ -253,7 +253,7 @@ DRAW_MENU:
box.h = 0x19;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&box, 0, gGT->backBuffer->otMem.startPlusFour);
}
}
@ -282,6 +282,6 @@ DRAW_MENU:
box.h = 0x19;
// Draw 2D Menu rectangle background
MENUBOX_DrawInnerRect(
DECOMP_MENUBOX_DrawInnerRect(
&box, 0, gGT->backBuffer->otMem.startPlusFour);
}

View File

@ -13,10 +13,10 @@ void DECOMP_MM_Scrapbook_PlayMovie(struct MenuBox *mb)
{
short lev;
int cdPos;
int getButtonPress;
int getButtonPress=0;
DRAWENV* ptrDrawEnv;
const CdlFILE cdlFile;
struct GameTracker *gGT = gGT;
struct GameTracker *gGT = sdata->gGT;
int isOn = DECOMP_TitleFlag_IsFullyOnScreen();
// book state (0,1,2,3,4)

View File

@ -305,6 +305,8 @@ int DECOMP_LOAD_TenStages(struct GameTracker* gGT, int loadingStage, struct BigH
{
Music_Restart();
}
#else
sdata->mainMenuState = 1;
#endif
// If in main menu (character selection, track selection, any part of it)

View File

@ -276,7 +276,7 @@ void DrawControllerError(struct GameTracker* gGT, struct GamepadSystem* gGamepad
// add 3 pixels above, 3 pixels bellow
window.h += 6;
MENUBOX_DrawInnerRect(&window, 1, gGT->backBuffer->otMem.startPlusFour);
DECOMP_MENUBOX_DrawInnerRect(&window, 1, gGT->backBuffer->otMem.startPlusFour);
}
void DrawFinalLap(struct GameTracker* gGT)

View File

@ -415,7 +415,7 @@ switchD_80038f90_caseD_9:
menuBoxBG.w = 400;
menuBoxBG.h = 0x87 - local_68;
menuBoxBG.y = sVar4 + 0x14;
MENUBOX_DrawInnerRect(&menuBoxBG, 4, (u_long *)(sdata->gGT->backBuffer->otMem).startPlusFour);
DECOMP_MENUBOX_DrawInnerRect(&menuBoxBG, 4, (u_long *)(sdata->gGT->backBuffer->otMem).startPlusFour);
if ((local_70 != 0) || ((sdata->AnyPlayerTap & (BTN_TRIANGLE | BTN_START | BTN_SQUARE_one)) != 0))
{

View File

@ -0,0 +1,6 @@
#include <common.h>
void DECOMP_MENUBOX_DrawInnerRect(RECT* r, int x, void* ot)
{
}

View File

@ -0,0 +1,136 @@
#include <common.h>
void DECOMP_MENUBOX_DrawSelf(struct MenuBox* mb, int param_2, short param_3, u_short width)
{
u_short textColor = 0;
int font = FONT_SMALL;
struct GameTracker* gGT = sdata->gGT;
short rowHeight = data.font_charPixHeight[FONT_SMALL];
short titleRowHeight = data.font_charPixHeight[FONT_BIG] + 3;
short posX_prev = mb->posX_curr;
short posY_prev = mb->posY_curr;
RECT r;
if ((mb->drawStyle & 0x10U) != 0)
textColor = LIGHT_GREEN;
if ((mb->state & 0x60000) == 0x60000)
{
mb->unk1e = 2;
if (mb->funcPtr != NULL)
mb->funcPtr(mb);
}
#if 0
if ((mb->state & USE_SMALL_FONT) == 0)
{
font = FONT_BIG;
rowHeight = data.font_charPixHeight[FONT_BIG] + 3;
}
int menuBoxHeight = 0;
DECOMP_MENUBOX_GetHeight(mb, &menuBoxHeight, 0);
mb->width = width;
mb->height = menuBoxHeight;
mb->state &= ~8;
if ((mb->state & CENTER_ON_Y) != 0)
{
short tmpHeight = 0;
DECOMP_MENUBOX_GetHeight(mb, &tmpHeight, 1);
short centerOffset = -(tmpHeight >> 1);
rowHeight += centerOffset;
}
short yOffset = param_3 + rowHeight + posY_prev;
short sVar12 = 0;
short titleIndex = mb->stringIndexTitle;
if ((titleIndex >= 0) && ((mb->state & ONLY_DRAW_TITLE) == 0))
{
short titleHeight = ((mb->state & BIG_TEXT_IN_TITLE)!=0) ? 1 : 2;
int titleX = param_2 + posX_prev;
if ((mb->state & 0x200) != 0)
{
titleX += width>>1;
textColor |= JUSTIFY_CENTER;
}
DecalFont_DrawLine(sdata->lngStrings[titleIndex], titleX, yOffset, titleHeight, textColor);
yOffset += titleRowHeight + 6;
}
struct MenuRow* row = &mb->rows[0];
if (row->stringIndex != -1)
{
int rowX = (width >> 1) + 1;
do
{
if (
(((mb->state & (SHOW_ONLY_HIGHLIT_ROW | ONLY_DRAW_TITLE))) == 0) ||
(sVar12 == mb->rowSelected)
)
{
u_short stringIndex = row->stringIndex;
u_short textColor = ((stringIndex & 0x8000) != 0) ? GRAY : ORANGE;
if ((mb->state & CENTER_ON_X) != 0)
textColor |= JUSTIFY_CENTER;
DecalFont_DrawLine(
sdata->lngStrings[stringIndex & 0x7fff],
param_2 + posX_prev + 1, yOffset, font, textColor);
yOffset += rowHeight;
}
sVar12++;
row++;
} while (row->stringIndex != -1);
}
if ((mb->state & 0x104) == 0)
{
r.x = param_2 + posX_prev;// + local_40;
r.y = param_3 + posY_prev + rowHeight - 1;
r.w = width;
if ((mb->state & SHOW_ONLY_HIGHLIT_ROW) == 0)
r.h += mb->rowSelected * rowHeight;// + local_50;
u_short* highlightColor = &sdata->menuRowHighlight_Normal;
if ((mb->drawStyle & 0x10) != 0)
highlightColor = &sdata->menuRowHighlight_Green;
CTR_Box_DrawClearBox(&r, highlightColor, TRANS_50_DECAL, gGT->backBuffer->otMem.startPlusFour, &gGT->backBuffer->primMem);
}
if ((mb->state & DRAW_NEXT_MENU_IN_HIERARCHY) != 0)
{
DECOMP_MENUBOX_DrawSelf(mb->ptrNextBox_InHierarchy, param_2 + posX_prev, param_3 + rowHeight + 0xc, width);
}
if ((mb->state & ONLY_DRAW_TITLE) == 0)
{
posX_prev = mb->posX_prev;
posY_prev = mb->posY_prev;
rowHeight = (menuBoxHeight + 8) - (u_short)((unsigned char)(mb->state >> 7));
}
else
{
posX_prev = mb->posX_prev;
posY_prev = mb->posY_prev;
rowHeight += 8;
}
r.h = rowHeight;
r.w = width + 0xc;
r.y = posY_prev - 4;
r.x = param_2 + posX_prev - 6;
MENUBOX_DrawFullRect(mb, &r);
#endif
}

View File

@ -67,7 +67,7 @@ void DECOMP_MENUBOX_ProcessState()
DECOMP_MENUBOX_GetWidth(currMenuBox, &width, 1);
// draw
MENUBOX_DrawSelf(currMenuBox, 0, 0, (int)width);
DECOMP_MENUBOX_DrawSelf(currMenuBox, 0, 0, (int)width);
}
}

View File

@ -487,7 +487,7 @@ common, exe, MENUBOX_DrawRwdTriangle, 0x0, General/MenuBox/MENUBOX_DrawRwdTriang
common, exe, MENUBOX_DrawOuterRect_LowLevel, 0x0, General/MenuBox/MENUBOX_DrawOuterRect_LowLevel.c
common, exe, MENUBOX_DrawOuterRect_HighLevel, 0x0, General/MenuBox/MENUBOX_DrawOuterRect_HighLevel.c
// MENUBOX_DrawQuip.c (wip)
// MENUBOX_DrawInnerRect
common, exe, MENUBOX_DrawOuterRect_HighLevel, 0x0, General/MenuBox/MENUBOX_DrawInnerRect.c
// MENUBOX_DrawFullRect
common, exe, MENUBOX_GetHeight, 0x0, General/MenuBox/MENUBOX_GetHeight.c
common, exe, MENUBOX_GetWidth, 0x0, General/MenuBox/MENUBOX_GetWidth.c

View File

@ -135,6 +135,8 @@ int DECOMP_MEMPACK_GetFreeBytes();
void DECOMP_MEMPACK_PopState();
int DECOMP_MEMPACK_PushState();
void DECOMP_MENUBOX_DrawInnerRect(RECT* r, int x, void* ot);
void DECOMP_MENUBOX_DrawSelf(struct MenuBox* mb, int param_2, short param_3, u_short width);
void DECOMP_MENUBOX_DrawPolyGT4(struct Icon* icon, short posX, short posY, struct PrimMem* primMem, u_long* ot, u_int color0, u_int color1, u_int color2, u_int color3, char transparency, short scale);
int DECOMP_MENUBOX_BoolHidden(struct MenuBox* m);
void DECOMP_MENUBOX_ClearInput();

View File

@ -181,11 +181,11 @@
#include "../decompile/General/MenuBox/MENUBOX_DrawOuterRect_LowLevel.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawOuterRect_HighLevel.c"
// MENUBOX_DrawQuip.c (wip)
// MENUBOX_DrawInnerRect
#include "../decompile/General/MenuBox/MENUBOX_DrawInnerRect.c"
// MENUBOX_DrawFullRect
#include "../decompile/General/MenuBox/MENUBOX_GetHeight.c"
#include "../decompile/General/MenuBox/MENUBOX_GetWidth.c"
// MENUBOX_DrawSelf.c (wip)
#include "../decompile/General/MenuBox/MENUBOX_DrawSelf.c"
#include "../decompile/General/MenuBox/MENUBOX_ClearInput.c"
#include "../decompile/General/MenuBox/MENUBOX_CollectInput.c"
#include "../decompile/General/MenuBox/MENUBOX_ProcessInput.c"