1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

Misc 1: Retail Overlay Actors OK (#1703)

This commit is contained in:
engineer124 2024-02-08 05:46:51 +11:00 committed by GitHub
parent 92203011b8
commit 563f717bc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 74 additions and 54 deletions

View file

@ -139,25 +139,6 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
Actor* touchedActor;
Actor* grabbed;
Vec3f bodyDistDiffVec;
Vec3f newPos;
f32 bodyDistDiff;
f32 phi_f16;
DynaPolyActor* dynaPolyActor;
f32 curGrabbedDist;
f32 grabbedDist;
s32 pad;
CollisionPoly* poly;
s32 bgId;
Vec3f intersectPos;
Vec3f prevFrameDiff;
Vec3f sp60;
f32 polyNormalX;
f32 polyNormalZ;
f32 velocity;
s32 pad1;
if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) { if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) {
ArmsHook_DetachHookFromActor(this); ArmsHook_DetachHookFromActor(this);
@ -170,7 +151,8 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) && if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) &&
(this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) { (this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) {
touchedActor = this->collider.base.at; Actor* touchedActor = this->collider.base.at;
if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) { if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) {
if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) { if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) {
ArmsHook_AttachHookToActor(this, touchedActor); ArmsHook_AttachHookToActor(this, touchedActor);
@ -182,7 +164,20 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
this->timer = 0; this->timer = 0;
Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else if (DECR(this->timer) == 0) { return;
}
if (DECR(this->timer) == 0) {
Actor* grabbed;
Vec3f bodyDistDiffVec;
Vec3f newPos;
f32 bodyDistDiff;
f32 phi_f16;
s32 pad1;
f32 curGrabbedDist;
f32 grabbedDist;
f32 velocity;
grabbed = this->grabbed; grabbed = this->grabbed;
if (grabbed != NULL) { if (grabbed != NULL) {
if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) { if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) {
@ -250,6 +245,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
} }
} }
} else { } else {
CollisionPoly* poly;
s32 bgId;
Vec3f intersectPos;
Vec3f prevFrameDiff;
Vec3f sp60;
Actor_MoveXZGravity(&this->actor); Actor_MoveXZGravity(&this->actor);
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff); Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8); Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8);
@ -260,13 +261,17 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true, if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true,
&bgId) && &bgId) &&
!func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) { !func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) {
polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); f32 polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x);
polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); f32 polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z);
s32 pad;
Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos); Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos);
this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.x += 10.0f * polyNormalX;
this->actor.world.pos.z += 10.0f * polyNormalZ; this->actor.world.pos.z += 10.0f * polyNormalZ;
this->timer = 0; this->timer = 0;
if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) { if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) {
DynaPolyActor* dynaPolyActor;
if (bgId != BGCHECK_SCENE) { if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) { if (dynaPolyActor != NULL) {
@ -308,6 +313,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) {
OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850); OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850);
if (1) {}
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
Matrix_MultVec3f(&D_80865B88, &hookNewTip); Matrix_MultVec3f(&D_80865B88, &hookNewTip);

View file

@ -90,17 +90,21 @@ static InitChainEntry sInitChain[] = {
static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f };
void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s16 pad1; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s16 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) {

View file

@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
} }
if (givingReward) { if (givingReward) {
if (!IS_CUTSCENE_LAYER) { if (!IS_CUTSCENE_LAYER || !OOT_DEBUG) {
if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
switch (this->fountainType) { switch (this->fountainType) {
case FAIRY_SPELL_FARORES_WIND: case FAIRY_SPELL_FARORES_WIND:

View file

@ -97,12 +97,11 @@ void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) {
void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
Actor* prop; Actor* prop;
BgGanonOtyuka* platform; s16 i;
f32 dx; f32 dx;
f32 dy; f32 dy;
f32 dz; f32 dz;
Vec3f center; Vec3f center;
s16 i;
if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) {
PRINTF("OTC O 1\n"); PRINTF("OTC O 1\n");
@ -113,20 +112,19 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) {
prop = prop->next; prop = prop->next;
continue; continue;
}
platform = (BgGanonOtyuka*)prop;
dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x;
dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y;
dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z;
if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) {
platform->visibleSides |= sSides[i];
break;
} else { } else {
prop = prop->next; BgGanonOtyuka* platform = (BgGanonOtyuka*)prop;
dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x;
dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y;
dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z;
if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) {
platform->visibleSides |= sSides[i];
break;
}
} }
prop = prop->next;
} }
} }

View file

@ -125,15 +125,18 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) {
} else if ((this->unk_198 % 6) == 0) { } else if ((this->unk_198 % 6) == 0) {
s32 i; s32 i;
s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
s16 temp_1;
f32 temp_3;
f32 temp_4;
f32 distXZ;
vecA.y = 0.0f; vecA.y = 0.0f;
vecB.y = thisx->world.pos.y; vecB.y = thisx->world.pos.y;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2; temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
f32 temp_3 = Math_SinS(temp_1); temp_3 = Math_SinS(temp_1);
f32 temp_4 = Math_CosS(temp_1); temp_4 = Math_CosS(temp_1);
f32 distXZ;
vecB.x = thisx->world.pos.x + (120.0f * temp_3); vecB.x = thisx->world.pos.x + (120.0f * temp_3);
vecB.z = thisx->world.pos.z + (120.0f * temp_4); vecB.z = thisx->world.pos.z + (120.0f * temp_4);

View file

@ -315,8 +315,6 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) {
if (this->vFlameScale > 0) { if (this->vFlameScale > 0) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716); OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716);
if (1) {}
Gfx_SetupDL_25Xlu(play->state.gfxCtx); Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08, gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0,
@ -327,6 +325,9 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) {
Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY);
scale = this->vFlameScale * 0.00001f; scale = this->vFlameScale * 0.00001f;
if (1) {}
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744), gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -85,14 +85,14 @@ void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) {
} }
void func_8087DB24(BgHakaMegane* this, PlayState* play) { void func_8087DB24(BgHakaMegane* this, PlayState* play) {
CollisionHeader* colHeader;
CollisionHeader* collision;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.objectSlot = this->requiredObjectSlot;
this->dyna.actor.draw = BgHakaMegane_Draw; this->dyna.actor.draw = BgHakaMegane_Draw;
Actor_SetObjectDependency(play, &this->dyna.actor); Actor_SetObjectDependency(play, &this->dyna.actor);
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
CollisionHeader* colHeader;
CollisionHeader* collision;
this->actionFunc = func_8087DBF0; this->actionFunc = func_8087DBF0;
collision = sCollisionHeaders[this->dyna.actor.params]; collision = sCollisionHeaders[this->dyna.actor.params];
if (collision != NULL) { if (collision != NULL) {

View file

@ -199,7 +199,11 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) {
f32 angleTemp; f32 angleTemp;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528); OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528);
Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Opa(play->state.gfxCtx);
if (1) {}
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534), gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -220,7 +224,9 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910);
} }
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568); CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568);
if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) {
s32 pad; s32 pad;
Vec3f sp2C; Vec3f sp2C;

View file

@ -352,6 +352,7 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
f32 floorHeight; f32 floorHeight;
f32 yIntersect; f32 yIntersect;
s32 i; s32 i;
s32 bgId;
this->dyna.actor.velocity.y *= 1.6f; this->dyna.actor.velocity.y *= 1.6f;
@ -366,8 +367,6 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
floorHeight = this->dyna.actor.floorHeight; floorHeight = this->dyna.actor.floorHeight;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
s32 bgId;
yIntersect = yIntersect =
BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) - BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) -
25.0f; 25.0f;

View file

@ -490,6 +490,8 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904); OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904);
if (1) {}
if (BgHeavyBlock_LiftedUp == this->actionFunc) { if (BgHeavyBlock_LiftedUp == this->actionFunc) {
Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z,
&thisx->shape.rot); &thisx->shape.rot);

View file

@ -86,11 +86,12 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) {
this->treasureFlag = (thisx->params >> 6) & 0x3F; this->treasureFlag = (thisx->params >> 6) & 0x3F;
thisx->params &= 0x3F; thisx->params &= 0x3F;
if ((this->actor.params < 0) || (this->actor.params > 0x3F)) { if (OOT_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) {
// "Save bit is not set" // "Save bit is not set"
PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c",
373, this->actor.params); 373, this->actor.params);
} }
Actor_SetScale(&this->actor, hcParams->scale); Actor_SetScale(&this->actor, hcParams->scale);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);

View file

@ -58,8 +58,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE };
void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { void BgHidanFirewall_Init(Actor* thisx, PlayState* play) {
BgHidanFirewall* this = (BgHidanFirewall*)thisx; BgHidanFirewall* this = (BgHidanFirewall*)thisx;
this->actor.scale.x = 0.12f; this->actor.scale.x = this->actor.scale.z = 0.12f;
this->actor.scale.z = 0.12f;
this->actor.scale.y = 0.01f; this->actor.scale.y = 0.01f;
this->unk_150 = 0; this->unk_150 = 0;