Skip to content

Commit

Permalink
Merge pull request #670 from MokhaLeee/overlay0
Browse files Browse the repository at this point in the history
review ewram-overlay0
  • Loading branch information
RevoSucks authored Sep 5, 2024
2 parents 12004df + 6d82e77 commit 2953f8c
Show file tree
Hide file tree
Showing 60 changed files with 759 additions and 789 deletions.
21 changes: 18 additions & 3 deletions include/ap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
#include "global.h"
#include "proc.h"

struct APProc;
#define AP_MAX_COUNT 0x14 // 20

struct APProc {
PROC_HEADER;

u8 _pad[0x50-0x29];

struct APHandle* pHandle;

u32 xPosition;
u32 yPosition;
};

struct APHandle {
/* 00 */ const u16 * pDefinition; // Pointer to Definition Root
Expand Down Expand Up @@ -39,8 +50,8 @@ void AP_ExecDummyFrame(struct APHandle *);
void AP_Init(struct APHandle *, const u16 *, u16);
struct APHandle * AP_Find(const u16 * definition);
ProcPtr APProc_Create(const void * apDefinition, int xPos, int yPos, int tileBase, int anim, int aObjNode);
// ??? APProc_OnUpdate(???);
// ??? APProc_OnEnd(???);
void APProc_OnUpdate(struct APProc * proc);
void APProc_OnEnd(struct APProc * proc);
void APProc_SetParameters(struct APProc * proc, int x, int y, int tileBase);
void APProc_Delete(struct APProc * proc);
void APProc_DeleteAll(void);
Expand All @@ -54,4 +65,8 @@ bool APProc_Exists(void);
(anim)->frameTimer = 0; \
(anim)->frameInterval = 0

extern struct ProcCmd CONST_DATA ProcScr_ApProc[];
extern u8 CONST_DATA sOamTileSizeLut[];
// extern struct APHandle sAPArray[AP_MAX_COUNT];

#endif // GUARD_AP_H
50 changes: 40 additions & 10 deletions include/bm.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
#ifndef GUARD_BM_H
#define GUARD_BM_H

enum {
CAMERA_MARGIN_LEFT = 16 * 3,
CAMERA_MARGIN_RIGHT = 16 * 11,
CAMERA_MARGIN_TOP = 16 * 2,
CAMERA_MARGIN_BOTTOM = 16 * 7,
};

struct CamMoveProc {
/* 00 */ PROC_HEADER;

/* 2C */ struct Vec2 to;
/* 30 */ struct Vec2 from;
/* 34 */ struct Vec2 watchedCoordinate;
/* 38 */ s16 calibration;
/* 3A */ s16 distance;
/* 3C */ int frame;
/* 40 */ s8 xCalibrated;
};

struct UnkMapCursorProc {
/* 00 */ PROC_HEADER;

/* 2C */ struct Vec2 to;
/* 30 */ struct Vec2 from;
/* 34 */ int clock;
/* 38 */ int duration;
};

void OnVBlank(void);
void OnGameLoopMain(void);
void OnMain(void);
void LockGame(void);
void UnlockGame(void);
u8 GetGameLock(void);
Expand Down Expand Up @@ -35,22 +62,25 @@ void PutMapCursor(int x, int y, int kind);
void DisplayBmTextShadow(int x, int y);
void SetCursorMapPosition(int, int);
void UpdateStatArrowSprites(int, int, u8);
// ??? CamMove_OnInit(???);
// ??? CamMove_OnLoop(???);
void CamMove_OnInit(struct CamMoveProc * proc);
void CamMove_OnLoop(struct CamMoveProc * proc);
void StoreAdjustedCameraPositions(int xIn, int yIn, int * xOut, int * yOut);
s8 sub_8015D84(ProcPtr parent, int x, int y);
s8 EnsureCameraOntoPosition(ProcPtr p, int x, int y);
s8 IsCameraNotWatchingPosition(int x, int y);
s8 CameraMove_8015EDC(ProcPtr parent);
// ??? UnkMapCursor_OnLoop(???);
// ??? sub_8015F90(???);
void UnkMapCursor_OnLoop(struct UnkMapCursorProc * proc);
void sub_8015F90(int x, int y, int duration);
int GetCurrentMapMusicIndex(void);
void StartMapSongBgm(void);
// ??? sub_80160E0(???);
// ??? sub_801613C(???);
// ??? sub_8016140(???);
void sub_80160E0(struct CamMoveProc * proc);
void sub_801613C(void);
void sub_8016140(ProcPtr parent, int x, int y, int distance);

extern struct ProcCmd CONST_DATA gProc_BMapMain[];
extern struct ProcCmd CONST_DATA gProcScr_CamMove[];
extern struct ProcCmd CONST_DATA ProcScr_CamMove[];
extern struct ProcCmd gProcScr_ResetCursorPosition[];
extern struct ProcCmd ProcScr_PhaseIntro[];
extern struct ProcCmd gProcScr_ChapterIntroTitleOnly[];

#endif // GUARD_BM_H
#endif // GUARD_BM_H
41 changes: 21 additions & 20 deletions include/bmarena.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#define GUARD_BMARENA_H

#include "global.h"
#include "bmunit.h"

struct ArenaData
{
/* 00 */ struct Unit* playerUnit;
/* 04 */ struct Unit* opponentUnit;
/* 00 */ struct Unit * playerUnit;
/* 04 */ struct Unit * opponentUnit;
/* 08 */ short matchupGoldValue;
/* 0A */ u8 result;
/* 0B */ u8 unk0B;
Expand All @@ -25,28 +26,28 @@ struct ArenaData
/* 1C */ u16 opponentWeapon;
};

// ??? ArenaBeginInternal(???);
void ArenaBegin(struct Unit* unit);
void ArenaResume(struct Unit* unit);
// ??? GetUnitBestWRankType(???);
// ??? GetClassBestWRankType(???);
// ??? ArenaGenerateOpposingClassId(???);
// ??? IsWeaponMagic(???);
// ??? ArenaGetOpposingLevel(???);
// ??? ArenaGetPowerRanking(???);
// ??? ArenaGenerateOpponentUnit(???);
// ??? ArenaGenerateBaseWeapons(???);
// ??? ArenaGetUpgradedWeapon(???);
// ??? ArenaAdjustOpponentDamage(???);
// ??? ArenaAdjustOpponentPowerRanking(???);
// ??? ArenaGenerateMatchupGoldValue(???);
void ArenaBeginInternal(struct Unit * unit);
void ArenaBegin(struct Unit * unit);
void ArenaResume(struct Unit * unit);
int GetUnitBestWRankType(struct Unit *);
int GetClassBestWRankType(const struct ClassData *);
int ArenaGenerateOpposingClassId(int);
s8 IsWeaponMagic(int);
int ArenaGetOpposingLevel(int);
int ArenaGetPowerRanking(struct Unit *, s8);
void ArenaGenerateOpponentUnit(void);
void ArenaGenerateBaseWeapons(void);
u16 ArenaGetUpgradedWeapon(u16 item);
s8 ArenaAdjustOpponentDamage(void);
s8 ArenaAdjustOpponentPowerRanking(void);
void ArenaGenerateMatchupGoldValue(void);
int ArenaGetMatchupGoldValue(void);
int ArenaGetResult(void);
void ArenaSetResult(int result);
void ArenaContinueBattle(void);
s8 ArenaIsUnitAllowed(struct Unit*);
// ??? ArenaSetFallbackWeaponForUnit(???);
// ??? ArenaSetFallbackWeaponsMaybe(???);
s8 ArenaIsUnitAllowed(struct Unit *);
void ArenaSetFallbackWeaponForUnit(struct Unit * unit, u16 * pItem);
void ArenaSetFallbackWeaponsMaybe(void);

extern struct ArenaData gArenaState;

Expand Down
4 changes: 2 additions & 2 deletions include/bmcontainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ void RemoveItemFromConvoy(int);
int GetConvoyItemSlot(int);
bool8 HasConvoyAccess(void);
bool8 sub_8031660(void);
struct Unit* GetSupplyUnit(void);
struct Unit * GetSupplyUnit(void);

extern EWRAM_DATA u8 gConvoyItemCount;
extern const struct MenuDef gSendToConvoyMenuDef;
extern const struct MenuDef gConvoyMenuDef;

#endif // GUARD_BM_CONTAINER_H
#endif // GUARD_BM_CONTAINER_H
98 changes: 73 additions & 25 deletions include/bmdifficulty.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#ifndef GUARD_BMDIFFICULTY_H
#define GUARD_BMDIFFICULTY_H

#include "global.h"
#include "fontgrp.h"
#include "bmunit.h"

#define BGPAL_BMDIFFICULTY_UNK_0 0
#define OBPAL_BMDIFFICULTY_UNK_5 5

struct Dungeon {
/* 00 */ u32 expEarned:16;

Expand All @@ -24,6 +31,14 @@ struct Struct030017A0 {
/* 24 */ u8 type; // tower = 0, ruins = 1
};

extern struct Struct030017A0 gDungeonState;

struct Struct020038C8 {
struct Text text[5][8];
};

extern struct Struct020038C8 gUnknown_020038C8[2];

enum {
DUNGEONRECORD_LABEL_MONSTERS,
DUNGEONRECORD_LABEL_EXP,
Expand All @@ -42,9 +57,28 @@ struct BMDifficultyProc {
/* 3C */ int unk_3c;
};

extern int gUnknown_020038C4;

struct Struct080D7FD0 {
s8 x;
s8 y;
u16 _pad;
u8 numDigits;
};

struct Outer080D7FD0 {
struct Struct080D7FD0 current[4];
s8 x;
s8 y;
struct Struct080D7FD0 record[4];
s8 x2;
s8 y2;
};
extern const struct Outer080D7FD0 gUnknown_080D7FD0;

int GetCurrentPromotedLevelBonus(void);
s8 CanUnitSeize(struct Unit* unit);
// ??? DungeonRecordUi_InitText(???);
s8 CanUnitSeize(struct Unit * unit);
void DungeonRecordUi_InitText(void);
void InitDungeon(u8 type);
void UnlockPostgameAllyByEnemyCount(void);
void UnlockPostgameAllyByClearCount(void);
Expand All @@ -65,32 +99,46 @@ void PushGlobalTimer(void);
void PopGlobalTimer(void);
void sub_8038230(void);
void SetupDungeonRecordUi(ProcPtr proc);
// ??? DrawDungeonRecordUiLabels(???);
// ??? DrawNumberText(???);
// ??? DrawNumberText_WithReset(???);
// ??? sub_8038668(???);
// ??? DrawTimeText(???);
// ??? DrawTimeText_WithReset(???);
void DrawDungeonRecordUiLabels(struct Text * th);
struct Text * DrawNumberText(struct Text * th, u16 number, u8 places, s8 x, s8 y, u8 colorId);
struct Text * DrawNumberText_WithReset(struct Text * th, u16 number, u8 numTiles, s8 x, s8 y, u8 colorId);
void sub_8038668(struct Text * th, u8 count);
struct Text * DrawTimeText(struct Text* th, int time, s8 xBase, s8 yBase, u8 colorId);
struct Text * DrawTimeText_WithReset(struct Text* th, int time, s8 xBase, s8 yBase, u8 colorId, s8 drawPunctuation);
void DrawDungeonRecordUiText(ProcPtr proc);
// ??? DungeonRecordUi_UpdateRunningTime(???);
void DungeonRecordUi_UpdateRunningTime(void);
void DungeonRecordUi_KeyListenerUpdatesTime(ProcPtr proc);
void DungeonRecordUi_KeyListener(ProcPtr proc);
void EndDungeonRecordUi(void);
// ??? sub_8038F78(???);
// ??? sub_803901C(???);
// ??? sub_80390D4(???);
// ??? DungeonRecordUi_SpawnUpdateValueProc(???);
// ??? GetCurrentDungeonValueByUiLabel(???);
// ??? GetRecordDungeonValueByUiLabel(???);
// ??? DungeonRecordUi_IsNewRecordForLabel(???);
// ??? sub_803943C(???);
// ??? sub_803948C(???);
// ??? sub_80394A8(???);
// ??? sub_8039554(???);
// ??? DungeonRecordUi_UpdateEnemiesDefeatedCount(???);
// ??? sub_803963C(???);
// ??? sub_8039660(???);
// ??? sub_8039668(???);
// ??? DungeonRecordUi_GotoNextLabel(???);
void sub_8038F78(struct Text * th);
void sub_803901C(struct BMDifficultyProc* proc);
void sub_80390D4(struct BMDifficultyProc* proc);
struct BMDifficultyProc * DungeonRecordUi_SpawnUpdateValueProc(int label, int value, ProcPtr parent);
u32 GetCurrentDungeonValueByUiLabel(u32 label);
u32 GetRecordDungeonValueByUiLabel(u32 label);
s8 DungeonRecordUi_IsNewRecordForLabel(u32 label);
void sub_803943C(struct BMDifficultyProc* proc);
void sub_803948C(ProcPtr proc);
void sub_80394A8(struct BMDifficultyProc* proc);
void sub_8039554(struct BMDifficultyProc* proc);
void DungeonRecordUi_UpdateEnemiesDefeatedCount(struct BMDifficultyProc* proc);
void sub_803963C(struct BMDifficultyProc* proc);
void sub_8039660(struct BMDifficultyProc* proc);
void sub_8039668(struct BMDifficultyProc* proc);
void DungeonRecordUi_GotoNextLabel(struct BMDifficultyProc* proc);

extern struct Struct02003BE8 gUnknown_02003BE8;
extern u16 gUnknown_02003B88[];
extern struct Struct0859E7D4 gUnknown_02003BA8[];
extern u16 gUnknown_0200310C[];
extern struct Font gUnknown_020038AC;
extern struct Text gUnknown_02003B48[8];

extern struct ProcCmd CONST_DATA sProcScr_DisplayDungeonRecord_FromMenu[];
extern struct ProcCmd CONST_DATA sProcScr_DisplayDungeonRecord_AfterDungeonClear[];
extern const u16 CONST_DATA obj_859E79C[];
extern u16 CONST_DATA gUnknown_0859E7C8[];
extern struct Struct0859E7D4 CONST_DATA gUnknown_0859E7D4[];
extern struct ProcCmd CONST_DATA sProcScr_DungeonRecord_UpdateNewRecordValues[];

#endif // GUARD_BMDIFFICULTY_H
2 changes: 1 addition & 1 deletion include/bonusclaim.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern struct BonusClaimEnt gBonusClaimData[];
extern struct BonusClaimEnt gBonusClaimDataUpdated[];
extern struct BonusClaimItemEnt gBonusClaimItemList[];
extern struct BonusClaimConfig gBonusClaimConfig[];
extern int gBonusClaimItemCount;
extern int gBonusClaimItemCounts[];
extern struct Text gBonusClaimText[];

extern struct BonusClaimEnt * gpBonusClaimData;
Expand Down
Loading

0 comments on commit 2953f8c

Please sign in to comment.