Skip to content

Commit

Permalink
Merge pull request #646 from MokhaLeee/mure
Browse files Browse the repository at this point in the history
Review mu/bmudisp
  • Loading branch information
RevoSucks authored Jul 11, 2024
2 parents c95bc90 + b5723d2 commit 8812c95
Show file tree
Hide file tree
Showing 96 changed files with 2,301 additions and 2,571 deletions.
8 changes: 8 additions & 0 deletions include/ap.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ void APProc_Delete(struct APProc * proc);
void APProc_DeleteAll(void);
bool APProc_Exists(void);

#define ResetSpriteAnimClock(anim) \
(anim)->frameTimer = 0; \
(anim)->frameInterval = 0x100

#define FreezeSpriteAnim(anim) \
(anim)->frameTimer = 0; \
(anim)->frameInterval = 0

#endif // GUARD_AP_H
3 changes: 3 additions & 0 deletions include/bmmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ extern u8 ** gBmMapOther;
extern u8 * gTilesetTerrainLookup;
extern u16 ** gBmMapBaseTiles;

#define gMapRangeSigned ((s8 **) gBmMapRange)
#define gMapMovementSigned ((s8 **) gBmMapMovement)

enum
{
// Magic values for gBmMapMovement
Expand Down
2 changes: 1 addition & 1 deletion include/bmmind.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct CombatActionProc {

/* 29 */ u8 unk_29[0x54-0x29];

/* 54 */ struct MUProc* unk_54;
/* 54 */ struct MuProc* unk_54;
/* 58 */ u8 unk_58[0x64-0x58];

/* 64 */ s16 unitIdA;
Expand Down
19 changes: 11 additions & 8 deletions include/bmudisp.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
#ifndef GUARD_BM_UDISP_H
#define GUARD_BM_UDISP_H

#define UNITSPRITE_MAX 0xD0
#define UNITSPRITE_ID_BITS 7

// ??? sub_8026618(???);
void SetupMapSpritesPalettes(void);
void ApplyUnitSpritePalettes(void);
// ??? sub_8026670(???);
void ResetUnitSprites(void);
// ??? ResetUnitSpritesB(???);
int SMS_80266F0(int smsId, int frameId);
int SMS_SomethingGmapUnit(int smsId, int frameId, int slot);
int StartUiSMS(int smsId, int frameId);
int StartWorldMapSMS(int smsId, int frameId, int slot);
int UseUnitSprite(u32);
int ApplyUnitSpriteUiImage16x16(int, u32);
int ApplyUnitSpriteImage16x16(int, u32);
int SomethingSMS_16x16(int, u32);
int ApplyUnitSpriteImage16x32(int, u32);
int ApplyUnitSpriteImage32x32(int, u32);
void sub_8026C1C(struct Unit*, int);
void TornOutUnitSprite(struct Unit * unit, int time);
void SyncUnitSpriteSheet(void);
void ForceSyncUnitSpriteSheet(void);
void sub_8026FF4(int id, u8* ptr);
void sub_8027068(int id, u8* ptr);
void sub_80270DC(int frameId, u8* dst);
void SetStandingMuFacing(int id, u8* ptr);
void SetStandingMuFacingWM(int frameId, u8* dst);
int GetUnitDisplayedSpritePalette(const struct Unit * unit);
int GetUnitSpritePalette(const struct Unit* unit);
void RefreshUnitSprites(void);
struct SMSHandle* AddUnitSprite(int);
struct SMSHandle * AddUnitSprite(int);
void PutUnitSpritesOam(void);
// ??? PutChapterMarkedTileIconOam(???);
void PutUnitSpriteIconsOam(void);
Expand Down
8 changes: 7 additions & 1 deletion include/bmunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ struct ClassData
/* 50 */ const void * _pU50;
};

enum {
// ClassData::slowWalking
UNIT_WALKSPEED_FAST,
UNIT_WALKSPEED_SLOW,
};

struct Unit
{
/* 00 */ const struct CharacterData* pCharacterData;
Expand Down Expand Up @@ -164,7 +170,7 @@ struct Unit
/* 3A */ u8 _u3A;
/* 3B */ u8 _u3B;

/* 3C */ struct SMSHandle* pMapSpriteHandle;
/* 3C */ struct SMSHandle * pMapSpriteHandle;

/* 40 */ u16 ai_config; // a bitmask
/* 42 */ u8 ai1; // enum to gAi1ScriptTable
Expand Down
139 changes: 139 additions & 0 deletions include/constants/songs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#pragma once

enum song_idx {
SONG_01 = 0x01,
SONG_02 = 0x02,
SONG_03 = 0x03,
SONG_04 = 0x04,
SONG_05 = 0x05,
SONG_06 = 0x06,
SONG_09 = 0x09,
SONG_0A = 0x0A,
SONG_0C = 0x0C,
SONG_0E = 0x0E,
SONG_0F = 0x0F,
SONG_11 = 0x11,
SONG_12 = 0x12,
SONG_13 = 0x13,
SONG_14 = 0x14,
SONG_22 = 0x22,
SONG_23 = 0x23,
SONG_24 = 0x24,
SONG_25 = 0x25,
SONG_26 = 0x26,
SONG_27 = 0x27,
SONG_28 = 0x28,
SONG_29 = 0x29,
SONG_2A = 0x2A,
SONG_2B = 0x2B,
SONG_2C = 0x2C,
SONG_31 = 0x31,
SONG_32 = 0x32,
SONG_33 = 0x33,
SONG_34 = 0x34,
SONG_37 = 0x37,
SONG_3B = 0x3B,
SONG_3C = 0x3C,
SONG_3D = 0x3D,
SONG_3E = 0x3E,
SONG_3F = 0x3F,
SONG_43 = 0x43,
SONG_44 = 0x44,
SONG_45 = 0x45,
SONG_5A = 0x5A,
SONG_5B = 0x5B,
SONG_5C = 0x5C,
SONG_60 = 0x60, // save success
SONG_61 = 0x61,
SONG_65 = 0x65,
SONG_66 = 0x66,
SONG_67 = 0x67, // change selection in menu/help box
SONG_68 = 0x68,
SONG_69 = 0x69,
SONG_6A = 0x6A,
SONG_6B = 0x6B,
SONG_6C = 0x6C,
SONG_6E = 0x6E,
SONG_6F = 0x6F, // stat screen page slide
SONG_70 = 0x70, // help box open
SONG_71 = 0x71, // help box close
SONG_73 = 0x73,
SONG_74 = 0x74, // exp bar thingy
SONG_75 = 0x75,
SONG_76 = 0x76,
SONG_77 = 0x77,
SONG_78 = 0x78, // open minimap
SONG_79 = 0x79, // close minimap
SONG_7A = 0x7A,
SONG_7B = 0x7B, // sioerror
SONG_82 = 0x82, // manim
SONG_83 = 0x83, // manim
SONG_84 = 0x84, // manim
SONG_85 = 0x85, // manim
SONG_86 = 0x86,
SONG_87 = 0x87,
SONG_88 = 0x88, // manim
SONG_89 = 0x89,
SONG_8A = 0x8A, // manim
SONG_8B = 0x8B, // manim
SONG_8C = 0x8C,
SONG_8D = 0x8D, // manim (unlock?)
SONG_90 = 0x90,
SONG_91 = 0x91,
SONG_96 = 0x96,
SONG_97 = 0x97,
SONG_9A = 0x9A,
SONG_9B = 0x9B,
SONG_9C = 0x9C,
SONG_A0 = 0xA0,
SONG_A4 = 0xA4,
SONG_A5 = 0xA5,
SONG_A6 = 0xA6,
SONG_A8 = 0xA8, // dance sfx
SONG_A9 = 0xA9, // play (bard) sfx
SONG_AA = 0xAA,
SONG_AB = 0xAB,
SONG_AC = 0xAC,
SONG_AF = 0xAF, // obstacle destroy (end)
SONG_B0 = 0xB0, // obstacle destroy (mid)
SONG_B1 = 0xB1,
SONG_B3 = 0xB3,
SONG_B4 = 0xB4, // manim
SONG_B5 = 0xB5, // manim
SONG_B6 = 0xB6,
SONG_B7 = 0xB7, // manim poison
SONG_BA = 0xBA,
SONG_BB = 0xBB,
SONG_BC = 0xBC,
SONG_BD = 0xBD, // chapter 14x timed map change sound A
SONG_BE = 0xBE, // chapter 14x timed map change sound B
SONG_BF = 0xBF,
SONG_C4 = 0xC4,
SONG_C6 = 0xC6,
SONG_C8 = 0xC8, // stat screen unit slide, also miss
SONG_D2 = 0xD2,
SONG_D5 = 0xD5,
SONG_D6 = 0xD6,
SONG_D8 = 0xD8, // crit?
SONG_EC = 0xEC, // no damage
SONG_FD = 0xFD, // manim
SONG_10F = 0x10F,
SONG_269 = 0x269,
SONG_26A = 0x26A,
SONG_2E0 = 0x2E0,
SONG_302 = 0x302,
SONG_303 = 0x303,
SONG_304 = 0x304,
SONG_305 = 0x305,
SONG_306 = 0x306,
SONG_307 = 0x307,
SONG_308 = 0x308,
SONG_309 = 0x309,
SONG_30A = 0x30A,
SONG_30B = 0x30B,
SONG_30C = 0x30C,
SONG_30D = 0x30D,
SONG_30E = 0x30E,
SONG_30F = 0x30F,
SONG_3BB = 0x3BB,
};
7 changes: 7 additions & 0 deletions include/ctc.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,11 @@ void PushSpriteLayerObjects(int layer);
struct SpriteProc * StartSpriteRefresher(ProcPtr parent, int layer, int x, int y, const u16* object, int tileref);
void MoveSpriteRefresher(struct SpriteProc* proc, int x, int y);

#define SetObjAffineAuto(id, angle, x_scale, y_scale) \
SetObjAffine((id), \
Div(+COS((angle)) << 4, (x_scale)), \
Div(-SIN((angle)) << 4, (y_scale)), \
Div(+SIN((angle)) << 4, (x_scale)), \
Div(+COS((angle)) << 4, (y_scale)))

#endif // GUARD_CTC_H
19 changes: 16 additions & 3 deletions include/eventcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,22 @@ void StartEventQuakefx(ProcPtr proc);
void EndEventQuakefx(ProcPtr proc);
void SetEventId_0x84(ProcPtr);
void UnsetEventId_0x84(ProcPtr);
void sub_8085988(struct EventEngineProc * proc);
void sub_8085990(struct EventEngineProc * proc);
void sub_80859D0(ProcPtr proc, ProcPtr parent);

struct ProcUnitTornOut {
PROC_HEADER;
STRUCT_PAD(0x29, 0x4C);

/* 4C */ s16 timer;

STRUCT_PAD(0x4E, 0x54);

/* 54 */ struct Unit * unit;
};

void UnitTornOut_Init(struct ProcUnitTornOut * proc);
void UnitTornOut_Loop(struct ProcUnitTornOut * proc);
void StartUnitTornOut(struct Unit * unit, ProcPtr parent);

void nullsub_20(ProcPtr);
void WorldFlushInit(struct ProcWorldFlush * proc);
void WorldFlushOut(struct ProcWorldFlush * proc);
Expand Down
1 change: 1 addition & 0 deletions include/gbafe.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "constants/worldmap.h"
#include "constants/classes.h"
#include "constants/faces.h"
#include "constants/songs.h"
#include "constants/video-banim.h"
#include "constants/video-wm.h"
#include "constants/video-global.h"
Expand Down
6 changes: 3 additions & 3 deletions include/mapanim.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct MapAnimStarfxConf {
struct MapAnimActorState {
/* 00 */ struct Unit * unit;
/* 04 */ struct BattleUnit * bu;
/* 08 */ struct MUProc * mu;
/* 08 */ struct MuProc * mu;
/* 0C */ u8 hp_max;
/* 0D */ u8 hp_cur;
/* 0E */ u16 hp_displayed_q4;
Expand Down Expand Up @@ -821,8 +821,8 @@ void sub_8081348(void);
void sub_8081384(void);
void sub_80813C0(void);
void MapAnim_BeginSubjectFastAnim(void);
void MapAnimMoveUnitTowardsTargetExt(struct MUProc * mu1, struct MUProc * mu2);
void MapAnimMoveUnitAwayFromTargetExt(struct MUProc * mu1, struct MUProc * mu2);
void MapAnimMoveUnitTowardsTargetExt(struct MuProc * mu1, struct MuProc * mu2);
void MapAnimMoveUnitAwayFromTargetExt(struct MuProc * mu1, struct MuProc * mu2);
void MapAnim_MoveSubjectsTowardsTarget(void);
void MapAnim_MoveSubjectsAwayFromTarget(void);
void MapAnim_MoveCameraOnSubject(ProcPtr proc);
Expand Down
Loading

0 comments on commit 8812c95

Please sign in to comment.