Decompile code_0x800E8EA0.c

This commit is contained in:
rozlette 2019-12-18 01:31:47 -06:00
parent 82ad58e489
commit 962a957166
7 changed files with 141 additions and 102 deletions

View File

@ -1518,15 +1518,15 @@ void func_800E8690(void); // func_800E8690
void func_800E86C0(void); // func_800E86C0
void func_800E86E0(void); // func_800E86E0
void func_800E8784(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); // func_800E8784
void func_800E8EA0(void); // func_800E8EA0
void func_800E8ED0(void); // func_800E8ED0
void func_800E8EE0(void); // func_800E8EE0
void func_800E8EEC(void); // func_800E8EEC
void func_800E8EFC(void); // func_800E8EFC
void func_800E8F08(void); // func_800E8F08
void func_800E8FA4(void); // func_800E8FA4
void func_800E9138(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_800E9138
void func_800E9250(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // func_800E9250
void func_800E8EA0(GlobalContext* ctxt, Actor* actor, u16 param_3); // func_800E8EA0
s32 nop_800E8ED0(UNK_TYPE4 param_1); // func_800E8ED0
void nop_800E8EE0(UNK_TYPE4 param_1); // func_800E8EE0
s32 nop_800E8EEC(UNK_TYPE4 param_1); // func_800E8EEC
void nop_800E8EFC(UNK_TYPE4 param_1); // func_800E8EFC
s32 func_800E8F08(Vector3s* param_1, Vector3s* param_2); // func_800E8F08
s32 func_800E8FA4(Actor* actor, Vector3f* param_2, Vector3s* param_3, Vector3s* param_4); // func_800E8FA4
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, f32 param_5); // func_800E9138
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, Vector3f param_5); // func_800E9250
void func_800E9360(void); // func_800E9360
void static_context_init(void); // func_800E93E0
void func_800E9470(void); // func_800E9470
@ -1834,8 +1834,8 @@ f32 Lib_DistanceXZVec3f(Vector3f* a, Vector3f* b); // func_800FF92C
f32 Lib_DistanceAndDifferenceXZVec3f(Vector3f* a, Vector3f* b, f32* xDiff, f32* zDiff); // func_800FF960
f32 Lib_PushAwayXZVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach); // func_800FF9A4
f32 Lib_DistanceYVec3f(Vector3f* a, Vector3f* b); // func_800FFA4C
s32 Lib_YawVec3f(Vector3f* from, Vector3f* to); // func_800FFA60
s32 Lib_PitchVec3f(Vector3f* from, Vector3f* to); // func_800FFA94
s16 Lib_YawVec3f(Vector3f* from, Vector3f* to); // func_800FFA60
s16 Lib_PitchVec3f(Vector3f* from, Vector3f* to); // func_800FFA94
void Lib_ApplyActorInitVars(Actor* actor, ActorInitVar* init); // func_800FFADC
void Lib_ApplyActorInitVarByte1(u8* actor, ActorInitVar* init); // func_800FFB54
void Lib_ApplyActorInitVarByte2(u8* actor, ActorInitVar* init); // func_800FFB70
@ -2833,7 +2833,7 @@ void func_80150A84(void); // func_80150A84
void func_80150D08(GlobalContext* ctxt, unsigned int uParm2); // func_80150D08
void func_801514B0(void); // func_801514B0
void func_801518B0(GlobalContext* ctxt, u32 uParm2, UNK_TYPE4 uParm3); // func_801518B0
void func_80151938(void); // func_80151938
void func_80151938(GlobalContext* ctxt, u16 param_2); // func_80151938
void func_80151A68(void); // func_80151A68
void func_80151BB4(s32 iParm1, u32 uParm2); // func_80151BB4
void func_80151C9C(void); // func_80151C9C
@ -3328,9 +3328,9 @@ void func_8017FAA8(void); // func_8017FAA8
void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); // func_8017FB1C
void func_8017FD44(void); // func_8017FD44
s16 atans_first_8th(f32 opposite, f32 adjacent); // func_8017FEB0
s32 atans(f32 opposite, f32 adjacent); // func_8017FEE4
s16 atans(f32 opposite, f32 adjacent); // func_8017FEE4
f32 atan(f32 opposite, f32 adjacent); // func_801800CC
s32 atans_flip(f32 adjacent, f32 opposite); // func_80180100
s16 atans_flip(f32 adjacent, f32 opposite); // func_80180100
void atan_flip(f32 adjacent, f32 opposite); // func_8018012C
void SysMatrix_StateAlloc(ContextCommon* ctxt); // func_80180160
void SysMatrix_StatePush(void); // func_8018019C

View File

@ -705,33 +705,6 @@ typedef struct {
/* 0x7DC */ UNK_TYPE1 pad7DC[108];
} s80083BC4;
typedef struct {
/* 0x00 */ UNK_TYPE4 unk0;
/* 0x04 */ UNK_TYPE4 unk4;
/* 0x08 */ UNK_TYPE4 unk8;
/* 0x0C */ UNK_TYPE1 padC[92];
/* 0x68 */ f32 unk68;
/* 0x6C */ f32 unk6C;
/* 0x70 */ f32 unk70;
/* 0x74 */ u16 unk74;
/* 0x76 */ u16 unk76;
/* 0x78 */ u16 unk78;
/* 0x7A */ UNK_TYPE1 pad7A[2];
/* 0x7C */ f32 unk7C;
/* 0x80 */ f32 unk80;
/* 0x84 */ f32 unk84;
/* 0x88 */ f32 unk88;
/* 0x8C */ f32 unk8C;
/* 0x90 */ f32 unk90;
/* 0x94 */ u16 unk94;
/* 0x96 */ u16 unk96;
/* 0x98 */ u16 unk98;
/* 0x9A */ UNK_TYPE1 pad9A[2];
/* 0x9C */ f32 unk9C;
/* 0xA0 */ f32 unkA0;
/* 0xA4 */ f32 unkA4;
} s800CAAD0;
typedef struct {
/* 0x00 */ UNK_TYPE1 pad0[32];
} s800E03A0;

View File

@ -219,7 +219,7 @@ SECTIONS
build/src/code/code_0x800E03A0.o(.text)
. += 0x10; /* XXX pad with NOPs*/
build/asm/z_collision_check.o(.text)
build/asm/code_0x800E8EA0.o(.text)
build/src/code/code_0x800E8EA0.o(.text)
build/asm/code_0x800E9360.o(.text)
build/asm/z_debug.o(.text)
build/asm/z_debug_display.o(.text)

110
src/code/code_0x800E8EA0.c Normal file
View File

@ -0,0 +1,110 @@
#include <ultra64.h>
#include <global.h>
void func_800E8EA0(GlobalContext* ctxt, Actor* actor, u16 param_3) {
func_80151938(ctxt, param_3);
actor->textId = param_3;
}
s32 nop_800E8ED0(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EE0(UNK_TYPE4 param_1) {}
s32 nop_800E8EEC(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EFC(UNK_TYPE4 param_1) {}
s32 func_800E8F08(Vector3s* param_1, Vector3s* param_2) {
Lib_ScaleMaxMin_s(&param_1->y, 0, 6, 6200, 100);
Lib_ScaleMaxMin_s(&param_1->x, 0, 6, 6200, 100);
Lib_ScaleMaxMin_s(&param_2->y, 0, 6, 6200, 100);
Lib_ScaleMaxMin_s(&param_2->x, 0, 6, 6200, 100);
return 1;
}
s32 func_800E8FA4(Actor* actor, Vector3f* param_2, Vector3s* param_3, Vector3s* param_4) {
s16 targetPitch;
s16 targetYaw;
s16 yawDiffFromTarget;
targetPitch = Lib_PitchVec3f(&actor->unk3C.pos,param_2);
targetYaw = Lib_YawVec3f(&actor->unk3C.pos,param_2) - actor->unk24.rot.y;
Lib_ScaleMaxMin_s(&param_3->x, targetPitch, 6, 2000, 1);
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
yawDiffFromTarget = Lib_ScaleMaxMin_s(&param_3->y, targetYaw, 6, 2000, 1);
param_3->y = (param_3->y < -8000)? -8000 : ((8000 < param_3->y)? 8000 : param_3->y);
if (yawDiffFromTarget != 0) {
if ((param_3->y < 0? -param_3->y : param_3->y) < 8000) {
return 0;
}
}
Lib_ScaleMaxMin_s(&param_4->y, targetYaw - param_3->y, 4, 2000, 1);
param_4->y = (param_4->y < -12000)? -12000 : ((12000 < param_4->y)? 12000 : param_4->y);
return 1;
}
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, f32 param_5) {
s16 sVar3;
Actor *player;
Vector3f local_14;
player = (ctxt->actorContext).actorTypeLists[2].head;
actor->unk3C.pos = actor->unk24.pos;
actor->unk3C.pos.y += param_5;
if (((ctxt->cutsceneContext).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->unk92 - actor->postDrawParams.rotation.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
return 0;
}
}
if (((ctxt->cutsceneContext).state != 0) || (D_801D0D50 != 0)) {
local_14 = ctxt->view.eye;
} else {
local_14 = player->unk3C.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
return 1;
}
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, Vector3f param_5) {
s16 sVar3;
Actor *player;
Vector3f local_14;
player = (ctxt->actorContext).actorTypeLists[2].head;
actor->unk3C.pos = param_5;
if (((ctxt->cutsceneContext).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->unk92 - actor->postDrawParams.rotation.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
return 0;
}
}
if (((ctxt->cutsceneContext).state != 0) || (D_801D0D50 != 0)) {
local_14 = ctxt->view.eye;
} else {
local_14 = player->unk3C.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
return 1;
}

View File

@ -1,44 +0,0 @@
#include <ultra64.h>
#include <global.h>
void func_800E8EA0(z_GlobalContext* a0, z_Actor* a1, u16 a2) {
func_80151938(a0, a2);
a1->unk116 = a2;
}
UNK_TYPE func_800E8ED0(UNK_TYPE a0) {
return 0;
}
void func_800E8EE0(UNK_TYPE a0) {
return;
}
UNK_TYPE func_800E8EEC(UNK_TYPE a0) {
return 0;
}
void func_800E8EFC(UNK_TYPE a0) {
return;
}
UNK_TYPE func_800E8F08(s16* a0, s16* a1) {
func_800FFEBC(a0 + 1, 0, 6, 6200, 100);
func_800FFEBC(a1 , 0, 6, 6200, 100);
func_800FFEBC(a0 + 1, 0, 6, 6200, 100);
func_800FFEBC(a1 , 0, 6, 6200, 100);
return 1;
}
UNK_RET func_800E8FA4(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3) {
}
UNK_RET func_800E9138(UNK_ARGS) {
}
UNK_RET func_800E9250(UNK_ARGS) {
}

View File

@ -409,13 +409,13 @@ f32 Lib_DistanceYVec3f(Vector3f* a, Vector3f* b) {
return b->y - a->y;
}
s32 Lib_YawVec3f(Vector3f* from, Vector3f* to) {
s16 Lib_YawVec3f(Vector3f* from, Vector3f* to) {
f32 f14 = to->x - from->x;
f32 f12 = to->z - from->z;
return atans_flip(f12, f14);
}
s32 Lib_PitchVec3f(Vector3f* from, Vector3f* to) {
s16 Lib_PitchVec3f(Vector3f* from, Vector3f* to) {
return atans_flip(Lib_DistanceXZVec3f(from, to), from->y - to->y);
}

View File

@ -1507,15 +1507,15 @@
0x800E86C0:("func_800E86C0","void","void"),
0x800E86E0:("func_800E86E0","void","void"),
0x800E8784:("func_800E8784","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8"),
0x800E8EA0:("func_800E8EA0","void","void"),
0x800E8ED0:("func_800E8ED0","void","void"),
0x800E8EE0:("func_800E8EE0","void","void"),
0x800E8EEC:("func_800E8EEC","void","void"),
0x800E8EFC:("func_800E8EFC","void","void"),
0x800E8F08:("func_800E8F08","void","void"),
0x800E8FA4:("func_800E8FA4","void","void"),
0x800E9138:("func_800E9138","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5"),
0x800E9250:("func_800E9250","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7"),
0x800E8EA0:("func_800E8EA0","void","GlobalContext* ctxt, Actor* actor, u16 param_3"),
0x800E8ED0:("nop_800E8ED0","s32","UNK_TYPE4 param_1"),
0x800E8EE0:("nop_800E8EE0","void","UNK_TYPE4 param_1"),
0x800E8EEC:("nop_800E8EEC","s32","UNK_TYPE4 param_1"),
0x800E8EFC:("nop_800E8EFC","void","UNK_TYPE4 param_1"),
0x800E8F08:("func_800E8F08","s32","Vector3s* param_1, Vector3s* param_2"),
0x800E8FA4:("func_800E8FA4","s32","Actor* actor, Vector3f* param_2, Vector3s* param_3, Vector3s* param_4"),
0x800E9138:("func_800E9138","s32","GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, f32 param_5"),
0x800E9250:("func_800E9250","s32","GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, Vector3f param_5"),
0x800E9360:("func_800E9360","void","void"),
0x800E93E0:("static_context_init","void","void"),
0x800E9470:("func_800E9470","void","void"),
@ -1823,8 +1823,8 @@
0x800FF960:("Lib_DistanceAndDifferenceXZVec3f","f32","Vector3f* a, Vector3f* b, f32* xDiff, f32* zDiff"),
0x800FF9A4:("Lib_PushAwayXZVec3f","f32","Vector3f* start, Vector3f* pusher, f32 distanceToApproach"),
0x800FFA4C:("Lib_DistanceYVec3f","f32","Vector3f* a, Vector3f* b"),
0x800FFA60:("Lib_YawVec3f","s32","Vector3f* from, Vector3f* to"),
0x800FFA94:("Lib_PitchVec3f","s32","Vector3f* from, Vector3f* to"),
0x800FFA60:("Lib_YawVec3f","s16","Vector3f* from, Vector3f* to"),
0x800FFA94:("Lib_PitchVec3f","s16","Vector3f* from, Vector3f* to"),
0x800FFADC:("Lib_ApplyActorInitVars","void","Actor* actor, ActorInitVar* init"),
0x800FFB54:("Lib_ApplyActorInitVarByte1","void","u8* actor, ActorInitVar* init"),
0x800FFB70:("Lib_ApplyActorInitVarByte2","void","u8* actor, ActorInitVar* init"),
@ -2822,7 +2822,7 @@
0x80150D08:("func_80150D08","void","GlobalContext* ctxt, unsigned int uParm2"),
0x801514B0:("func_801514B0","void","void"),
0x801518B0:("func_801518B0","void","GlobalContext* ctxt, u32 uParm2, UNK_TYPE4 uParm3"),
0x80151938:("func_80151938","void","void"),
0x80151938:("func_80151938","void","GlobalContext* ctxt, u16 param_2"),
0x80151A68:("func_80151A68","void","void"),
0x80151BB4:("func_80151BB4","void","s32 iParm1, u32 uParm2"),
0x80151C9C:("func_80151C9C","void","void"),
@ -3317,9 +3317,9 @@
0x8017FB1C:("func_8017FB1C","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11"),
0x8017FD44:("func_8017FD44","void","void"),
0x8017FEB0:("atans_first_8th","s16","f32 opposite, f32 adjacent"),
0x8017FEE4:("atans","s32","f32 opposite, f32 adjacent"),
0x8017FEE4:("atans","s16","f32 opposite, f32 adjacent"),
0x801800CC:("atan","f32","f32 opposite, f32 adjacent"),
0x80180100:("atans_flip","s32","f32 adjacent, f32 opposite"),
0x80180100:("atans_flip","s16","f32 adjacent, f32 opposite"),
0x8018012C:("atan_flip","void","f32 adjacent, f32 opposite"),
0x80180160:("SysMatrix_StateAlloc","void","ContextCommon* ctxt"),
0x8018019C:("SysMatrix_StatePush","void","void"),