SSBM Decomp
Loading...
Searching...
No Matches
mndiagram.h File Reference

Go to the source code of this file.

Functions

u8 mnDiagram_GetFighterByIndex (int idx)
 Gets the fighter ID at the given sorted index.
u8 mnDiagram_GetNameByIndex (int idx)
 Gets the name ID at the given sorted index.
bool mnDiagram_IsDistanceOverflow (u32 distance)
 Tests whether a distance is at or above the large-unit threshold.
u32 mnDiagram_ConvertDistanceForDisplay (u32 distance)
 Scales a distance for display with a language-dependent divisor.
s32 mnDiagram_GetHitPercentage (u8 is_name_mode, u8 player_index)
s32 mnDiagram_GetPlayPercentage (u8 is_name_mode, u8 player_index)
s32 mnDiagram_GetAveragePlayerCount (u8 is_name_mode, u8 player_index)
int mnDiagram_GetNameTotalKOs (u8 field_index)
 Gets total KOs scored by a name against all other names.
int mnDiagram_GetNameTotalFalls (u8 field_index)
 Gets total falls (deaths) of a name against all other names.
int mnDiagram_GetFighterTotalKOs (u8 field_index)
 Gets total KOs scored by a fighter against all other fighters.
int mnDiagram_GetFighterTotalFalls (u8 field_index)
void mnDiagram_FormatDecimalNumber (char *buf, u32 val, int decimal_places)
 Writes val as NUL-terminated decimal text with its low decimal_places digits after a decimal point.
void mnDiagram_FormatTime (char *buf, s32 seconds)
 Writes nonnegative seconds as "M:SS" with unpadded minutes.
void mnDiagram_IntToStr (char *buf, u32 val)
 Writes val as NUL-terminated decimal digits.
u8 mnDiagram_GetPrevNameIndex (s32 idx)
 Gets the previous valid name index.
u8 mnDiagram_GetNextNameIndex (s32 idx)
u8 mnDiagram_GetPrevFighterIndex (s32 idx)
 Gets the previous valid fighter index.
u8 mnDiagram_GetNextFighterIndex (s32 idx)
u32 mnDiagram_GetNamePlayTimeByFighter (int name_idx, SelectableCharacterKind fighter_idx)
 Gets play time for a specific fighter under a name tag.
int mnDiagram_GetRankedFighterForName (int rank, int name_idx, u32(*func)(int, int))
u8 mnDiagram_GetLeastPlayedFighter (u8 name_idx)
void mnDiagram_SortFightersByKOs (void)
void mnDiagram_SortNamesByKOs (void)
int mnDiagram_CountUnlockedFighters (void)
 Counts the number of unlocked fighters.
void mnDiagram_PopupInputProc (HSD_GObj *)
void mnDiagram_InputProc (HSD_GObj *)
 Per-frame input handler for the VS Records "diagram" grid screen.
void mnDiagram_PopupCleanup (void *arg0)
void mnDiagram_PopupAnimProc (HSD_GObj *arg0)
void mnDiagram_CreatePopupTexts (HSD_GObj *arg0, s32 arg1, s32 arg2, s32 arg3)
void mnDiagram_CreatePopup (s32 arg0, s32 arg1, s32 arg2)
void mnDiagram_ClearGrid (HSD_GObj *arg0)
void mnDiagram_RefreshGrid (HSD_GObj *arg0, int arg1, int arg2)
void mnDiagram_UpdateScrollArrows (HSD_GObj *gobj)
 Updates scroll arrow visibility based on cursor position and available entries beyond the visible range.
void mnDiagram_ExitAnimProc (HSD_GObj *gobj)
void mnDiagram_UpdateScrollArrowVisibility (HSD_GObj *gobj, int count)
 Updates scroll arrow visibility based on entry count.
void mnDiagram_OnFrame (HSD_GObj *gobj)
void mnDiagram_DrawCellValue (HSD_GObj *arg0, u8 col, u8 row, int arg3)
void mnDiagram_DrawGridValues (HSD_GObj *arg0, s32 arg1, s32 arg2, u8 arg3)
void mnDiagram_DrawNameHeaders (HSD_GObj *arg0, s32 arg1, s32 arg2)
HSD_JObj * mnDiagram_CreateFighterIcon (int idx, int arg1)
void mnDiagram_DrawFighterHeaders (HSD_GObj *arg0, int arg1, int arg2)
void mnDiagram_CursorProc (HSD_GObj *gobj)
void mnDiagram_CreateCursor (void)
void mnDiagram_CreateScreen (u8 arg0)
void mnDiagram_Init (u8 arg0, u8 arg1)
 Initialize VS Records diagram screen.

Variables

StaticModelDesc MenMainConB2_Top
StaticModelDesc MenMainConB3_Top
StaticModelDesc MenMainCursorB3_Top

Function Documentation

◆ mnDiagram_GetFighterByIndex()

u8 mnDiagram_GetFighterByIndex ( int idx)

Gets the fighter ID at the given sorted index.

Parameters
idxIndex into the sorted fighter list
Returns
Fighter ID

◆ mnDiagram_GetNameByIndex()

u8 mnDiagram_GetNameByIndex ( int idx)

Gets the name ID at the given sorted index.

Parameters
idxIndex into the sorted name list
Returns
Name ID

◆ mnDiagram_IsDistanceOverflow()

bool mnDiagram_IsDistanceOverflow ( u32 distance)

Tests whether a distance is at or above the large-unit threshold.

The threshold is 160934 when lbLang_IsSavedLanguageUS is true and 100000 otherwise. Callers use a true result to select SIS entry 0x7F instead of their per-stat unit entry. Despite the name, this is not an arithmetic overflow check.

Parameters
[in]distanceAccumulated distance, before conversion.

◆ mnDiagram_ConvertDistanceForDisplay()

u32 mnDiagram_ConvertDistanceForDisplay ( u32 distance)

Scales a distance for display with a language-dependent divisor.

US: distance/30.4788 (f64, truncated) below 160934, else distance/160934. Otherwise: distance/100 below 100000, else distance/100000. The result is not capped at the threshold: 160933 gives 5280, 160934 gives 1, and 321868 gives 2. The unit is chosen by the caller.

Parameters
[in]distanceAccumulated distance, before conversion.

◆ mnDiagram_GetHitPercentage()

s32 mnDiagram_GetHitPercentage ( u8 is_name_mode,
u8 player_index )

◆ mnDiagram_GetPlayPercentage()

s32 mnDiagram_GetPlayPercentage ( u8 is_name_mode,
u8 player_index )

◆ mnDiagram_GetAveragePlayerCount()

s32 mnDiagram_GetAveragePlayerCount ( u8 is_name_mode,
u8 player_index )

◆ mnDiagram_GetNameTotalKOs()

int mnDiagram_GetNameTotalKOs ( u8 field_index)

Gets total KOs scored by a name against all other names.

Parameters
field_indexIndex of the name tag to query.
Returns
Sum of KOs scored by this name against all existing names.

◆ mnDiagram_GetNameTotalFalls()

int mnDiagram_GetNameTotalFalls ( u8 field_index)

Gets total falls (deaths) of a name against all other names.

Iterates through all names and sums how many times each name KO'd the target name. This is the column sum of the KO matrix. Accesses vs_kos[field_index] in each name's data.

Parameters
field_indexIndex of the name tag to query.
Returns
Sum of times this name was KO'd by all existing names (capped at 999999).

◆ mnDiagram_GetFighterTotalKOs()

int mnDiagram_GetFighterTotalKOs ( u8 field_index)

Gets total KOs scored by a fighter against all other fighters.

Iterates through all unlocked fighters and sums how many times the target fighter KO'd each one. Fighter data uses a similar matrix layout to name data.

Parameters
field_indexIndex of the fighter to query (0-24).
Returns
Sum of KOs scored by this fighter against all unlocked fighters.

◆ mnDiagram_GetFighterTotalFalls()

int mnDiagram_GetFighterTotalFalls ( u8 field_index)

◆ mnDiagram_FormatDecimalNumber()

void mnDiagram_FormatDecimalNumber ( char * buf,
u32 val,
int decimal_places )

Writes val as NUL-terminated decimal text with its low decimal_places digits after a decimal point.

Callers pass 0 or 2. With 2, 5 gives "0.05" and 12345 gives "123.45"; with 0, no decimal point is written. No thousands separators.

Parameters
[out]bufMust hold the whole result and its NUL.
[in]valValue scaled by 10^decimal_places.
[in]decimal_placesDigits after the decimal point.

◆ mnDiagram_FormatTime()

void mnDiagram_FormatTime ( char * buf,
s32 seconds )

Writes nonnegative seconds as "M:SS" with unpadded minutes.

59 gives "0:59", 60 gives "1:00", and 600000 gives "10000:00"; minutes are neither capped nor split into hours. Callers apply their own limits.

Parameters
[out]bufMust hold the whole result and its NUL.
[in]secondsNonnegative elapsed seconds.

◆ mnDiagram_IntToStr()

void mnDiagram_IntToStr ( char * buf,
u32 val )

Writes val as NUL-terminated decimal digits.

No padding or separators; 0 gives "0". Both callers cap val first. This and mnDiagram_FormatDecimalNumber use the signed mn_GetDigitCount and mn_GetDigitAt, so the full u32 range is not established.

Parameters
[out]bufMust hold the whole result and its NUL.
[in]valValue to format.

◆ mnDiagram_GetPrevNameIndex()

u8 mnDiagram_GetPrevNameIndex ( s32 idx)

Gets the previous valid name index.

Parameters
idxCurrent name index.
Returns
Previous name index with a valid name, or original if none found.

◆ mnDiagram_GetNextNameIndex()

u8 mnDiagram_GetNextNameIndex ( s32 idx)

◆ mnDiagram_GetPrevFighterIndex()

u8 mnDiagram_GetPrevFighterIndex ( s32 idx)

Gets the previous valid fighter index.

Parameters
idxCurrent fighter index.
Returns
Previous fighter index that's unlocked, or original if none found.

◆ mnDiagram_GetNextFighterIndex()

u8 mnDiagram_GetNextFighterIndex ( s32 idx)

◆ mnDiagram_GetNamePlayTimeByFighter()

u32 mnDiagram_GetNamePlayTimeByFighter ( int name_idx,
SelectableCharacterKind selkind )

Gets play time for a specific fighter under a name tag.

Parameters
name_idxName tag index.
fighter_idxFighter index (0-24).
Returns
Play time in seconds for this fighter under this name.

◆ mnDiagram_GetRankedFighterForName()

int mnDiagram_GetRankedFighterForName ( int rank,
int name_idx,
u32(* func )(int, int) )

◆ mnDiagram_GetLeastPlayedFighter()

u8 mnDiagram_GetLeastPlayedFighter ( u8 name_idx)

◆ mnDiagram_SortFightersByKOs()

void mnDiagram_SortFightersByKOs ( void )

◆ mnDiagram_SortNamesByKOs()

void mnDiagram_SortNamesByKOs ( void )

◆ mnDiagram_CountUnlockedFighters()

int mnDiagram_CountUnlockedFighters ( void )

Counts the number of unlocked fighters.

Returns
Number of unlocked fighters.

◆ mnDiagram_PopupInputProc()

void mnDiagram_PopupInputProc ( HSD_GObj * gobj)

◆ mnDiagram_InputProc()

void mnDiagram_InputProc ( HSD_GObj * gobj)

Per-frame input handler for the VS Records "diagram" grid screen.

Dispatches the current frame's menu input:

  • A (0x10): open the detail popup (mnDiagram_PopupInputProc) for the highlighted cell, mapping the display cursor (mn_804A04F0.hovered_selection = row<<8 | col) to the underlying name/fighter id via the col-th/row-th visible entry, then enter the detail page (mnDiagram_CreatePopup).
  • B (0x20): save cursor state and back out (mn_80229894).
  • Start/Z (0xC0): save cursor state and advance to page 2 (mnDiagram2_Init) or page 3 (mnDiagram3_Init).
  • L/R (0xC00): toggle between name-tag and fighter axes, clamping the cursor to the valid entry count.
  • D-pad (1/2/4/8): move the cursor within the grid, scrolling the data window by a page when moving past a visible edge.

The visible-entry scans skip locked fighters and empty name slots.

◆ mnDiagram_PopupCleanup()

void mnDiagram_PopupCleanup ( void * arg0)

◆ mnDiagram_PopupAnimProc()

void mnDiagram_PopupAnimProc ( HSD_GObj * arg0)

◆ mnDiagram_CreatePopupTexts()

void mnDiagram_CreatePopupTexts ( HSD_GObj * arg0,
s32 arg1,
s32 arg2,
s32 arg3 )

◆ mnDiagram_CreatePopup()

void mnDiagram_CreatePopup ( s32 arg0,
s32 arg1,
s32 arg2 )

◆ mnDiagram_ClearGrid()

void mnDiagram_ClearGrid ( HSD_GObj * arg0)

◆ mnDiagram_RefreshGrid()

void mnDiagram_RefreshGrid ( HSD_GObj * arg0,
int arg1,
int arg2 )

◆ mnDiagram_UpdateScrollArrows()

void mnDiagram_UpdateScrollArrows ( HSD_GObj * gobj)

Updates scroll arrow visibility based on cursor position and available entries beyond the visible range.

Parameters
[in]gobjThe diagram GObj containing arrow JObjs in user_data.

Checks 4 arrows: right (10 more cols?), left (cursor > 0?), up (cursor row > 0?), down (7 more rows?). Hides arrows when there's nothing to scroll to, shows them when there is.

◆ mnDiagram_ExitAnimProc()

void mnDiagram_ExitAnimProc ( HSD_GObj * gobj)

◆ mnDiagram_UpdateScrollArrowVisibility()

void mnDiagram_UpdateScrollArrowVisibility ( HSD_GObj * gobj,
int count )

Updates scroll arrow visibility based on entry count.

Hides vertical arrows if count <= 7 (fits in visible rows). Hides horizontal arrows if count <= 10 (fits in visible columns).

Parameters
gobjThe diagram GObj containing arrow JObjs in user_data.
countNumber of entries (fighters or names) to display.

◆ mnDiagram_OnFrame()

void mnDiagram_OnFrame ( HSD_GObj * gobj)

◆ mnDiagram_DrawCellValue()

void mnDiagram_DrawCellValue ( HSD_GObj * arg0,
u8 col,
u8 row,
int arg3 )

◆ mnDiagram_DrawGridValues()

void mnDiagram_DrawGridValues ( HSD_GObj * arg0,
s32 arg1,
s32 arg2,
u8 arg3 )

◆ mnDiagram_DrawNameHeaders()

void mnDiagram_DrawNameHeaders ( HSD_GObj * arg0,
s32 arg1,
s32 arg2 )

◆ mnDiagram_CreateFighterIcon()

HSD_JObj * mnDiagram_CreateFighterIcon ( int idx,
int arg1 )

◆ mnDiagram_DrawFighterHeaders()

void mnDiagram_DrawFighterHeaders ( HSD_GObj * arg0,
int arg1,
int arg2 )

◆ mnDiagram_CursorProc()

void mnDiagram_CursorProc ( HSD_GObj * gobj)

◆ mnDiagram_CreateCursor()

void mnDiagram_CreateCursor ( void )

◆ mnDiagram_CreateScreen()

void mnDiagram_CreateScreen ( u8 arg0)

◆ mnDiagram_Init()

void mnDiagram_Init ( u8 arg0,
u8 arg1 )

Initialize VS Records diagram screen.

Parameters
arg0If non-zero, load DAT archive symbols
arg1Initial mode (passed to mnDiagram_CreateScreen)

Variable Documentation

◆ MenMainConB2_Top

StaticModelDesc MenMainConB2_Top
extern

◆ MenMainConB3_Top

StaticModelDesc MenMainConB3_Top
extern

◆ MenMainCursorB3_Top

StaticModelDesc MenMainCursorB3_Top
extern