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

Decompile z_play.c and Match/Document some of z_view.c (#74)

* Decompile z_play.c and Match/Document some of z_view.c

Also fix the last non matching in z_sample.c and update some game state functions.

* Suggestions from PR #74

* Fix undefined reference to Gameplay_DrawOverlay

* Suggestion from PR #74 (2)

* Fix a fake argument in func_800BC450
This commit is contained in:
Roman971 2020-04-16 23:36:12 +02:00 committed by GitHub
parent 9ac1f8130d
commit 262f6c507c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
278 changed files with 5139 additions and 5939 deletions

View file

@ -5,6 +5,7 @@
*/
#include "z_arrow_fire.h"
#include "../ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x02000010
@ -53,14 +54,14 @@ void ArrowFire_Init(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Destroy(ArrowFire* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
// Translates to: "Disappearance"
LOG_STRING("消滅", "../z_arrow_fire.c", 421);
}
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) {
EnArrow* arrow;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -147,7 +148,7 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
f32 distanceScaled;
s32 pad;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -194,7 +195,7 @@ void ArrowFire_Draw(ArrowFire* this, GlobalContext* globalCtx) {
Gfx* dispRefs[4];
stateFrames = globalCtx->state.frames;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if (1) {}
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {

View file

@ -5,6 +5,7 @@
*/
#include "z_arrow_ice.h"
#include "../ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x02000010
@ -53,14 +54,14 @@ void ArrowIce_Init(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Destroy(ArrowIce* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
// Translates to: "Disappearance"
LOG_STRING("消滅", "../z_arrow_ice.c", 415);
}
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {
EnArrow* arrow;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -147,7 +148,7 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
f32 distanceScaled;
s32 pad;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -194,7 +195,7 @@ void ArrowIce_Draw(ArrowIce* this, GlobalContext* globalCtx) {
Gfx* dispRefs[4];
stateFrames = globalCtx->state.frames;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if (1) {}
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {

View file

@ -5,6 +5,7 @@
*/
#include "z_arrow_light.h"
#include "../ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x02000010
@ -53,14 +54,14 @@ void ArrowLight_Init(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Destroy(ArrowLight* this, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
// Translates to: ""Disappearance" = Disappearance"
// Translates to: "Disappearance"
LOG_STRING("消滅", "../z_arrow_light.c", 403);
}
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) {
EnArrow* arrow;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -147,7 +148,7 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
f32 distanceScaled;
s32 pad;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
Actor_Kill(&this->actor);
return;
@ -194,7 +195,7 @@ void ArrowLight_Draw(ArrowLight* this, GlobalContext* globalCtx) {
Gfx* dispRefs[4];
stateFrames = globalCtx->state.frames;
arrow = this->actor.attachedA;
arrow = (EnArrow*)this->actor.attachedA;
if (1) {}
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {

View file

@ -69,7 +69,7 @@ s32 BgBdanObjects_GetContactRu1(BgBdanObjects* this, s32 arg1) {
case 0:
return this->unk_1B8 == 1;
case 4:
return gSaveContext.inf_table[20] & 0x40;
return gSaveContext.infTable[20] & 0x40;
case 3:
return this->unk_1B8 == 4;
default:
@ -87,7 +87,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) {
this->unk_1B8 = 3;
break;
case 4:
gSaveContext.inf_table[20] |= 0x40;
gSaveContext.infTable[20] |= 0x40;
break;
default:
osSyncPrintf("Bg_Bdan_Objects_Set_Contact_Ru1\nそんな送信モードは無い%d!!!!!!!!\n");
@ -185,7 +185,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
if ((!func_800BFC84(globalCtx)) && (!BgBdanObjects_GetContactRu1(this, 0))) {
if (!Gameplay_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) {
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y + -79.0f;
} else {
this->dyna.actor.posRot.pos.y = (this->dyna.actor.initPosRot.pos.y + -79.0f) - 5.0f;
@ -218,7 +218,7 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_16A != 0) {
this->unk_16A -= 1;
if (this->unk_16A == 0) {
temp = Quake_Add(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 1);
temp = Quake_Add(globalCtx->cameraPtrs[globalCtx->activeCamera], 1);
Quake_SetSpeed(temp, 0x3A98);
Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
Quake_SetCountdown(temp, 0xA);
@ -232,7 +232,7 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
BgBdanObjects_SetContactRu1(this, 4);
this->unk_16A = 0xA;
this->actionFunc = (ActorFunc)func_8086C55C;
func_8005B1A4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]);
func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamera]);
}
}
@ -345,13 +345,13 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
}
if (this->unk_168 == 0) {
if (func_8004356C(&this->dyna.actor)) {
this->unk_1B8 = globalCtx->cameraCtx.activeCameraPtrs[0]->unk_142;
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x3A);
func_8005AD1C(globalCtx->cameraCtx.activeCameraPtrs[0], 4);
this->unk_1B8 = globalCtx->cameraPtrs[0]->unk_142;
func_8005A77C(globalCtx->cameraPtrs[0], 0x3A);
func_8005AD1C(globalCtx->cameraPtrs[0], 4);
this->unk_168 = 0xAU;
}
} else {
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x3A);
func_8005A77C(globalCtx->cameraPtrs[0], 0x3A);
if (!func_8004356C(&this->dyna.actor)) {
if (this->unk_168 != 0) {
this->unk_168 -= 1;
@ -360,8 +360,8 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_168 == 0) {
do {
} while (0);
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], (s16)this->unk_1B8);
func_8005ACFC(globalCtx->cameraCtx.activeCameraPtrs[0], 4);
func_8005A77C(globalCtx->cameraPtrs[0], (s16)this->unk_1B8);
func_8005ACFC(globalCtx->cameraPtrs[0], 4);
}
}
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y -

View file

@ -6,6 +6,8 @@
#include "z_bg_bom_guard.h"
#include "../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h"
#include <vt.h>
#define FLAGS 0x00000010

View file

@ -4,8 +4,6 @@
#include <ultra64.h>
#include <global.h>
#include "../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h"
typedef struct {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ ActorFunc actionFunc;

View file

@ -46,7 +46,7 @@ void BgGateShutter_Init(BgGateShutter* this, GlobalContext* globalCtx) {
this->somePosX = thisx->posRot.pos.x;
this->somePosY = thisx->posRot.pos.y;
this->somePosZ = thisx->posRot.pos.z;
if ((gSaveContext.inf_table[7] & 0x40) || (gSaveContext.event_chk_inf[4] & 0x20)) {
if ((gSaveContext.infTable[7] & 0x40) || (gSaveContext.eventChkInf[4] & 0x20)) {
if (globalCtx->sceneNum == SCENE_SPOT01) {
thisx->posRot.pos.x = -89.0f;
thisx->posRot.pos.z = -1375.0f;
@ -65,7 +65,7 @@ void BgGateShutter_Destroy(BgGateShutter* this, GlobalContext* globalCtx) {
}
void func_8087828C(BgGateShutter* this, GlobalContext* globalCtx) {
if (this->unk_168 == 1 && !(gSaveContext.inf_table[7] & 0x40)) {
if (this->unk_168 == 1 && !(gSaveContext.infTable[7] & 0x40)) {
this->unk_178 = 2;
this->actionFunc = (ActorFunc)func_80878300;
} else if (this->unk_168 == 2) {

View file

@ -52,7 +52,7 @@ void BgGjyoBridge_Init(BgGjyoBridge* this, GlobalContext* globalCtx) {
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, dynaCollisionContext, this, local_c);
if (gSaveContext.event_chk_inf[4] & 0x2000) {
if (gSaveContext.eventChkInf[4] & 0x2000) {
this->actionFunc = func_808787A4;
} else {
this->dyna.actor.draw = NULL;
@ -71,13 +71,13 @@ void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx) {
void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((gBitFlags[3] & gSaveContext.quest_items) && (gBitFlags[4] & gSaveContext.quest_items) &&
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) &&
(INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) && (player->actor.posRot.pos.x > -70.0f) &&
(player->actor.posRot.pos.x < 300.0f) && (player->actor.posRot.pos.y > 1340.0f) &&
(player->actor.posRot.pos.z > 1340.0f) && (player->actor.posRot.pos.z < 1662.0f) &&
(func_800BFC84(globalCtx) == 0)) {
!Gameplay_InCsMode(globalCtx)) {
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&D_02002640);
gSaveContext.cutscene_trigger = 1;
gSaveContext.cutsceneTrigger = 1;
this->actionFunc = BgGjyoBridge_SpawnBridge;
}
}
@ -87,7 +87,7 @@ void BgGjyoBridge_SpawnBridge(BgGjyoBridge* this, GlobalContext* globalCtx) {
(globalCtx->csCtx.actorActions[2]->action == 2)) {
this->dyna.actor.draw = &BgGjyoBridge_Draw;
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
gSaveContext.event_chk_inf[4] |= 0x2000;
gSaveContext.eventChkInf[4] |= 0x2000;
}
}

View file

@ -191,9 +191,8 @@ void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) {
void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) {
UNK_PTR* temp;
u32 pad;
GraphicsContext* gfxCtx;
Gfx* dispRefs[3];
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;

View file

@ -132,12 +132,12 @@ void BgHidanFslift_Update(BgHidanFslift* this, GlobalContext* globalCtx) {
if (this->unk_16A == 0) {
this->unk_16A = 3;
}
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x30);
func_8005A77C(globalCtx->cameraPtrs[0], 0x30);
return;
}
if (func_8004356C(thisx) == 0) {
if (this->unk_16A != 0) {
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 3);
func_8005A77C(globalCtx->cameraPtrs[0], 3);
}
this->unk_16A = 0;
}

View file

@ -108,12 +108,12 @@ void BgHidanSyoku_Update(BgHidanSyoku* this, GlobalContext* globalCtx) {
if (this->unk_168 == 0) {
this->unk_168 = 3;
}
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x30);
func_8005A77C(globalCtx->cameraPtrs[0], 0x30);
return;
}
if (!func_8004356C(&this->dyna.actor)) {
if (this->unk_168 != 0) {
func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 3);
func_8005A77C(globalCtx->cameraPtrs[0], 3);
}
this->unk_168 = 0;
}

View file

@ -99,7 +99,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) {
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.x, 0x4000, this->unk_168)) {
func_80899A08(this);
Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRAP_BOUND);
var = Quake_Add(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3);
var = Quake_Add(globalCtx->cameraPtrs[globalCtx->activeCamera], 3);
Quake_SetSpeed(var, 25000);
Quake_SetQuakeValues(var, 2, 0, 0, 0);
Quake_SetCountdown(var, 0x10);

View file

@ -45,8 +45,8 @@ void BgSpot01Fusya_Init(BgSpot01Fusya* this, GlobalContext* globalCtx) {
this->unk_154 = 100.0f;
this->unk_158 = 100.0f;
this->unk_15C = 0.5f;
if (gSaveContext.scene_setup_index < 4) {
gSaveContext.event_chk_inf[6] &= 0xFFDF;
if (gSaveContext.sceneSetupIndex < 4) {
gSaveContext.eventChkInf[6] &= 0xFFDF;
}
BgSpot01Fusya_SetupAction(this, func_808AAA50);
}
@ -57,7 +57,7 @@ void BgSpot01Fusya_Destroy(BgSpot01Fusya* this, GlobalContext* globalCtx) {
void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) {
f32 temp;
Actor* thisx = &this->actor;
if (gSaveContext.event_chk_inf[6] & 0x20) {
if (gSaveContext.eventChkInf[6] & 0x20) {
this->unk_158 = 1800.0f;
}
thisx->shape.rot.z += this->unk_154;

View file

@ -9,8 +9,8 @@ typedef struct {
/* 0x014C */ char unk_14C[0x18];
/* 0x0164 */ ActorFunc actionFunc;
/* 0x0168 */ char unk_168[0x10];
/* 0x0178 */ s8 objBankIndex;
/* 0x0179 */ char unk_179[0x7];
/* 0x0178 */ s32 objectId;
/* 0x0179 */ char unk_179[0x4];
} BgSpot01Objects2; // size = 0x0180
extern const ActorInit Bg_Spot01_Objects2_InitVars;

View file

@ -57,11 +57,11 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
s32 carpentersRescued;
Actor* thisx = &this->dyna.actor;
if (gSaveContext.scene_setup_index >= 4) {
if (gSaveContext.sceneSetupIndex >= 4) {
return thisx->params == 0;
}
carpentersRescued = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF;
carpentersRescued = (gSaveContext.eventChkInf[9] & 0xF) == 0xF;
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
switch (thisx->params) {
@ -136,7 +136,7 @@ void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params,
gSaveContext.event_chk_inf[9] & 0xF);
gSaveContext.eventChkInf[9] & 0xF);
thisx->params &= 0xFF;
if ((thisx->params < 0) || (thisx->params >= 5)) {
osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n",

View file

@ -113,7 +113,7 @@ void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) {
Math_ApproxF(&thisx->velocity.y, 1.6f, 0.03f);
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) {
func_808B3274(this);
var = Quake_Add(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3);
var = Quake_Add(globalCtx->cameraPtrs[globalCtx->activeCamera], 3);
Quake_SetSpeed(var, -0x3CB0);
Quake_SetQuakeValues(var, 3, 0, 0, 0);
Quake_SetCountdown(var, 0xC);

View file

@ -46,7 +46,7 @@ void BgSpot15Saku_Init(BgSpot15Saku* this, GlobalContext* globalCtx) {
this->unk_170 = thisx->posRot.pos.x;
this->unk_174 = thisx->posRot.pos.y;
this->unk_178 = thisx->posRot.pos.z;
if ((gSaveContext.inf_table[7] & 2) != 0) {
if ((gSaveContext.infTable[7] & 2) != 0) {
thisx->posRot.pos.z = 2659.0f;
}
this->actionFunc = func_808B4930;
@ -57,7 +57,7 @@ void BgSpot15Saku_Destroy(BgSpot15Saku* this, GlobalContext* globalCtx) {
}
void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) {
if (this->unk_168 && !(gSaveContext.inf_table[7] & 2)) {
if (this->unk_168 && !(gSaveContext.infTable[7] & 2)) {
this->unk_17C = 2;
this->actionFunc = func_808B4978;
}

View file

@ -57,10 +57,10 @@ void func_808B7478(BgSpot17Funen* this, GlobalContext* globalCtx) {
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 153);
func_80093D84(globalCtx->state.gfxCtx);
Matrix_RotateY((s16)(func_8005A9F4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]) -
this->actor.shape.rot.y + 0x8000) *
9.58738019108e-05f,
MTXMODE_APPLY);
Matrix_RotateY(
(s16)(func_8005A9F4(globalCtx->cameraPtrs[globalCtx->activeCamera]) - this->actor.shape.rot.y + 0x8000) *
9.58738019108e-05f,
MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 161),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -193,7 +193,7 @@ void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) {
thisx->draw = NULL;
}
if (gSaveContext.scene_setup_index == 5) {
if (gSaveContext.sceneSetupIndex == 5) {
globalCtx->unk_11D30[0] = 0xFF;
}
@ -209,13 +209,13 @@ void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx) {
}
void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) {
if (((gSaveContext.event_chk_inf[4] & 0x8000) == 0) && (gSaveContext.scene_setup_index < 4) &&
(func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && (func_800BFC84(globalCtx) == 0)) {
gSaveContext.event_chk_inf[4] |= 0x8000;
if (((gSaveContext.eventChkInf[4] & 0x8000) == 0) && (gSaveContext.sceneSetupIndex < 4) &&
(func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && !Gameplay_InCsMode(globalCtx)) {
gSaveContext.eventChkInf[4] |= 0x8000;
globalCtx->csCtx.segment = D_808BBD90;
gSaveContext.cutscene_trigger = 1;
gSaveContext.cutsceneTrigger = 1;
}
if (LINK_IS_CHILD || ((gSaveContext.event_chk_inf[5] & 0x20) != 0)) {
if (LINK_IS_CHILD || ((gSaveContext.eventChkInf[5] & 0x20) != 0)) {
if (func_8002F410(&this->actor, globalCtx) != 0) {
if (LINK_IS_CHILD) {
Item_Give(globalCtx, ITEM_SWORD_MASTER);
@ -225,7 +225,7 @@ void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) {
}
Audio_SetBGM(NA_BGM_STOP);
Audio_SetBGM(NA_SE_PL_BOUND_DIRT);
gSaveContext.cutscene_trigger = 1;
gSaveContext.cutsceneTrigger = 1;
this->actor.attachedA = 0;
BgTokiSwd_SetupAction(this, func_808BB0AC);
} else {
@ -234,7 +234,7 @@ void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) {
}
}
}
if (gSaveContext.scene_setup_index == 5) {
if (gSaveContext.sceneSetupIndex == 5) {
if (globalCtx->unk_11D30[0] > 0) {
globalCtx->unk_11D30[0]--;
} else {

View file

@ -6,6 +6,8 @@
#include "z_bg_zg.h"
#include <vt.h>
#define FLAGS 0x00000010
void BgZg_Init(BgZg* this, GlobalContext* globalCtx);

View file

@ -3,7 +3,6 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
typedef struct {
/* 0x0000 */ DynaPolyActor dyna;

View file

@ -45,7 +45,7 @@ static s16 entrances[] = {
};
// display list
extern Gfx* D_05001390;
extern Gfx D_05001390[];
// sets current actionFunc to be ran on next update call
void DoorAna_SetupAction(DoorAna* this, ActorFunc func) {
@ -120,7 +120,7 @@ void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx) {
if ((this->actor.unk_1F != 0) && (globalCtx->sceneLoadFlag == 0) && (player->stateFlags1 & 0x80000000) &&
(player->unk_84F == 0)) {
destinationIdx = ((this->actor.params >> 0xC) & 7) - 1;
func_800C0AF4(globalCtx, 1, 0x4FF);
Gameplay_SetupRespawnPoint(globalCtx, RESPAWN_MODE_RETURN, 0x4FF);
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.posRot.pos.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.initPosRot.rot.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF;
@ -130,7 +130,7 @@ void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = entrances[destinationIdx];
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Entering);
} else {
if (func_8008E988(globalCtx) == 0 && !(player->stateFlags1 & 0x8800000) &&
if (!func_8008E988(globalCtx) && !(player->stateFlags1 & 0x8800000) &&
this->actor.xzDistanceFromLink <= 15.0f && -50.0f <= this->actor.yDistanceFromLink &&
this->actor.yDistanceFromLink <= 15.0f) {
player->stateFlags1 |= 0x80000000;
@ -157,19 +157,17 @@ void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx) {
void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
// changes the grottos facing angle based on camera angle
this->actor.shape.rot.y =
func_8005A9F4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]) + 0x8000;
this->actor.shape.rot.y = func_8005A9F4(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000;
}
void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx** dList = &D_05001390; // required for stack placement?
Gfx* dispRefs[3];
Gfx* dispRefs[4];
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_ana.c", 440);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, dList);
gSPDisplayList(gfxCtx->polyXlu.p++, D_05001390);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_ana.c", 449);
}

View file

@ -46,7 +46,7 @@ void DoorToki_Destroy(DoorToki* this, GlobalContext* globalCtx) {
}
void DoorToki_Update(DoorToki* this, GlobalContext* globalCtx) {
if (gSaveContext.event_chk_inf[4] & 0x800) {
if (gSaveContext.eventChkInf[4] & 0x800) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId);
} else {
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId);

View file

@ -123,7 +123,7 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) {
} else {
EnAni_SetupAction(this, func_809B0524);
}
gSaveContext.item_get_inf[1] |= 0x20;
gSaveContext.itemGetInf[1] |= 0x20;
return;
}
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
@ -147,8 +147,8 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
if (!textId) {}
if (textId2 == 0) {
textId = gSaveContext.night_flag ? 0x5051 : 0x5050; // "...all I can do is look at the stars."
// "...all I can do is look at Death Mountain."
textId = gSaveContext.nightFlag ? 0x5051 : 0x5050; // "...all I can do is look at the stars."
// "...all I can do is look at Death Mountain."
}
yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y;
@ -162,7 +162,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
}
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistanceFromLink < 150.0f &&
-80.0f < this->actor.yDistanceFromLink) {
if (gSaveContext.item_get_inf[1] & 0x20) {
if (gSaveContext.itemGetInf[1] & 0x20) {
EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..."
} else {
EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento."
@ -188,17 +188,17 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
}
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistanceFromLink < 150.0f &&
-80.0f < this->actor.yDistanceFromLink) {
if ((gSaveContext.item_get_inf[1] & 0x20) != 0) {
if ((gSaveContext.itemGetInf[1] & 0x20) != 0) {
EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..."
} else {
EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento."
}
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistanceFromLink < 350.0f) {
if ((gSaveContext.event_chk_inf[2] & 0x8000) == 0) {
if ((gSaveContext.eventChkInf[2] & 0x8000) == 0) {
textId = 0x5052; // "...Something is happening on Death Mountain!"
} else {
textId = (gSaveContext.item_get_inf[1] & 0x20) ? 0x5054 : 0x5053; // "I don't feel like getting down..."
// "...Death Mountain is back to normal!"
textId = (gSaveContext.itemGetInf[1] & 0x20) ? 0x5054 : 0x5053; // "I don't feel like getting down..."
// "...Death Mountain is back to normal!"
}
EnAni_SetText(this, globalCtx, textId);
}

View file

@ -6,6 +6,8 @@
#include "z_en_anubice_tag.h"
#include <vt.h>
#define FLAGS 0x00000010
void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx);
@ -29,7 +31,7 @@ const ActorInit En_Anubice_Tag_InitVars = {
void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx) {
osSyncPrintf("\n\n");
//"Anubis control tag generated"
// "Anubis control tag generated"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ アヌビス制御タグ発生 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params);
if (this->actor.params < (s16)0xFFFF) {

View file

@ -3,7 +3,7 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
#include "../ovl_En_Anubice/z_en_anubice.h"
typedef struct {

View file

@ -33,10 +33,9 @@ const ActorInit En_Dog_InitVars = {
};
static ColliderCylinderInit cylinderInit = {
0x06, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000,
0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
0x0010, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000,
0x06, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x00, 0x0010, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000,
};
static Sub98Init5 sub98Data = {
@ -54,15 +53,6 @@ static struct_80034EC0_Entry animations[] = {
{ 0x06000928, 1.0f, 0.0f, 6.0f, 0x02, -6.0f }, { 0x06000C28, 1.0f, 0.0f, -1.0f, 0x00, -6.0f },
};
// Bandaid fix for a lw vs lh issue in EnDog_FollowPath. Roman will look at it later.
typedef union {
/* 0x00 */ s32 entry;
struct {
s16 unk_0;
s16 unk_2;
};
} s16ArrEntry;
typedef enum {
/* 0x00 */ DOG_WALK,
/* 0x01 */ DOG_RUN,
@ -164,7 +154,7 @@ s32 EnDog_PlayAnimAndSFX(EnDog* this) {
return 0;
}
static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) {
s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) {
if ((this->collider.base.collideFlags & 2)) {
this->collider.base.collideFlags &= ~2;
return 2;
@ -186,7 +176,7 @@ static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) {
return 0;
}
static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) {
s32 EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) {
s32 change;
if (this->path == NULL) {
@ -293,8 +283,8 @@ void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx) {
}
void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) {
s16ArrEntry behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK };
s16ArrEntry unused[] = { 40, 80, 20 };
s32 behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK };
s32 unused[] = { 40, 80, 20 };
f32 speed;
s32 frame;
@ -316,16 +306,16 @@ void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) {
// depending on where he is on his path. En_Hy checks these event flags.
if (this->waypoint < 9) {
// Richard is close to her, text says something about his coat
gSaveContext.event_inf[3] |= 1;
gSaveContext.eventInf[3] |= 1;
} else {
// Richard is far, text says something about running fast
gSaveContext.event_inf[3] &= ~1;
gSaveContext.eventInf[3] &= ~1;
}
} else {
frame = globalCtx->state.frames % 3;
this->nextBehavior = behaviors[frame].entry;
// no clue why they're using the action id to calculate timer. possibly meant to use the unused array?
this->behaviorTimer = Math_Rand_S16Offset(60, behaviors[frame].unk_2);
this->nextBehavior = behaviors[frame];
// no clue why they're using the behavior id to calculate timer. possibly meant to use the unused array?
this->behaviorTimer = Math_Rand_S16Offset(60, behaviors[frame]);
this->actionFunc = EnDog_ChooseMovement;
}
}
@ -451,8 +441,7 @@ void EnDog_Update(EnDog* this, GlobalContext* globalCtx) {
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
}
static UNK_TYPE EnDog_Callback1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* actor) {
s32 EnDog_Callback1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor) {
return 0;
}

View file

@ -99,7 +99,7 @@ void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) {
this->actor.textId = 0x504F;
this->actionFunc = EnDs_TalkAfterGiveOddPotion;
this->actor.flags &= ~0x100;
gSaveContext.item_get_inf[3] |= 1;
gSaveContext.itemGetInf[3] |= 1;
}
}
@ -107,7 +107,7 @@ void EnDs_GiveOddPotion(EnDs* this, GlobalContext* globalCtx) {
if (func_8002F410(&this->actor, globalCtx) != 0) {
this->actor.attachedA = NULL;
this->actionFunc = EnDs_DisplayOddPotionText;
gSaveContext.timer_2_state = 0;
gSaveContext.timer2State = 0;
} else {
func_8002F434(&this->actor, globalCtx, GI_ODD_POTION, 10000.0f, 50.0f);
}
@ -229,7 +229,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
player->actor.textId = 0x504A;
this->actionFunc = EnDs_OfferOddPotion;
} else if (gSaveContext.item_get_inf[3] & 1) {
} else if (gSaveContext.itemGetInf[3] & 1) {
player->actor.textId = 0x500C;
this->actionFunc = EnDs_OfferBluePotion;
} else {

View file

@ -6,9 +6,10 @@
#include "z_en_eg.h"
#include <vt.h>
#define FLAGS 0x00000010
void EnEg_PlayVoidOutSFX();
void EnEg_Init(EnEg* this, GlobalContext* globalCtx);
void EnEg_Destroy(EnEg* this, GlobalContext* globalCtx);
void func_809FFDC8(EnEg* this, GlobalContext* globalCtx);
@ -32,7 +33,7 @@ const ActorInit En_Eg_InitVars = {
(ActorFunc)EnEg_Draw,
};
void PlayVoidOutSFX() {
void EnEg_PlayVoidOutSFX() {
func_800788CC(NA_SE_OC_ABYSS);
}
@ -44,13 +45,13 @@ void EnEg_Init(EnEg* this, GlobalContext* globalCtx) {
}
void func_809FFDC8(EnEg* this, GlobalContext* globalCtx) {
if (!hasVoidedOut && (gSaveContext.timer_2_value < 1) && Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) {
if (!hasVoidedOut && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) {
// Void the player out
func_800C0C88(globalCtx);
gSaveContext.respawn_flag = -2;
Gameplay_TriggerRespawn(globalCtx);
gSaveContext.respawnFlag = -2;
Audio_SetBGM(NA_BGM_STOP);
globalCtx->fadeOutTransition = 2;
PlayVoidOutSFX();
globalCtx->fadeTransition = 2;
EnEg_PlayVoidOutSFX();
hasVoidedOut = true;
}
}

View file

@ -3,7 +3,6 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
typedef struct {
/* 0x0000 */ Actor actor;

View file

@ -105,9 +105,8 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) {
void EnGanonOrgan_Draw(EnGanonOrgan* this, GlobalContext* globalCtx) {
BossGanon* dorf;
u32 pad;
GraphicsContext* gfxCtx;
Gfx* dispRefs[3];
Gfx* dispRefs[4];
dorf = (BossGanon*)this->actor.attachedA;
gfxCtx = globalCtx->state.gfxCtx;

View file

@ -138,7 +138,7 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) {
void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) {
if (func_8002F410(&this->actor, globalCtx) != 0) { // if attached is set
Rupees_ChangeBy(-prices[BEANS_BOUGHT]); // decrease ruppees
Rupees_ChangeBy(-prices[BEANS_BOUGHT]);
this->actor.attachedA = NULL;
this->actionFunc = &EnMs_TalkAfterBuy;
return;
@ -165,7 +165,7 @@ void EnMs_Update(EnMs* this, GlobalContext* globalCtx) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
this->actionFunc(this, globalCtx);
if (gSaveContext.entrance_index == 0x157 && gSaveContext.scene_setup_index == 8) { // ride carpet if in credits
if (gSaveContext.entranceIndex == 0x157 && gSaveContext.sceneSetupIndex == 8) { // ride carpet if in credits
Actor_MoveForward(&this->actor);
osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y);
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);

View file

@ -41,33 +41,33 @@ void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, ActorFunc* newActionFunc
}
void EnOkarinaEffect_Destroy(EnOkarinaEffect* this, GlobalContext* globalCtx) {
globalCtx->unk_10B16[0] = 0;
if ((D_8011FB30 != 4) && (D_8011FB30 != 5) && (globalCtx->gloomySkyEvent == 1)) {
globalCtx->gloomySkyEvent = 2; // end gloomy sky
globalCtx->envCtx.unk_F2[0] = 0;
if ((D_8011FB30 != 4) && (D_8011FB30 != 5) && (globalCtx->envCtx.gloomySkyEvent == 1)) {
globalCtx->envCtx.gloomySkyEvent = 2; // end gloomy sky
func_80077684(globalCtx);
}
globalCtx->lightning = 2; // end lightning
globalCtx->envCtx.lightning = 2; // end lightning
}
void EnOkarinaEffect_Init(EnOkarinaEffect* this, GlobalContext* globalCtx) {
osSyncPrintf("\n\n");
//"Ocarina Storm Effect"
// "Ocarina Storm Effect"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf("\n\n");
if (globalCtx->unk_10B12[1] != 0) {
if (globalCtx->envCtx.unk_EE[1] != 0) {
Actor_Kill(&this->actor); // kill if an instance is already spawned
}
EnOkarinaEffect_SetupAction(this, &EnOkarinaEffect_TriggerStorm);
}
void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) {
this->timer = 400; // 20 seconds
globalCtx->unk_10B16[0] = 20; // rain intensity target
globalCtx->gloomySkyEvent = 1; // start gloomy sky
if ((D_8011FB30 != 0) || globalCtx->gloomySky != 0) {
globalCtx->unk_10B02 = 1;
this->timer = 400; // 20 seconds
globalCtx->envCtx.unk_F2[0] = 20; // rain intensity target
globalCtx->envCtx.gloomySkyEvent = 1; // start gloomy sky
if ((D_8011FB30 != 0) || globalCtx->envCtx.gloomySky != 0) {
globalCtx->envCtx.unk_DE = 1;
}
globalCtx->lightning = 1; // start lightning
globalCtx->envCtx.lightning = 1; // start lightning
func_80077624(globalCtx);
EnOkarinaEffect_SetupAction(this, &EnOkarinaEffect_ManageStorm);
}
@ -75,14 +75,14 @@ void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCt
void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) {
func_8006C438(globalCtx, 5); // clear bean grow env flag
if (((globalCtx->pauseCtx.state == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->msgCtx.unk_E300 == 0) &&
(func_800C0D28(globalCtx) == 0) && ((globalCtx->unk_1241B == 0) || (gSaveContext.game_mode != 0))) ||
(func_800C0D28(globalCtx) == 0) && ((globalCtx->unk_1241B == 0) || (gSaveContext.gameMode != 0))) ||
(this->timer >= 250)) {
if (globalCtx->unk_10A42 != 0 || globalCtx->unk_10A43 != 1) {
if (globalCtx->envCtx.unk_1E != 0 || globalCtx->envCtx.unk_1F != 1) {
this->timer--;
}
osSyncPrintf("\nthis->timer=[%d]", this->timer);
if (this->timer == 308) {
//"Let's grow some beans"
// "Let's grow some beans"
osSyncPrintf("\n\n\n豆よ のびろ 指定\n\n\n");
func_8006C3D0(globalCtx, 5); // set bean grow env flag
}
@ -93,7 +93,7 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx
}
if (this->timer == 0) {
globalCtx->unk_10B16[0] = 0;
globalCtx->envCtx.unk_F2[0] = 0;
if (globalCtx->csCtx.state == 0) {
func_80077684(globalCtx);
} else if (func_800FA0B4(0) == 1) {
@ -101,14 +101,14 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx
func_800F6D58(0xE, 1, 0);
}
osSyncPrintf("\n\n\nE_wether_flg=[%d]", D_8011FB30);
osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->gloomySkyEvent);
if (D_8011FB30 == 0 && (globalCtx->gloomySkyEvent == 1)) {
globalCtx->gloomySkyEvent = 2; // end gloomy sky
osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->envCtx.gloomySkyEvent);
if (D_8011FB30 == 0 && (globalCtx->envCtx.gloomySkyEvent == 1)) {
globalCtx->envCtx.gloomySkyEvent = 2; // end gloomy sky
} else {
globalCtx->gloomySkyEvent = 0;
globalCtx->unk_10B02 = 0;
globalCtx->envCtx.gloomySkyEvent = 0;
globalCtx->envCtx.unk_DE = 0;
}
globalCtx->lightning = 2; // end lightning
globalCtx->envCtx.lightning = 2; // end lightning
Actor_Kill(&this->actor);
}
}

View file

@ -266,11 +266,11 @@ void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx) {
Player* player;
s16 temp;
if (gSaveContext.chamber_cutscene_num == 2 && gSaveContext.scene_setup_index < 4) {
if (gSaveContext.chamberCutsceneNum == 2 && gSaveContext.sceneSetupIndex < 4) {
player = PLAYER;
this->action = 1;
globalCtx->csCtx.segment = &D_80AF411C;
gSaveContext.cutscene_trigger = 2;
gSaveContext.cutsceneTrigger = 2;
Item_Give(globalCtx, ITEM_MEDALLION_WATER);
temp = this->actor.posRot.rot.y + 0x8000;
player->actor.shape.rot.y = temp;
@ -626,7 +626,7 @@ s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) {
}
void func_80AF3878(EnRu2* this, GlobalContext* globalCtx) {
if (func_80AF383C(this, globalCtx) && !func_800BFC84(globalCtx)) {
if (func_80AF383C(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) {
this->action = 16;
func_800800F8(globalCtx, 0xC3A, -0x63, &this->actor, 0);
}
@ -667,7 +667,7 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) {
if (this->unk_2C2 % 6 == 3) {
player = PLAYER;
osSyncPrintf("うおりゃー! \n");
func_8005B1A4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]);
func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamera]);
player->actor.posRot.pos.x = 820.0f;
player->actor.posRot.pos.y = 0.0f;
player->actor.posRot.pos.z = 180.0f;
@ -678,7 +678,7 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) {
this->unk_2C3 = dialogState;
if (func_8010BDBC(msgCtx) == 2) {
this->action = 18;
func_8005B1A4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]);
func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamera]);
}
}

View file

@ -354,7 +354,7 @@ u16 func_80B1C54C(GlobalContext* globalCtx, Actor* a1) {
return ret;
}
if (gSaveContext.inf_table[13] & 0x0200) {
if (gSaveContext.infTable[13] & 0x0200) {
/* "Do you want me to dig here? ..." */
return 0x5019;
} else {
@ -373,7 +373,7 @@ s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* actor) {
case 2:
/* "I am the boss of the carpenters ..." (wtf?) */
if (actor->textId == 0x5028) {
gSaveContext.inf_table[13] |= 0x0100;
gSaveContext.infTable[13] |= 0x0100;
}
ret = 0;
break;
@ -390,11 +390,11 @@ s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* actor) {
} else {
globalCtx->msgCtx.msgMode = 0x37;
Rupees_ChangeBy(-10);
gSaveContext.inf_table[13] |= 0x0200;
gSaveContext.infTable[13] |= 0x0200;
return 2;
}
func_8010B720(globalCtx, actor->textId);
gSaveContext.inf_table[13] |= 0x0200;
gSaveContext.infTable[13] |= 0x0200;
}
break;
case 5:
@ -507,7 +507,7 @@ void EnTk_Init(EnTk* this, GlobalContext* globalCtx) {
func_80061EFC(&thisAgain->actor.sub_98, NULL, &D_80B1D534);
if (gSaveContext.day_time <= 0xC000 || gSaveContext.day_time >= 0xE000 || !LINK_IS_CHILD ||
if (gSaveContext.dayTime <= 0xC000 || gSaveContext.dayTime >= 0xE000 || !LINK_IS_CHILD ||
globalCtx->sceneNum != SCENE_SPOT02) {
Actor_Kill(&thisAgain->actor);
return;
@ -629,8 +629,8 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
* Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig.
*/
if ((gSaveContext.item_get_inf[1] & 0x1000) == 0) {
gSaveContext.item_get_inf[1] |= 0x1000;
if ((gSaveContext.itemGetInf[1] & 0x1000) == 0) {
gSaveContext.itemGetInf[1] |= 0x1000;
this->currentReward = 4;
}
}

View file

@ -236,7 +236,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) {
if (this->actor.xzDistanceFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) {
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, this, ACTORTYPE_ENEMY);
this->actor.flags |= 1;
targetHeight = 40.0f + -10.0f * gSaveContext.link_age;
targetHeight = 40.0f + -10.0f * gSaveContext.linkAge;
this->targetY = player->actor.posRot.pos.y + targetHeight;
if (this->targetY < this->actor.posRot.pos.y) {

View file

@ -69,7 +69,7 @@ static ActorDamageChart damageChart = { {
{ 0x0, 0x2 }, { 0x0, 0x2 }, { 0x0, 0x8 }, { 0x0, 0x4 }, { 0x0, 0x0 }, { 0x0, 0x0 }, { 0x0, 0x4 }, { 0x0, 0x0 },
} };
static InitChainEntry initChain[3] = {
static InitChainEntry initChain[] = {
ICHAIN_S8(naviEnemyId, 0x30, 1),
ICHAIN_F32(unk_4C, 0x157C, 1),
ICHAIN_F32_DIV1000(gravity, 0xFA24, 0),
@ -295,7 +295,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) {
void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((func_8008E988(globalCtx) == 0) && (player->stateFlags2 & 0x10) == 0 && (player->unk_A78 >= 0) &&
if (!func_8008E988(globalCtx) && (player->stateFlags2 & 0x10) == 0 && (player->unk_A78 >= 0) &&
(this->actor.xzDistanceFromLink < 30.0f) && (this->actor.yDistanceFromLink < -5.0f) &&
(-(f32)(player->unk_4DA + 0xA) < this->actor.yDistanceFromLink)) {
EnWallmas_TakePlayerBegin(this, globalCtx);
@ -417,14 +417,14 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) {
this->actor.posRot.pos.y = this->actor.posRot.pos.y + 10.0f;
}
if (gSaveContext.link_age != 0) {
if (LINK_IS_CHILD) {
player->actor.posRot.pos.y = this->actor.posRot.pos.y - 30.0f;
} else {
player->actor.posRot.pos.y = this->actor.posRot.pos.y - 50.0f;
}
if (this->timer == -0x1E) {
if (gSaveContext.link_age != 0) {
if (LINK_IS_CHILD) {
func_8002F7DC(&this->actor, NA_SE_VO_LI_TAKEN_AWAY_KID);
} else {
func_8002F7DC(&this->actor, NA_SE_VO_LI_TAKEN_AWAY);
@ -436,8 +436,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) {
this->timer = this->timer + 2;
} else {
Math_ApproxF(&this->actor.posRot.pos.y,
player->actor.posRot.pos.y + (gSaveContext.link_age != 0 ? 30.0f : 50.0f), 5.0f);
Math_ApproxF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y + (LINK_IS_CHILD ? 30.0f : 50.0f), 5.0f);
}
Math_ApproxF(&this->actor.posRot.pos.x, player->actor.posRot.pos.x, 3.0f);
@ -445,7 +444,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) {
if (this->timer == 0x1E) {
func_80078884(NA_SE_OC_ABYSS);
func_800C0C88(globalCtx);
Gameplay_TriggerRespawn(globalCtx);
}
}

View file

@ -6,6 +6,8 @@
#include "z_obj_makekinsuta.h"
#include <vt.h>
#define FLAGS 0x00000010
void ObjMakekinsuta_Init(ObjMakekinsuta* this, GlobalContext* globalCtx);

View file

@ -3,7 +3,6 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
typedef struct {
/* 0x0000 */ Actor actor;

View file

@ -46,8 +46,8 @@ void ObjRoomtimer_Init(ObjRoomtimer* this, GlobalContext* globalCtx) {
void ObjRoomtimer_Destroy(ObjRoomtimer* this, GlobalContext* globalCtx) {
if (this->actor.params != 0x3FF) {
if (gSaveContext.timer_1_value > 0) {
gSaveContext.timer_1_state = 10;
if (gSaveContext.timer1Value > 0) {
gSaveContext.timer1State = 10;
}
}
}
@ -64,7 +64,7 @@ void func_80B9D054(ObjRoomtimer* this, GlobalContext* globalCtx) {
void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx) {
if (Flags_GetTempClear(globalCtx, this->actor.room)) {
if (this->actor.params != 0x3FF) {
gSaveContext.timer_1_state = 10;
gSaveContext.timer1State = 10;
}
Flags_SetClear(globalCtx, this->actor.room);
@ -73,9 +73,9 @@ void func_80B9D0B0(ObjRoomtimer* this, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
} else {
if (this->actor.params != 0x3FF) {
if (gSaveContext.timer_1_value == 0) {
if (gSaveContext.timer1Value == 0) {
Audio_PlaySoundGeneral(NA_SE_OC_ABYSS, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800C0B60(globalCtx); // Void Out
Gameplay_TriggerVoidOut(globalCtx);
Actor_Kill(&this->actor);
}
}

View file

@ -7,22 +7,22 @@
#include <ultra64.h>
#include <global.h>
void Opening_SetNextGameState(OpeningContext* this) {
gSaveContext.game_mode = 1;
void Opening_SetupTitleScreen(OpeningContext* this) {
gSaveContext.gameMode = 1;
this->state.running = false;
gSaveContext.link_age = 0;
gSaveContext.linkAge = 0;
func_800A82C8();
gSaveContext.cutscene_index = 0xFFF3;
gSaveContext.scene_setup_index = 7;
SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext);
gSaveContext.cutsceneIndex = 0xFFF3;
gSaveContext.sceneSetupIndex = 7;
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
}
void func_80803C5C(OpeningContext* this) {
}
void Opening_Update(OpeningContext* this) {
void Opening_Main(OpeningContext* this) {
func_80095248(this->state.gfxCtx, 0, 0, 0);
Opening_SetNextGameState(this);
Opening_SetupTitleScreen(this);
func_80803C5C(this);
}
@ -32,7 +32,7 @@ void Opening_Destroy(OpeningContext* this) {
void Opening_Init(OpeningContext* this) {
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
func_800AA278(&this->view, this->state.gfxCtx);
this->state.main = Opening_Update;
View_Init(&this->view, this->state.gfxCtx);
this->state.main = Opening_Main;
this->state.destroy = Opening_Destroy;
}

View file

@ -40,7 +40,7 @@ void Title_Calc(TitleContext* this) {
this->exit = 1;
}
void Title_InitView(TitleContext* this, f32 x, f32 y, f32 z) {
void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) {
View* view;
Vec3f v1;
Vec3f v2;
@ -91,7 +91,7 @@ void Title_Draw(TitleContext* this) {
func_8002EABC(&v1, &v2, &v3, this->state.gfxCtx);
gSPSetLights1(gfxCtx->polyOpa.p++, sTitleLights);
Title_InitView(this, 0, 150.0, 300.0);
Title_SetupView(this, 0, 150.0, 300.0);
func_80093D18(this->state.gfxCtx);
Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW);
Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY);
@ -127,12 +127,11 @@ void Title_Draw(TitleContext* this) {
Graph_CloseDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 483);
}
void Title_Update(TitleContext* this) {
void Title_Main(TitleContext* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
u32 pad;
Gfx* dispRefs[4];
u32 pad2;
Gfx* gfx[2];
Gfx* dispRefs[5];
u32 pad[2];
Gfx* gfx;
Graph_OpenDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 494);
@ -142,14 +141,14 @@ void Title_Update(TitleContext* this) {
Title_Calc(this);
Title_Draw(this);
if (D_8012DBC0) {
gfx[0] = gfxCtx->polyOpa.p;
gfx = gfxCtx->polyOpa.p;
Title_PrintBuildInfo(&gfx);
gfxCtx->polyOpa.p = gfx[0];
gfxCtx->polyOpa.p = gfx;
}
if (this->exit) {
gSaveContext.seq_index = -1;
gSaveContext.night_sfx = -1;
gSaveContext.game_mode = 1;
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.gameMode = 1;
this->state.running = false;
SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext);
}
@ -173,11 +172,11 @@ void Title_Init(TitleContext* this) {
DmaMgr_SendRequest1(this->staticSegment, (u32)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c", 615);
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
func_800AA278(&this->view, this->state.gfxCtx);
this->state.main = Title_Update;
View_Init(&this->view, this->state.gfxCtx);
this->state.main = Title_Main;
this->state.destroy = Title_Destroy;
this->exit = false;
gSaveContext.file_num = 0xFF;
gSaveContext.fileNum = 0xFF;
func_800A9CD4(&this->state, &this->sram);
this->ult = 0;
this->unk_1D4 = 0x14;