Merge branch 'master' into asset-extraction

This commit is contained in:
octorock
2021-11-12 12:13:13 +01:00
parent b1e2175ffb
commit 9396484df6
340 changed files with 4576 additions and 6192 deletions
+3 -1
View File
@@ -23,7 +23,8 @@ typedef struct {
u8 unk1A;
u8 filler2[13];
u8 field_0x28;
u8 filler4[0x834];
u8 filler4[0x833];
void*** field_0x85c;
u32 musicIndex;
u32 pMusicIndex;
u8 filler5[0x20];
@@ -31,6 +32,7 @@ typedef struct {
u32 unk3;
u32 unk4;
} Area;
static_assert(sizeof(Area) == 0x894);
extern Area gArea;
+57 -50
View File
@@ -42,32 +42,29 @@ typedef struct {
typedef struct Entity {
/*0x00*/ struct Entity* prev;
/*0x04*/ struct Entity* next;
/*0x08*/ u8 kind; // was: type
/*0x09*/ u8 id; // was: subtype
/*0x0a*/ u8 type; // was: form
/*0x0b*/ u8 type2; // was: parameter
/*0x08*/ u8 kind;
/*0x09*/ u8 id;
/*0x0a*/ u8 type;
/*0x0b*/ u8 type2;
/*0x0c*/ u8 action;
/*0x0d*/ u8 subAction;
/*0x0e*/ u8 actionDelay;
/*0x0f*/ u8 field_0xf;
/*0x10*/ u8 flags;
/*0x11*/ u8 scriptedScene : 4;
/* */ u8 scriptedScene2 : 4;
/*0x11*/ u8 updateConditions : 4; // should we update this sprite during pause
/* */ u8 updateConditions2 : 4;
/*0x12*/ s16 spriteIndex;
/*0x14*/ u8 animationState;
/*0x15*/ u8 direction;
/*0x16*/ u8 field_0x16;
/*0x17*/ u8 field_0x17;
/*0x18*/ union {
/* */ u8 raw;
/* */ struct {
/* */ u32 draw : 2; // 1-2
/* */ u32 ss2 : 1; // 4
/* */ u32 ss3 : 1; // 8
/* */ u32 shadow : 2; //0x10-0x20
/* */ u32 flipX : 1; //0x40
/* */ u32 flipY : 1; //0x80
/* */ } PACKED b;
/*0x18*/ struct {
/* */ u32 draw : 2; // 1-2
/* */ u32 ss2 : 1; // 4
/* */ u32 ss3 : 1; // 8
/* */ u32 shadow : 2; //0x10-0x20
/* */ u32 flipX : 1; //0x40
/* */ u32 flipY : 1; //0x80
/* */ } PACKED spriteSettings;
/*0x19*/ struct {
/* */ u32 b0 : 2; // 1-2
@@ -91,7 +88,7 @@ typedef struct Entity {
/*0x1d*/ u8 field_0x1d;
/*0x1e*/ u8 frameIndex;
/*0x1f*/ u8 lastFrameIndex;
/*0x20*/ s32 hVelocity;
/*0x20*/ s32 zVelocity;
/*0x24*/ s16 speed;
/*0x26*/ u8 spriteAnimation[3];
/*0x29*/ struct {
@@ -102,7 +99,7 @@ typedef struct Entity {
/*0x2a*/ u16 collisions;
/*0x2c*/ union SplitWord x;
/*0x30*/ union SplitWord y;
/*0x34*/ union SplitWord height; // todo
/*0x34*/ union SplitWord z;
/*0x38*/ u8 collisionLayer;
/*0x39*/ s8 interactType;
/*0x3a*/ u8 field_0x3a;
@@ -110,29 +107,21 @@ typedef struct Entity {
/*0x3c*/ u8 field_0x3c;
/*0x3d*/ s8 iframes;
/*0x3e*/ u8 knockbackDirection;
/*0x3f*/ u8 damageType;
/*0x40*/ u8 field_0x40;
/*0x3f*/ u8 hitType; // behavior as a collision sender
/*0x40*/ u8 hurtType; // behavior as a collision reciever
/*0x41*/ u8 bitfield;
/*0x42*/ u8 knockbackDuration;
/*0x43*/ u8 field_0x43;
/*0x44*/ u8 field_0x44;
/*0x45*/ u8 currentHealth;
/*0x44*/ u8 damage;
/*0x45*/ u8 health;
/*0x46*/ u16 field_0x46;
/*0x48*/ Hitbox* hitbox;
/*0x4c*/ struct Entity* field_0x4c;
/*0x50*/ struct Entity* parent;
/*0x54*/ struct Entity* attachedEntity;
/*0x54*/ struct Entity* child;
/*0x58*/ u8 animIndex;
/*0x59*/ u8 frameDuration;
/*0x5a*/ union {
/* */ u8 all;
/* */ struct {
/* */ u8 f0 : 1;
/* */ u8 f1 : 5;
/* */ u8 f2 : 1; //0x40
/* */ u8 f3 : 1; //0x80
/* */ } PACKED b;
/* */ } PACKED frames;
/*0x5a*/ u8 frame;
/*0x5b*/ u8 frameSpriteSettings;
/*0x5c*/ Frame* animPtr;
/*0x60*/ u16 spriteVramOffset;
@@ -165,9 +154,20 @@ extern LinkedList gUnk_03003D90;
extern LinkedList gUnk_03003DA0;
enum {
ENT_DID_INIT = 0x1,
ENT_SCRIPTED = 0x2,
ENT_ASLEEP = 0x10,
ENT_20 = 0x20,
ENT_COLLIDE = 0x80,
};
#define COLLISION_OFF(entity) ((entity)->flags &= ~ENT_COLLIDE)
#define COLLISION_ON(entity) ((entity)->flags |= ENT_COLLIDE)
#define TILE(x, y) \
(((((x) - gRoomControls.roomOriginX) >> 4) & 0x3fU) | \
((((y) - gRoomControls.roomOriginY) >> 4) & 0x3fU) << 6)
(((((x) - gRoomControls.roomOriginX) >> 4) & 0x3F) | \
((((y) - gRoomControls.roomOriginY) >> 4) & 0x3F) << 6)
#define COORD_TO_TILE(entity) \
TILE((entity)->x.HALF.HI, (entity)->y.HALF.HI)
@@ -186,9 +186,10 @@ enum {
#define DirectionRoundUp(expr) DirectionRound((expr) + 4)
#define DirectionIsHorizontal(expr) ((expr) & 0x08)
#define DirectionIsVertical(expr) ((expr) & 0x10)
#define DirectionTurnAround(expr) (DirectionRoundUp(expr) ^ 0x10)
#define DirectionTurnAround(expr) ((expr) ^ 0x10)
#define DirectionToAnimationState(expr) (DirectionRoundUp(expr) >> 3)
#define DirectionFromAnimationState(expr) ((expr) << 3)
#define DirectionNormalize(expr) ((expr) & 0x1f)
#define Direction8Round(expr) ((expr) & 0x1c)
#define Direction8RoundUp(expr) Direction8Round((expr) + 2)
@@ -197,23 +198,29 @@ enum {
#define Direction8FromAnimationState(expr) (((expr) << 2)
Entity* GetEmptyEntity(void);
extern Entity* CreateEnemy(u32 id, u32 type);
extern Entity* CreateNPC(u32 id, u32 type, u32 type2);
extern Entity* CreateObject(u32 id, u32 type, u32 type2);
extern Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2);
extern Entity* CreateFx(Entity* parent, u32 type, u32 type2);
void DrawEntity(Entity*);
Entity* CreateEnemy(u32 id, u32 type);
Entity* CreateNPC(u32 id, u32 type, u32 type2);
Entity* CreateObject(u32 id, u32 type, u32 type2);
Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2);
Entity* CreateFx(Entity* parent, u32 type, u32 type2);
extern void InitializeAnimation(Entity*, u32);
extern void InitAnimationForceUpdate(Entity*, u32);
extern void UpdateAnimationSingleFrame(Entity*);
extern void UpdateSpriteForCollisionLayer(Entity*);
extern void GetNextFrame(Entity*);
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void SetExtraSpriteFrame(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData1(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
void InitializeAnimation(Entity*, u32);
void InitAnimationForceUpdate(Entity*, u32);
void UpdateAnimationSingleFrame(Entity*);
void UpdateSpriteForCollisionLayer(Entity*);
void GetNextFrame(Entity*);
u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
void SetExtraSpriteFrame(Entity*, u32, u32);
void SetSpriteSubEntryOffsetData1(Entity*, u32, u32);
void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern u32 GetFacingDirection(Entity*, Entity*);
u32 GetFacingDirection(Entity*, Entity*);
/**
* @brief Check if entity should sleep this frame.
*/
bool32 CheckDontUpdate(Entity* this);
/**
* @brief Delete the entity currently in execution.
+1 -1
View File
@@ -105,7 +105,7 @@ extern void sub_0807AA80(Entity*);
extern s32 sub_0807887C(Entity*, u32, u32);
extern s32 sub_08078904();
extern void sub_0805E5A8(void);
extern void sub_0805E5C0(void);
extern void UpdateEntities(void);
extern void sub_080AD9B0(void);
extern void sub_080AD918(void);
extern void sub_0801E104(void);
+2
View File
@@ -173,6 +173,8 @@ typedef struct MusicPlayer {
extern const MusicPlayer gMusicPlayers[];
extern const Song gSongTable[];
void m4aSoundMain(void);
void m4aSoundVSync(void);
void m4aSoundInit(void);
void m4aSongNumStart(u16 n);
void m4aSongNumStartOrContinue(u16 n);
+1 -1
View File
@@ -96,7 +96,7 @@ extern void sub_0804FF84(u32);
extern u16 gPaletteBuffer[];
extern void VBlankInterruptWait(void);
extern void DisableInterruptsAndDMA(void);
extern void sub_08016B34(void);
extern void EnableVBlankIntr(void);
static void sub_08055F70(void);
static bool32 SoftResetKeysPressed(void);
+1 -1
View File
@@ -12,7 +12,7 @@ union SplitSHWord {
} PACKED;
typedef struct Manager {
/*0x00*/ struct Manager* previous;
/*0x00*/ struct Manager* prev;
/*0x00*/ struct Manager* next;
/*0x08*/ u8 type;
/*0x09*/ u8 subtype;
+5 -1
View File
@@ -92,7 +92,7 @@ typedef struct {
/* */ u8 swordBlueParticle : 1;
/* */ u8 filler14 : 6;
/*0x3f*/ u8 field_0x3f;
/*0x40*/ u8 field_0x40[64];
/*0x40*/ u8 hurtType[64];
/*0x80*/ u16 field_0x80;
/*0x82*/ u8 field_0x82[9];
/*0x8b*/ u8 field_0x8b;
@@ -161,6 +161,10 @@ extern Entity gPlayerEntity;
extern u32 GetInventoryValue(u32);
extern s32 ModHealth(s32);
extern void ModRupees(s32);
#define COPY_FLAG_FROM_TO(base, src, dest) (base) = ((base) & ~(dest)) | (((dest) * ((base) & (src))) / src)
#endif
// clang-format on
+3 -10
View File
@@ -60,20 +60,13 @@ typedef struct {
u8 filler4[48];
u8 filler5[28];
u32 greatFairyState;
u32* field_0x6c;
u32* field_0x70;
u32* field_0x74;
u32 field_0x78;
u8 field_0x79[10];
void* field_0x88;
void* field_0x6c[8];
} RoomVars;
// Packets used to store which entities to load in a room
typedef struct {
u8 kind : 4;
u8 layer : 4;
u8 flags : 4;
u8 unk : 4;
u8 kind;
u8 flags;
u8 id;
u8 type;
u32 type2;
+14 -22
View File
@@ -11,29 +11,19 @@ typedef struct {
} LcdControls;
typedef struct {
u16 bg0Control;
u16 bg0xOffset;
u16 bg0yOffset;
u16 bg0Updated;
void* bg0Tilemap;
u16 bg1Control;
u16 bg1xOffset;
u16 bg1yOffset;
u16 bg1Updated;
void* bg1Tilemap;
u16 control;
u16 xOffset;
u16 yOffset;
u16 updated;
void* tilemap;
} BgSettings;
typedef struct {
u16 bg2Control;
u16 bg2xOffset;
u16 bg2yOffset;
u16 bg2Updated;
void* bg2Tilemap;
u16 bg3Control;
s16 bg3xOffset;
s16 bg3yOffset;
u16 bg3Updated;
void* bg3Tilemap;
u16 control;
s16 xOffset;
s16 yOffset;
u16 updated;
void* tilemap;
} BgAffSettings;
typedef struct {
@@ -67,8 +57,10 @@ typedef struct {
typedef struct {
/*0x00*/ LcdControls lcd;
/*0x08*/ BgSettings bg;
/*0x20*/ BgAffSettings affine;
/*0x08*/ BgSettings bg0;
/*0x14*/ BgSettings bg1;
/*0x20*/ BgAffSettings bg2;
/*0x2c*/ BgAffSettings bg3;
/*0x38*/ BgControls controls;
/*0x6c*/ u8 _6c;
/*0x6d*/ u8 _6d;
+2 -5
View File
@@ -61,7 +61,7 @@ typedef struct {
u8 field_0x3c;
u8 field_0x3d;
u16 field_0x3e;
u16 field_0x40;
u16 hurtType;
u16 field_0x42;
u16 field_0x44;
u16 field_0x46;
@@ -171,10 +171,7 @@ typedef struct {
u8 unk1;
u8 unk2;
u8 unk3;
u8 freezeTime;
u8 unk9;
u8 unk_0xa;
u8 unk_0xb;
Entity* unk4;
u16 unk_0xc;
} EntityHandler;