|
SSBM Decomp
|
#include "mndiagram.h"#include <melee/gm/forward.h>#include "inlines.h"#include "mndiagram2.h"#include "mndiagram3.h"#include "mnmain.h"#include "mnname.h"#include "types.h"#include <dolphin/types.h>#include <melee/gm/gm_1601.h>#include <melee/gm/gmmain_lib.h>#include <melee/gm/types.h>#include <melee/lb/lb_00B0.h>#include <melee/lb/lb_00CE.h>#include <melee/lb/lbarchive.h>#include <melee/lb/lbaudio_ax.h>#include <melee/lb/lblanguage.h>#include <melee/lb/lbspdisplay.h>#include <sysdolphin/baselib/debug.h>#include <sysdolphin/baselib/gobj.h>#include <sysdolphin/baselib/gobjgxlink.h>#include <sysdolphin/baselib/gobjobject.h>#include <sysdolphin/baselib/gobjplink.h>#include <sysdolphin/baselib/gobjproc.h>#include <sysdolphin/baselib/gobjuserdata.h>#include <sysdolphin/baselib/jobj.h>#include <sysdolphin/baselib/memory.h>Data Structures | |
| struct | mnDiagram_Assets |
| Matching overlay for the separately declared fighter and name order tables. More... | |
| struct | mnDiagram_PopupData |
| struct | mnDiagram_PopupAnimTableHead |
| Head label for the contiguous mnDiagram popup animation data run. More... | |
| struct | mnDiagram_AnimTable |
| Overlay over the contiguous .data run starting at mnDiagram_PopupTextOffsets. More... | |
| struct | RankEntry |
Macros | |
| #define | GET_DIAGRAM_ANIM_TABLE() |
Functions | |
| ASSERT_SIZE (mnDiagram_Assets, 0x94) | |
| ASSERT_SIZE (mnDiagram_PopupData, 0x4C) | |
| 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) |
| static int | getNamePairKOs (u8 name, u8 opponent) |
| int | mnDiagram_GetNameTotalKOs (u8 field_index) |
| Gets total KOs scored by a name against all other names. | |
| static int | sumNameKOs (u8 field_index, bool falls) |
| 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. | |
| static int | mnDiagram_SumFighterFalls (u8 field_index) |
| Gets total falls (deaths) of 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. | |
| static void | writeIntegerDigits (char *buf, s32 value, int count) |
| 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 selkind) |
| Gets play time for a specific fighter under a name tag. | |
| static bool | allPlayTimesZero (s32 name_idx) |
| 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 *gobj) |
| static u8 | mnDiagram_GetVisibleNameFrom (int start, int rank) |
| static s32 | mnDiagram_FindPrevFighter (u8 *sorted, SelectableCharacterKind cur) |
| static u8 | mnDiagram_FindNextFighter (u8 *sorted, SelectableCharacterKind cur) |
| static s32 | mnDiagram_FindPrevName (s32 cur) |
| static s32 | mnDiagram_FindPrevNameWrap (s32 cur) |
| static s32 | mnDiagram_FindPrevFighterWrap (u8 *sorted, s32 cur) |
| static int | mnDiagram_FindNextName (s32 cur) |
| static u8 | mnDiagram_GetVisibleNameCursorFrom (int start, int rank) |
| static u8 | mnDiagram_GetVisibleFighterCursorFrom (u8 *sorted, int start, int rank) |
| static u8 | mnDiagram_GetVisibleFighterColumnForInput (u8 *sorted, int start, int rank, int *index) |
| static u8 | mnDiagram_GetVisibleFighterRowForInput (u8 *sorted, Diagram *data, const u16 *selection, int *index) |
| static u8 | mnDiagram_GetVisibleFighterFromPointer (const u8 *sorted, u8 *p, int start, int rank) |
| static u8 | mnDiagram_GetVisibleFighterCursorFrom2 (int start, int rank) |
| static Diagram * | mnDiagram_GetCurrentDiagramData (void) |
| static void | saveCursorPositions (Diagram *data) |
| static s32 | getHoveredRow (void) |
| static u8 | getHoveredColumn (void) |
| void | mnDiagram_InputProc (HSD_GObj *gobj) |
| Per-frame input handler for the VS Records "diagram" grid screen. | |
| static void | removeText (HSD_Text *text) |
| void | mnDiagram_PopupCleanup (void *arg0) |
| static Vec3 * | mnDiagram_PopupAnimProc_Inline (mnDiagram_AnimTable *arg0, int arg1) |
| static void | mnDiagram_TextSetPos (HSD_Text *text, f32 x, f32 y, f32 z) |
| void | mnDiagram_PopupAnimProc (HSD_GObj *arg0) |
| static void | mnDiagram_FormatPopupNumber (char *buf, u32 val) |
| static void | setPopupTextPosition (HSD_Text *text, const Vec3 *pos) |
| void | mnDiagram_CreatePopupTexts (HSD_GObj *arg0, s32 selkind_or_nametag_slot_id, s32 arg2, s32 use_nametag) |
| void | mnDiagram_CreatePopup (s32 arg0, s32 arg1, s32 use_nametag) |
| void | mnDiagram_ClearGrid (HSD_GObj *arg0) |
| static void | refreshGrid (HSD_GObj *gobj, int row_start, int col_start, Diagram *data) |
| void | mnDiagram_RefreshGrid (HSD_GObj *arg0, int arg1, int arg2) |
| static void | setArrowVisible (HSD_JObj *arrow, bool visible) |
| 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) |
| static void | updateScrollArrowVisibility (Diagram *data, int count) |
| void | mnDiagram_UpdateScrollArrowVisibility (HSD_GObj *gobj, int count) |
| Updates scroll arrow visibility based on entry count. | |
| static int | getEntryCount (Diagram *data) |
| static int | getFighterCount (void) |
| void | mnDiagram_OnFrame (HSD_GObj *gobj) |
| static void | requestIntegerAnimFrame (HSD_JObj *jobj, int frame) |
| void | mnDiagram_DrawCellValue (HSD_GObj *arg0, u8 col, u8 row, int arg3) |
| static int | mnDiagram_GetFighterPairKOs (u8 fighter, u8 opponent) |
| void | mnDiagram_DrawGridValues (HSD_GObj *arg0, s32 row_start, s32 col_start, u8 arg3) |
| static f32 | getColumnReferenceX (Diagram *data) |
| static f32 | getRowReferenceY (Diagram *data) |
| void | mnDiagram_DrawNameHeaders (HSD_GObj *arg0, s32 arg1, s32 arg2) |
| HSD_JObj * | mnDiagram_CreateFighterIcon (int idx, int arg1) |
| static HSD_JObj * | mnDiagram_LoadHeaderIcon (StaticModelDesc *joint_data, int fighter_id, HSD_JObj **child) |
| static void | getVisibleFighter (int start, int rank, int *fighter) |
| 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 | MenMainCursorB1_Top |
| StaticModelDesc | MenMainSubB1_Top |
| StaticModelDesc | MenMainNmB_Top |
| StaticModelDesc | MenMainFaceB_Top |
| StaticModelDesc | MenMainConB1_Top |
| HSD_GObj * | mnDiagram_ScreenGObj |
| StaticModelDesc | MenMainCursorB3_Top |
| StaticModelDesc | MenMainConB3_Top |
| StaticModelDesc | MenMainConB2_Top |
| u8 | mnDiagram_FighterDisplayOrder [0x1C] |
| u8 | mnDiagram_NameDisplayOrder [GM_NAMETAG_COUNT] |
| static mnDiagram_PopupAnimTableHead | mnDiagram_PopupTextOffsets |
| static u8 | mnDiagram_DefaultFighterOrder [0x1C] |
| static AnimLoopSettings | mnDiagram_IntroAnim = { 0.0f, 9.0f, -0.1f } |
| static AnimLoopSettings | mnDiagram_PopupExitAnim = { 10.0f, 19.0f, -0.1f } |
| static AnimLoopSettings | mnDiagram_ArrowAnim = { 0.0f, 199.0f, 0.0f } |
| static AnimLoopSettings | mnDiagram_CursorAnim = { 0.0f, 10.0f, -0.1f } |
| static GXColor | mnDiagram_PopupTextColor = { 0, 0, 0, 0xFF } |
| char | mnDiagram_StringTerminator [1] = "" |
| #define GET_DIAGRAM_ANIM_TABLE | ( | ) |
| ASSERT_SIZE | ( | mnDiagram_Assets | , |
| 0x94 | ) |
| ASSERT_SIZE | ( | mnDiagram_PopupData | , |
| 0x4C | ) |
| u8 mnDiagram_GetFighterByIndex | ( | int | idx | ) |
Gets the fighter ID at the given sorted index.
| idx | Index into the sorted fighter list |
| u8 mnDiagram_GetNameByIndex | ( | int | idx | ) |
Gets the name ID at the given sorted index.
| idx | Index into the sorted name list |
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.
| [in] | distance | Accumulated distance, before conversion. |
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.
| [in] | distance | Accumulated distance, before conversion. |
| int mnDiagram_GetNameTotalKOs | ( | u8 | field_index | ) |
Gets total KOs scored by a name against all other names.
| field_index | Index of the name tag to query. |
| 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.
| field_index | Index of the name tag to query. |
| 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.
| field_index | Index of the fighter to query (0-24). |
|
inlinestatic |
Gets total falls (deaths) of a fighter against all other fighters.
Iterates through all unlocked fighters and sums how many times each fighter KO'd the target fighter. This is the column sum of the fighter KO matrix.
| field_index | Index of the fighter to query (0-24). |
| 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.
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.
| [out] | buf | Must hold the whole result and its NUL. |
| [in] | val | Value scaled by 10^decimal_places. |
| [in] | decimal_places | Digits after the decimal point. |
|
inlinestatic |
| 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.
| [out] | buf | Must hold the whole result and its NUL. |
| [in] | seconds | Nonnegative elapsed seconds. |
| 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.
| [out] | buf | Must hold the whole result and its NUL. |
| [in] | val | Value to format. |
Gets the previous valid name index.
| idx | Current name index. |
Gets the previous valid fighter index.
| idx | Current fighter index. |
| u32 mnDiagram_GetNamePlayTimeByFighter | ( | int | name_idx, |
| SelectableCharacterKind | selkind ) |
Gets play time for a specific fighter under a name tag.
| name_idx | Name tag index. |
| fighter_idx | Fighter index (0-24). |
| int mnDiagram_GetRankedFighterForName | ( | int | rank, |
| int | name_idx, | ||
| u32(* | func )(int, int) ) |
| void mnDiagram_SortFightersByKOs | ( | void | ) |
| void mnDiagram_SortNamesByKOs | ( | void | ) |
| int mnDiagram_CountUnlockedFighters | ( | void | ) |
Counts the number of unlocked fighters.
| void mnDiagram_PopupInputProc | ( | HSD_GObj * | gobj | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| void mnDiagram_InputProc | ( | HSD_GObj * | gobj | ) |
Per-frame input handler for the VS Records "diagram" grid screen.
Dispatches the current frame's menu input:
The visible-entry scans skip locked fighters and empty name slots.
|
inlinestatic |
| void mnDiagram_PopupCleanup | ( | void * | arg0 | ) |
|
inlinestatic |
| void mnDiagram_PopupAnimProc | ( | HSD_GObj * | arg0 | ) |
|
inlinestatic |
| void mnDiagram_CreatePopupTexts | ( | HSD_GObj * | arg0, |
| s32 | selkind_or_nametag_slot_id, | ||
| s32 | arg2, | ||
| s32 | use_nametag ) |
| 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.
| [in] | gobj | The 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.
| void mnDiagram_ExitAnimProc | ( | HSD_GObj * | gobj | ) |
|
inlinestatic |
| 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).
| gobj | The diagram GObj containing arrow JObjs in user_data. |
| count | Number of entries (fighters or names) to display. |
|
inlinestatic |
|
inlinestatic |
| void mnDiagram_OnFrame | ( | HSD_GObj * | gobj | ) |
|
static |
| HSD_JObj * mnDiagram_CreateFighterIcon | ( | int | idx, |
| int | arg1 ) |
|
inlinestatic |
|
inlinestatic |
| 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 | ) |
Initialize VS Records diagram screen.
| arg0 | If non-zero, load DAT archive symbols |
| arg1 | Initial mode (passed to mnDiagram_CreateScreen) |
| StaticModelDesc MenMainCursorB1_Top |
| StaticModelDesc MenMainSubB1_Top |
| StaticModelDesc MenMainNmB_Top |
| StaticModelDesc MenMainFaceB_Top |
| StaticModelDesc MenMainConB1_Top |
| HSD_GObj* mnDiagram_ScreenGObj |
| StaticModelDesc MenMainCursorB3_Top |
| StaticModelDesc MenMainConB3_Top |
| StaticModelDesc MenMainConB2_Top |
| u8 mnDiagram_FighterDisplayOrder[0x1C] |
| u8 mnDiagram_NameDisplayOrder[GM_NAMETAG_COUNT] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| char mnDiagram_StringTerminator[1] = "" |