1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 06:21:16 +00:00

OnePointDemo OK (#719)

* matches

* more matches

* progress?

* it's time

* so close

* organize declarations

* docs

* more fixes

* more fixes

* fix stage 1

* more fixes

* first try

* demo ids in decimal

* final cleanup

* one more thing

* fixes

* more cleanup

* onepointcs

* OnePointCutscene

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
petrie911 2021-03-31 11:18:31 -05:00 committed by GitHub
parent 28cfd82a4f
commit 9b4482314a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
233 changed files with 3949 additions and 7571 deletions

View file

@ -85,13 +85,10 @@ void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
Player* player;
s32 length;
if (this->actor.parent == NULL) {
player = PLAYER;
Player* player = PLAYER;
// get correct timer length for hookshot or longshot
length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f);
@ -125,6 +122,7 @@ void ArmsHook_DetachHookFromActor(ArmsHook* this) {
s32 ArmsHook_CheckForCancel(ArmsHook* this) {
Player* player = (Player*)this->actor.parent;
if (Player_HoldsHookshot(player)) {
if ((player->itemActionParam != player->heldItemActionParam) || ((player->actor.flags & 0x100)) ||
((player->stateFlags1 & 0x4000080))) {
@ -174,40 +172,33 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
func_8002F8F0(&player->actor, NA_SE_IT_HOOKSHOT_CHAIN - SFX_FLAG);
ArmsHook_CheckForCancel(this);
if (this->timer != 0) {
if ((this->collider.base.atFlags & AT_HIT) && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
touchedActor = this->collider.base.at;
if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HOOKABLE) {
ArmsHook_AttachHookToActor(this, touchedActor);
if ((touchedActor->flags & 0x400) == 0x400) {
func_80865044(this);
}
if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) &&
(this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
touchedActor = this->collider.base.at;
if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HOOKABLE) {
ArmsHook_AttachHookToActor(this, touchedActor);
if ((touchedActor->flags & 0x400) == 0x400) {
func_80865044(this);
}
}
this->timer = 0;
Audio_PlaySoundGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
return;
}
}
if (DECR(this->timer) == 0) {
this->timer = 0;
Audio_PlaySoundGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
} else if (DECR(this->timer) == 0) {
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) {
sp94 = Actor_WorldDistXYZToActor(&this->actor, grabbed);
sp90 =
sqrtf(SQ(this->grabbedDistDiff.x) + SQ(this->grabbedDistDiff.y) + SQ(this->grabbedDistDiff.z));
Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos);
if (50.0f < (sp94 - sp90)) {
ArmsHook_DetachHookFromActor(this);
grabbed = NULL;
}
} else if (this->actor.child != NULL) {
sp94 = Actor_WorldDistXYZToActor(&this->actor, grabbed);
sp90 = sqrtf(SQ(this->grabbedDistDiff.x) + SQ(this->grabbedDistDiff.y) + SQ(this->grabbedDistDiff.z));
Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos);
if (50.0f < (sp94 - sp90)) {
ArmsHook_DetachHookFromActor(this);
grabbed = NULL;
}
}
}
@ -219,12 +210,10 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
} else {
if (this->actor.child != NULL) {
velocity = 30.0f;
} else if (grabbed != NULL) {
velocity = 50.0f;
} else {
if (grabbed != NULL) {
velocity = 50.0f;
} else {
velocity = 200.0f;
}
velocity = 200.0f;
}
phi_f16 = bodyDistDiff - velocity;
if (bodyDistDiff <= velocity) {
@ -260,7 +249,6 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
if (ArmsHook_AttachToPlayer(this, player)) {
Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &player->actor.velocity);
player->actor.velocity.y -= 20.0f;
return;
}
}
}
@ -272,34 +260,32 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x);
sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y);
sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z);
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, 1, 1, 1, 1, &bgId) != 0) {
if (func_8002F9EC(globalCtx, &this->actor, poly, bgId, &sp78) == false) {
sp5C = COLPOLY_GET_NORMAL(poly->normal.x);
sp58 = COLPOLY_GET_NORMAL(poly->normal.z);
Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
this->actor.world.pos.x += 10.0f * sp5C;
this->actor.world.pos.z += 10.0f * sp58;
this->timer = 0;
if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId) != 0) {
if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
if (dynaPolyActor != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true,
&bgId) &&
!func_8002F9EC(globalCtx, &this->actor, poly, bgId, &sp78)) {
sp5C = COLPOLY_GET_NORMAL(poly->normal.x);
sp58 = COLPOLY_GET_NORMAL(poly->normal.z);
Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
this->actor.world.pos.x += 10.0f * sp5C;
this->actor.world.pos.z += 10.0f * sp58;
this->timer = 0;
if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) {
if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
if (dynaPolyActor != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
func_80865044(this);
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
return;
}
func_80865044(this);
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
} else {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos);
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_REFLECT, &this->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
return;
}
}
if ((CHECK_BTN_ANY(globalCtx->state.input[0].press.button,
(BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)))) {
} else if ((CHECK_BTN_ANY(globalCtx->state.input[0].press.button,
(BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)))) {
this->timer = 0;
}
}
@ -313,8 +299,8 @@ void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ArmsHook* this = THIS;
u32 pad3;
Player* player = PLAYER;
Vec3f sp78;
Vec3f sp6C;
@ -322,38 +308,36 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
f32 sp5C;
f32 sp58;
if (player->actor.draw != NULL) {
if (player->rightHandType == 15) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850);
if ((player->actor.draw != NULL) && (player->rightHandType == 15)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850);
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
Matrix_MultVec3f(&D_80865B88, &sp6C);
Matrix_MultVec3f(&D_80865B94, &sp60);
this->hookInfo.active = 0;
} else {
Matrix_MultVec3f(&D_80865B7C, &this->unk_1E8);
Matrix_MultVec3f(&D_80865BA0, &sp6C);
Matrix_MultVec3f(&D_80865BAC, &sp60);
}
func_80090480(globalCtx, &this->collider, &this->hookInfo, &sp6C, &sp60);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0602B288);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk_3C8, &this->actor.world.pos, &sp78);
sp58 = SQ(sp78.x) + SQ(sp78.z);
sp5C = sqrtf(sp58);
Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY);
Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY);
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0602AFF0);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913);
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
Matrix_MultVec3f(&D_80865B88, &sp6C);
Matrix_MultVec3f(&D_80865B94, &sp60);
this->hookInfo.active = 0;
} else {
Matrix_MultVec3f(&D_80865B7C, &this->unk_1E8);
Matrix_MultVec3f(&D_80865BA0, &sp6C);
Matrix_MultVec3f(&D_80865BAC, &sp60);
}
func_80090480(globalCtx, &this->collider, &this->hookInfo, &sp6C, &sp60);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0602B288);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk_3C8, &this->actor.world.pos, &sp78);
sp58 = SQ(sp78.x) + SQ(sp78.z);
sp5C = sqrtf(sp58);
Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY);
Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY);
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0602AFF0);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913);
}
}