Merge branch 'master' into tilemap-docs

This commit is contained in:
octorock
2024-01-06 12:26:39 +01:00
226 changed files with 2058 additions and 1984 deletions
+12 -2
View File
@@ -21,11 +21,21 @@ extern void GenericKnockback(struct Entity_*);
extern u32 GetFuserId(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity);
enum {
BOUNCE_DONE_ALL,
BOUNCE_INIT_NEXT,
BOUNCE_AIRBORNE,
};
u32 BounceUpdate(struct Entity_*, u32 acceleration);
extern u32 CheckOnScreen(struct Entity_*);
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*);
extern void sub_08004484(struct Entity_*, struct Entity_*);
extern u32 GetTileHazardType(struct Entity_*);
/**
* Basic collision, only used between player and dazed enemies.
* (Probablity leftover from Four Swords)
*/
extern void CalcCollisionStaticEntity(struct Entity_*, struct Entity_*);
extern void ResetCollisionLayer(struct Entity_*);
extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, u32);
+10
View File
@@ -6,6 +6,16 @@
/** Collisions. */
enum {
COL_LANTERN = 0x7,
COL_SMALL_GUST = 0x13,
COL_BOOMERANG = 0x14,
COL_ARROW = 0x15,
COL_BIG_GUST = 0x1b,
COL_PACCI = 0x1d,
COL_SWORD_BEAM = 0x21,
};
typedef enum {
COL_NONE = 0x0,
COL_NORTH_WEST = 0x2,
+2 -2
View File
@@ -11,9 +11,9 @@ struct Entity_;
typedef struct {
u16 heldKeys; /**< Keys held since last frame. */
u16 newKeys; /** Keys newly pressed this frame. */
u16 unk4;
u16 menuScrollKeys;
u8 unk6;
u8 unk7;
u8 menuScrollTimer;
} Input;
extern Input gInput; /**< Input instance. */
+2 -2
View File
@@ -22,7 +22,7 @@ typedef struct EnemyDefinition {
u8 health;
s16 speed;
u8 damageType;
u8 flags2;
u8 collisionMask;
} EnemyDefinition;
typedef struct ProjectileDefinition {
@@ -43,7 +43,7 @@ typedef struct ProjectileDefinition {
u8 field0x40;
s16 speed;
u8 damageType;
u8 flags2;
u8 collisionMask;
} ProjectileDefinition;
// Sprite data definition for objects and npcs
+38 -11
View File
@@ -12,7 +12,35 @@
#include "entity.h"
#include "projectile.h"
bool32 EnemyInit(Entity* this);
#define EM_FLAG_BOSS (1 << 0)
#define EM_FLAG_BOSS_KILLED (1 << 1)
#define EM_FLAG_HAS_HOME (1 << 2)
#define EM_FLAG_NO_DEATH_FX (1 << 3)
#define EM_FLAG_SUPPORT (1 << 4)
#define EM_FLAG_CAPTAIN (1 << 5)
#define EM_FLAG_MONITORED (1 << 6)
typedef struct {
Entity base;
Entity* child;
u8 idx;
u8 enemyFlags;
u8 rangeX;
u8 rangeY;
s16 homeX;
s16 homeY;
/*0x74*/ union SplitHWord field_0x74;
/*0x76*/ union SplitHWord field_0x76;
/*0x78*/ union SplitHWord field_0x78;
/*0x7a*/ union SplitHWord field_0x7a;
/*0x7c*/ union SplitWord field_0x7c;
/*0x80*/ union SplitHWord field_0x80;
/*0x82*/ union SplitHWord field_0x82;
/*0x84*/ union SplitHWord cutsceneBeh;
/*0x86*/ union SplitHWord field_0x86;
} Enemy;
bool32 EnemyInit(Enemy* this);
/**
* 0: _OnTick
* 1: _OnCollision
@@ -25,16 +53,15 @@ u32 GetNextFunction(Entity*);
void EnemyFunctionHandler(Entity*, EntityActionArray);
void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])());
void GenericKnockback(Entity*);
Entity* CreateDeathFx(Entity*, u32, u32);
void EnemyCreateDeathFX(Enemy*, u32, u32);
void sub_0804A720(Entity*);
bool32 sub_08049FDC(Entity*, u32);
Entity* Create0x68FX(Entity*, u32);
void SetChildOffset(Entity*, s32, s32, s32);
Entity* CreateProjectileWithParent(Entity*, u8, u8);
Entity* EnemyCreateFX(Entity*, u32);
void EnemySetFXOffset(Entity*, s32, s32, s32);
Entity* EnemyCreateProjectile(Entity*, u32, u32);
void GenericDeath(Entity*);
void sub_08002724(void*, u8*);
void sub_080026C4(u8*, u8*, u8*, u32);
void sub_080026F2(u8*, void*, u8*, u32);
bool32 sub_08049FA0(Entity*);
@@ -43,14 +70,14 @@ bool32 sub_08049F84(Entity*, s32);
Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
s32 sub_080012DC(Entity*);
u32 sub_080044EC(Entity*, u32);
void sub_0804AA1C(Entity*);
void EnemyDetachFX(Entity*);
bool32 sub_08049F1C(Entity*, Entity*, s32);
bool32 PlayerInRange(Entity*, u32, s32);
void sub_0804A4E4(Entity*, Entity*);
void EnemyCopyParams(Entity*, Entity*);
void GenericKnockback2(Entity*);
typedef enum {
enum {
/*0x00*/ OCTOROK,
/*0x01*/ CHUCHU,
/*0x02*/ LEEVER,
@@ -154,7 +181,7 @@ typedef enum {
/*0x64*/ ENEMY_64,
/*0x65*/ TREE_ITEM,
/*0x66*/ ENEMY_66
} Enemy;
};
void Octorok();
void Chuchu();
+37 -3
View File
@@ -79,6 +79,40 @@ typedef enum {
DirectionNorthWest = 0x1c, /**< North West. */
} Direction;
/** Collision layer flags. */
typedef enum {
COL_LAYER_NONE = 0x0,
COL_LAYER_BOTTOM = 0x1,
COL_LAYER_TOP = 0x2,
COL_LAYER_BOTH = 0x3
} CollisionLayer;
/**
* Collision class flags.
* An Entity's collision class is determined by the first 3 bits of #Entity::collisionFlags.
* What classes an Entity collides with is determined by the bitfield #Entity::collisionMask.
*/
typedef enum {
COL_CLASS_NONE = 0x0,
COL_CLASS_PLAYER = 0x1,
COL_CLASS_ITEM = 0x2,
COL_CLASS_FLAMMABLE = 0x3,
COL_CLASS_4 = 0x4,
COL_CLASS_5 = 0x5,
COL_CLASS_6 = 0x6,
COL_CLASS_PACCI_OBJ = 0x7,
} CollisionClass;
/** Collision flags. */
typedef enum {
COL_FLAG_3D = 0x10,
COL_FLAG_SOLID = 0x20,
COL_FLAG_REFLECT = 0x80,
} CollisionFlags;
#define COLLISION_MASK(layer) (1 << (layer))
#define CONTACT_NOW 0x80
typedef struct {
void* entity1;
void* entity2;
@@ -192,11 +226,11 @@ typedef struct Entity_ {
/*0x2c*/ union SplitWord x; /**< X position, fixed point Q16.16. */
/*0x30*/ union SplitWord y; /**< Y position, fixed point Q16.16. */
/*0x34*/ union SplitWord z; /**< Z position, fixed point Q16.16. */
/*0x38*/ u8 collisionLayer; /**< Collision layer. */
/*0x38*/ u8 collisionLayer; /**< @see CollisionLayer. */
/*0x39*/ s8 interactType;
/*0x3a*/ u8 gustJarState; /**< 4: grabbed by GustJar */
/*0x3b*/ u8 flags2; /**< Debug visualization related? */
/*0x3c*/ u8 collisionFlags; /**< Controls collision modes. */
/*0x3b*/ u8 collisionMask; /**< Bitfield. @see CollisionClass */
/*0x3c*/ u8 collisionFlags; /**< @see CollisionFlags, @see CollisionClass */
/*0x3d*/ s8 iframes; /**< Invulnerability frames. */
/*0x3e*/ u8 knockbackDirection; /**< Direction of knockback. */
/*0x3f*/ u8 hitType; /**< Behavior as a collision sender. */
+9 -9
View File
@@ -14,10 +14,10 @@
// Identified - to be sorted into header files
extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
extern void CopyOAM(void);
extern void CreateChestSpawner(Entity*);
extern void CreateLavaDrownFX(Entity*);
extern Entity* CreateGroundItem(Entity*, u32, u32);
extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32);
extern void CreateItemOnGround(Entity*);
extern void CreatePitFallFX(Entity*);
extern void CreateMagicSparkles(u32, u32, u32);
extern void CreateMinishEntrance(u32 tile);
extern u32 CreateRandomItemDrop(Entity*, u32);
@@ -50,31 +50,31 @@ extern void SetBGDefaults(void);
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
extern void sub_080027EA(Entity*, u32, u32);
extern void LinearMoveDirectionOLD(Entity*, u32, u32);
extern void sub_080028E0(Entity*);
extern u32 sub_080040A2(Entity*);
extern u32 sub_080040D8(Entity*, u8*, s32, s32);
extern void sub_08004168(Entity*);
extern void SnapToTile(Entity*);
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
extern void sub_080042BA(Entity*, u32);
extern void sub_080042D0(Entity*, u32, u16);
extern void sub_080043A8(Entity*);
extern void CreateDrownFX(Entity*);
extern u32 sub_0800445C(Entity*);
extern void sub_080044AE(Entity*, u32, u32);
extern u32 sub_080044EC(Entity*, u32);
extern u32 BounceUpdate(Entity*, u32);
extern void sub_0800451C(Entity*);
extern void sub_08004542(Entity*);
extern void sub_080085B0(Entity*);
extern u16* sub_08008796(Entity*, u32, u32, u32);
extern void sub_08016AD2(Entity*);
extern u16* DoTileInteraction(Entity*, u32, u32, u32);
extern void UpdateCollisionLayer(Entity*);
extern u32 sub_0801766C(Entity*);
extern void sub_0801AFE4(void);
extern void UpdateUIElements(void);
extern void sub_0801E104(void);
extern void sub_08030118(u32);
extern void sub_0803C0AC(Entity*);
extern void SetRoomTrackerFlag(Entity*);
extern void EnemyDisableRespawn(Entity*);
extern u32 sub_0804A024(Entity*, u32, u32);
extern u32 IsMinishItem(u32);
extern void DisableRandomDrops();
+1 -1
View File
@@ -19,7 +19,7 @@ typedef struct {
/*0x0004*/ u16 mapData[0x40 * 0x40];
/**< MetaTileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
/*0x2004*/ u8 collisionData[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
/*0x3004*/ u16 mapDataClone[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
/*0x3004*/ u16 mapDataOriginal[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
// Tileset
/*0x5004*/ u16 metatileTypes[0x800];
/**< Maps from the MetaTileIndex to the MetaTileType. */ // gMetatileTypesTop, gMetatileTypesBottom
+5 -5
View File
@@ -18,11 +18,11 @@ typedef struct {
u8 textWindowPosY;
u16 textIndex;
u16 unk2; // HI?
u32 field_0xc;
u32 rupees;
u32 field_0x14;
u32 field_0x18;
u32 field_0x1c;
u32 flags;
u32 rupees; // item price, shells, minigame timer
u32 field_0x14; // number of cuccos
u32 field_0x18; // unused
u32 field_0x1c; // unused
} Message;
extern Message gMessage;
+24 -6
View File
@@ -11,8 +11,8 @@ typedef struct {
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x70*/ Entity* pulledJarEntity;
/*0x74*/ Entity* carriedEntity;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
@@ -299,6 +299,24 @@ typedef enum {
SWORD_MOVE_LOW_BEAM,
} SwordMove;
typedef enum {
PL_JAR_NONE = 0x0,
PL_JAR_SUCK = 0x1,
PL_JAR_2 = 0x2,
PL_JAR_3 = 0x3,
PL_JAR_BLAST_INIT = 0x4,
PL_JAR_BLAST_UPDATE = 0x5,
PL_JAR_BLAST_DONE = 0x6,
PL_JAR_ENT_ATTACHED = 0x7,
} GustJarState;
typedef enum {
JAR_CHARGE_NONE = 0,
JAR_CHARGE_SMALL = 1,
JAR_CHARGE_MID = 2,
JAR_CHARGE_BIG = 3,
} GustJarCharge;
typedef enum {
ANIM_DEFAULT = 0x100,
ANIM_WALK = 0x104,
@@ -493,8 +511,8 @@ typedef struct {
/*0x18*/ u16 startPosY;
/*0x1a*/ u8 mobility;
/*0x1b*/ u8 sword_state;
/*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 gustJarSpeed;
/*0x1c*/ u8 gustJarState;
/*0x1d*/ u8 gustJarCharge;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[2];
/*0x21*/ u8 bow_state;
@@ -512,7 +530,7 @@ typedef struct {
/*0x39*/ u8 field_0x39;
/*0x3a*/ u8 field_0x3a;
/*0x3b*/ u8 field_0x3b;
/*0x3c*/ u8 field_0x3c;
/*0x3c*/ u8 killed; /**< Non-zero if player is dead */
/*0x3d*/ u8 moleMittsState;
/*0x3e*/ u8 swordDamage : 2;
/* */ u8 filler14 : 6;
@@ -762,7 +780,7 @@ void PlayerShrinkByRay(void);
// player.s
extern u32 PlayerCheckNEastTile();
extern u32* sub_08008790(Entity*, u32);
extern u32* DoTileInteractionHere(Entity*, u32);
extern void UpdateIcePlayerVelocity(Entity*);
extern void sub_08008AC6(Entity*);
extern void sub_08008926(Entity*);
+2 -2
View File
@@ -89,11 +89,11 @@ typedef struct {
u8 area;
u8 room;
u16 unk_02;
u32 flags; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in
u32 enemyBits; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in
the discovered state?)*/
} RoomMemory;
extern RoomMemory* gRoomMemoryPtr;
extern RoomMemory* gCurrentRoomMemory;
extern RoomMemory gRoomMemory[];
// Packets used to store which entities to load in a room
+15 -14
View File
@@ -1,6 +1,7 @@
#ifndef TILES_H
#define TILES_H
typedef enum {
META_TILE_TYPE_0, // 0x0
META_TILE_TYPE_1, // 0x1
@@ -1558,22 +1559,22 @@ typedef enum {
} SpecialMetaTile;
typedef enum {
VVV_0 = 0,
VVV_1 = 1,
VVV_2 = 2,
VVV_3 = 3,
VVV_4 = 4,
VVV_5 = 5,
VVV_6 = 6,
VVV_7 = 7,
VVV_8 = 8, // -> SURFACE_7
VVV_9 = 9, // sub_0801FDE4(leever)
VVV_10 = 10, // sub_0801FDE4(leever), sub_08025AB8(puffstool)
VVV_0 = 0, // TILE_ACT_CUT
VVV_1 = 1, // TILE_ACT_ROCKBREAKER
VVV_2 = 2, // TILE_ACT_BOOMERANG
VVV_3 = 3, // TILE_ACT_BOMB
VVV_4 = 4, // TILE_ACT_ARROW
VVV_5 = 5, // TILE_ACT_GUST
VVV_6 = 6, // TILE_ACT_LIFT
VVV_7 = 7, // TILE_ACT_FIRE
VVV_8 = 8, // TILE_ACT_PLAYER_WALK -> SURFACE_7
VVV_9 = 9, // TILE_ACT_ENEMY_WALK sub_0801FDE4(leever)
VVV_10 = 10, // TILE_ACT_PACCI sub_0801FDE4(leever), sub_08025AB8(puffstool)
VVV_11 = 11, // sub_0801FDE4(leever)
VVV_12 = 12, // sub_0801FDE4(leever)
VVV_13 = 13, // -> SURFACE_PIT, sub_08094E30(cutsceneMiscObject), sub_08085B40(lilypadLarge), Pot_Action1,
VVV_12 = 12, // TILE_ACT_SWORDBEAM sub_0801FDE4(leever)
VVV_13 = 13, // TILE_ACT_DIG -> SURFACE_PIT, sub_08094E30(cutsceneMiscObject), sub_08085B40(lilypadLarge), Pot_Action1,
// sub_080AD040(playerItemHeldObject), UpdatePlayerCollision, sub_0807B434(playerUtils), FX_FALL_DOWN
VVV_14 = 14, // -> SURFACE_SLOPE_GNDWATER
VVV_14 = 14, // TILE_ACT_MINIGUST -> SURFACE_SLOPE_GNDWATER
VVV_15 = 15, // -> SURFACE_SHALLOW_WATER, SPECIAL_META_TILE_145
VVV_16 = 16, // -> SURFACE_WATER, sub_0801FBD0(chuchu), PlayerItemBottle_UseEmptyBottle, SPECIAL_META_TILE_137 -
// 140, sub_080AD040(playerItemHeldObject), FX_WATER_SPLASH