z_en_item00 (#78)

* z_en_item00 WIP 17/21 match, rest close to matching

* Split .rodata for z_en_item00

* Item00 documentation, some misc cleanup

* Minor cleanup

* Fixup for z_collision_check

* Address feedback

* Delete old file

* Fix bad merge
This commit is contained in:
Rozelette
2021-03-27 19:55:42 -05:00
committed by GitHub
parent 623b6d5318
commit b22e26dbd8
18 changed files with 1425 additions and 1367 deletions
+27 -27
View File
@@ -509,27 +509,27 @@ void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt);
void EnAObj_Update2(ActorEnAObj* this, GlobalContext* ctxt);
void EnAObj_Update(ActorEnAObj* this, GlobalContext* ctxt);
void EnAObj_Draw(ActorEnAObj* this, GlobalContext* ctxt);
void EnItem00_UpdateForNewObjectId(ActorEnItem00* this, GlobalContext* ctxt, f32* puParm3, f32* pfParm4);
void EnItem00_Init(ActorEnItem00* this, GlobalContext* ctxt);
void EnItem00_Destroy(ActorEnItem00* this, GlobalContext* ctxt);
void func_800A63A8(ActorEnItem00* this, GlobalContext* ctxt);
void func_800A640C(ActorEnItem00* this);
// void func_800A6650(void);
// void func_800A6780(void);
void EnItem00_Update1(ActorEnItem00* this, GlobalContext* ctxt);
void EnItem00_Update(ActorEnItem00* this, GlobalContext* ctxt);
void EnItem00_Draw(ActorEnItem00* this, GlobalContext* ctxt);
void EnItem00_DrawRupee(ActorEnItem00* this, GlobalContext* ctxt);
void EnItem00_DrawSprite(ActorEnItem00* actor, GlobalContext* ctxt);
void EnItem00_DrawHeartContainer(ActorEnItem00* actor, GlobalContext* ctxt);
// void EnItem00_DrawHeartPiece(void);
// void func_800A7650(void);
void func_800A7730(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params);
// void func_800A7AD4(void);
// void func_800A7D28(void);
s32 func_800A8150(s32 params);
// void func_800A817C(void);
// void func_800A81A4(void);
// void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale);
// void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
// void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
// void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx);
// void func_800A640C(EnItem00* this, GlobalContext* globalCtx);
// void func_800A6650(EnItem00* this, GlobalContext* globalCtx);
// void func_800A6780(EnItem00* this, GlobalContext* globalCtx);
// void func_800A6A40(EnItem00* this, GlobalContext* globalCtx);
// void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx);
// void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx);
// void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx);
// void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx);
// void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx);
// void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx);
// s16 func_800A7650(s16 dropId);
EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params);
Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params);
void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params);
s32 func_800A8150(s32 index);
s32 func_800A817C(s32 index);
s32 func_800A81A4(GlobalContext* globalCtx, s32 a1, s32 a2);
void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2);
// void func_800A8514(void);
void EffectBlure_Initcommon(EffectBlure* params);
@@ -786,7 +786,7 @@ void func_800B78B8(GlobalContext* ctxt, Actor* actor, f32 uParm3, f32 uParm4, f3
s32 func_800B7FE0(f32* param_1, f32* param_2, f32* param_3, GraphicsContext* gCtxt);
// void func_800B8018(void);
void func_800B8050(Actor* actor, GlobalContext* ctxt, s32 iParm3);
// void func_800B8118(void);
void func_800B8118(Actor* actor, GlobalContext* ctxt, s32 iParm3);
// void func_800B81E0(void);
UNK_PTR func_800B8214(PosRot* param_1, Actor* param_2);
f32* func_800B8248(PosRot* param_1, ActorPlayer* param_2);
@@ -809,7 +809,7 @@ s32 func_800B8708(GlobalContext* ctxt);
void func_800B8898(GlobalContext* ctxt, Actor* actor, UNK_PTR param_3, UNK_PTR param_4);
// void func_800B8934(void);
u32 Actor_HasParent(Actor* actor, GlobalContext* ctxt);
// UNK_TYPE4 func_800B8A1C(Actor* actor, GlobalContext* ctxt, s32 iParm3, f32 fParm4, f32 param_5);
UNK_TYPE4 func_800B8A1C(Actor* actor, GlobalContext* ctxt, s32 iParm3, f32 fParm4, f32 param_5);
// void func_800B8B84(void);
// void func_800B8BB0(void);
// void func_800B8BD0(void);
@@ -1601,7 +1601,7 @@ void func_800EE0CC(Actor* actor, GlobalContext* ctxt, s32 iParm3);
u32 func_800EE200(GlobalContext* ctxt, u32 uParm2);
u32 func_800EE29C(GlobalContext* ctxt, u32 uParm2);
u32 func_800EE2F4(GlobalContext* ctxt);
void func_800EE320(GlobalContext* ctxt, s16 index);
void GetItem_Draw(GlobalContext* ctxt, s16 index);
void func_800EE364(GlobalContext* ctxt, s16 index);
void func_800EE400(GlobalContext* ctxt, s16 index);
void func_800EE5FC(GlobalContext* ctxt, s16 index);
@@ -2130,7 +2130,7 @@ void Interface_ChangeAlpha(u16 param_1);
// void func_80112B40(void);
// void func_80112BE4(void);
// void func_80112C0C(void);
u32 func_80112E80(GlobalContext* ctxt, u8 param_2);
u32 Item_Give(GlobalContext* ctxt, u8 param_2);
// void func_801143CC(void);
// void func_80114978(void);
// void func_801149A0(void);
@@ -2148,7 +2148,7 @@ u32 func_80112E80(GlobalContext* ctxt, u8 param_2);
// void func_801155B4(void);
// void func_80115764(void);
void func_80115844(GlobalContext* ctxt, s16 param_2);
// void func_80115908(void);
void func_80115908(GlobalContext* ctxt, u8 param_2);
void func_801159c0(s16 param_1);
// void func_801159EC(void);
// void func_80115A14(void);
@@ -3000,7 +3000,7 @@ void func_80165438(UNK_PTR param_1);
// void func_80165E7C(void);
// void func_80165EC0(void);
// void func_80166060(void);
// void func_801660B8(GlobalContext* ctxt, UNK_TYPE4 param_2);
UNK_TYPE4 func_801660B8(GlobalContext* ctxt, UNK_TYPE4 param_2);
void Play_Fini(GlobalContext* ctxt);
// void func_801663C4(void);
// void func_80166644(void);
+5
View File
@@ -26,6 +26,11 @@
#define PLAYER ((ActorPlayer*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first)
// linkAge still exists in MM, but is always set to 0 (always adult)
// There are remnants of these macros from OOT, but they are essentially useless
//#define LINK_IS_CHILD (gSaveContext.perm.linkAge != 0)
#define LINK_IS_ADULT (gSaveContext.perm.linkAge == 0)
#define SQ(x) ((x)*(x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
+30 -24
View File
@@ -3,13 +3,37 @@
#include <z64.h>
extern Gfx D_04029CB0[]; // D_04029CB0
extern Gfx D_04029CF0[]; // D_04029CF0
extern Gfx D_040008D0[];
extern Gfx D_04029CB0[];
extern Gfx D_04029CF0[];
extern Gfx D_0405AAB0[];
extern UNK_TYPE D_0405BEF0;
extern UNK_TYPE D_0405B6F0;
extern UNK_TYPE D_0405C6F0;
extern UNK_TYPE D_0405CEF0;
extern UNK_TYPE D_0405E6F0;
extern Gfx D_0405F6F0[];
extern UNK_TYPE D_0405F7C0;
extern UNK_TYPE D_0405FFC0;
extern UNK_TYPE D_040607C0;
extern UNK_TYPE D_04060FC0;
extern UNK_TYPE D_040617C0;
extern UNK_TYPE D_04061FC0;
extern UNK_TYPE D_04061FE0;
extern UNK_TYPE D_04062000;
extern UNK_TYPE D_04062020;
extern UNK_TYPE D_04062040;
extern UNK_TYPE D_04062060;
extern Gfx D_040622C0[];
extern Gfx D_04075A40[];
extern Gfx D_04075B30[];
extern Gfx D_04076BC0[];
extern Gfx D_04077480[];
//extern Gfx[] D_05018090; // pot break shard displaylist
//extern Gfx[] D_05017EA0; // pot displaylist
extern UNK_TYPE D_05018090; // pot break shard displaylist
extern UNK_TYPE D_05017EA0; // pot displaylist
extern Gfx D_05017EA0[]; // pot displaylist
extern Gfx D_05018090[]; // pot break shard displaylist
extern Gfx D_0501D980[];
extern Gfx D_050219E0[];
extern UNK_TYPE D_0E000048;
extern UNK_TYPE D_0E000088;
@@ -23,22 +47,4 @@ extern AnimatedTexture object_ikana_obj_001228[];
extern Gfx object_fu_kaiten_0005D0[];
extern BgMeshHeader object_fu_kaiten_002D30;
extern UNK_PTR D_04061FC0[];
extern UNK_PTR D_04061FE0[];
extern UNK_PTR D_04062000[];
extern UNK_PTR D_04062040[];
extern UNK_PTR D_04062020[];
extern UNK_PTR D_04062060[];
extern UNK_PTR D_04062000[];
extern Gfx D_040622C0[];
extern Gfx D_04075A40[];
/* z_actor.c */
extern Gfx D_04076BC0[];
extern Gfx D_04077480[];
extern Gfx D_04075B30[];
extern Gfx D_0501D980[];
extern Gfx D_050219E0[];
#endif
+9 -9
View File
@@ -376,14 +376,14 @@ extern u32 enAObjDisplayLists[2];
extern ActorInit En_Item00_InitVars;
extern ColliderCylinderInit enItem00CylinderInit;
extern InitChainEntry enItem00InitVars[1];
// extern UNK_TYPE1 D_801ADF10;
// extern UNK_TYPE1 D_801ADF14;
extern Color_RGBA8 D_801ADF10;
extern Color_RGBA8 D_801ADF14;
extern Vec3f D_801ADF18;
extern Vec3f D_801ADF24;
// extern UNK_TYPE1 D_801ADF30;
// extern UNK_TYPE1 D_801ADF44;
extern u8 D_801ADF74[272];
extern u8 D_801AE084[272];
extern UNK_PTR D_801ADF30[5];
extern UNK_PTR D_801ADF44[12];
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
extern u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
extern s32 D_801AE194[32];
extern u8 D_801AE214[32];
// extern UNK_TYPE4 D_801AE240;
@@ -1444,10 +1444,10 @@ extern UNK_PTR D_801C1E6C;
// extern UNK_TYPE1 D_801C1FAC;
// extern UNK_TYPE4 D_801C1FE0;
// extern UNK_TYPE1 D_801C2054;
// extern UNK_TYPE1 D_801C2078;
// extern UNK_TYPE1 D_801C2079;
extern u8 D_801C2078[1]; // TODO This array is larger than this. How large is it?
extern u8 D_801C2079;
// extern UNK_TYPE1 D_801C207A;
// extern UNK_TYPE1 D_801C207E;
extern u8 D_801C207E;
// extern UNK_TYPE1 D_801C207F;
// extern UNK_TYPE1 D_801C2080;
// extern UNK_TYPE1 D_801C2081;
+6 -3
View File
@@ -22,6 +22,7 @@
#include <z64cutscene.h>
#include <z64dma.h>
#include <z64effect.h>
#include <z64item.h>
#include <z64light.h>
#include <z64math.h>
#include <z64object.h>
@@ -364,9 +365,10 @@ typedef struct {
/* 0x06 */ UNK_TYPE1 pad6[0xA];
/* 0x10 */ s16 maxLife;
/* 0x12 */ s16 currentLife;
/* 0x14 */ UNK_TYPE1 pad14[0x1];
/* 0x14 */ s8 unk14;
/* 0x15 */ s8 currentMagic;
/* 0x16 */ UNK_TYPE1 pad16[0x12];
/* 0x16 */ s16 unk16;
/* 0x16 */ UNK_TYPE1 pad17[0x10];
} SaveContext_struct1; // size = 0x28
typedef struct {
@@ -657,7 +659,8 @@ typedef struct {
// Permanent save context, kept in regular save files
typedef struct {
/* 0x0000 */ u32 entranceIndex; // bits 0-3 : offset; 4-8: spawn index; 9-15: scene index
/* 0x0004 */ UNK_TYPE1 pad4[0x4];
/* 0x0004 */ UNK_TYPE1 pad4[0x3];
/* 0x0007 */ u8 linkAge;
/* 0x0008 */ s32 cutscene;
/* 0x000C */ u16 time;
/* 0x000E */ UNK_TYPE1 padE[0x2];
+46 -7
View File
@@ -263,19 +263,58 @@ typedef struct {
/* 0xCC4 */ UNK_TYPE1 padCC4[0xB4];
} ActorPlayer; // size = 0xD78
typedef struct {
/* 0x000 */ Actor base;
/* 0x144 */ ActorFunc update;
/* 0x148 */ s16 collectibleFlagId;
typedef enum {
/* 0x00 */ ITEM00_RUPEE_GREEN,
/* 0x01 */ ITEM00_RUPEE_BLUE,
/* 0x02 */ ITEM00_RUPEE_RED,
/* 0x03 */ ITEM00_HEART,
/* 0x04 */ ITEM00_BOMBS_A,
/* 0x05 */ ITEM00_ARROWS_10,
/* 0x06 */ ITEM00_HEART_PIECE,
/* 0x07 */ ITEM00_HEART_CONTAINER,
/* 0x08 */ ITEM00_ARROWS_30,
/* 0x09 */ ITEM00_ARROWS_40,
/* 0x0A */ ITEM00_ARROWS_50,
/* 0x0B */ ITEM00_BOMBS_B,
/* 0x0C */ ITEM00_NUTS_1,
/* 0x0D */ ITEM00_STICK,
/* 0x0E */ ITEM00_MAGIC_LARGE,
/* 0x0F */ ITEM00_MAGIC_SMALL,
/* 0x10 */ ITEM00_MASK,
/* 0x11 */ ITEM00_SMALL_KEY,
/* 0x12 */ ITEM00_FLEXIBLE,
/* 0x13 */ ITEM00_RUPEE_ORANGE,
/* 0x14 */ ITEM00_RUPEE_PURPLE,
/* 0x15 */ ITEM00_3_HEARTS,
/* 0x16 */ ITEM00_SHIELD_HERO,
/* 0x17 */ ITEM00_NUTS_10,
/* 0x18 */ ITEM00_NOTHING,
/* 0x19 */ ITEM00_BOMBS_0,
/* 0x1A */ ITEM00_BIG_FAIRY,
/* 0x1B */ ITEM00_MAP,
/* 0x1C */ ITEM00_COMPASS,
/* 0x1D */ ITEM00_MUSHROOM_CLOUD,
/* 0xFF */ ITEM00_NO_DROP = -1
} Item00Type;
struct EnItem00;
typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*);
typedef struct EnItem00 {
/* 0x000 */ Actor actor;
/* 0x144 */ EnItem00ActionFunc actionFunc;
/* 0x148 */ s16 collectibleFlag;
/* 0x14A */ s16 unk14A;
/* 0x14C */ s16 unk14C;
/* 0x14E */ s16 unk14E;
/* 0x150 */ s16 unk150;
/* 0x152 */ s16 unk152;
/* 0x154 */ f32 unk154;
/* 0x158 */ ColliderCylinder collision;
/* 0x1A4 */ UNK_TYPE1 pad1A4[0x4];
} ActorEnItem00; // size = 0x1A8
/* 0x158 */ ColliderCylinder collider;
/* 0x1A4 */ s8 unk1A4;
} EnItem00; // size = 0x1A8
typedef struct {
/* 0x000 */ Actor base;
+50
View File
@@ -0,0 +1,50 @@
#ifndef _Z64ITEM_H_
#define _Z64ITEM_H_
#define DROP_TABLE_SIZE 16
#define DROP_TABLE_NUMBER 17
// TODO fill out these enums
typedef enum {
/* 0x78 */ ITEM_KEY_SMALL = 0x78,
/* 0x79 */ ITEM_MAGIC_SMALL = 0x79,
/* 0x7A */ ITEM_MAGIC_LARGE = 0x7A,
/* 0x83 */ ITEM_HEART = 0x83,
/* 0x84 */ ITEM_RUPEE_GREEN = 0x84,
/* 0x85 */ ITEM_RUPEE_BLUE = 0x85,
/* 0x86 */ ITEM_RUPEE_10 = 0x86,
/* 0x87 */ ITEM_RUPEE_RED = 0x87,
/* 0x88 */ ITEM_RUPEE_PURPLE = 0x88,
/* 0x89 */ ITEM_RUPEE_100 = 0x89,
/* 0x8A */ ITEM_RUPEE_ORANGE = 0x8A,
/* 0x8F */ ITEM_BOMBS_5 = 0x8F,
/* 0x90 */ ITEM_BOMBS_10 = 0x90,
/* 0x91 */ ITEM_BOMBS_20 = 0x91,
/* 0x92 */ ITEM_BOMBS_30 = 0x92,
/* 0x93 */ ITEM_ARROWS_10 = 0x93,
/* 0x94 */ ITEM_ARROWS_30 = 0x94,
/* 0x95 */ ITEM_ARROWS_40 = 0x95,
/* 0x96 */ ITEM_ARROWS_50 = 0x96
} ItemID;
typedef enum {
/* 0x00 */ GI_NONE,
/* 0x0C */ GI_HEART_PIECE = 0x0C,
/* 0x0D */ GI_HEART_CONTAINER = 0x0D,
/* 0x19 */ GI_STICKS_1 = 0x19,
/* 0x28 */ GI_NUTS_1 = 0x28,
/* 0x2A */ GI_NUTS_10 = 0x2A,
/* 0x32 */ GI_SHIELD_HERO = 0x32,
/* 0x3C */ GI_KEY_SMALL = 0x3C,
/* 0x3E */ GI_MAP = 0x3E,
/* 0x3F */ GI_COMPASS = 0x3F
} GetItemID;
typedef enum {
/* 0x0A */ GID_COMPASS = 0x0A,
/* 0x1B */ GID_DUNGEON_MAP = 0x1B,
/* 0x27 */ GID_SHIELD_HERO = 0x27
} GetItemDrawID;
#endif