a5dd0 (model file) + filemenu decomp (#420)

* remove some warnings, improve build speed on master

* update Camera

* update_camera_zone_interp not matching but close :/

* cleanup

* configure fix

* cleanup, better gbi macros

* decomp and syms

* a couple more

* 2 more and stuff

* more naming

* 3

* syms

* mdl_get_child_count

* more stuff

* get_model_list_index_from_tree_index

* 5 more

* header org

* update_entity_shadow_position

* fog color funcs

* more color stuff

* display lists

* create_shadow_from_data

* 4 evt shtuffsh

* func_80117D00

* func_80111790

* some BSS

* entity_raycast_down

* MakeEntity and almost step_entity_commandList

* step_current_game_mode

* filemenu stuff

* lots more filemenu stuff

* cleanup

* formatting

* fixes

* 1 more

* more fixes
This commit is contained in:
Ethan Roseman 2021-09-22 20:17:46 +09:00 committed by GitHub
parent ac5b75763c
commit db578d9788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
157 changed files with 4962 additions and 4770 deletions

View File

@ -24,7 +24,8 @@
"ver/current": true,
"ver/us/build": true,
"ver/jp/build": true,
"expected": true
"expected": true,
"**/*.i": true,
},
"python.autoComplete.extraPaths": [
"./tools"

2
Jenkinsfile vendored
View File

@ -64,7 +64,7 @@ pipeline {
sh 'python3 progress.py jp --csv >> reports/progress_jp.csv'
sh 'python3 progress.py jp --shield-json > reports/progress_jp_shield.json'
sh './tools/warnings_count/update_current_warnings.sh'
sh 'cat build_log.txt | grep warning | sort > tools/warnings_count/warnings.txt'
sh 'cp tools/warnings_count/warnings.txt reports/warnings.txt'
stash includes: 'reports/*', name: 'reports'

View File

@ -17,6 +17,10 @@ typedef struct {
u8 r, g, b, a;
} Color_RGBA8;
typedef struct {
u8 r, g, b;
} Color_RGB8;
typedef struct Vec2b {
/* 0x00 */ s8 x;
/* 0x01 */ s8 y;
@ -510,12 +514,22 @@ typedef struct CameraUnk {
/* 0x68 */ char unk_68[0x24];
} CameraUnk; // size = 0x8C
typedef struct CameraControlSettings {
/* 0x00 */ s32 type;
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
/* 0x0C */ Vec3f posA;
/* 0x18 */ Vec3f posB;
/* 0x24 */ f32 viewPitch;
/* 0x28 */ s32 flag;
} CameraControlSettings; // size = 0x2C
typedef struct Camera {
/* 0x000 */ u16 flags;
/* 0x002 */ s16 moveFlags;
/* 0x004 */ s16 mode;
/* 0x004 */ s16 updateMode;
/* 0x006 */ s16 unk_06;
/* 0x008 */ s16 unk_08;
/* 0x008 */ s16 changingMap;
/* 0x00A */ s16 viewportW;
/* 0x00C */ s16 viewportH;
/* 0x00E */ s16 viewportStartX;
@ -533,7 +547,7 @@ typedef struct Camera {
/* 0x028 */ s16 unk_28;
/* 0x02A */ s16 zoomPercent;
/* 0x02C */ s16 bgColor[3];
/* 0x032 */ s16 targetScreenCoords[3];
/* 0x032 */ Vec3s targetScreenCoords;
/* 0x038 */ u16 perspNorm;
/* 0x03A */ char unk_3A[2];
/* 0x03C */ Vec3f lookAt_eye;
@ -553,7 +567,7 @@ typedef struct Camera {
/* 0x094 */ f32 currentPitch;
/* 0x098 */ s32 unk_98;
/* 0x09C */ s32 unk_9C;
/* 0x0A0 */ Vp viewport;
/* 0x0A0 */ Vp vp;
/* 0x0B0 */ Vp vpAlt;
/* 0x0C0 */ s32 unk_C0;
/* 0x0C4 */ f32 unk_C4;
@ -565,33 +579,34 @@ typedef struct Camera {
/* 0x1D4 */ char unk_1D4[0x28];
/* 0x1FC */ void (*fpDoPreRender)(struct Camera*);
/* 0x200 */ void (*fpDoPostRender)(struct Camera*);
/* 0x204 */ struct Matrix4s* unkMatrix;
/* 0x204 */ Matrix4s* unkMatrix;
/* 0x208 */ s32 unk_208;
/* 0x20C */ struct Matrix4s* unkEffectMatrix;
/* 0x20C */ Matrix4s* unkEffectMatrix;
/* 0x210 */ char unk_210[0x2];
/* 0x212 */ s16 unk_212;
/* 0x214 */ CameraUnk unk_214[4];
/* 0x444 */ struct Zone* prevZone;
/* 0x448 */ struct Zone* currentZone;
/* 0x44C */ struct CamPosSettings initialSettings; /* for start of blend between zones */
/* 0x468 */ struct CamPosSettings targetSettings; /* goal for blend between zones */
/* 0x484 */ f32 sinInterpAlpha;
/* 0x444 */ CameraControlSettings* prevController;
/* 0x448 */ CameraControlSettings* currentController;
/* 0x44C */ CamPosSettings oldCameraSettings;
/* 0x468 */ CamPosSettings newCameraSettings;
/* 0x484 */ f32 interpAlpha;
/* 0x488 */ f32 linearInterp;
/* 0x48C */ f32 linearInterpScale; /* 3.0? */
/* 0x490 */ f32 moveSpeed;
/* 0x494 */ char unk_494[0x8];
/* 0x494 */ f32 unk_494;
/* 0x498 */ f32 unk_498;
/* 0x49C */ f32 unk_49C;
/* 0x4A0 */ char unk_4A0[0x10];
/* 0x4A0 */ f32 savedTargetY;
/* 0x4A4 */ f32 unk_4A4;
/* 0x4A8 */ f32 unk_4A8;
/* 0x4AC */ f32 unk_4AC;
/* 0x4B0 */ Vec3f movePos;
/* 0x4BC */ char unk_4BC[28];
/* 0x4D8 */ s32 controllerType;
/* 0x4DC */ f32 controllerBoomLen;
/* 0x4E0 */ f32 controllerBoomPitch;
/* 0x4E4 */ Vec3f posA;
/* 0x4F0 */ Vec3f posB;
/* 0x4FC */ f32 controllerViewPitch;
/* 0x500 */ s32 unk_500;
/* 0x504 */ s16 boolTargetPlayer;
/* 0x4BC */ Vec3f prevPrevMovePos;
/* 0x4C8 */ Vec3f prevMovePos;
/* 0x4D4 */ u16 prevPrevFollowFlags;
/* 0x4D6 */ u16 prevFollowFlags;
/* 0x4D8 */ CameraControlSettings controlSettings;
/* 0x504 */ u16 followPlayer;
/* 0x506 */ u16 unk_506;
/* 0x508 */ f32 panPhase;
/* 0x50C */ f32 leadAmount;
@ -816,58 +831,6 @@ typedef struct ModelDisplayData {
/* 0x4 */ char unk_00[0x4];
} ModelDisplayData; // size = 0x8
typedef struct ModelNodeProperty {
/* 0x0 */ s32 key;
/* 0x4 */ s32 dataType;
/* 0x8 */ s32 data;
} ModelNodeProperty; // size = 0x8;
typedef struct ModelNode {
/* 0x00 */ s32 type; /* 2 = model */
/* 0x04 */ ModelDisplayData* displayData;
/* 0x08 */ s32 numProperties;
/* 0x0C */ ModelNodeProperty* propertyList;
/* 0x10 */ struct ModelGroupData* groupData;
} ModelNode; // size = 0x14
typedef struct Model {
/* 0x00 */ u16 flags;
/* 0x02 */ s16 modelID;
/* 0x04 */ Matrix4s* currentMatrix;
/* 0x08 */ ModelNode* modelNode;
/* 0x0C */ ModelGroupData* groupData;
/* 0x10 */ s32* currentSpecialMatrix;
/* 0x14 */ char unk_14[4];
/* 0x18 */ Matrix4s specialMatrix;
/* 0x58 */ Matrix4f transformMatrix;
/* 0x98 */ Vec3f center;
/* 0xA4 */ u8 texPannerID;
/* 0xA5 */ u8 specialDisplayListID;
/* 0xA6 */ s8 renderMode;
/* 0xA7 */ char unk_A7;
/* 0xA8 */ u8 textureID;
/* 0xA9 */ u8 unk_A9;
/* 0xAA */ char unk_AA[6];
} Model; // size = 0xB0
typedef struct ModelTransformGroup {
/* 0x00 */ u16 flags;
/* 0x02 */ s16 groupModelID;
/* 0x04 */ Matrix4s* matrixRDP_N;
/* 0x08 */ ModelNode* modelNode;
/* 0x0C */ Matrix4s* transformMtx;
/* 0x10 */ Matrix4f matrixA;
/* 0x50 */ Matrix4f matrixB;
/* 0x90 */ Vec3f center;
/* 0x9C */ u8 minChildModelIndex;
/* 0x9D */ u8 maxChildModelIndex;
/* 0x9E */ u8 renderMode;
/* 0x9F */ s8 matrixMode;
} ModelTransformGroup; // size = 0xA0
typedef Model* ModelList[MAX_MODELS];
typedef ModelTransformGroup* ModelTransformGroupList[MAX_MODEL_TRANSFORM_GROUPS];
typedef struct AnimatedMesh {
/* 0x000 */ s32 flags;
/* 0x004 */ u8 renderMode;
@ -1041,10 +1004,19 @@ typedef struct ItemEntity {
/* 0x58 */ s32 unk_58;
} ItemEntity; // size = 0x5C
typedef struct StaticShadowData {
/* 0x00 */ s16 flags;
/* 0x02 */ char unk_02[34];
} StaticShadowData; // size = 0x24
typedef struct StaticAnimatorNode {
/* 0x00 */ u32* displayList; // can sometime point to a node???
/* 0x04 */ Vec3s rot; /* range = -180,180 */
/* 0x0A */ char unk_0A[0x2];
/* 0x0C */ Vec3f pos;
/* 0x18 */ struct StaticAnimatorNode* sibling;
/* 0x1C */ struct StaticAnimatorNode* child;
/* 0x20 */ s16 vertexStartOffset;
/* 0x22 */ char unk_22[0x2];
/* 0x24 */ Vtx* vtxList;
/* 0x28 */ s16 modelID;
/* 0x2A */ char unk_2A[0x2];
} StaticAnimatorNode; // size = 0x2C
typedef struct SpriteComponent {
/* 0x00 */ char unk_00[8];
@ -1286,7 +1258,7 @@ typedef struct GameStatus {
/* 0x0A8 */ s8 creditsViewportMode;
/* 0x0A9 */ s8 unk_A9;
/* 0x0AA */ s8 demoFlags;
/* 0x0AB */ s8 unk_AB;
/* 0x0AB */ u8 unk_AB;
/* 0x0AC */ s8 loadMenuState;
/* 0x0AD */ s8 menuCounter;
/* 0x0AE */ s8 bSkipIntro;
@ -1345,6 +1317,15 @@ typedef struct Shadow {
typedef Shadow* ShadowList[MAX_SHADOWS];
typedef struct StaticShadowData {
/* 0x00 */ u16 flags;
/* 0x02 */ char unk_02[0x2];
/* 0x04 */ s32 unk_04;
/* 0x08 */ StaticAnimatorNode** animModelNode;
/* 0x0C */ void (*onCreateCallback)(Shadow* shadow);
/* 0x10 */ char unk_10[0x14];
} StaticShadowData; // size = 0x24
typedef struct PushBlockGrid {
/* 0x00 */ s8* cells;
/* 0x04 */ u8 numCellsX;
@ -1373,18 +1354,6 @@ typedef struct RenderTask {
/* 0x0C */ void (*appendGfx)(void*);
} RenderTask; // size = 0x10
typedef void(*CustomModelGfxBuilderFunc)(s32 index);
typedef struct CustomModelGfxBuilder {
/* 0x00 */ CustomModelGfxBuilderFunc pre;
/* 0x00 */ CustomModelGfxBuilderFunc post;
} CustomModelGfxBuilder; // size = 0x8
typedef struct CustomModelGfx {
/* 0x00 */ Gfx* pre;
/* 0x00 */ Gfx* post;
} CustomModelGfx; // size = 0x8
typedef struct SelectableTarget {
/* 0x00 */ s16 actorID;
/* 0x02 */ s16 partID; /* sometimes loaded as byte from 0x3 */
@ -1664,15 +1633,6 @@ typedef struct CollisionHeader {
/* 0x18 */ char unk_18[8];
} CollisionHeader; // size = 0x20
typedef struct Zone {
/* 0x00 */ s32 type;
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
/* 0x0C */ f32 pos[6];
/* 0x24 */ f32 viewPitch;
/* 0x28 */ s32 flag;
} Zone; // size = 0x2C
typedef struct ActorMovement {
/* 0x00 */ Vec3f currentPos;
/* 0x0C */ Vec3f goalPos;
@ -1939,12 +1899,6 @@ typedef struct PlayerStatus {
/* 0x281 */ char unk_281[7];
} PlayerStatus; // size = 0x288
typedef struct AnimatedModelNode {
/* 0x00 */ u32* displayList;
/* 0x04 */ s16 rot[3]; /* range = -180,180 */
/* 0x0A */ char unk_0A[34];
} AnimatedModelNode; // size = 0x2C
typedef struct EncounterStatus {
/* 0x000 */ s32 flags;
/* 0x004 */ s8 eFirstStrike; /* 0 = none, 1 = player, 2 = enemy */
@ -2044,10 +1998,10 @@ typedef struct PauseMapSpace {
} PauseMapSpace; // size = 0x14
typedef struct MenuPanel {
/* 0x00 */ s8 initialized; //?
/* 0x00 */ u8 initialized; //?
/* 0x01 */ s8 col; // might be backwards
/* 0x02 */ s8 row; // might be backwards
/* 0x03 */ s8 selected;
/* 0x03 */ u8 selected;
/* 0x04 */ s8 page; // filemenu: 0 = select, 1 = delete, 3 = copy from, 4 = copy to, all else = save
/* 0x05 */ s8 numCols;
/* 0x06 */ s8 numRows;
@ -2057,7 +2011,7 @@ typedef struct MenuPanel {
/* 0x10 */ UNK_FUN_PTR(fpHandleInput);
/* 0x14 */ UNK_FUN_PTR(fpUpdate);
/* 0x18 */ UNK_FUN_PTR(fpCleanup);
} MenuPanel;
} MenuPanel; // size = 0x1C
typedef struct WindowBackground {
/* 0x00 */ s32* imgData;
@ -2298,17 +2252,10 @@ typedef struct TempSetZoneEnabled {
/* 0x04 */ s16 id1;
/* 0x06 */ s16 id2;
/* 0x08 */ char unk_08[0x8];
/* 0x10 */ s32 unk_10;
/* 0x10 */ CameraControlSettings* unk_10;
/* 0x14 */ char unk_14[0x8];
} TempSetZoneEnabled; // size = 0x1C
typedef struct RenderTaskEntry {
/* 0x00 */ s32 unk_00;
/* 0x04 */ s32 unk_04;
/* 0x08 */ void* appendGfxArg;
/* 0x0C */ void (*appendGfx)(void*);
} RenderTaskEntry; // size = 0x10
typedef struct ActionCommandStatus {
/* 0x00 */ s32 unk_00;
/* 0x04 */ s32 hudElements[15];

22
include/filemenu.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef _FILEMENU_H_
#define _FILEMENU_H_
#include "common.h"
extern MenuPanel* filemenu_menus[4];
void pause_partners_draw_movelist_flower(MenuPanel* menu, s32 posX, s32 posY);
extern BSS s32 filemenu_iterFileIdx;
extern BSS s32 filemenu_pressedButtons;
extern BSS s32 filemenu_8024C088;
extern BSS s32 filemenu_heldButtons;
extern BSS s32 filemenu_8024C090;
extern BSS s32 filemenu_loadedFileIdx;
extern BSS s32 filemenu_8024C098[2];
extern BSS s32 filemenu_cursorHudElemID;
extern BSS s32 filemenu_8024C0A4[3];
extern BSS s32 filemenu_hudElemIDs[20];
extern BSS s32 filemenu_8024C100[8];
#endif

View File

@ -61,7 +61,7 @@ void set_entity_model_flags(s32 idx, s32 newFlags);
void clear_entity_model_flags(s32 idx, s32 newFlags);
void exec_entity_model_commandlist(s32 idx);
s32 load_entity_model(s32* cmdList);
RenderTaskEntry* queue_render_task(RenderTask* task);
RenderTask* queue_render_task(RenderTask* task);
void setup_pause_menu_tab(MenuWindowBP* bpArray, s32 arraySize);

View File

@ -62,23 +62,6 @@
#define PACK_FILL_COLOR(r, g, b, a) (GPACK_RGBA5551(r, g, b, a) << 0x10) | GPACK_RGBA5551(r, g, b, a)
//NOTE: SCRIPT_ALLOC is probably not quite correct, but this is the closest thing to matching for the functions its used in. Needs more work.
#define SCRIPT_ALLOC(new, index) \
{ \
(*gCurrentScriptListPtr)[index] = new = heap_malloc(sizeof(Evt)); \
gNumScripts++; \
ASSERT(new != NULL); \
}
#define SCRIPT_FREE(index) \
{ \
ScriptList** temp = &gCurrentScriptListPtr; \
s32 *numScripts = &gNumScripts; \
heap_free((**temp)[index]); \
(**temp)[index] = NULL; \
(*numScripts)--; \
}
#define SQ(x) (x*x)
#define CUBE(x) (x*x*x)
#define QUART(x) (x*x*x*x)

View File

@ -4,6 +4,7 @@
#include "common_structs.h"
#include "enums.h"
#include "script_api/map.h"
#include "model.h"
// TODO: consider moving Npc here

151
include/model.h Normal file
View File

@ -0,0 +1,151 @@
#ifndef _MODEL_H_
#define _MODEL_H_
#include "common.h"
typedef union ModelNodePropertyData {
s32 s;
f32 f;
s32* p;
} ModelNodePropertyData;
typedef struct ModelNodeProperty {
/* 0x0 */ s32 key;
/* 0x4 */ s32 dataType;
/* 0x8 */ ModelNodePropertyData data;
} ModelNodeProperty; // size = 0xC;
typedef struct ModelNode {
/* 0x00 */ s32 type; /* 2 = model */
/* 0x04 */ ModelDisplayData* displayData;
/* 0x08 */ s32 numProperties;
/* 0x0C */ ModelNodeProperty* propertyList;
/* 0x10 */ struct ModelGroupData* groupData;
} ModelNode; // size = 0x14
typedef struct Model {
/* 0x00 */ u16 flags;
/* 0x02 */ u16 modelID;
/* 0x04 */ Matrix4s* currentMatrix;
/* 0x08 */ ModelNode* modelNode;
/* 0x0C */ ModelGroupData* groupData;
/* 0x10 */ s32* currentSpecialMatrix;
/* 0x14 */ char unk_14[4];
/* 0x18 */ Matrix4s specialMatrix;
/* 0x58 */ Matrix4f transformMatrix;
/* 0x98 */ Vec3f center;
/* 0xA4 */ u8 texPannerID;
/* 0xA5 */ u8 specialDisplayListID;
/* 0xA6 */ s8 renderMode;
/* 0xA7 */ char unk_A7;
/* 0xA8 */ u8 textureID;
/* 0xA9 */ u8 unk_A9;
/* 0xAA */ char unk_AA[6];
} Model; // size = 0xB0
typedef struct ModelTransformGroup {
/* 0x00 */ u16 flags;
/* 0x02 */ u16 groupModelID;
/* 0x04 */ Mtx* matrixRDP_N;
/* 0x08 */ ModelNode* modelNode;
/* 0x0C */ Matrix4s* transformMtx;
/* 0x10 */ Mtx matrixA;
/* 0x50 */ Matrix4f matrixB;
/* 0x90 */ Vec3f center;
/* 0x9C */ u8 minChildModelIndex;
/* 0x9D */ u8 maxChildModelIndex;
/* 0x9E */ u8 renderMode;
/* 0x9F */ s8 matrixMode;
} ModelTransformGroup; // size = 0xA0
typedef Model* ModelList[MAX_MODELS];
typedef ModelTransformGroup* ModelTransformGroupList[MAX_MODEL_TRANSFORM_GROUPS];
typedef struct ModelLocalVertexCopy {
/* 0x00 */ s32 numVertices;
/* 0x04 */ Vtx* minVertexAddr;
/* 0x08 */ Gfx* gfxCopy[2];
/* 0x10 */ Vtx* vtxCopy[2];
/* 0x18 */ s32 selector;
} ModelLocalVertexCopy; // size = 0x1C
typedef struct ModelTreeInfo {
/* 0x00 */ u8 modelIndex;
/* 0x01 */ s8 treeDepth;
/* 0x02 */ s8 textureID;
/* 0x03 */ char unk_03;
} ModelTreeInfo; // size = 0x04
typedef struct TextureHandle {
/* 0x00 */ Gfx* gfx;
/* 0x04 */ TileDescriptor desc;
/* 0x34 */ s32* raster;
/* 0x38 */ s32* palette;
/* 0x3C */ s32* auxRaster;
/* 0x40 */ s32* auxPalette;
} TextureHandle; // size = 0x44
typedef void(*ModelCustomGfxBuilderFunc)(s32 index);
typedef struct ModelCustomGfxBuilder {
/* 0x00 */ ModelCustomGfxBuilderFunc pre;
/* 0x00 */ ModelCustomGfxBuilderFunc post;
} ModelCustomGfxBuilder; // size = 0x8
typedef struct ModelCustomGfx {
/* 0x00 */ Gfx* pre;
/* 0x00 */ Gfx* post;
} ModelCustomGfx; // size = 0x8
typedef struct ModelBlueprint {
/* 0x0 */ s16 flags;
/* 0x2 */ char unk_02[0x2];
/* 0x4 */ ModelNode* mdlNode;
/* 0x8 */ ModelGroupData* groupData;
/* 0xC */ Matrix4s* mtx;
} ModelBlueprint; // size = 0x10
typedef ModelCustomGfx ModelCustomGfxList[32];
typedef ModelCustomGfxBuilder ModelCustomGfxBuilderList[32];
// In memory this is a list of ModelNodeProperty, but due to the way it uses
// the fields (storing into the "type" field) we decided to make a struct for this
typedef struct ModelBoundingBox {
/* 0x00 */ s32 key; // MODEL_PROP_KEY_BOUNDING_BOX
/* 0x04 */ s32 halfSizeX;
/* 0x08 */ f32 minX;
/* 0x0C */ char unk_0C[0x04];
/* 0x10 */ s32 halfSizeY;
/* 0x14 */ f32 minY;
/* 0x18 */ char unk_18[0x04];
/* 0x1C */ s32 halfSizeZ;
/* 0x20 */ f32 minZ;
/* 0x24 */ char unk_24[0x8];
/* 0x2C */ f32 maxX;
/* 0x30 */ char unk_30[0x8];
/* 0x38 */ f32 maxY;
/* 0x3C */ char unk_3C[0x8];
/* 0x44 */ f32 maxZ;
} ModelBoundingBox; // size = 0x48?
typedef enum ModelPropertyKeys {
MODEL_PROP_KEY_RENDER_MODE = 0x5C,
MODEL_PROP_KEY_CAMERA_DATA = 0x5D,
MODEL_PROP_KEY_TEXTURE_NAME = 0x5E,
MODEL_PROP_KEY_SPECIAL = 0x5F,
MODEL_PROP_KEY_GROUP_TYPE = 0x60,
MODEL_PROP_KEY_BOUNDING_BOX = 0x61,
MODEL_PROP_KEY_62 = 0x62,
} ModelPropertyKeys;
typedef enum ShapeTypes {
SHAPE_TYPE_MODEL = 2,
SHAPE_TYPE_GROUP = 5,
SHAPE_TYPE_ROOT = 7,
SHAPE_TYPE_SPECIAL_GROUP = 10,
} ShapeTypes;
typedef ModelTreeInfo ModelTreeInfoList[0x200];
extern ModelTreeInfoList* mdl_currentModelTreeNodeInfo;
#endif

View File

@ -53,19 +53,9 @@ extern s32 gScriptIndexList[MAX_SCRIPTS];
extern s32 gMoveScriptTable[][4];
extern ModelList gWorldModelList;
extern ModelList gBattleModelList;
extern ModelList* gCurrentModelListPtr;
// TODO: potentially a display list, figure this out
extern u32* gWorldModelSpecialDls[32];
extern u32* gBattleModelSpecialDls[32];
extern CustomModelGfx* gCurrentModelSpecialDlsPtr;
extern EntityList gWorldEntityList;
extern EntityList gBattleEntityList;
extern EntityList* gCurrentEntityListPtr;
extern s32 gLastCreatedEntityIndex;
extern DynamicEntityList gWorldDynamicEntityList;
extern DynamicEntityList gBattleDynamicEntityList;

View File

@ -1,13 +1,84 @@
#include "common.h"
#include "filemenu.h"
// TODO this is the bss for the whole segment - break it up
static char bss[0xA0];
extern s32 D_80241ECC;
extern MenuPanel D_8024A098;
extern MenuPanel D_8024A114;
extern MenuPanel D_8024A158;
extern MenuPanel D_8024A1D8;
extern s32 D_8024BA60;
extern s32 D_8024BA98;
void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
void filemenu_draw_contents_copy_arrow(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
);
s32* D_80249B80[] = { &D_80241ECC };
MenuPanel* filemenu_menus[4] = { &D_8024A098, &D_8024A114, &D_8024A158, &D_8024A1D8 };
s32 D_80249B94 = 160;
s32 D_80249B98 = -120;
s32 D_80249B9C[] = {0};
s32 D_80249BA0 = 160;
s32 D_80249BA4[] = { -120 };
s32 filemenu_cursorGoalAlpha = 0;
s32 filemenu_cursorGoalAlpha2 = 0;
s32 D_80249BB0[] = { 0x00000001, 0x00000000 };
s32 D_80249BB8[] = { 0x00000000 };
s16 D_80249BBC[16] = { 315, 303, 283, 260, 235, 210, 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 };
s16 D_80249BDC[16] = { 315, 303, 283, 260, 235, 210, 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 };
s16 D_80249BFC[16] = { 157, 151, 141, 130, 117, 105, 92, 80, 67, 55, 42, 30, 18, 8, 2, 0 };
s16 D_80249C1C[16] = { 157, 151, 141, 130, 117, 105, 92, 80, 67, 55, 42, 30, 18, 8, 2, 0 };
s16 D_80249C3C[16] = { 63, 60, 56, 52, 47, 42, 37, 32, 27, 22, 17, 12, 7, 3, 1, 0 };
s16 D_80249C5C[16] = { 63, 60, 56, 52, 47, 42, 37, 32, 27, 22, 17, 12, 7, 3, 1, 0 };
s16 D_80249C7C[10] = { -5, -17, -37, -60, -85, -110, -135, -160, -185, -210 };
s16 D_80249C90[10] = { -5, -17, -37, -60, -85, -110, -135, -160, -185, -210 };
s16 D_80249CA4[10] = { -2, -8, -18, -30, -42, -55, -70, -85, -100, -115 };
s16 D_80249CB8[10] = { -2, -8, -18, -30, -42, -55, -70, -85, -100, -115 };
s16 D_80249CCC[10] = { -1, -3, -7, -12, -17, -22, -27, -32, -37, -42 };
s16 D_80249CE0[10] = { -1, -3, -7, -12, -17, -22, -27, -32, -37, -42 };
s16 D_80249CF4[16] = { 180, 173, 161, 148, 134, 120, 105, 91, 77, 62, 48, 34, 21, 9, 2, 0 };
s16 D_80249D14[] = { 0, 2, 9, 21, 34, 48, 62, 77, 91, 105, 120, 134, 148, 161, 173, 180 };
s16 D_80249D34[] = { 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 };
s16 D_80249D48[10] = { 0, 5, 17, 37, 60, 85, 110, 135, 160, 185};
s32 D_80249D4C = 0; // padding?
s32 D_80249D60[] = { 0x028001E0, 0x01FF0000, 0x028001E0, 0x01FF0000, };
s32 D_80249D70[] = { 0x40E00000, 0x41480000, 0x41500000, 0x41680000, 0x41600000, 0x41500000, 0x41380000, 0x41180000,
0x40F00000, 0x40B00000, 0x40600000, 0x40000000, 0x3F800000, 0x3F000000, 0x00000000, };
s32 D_80249DAC[] = { 0x2C000010, 0x00180120, 0x00C00000, 0x00000000, 0x00000000, 0xFF000000, 0x00000001, 0x40000000, };
s32 D_80249DCC[] = { &D_8024BA60, 0x18000000, 0x00000120, 0x00C00000, filemenu_draw_contents_copy_arrow, 0x00000000,
0x2C000000, 0x00000001, 0x00000000, &D_8024BA98, 0x17000000, 0x00000140, 0x00F00000,
filemenu_draw_cursor, 0x00000000, 0xFF000000, 0x00000001, 0x00000000, &D_8024BA98, 0x00000000,
0x00000000, };
BSS s32 filemenu_iterFileIdx;
BSS s32 filemenu_pressedButtons;
BSS s32 filemenu_8024C088;
BSS s32 filemenu_heldButtons;
BSS s32 filemenu_8024C090;
BSS s32 filemenu_loadedFileIdx;
BSS s32 filemenu_8024C098[2];
BSS s32 filemenu_cursorHudElemID;
BSS s32 filemenu_8024C0A4[3];
BSS s32 filemenu_hudElemIDs[20];
BSS s32 filemenu_8024C100[8];
INCLUDE_ASM(s32, "163400", mainmenu_draw_rect);
INCLUDE_ASM(s32, "163400", filemenu_set_selected);
void filemenu_set_selected(MenuPanel* menu, s32 col, s32 row) {
menu->col = col;
menu->row = row;
menu->selected = menu->gridData[(menu->page * menu->numCols * menu->numRows) +
(menu->numCols * (s8) row) + menu->col];
}
INCLUDE_ASM(s32, "163400", filemenu_set_cursor_alpha);
void filemenu_set_cursor_alpha(s32 arg0) {
filemenu_cursorGoalAlpha = arg0;
filemenu_cursorGoalAlpha2 = arg0;
}
INCLUDE_ASM(s32, "163400", filemenu_set_cursor_goal_pos);
@ -15,33 +86,322 @@ INCLUDE_ASM(s32, "163400", filemenu_update_cursor);
INCLUDE_ASM(s32, "163400", filemenu_update);
INCLUDE_ASM(s32, "163400", func_8024330C);
void func_8024330C(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_update_show_name_input);
if (updateCounter == 0) {
window->flags &= ~0x4;
}
INCLUDE_ASM(s32, "163400", filemenu_update_show_options_left);
if (updateCounter < ARRAY_COUNT(D_80249BBC)) {
*posX -= D_80249BBC[updateCounter];
} else {
*posX -= D_80249BBC[ARRAY_COUNT(D_80249BBC) - 1];
window->flags &= ~0x8;
}
}
INCLUDE_ASM(s32, "163400", filemenu_update_show_options_right);
void filemenu_update_show_name_input(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_update_show_options_bottom);
if (updateCounter == 0) {
window->flags &= ~0x4;
}
INCLUDE_ASM(s32, "163400", filemenu_update_show_title);
if (updateCounter < ARRAY_COUNT(D_80249BDC)) {
*posX += D_80249BDC[updateCounter];
} else {
*posX += D_80249BDC[ARRAY_COUNT(D_80249BDC) - 1];
window->flags &= ~0x8;
}
}
INCLUDE_ASM(s32, "163400", func_802435C4);
void filemenu_update_show_options_left(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_name_input);
if (updateCounter == 0) {
window->flags &= ~0x4;
}
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_options_left);
if (updateCounter < ARRAY_COUNT(D_80249BFC)) {
*posX -= D_80249BFC[updateCounter];
} else {
*posX -= D_80249BFC[ARRAY_COUNT(D_80249BFC) - 1];
window->flags &= ~0x8;
}
}
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_options_right);
void filemenu_update_show_options_right(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_title);
if (updateCounter == 0) {
window->flags &= ~0x4;
}
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_options_bottom);
if (updateCounter < ARRAY_COUNT(D_80249C1C)) {
*posX += D_80249C1C[updateCounter];
} else {
*posX += D_80249C1C[ARRAY_COUNT(D_80249C1C) - 1];
window->flags &= ~0x8;
}
}
INCLUDE_ASM(s32, "163400", filemenu_update_show_with_rotation);
void filemenu_update_show_options_bottom(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_with_rotation);
if (updateCounter == 0) {
window->flags &= ~0x4;
}
if (updateCounter < ARRAY_COUNT(D_80249C3C)) {
*posY += D_80249C3C[updateCounter];
} else {
*posY += D_80249C3C[ARRAY_COUNT(D_80249C3C) - 1];
window->flags &= ~0x8;
}
}
void filemenu_update_show_title(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter == 0) {
window->flags &= ~0x4;
}
if (updateCounter < ARRAY_COUNT(D_80249C5C)) {
*posY -= D_80249C5C[updateCounter];
} else {
*posY -= D_80249C5C[ARRAY_COUNT(D_80249C5C) - 1];
window->flags &= ~0x8;
}
}
void func_802435C4(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249C7C)) {
*posX += D_80249C7C[updateCounter];
} else {
*posX += D_80249C7C[ARRAY_COUNT(D_80249C7C) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_hidden_name_input(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249C90)) {
*posX -= D_80249C90[updateCounter];
} else {
*posX -= D_80249C90[ARRAY_COUNT(D_80249C90) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_hidden_options_left(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249CA4)) {
*posX += D_80249CA4[updateCounter];
} else {
*posX += D_80249CA4[ARRAY_COUNT(D_80249CA4) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_hidden_options_right(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249CB8)) {
*posX -= D_80249CB8[updateCounter];
} else {
*posX -= D_80249CB8[ARRAY_COUNT(D_80249CB8) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_hidden_title(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249CCC)) {
*posY += D_80249CCC[updateCounter];
} else {
*posY += D_80249CCC[ARRAY_COUNT(D_80249CCC) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_hidden_options_bottom(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < ARRAY_COUNT(D_80249CE0)) {
*posY -= D_80249CE0[updateCounter];
} else {
*posY -= D_80249CE0[ARRAY_COUNT(D_80249CE0) - 1];
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_update_show_with_rotation(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter == 0) {
window->flags &= ~0x4;
}
if (updateCounter < ARRAY_COUNT(D_80249CF4)) {
*rotY += D_80249CF4[updateCounter];
*flags = 8 | 1;
} else {
*flags = 0;
window->flags &= ~0x8;
}
}
void filemenu_update_hidden_with_rotation(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
if (updateCounter < 10) { // TODO: array count?
*rotY += -D_80249D14[updateCounter];
*flags = 8 | 1;
} else {
*flags = 0;
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
INCLUDE_ASM(s32, "163400", filemenu_update_select_file);
@ -49,13 +409,50 @@ INCLUDE_ASM(s32, "163400", filemenu_update_deselect_file);
INCLUDE_ASM(s32, "163400", filemenu_update_show_name_confirm);
INCLUDE_ASM(s32, "163400", filemenu_update_hidden_name_confirm);
void filemenu_update_hidden_name_confirm(
s32 windowIdx,
s32* flags,
s32* posX, s32* posY, s32* posZ,
s32* scaleX, s32* scaleY,
s32* rotX, f32* rotY, s32* rotZ,
s32* darkening,
s32* opacity
) {
Window* window = &gWindows[windowIdx];
s32 updateCounter = window->updateCounter;
INCLUDE_ASM(s32, "163400", filemenu_draw_cursor);
if (updateCounter < ARRAY_COUNT(D_80249D48)) {
gDPPipeSync(gMasterGfxPos++);
gDPSetCycleType(gMasterGfxPos++, G_CYC_1CYCLE);
gDPSetCombineMode(gMasterGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetRenderMode(gMasterGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
gDPSetPrimColor(gMasterGfxPos++, 0, 0, 0, 0, 0, 140 - (updateCounter * 14));
mainmenu_draw_rect(0, 0, 1280, 960, 0, 0, 0, 0, 0);
*posY -= D_80249D48[updateCounter];
} else {
window->flags &= ~0x8;
window->flags |= 0x4;
}
}
void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
s32 temp_a1;
filemenu_update_cursor();
temp_a1 = *D_80249B9C;
if (temp_a1 > 0) {
if (temp_a1 > 255) {
temp_a1 = 255;
}
set_hud_element_alpha(filemenu_cursorHudElemID, temp_a1);
set_hud_element_render_pos(filemenu_cursorHudElemID, baseX + D_80249B94, baseY + D_80249B98);
draw_hud_element_3(filemenu_cursorHudElemID);
}
}
INCLUDE_ASM(s32, "163400", filemenu_draw_contents_copy_arrow);
INCLUDE_ASM(void, "163400", filemenu_init, s32 arg0);
INCLUDE_ASM(void, "163400", filemenu_init);
INCLUDE_ASM(s32, "163400", filemenu_cleanup);

View File

@ -1,10 +1,37 @@
#include "common.h"
#include "filemenu.h"
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_title);
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_stereo);
void filemenu_draw_contents_stereo(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
if (gGameStatusPtr->unk_AB == 1) {
set_hud_element_render_pos(filemenu_hudElemIDs[18], baseX + 34, baseY + 10);
draw_hud_element_3(filemenu_hudElemIDs[18]);
} else {
set_hud_element_render_pos(filemenu_hudElemIDs[19], baseX + 34, baseY + 10);
draw_hud_element_3(filemenu_hudElemIDs[19]);
}
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_mono);
void filemenu_draw_contents_mono(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
if (gGameStatusPtr->unk_AB == 0) {
set_hud_element_render_pos(filemenu_hudElemIDs[16], baseX + 34, baseY + 10);
draw_hud_element_3(filemenu_hudElemIDs[16]);
} else {
set_hud_element_render_pos(filemenu_hudElemIDs[17], baseX + 34, baseY + 10);
draw_hud_element_3(filemenu_hudElemIDs[17]);
}
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_option_left);
@ -16,21 +43,77 @@ INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_info);
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_title);
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_0_info);
void filemenu_draw_contents_file_0_info(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_info(0, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_1_info);
void filemenu_draw_contents_file_1_info(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_info(1, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_2_info);
void filemenu_draw_contents_file_2_info(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_info(2, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_3_info);
void filemenu_draw_contents_file_3_info(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_info(3, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_0_title);
void filemenu_draw_contents_file_0_title(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_title(0, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_1_title);
void filemenu_draw_contents_file_1_title(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_title(1, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_2_title);
void filemenu_draw_contents_file_2_title(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_title(2, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_draw_contents_file_3_title);
void filemenu_draw_contents_file_3_title(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
filemenu_draw_contents_file_title(3, menu, baseX, baseY, width, height, opacity, darkening);
}
INCLUDE_ASM(s32, "165490", filemenu_main_init);
@ -38,4 +121,10 @@ INCLUDE_ASM(s32, "165490", filemenu_main_handle_input);
INCLUDE_ASM(s32, "165490", filemenu_main_update);
INCLUDE_ASM(s32, "165490", filemenu_main_cleanup);
void filemenu_main_cleanup(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) {
free_hud_element(filemenu_hudElemIDs[i]);
}
}

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "filemenu.h"
INCLUDE_ASM(s32, "167570", filemenu_yesno_draw_options_contents);

View File

@ -1,10 +1,98 @@
#include "common.h"
#include "filemenu.h"
INCLUDE_ASM(s32, "168590", filemenu_info_draw_message_contents);
extern MenuWindowBP D_8024A134[1];
INCLUDE_ASM(s32, "168590", filemenu_info_init);
extern s32 filemenu_iterFileIdx;
extern s32 filemenu_pressedButtons;
extern s8 D_8024C090;
extern s32 filemenu_loadedFileIdx;
extern s8 D_8024C098_C09918;
extern s32 D_8024C100_C09980[3];
extern s32 D_8024C110;
INCLUDE_ASM(s32, "168590", filemenu_info_handle_input);
s32 filemenu_get_menu_message(s32 index);
void filemenu_update_show_options_left(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, s32* scaleX,
s32* scaleY, s32* rotX, s32* rotY, s32* rotZ, s32* darkening, s32* opacity);
void filemenu_update_show_options_right(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, s32* scaleX,
s32* scaleY, s32* rotX, s32* rotY, s32* rotZ, s32* darkening, s32* opacity);
void filemenu_update_show_options_bottom(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, s32* scaleX,
s32* scaleY, s32* rotX, s32* rotY, s32* rotZ, s32* darkening, s32* opacity);
void filemenu_info_draw_message_contents(MenuPanel* menu, s32 baseX, s32 baseY) {
s8 page = menu->page;
switch (page) {
case 0:
filemenu_draw_message(filemenu_get_menu_message(0x1A), baseX + 10, baseY + 4, 255, 0, 0);
draw_number(filemenu_menus[0]->selected + 1, baseX + 48, baseY + 6, 0, 0, 255, 3);
filemenu_draw_message(filemenu_get_menu_message(0x1B), baseX + 49, baseY + 4, 255, 0, 0);
break;
case 2:
filemenu_draw_message(filemenu_get_menu_message(0x1D), baseX + 10, baseY + 4, 255, 0, 0);
filemenu_draw_message(filemenu_get_menu_message(0x1A), baseX + 84, baseY + 4, 255, 0, 0);
draw_number(filemenu_loadedFileIdx + 1, baseX + 122, baseY + 6, 0, 0, 255, 3);
filemenu_draw_message(filemenu_get_menu_message(0x1E), baseX + 10, baseY + 18, 255, 0, 0);
filemenu_draw_message(filemenu_get_menu_message(0x1A), baseX + 30, baseY + 18, 255, 0, 0);
draw_number(filemenu_iterFileIdx + 1, baseX + 68, baseY + 20, 0, 0, 255, 3);
filemenu_draw_message(filemenu_get_menu_message(0x22), baseX + 65, baseY + 18, 255, 0, 0);
break;
case 1:
filemenu_draw_message(filemenu_get_menu_message(0x1C), baseX + 10, baseY + 4, 255, 0, 0);
break;
case 3:
filemenu_draw_message(filemenu_get_menu_message(0x1A), baseX + 10, baseY + 4, 255, 0, 0);
draw_number(filemenu_menus[0]->selected + 1, baseX + 48, baseY + 6, 0, 0, 255, page);
filemenu_draw_message(filemenu_get_menu_message(0x1F), baseX + 49, baseY + 4, 255, 0, 0);
break;
}
filemenu_set_cursor_alpha(0);
}
void filemenu_info_init(s8* tab) {
s32 i;
for (i = 0; i < ARRAY_COUNT(D_8024A134); i++) {
D_8024A134[i].tab = tab;
}
setup_pause_menu_tab(D_8024A134, 1);
*tab = 1;
}
void filemenu_info_handle_input(void) {
if (filemenu_pressedButtons & (BUTTON_A | BUTTON_B)) {
MenuPanel* menu = filemenu_menus[0];
s32 page;
D_8024C098_C09918 = 0;
page = menu->page;
switch(page) {
case 1:
menu->page = 0;
set_window_update(0x33, filemenu_update_show_options_left);
set_window_update(0x34, filemenu_update_show_options_right);
set_window_update(0x35, filemenu_update_show_options_bottom);
set_window_update(0x37, filemenu_update_show_options_bottom);
filemenu_set_selected(menu, 0, 2);
break;
case 4:
menu->page = 0;
set_window_update(0x33, filemenu_update_show_options_left);
set_window_update(0x34, filemenu_update_show_options_right);
set_window_update(0x35, filemenu_update_show_options_bottom);
set_window_update(0x37, filemenu_update_show_options_bottom);
filemenu_set_selected(menu, 1, 2);
break;
case 2:
menu->page = page;
filemenu_set_selected(menu, 1, 2);
break;
}
set_window_update(0x2F, 2);
}
}
void filemenu_info_update(void) {
}
@ -21,7 +109,36 @@ void func_80248170(s32 idx) {
}
}
INCLUDE_ASM(s32, "168590", filemenu_draw_contents_file_create_header);
void filemenu_draw_contents_file_create_header(MenuPanel* menu, s32 baseX, s32 baseY) {
s32 xOffset;
s32 yOffset;
s32 i;
s32 tempAmt;
filemenu_draw_message(filemenu_get_menu_message(0x20), baseX + 10, baseY + 6, 255, 0, 0);
filemenu_draw_file_name(&D_8024C110, 8, baseX + 36, baseY + 22, 255, 0, 0, 0xB);
xOffset = 41;
for (i = 0; i < 8; i++) {
set_hud_element_render_pos(D_8024C100_C09980[1], baseX + 42 + (i * 11), baseY + xOffset);
if (i == 0) {
draw_hud_element_3(D_8024C100_C09980[1]);
} else {
draw_hud_element_2(D_8024C100_C09980[1]);
}
}
tempAmt = 8;
if (D_8024C098_C09918 == 3) {
s32 phi_v0 = 122;
if (D_8024C090 != tempAmt) {
phi_v0 = (D_8024C090 * 0xB) + 45;
}
set_hud_element_render_pos(D_8024C100_C09980[0], baseX + phi_v0, baseY + 45);
draw_hud_element_2(D_8024C100_C09980[0]);
}
}
INCLUDE_ASM(s32, "168590", filemenu_draw_contents_choose_name);
@ -32,4 +149,10 @@ INCLUDE_ASM(s32, "168590", filemenu_choose_name_handle_input);
void filemenu_choose_name_update(void) {
}
INCLUDE_ASM(s32, "168590", filemenu_choose_name_cleanup);
void filemenu_choose_name_cleanup(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(D_8024C100_C09980); i++) {
free_hud_element(D_8024C100_C09980[i]);
}