z_actor with some documentation, with 1 NON_EQUIVALENTs (#401)

* Match Player_GetHeight

* Another bunch

* Fix merge conflict

* rename Gfx_DrawDListXlu

* add WEEROR

* Actor_Spawn

* almost Actor_SpawnTransitionActors  and Actor_Delete

* A bunch of small actors

* More renames

* format

* Some Player renames

* a few more

* import data

* run formatter

* func_800B7170

* whoops

* Fix merge issues

* Whoops 2

* func_800B83BC and func_800B83F8

* Actor_IsActorFacingPlayerAndWithinRange

* add some prototypes

* match Actor_UpdateBgCheckInfo

* func_800B7678

* mark Actor_SpawnAsChildAndCutscene as non_matching

* Actor_Draw

* Update is chaotic

* 2 new matches

* func_800BC8B8

* Another bunch

* function renames

* run formatter

* cleanup

* remove unnecesary casts

* add missing sfx

* Fix renames

* fix merge

* func_800BF7CC

* small bunch

* another bunch

* func_800BE184 non_matching

* two more

* split z_cheap_proc

* Another bunch

* another bunch

* a few and a non matching

* yeee

* a

* Actor_DrawAll non_equivalent

* Actor_RecordUndrawnActor

* i don't know what to put in this commit message

* func_800B4B50 non matching

* func_800B42F8 non matching

* func_800B5040

* func_800B5814 non_equiv

* func_800B6584

* func_800B6608

* func_800B6680

* func_800B7E04

* func_800B8118

* func_800b9170

* ,

* func_800BC4EC

* func_800BA6FC

* func_800BA798

* func_800BA8B8

* Actor_LoadOverlay

* small cleanup

* func_800BB2D0

* meh

* func_800BBAC0

* func_800BC270

* func_800B5208 non matching

* Fix warnings

* meh

* rename some ActorShadow_ functions

* fairy

* Flags_

* fix warnings

* format

* Actor_PickUp and family

* func_800B8E58

* match Actor_RemoveFromCategory

* another bit of docs

* Match func_800B86C8

* And another bit

* rename Player_GetRunSpeedLimit

* func_800B9E84

* func_800BE63C

* func_800BB8EC

* match func_800B5814

* match func_800B9334

* cleanup

* fix conflicts: first pass

* another fix

* actorfixer fix

* fix conflicts

* func_800BE680 non_equivalent

* Improve func_800BE680 a bit

* func_800BE680 equivalent (?)

* func_800BE680 equivalent

* Actor_UpdateActor equivalent

* format

* use some  ExchangeItemID enum values

* Some more cleaning

* more cleanup

* More name stealing from OoT

* match func_800B82EC

* match func_800B9D1C and a bit of cleanup

* Add ACTOR_FLAGS placeholders

* Renames and match func_800BE184

* last pass of name stealing

* format

* fix conflicts

* more cleanup

* more cleanup

* cleanup and OVERLAY_RELOCATION_OFFSET macro

* Remove prototypes of obviously internal-only functions,
update variable names,
forward declare where necessary,
remove all `param_\d`s

* remove newlines

* minor rename

* Use ACTOR_FLAGS in z_actor

* Match func_800BE3D0

* Rename movement functions

* Document Actor_CalcOffsetOrientedToDrawRotation

* velX -> horizontalSpeed

* A bit of documentation for actor movement functions

* format

* Fix merge issues

* format

* Format

* Fix renames

* fix warnings

* fix conflicts

* review :D

* Update src/overlays/actors/ovl_En_Ma4/z_en_ma4.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Fix

* format

* Actor_SpawnSetupActors

* engineer review

* Update src/code/z_actor.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* A bunch of Engineer's reviews

* more Engineer's review

* a

* whoops

* run actorfixer

* c'mon

* 😮‍💨

* whoops

* warning

* More engineer's review

* run format

* I'm dumb

* a

* match func_800BE680

* Match Actor_DrawZTarget

* Match Actor_SpawnAsChildAndCutscene, fix non-equivalent in Actor_UpdateActor

* Fix merge issue

* format

* update actor

* Steal a bit of @Thar0 documentation from OoT's z_message

* Run actorfixer

* Fix renames

* Match func_800B4B50 thanks to @hensldm

* Improve ActorShadow_DrawFeet thanks to @hensldm

* whoops

* Actor_PlaySfxAtProjectedPos

* Actor_UpdateActor matched by @hensldm

* Match func_800BA2FC by @hensldm

* Match Actor_SpawnTransitionActors by @hensldm

* Match func_800BB604 by @hensldm

* Match Actor_DrawAll by @hensldm

* ActorShadow_DrawFeet by @hensldm

* Actor_UpdateAll by @hensldm

* Match func_800BCCDC by @engineer124

* Small Actor_PlaySfxAtPos by @engineer124

* ACTOR_FLAGS_ALL and a bit of cleanup

* Add invisible comment

* Small docs pass

* Fix merge

* Engineer's review

* format lol

* Actor_DrawDoorLock docs

* Actor_SpawnShieldParticlesMetal

* fix merge issues

* sActorFaultClient

* fix

* commit message

* Run actorfixer.py && format.sh

* Fix warnings

* fixes

* format

* bss

* Update include/functions.h

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Address review

* Fix merge issues, format and such

* fix merge issues

* Add ACTORCAT_MAX

* actorList -> actorLists

* Fix merge issues

* format

* Enable WERROR on jenkinsfile

* Fix merge

* Use object symbols

* address review

* format

* review

* fix merge issues

* fix

* VRAM_PTR_SIZE, small cleanup and format

* review

Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
This commit is contained in:
Anghelo Carvajal
2022-01-10 12:04:28 -05:00
committed by GitHub
co-authored by Elliptic Ellipsis Derek Hensley engineer124 engineer124
parent b74bec0e1d
commit 6069a1585f
260 changed files with 7753 additions and 3747 deletions
+10 -4
View File
@@ -8,6 +8,8 @@ COMPARE ?= 1
NON_MATCHING ?= 0
# If ORIG_COMPILER is 1, compile with QEMU_IRIX and the original compiler
ORIG_COMPILER ?= 0
# if WERROR is 1, pass -Werror to CC_CHECK, so warnings would be treated as errors
WERROR ?= 0
# Keep .mdebug section in build
KEEP_MDEBUG ?= 0
# Disassembles all asm from the ROM instead of skipping files which are entirely in C
@@ -110,6 +112,10 @@ ifneq ($(NON_MATCHING),1)
COMPFLAGS += --matching
endif
ifneq ($(WERROR), 0)
CC_CHECK += -Werror
endif
#### Files ####
# ROM image
@@ -290,8 +296,8 @@ build/data/%.o: data/%.s
$(AS) $(ASFLAGS) $< -o $@
build/src/overlays/%.o: src/overlays/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
@$(OBJDUMP) -d $@ > $(@:.o=.s)
# TODO: `() || true` is currently necessary to suppress `Error 1 (ignored)` make warnings caused by `test`, but this will go away if
# the following is moved to a separate rule that is only run once when all the required objects have been compiled.
@@ -300,21 +306,21 @@ build/src/overlays/%.o: src/overlays/%.c
$(RM_MDEBUG)
build/src/%.o: src/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $<
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
$(RM_MDEBUG)
+2 -2
View File
@@ -1,7 +1,7 @@
<Root>
<File Name="gameplay_dangeon_keep" Segment="5">
<DList Name="gameplay_dangeon_keep_DL_000140" Offset="0x140" />
<DList Name="gameplay_dangeon_keep_DL_000230" Offset="0x230" />
<DList Name="gDoorLockDL" Offset="0x140" />
<DList Name="gDoorChainsDL" Offset="0x230" />
<Texture Name="gameplay_dangeon_keep_Tex_0002C0" OutName="tex_0002C0" Format="rgba16" Width="32" Height="32" Offset="0x2C0" />
<Texture Name="gameplay_dangeon_keep_Tex_000AC0" OutName="tex_000AC0" Format="rgba16" Width="32" Height="32" Offset="0xAC0" />
<Texture Name="gameplay_dangeon_keep_Tex_0012C0" OutName="tex_0012C0" Format="rgba16" Width="16" Height="128" Offset="0x12C0" />
+6 -6
View File
@@ -866,7 +866,7 @@
<Texture Name="gameplay_keep_Tex_01EAF8" OutName="tex_01EAF8" Format="rgba16" Width="16" Height="16" Offset="0x1EAF8" />
<DList Name="gameplay_keep_DL_01ED00" Offset="0x1ED00" />
<DList Name="gameplay_keep_DL_01ED90" Offset="0x1ED90" />
<DList Name="gameplay_keep_DL_01F0F0" Offset="0x1F0F0" />
<DList Name="gZTargetArrowDL" Offset="0x1F0F0" />
<Texture Name="gameplay_keep_Tex_01F200" OutName="tex_01F200" Format="i8" Width="8" Height="8" Offset="0x1F200" />
<DList Name="gameplay_keep_DL_01F300" Offset="0x1F300" />
<Texture Name="gameplay_keep_Tex_01F340" OutName="tex_01F340" Format="ia8" Width="32" Height="32" Offset="0x1F340" />
@@ -1301,13 +1301,13 @@
<Texture Name="gameplay_keep_Tex_075000" OutName="tex_075000" Format="i4" Width="32" Height="64" Offset="0x75000" />
<Texture Name="gameplay_keep_Tex_075400" OutName="tex_075400" Format="i4" Width="32" Height="64" Offset="0x75400" />
<Texture Name="gameplay_keep_Tex_075800" OutName="tex_075800" Format="i4" Width="32" Height="32" Offset="0x75800" />
<DList Name="gameplay_keep_DL_075A40" Offset="0x75A40" />
<DList Name="gSquareShadowDL" Offset="0x75A40" />
<Texture Name="gameplay_keep_Tex_075AA8" OutName="tex_075AA8" Format="i4" Width="16" Height="16" Offset="0x75AA8" />
<DList Name="gameplay_keep_DL_075B30" Offset="0x75B30" />
<DList Name="gFootShadowDL" Offset="0x75B30" />
<Texture Name="gameplay_keep_Tex_075BC0" OutName="tex_075BC0" Format="ia16" Width="32" Height="64" Offset="0x75BC0" />
<DList Name="gameplay_keep_DL_076BC0" Offset="0x76BC0" />
<DList Name="gCircleShadowDL" Offset="0x76BC0" />
<Texture Name="gameplay_keep_Tex_076C40" OutName="tex_076C40" Format="ia16" Width="32" Height="32" Offset="0x76C40" />
<DList Name="gameplay_keep_DL_077480" Offset="0x77480" />
<DList Name="gHorseShadowDL" Offset="0x77480" />
<Texture Name="gameplay_keep_Tex_0774D0" OutName="tex_0774D0" Format="i8" Width="16" Height="64" Offset="0x774D0" />
<DList Name="gameplay_keep_DL_077990" Offset="0x77990" />
<Texture Name="gameplay_keep_Tex_077A40" OutName="tex_077A40" Format="ia8" Width="32" Height="128" Offset="0x77A40" />
@@ -1322,7 +1322,7 @@
<DList Name="gameplay_keep_DL_07AB10" Offset="0x7AB10" />
<DList Name="gameplay_keep_DL_07AB58" Offset="0x7AB58" />
<DList Name="gameplay_keep_DL_07AB70" Offset="0x7AB70" />
<DList Name="gameplay_keep_DL_07AE00" Offset="0x7AE00" />
<DList Name="gZTargetLockOnTriangleDL" Offset="0x7AE00" />
<DList Name="gameplay_keep_DL_07AFB0" Offset="0x7AFB0" />
<DList Name="gameplay_keep_DL_07B0B8" Offset="0x7B0B8" />
<Texture Name="gameplay_keep_Tex_07B0C0" OutName="tex_07B0C0" Format="i8" Width="64" Height="64" Offset="0x7B0C0" />
+32 -32
View File
@@ -63,7 +63,7 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80952BA0);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 35.0f);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
Actor_SetScale(&this->actor, 0.015f);
this->actor.colChkInfo.mass = 0xFF;
this->actionFunc = func_80952734;
@@ -87,7 +87,7 @@ void func_80952734(EnMs* this, GlobalContext* globalCtx) {
this->actor.textId = 0x932;
}
if (func_800B84D0(&this->actor, globalCtx) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
this->actionFunc = func_809527F8;
return;
}
@@ -107,12 +107,12 @@ void func_809529AC(EnMs *this, GlobalContext *globalCtx) {
func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0);
this->actionFunc = func_80952A1C;
} else {
func_800B8A1C(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
}
}
void func_80952A1C(EnMs *this, GlobalContext *globalCtx) {
if (func_800B84D0(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
func_80151938(globalCtx, 0x936U);
this->actionFunc = func_809527F8;
} else {
@@ -124,7 +124,7 @@ void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnMs* this = THIS;
Actor_SetHeight(&this->actor, 20.0f);
Actor_SetFocus(&this->actor, 20.0f);
this->actor.targetArrowOffset = 500.0f;
Actor_SetScale(&this->actor, 0.015f);
SkelAnime_Update(&this->skelAnime);
@@ -156,7 +156,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
u8 temp_v0;
u8 temp_v0_2;
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 != 4) {
if (temp_v0 != 5) {
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
@@ -168,7 +168,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
}
if (func_80147624(globalCtx) != 0) {
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
return;
}
@@ -198,7 +198,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
return;
}
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
}
@@ -208,7 +208,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
which is long, messy, and contains some rather nasty-looking control flow, including horrors like
```C
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 != 4) {
if (temp_v0 != 5) {
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
@@ -238,7 +238,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
u8 temp_v0;
u8 temp_v0_2;
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 == 4) {
goto block_7;
}
@@ -258,7 +258,7 @@ block_5:
goto block_17;
}
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
return;
block_7:
@@ -290,7 +290,7 @@ block_13:
return;
block_15:
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
return;
@@ -340,7 +340,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
u8 temp_v0;
u8 temp_v0_2;
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 == 4) {
goto block_7;
}
@@ -360,7 +360,7 @@ block_5:
goto block_17;
}
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
return;
block_7:
@@ -390,7 +390,7 @@ block_11:
}
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
return;
@@ -410,7 +410,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
u8 temp_v0;
u8 temp_v0_2;
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 == 4) {
goto block_7;
}
@@ -430,7 +430,7 @@ block_5:
return;
}
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
return;
block_7:
@@ -460,7 +460,7 @@ block_11:
}
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
return;
@@ -509,7 +509,7 @@ So let us rewrite the entire second half as a switch:
}
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
return;
@@ -540,7 +540,7 @@ There's a couple of other obvious things here:
func_80151938(globalCtx, 0x937U);
} else {
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
}
@@ -568,7 +568,7 @@ can be swapped round and made to wrap the switch. This leaves us with
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
u8 temp_v0;
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 == 4) {
goto block_7;
}
@@ -588,7 +588,7 @@ block_5:
return;
}
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
return;
block_7:
@@ -605,7 +605,7 @@ block_7:
func_80151938(globalCtx, 0x937U);
} else {
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
}
@@ -623,7 +623,7 @@ block_7:
Now, the top of the function also looks like a switch:
```C
temp_v0 = func_80152498(&globalCtx->msgCtx);
temp_v0 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0 == 4) {
goto block_7;
}
@@ -641,7 +641,7 @@ Putting all this together, we write down a function with no gotos in it:
```C
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
switch (func_80152498(&globalCtx->msgCtx)) {
switch (Message_GetState(&globalCtx->msgCtx)) {
case 6:
this->actionFunc = func_80952734;
break;
@@ -651,7 +651,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
return;
}
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
break;
@@ -660,7 +660,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
switch (globalCtx->msgCtx.choiceIndex) {
case 0:
func_801477B4(globalCtx);
if (gSaveContext.rupees < 0xA) {
play_sound(0x4806U);
func_80151938(globalCtx, 0x935U);
@@ -669,7 +669,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
func_80151938(globalCtx, 0x937U);
} else {
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
}
@@ -694,7 +694,7 @@ Lastly, we can simplify `case 5` to replace the return in the if by the rest of
```C
void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
switch (func_80152498(&globalCtx->msgCtx)) {
switch (Message_GetState(&globalCtx->msgCtx)) {
case 6:
this->actionFunc = func_80952734;
break;
@@ -702,7 +702,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
case 5:
if (func_80147624(globalCtx) != 0) {
func_801477B4(globalCtx);
func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
this->actionFunc = func_809529AC;
}
break;
@@ -712,7 +712,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
switch (globalCtx->msgCtx.choiceIndex) {
case 0:
func_801477B4(globalCtx);
if (gSaveContext.rupees < 0xA) {
play_sound(0x4806U);
func_80151938(globalCtx, 0x935U);
@@ -721,7 +721,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
func_80151938(globalCtx, 0x937U);
} else {
func_8019F208();
func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f);
func_801159EC(-0xA);
this->actionFunc = func_809529AC;
}
+9 -9
View File
@@ -148,9 +148,9 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) {
}
}
if (func_800B84D0(&this->actor, globalCtx) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
func_80C10290(this);
} else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) {
} else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) {
func_800B8614(&this->actor, globalCtx, 60.0f);
if (Player_GetMask(globalCtx) == 2) {
this->actor.textId = 0x2367;
@@ -188,7 +188,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
}
}
temp_v0_2 = func_80152498(&globalCtx->msgCtx);
temp_v0_2 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0_2 == 2) {
this->actor.textId = 0x2ADC;
func_80C10148(this);
@@ -197,7 +197,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) {
if (this->actor.textId == 0x2AD9) {
Actor_SetSwitchFlag(globalCtx, this->actor.params);
Flags_SetSwitch(globalCtx, this->actor.params);
Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f);
if ((gSaveContext.weekEventReg[63] & 0x80)) {
this->actor.textId = 0x2ADF;
@@ -476,9 +476,9 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) {
}
}
if (func_800B84D0(&this->actor, globalCtx) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
func_80C10290(this);
} else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) {
} else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) {
func_800B8614(&this->actor, globalCtx, 60.0f);
if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) {
this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?"
@@ -514,13 +514,13 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) {
}
}
temp_v0_2 = func_80152498(&globalCtx->msgCtx);
temp_v0_2 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0_2 == 2) {
this->actor.textId = 0x2ADC; // hear directions again?
func_80C10148(this);
} else if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) {
if (this->actor.textId == 0x2AD9) { // "Welcome..."
Actor_SetSwitchFlag(globalCtx, this->actor.params);
Flags_SetSwitch(globalCtx, this->actor.params);
Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f);
if (gSaveContext.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting
this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended)
@@ -546,7 +546,7 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) {
}
}
```
All this branching is to make the conversation look more diverse and interesting. Notably, though, `func_80C1019C` is set to start with, and is only changed when `func_800B84D0(&this->actor, globalCtx) != 0`. This is something to do with talking. The other function handles the rest of the conversation, and hands back to the first if `func_80152498(&globalCtx->msgCtx) == 2`. This function is *something* to do with the text state, which will require `z_message` to be decomped. However, observation in-game will reveal this is something to do with ending dialogue. So we can conclude that the action functions are `EnRecepgirl_Wait` and `EnRecepgirl_Talk`. The setup functions are thus `EnRecepgirl_SetupWait` and `EnRecepgirl_SetupTalk`.
All this branching is to make the conversation look more diverse and interesting. Notably, though, `func_80C1019C` is set to start with, and is only changed when `Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0`. This is something to do with talking. The other function handles the rest of the conversation, and hands back to the first if `Message_GetState(&globalCtx->msgCtx) == 2`. This function is *something* to do with the text state, which will require `z_message` to be decomped. However, observation in-game will reveal this is something to do with ending dialogue. So we can conclude that the action functions are `EnRecepgirl_Wait` and `EnRecepgirl_Talk`. The setup functions are thus `EnRecepgirl_SetupWait` and `EnRecepgirl_SetupTalk`.
For more complex actors, we have a tool called `graphovl.py` that can produce function flow graphs for actors: running
```
+2 -2
View File
@@ -27,7 +27,7 @@ glabel func_809529AC
/* 0003D8 809529F8 C484009C */ lwc1 $f4, 0x9c($a0)
/* 0003DC 809529FC 8C870098 */ lw $a3, 0x98($a0)
/* 0003E0 80952A00 24060035 */ addiu $a2, $zero, 0x35
/* 0003E4 80952A04 0C02E287 */ jal func_800B8A1C
/* 0003E4 80952A04 0C02E287 */ jal Actor_PickUp
/* 0003E8 80952A08 E7A40010 */ swc1 $f4, 0x10($sp)
.L80952A0C:
/* 0003EC 80952A0C 8FBF001C */ lw $ra, 0x1c($sp)
@@ -46,7 +46,7 @@ void func_809529AC(EnMs *this, GlobalContext *globalCtx) {
func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0);
this->actionFunc = func_80952A1C;
} else {
func_800B8A1C(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
Actor_PickUp(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
}
}
```
+11 -11
View File
@@ -116,11 +116,11 @@ void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) {
Animation_ChangeTransitionRepeat(temp_a0, &D_06009890, -4.0f);
}
}
if (func_800B84D0((Actor *) this, globalCtx) != 0) {
if (Actor_ProcessTalkRequest((Actor *) this, globalCtx) != 0) {
func_80C10290(this);
return;
}
if (Actor_IsActorFacingLink((Actor *) this, 0x2000) != 0) {
if (Actor_IsFacingPlayer((Actor *) this, 0x2000) != 0) {
func_800B8614((Actor *) this, globalCtx, 60.0f);
if (Player_GetMask(globalCtx) == 2) {
this->actor.textId = 0x2367;
@@ -168,11 +168,11 @@ void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) {
Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f);
}
}
if (func_800B84D0(&this->actor, globalCtx) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
func_80C10290(this);
return;
}
if (Actor_IsActorFacingLink(&this->actor, 0x2000) != 0) {
if (Actor_IsFacingPlayer(&this->actor, 0x2000) != 0) {
func_800B8614(&this->actor, globalCtx, 60.0f);
if (Player_GetMask(globalCtx) == 2) {
this->actor.textId = 0x2367;
@@ -203,9 +203,9 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) {
}
}
if (func_800B84D0(&this->actor, globalCtx) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
func_80C10290(this);
} else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) {
} else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) {
func_800B8614(&this->actor, globalCtx, 60.0f);
if (Player_GetMask(globalCtx) == 2) {
this->actor.textId = 0x2367;
@@ -282,7 +282,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
Animation_MorphToPlayOnce(sp20, &D_0600A280, -4.0f);
}
}
temp_v0_2 = func_80152498(&globalCtx->msgCtx);
temp_v0_2 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0_2 == 2) {
this->actor.textId = 0x2ADC;
func_80C10148(this);
@@ -291,7 +291,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) {
temp_v0_3 = this->actor.textId;
if (temp_v0_3 == 0x2AD9) {
Actor_SetSwitchFlag(globalCtx, (s32) this->actor.params);
Flags_SetSwitch(globalCtx, (s32) this->actor.params);
Animation_MorphToPlayOnce(sp20, &D_0600AD98, 10.0f);
if ((*(&gSaveContext + 0xF37) & 0x80) != 0) {
this->actor.textId = 0x2ADF;
@@ -340,7 +340,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
}
}
temp_v0_2 = func_80152498(&globalCtx->msgCtx);
temp_v0_2 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0_2 == 2) {
this->actor.textId = 0x2ADC;
func_80C10148(this);
@@ -349,7 +349,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) {
if (this->actor.textId == 0x2AD9) {
Actor_SetSwitchFlag(globalCtx, this->actor.params);
Flags_SetSwitch(globalCtx, this->actor.params);
Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f);
if ((*(&gSaveContext + 0xF37) & 0x80) != 0) {
this->actor.textId = 0x2ADF;
@@ -390,7 +390,7 @@ The yellow shows registers that don't match, the different colours on the regist
```
somehow we skipped over `t0`. Where is this in the code? The `153` in the middle is the line number in the C file (the `3f0`s are the offsets into the assembly file), we have `--source` if you want to see the code explicitly, or you can do it the old-fashioned way, and work it out from nearby function calls. In this case, `func_80C10148` is run straight after, and the only place that is called is
```C
temp_v0_2 = func_80152498(&globalCtx->msgCtx);
temp_v0_2 = Message_GetState(&globalCtx->msgCtx);
if (temp_v0_2 == 2) {
this->actor.textId = 0x2ADC;
func_80C10148(this);
+218 -312
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -153,4 +153,11 @@ extern u8 __osMaxControllers;
// extern OSMesgQueue D_8009CF38;
// extern OSMesg D_8009CF50;
typedef struct {
/* 0x00 */ OSContPad cur;
/* 0x06 */ OSContPad prev;
/* 0x0C */ OSContPad press; // X/Y store delta from last frame
/* 0x12 */ OSContPad rel; // X/Y store adjusted
} Input; // size = 0x18
#endif
+7 -2
View File
@@ -39,9 +39,9 @@
} \
(void)0
#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorList[ACTORCAT_PLAYER].first)
#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].first)
#define GET_FIRST_ENEMY(globalCtx) ((Actor*)(globalCtx)->actorCtx.actorList[ACTORCAT_ENEMY].first)
#define GET_FIRST_ENEMY(globalCtx) ((Actor*)(globalCtx)->actorCtx.actorLists[ACTORCAT_ENEMY].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
@@ -86,6 +86,8 @@
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)
#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask))
extern GraphicsContext* __gfxCtx;
#define WORK_DISP __gfxCtx->work.p
@@ -147,6 +149,9 @@ extern GraphicsContext* __gfxCtx;
(b) = _temp; \
}
#define OVERLAY_RELOCATION_OFFSET(overlayEntry) ((uintptr_t)((overlayEntry)->vramStart) - (uintptr_t)((overlayEntry)->loadedRamAddr))
#define VRAM_PTR_SIZE(entry) ((uintptr_t)((entry)->vramEnd) - (uintptr_t)((entry)->vramStart))
#ifdef __GNUC__
#define ALIGNED8 __attribute__ ((aligned (8)))
#else
+2
View File
@@ -53,6 +53,8 @@
#define SP_DMEM_START 0x04000000
#define SP_DMEM_SIZE 0x1000
#define TMEM_SIZE 0x1000
#define SP_MEM_ADDR_REG 0x04040000
#define SP_DRAM_ADDR_REG 0x04040004
#define SP_RD_LEN_REG 0x04040008
+14 -19
View File
@@ -374,7 +374,6 @@ extern u8 D_801AE214[32];
// extern UNK_TYPE4 D_801AE240;
// extern UNK_TYPE4 D_801AE250;
extern UNK_PTR D_801AE260[3];
// extern UNK_TYPE4 D_801AE26C;
// extern UNK_TYPE4 D_801AE27C;
// extern UNK_TYPE4 D_801AE28C;
// extern UNK_TYPE4 D_801AE29C;
@@ -415,11 +414,8 @@ extern EffectSsOverlay gParticleOverlayTable[39];
// extern s32 sEntryIndex;
// extern u32 sCurrentBit;
// extern s32 sTimer;
extern Color_RGBA8 D_801AEC80;
extern s801AEC84 D_801AEC84[13];
extern f32 actorMovementScale;
extern f32 D_801AECF0;
extern f32 D_801AECF4;
extern TargetRangeParams gTargetRanges[];
extern s16 D_801AED48[8];
// extern UNK_TYPE4 D_801AED58;
extern Color_RGBA8 actorDefaultHitColor;
@@ -2838,7 +2834,7 @@ extern f32 D_801DE860;
extern f32 D_801DE864;
extern f32 D_801DE868;
extern f32 D_801DE884;
// extern UNK_TYPE1 D_801DE890;
extern TexturePtr D_801DE890[];
extern f32 D_801DF090;
extern f32 D_801DF094;
extern f32 D_801DF0A0;
@@ -3102,15 +3098,15 @@ extern u64 gJpegUCodeData[];
// bss
// extern UNK_TYPE1 D_801ED890;
// extern UNK_TYPE1 D_801ED8A0;
// extern UNK_TYPE1 D_801ED8B0;
// extern UNK_TYPE1 D_801ED8B4;
// extern UNK_TYPE1 D_801ED894;
extern CollisionPoly* D_801ED8B0;
extern s32 D_801ED8B4;
// extern UNK_TYPE1 D_801ED8B8;
// extern UNK_TYPE1 D_801ED8BC;
// extern UNK_TYPE1 D_801ED8C0;
// extern UNK_TYPE1 D_801ED8C4;
extern f32 D_801ED8C8;
extern f32 D_801ED8CC;
extern f32 sBgmEnemyDistSq;
extern f32 D_801ED8D0;
// extern UNK_TYPE1 D_801ED8D4;
// extern UNK_TYPE1 D_801ED8D8;
@@ -3887,8 +3883,6 @@ extern Gfx D_04023210[];
extern UNK_TYPE D_04023288;
extern Gfx D_04023348[];
extern Gfx D_04023428[];
extern Gfx D_04025850[];
extern Gfx D_04025970[];
extern UNK_TYPE D_04025DD0;
extern UNK_TYPE D_040281DC;
extern UNK_TYPE D_04028FEC;
@@ -3920,8 +3914,8 @@ extern UNK_TYPE D_0403F230;
extern UNK_TYPE D_04044300;
extern Gfx D_04048DF0[];
extern UNK_TYPE D_04050D10;
extern UNK_TYPE D_04051180;
extern UNK_TYPE D_04051238;
extern Gfx D_04051180[];
extern Gfx D_04051238[];
extern AnimationHeader D_0405140C;
extern Gfx D_040527F0[];
extern Gfx D_040528B0[];
@@ -3940,7 +3934,8 @@ extern TexturePtr D_0408EFE0[]; // gDust6Tex
extern TexturePtr D_0408F3E0[]; // gDust7Tex
extern TexturePtr D_0408F7E0[]; // gDust8Tex
extern UNK_TYPE D_04050550;
extern UNK_TYPE D_04050648;
extern Gfx D_04050648[];
extern Gfx D_040506E0[];
extern UNK_TYPE D_040510B0;
extern UNK_TYPE D_04054940;
extern Gfx D_0405AAB0[];
@@ -3969,15 +3964,11 @@ extern UNK_TYPE D_0406F380;
extern Gfx D_040706E0[];
extern UNK_TYPE D_04073F00;
extern UNK_TYPE D_04075400;
extern Gfx D_04075A40[];
extern Gfx D_04075B30[];
extern Gfx D_04076BC0[];
extern Gfx D_04077480[];
extern UNK_TYPE D_04079B10;
extern Gfx D_0407AB10[]; // sun (sparkles when small) displaylist
extern Gfx D_0407AB58[];
extern UNK_TYPE D_0407AFB0;
extern Gfx gGameplayKeepDrawFlameDL[];
extern UNK_TYPE D_0407D650;
extern UNK_TYPE D_0407F218;
extern UNK_TYPE D_040815D0;
@@ -3985,6 +3976,10 @@ extern UNK_TYPE D_04081628;
extern UNK_TYPE D_04083534;
extern UNK_TYPE D_04091BE0;
extern UNK_TYPE D_04091CE0;
extern TexturePtr D_04091DE0[];
extern TexturePtr D_04091FE0[];
extern TexturePtr D_040921E0[];
extern TexturePtr D_040923E0[];
extern Gfx D_05000C40[];
extern UNK_TYPE D_05001D20;
+33 -117
View File
@@ -334,26 +334,6 @@ typedef struct {
/* 0x24 */ s16 unk_24;
} SramContext; // size = 0x28
typedef struct {
/* 0x00 */ UNK_TYPE4 unk0;
/* 0x04 */ UNK_TYPE4 unk4;
/* 0x08 */ UNK_TYPE4 unk8;
/* 0x0C */ f32 unkC;
/* 0x10 */ Color_RGBA8 unk10;
} TargetContextEntry; // size = 0x14
typedef struct {
/* 0x0 */ u32 texture;
/* 0x4 */ s16 unk4;
/* 0x6 */ s16 unk6;
/* 0x8 */ u8 unk8;
/* 0x9 */ u8 unk9;
/* 0xA */ u8 fadeOutDelay;
/* 0xB */ u8 fadeInDelay;
/* 0xC */ s16 alpha;
/* 0xE */ s16 color;
} TitleCardContext; // size = 0x10
typedef struct {
/* 0x0 */ s32 topY;
/* 0x4 */ s32 bottomY;
@@ -392,15 +372,27 @@ typedef struct {
} s80185D40; // size = 0x2C
typedef struct {
/* 0x0 */ u8 unk0;
/* 0x1 */ u8 unk1;
/* 0x2 */ u8 unk2;
/* 0x3 */ u8 unk3;
/* 0x4 */ u8 unk4;
/* 0x5 */ u8 unk5;
/* 0x6 */ u8 unk6;
/* 0x7 */ u8 unk7;
} s801AEC84; // size = 0x8
/* 0x00 */ u32 unk0;
/* 0x04 */ u8 unk4;
/* 0x05 */ u8 unk5;
/* 0x06 */ u8 unk6;
/* 0x07 */ UNK_TYPE1 pad7[0x2];
/* 0x09 */ u8 unk9;
/* 0x0A */ UNK_TYPE1 padA[0x2];
/* 0x0C */ u32 unkC;
/* 0x10 */ u16 unk10;
/* 0x12 */ u16 unk12;
/* 0x14 */ u16 unk14;
/* 0x16 */ UNK_TYPE1 pad16[0x2];
/* 0x18 */ u32 unk18;
/* 0x1C */ u32 unk1C;
/* 0x20 */ u32 unk20;
/* 0x24 */ u32 unk24;
/* 0x28 */ u32 unk28;
/* 0x2C */ u32 unk2C;
/* 0x30 */ u32 unk30;
/* 0x34 */ u32 unk34;
} s8018CFAC; // size = 0x38
typedef struct {
/* 0x00 */ Vec3f unk0;
@@ -480,13 +472,6 @@ typedef struct {
/* 0x10 */ Vec3f relativePos;
} SoundSource; // size = 0x1C
typedef struct {
/* 0x00 */ OSContPad cur;
/* 0x06 */ OSContPad prev;
/* 0x0C */ OSContPad press; // X/Y store delta from last frame
/* 0x12 */ OSContPad rel; // X/Y store adjusted
} Input; // size = 0x18
typedef struct {
/* 0x000 */ u32 magic;
/* 0x004 */ GraphicsContext* gfxCtx;
@@ -743,7 +728,7 @@ typedef struct {
/* 0x22 */ u16 unk_22;
/* 0x24 */ u16 unk_24;
/* 0x26 */ u8 unk_26;
/* 0x28 */ LightInfo unk_28; // sun 1
/* 0x28 */ LightInfo dirLight1; // sun 1
/* 0x36 */ LightInfo unk_36; // sun 2
/* 0x44 */ s8 unk_44;
/* 0x48 */ DmaRequest unk_48;
@@ -877,7 +862,9 @@ typedef struct {
/* 0x1202A */ u16 unk1202A;
/* 0x1202C */ UNK_TYPE1 pad1202C[0x2];
/* 0x1202E */ u16 unk1202E;
/* 0x12030 */ UNK_TYPE1 pad12030[0x14];
/* 0x12030 */ s16 unk_12030;
/* 0x12032 */ UNK_TYPE1 unk_12032[0x2];
/* 0x12034 */ UNK_TYPE1 pad12034[0x10];
/* 0x12044 */ s16 unk12044;
/* 0x12046 */ UNK_TYPE1 pad12046[0x2];
/* 0x12048 */ u8 unk12048; // EnKakasi
@@ -1197,24 +1184,12 @@ typedef enum {
STACK_STATUS_OVERFLOW = 2
} StackStatus;
typedef struct TargetContext TargetContext;
typedef struct ActorContext ActorContext;
typedef struct s800B948C s800B948C;
struct FireObjLight {
/* 0x00 */ LightNode* light;
/* 0x04 */ LightInfoPositional lightInfo;
/* 0x12 */ u8 unk12;
}; // size = 0x13
typedef struct ActorListEntry {
/* 0x0 */ s32 length; // number of actors loaded of this type
/* 0x4 */ Actor* first; // pointer to first actor of this type
/* 0x8 */ UNK_TYPE1 pad8[0x4];
} ActorListEntry; // size = 0xC
#define OS_SC_RETRACE_MSG 1
#define OS_SC_DONE_MSG 2
#define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c
@@ -1271,72 +1246,6 @@ struct FireObj {
/* 0x78 */ FireObjLight light;
}; // size = 0x8B
struct TargetContext {
/* 0x00 */ Vec3f unk0;
/* 0x0C */ Vec3f unkC;
/* 0x18 */ Color_RGBAf unk18;
/* 0x28 */ Color_RGBAf unk28;
/* 0x38 */ Actor* unk38;
/* 0x3C */ Actor* unk3C;
/* 0x40 */ f32 unk40;
/* 0x44 */ f32 unk44;
/* 0x48 */ s16 unk48;
/* 0x4A */ u8 unk4A;
/* 0x4B */ u8 unk4B;
/* 0x4C */ s8 unk4C;
/* 0x4D */ UNK_TYPE1 pad4D[0x3];
/* 0x50 */ TargetContextEntry unk50[3];
/* 0x8C */ Actor* unk8C;
/* 0x90 */ Actor* unk90;
/* 0x94 */ Actor* unk_94;
}; // size = 0x98
struct s800B948C {
/* 0x00 */ GlobalContext* globalCtx;
/* 0x04 */ Actor* actor;
/* 0x08 */ u32 updateActorIfSet;
/* 0x0C */ u32 unkC;
/* 0x10 */ Actor* unk10;
/* 0x14 */ Player* player;
/* 0x18 */ u32 runMainIfSet; // Bitmask of actor flags. The actor will only have main called if it has at least 1 flag set that matches this bitmask
}; // size = 0x1C
struct ActorContext {
/* 0x000 */ UNK_TYPE1 pad0[0x2];
/* 0x002 */ u8 unk2;
/* 0x003 */ u8 unk3;
/* 0x004 */ s8 unk4;
/* 0x005 */ u8 unk5;
/* 0x006 */ UNK_TYPE1 pad6[0x5];
/* 0x00B */ s8 unkB;
/* 0x00C */ s16 unkC;
/* 0x00E */ u8 totalLoadedActors;
/* 0x00F */ u8 undrawnActorCount;
/* 0x010 */ ActorListEntry actorList[12];
/* 0x0A0 */ Actor* undrawnActors[32]; // Records the first 32 actors drawn each frame
/* 0x120 */ TargetContext targetContext;
/* 0x1B8 */ u32 switchFlags[4]; // First 0x40 are permanent, second 0x40 are temporary
/* 0x1C8 */ u32 chestFlags;
/* 0x1CC */ u32 clearedRooms;
/* 0x1D0 */ u32 clearedRoomsTemp;
/* 0x1D4 */ u32 collectibleFlags[4]; // bitfield of 128 bits
/* 0x1E4 */ TitleCardContext titleCtxt;
/* 0x1F4 */ u8 unk1F4;
/* 0x1F5 */ u8 unk1F5;
/* 0x1F6 */ UNK_TYPE1 pad1F6[0x2];
/* 0x1F8 */ f32 unk1F8;
/* 0x1FC */ Vec3f unk1FC;
/* 0x208 */ UNK_TYPE1 pad208[0x48];
/* 0x250 */ void* unk250; // allocation of 0x20f0 bytes?
/* 0x254 */ u32 unk254[5];
/* 0x268 */ u8 unk268;
/* 0x269 */ UNK_TYPE1 pad269[0x3];
/* 0x26C */ UNK_TYPE1 pad26C[0xC];
/* 0x278 */ u16 unk278;
/* 0x27A */ UNK_TYPE1 pad27A[0x2];
/* 0x27C */ UNK_TYPE1 pad27C[0x8];
}; // size = 0x284
typedef struct {
/* 0x00 */ u8 seqIndex;
/* 0x01 */ u8 nightSeqIndex;
@@ -1448,7 +1357,9 @@ struct GlobalContext {
/* 0x18B4C */ PreRender pauseBgPreRender;
/* 0x18B9C */ char unk_18B9C[0x2B8];
/* 0x18E54 */ SceneTableEntry* loadedScene;
/* 0x18E58 */ char unk_18E58[0x400];
/* 0x18E58 */ char unk_18E58[0x10];
/* 0x18E68 */ s32 unk_18E68;
/* 0x18E6C */ char unk_18E6C[0x3EC];
}; // size = 0x19258
typedef struct {
@@ -1577,6 +1488,11 @@ typedef struct DebugDispObject {
/* 0x2C */ s32 pad; //Padding not in the OOT version
} DebugDispObject; // size = 0x30
typedef struct {
/* 0x0 */ f32 rangeSq;
/* 0x4 */ f32 leashScale;
} TargetRangeParams; // size = 0x8
typedef struct {
/* 0x00 */ u8* value;
/* 0x04 */ const char* name;
+174 -8
View File
@@ -1,5 +1,5 @@
#ifndef _Z64ACTOR_H_
#define _Z64ACTOR_H_
#ifndef Z64ACTOR_H
#define Z64ACTOR_H
#include "PR/ultratypes.h"
#include "z64math.h"
@@ -7,6 +7,8 @@
#include "z64collision_check.h"
#include "unk.h"
// This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD.
#define AM_FIELD_SIZE SEGMENT_SIZE(ovl_Arrow_Fire)
#define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC collisions
#define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects.
@@ -15,6 +17,7 @@ struct GlobalContext;
struct Lights;
struct CollisionPoly;
struct EnBox;
struct EnDoor;
typedef void(*ActorFunc)(struct Actor* this, struct GlobalContext* globalCtx);
@@ -118,6 +121,8 @@ typedef struct {
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
/* 0x14 */ u8 shadowAlpha; // Default is 255
/* 0x15 */ u8 feetFloorFlags; // Set if the actor's foot is clipped under the floor. & 1 is right foot, & 2 is left
/* 0x16 */ u8 unk_16;
/* 0x17 */ u8 unk_17;
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa
} ActorShape; // size = 0x30
@@ -133,15 +138,15 @@ typedef struct Actor {
/* 0x020 */ s16 unk20;
/* 0x024 */ PosRot world; // Position/rotation in the world
/* 0x038 */ s8 cutscene;
/* 0x039 */ s8 unk39;
/* 0x039 */ u8 audioFlags; // Another set of flags? Seems related to sfx or bgm
/* 0x03C */ PosRot focus; // Target reticle focuses on this position. For player this represents head pos and rot
/* 0x050 */ u16 sfx; // SFX ID to play. Sound plays when value is set, then is cleared the following update cycle
/* 0x050 */ u16 sfxId; // Id of sound effect to play. Plays when value is set, then is cleared the following update cycle
/* 0x054 */ f32 targetArrowOffset; // Height offset of the target arrow relative to `focus` position
/* 0x058 */ Vec3f scale; // Scale of the actor in each axis
/* 0x064 */ Vec3f velocity; // Velocity of the actor in each axis
/* 0x070 */ f32 speedXZ; // How fast the actor is traveling along the XZ plane
/* 0x074 */ f32 gravity; // Acceleration due to gravity. Value is added to Y velocity every frame
/* 0x078 */ f32 minVelocityY; // Sets the lower bounds cap on velocity along the Y axis
/* 0x078 */ f32 terminalVelocity; // Sets the lower bounds cap on velocity along the Y axis
/* 0x07C */ struct CollisionPoly* wallPoly; // Wall polygon the actor is touching
/* 0x080 */ struct CollisionPoly* floorPoly; // Floor polygon directly below the actor
/* 0x084 */ u8 wallBgId; // Bg ID of the wall polygon the actor is touching
@@ -170,12 +175,12 @@ typedef struct Actor {
/* 0x11C */ u8 colorFilterTimer; // A non-zero value enables the color filter. Decrements automatically
/* 0x11D */ u8 isDrawn; // Set to true if the actor is currently being drawn. Always stays false for lens actors
/* 0x11E */ u8 dropFlag; // Configures what item is dropped by the actor from `Item_DropCollectibleRandom`
/* 0x11F */ u8 hintId; // Sets what 0600 dialog to display when talking to navi. Default 0xFF
/* 0x11F */ u8 hintId; // Sets what 0600 dialog to display when talking to Tatl. Default 0xFF
/* 0x120 */ struct Actor* parent; // Usage is actor specific. Set if actor is spawned via `Actor_SpawnAsChild`
/* 0x124 */ struct Actor* child; // Usage is actor specific. Set if actor is spawned via `Actor_SpawnAsChild`
/* 0x128 */ struct Actor* prev; // Previous actor of this category
/* 0x12C */ struct Actor* next; // Next actor of this category
/* 0x130 */ ActorFunc init; // Initialization Routine. Called by `Actor_Init` or `Actor_UpdateAll`
/* 0x130 */ ActorFunc init; // Initialization Routine. Called by `Actor_InitContext` or `Actor_UpdateAll`
/* 0x134 */ ActorFunc destroy; // Destruction Routine. Called by `Actor_Destroy`
/* 0x138 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll`
/* 0x13C */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw`
@@ -289,7 +294,8 @@ typedef enum {
/* 0x08 */ ACTORCAT_MISC,
/* 0x09 */ ACTORCAT_BOSS,
/* 0x0A */ ACTORCAT_DOOR,
/* 0x0B */ ACTORCAT_CHEST
/* 0x0B */ ACTORCAT_CHEST,
/* 0x0C */ ACTORCAT_MAX
} ActorType;
typedef struct {
@@ -310,6 +316,96 @@ typedef struct {
/* 0x0E */ s16 transitionRate;
} ActorAnimationEntryS; // size = 0x10
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unkC;
/* 0x10 */ Color_RGBA8 color;
} TargetContextEntry; // size = 0x14
typedef struct TargetContext {
/* 0x00 */ Vec3f unk0;
/* 0x0C */ Vec3f targetCenterPos;
/* 0x18 */ Color_RGBAf fairyInner;
/* 0x28 */ Color_RGBAf fairyOuter;
/* 0x38 */ Actor* arrowPointedActor;
/* 0x3C */ Actor* targetedActor;
/* 0x40 */ f32 unk40;
/* 0x44 */ f32 unk44;
/* 0x48 */ s16 unk48; // alpha
/* 0x4A */ u8 unk4A;
/* 0x4B */ u8 unk4B;
/* 0x4C */ s8 unk4C;
/* 0x4D */ UNK_TYPE1 pad4D[0x3];
/* 0x50 */ TargetContextEntry unk50[3];
/* 0x8C */ Actor* unk8C;
/* 0x90 */ Actor* bgmEnemy;
/* 0x94 */ Actor* unk_94;
} TargetContext; // size = 0x98
typedef struct {
/* 0x0 */ TexturePtr texture;
/* 0x4 */ s16 x;
/* 0x6 */ s16 y;
/* 0x8 */ u8 width;
/* 0x9 */ u8 height;
/* 0xA */ u8 durationTimer; // how long the title card appears for before fading
/* 0xB */ u8 delayTimer; // how long the title card waits to appear
/* 0xC */ s16 alpha;
/* 0xE */ s16 intensity;
} TitleCardContext; // size = 0x10
typedef struct ActorContext_unk_20C {
/* 0x0 */ s16 id;
/* 0x2 */ s8 isDynamicallyInitialised;
/* 0x4 */ void* ptr;
} ActorContext_unk_20C; // size = 0x8
typedef struct ActorContextFlags {
/* 0x00 */ u32 switches[4]; // First 0x40 are permanent, second 0x40 are temporary
/* 0x10 */ u32 chest;
/* 0x14 */ u32 clearedRoom;
/* 0x18 */ u32 clearedRoomTemp;
/* 0x1C */ u32 collectible[4]; // bitfield of 128 bits
} ActorContextFlags; // size = 0x2C
typedef struct ActorListEntry {
/* 0x0 */ s32 length; // number of actors loaded of this type
/* 0x4 */ Actor* first; // pointer to first actor of this type
/* 0x8 */ s32 unk_08;
} ActorListEntry; // size = 0xC
typedef struct ActorContext {
/* 0x000 */ u8 freezeFlashTimer;
/* 0x001 */ UNK_TYPE1 pad1;
/* 0x002 */ u8 unk2;
/* 0x003 */ u8 unk3;
/* 0x004 */ s8 unk4;
/* 0x005 */ u8 unk5;
/* 0x006 */ UNK_TYPE1 pad6[0x5];
/* 0x00B */ s8 unkB;
/* 0x00C */ s16 unkC;
/* 0x00E */ u8 totalLoadedActors;
/* 0x00F */ u8 undrawnActorCount;
/* 0x010 */ ActorListEntry actorLists[ACTORCAT_MAX];
/* 0x0A0 */ Actor* undrawnActors[32]; // Records the first 32 actors drawn each frame
/* 0x120 */ TargetContext targetContext;
/* 0x1B8 */ ActorContextFlags flags;
/* 0x1E4 */ TitleCardContext titleCtxt;
/* 0x1F4 */ u8 unk1F4;
/* 0x1F5 */ u8 unk1F5;
/* 0x1F6 */ UNK_TYPE1 pad1F6[0x2];
/* 0x1F8 */ f32 unk1F8;
/* 0x1FC */ Vec3f unk1FC;
/* 0x208 */ UNK_TYPE1 unk_208[0x4];
/* 0x20C */ ActorContext_unk_20C unk_20C[8];
/* 0x24C */ UNK_TYPE1 unk_24C[0x4];
/* 0x250 */ void* absoluteSpace; // Space used to allocate actor overlays of alloc type ALLOCTYPE_ABSOLUTE
/* 0x254 */ u32 unk254[5];
/* 0x268 */ u8 unk268;
/* 0x269 */ UNK_TYPE1 pad269[0x3];
/* 0x26C */ Input unk_26C;
} ActorContext; // size = 0x284
typedef enum {
/* 0x000 */ ACTOR_PLAYER,
/* 0x001 */ ACTOR_EN_TEST,
@@ -1004,6 +1100,76 @@ typedef enum {
/* 0x2B2 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX"
} ActorID;
typedef enum {
/* 0 */ DOORLOCK_NORMAL,
/* 1 */ DOORLOCK_BOSS,
/* 2 */ DOORLOCK_2, // DOORLOCK_NORMAL_SPIRIT on OoT
/* 3 */ DOORLOCK_MAX
} DoorLockType;
// Targetability / ACTOR_FLAG_TARGETABLE?
#define ACTOR_FLAG_1 (1 << 0)
//
#define ACTOR_FLAG_2 (1 << 1)
//
#define ACTOR_FLAG_4 (1 << 2)
//
#define ACTOR_FLAG_8 (1 << 3)
//
#define ACTOR_FLAG_10 (1 << 4)
//
#define ACTOR_FLAG_20 (1 << 5)
//
#define ACTOR_FLAG_40 (1 << 6)
// Invisible
#define ACTOR_FLAG_80 (1 << 7)
// Related to talk
#define ACTOR_FLAG_100 (1 << 8)
//
#define ACTOR_FLAG_200 (1 << 9)
//
#define ACTOR_FLAG_400 (1 << 10)
//
#define ACTOR_FLAG_800 (1 << 11)
//
#define ACTOR_FLAG_1000 (1 << 12)
//
#define ACTOR_FLAG_2000 (1 << 13)
//
#define ACTOR_FLAG_4000 (1 << 14)
//
#define ACTOR_FLAG_8000 (1 << 15)
//
#define ACTOR_FLAG_10000 (1 << 16)
//
#define ACTOR_FLAG_20000 (1 << 17)
//
#define ACTOR_FLAG_40000 (1 << 18)
//
#define ACTOR_FLAG_80000 (1 << 19)
//
#define ACTOR_FLAG_100000 (1 << 20)
//
#define ACTOR_FLAG_200000 (1 << 21)
//
#define ACTOR_FLAG_400000 (1 << 22)
//
#define ACTOR_FLAG_800000 (1 << 23)
//
#define ACTOR_FLAG_1000000 (1 << 24)
//
#define ACTOR_FLAG_2000000 (1 << 25)
//
#define ACTOR_FLAG_4000000 (1 << 26)
//
#define ACTOR_FLAG_8000000 (1 << 27)
//
#define ACTOR_FLAG_10000000 (1 << 28)
//
#define ACTOR_FLAG_20000000 (1 << 29)
//
#define ACTOR_FLAG_40000000 (1 << 30)
typedef enum {
/* 0x00 */ CLEAR_TAG_SMALL_EXPLOSION,
/* 0x01 */ CLEAR_TAG_LARGE_EXPLOSION,
+9
View File
@@ -343,6 +343,7 @@ typedef enum {
/* 0x9F */ GI_SHIELD_HERO_2, // Code that treats this as hero's shield is unused, so take with a grain of salt
/* 0xA1 */ GI_LETTER_TO_MAMA = 0xA1,
/* 0xA9 */ GI_BOTTLE = 0xA9,
/* 0xAB */ GI_PENDANT_OF_MEMORIES = 0xAB,
/* 0xBA */ GI_MAX = 0xBA
} GetItemID;
@@ -373,4 +374,12 @@ typedef enum {
/* 0x68 */ GID_SWORD_GREAT_FAIRY
} GetItemDrawID;
// TODO: fill
typedef enum {
/* -1 */ EXCH_ITEM_MINUS1 = -1, // Unknown usage or function
/* 0x00 */ EXCH_ITEM_NONE,
/* 0x1E */ EXCH_ITEM_1E = 0x1E, // BOTTLE_MUSHROOM
/* 0x2A */ EXCH_ITEM_2A = 0x2A // MOON_TEAR?
} ExchangeItemID;
#endif
+11 -10
View File
@@ -1,5 +1,5 @@
#ifndef _Z64PLAYER_H_
#define _Z64PLAYER_H_
#ifndef Z64PLAYER_H
#define Z64PLAYER_H
#include "z64actor.h"
#include "os.h"
@@ -252,7 +252,7 @@ typedef struct Player {
/* 0x32A */ Vec3s morphTable[5];
/* 0x348 */ s16 eyeTexId;
/* 0x34A */ s16 eyeAnimTimer;
/* 0x34C */ Actor* leftHandActor;
/* 0x34C */ Actor* heldActor;
/* 0x350 */ PosRot leftHandWorld;
/* 0x364 */ Actor* rightHandActor;
/* 0x368 */ PosRot rightHandWorld;
@@ -261,12 +261,12 @@ typedef struct Player {
/* 0x37E */ s8 doorTimer;
/* 0x37F */ s8 doorNext; // used with spiral staircase
/* 0x380 */ Actor* doorActor;
/* 0x384 */ s16 unk_384;
/* 0x386 */ u16 unk_386;
/* 0x388 */ Actor* unk_388;
/* 0x38C */ s16 unk_38C;
/* 0x384 */ s16 getItemId;
/* 0x386 */ u16 getItemDirection;
/* 0x388 */ Actor* interactRangeActor;
/* 0x38C */ s8 mountSide;
/* 0x390 */ Actor* rideActor;
/* 0x394 */ u8 unk_394;
/* 0x394 */ u8 csMode;
/* 0x395 */ u8 unk_395;
/* 0x396 */ u8 unk_396;
/* 0x397 */ u8 unk_397;
@@ -289,7 +289,8 @@ typedef struct Player {
/* 0x664 */ ColliderQuad shieldQuad;
/* 0x6E4 */ ColliderCylinder shieldCylinder;
/* 0x730 */ Actor* unk_730;
/* 0x734 */ char unk_734[8];
/* 0x734 */ char unk_734[4];
/* 0x738 */ s32 unk_738;
/* 0x73C */ s32 blureEffectIndex[3];
/* 0x748 */ char unk_748[0x320];
/* 0xA68 */ PlayerAgeProperties* ageProperties; // repurposed as "transformation properties"?
@@ -301,7 +302,7 @@ typedef struct Player {
/* 0xA80 */ Actor* tatlActor;
/* 0xA84 */ s16 tatlTextId;
/* 0xA86 */ s8 unk_A86;
/* 0xA87 */ s8 unk_A87;
/* 0xA87 */ s8 exchangeItemId;
/* 0xA88 */ Actor* targetActor;
/* 0xA8C */ f32 targetActorDistance;
/* 0xA90 */ Actor* unk_A90;
+1 -1
View File
@@ -174,7 +174,7 @@ typedef struct {
/* 0x3F5C */ s32 unk_3F5C; // "bet_rupees"
/* 0x3F60 */ u8 unk_3F60; // "framescale_flag"
/* 0x3F64 */ f32 unk_3F64; // "framescale_scale"
/* 0x3F68 */ u32 unk_3F68[5][120];
/* 0x3F68 */ u32 cycleSceneFlags[120][5];
/* 0x48C8 */ u16 unk_48C8; // "scene_id_mix"
/* 0x48CA */ u8 maskMaskBit[3]; // masks given away on the Moon
/* 0x48CD */ char unk_48CD[24];
+1 -1
View File
@@ -295,7 +295,7 @@ typedef struct {
/* 0x04 */ s16 id;
/* 0x06 */ Vec3s pos;
/* 0x0C */ s16 rotY;
/* 0x0E */ s16 params;
/* 0x0E */ u16 params;
} TransitionActorEntry; // size = 0x10
typedef struct {
-1
View File
@@ -441,7 +441,6 @@ beginseg
include "build/src/code/pad_801DC9C0.o"
include "build/src/code/z_DLF.o"
include "build/src/code/z_actor.o"
include "build/data/code/z_actor.data.o"
include "build/data/code/z_actor.bss.o"
include "build/src/code/z_actor_dlftbls.o"
include "build/src/code/z_bgcheck.o"
+4 -4
View File
@@ -182,7 +182,7 @@ void __osFree(Arena* arena, void* ptr) {
ArenaNode* newNext;
ArenaImpl_Lock(arena);
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode));
if (ptr == NULL || (node->magic != NODE_MAGIC) || node->isFree) {
goto end;
@@ -190,10 +190,10 @@ void __osFree(Arena* arena, void* ptr) {
next = node->next;
prev = node->prev;
node->isFree = 1;
node->isFree = true;
newNext = next;
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
if ((uintptr_t)next == (uintptr_t)node + sizeof(ArenaNode) + node->size && next->isFree) {
newNext = next->next;
if (newNext != NULL) {
newNext->prev = node;
@@ -205,7 +205,7 @@ void __osFree(Arena* arena, void* ptr) {
next = newNext;
}
if (prev != NULL && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) {
if (prev != NULL && prev->isFree && (uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size) {
if (next) {
next->prev = prev;
}

Some files were not shown because too many files have changed in this diff Show More