Arms_Hook OK (#33)

* All but 2 functions matched

* More work on hookshot

* hookshot work

* 2 functions left (and one is almost done)

* sp issues with draw, but matching otherwise

* hookshot matching

* Changed rodata inclusion for armshook

* Hookshot OK

* Resolve script conflicts

* Rename unk variables to match MM standard

* Made requested changes
This commit is contained in:
fullgrowngaming 2020-10-11 16:30:22 -07:00 committed by GitHub
parent 1c4a3047de
commit f927730418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 404 additions and 62 deletions

View File

@ -3,6 +3,13 @@
#include <z64.h>
float fabsf(float f);
#pragma intrinsic(fabsf)
float sqrtf(float f);
#pragma intrinsic(sqrtf)
double sqrt(double d);
#pragma intrinsic(sqrt)
void bootproc(void); // func_80080060
void Idle_ClearMemory(void* begin, void* end); // func_80080150
void Idle_InitFramebuffer(u32* ptr, u32 numBytes, u32 value); // func_80080180
@ -816,14 +823,14 @@ void func_800B8E1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_
void func_800B8E58(void); // func_800B8E58
void func_800B8EC8(Actor* iParm1, u32 uParm2); // func_800B8EC8
void func_800B8EF4(void); // func_800B8EF4
void func_800B8F98(void); // func_800B8F98
void func_800B8F98(Actor* actor, u16 sfxId); // func_800B8F98
void func_800B8FC0(void); // func_800B8FC0
void func_800B8FE8(void); // func_800B8FE8
void func_800B9010(Actor* actor, UNK_TYPE2 uParm2); // func_800B9010
void func_800B9038(void); // func_800B9038
void func_800B9084(void); // func_800B9084
void func_800B9098(Actor* actor); // func_800B9098
void func_800B90AC(void); // func_800B90AC
s32 func_800B90AC(GlobalContext* globalCtx, Actor* actor, UNK_TYPE arg2, UNK_TYPE arg3, UNK_TYPE arg4); // func_800B90AC
void func_800B90F4(void); // func_800B90F4
void func_800B9120(ActorContext* actCtxt); // func_800B9120
void Actor_Init(GlobalContext* ctxt, ActorContext* actCtxt, UNK_TYPE4 uParm3); // func_800B9170
@ -992,10 +999,10 @@ void func_800C4FD4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_
void func_800C5464(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_800C5464
void func_800C54AC(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); // func_800C54AC
void func_800C5538(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); // func_800C5538
void func_800C55C4(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); // func_800C55C4
s32 func_800C55C4(CollisionContext*, Vec3f*, Vec3f*, Vec3f*, BgPolygon**, u32, u32, u32, u32, u32*); // func_800C55C4
void func_800C5650(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_800C5650
void func_800C56E0(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, UNK_TYPE4 param_12); // func_800C56E0
s32 func_800C576C(CollisionContext* bgCtxt, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, UNK_PTR param_5, s32 param_6, s32 param_7, s32 param_8, s32 param_9, UNK_PTR param_10); // func_800C576C
s32 func_800C576C(CollisionContext*, Vec3f*, Vec3f*, Vec3f*, BgPolygon**, u32, u32, u32, u32, u32*); // func_800C576C
void func_800C57F8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_800C57F8
void func_800C583C(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); // func_800C583C
void func_800C58C8(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); // func_800C58C8
@ -1084,7 +1091,7 @@ u32 func_800C9C24(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index, UNK_T
u32 func_800C9C74(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index); // func_800C9C74
u32 func_800C9C9C(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index); // func_800C9C9C
u32 func_800C9CC4(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index); // func_800C9CC4
void func_800C9CEC(void); // func_800C9CEC
u32 func_800C9CEC(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index); // func_800C9CEC
void func_800C9D14(void); // func_800C9D14
void func_800C9D50(void); // func_800C9D50
unsigned int func_800C9D8C(CollisionContext* param_1, BgPolygon* param_2, s32 param_3); // func_800C9D8C
@ -1516,7 +1523,7 @@ void func_800E823C(void); // func_800E823C
void func_800E8318(void); // func_800E8318
void func_800E8478(void); // func_800E8478
void func_800E85D4(UNK_TYPE4 param_1, Vec3f* param_2); // func_800E85D4
void func_800E8668(void); // func_800E8668
void func_800E8668(GlobalContext* globalCtx, Vec3f* arg2); // func_800E8668
void func_800E8690(void); // func_800E8690
void func_800E86C0(void); // func_800E86C0
void func_800E86E0(UNK_TYPE4 param_1, Vec3f* param_2, UNK_TYPE4 param_3); // func_800E86E0
@ -2187,8 +2194,8 @@ UNK_TYPE4 func_80122670(int* param_1, Input* input); // func_80122670
void func_801226E0(void); // func_801226E0
void func_80122744(void); // func_80122744
void func_80122760(void); // func_80122760
void func_80122868(void); // func_80122868
void func_801229A0(void); // func_801229A0
void func_80122868(GlobalContext* globalCtx, ActorPlayer* player); // func_80122868
void func_801229A0(GlobalContext* globalCtx, ActorPlayer* player); // func_801229A0
void func_801229EC(void); // func_801229EC
void func_801229FC(void); // func_801229FC
void func_80122BA4(void); // func_80122BA4
@ -2229,7 +2236,7 @@ u32 func_8012403C(GlobalContext* ctxt); // func_8012403C
void func_8012404C(GlobalContext* ctxt); // func_8012404C
void func_8012405C(void); // func_8012405C
void func_80124088(void); // func_80124088
void func_801240C8(void); // func_801240C8
s32 func_801240C8(ActorPlayer* player); // func_801240C8
void func_801240DC(void); // func_801240DC
void func_80124110(void); // func_80124110
void func_80124148(void); // func_80124148
@ -2261,7 +2268,7 @@ void func_80125CE0(void); // func_80125CE0
void func_80125D4C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_80125D4C
void func_801262C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_801262C8
void func_801263FC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_801263FC
void func_80126440(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_80126440
void func_80126440(GlobalContext* globalCtx, ColCommon* param_2, s32* param_3, Vec3f* param_4, Vec3f* param_5); // func_80126440
void func_801265C8(void); // func_801265C8
void func_8012669C(void); // func_8012669C
void func_80126808(void); // func_80126808
@ -3391,7 +3398,7 @@ s16 atans_first_8th(f32 opposite, f32 adjacent); // func_8017FEB0
s16 atans(f32 opposite, f32 adjacent); // func_8017FEE4
f32 atan(f32 opposite, f32 adjacent); // func_801800CC
s16 atans_flip(f32 adjacent, f32 opposite); // func_80180100
void atan_flip(f32 adjacent, f32 opposite); // func_8018012C
s16 atan_flip(f32 adjacent, f32 opposite); // func_8018012C
void SysMatrix_StateAlloc(GameState* ctxt); // func_80180160
void SysMatrix_StatePush(void); // func_8018019C
void SysMatrix_StatePop(void); // func_801801CC

View File

@ -2023,16 +2023,16 @@ void EnBbfall_Update(void); // func_808C03EC
void func_808C07D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE4 param_6); // func_808C07D4
void func_808C080C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_808C080C
void EnBbfall_Draw(void); // func_808C0A04
void func_808C1030(void); // func_808C1030
void ArmsHook_SetupAction(void); // ArmsHook_SetupAction
void ArmsHook_Init(void); // func_808C103C
void ArmsHook_Destroy(void); // func_808C10B0
void func_808C10F8(void); // func_808C10F8
void ArmsHook_Wait(void); // ArmsHook_Wait
void func_808C1154(void); // func_808C1154
void func_808C1168(void); // func_808C1168
void func_808C1198(void); // func_808C1198
void func_808C11C0(void); // func_808C11C0
void func_808C125C(void); // func_808C125C
void func_808C12A4(void); // func_808C12A4
void ArmsHook_AttachToPlayer(void); // ArmsHook_AttachToPlayer
void ArmsHook_DetachHookFromActor(void); // ArmsHook_DetachHookFromActor
void ArmsHook_CheckForCancel(void); // ArmsHook_CheckForCancel
void ArmsHook_AttachHookToActor(void); // ArmsHook_AttachHookToActor
void ArmsHook_Shoot(void); // ArmsHook_Shoot
void ArmsHook_Update(void); // func_808C18D8
void ArmsHook_Draw(void); // func_808C1918
void EnBb_Init(void); // func_808C1D40

View File

@ -3,6 +3,36 @@
#include <PR/ultratypes.h>
#define CONT_A 0x8000
#define CONT_B 0x4000
#define CONT_G 0x2000
#define CONT_START 0x1000
#define CONT_UP 0x0800
#define CONT_DOWN 0x0400
#define CONT_LEFT 0x0200
#define CONT_RIGHT 0x0100
#define CONT_L 0x0020
#define CONT_R 0x0010
#define CONT_E 0x0008
#define CONT_D 0x0004
#define CONT_C 0x0002
#define CONT_F 0x0001
#define A_BUTTON CONT_A
#define B_BUTTON CONT_B
#define L_TRIG CONT_L
#define R_TRIG CONT_R
#define Z_TRIG CONT_G
#define START_BUTTON CONT_START
#define U_JPAD CONT_UP
#define L_JPAD CONT_LEFT
#define R_JPAD CONT_RIGHT
#define D_JPAD CONT_DOWN
#define U_CBUTTONS CONT_E
#define L_CBUTTONS CONT_C
#define R_CBUTTONS CONT_F
#define D_CBUTTONS CONT_D
typedef struct {
/* 0x00 */ u32 ramarray[15];
/* 0x3C */ u32 pifstatus;

View File

@ -21,6 +21,11 @@
(curState)->nextGameStateInit = (GameStateFunc)newInit; \
(curState)->nextGameStateSize = sizeof(newStruct);
#define PLAYER ((ActorPlayer*)globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].first)
#define SQ(x) ((x)*(x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
extern GraphicsContext* oGfxCtx;
#define OPEN_DISPS(gfxCtx, file, line) \

View File

@ -1787,4 +1787,9 @@ typedef struct {
/* 0x14 */ Gfx* monoDl;
} VisMono; // size = 0x18
typedef enum {
MTXMODE_NEW, // generates a new matrix
MTXMODE_APPLY // applies transformation to the current matrix
} MatrixMode;
#endif

View File

@ -138,7 +138,7 @@ typedef struct Actor {
/* 0x0A0 */ ActorA0 unkA0;
/* 0x0BC */ ActorShape shape;
/* 0x0D4 */ UNK_TYPE1 padD4[0x18];
/* 0x0EC */ Vec3f unkEC;
/* 0x0EC */ Vec3f projectedPos;
/* 0x0F8 */ f32 unkF8;
/* 0x0FC */ f32 unkFC;
/* 0x100 */ f32 unk100;
@ -179,14 +179,19 @@ typedef struct {
typedef struct {
/* 0x000 */ Actor base;
/* 0x144 */ UNK_TYPE1 pad144[0x3];
/* 0x147 */ s8 unk147;
/* 0x148 */ UNK_TYPE1 pad148[0x3];
/* 0x147 */ s8 itemActionParam;
/* 0x148 */ UNK_TYPE1 pad148[0x2];
/* 0x14A */ s8 heldItemActionParam;
/* 0x14B */ u8 unk14B;
/* 0x14C */ UNK_TYPE1 pad14C[0x7];
/* 0x14C */ UNK_TYPE1 pad14C[0x5];
/* 0x151 */ u8 unk151;
/* 0x152 */ UNK_TYPE1 unk152;
/* 0x153 */ u8 unk153;
/* 0x154 */ UNK_TYPE1 pad154[0x1F8];
/* 0x34C */ Actor* unk34C;
/* 0x350 */ UNK_TYPE1 pad350[0x44];
/* 0x34C */ Actor* heldActor;
/* 0x350 */ UNK_TYPE1 pad350[0x18];
/* 0x368 */ Vec3f unk368;
/* 0x374 */ UNK_TYPE1 pad374[0x20];
/* 0x394 */ u8 unk394;
/* 0x395 */ UNK_TYPE1 pad395[0x37];
/* 0x3CC */ s16 unk3CC;
@ -194,7 +199,7 @@ typedef struct {
/* 0x3CF */ UNK_TYPE1 pad3CF[0x361];
/* 0x730 */ Actor* unk730;
/* 0x734 */ UNK_TYPE1 pad734[0x338];
/* 0xA6C */ u32 unkA6C;
/* 0xA6C */ u32 stateFlags1;
/* 0xA70 */ u32 unkA70;
/* 0xA74 */ u32 unkA74;
/* 0xA78 */ UNK_TYPE1 padA78[0x8];

View File

@ -67,6 +67,13 @@ typedef struct {
/* 0x3C */ f32 unk3C;
} ColQuadParams; // size = 0x40
typedef struct {
/* 0x00 */ Vec3f pointA;
/* 0x0C */ Vec3f pointB;
/* 0x18 */ Vec3f pointC;
/* 0x24 */ Vec3f pointD;
} ColQuadParamsInit; // size = 0x30
typedef struct {
/* 0x0 */ Vec3s loc;
/* 0x6 */ s16 radius;
@ -110,8 +117,8 @@ typedef struct {
typedef struct {
/* 0x00 */ ColCommonInit base;
/* 0x08 */ ColBodyInfoInit body;
/* 0x20 */ ColQuadParams params;
} ColQuadInit; // size = 0x60
/* 0x20 */ ColQuadParamsInit params;
} ColQuadInit; // size = 0x50
typedef struct {
/* 0x00 */ ColBodyInfoInit body;

View File

@ -3,6 +3,8 @@
#include <ultra64.h>
#define SHT_MAX 32767.0f
typedef struct {
/* 0x0 */ f32 x;
/* 0x4 */ f32 y;

View File

@ -1312,8 +1312,9 @@ SECTIONS
ovl_Arms_Hook : AT(RomLocation)
{
build/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.o(.text)
build/asm/ovl_Arms_Hook_data.o(.data)
build/asm/ovl_Arms_Hook_rodata.o(.rodata)
build/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.o(.data)
build/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.o(.rodata)
build/src/overlays/actors/ovl_Arms_Hook/z_arms_hook_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -1,5 +1,6 @@
D_04029CB0 = 0x04029CB0;
D_04029CF0 = 0x04029CF0;
D_040008D0 = 0x040008D0;
object_ikana_obj_001100 = 0x06001100;
object_ikana_obj_001228 = 0x06001228;
@ -32,3 +33,6 @@ D_0601F050 = 0x0601F050;
D_06018DA0 = 0x06018DA0;
D_0601EF10 = 0x0601EF10;
D_06018C60 = 0x06018C60;
/* arms_hook */
D_0601D960 = 0x0601D960;

View File

@ -1,7 +1,5 @@
#include <ultra64.h>
#include <global.h>
extern float fabsf(float);
#pragma intrinsic (fabsf)
void EffFootmark_Init(GlobalContext* ctxt) {
EffFootmark* footmark;

View File

@ -1,10 +1,6 @@
#include <ultra64.h>
#include <global.h>
#pragma intrinsic (sqrtf)
extern float fabsf(float);
#pragma intrinsic (fabsf)
void* Lib_bcopy(void* dest, void* src, size_t n) {
_bcopy(src, dest, n);

View File

@ -1,10 +1,6 @@
#include <ultra64.h>
#include <global.h>
#pragma intrinsic (sqrtf)
extern float fabsf(float);
#pragma intrinsic (fabsf)
void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius, u32 type) {
info->type = type;
info->params.posX = posX;

View File

@ -9,7 +9,9 @@ void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx);
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx);
const ActorInit Arms_Hook_InitVars = {
ACTOR_ARMS_HOOK,
ACTORTYPE_ITEMACTION,
@ -21,28 +23,301 @@ const ActorInit Arms_Hook_InitVars = {
(ActorFunc)ArmsHook_Update,
(ActorFunc)ArmsHook_Draw
};
*/
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C1030.asm")
ColQuadInit D_808C1BC0 = {
{ 10, 0x09, 0x00, 0x00, 0x08, 3 },
{ 0x02, { 0x00000080, 0x00, 0x02 }, { 0xF7CFFFFF, 0x00, 0x00 }, 0x05, 0x00, 0x00 },
{ 0 },
};
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/ArmsHook_Init.asm")
Vec3f D_808C1C10 = { 0.0f, 0.0f, 0.0f };
Vec3f D_808C1C1C = { 0.0f, 0.0f, 900.0f };
Vec3f D_808C1C28 = { 0.0f, 500.0f, -3000.0f };
Vec3f D_808C1C34 = { 0.0f, -500.0f, -3000.0f };
Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f };
Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/ArmsHook_Destroy.asm")
extern Gfx D_0601D960[];
extern Gfx D_040008D0[];
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C10F8.asm")
void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C1154.asm")
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C1168.asm")
Collision_InitQuadDefault(globalCtx, &this->collider);
Collision_InitQuadWithData(globalCtx, &this->collider, &this->actor, &D_808C1BC0);
ArmsHook_SetupAction(this, ArmsHook_Wait);
this->unk1E0 = this->actor.currPosRot.pos;
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C1198.asm")
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C11C0.asm")
if (this->grabbed != NULL) {
this->grabbed->flags &= ~0x2000;
}
Collision_FiniQuad(globalCtx, &this->collider);
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C125C.asm")
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
if (this->actor.parent == NULL) {
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_800B6C04(&this->actor, 20.0f);
this->actor.parent = &PLAYER->base;
this->timer = 26;
}
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/func_808C12A4.asm")
void func_808C1154(ArmsHook* this) {
this->actor.child = this->actor.parent;
this->actor.parent->parent = &this->actor;
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/ArmsHook_Update.asm")
s32 ArmsHook_AttachToPlayer(ArmsHook* this, ActorPlayer* player) {
player->base.child = &this->actor;
player->heldActor = &this->actor;
if (this->actor.child != NULL) {
player->base.parent = this->actor.child = NULL;
return 1;
}
return 0;
}
GLOBAL_ASM("asm/non_matchings/ovl_Arms_Hook_0x808C1030/ArmsHook_Draw.asm")
void ArmsHook_DetachHookFromActor(ArmsHook* this) {
if (this->grabbed != NULL) {
this->grabbed->flags &= ~0x2000;
this->grabbed = NULL;
}
}
s32 ArmsHook_CheckForCancel(ArmsHook* this) {
ActorPlayer* player = (ActorPlayer*)this->actor.parent;
if (func_801240C8(player)) {
if ((player->heldItemActionParam != player->itemActionParam) || ((player->base.flags & 0x100)) ||
((player->stateFlags1 & 0x4000080))) {
this->timer = 0;
ArmsHook_DetachHookFromActor(this);
Math_Vec3f_Copy(&this->actor.currPosRot.pos, &player->unk368);
return 1;
}
}
return 0;
}
void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
actor->flags |= 0x2000;
this->grabbed = actor;
Math_Vec3f_Diff(&actor->currPosRot.pos, &this->actor.currPosRot.pos, &this->unk1FC);
}
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
ActorPlayer* player = PLAYER;
if ((this->actor.parent == NULL) || (!func_801240C8(player))) {
ArmsHook_DetachHookFromActor(this);
Actor_MarkForDeath(&this->actor);
return;
}
func_800B8F98(&player->base, 0x100B);
ArmsHook_CheckForCancel(this);
if (this->timer != 0 && (this->collider.base.flagsAT & 2) && (this->collider.body.unk20->unk14 != 4)) {
Actor* touchedActor = this->collider.base.collisionAT;
if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
if (this->collider.body.unk20->unk16 & 4) {
ArmsHook_AttachHookToActor(this, touchedActor);
if ((touchedActor->flags & 0x400) == 0x400) {
func_808C1154(this);
}
}
}
this->timer = 0;
func_8019F1C0(&this->actor.projectedPos, 0x1814);
return;
}
if (DECR(this->timer) == 0) {
Actor* grabbed;
Vec3f bodyDistDiffVec;
Vec3f newPos;
f32 bodyDistDiff;
f32 phi_f16;
s32 pad;
grabbed = this->grabbed;
if (grabbed != NULL) {
if ((grabbed->update == NULL) || (grabbed->flags & 0x2000) != 0x2000) {
grabbed = NULL;
this->grabbed = NULL;
} else {
if (this->actor.child != NULL) {
f32 sp94 = Actor_DistanceBetweenActors(this, grabbed);
f32 sp90 = sqrtf(SQ(this->unk1FC.x) + SQ(this->unk1FC.y) + SQ(this->unk1FC.z));
Math_Vec3f_Diff(&grabbed->currPosRot.pos, &this->unk1FC, &this->actor.currPosRot.pos);
if (50.0f < (sp94 - sp90)) {
ArmsHook_DetachHookFromActor(this);
grabbed = NULL;
}
}
}
}
{
f32 velocity;
bodyDistDiff =
Math_Vec3f_DistXYZAndStoreDiff(&player->unk368, &this->actor.currPosRot.pos, &bodyDistDiffVec);
if (bodyDistDiff < 30.0f) {
velocity = 0.0f;
phi_f16 = 0.0f;
} else {
if (this->actor.child != NULL) {
velocity = 30.0f;
} else {
if (grabbed != NULL) {
velocity = 50.0f;
} else {
velocity = 200.0f;
}
}
phi_f16 = bodyDistDiff - velocity;
if (bodyDistDiff <= velocity) {
phi_f16 = 0.0f;
}
velocity = phi_f16 / bodyDistDiff;
}
newPos.x = bodyDistDiffVec.x * velocity;
newPos.y = bodyDistDiffVec.y * velocity;
newPos.z = bodyDistDiffVec.z * velocity;
}
if (this->actor.child == NULL) {
Math_Vec3f_Sum(&player->unk368, &newPos, &this->actor.currPosRot.pos);
if (grabbed != NULL) {
Math_Vec3f_Sum(&this->actor.currPosRot.pos, &this->unk1FC, &grabbed->currPosRot.pos);
}
} else {
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->base.velocity);
player->base.currPosRot.rot.x =
atans_flip(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
}
if (phi_f16 < 50.0f) {
ArmsHook_DetachHookFromActor(this);
if (phi_f16 == 0.0f) {
ArmsHook_SetupAction(this, ArmsHook_Wait);
if (ArmsHook_AttachToPlayer(this, player)) {
Math_Vec3f_Diff(&this->actor.currPosRot.pos, &player->base.currPosRot.pos, &player->base.velocity);
player->base.velocity.y -= 20.0f;
}
}
}
} else {
BgPolygon* poly;
u32 dynaPolyID;
Vec3f sp78;
Vec3f prevFrameDiff;
Vec3f sp60;
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
Math_Vec3f_Diff(&this->actor.currPosRot.pos, &this->actor.lastPos, &prevFrameDiff);
Math_Vec3f_Sum(&this->unk1E0, &prevFrameDiff, &this->unk1E0);
this->actor.shape.rot.x = atans_flip(this->actor.speedXZ, -this->actor.velocity.y);
sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x);
sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y);
sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z);
if (func_800C55C4(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID) != 0 &&
(func_800B90AC(globalCtx, &this->actor, poly, dynaPolyID, &sp78) == 0 ||
func_800C576C(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID) != 0)) {
f32 sp5C = poly->normal.x * (1 / SHT_MAX);
f32 sp58 = poly->normal.z * (1 / SHT_MAX);
Math_Vec3f_Copy(&this->actor.currPosRot.pos, &sp78);
this->actor.currPosRot.pos.x += 10.0f * sp5C;
this->actor.currPosRot.pos.z += 10.0f * sp58;
this->timer = 1;
if (func_800C9CEC(&globalCtx->colCtx, poly, dynaPolyID)) {
{
DynaPolyActor* dynaPolyActor;
if (dynaPolyID != 0x32 &&
(dynaPolyActor = BgCheck_GetActorOfMesh(&globalCtx->colCtx, dynaPolyID)) != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
}
func_808C1154(this);
func_8019F1C0(&this->actor.projectedPos, 0x1829);
} else {
func_800E8668(globalCtx, &this->actor.currPosRot.pos);
func_8019F1C0(&this->actor.projectedPos, 0x1813);
}
} else {
if ((globalCtx->state.input[0].pressEdge.buttons &
(A_BUTTON | B_BUTTON | R_TRIG | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS))) {
s32 pad;
this->timer = 1;
}
}
}
}
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
this->actionFunc(this, globalCtx);
this->unk1EC = this->unk1E0;
}
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
s32 pad;
ActorPlayer* player = PLAYER;
Vec3f sp68;
Vec3f sp5C;
Vec3f sp50;
f32 sp4C;
f32 sp48;
if (player->base.draw != NULL && player->unk151 == 0xB) {
// OPEN_DISP macro
{
GraphicsContext* sp44 = globalCtx->state.gfxCtx;
f32 f0;
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
SysMatrix_MultiplyVector3fByState(&D_808C1C10, &this->unk1E0);
SysMatrix_MultiplyVector3fByState(&D_808C1C28, &sp5C);
SysMatrix_MultiplyVector3fByState(&D_808C1C34, &sp50);
this->unk1C4 = 0;
} else {
SysMatrix_MultiplyVector3fByState(&D_808C1C1C, &this->unk1E0);
SysMatrix_MultiplyVector3fByState(&D_808C1C40, &sp5C);
SysMatrix_MultiplyVector3fByState(&D_808C1C4C, &sp50);
}
func_80126440(globalCtx, &this->collider.base, &this->unk1C4, &sp5C, &sp50);
func_8012C28C(globalCtx->state.gfxCtx);
func_80122868(globalCtx, player);
gSPMatrix(sp44->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(sp44->polyOpa.p++, D_0601D960);
SysMatrix_InsertTranslation(this->actor.currPosRot.pos.x, this->actor.currPosRot.pos.y,
this->actor.currPosRot.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk368, &this->actor.currPosRot.pos, &sp68);
sp48 = SQ(sp68.x) + SQ(sp68.z);
sp4C = sqrtf(sp48);
SysMatrix_InsertYRotation_s(atans(sp68.x, sp68.z), MTXMODE_APPLY);
SysMatrix_InsertXRotation_s(atans(-sp68.y, sp4C), MTXMODE_APPLY);
f0 = sqrtf(SQ(sp68.y) + sp48);
SysMatrix_InsertScale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
gSPMatrix(sp44->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(sp44->polyOpa.p++, D_040008D0);
func_801229A0(globalCtx, player);
}
}
}

View File

@ -5,9 +5,20 @@
struct ArmsHook;
typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*);
typedef struct ArmsHook {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0xCC];
/* 0x144 */ ColQuad collider;
/* 0x1C4 */ s32 unk1C4;
/* 0x1C8 */ char unk1C8[0x18];
/* 0x1E0 */ Vec3f unk1E0;
/* 0x1EC */ Vec3f unk1EC;
/* 0x1F8 */ Actor* grabbed;
/* 0x1FC */ Vec3f unk1FC;
/* 0x208 */ char unk208[0x2];
/* 0x20A */ s16 timer;
/* 0x20C */ ArmsHookActionFunc actionFunc;
} ArmsHook; // size = 0x210
extern const ActorInit Arms_Hook_InitVars;

View File

@ -47,7 +47,7 @@ void BgFuKaiten_UpdateRotation(BgFuKaiten* this) {
if (this->rotationSpeed > 0)
{
f0 = this->rotationSpeed * .002f;
func_8019FAD8(&this->bg.actor.unkEC, 8310, f0);
func_8019FAD8(&this->bg.actor.projectedPos, 8310, f0);
}
}

View File

@ -6048,16 +6048,16 @@
0x808C07D4:("func_808C07D4",),
0x808C080C:("func_808C080C",),
0x808C0A04:("EnBbfall_Draw",),
0x808C1030:("func_808C1030",),
0x808C1030:("ArmsHook_SetupAction",),
0x808C103C:("ArmsHook_Init",),
0x808C10B0:("ArmsHook_Destroy",),
0x808C10F8:("func_808C10F8",),
0x808C10F8:("ArmsHook_Wait",),
0x808C1154:("func_808C1154",),
0x808C1168:("func_808C1168",),
0x808C1198:("func_808C1198",),
0x808C11C0:("func_808C11C0",),
0x808C125C:("func_808C125C",),
0x808C12A4:("func_808C12A4",),
0x808C1168:("ArmsHook_AttachToPlayer",),
0x808C1198:("ArmsHook_DetachHookFromActor",),
0x808C11C0:("ArmsHook_CheckForCancel",),
0x808C125C:("ArmsHook_AttachHookToActor",),
0x808C12A4:("ArmsHook_Shoot",),
0x808C18D8:("ArmsHook_Update",),
0x808C1918:("ArmsHook_Draw",),
0x808C1D40:("EnBb_Init",),