En_Elforg (Stray Fairy) OK and mostly documented (#359)

* Migrate data to C

* EnElforg_Init OK

* func_80ACC470 OK

* EnElforg_Destroy OK

* EnElforg_Update OK

* func_80ACCBD0 OK

* func_80ACCBB8 OK

* func_80ACD6EC OK

* func_80ACD59C OK

* func_80ACD6A8 OK

* func_80ACD610 OK

* func_80ACD878 OK

* Declare animated materials for Elforg

* EnElforg_Draw OK

* func_80ACCC98 OK

* func_80ACC7E4 OK

* func_80ACC8D4 OK

* func_80ACCEB0 OK

* func_80ACC994 OK

* PLAYER -> GET_PLAYER

* func_80ACCE4C OK

* func_80ACC934 OK

* func_80ACCAC0 OK

* func_80ACD2E4 OK

* func_80ACD1F0 OK

* func_80ACD164 OK

* func_80ACD1B0 OK (maybe fakematch but oh well)

* func_80ACD088 OK

* Better match for func_80ACD1B0

* Use compiled reloc

* Move static data to appropriate function

* Name sCylinderInit appropriately

* Add explanatory comment

* Clean up forward declarations

* Add macro for the flag

* Macro and enum for type

* Add STRAY_FAIRY_GET_PARAM_1C0 macro (no clue what this does)

* Document the area stuff

* Name some functions

* Document timer and direction

* Eliminate some early returns

* Tons more documentation

* Name remaining functions

* Document flags

* Name targetDistanceFromHome

* fairyFountainTimer -> secondaryTimer, since it's used outside of Fairy Fountains

* Name the unknown flag

* Name the collider fairy type

* Last bit of renaming/documenting

* Remove zero check

* Use hex constant for newAngle

* Merge animation updates

* Use 0x10000 instead of 65536.0f

* Use decimal for alpha

* Move yDifference initialization up to the same line as declaration

* Use +=/-=

* <= 30 instead of < 31

* += -1 -> --

* >= 81 -> > 80

* 0xDFFFFFFF -> ~0x20000000

* EnElforg_InitializeSpeedAndRotation -> EnElforg_InitializeParams
This commit is contained in:
Tom Overton
2021-10-31 13:25:10 -03:00
committed by GitHub
parent b1b114e142
commit d4effceefd
9 changed files with 642 additions and 62 deletions
+2 -2
View File
@@ -2021,7 +2021,7 @@ void func_80105818(GlobalContext* globalCtx, u32 uParm2, TransitionActorEntry* p
// void func_80109EF8(void);
// void func_80109F78(void);
s32 func_8010A000(GlobalContext* globalCtx);
// void func_8010A074(void);
s32 func_8010A074(GlobalContext* globalCtx);
// void func_8010A0A4(void);
// void func_8010A0F0(void);
// void func_8010A164(void);
@@ -2155,7 +2155,7 @@ void func_8011552C(GlobalContext* globalCtx, s16 arg1);
// void func_801155B4(void);
// void func_80115764(void);
void func_80115844(GlobalContext* globalCtx, s16 param_2);
void func_80115908(GlobalContext* globalCtx, u8 param_2);
s32 func_80115908(GlobalContext* globalCtx, u8 param_2);
void func_801159c0(s16 param_1);
void func_801159EC(s16 arg0);
void func_80115A14(s32 arg0, s16 arg1);
+7 -2
View File
@@ -3972,8 +3972,13 @@ extern UNK_TYPE D_04029140;
extern Gfx D_04029CB0[];
extern Gfx D_04029CF0[];
extern UNK_TYPE D_04029D20;
extern UNK_TYPE D_0402B494;
extern UNK_TYPE D_0402C908;
extern AnimationHeader D_0402B494;
extern AnimatedMaterial D_0402C818;
extern AnimatedMaterial D_0402C890;
extern AnimatedMaterial D_0402C908;
extern AnimatedMaterial D_0402C980;
extern AnimatedMaterial D_0402C9F8;
extern FlexSkeletonHeader D_0402CA98;
extern Gfx D_0402E510[];
extern UNK_TYPE D_0402E65C;
extern UNK_TYPE D_0402F0EC;
+1 -2
View File
@@ -3577,8 +3577,7 @@ beginseg
name "ovl_En_Elforg"
compress
include "build/src/overlays/actors/ovl_En_Elforg/z_en_elforg.o"
include "build/data/ovl_En_Elforg/ovl_En_Elforg.data.o"
include "build/data/ovl_En_Elforg/ovl_En_Elforg.reloc.o"
include "build/src/overlays/actors/ovl_En_Elforg/ovl_En_Elforg_reloc.o"
endseg
beginseg
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "prevent_bss_reordering.h"
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "prevent_bss_reordering.h"
@@ -5,6 +5,7 @@
*/
#include "z_en_elfbub.h"
#include "overlays/actors/ovl_En_Elforg/z_en_elforg.h"
#define FLAGS 0x00000001
@@ -76,7 +77,7 @@ void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx) {
childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELFORG,
this->actor.world.pos.x, this->actor.world.pos.y + 12.0f, this->actor.world.pos.z,
this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z,
((ENELFBUB_GET_SWITCHFLAG(&this->actor) & 0x7F) << 9) | 2);
((ENELFBUB_GET_SWITCHFLAG(&this->actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_BUBBLE);
if (childActor != NULL) {
childActor->parent = &this->actor;
}
File diff suppressed because it is too large Load Diff
@@ -3,14 +3,54 @@
#include "global.h"
#define STRAY_FAIRY_TYPE(thisx) ((thisx)->params & 0xF)
#define STRAY_FAIRY_GET_PARAM_1C0(thisx) ((thisx)->params & 0x1C0)
#define STRAY_FAIRY_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9)
#define STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME (1 << 0)
#define STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS (1 << 1)
#define STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN (1 << 2)
#define STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED (1 << 3)
typedef enum {
STRAY_FAIRY_TYPE_FREE_FLOATING, // The ones just floating around
STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN, // The ones already present when you enter a Fairy Fountain
STRAY_FAIRY_TYPE_BUBBLE, // The ones trapped in bubbles
STRAY_FAIRY_TYPE_CLOCK_TOWN, // The free-floating Stray Fairies in Clock Town
STRAY_FAIRY_TYPE_ENEMY, // The ones trapped inside enemies
STRAY_FAIRY_TYPE_COLLIDER, // Unused in retail. The fairy is hidden until the collider is hit
STRAY_FAIRY_TYPE_CHEST, // The ones in treasure chests
STRAY_FAIRY_TYPE_COLLECTIBLE, // The ones in boxes, pots, beehives, etc.
STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN // The ones you "turn in" by walking into a Fairy Fountain
} StrayFairyType;
typedef enum {
STRAY_FAIRY_AREA_CLOCK_TOWN,
STRAY_FAIRY_AREA_WOODFALL,
STRAY_FAIRY_AREA_SNOWHEAD,
STRAY_FAIRY_AREA_GREAT_BAY,
STRAY_FAIRY_AREA_STONE_TOWER,
STRAY_FAIRY_AREA_MAX
} StrayFairyArea;
struct EnElforg;
typedef void (*EnElforgActionFunc)(struct EnElforg*, GlobalContext*);
typedef struct EnElforg {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0xE8];
/* 0x022C */ EnElforgActionFunc actionFunc;
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[10];
/* 0x1C4 */ ColliderCylinder collider;
/* 0x210 */ Actor* enemy;
/* 0x214 */ u16 flags;
/* 0x216 */ s16 direction; // negative when facing left, positive when facing right
/* 0x218 */ s16 area;
/* 0x21C */ s32 timer;
/* 0x220 */ s32 secondaryTimer;
/* 0x224 */ f32 targetSpeedXZ;
/* 0x228 */ f32 targetDistanceFromHome;
/* 0x22C */ EnElforgActionFunc actionFunc;
} EnElforg; // size = 0x230
extern const ActorInit En_Elforg_InitVars;
+20 -20
View File
@@ -12075,30 +12075,30 @@
0x80ACBDFC:("func_80ACBDFC",),
0x80ACBEE0:("ObjAqua_Update",),
0x80ACC048:("ObjAqua_Draw",),
0x80ACC470:("func_80ACC470",),
0x80ACC470:("EnElforg_InitializeParams",),
0x80ACC50C:("EnElforg_Init",),
0x80ACC7A4:("EnElforg_Destroy",),
0x80ACC7E4:("func_80ACC7E4",),
0x80ACC8D4:("func_80ACC8D4",),
0x80ACC934:("func_80ACC934",),
0x80ACC994:("func_80ACC994",),
0x80ACCAC0:("func_80ACCAC0",),
0x80ACC7E4:("EnElforg_SpawnSparkles",),
0x80ACC8D4:("EnElforg_ApproachTargetYPosition",),
0x80ACC934:("EnElforg_ApproachTargetSpeedXZ",),
0x80ACC994:("EnElforg_MoveToTargetFairyFountain",),
0x80ACCAC0:("EnElforg_MoveToTarget",),
0x80ACCBB8:("func_80ACCBB8",),
0x80ACCBD0:("func_80ACCBD0",),
0x80ACCC98:("func_80ACCC98",),
0x80ACCE4C:("func_80ACCE4C",),
0x80ACCEB0:("func_80ACCEB0",),
0x80ACD088:("func_80ACD088",),
0x80ACD164:("func_80ACD164",),
0x80ACD1B0:("func_80ACD1B0",),
0x80ACD1F0:("func_80ACD1F0",),
0x80ACD2E4:("func_80ACD2E4",),
0x80ACD59C:("func_80ACD59C",),
0x80ACD610:("func_80ACD610",),
0x80ACD6A8:("func_80ACD6A8",),
0x80ACD6EC:("func_80ACD6EC",),
0x80ACCBD0:("EnElforg_TrappedByBubble",),
0x80ACCC98:("EnElforg_TurnInFairy",),
0x80ACCE4C:("EnElforg_QuicklyCircleFairyFountain",),
0x80ACCEB0:("EnElforg_FreeFloatingFairyFountain",),
0x80ACD088:("EnElforg_CirclePlayer",),
0x80ACD164:("EnElforg_FairyCollected",),
0x80ACD1B0:("EnElforg_SetupFairyCollected",),
0x80ACD1F0:("EnElforg_ClockTownFairyCollected",),
0x80ACD2E4:("EnElforg_FreeFloating",),
0x80ACD59C:("EnElforg_GetHoldingEnemy",),
0x80ACD610:("EnElforg_TrappedByEnemy",),
0x80ACD6A8:("EnElforg_SetupTrappedByEnemy",),
0x80ACD6EC:("EnElforg_HiddenByCollider",),
0x80ACD798:("EnElforg_Update",),
0x80ACD878:("func_80ACD878",),
0x80ACD878:("EnElforg_OverrideLimbDraw",),
0x80ACD8C0:("EnElforg_Draw",),
0x80ACDCD0:("EnElfbub_Init",),
0x80ACDE34:("EnElfbub_Destroy",),