Merge branch 'master' into tilemap-docs

This commit is contained in:
octorock
2023-12-31 02:12:41 +01:00
549 changed files with 15821 additions and 15437 deletions
+82 -82
View File
@@ -156,108 +156,108 @@ typedef enum {
/*0x66*/ ENEMY_66
} Enemy;
void Octorok(Entity*);
void Chuchu(Entity*);
void Leever(Entity*);
void Peahat(Entity*);
void Rollobite(Entity*);
void DarkNut(Entity*);
void HangingSeed(Entity*);
void Beetle(Entity*);
void Keese(Entity*);
void DoorMimic(Entity*);
void RockChuchu(Entity*);
void SpinyChuchu(Entity*);
void CuccoChickAggr(Entity*);
void Moldorm(Entity*);
void EnemyE(Entity*);
void Moldworm(Entity*);
void Sluggula(Entity*);
void Pesto(Entity*);
void Puffstool(Entity*);
void ChuchuBoss(Entity*);
void LikeLike(Entity*);
void SpearMoblin(Entity*);
void BusinessScrub(Entity*);
void RupeeLike(Entity*);
void Madderpillar(Entity*);
void WaterDrop(Entity*);
void WallMaster(Entity*);
void BombPeahat(Entity*);
void Spark(Entity*);
void Chaser(Entity*);
void SpikedBeetle(Entity*);
void SensorBladeTrap(Entity*);
void Helmasaur(Entity*);
void FallingBoulder(Entity*);
void Bobomb(Entity*);
void WallMaster2(Entity*);
void Octorok();
void Chuchu();
void Leever();
void Peahat();
void Rollobite();
void DarkNut();
void HangingSeed();
void Beetle();
void Keese();
void DoorMimic();
void RockChuchu();
void SpinyChuchu();
void CuccoChickAggr();
void Moldorm();
void EnemyE();
void Moldworm();
void Sluggula();
void Pesto();
void Puffstool();
void ChuchuBoss();
void LikeLike();
void SpearMoblin();
void BusinessScrub();
void RupeeLike();
void Madderpillar();
void WaterDrop();
void WallMaster();
void BombPeahat();
void Spark();
void Chaser();
void SpikedBeetle();
void SensorBladeTrap();
void Helmasaur();
void FallingBoulder();
void Bobomb();
void WallMaster2();
void Gleerok();
void VaatiEyesMacro(Entity*);
void Tektite(Entity*);
void VaatiEyesMacro();
void Tektite();
void WizzrobeWind();
void WizzrobeFire();
void WizzrobeIce();
void Armos();
void Eyegore();
void Rope(Entity*);
void SmallPesto(Entity*);
void AcroBandit(Entity*);
void BladeTrap(Entity*);
void Keaton(Entity*);
void Crow(Entity*);
void Rope();
void SmallPesto();
void AcroBandit();
void BladeTrap();
void Keaton();
void Crow();
void Mulldozer();
void Bombarossa(Entity*);
void Wisp(Entity*);
void SpinyBeetle(Entity*);
void MazaalHead(Entity*);
void MazaalMacro(Entity*);
void MazaalHand(Entity*);
void Bombarossa();
void Wisp();
void SpinyBeetle();
void MazaalHead();
void MazaalMacro();
void MazaalHand();
void OctorokBoss();
void FlyingPot(Entity*);
void Gibdo(Entity*);
void OctorokGolden(Entity*);
void TektiteGolden(Entity*);
void RopeGolden(Entity*);
void FlyingPot();
void Gibdo();
void OctorokGolden();
void TektiteGolden();
void RopeGolden();
void CloudPiranha();
void ScissorsBeetle(Entity*);
void CuccoAggr(Entity*);
void ScissorsBeetle();
void CuccoAggr();
void Stalfos();
void FlyingSkull(Entity*);
void MazaalBracelet(Entity*);
void Takkuri(Entity*);
void BowMoblin(Entity*);
void Lakitu(Entity*);
void LakituCloud(Entity*);
void TorchTrap(Entity*);
void VaatiRebornEnemy(Entity*);
void VaatiProjectile(Entity*);
void BallChainSoldier(Entity*);
void FlyingSkull();
void MazaalBracelet();
void Takkuri();
void BowMoblin();
void Lakitu();
void LakituCloud();
void TorchTrap();
void VaatiRebornEnemy();
void VaatiProjectile();
void BallChainSoldier();
void Enemy4D();
void Ghini();
void VaatiTransfigured(Entity*);
void VaatiTransfigured();
void Enemy50();
void VaatiWrath(Entity*);
void VaatiArm(Entity*);
void Dust(Entity*);
void VaatiBall(Entity*);
void Slime(Entity*);
void MiniSlime(Entity*);
void FireballGuy(Entity*);
void MiniFireballGuy(Entity*);
void VaatiTransfiguredEye(Entity*);
void BusinessScrubPrologue(Entity*);
void VaatiWrath();
void VaatiArm();
void Dust();
void VaatiBall();
void Slime();
void MiniSlime();
void FireballGuy();
void MiniFireballGuy();
void VaatiTransfiguredEye();
void BusinessScrubPrologue();
void GyorgFemale();
void GyorgMale();
void Curtain(Entity*);
void VaatiWrathEye(Entity*);
void Curtain();
void VaatiWrathEye();
void GyorgChild();
void GyorgFemaleEye();
void GyorgMaleEye();
void GyorgFemaleMouth();
void Enemy64();
void TreeItem(Entity*);
void Enemy66(Entity*);
void TreeItem();
void Enemy66();
extern void (*const gUnk_080012C8[])(Entity*);
+20
View File
@@ -0,0 +1,20 @@
#ifndef VAATIWRATH_H
#define VAATIWRATH_H
#include "enemy.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[5];
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unused2[10];
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u8 unused3[1];
/*0x7b*/ u8 unk_7b;
/*0x7c*/ u16 unk_7c;
/*0x7e*/ u16 unk_7e;
/*0x80*/ u8 unused4[4];
/*0x84*/ u8 unk_84;
} VaatiWrathEntity;
#endif // VAATIWRATH_H
+22 -17
View File
@@ -6,7 +6,9 @@
#include "color.h"
#include "sprite.h"
#define MAX_ENTITIES 71
#define MAX_ENTITIES 72
#define MAX_MANAGERS 32
#define MAX_AUX_PLAYER_ENTITIES 7
/** Kinds of Entity's supported by the game. */
typedef enum {
@@ -38,6 +40,8 @@ typedef enum {
typedef enum {
ENT_DID_INIT = 0x1, /**< Graphics and other data loaded. */
ENT_SCRIPTED = 0x2, /**< Execute in a scripted environment. */
ENT_UNUSED1 = 0x4, /**< Unused delete flag. */
ENT_UNUSED2 = 0x8, /**< Unused delete flag. */
ENT_DELETED = 0x10, /**< Queue deletion next frame. */
ENT_PERSIST = 0x20, /**< Persist between rooms. */
ENT_COLLIDE = 0x80, /**< Collide with other Entity's. */
@@ -216,9 +220,6 @@ typedef struct Entity_ {
/*0x62*/ u8 spriteOffsetX;
/*0x63*/ s8 spriteOffsetY;
/*0x64*/ void* myHeap; /**< Heap data allocated with #zMalloc. */
#ifndef NENT_DEPRECATED
GENERIC_ENTITY_FIELDS
#endif
} Entity;
typedef struct {
@@ -238,6 +239,15 @@ typedef struct LinkedList {
Entity* first;
} LinkedList;
/**
* LinkedList's which point to allocate Entities.
* These work together with Entity.prev and Entity.next fields
* to allow the iteration of all Entity's.
*/
extern LinkedList gEntityLists[9];
extern GenericEntity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES];
extern GenericEntity gEntities[MAX_ENTITIES];
typedef void(EntityAction)(Entity*);
typedef void (*EntityActionPtr)(Entity*);
typedef void (*const* EntityActionArray)(Entity*);
@@ -283,7 +293,7 @@ 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* CreateItemGetEntity(void);
Entity* CreateAuxPlayerEntity(void);
Entity* CreateFx(Entity* parent, u32 type, u32 type2);
/// @}
@@ -386,12 +396,15 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2);
* @param entity Entity to set the priority of.
* @param prio #Priority level.
*/
void SetDefaultPriority(Entity* entity, u32 prio);
void SetEntityPriority(Entity* entity, u32 prio);
/**
* Check if entity will be deleted next frame.
* Check if entity is disabled. Entities are disabled if:
* - They are deleted.
* - There is an event and the entity doesn't have priority
* (n/a if entity is in action 0).
*/
bool32 EntityIsDeleted(Entity* entity);
bool32 EntityDisabled(Entity* entity);
/**
* Check if system or entity is blocking updates.
@@ -477,18 +490,10 @@ void SetInitializationPriority(void);
/**
* Reset the system update priority.
*/
void ResetSystemPriority(void);
void ClearEventPriority(void);
void sub_0805E958(void);
/**
* LinkedList's which point to allocate Entities.
* These work together with Entity.prev and Entity.next fields
* to allow the iteration of all Entity's.
*/
extern LinkedList gEntityLists[9];
extern Entity gItemGetEntities[7];
typedef struct {
u8 unk_0;
u8 unk_1;
+1 -1
View File
@@ -76,7 +76,7 @@ extern void sub_08030118(u32);
extern void sub_0803C0AC(Entity*);
extern void SetRoomTrackerFlag(Entity*);
extern u32 sub_0804A024(Entity*, u32, u32);
extern u32 sub_080542AC(u32);
extern u32 IsMinishItem(u32);
extern void DisableRandomDrops();
extern void EnableRandomDrops(void);
extern s32 sub_08056338(void);
+1 -1
View File
@@ -197,7 +197,7 @@ typedef enum {
WORLD_EVENT_TYPE_8, // set a tile type
WORLD_EVENT_TYPE_9, // LoadRoomEntity and set some tile type
WORLD_EVENT_TYPE_BEANSTALK,
WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.field_0x8c
WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.entityRails
WORLD_EVENT_TYPE_12,
WORLD_EVENT_TYPE_13,
WORLD_EVENT_TYPE_14,
+3 -1
View File
@@ -5,8 +5,10 @@
#include "entity.h"
#include "structures.h"
#define MESSAGE_ACTIVE 0x7f
typedef struct {
u8 doTextBox;
u8 state;
u8 unk;
u8 textSpeed;
u8 unk3; // HI?
-26
View File
@@ -1,26 +0,0 @@
#ifndef NEW_PLAYER_H
#define NEW_PLAYER_H
#include "entity.h"
// TODO Use new player entity struct everywhere once it is fully discovered.
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u32 unk_68;
/*0x6c*/ u8 unk_6c;
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u32 unk_7c;
/*0x80*/ u8 unk_80[8];
} PlayerEntity;
#define gNewPlayerEntity (*(PlayerEntity*)&gPlayerEntity)
#endif // NEW_PLAYER_H
-3
View File
@@ -1,9 +1,6 @@
#ifndef DEATHFX_H
#define DEATHFX_H
#ifndef NENT_DEPRECATED
#error "deathFx.h requires new entities"
#endif
#include "entity.h"
typedef struct {
+13
View File
@@ -0,0 +1,13 @@
#ifndef HOUSESIGN_H
#define HOUSESIGN_H
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[24];
/*0x80*/ s16 unk_80;
/*0x82*/ s16 unk_82;
} HouseSignEntity;
#endif // HOUSESIGN_H
+13
View File
@@ -0,0 +1,13 @@
#ifndef ITEMFORSALE_H
#define ITEMFORSALE_H
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x18];
/*0x80*/ u16 unk_80;
/*0x82*/ u16 unk_82;
} ItemForSaleEntity;
#endif // ITEMFORSALE_H
+20
View File
@@ -0,0 +1,20 @@
#ifndef LINKANIMATION_H
#define LINKANIMATION_H
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 storeDrawFlags;
/*0x69*/ u8 storeFlags;
/*0x6a*/ u8 storeIFrames;
/*0x6b*/ u8 storeField7;
/*0x6c*/ u8 storeKeepFacing;
/*0x6d*/ u8 storeFieldA;
/*0x6e*/ u8 storeField27;
/*0x6f*/ u8 storeMobility;
/*0x70*/ u32 storeStateFlags;
/*0x74*/ u8 store8A;
} LinkAnimationEntity;
#endif // LINKANIMATION_H
+25
View File
@@ -0,0 +1,25 @@
#ifndef PUSHABLEFURNITURE_H
#define PUSHABLEFURNITURE_H
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 unk_74;
/*0x76*/ u16 unk_76;
/*0x78*/ u8 unk_78[0x2];
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u16 unk_7c;
/*0x7e*/ u16 unk_7e;
/*0x80*/ u8 unk_80;
/*0x81*/ u8 unk_81;
/*0x82*/ u8 unk_82;
/*0x83*/ u8 unk_83;
/*0x84*/ u8 unk_84[0x2];
/*0x86*/ u16 unk_86;
} PushableFurnitureEntity;
#endif // PUSHABLEFURNITURE_H
+36 -21
View File
@@ -4,6 +4,23 @@
#include "global.h"
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ union SplitWord unk_68;
/*0x6c*/ u8 unk_6c;
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ union SplitWord unk_7c;
/*0x80*/ union SplitWord unk_80;
/*0x84*/ union SplitWord unk_84;
} PlayerEntity;
enum PlayerActions {
PLAYER_INIT,
PLAYER_NORMAL,
@@ -244,29 +261,27 @@ typedef struct {
} PlayerMacroEntry ALIGNED(2);
typedef enum {
PLAYER_INPUT_1 = 0x1, // A
PLAYER_INPUT_2 = 0x2, // B
PLAYER_INPUT_8 = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
PLAYER_INPUT_10 = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
PLAYER_INPUT_20 = 0x20, // R sub_0807953C
PLAYER_INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
PLAYER_INPUT_80 =
INPUT_USE_ITEM1 = 0x1, // A
INPUT_USE_ITEM2 = 0x2, // B
INPUT_INTERACT = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
INPUT_CANCEL = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
INPUT_CONTEXT = 0x20, // R sub_0807953C
INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
INPUT_ACTION =
0x80, // R sub_08073584, IsPreventedFromUsingItem, sub_080782C0, CrenelBeanSprout_Action1, ItemForSale_Action2
PLAYER_INPUT_RIGHT = 0x100,
PLAYER_INPUT_LEFT = 0x200,
PLAYER_INPUT_UP = 0x400,
PLAYER_INPUT_DOWN = 0x800,
PLAYER_INPUT_ANY_DIRECTION = 0xf00,
PLAYER_INPUT_1000 = 0x1000, // L, where is it set? sub_080782C0
PLAYER_INPUT_8000 = 0x8000, // R, IsTryingToPickupObject, sub_08076518
// TODO What is the result of u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000;?
INPUT_RIGHT = 0x100,
INPUT_LEFT = 0x200,
INPUT_UP = 0x400,
INPUT_DOWN = 0x800,
INPUT_ANY_DIRECTION = 0xf00,
INPUT_FUSE = 0x1000, // L, where is it set? sub_080782C0
INPUT_LIFT_THROW = 0x8000, // R, IsTryingToPickupObject, sub_08076518
} PlayerInputState;
typedef struct {
/*0x0*/ u16 heldInput; /**< Input currently held @see PlayerInputState */
/*0x2*/ u16 newInput; /**< New input this frame @see PlayerInputState */
/*0x4*/ u32 field_0x94;
/*0x4*/ u32 unused;
/*0x8*/ u16 playerMacroWaiting;
/*0xa*/ u16 playerMacroHeldKeys;
/*0xc*/ PlayerMacroEntry* playerMacro;
@@ -536,7 +551,7 @@ typedef struct {
/*0x09*/ u8 _hasAllFigurines;
/*0x0a*/ u8 charm;
/*0x0b*/ u8 picolyteType;
/*0x0c*/ u8 itemButtons[2];
/*0x0c*/ u8 equipped[2];
/*0x0e*/ u8 bottles[4];
/*0x12*/ u8 effect;
/*0x13*/ u8 hasAllFigurines;
@@ -588,9 +603,9 @@ extern const u8 gQuiverSizes[];
extern Entity* gPlayerClones[];
extern PlayerState gPlayerState;
extern Entity gPlayerEntity;
extern PlayerEntity gPlayerEntity;
void DoPlayerAction(Entity*);
void DoPlayerAction(PlayerEntity*);
bool32 CheckInitPauseMenu(void);
void SetPlayerControl(PlayerControlMode mode);
void ResetActiveItems(void);
@@ -722,7 +737,7 @@ s32 AddInteractableObject(Entity*, u32, u32);
void RemoveInteractableObject(Entity*);
s32 GetInteractableObjectIndex();
void sub_08078AC0(u32, u32, u32);
void sub_08078B48(void);
void PausePlayer(void);
void sub_08078E84(Entity*, Entity*);
void sub_08078FB0(Entity*);
void sub_080792BC(s32, u32, u32);
+13
View File
@@ -0,0 +1,13 @@
#ifndef PLAYERITEMBOTTLE_H
#define PLAYERITEMBOTTLE_H
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 bottleIndex; /**< @see Item */
/*0x69*/ u8 unused[6];
/*0x6f*/ u8 bottleContent; /**< @see Item */
} PlayerItemBottleEntity;
#endif // PLAYERITEMBOTTLE_H
+13 -16
View File
@@ -61,29 +61,26 @@ typedef struct {
extern RoomControls gRoomControls;
typedef struct {
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 filler_0x1;
/* 0x00 */ bool8 didEnterScrolling;
/* 0x01 */ bool8 destructableManagerLoaded;
/* 0x02 */ bool8 randomDropsDisabled;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ u8 field_0x4;
/* 0x05 */ u8 filler1[1];
/* 0x03 */ bool8 remFlagUnused;
/* 0x04 */ u8 numKinstoneDrops;
/* 0x05 */ u8 numKinstoneDropsPrevFrame;
/* 0x06 */ u8 shopItemType;
/* 0x07 */ u8 shopItemType2;
/* 0x08 */ u8 field_0x8;
/* 0x08 */ u8 unused;
/* 0x09 */ u8 fight_bgm;
/* 0x0a */ u8 unk2;
/* 0x0b */ u8 filler2;
/* 0x0a */ u8 needHealthDrop;
/* 0x0c */ s16 lightLevel;
/* 0x0e */ u16 specialTileCount; // Number of previous values for special tiles stored in gMetaTilesForSpecialTiles
/* 0x10 */ u8 unk_10[4];
/* 0x14 */ u32 flags;
/* 0x18 */ u32 unk3;
/* 0x1c */ u8 filler4[44];
/* 0x0e */ u16 tileEntityCount; // Number of previous values for special tiles stored in gMetaTilesForSpecialTiles
/* 0x10 */ u8 graphicsGroups[4];
/* 0x14 */ u8 flags[52];
/* 0x48 */ Droptable currentAreaDroptable;
/* 0x68 */ u32 animFlags;
/* 0x6c */ void* field_0x6c[8];
/* 0x8c */ void* field_0x8c[8];
/* 0xac */ Entity* entities[8];
/* 0x6c */ void* properties[8];
/* 0x8c */ void* entityRails[8];
/* 0xac */ Entity* puzzleEntities[8];
} RoomVars;
static_assert(sizeof(RoomVars) == 0xCC);
extern RoomVars gRoomVars;
+2 -2
View File
@@ -205,8 +205,8 @@ extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS];
static_assert(sizeof(gActiveItems) == 0x70);
typedef struct {
u8 sys_priority; // system requested priority
u8 ent_priority; // entity requested priority
u8 event_priority; // system requested priority
u8 ent_priority; // entity requested priority
u8 queued_priority;
u8 queued_priority_reset;
Entity* requester;