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

Decompile Player (#387)

* Setup player decomp

* Decompile z_player.c and z_player_lib.c

* Decompile remaining z_player.c functions

* Various player improvements

* Player progress (some non matchings and .data migrated)

* Player progress (reposition data and fix some non matchings)

* Cleanup, improve and document parts of z_player_lib.c/z_player.c

* Fix player renames in z_en_st.c

* Fix missing open/close disps in z_player.c

* Minor player fixes

* Address player comments
This commit is contained in:
Roman971 2020-09-19 03:45:39 +02:00 committed by GitHub
parent b29c268f37
commit 14191307e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
686 changed files with 16334 additions and 39630 deletions

View file

@ -77,7 +77,7 @@ void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
if (this->actor.parent == NULL) {
player = PLAYER;
// get correct timer length for hookshot or longshot
length = (player->heldItemActionParam == 0x10) ? 13 : 26;
length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f);
@ -111,8 +111,8 @@ void ArmsHook_DetachHookFromActor(ArmsHook* this) {
s32 ArmsHook_CheckForCancel(ArmsHook* this) {
Player* player = (Player*)this->actor.parent;
if (func_8008F104(player)) {
if ((player->unk_154 != player->heldItemActionParam) || ((player->actor.flags & 0x100)) ||
if (Player_HoldsHookshot(player)) {
if ((player->itemActionParam != player->heldItemActionParam) || ((player->actor.flags & 0x100)) ||
((player->stateFlags1 & 0x4000080))) {
this->timer = 0;
ArmsHook_DetachHookFromActor(this);
@ -151,7 +151,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
f32 velocity;
s32 pad1;
if ((this->actor.parent == NULL) || (!func_8008F104(player))) {
if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) {
ArmsHook_DetachHookFromActor(this);
Actor_Kill(&this->actor);
return;
@ -310,21 +310,21 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
f32 sp58;
if (player->actor.draw != NULL) {
if (player->unk_15D == 0xF) {
if (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->unk_1CC = 0;
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.base, &this->unk_1CC, &sp6C, &sp60);
func_80090480(globalCtx, &this->collider, &this->hookInfo, &sp6C, &sp60);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -11,8 +11,7 @@ typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*);
typedef struct ArmsHook {
/* 0x0000 */ Actor actor;
/* 0x014C */ ColliderQuad collider;
/* 0x01CC */ s32 unk_1CC;
/* 0x01D0 */ char unk_1D0[0x18];
/* 0x01CC */ WeaponInfo hookInfo;
/* 0x01E8 */ Vec3f unk_1E8;
/* 0x01F4 */ Vec3f unk_1F4;
/* 0x0200 */ Actor* grabbed;

View file

@ -363,7 +363,7 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->unk_168 == 0) {
do {
} while (0);
func_8005A77C(globalCtx->cameraPtrs[0], (s16)this->unk_1B8);
func_8005A77C(globalCtx->cameraPtrs[0], this->unk_1B8);
func_8005ACFC(globalCtx->cameraPtrs[0], 4);
}
}

View file

@ -479,7 +479,7 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk_1D8 -= 1;
return;
}
if (!func_8008E988(globalCtx) && this->unk_1D8 > 0) {
if (!Player_InCsMode(globalCtx) && this->unk_1D8 > 0) {
this->unk_1D8 -= 1;
}
temp = this->collider.base.acFlags;

View file

@ -200,7 +200,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) {
static UNK_TYPE D_80881018 = 0;
Player* player = PLAYER;
if ((D_80880F30 == 0) && (func_8008E988(globalCtx) == 0)) {
if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) {
if (!Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x, 0.5f)) {
func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
} else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) {
@ -403,9 +403,10 @@ void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) {
func_8002DBD0(&this->dyna.actor, &sp18, &player->actor.posRot.pos);
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) && (PLAYER->currentBoots != 1)) {
player->fanWindSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 14848.0f) * (2.0f / 3.0f);
player->fanWindDirection = this->dyna.actor.shape.rot.y;
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) &&
(PLAYER->currentBoots != PLAYER_BOOTS_IRON)) {
player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 14848.0f) * (2.0f / 3.0f);
player->windDirection = this->dyna.actor.shape.rot.y;
}
}

View file

@ -499,7 +499,7 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904);
if (BgHeavyBlock_LiftedUp == this->actionFunc) {
func_800D1694(player->unk_3B0.x, player->unk_3B0.y, player->unk_3B0.z, &thisx->shape.rot);
func_800D1694(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, &thisx->shape.rot);
Matrix_Translate(-this->unk_164.x, -this->unk_164.y, -this->unk_164.z, MTXMODE_APPLY);
} else if ((thisx->gravity == 0.0f) && (BgHeavyBlock_Land == this->actionFunc)) {
func_800D1694(thisx->initPosRot.pos.x, thisx->initPosRot.pos.y, thisx->initPosRot.pos.z, &thisx->shape.rot);

View file

@ -90,7 +90,7 @@ void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgHidanDalm_WaitInteraction(BgHidanDalm* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((this->collider.base.acFlags & 2) && !func_8008E988(globalCtx) &&
if ((this->collider.base.acFlags & 2) && !Player_InCsMode(globalCtx) &&
(player->swordAnimation == 22 || player->swordAnimation == 23)) {
this->collider.base.acFlags &= ~2;
if (this->collider.list[0].body.bumperFlags & 2 || this->collider.list[1].body.bumperFlags & 2) {

View file

@ -59,7 +59,7 @@ void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
if (PLAYER->currentBoots == 1) {
if (PLAYER->currentBoots == PLAYER_BOOTS_IRON) {
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
} else {
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);

View file

@ -128,7 +128,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = entrances[destinationIdx];
DoorAna_SetupAction(this, DoorAna_GrabLink);
} else {
if (!func_8008E988(globalCtx) && !(player->stateFlags1 & 0x8800000) &&
if (!Player_InCsMode(globalCtx) && !(player->stateFlags1 & 0x8800000) &&
this->actor.xzDistFromLink <= 15.0f && -50.0f <= this->actor.yDistFromLink &&
this->actor.yDistFromLink <= 15.0f) {
player->stateFlags1 |= 0x80000000;

View file

@ -86,7 +86,7 @@ s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) {
f32 temp_f0;
s16 rotYDiff;
if (!func_8008E988(globalCtx)) {
if (!Player_InCsMode(globalCtx)) {
temp_f0 = func_809946BC(globalCtx, this, 0.0f, 20.0f, 15.0f);
if (fabsf(temp_f0) < 40.0f) {
rotYDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y;
@ -102,27 +102,26 @@ s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) {
}
void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) {
s32 temp_v0;
Player* player;
if (this->unk_164 != 0) {
this->actionFunc = func_8099496C;
gSaveContext.dungeonKeys[gSaveContext.mapIndex] -= 1;
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
} else {
temp_v0 = func_80994750(this, globalCtx);
if (temp_v0 != 0) {
player = PLAYER;
s32 direction = func_80994750(this, globalCtx);
if (direction != 0) {
Player* player = PLAYER;
if (gSaveContext.dungeonKeys[gSaveContext.mapIndex] <= 0) {
player->naviMessageId = -0x203;
} else if (!Flags_GetCollectible(globalCtx, (this->dyna.actor.params >> 8) & 0x1F)) {
player->naviMessageId = -0x225;
} else {
player->unk_42C = 2;
player->unk_42D = temp_v0;
player->unk_430 = &this->dyna.actor;
player->unk_42E = 10;
player->doorType = 2;
player->doorDirection = direction;
player->doorActor = &this->dyna.actor;
player->doorTimer = 10;
}
}
}

View file

@ -8,7 +8,9 @@ struct DoorShutter;
typedef struct DoorShutter {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x2C];
/* 0x014C */ char unk_14C[0x18];
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ char unk_166[0x12];
} DoorShutter; // size = 0x0178
extern const ActorInit Door_Shutter_InitVars;

View file

@ -173,7 +173,7 @@ s32 ElfMsg_GetMessageId(ElfMsg* this) {
void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
EnElf* navi = (EnElf*)player->navi;
EnElf* navi = (EnElf*)player->naviActor;
if ((fabsf(player->actor.posRot.pos.x - this->actor.posRot.pos.x) < (100.0f * this->actor.scale.x)) &&
(this->actor.posRot.pos.y <= player->actor.posRot.pos.y) &&
@ -190,7 +190,7 @@ s32 ElfMsg_WithinXZDistance(Vec3f* pos1, Vec3f* pos2, f32 distance) {
void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
EnElf* navi = (EnElf*)player->navi;
EnElf* navi = (EnElf*)player->naviActor;
if (ElfMsg_WithinXZDistance(&player->actor.posRot.pos, &this->actor.posRot.pos, this->actor.scale.x * 100.0f) &&
(this->actor.posRot.pos.y <= player->actor.posRot.pos.y) &&

View file

@ -246,7 +246,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
} else {
// if a lit stick touches the bomb, set timer to 100
// these bombs never have a timer over 70, so this isnt used
if ((this->timer > 100) && func_8008EF5C(globalCtx, &thisx->posRot.pos, 30.0f, 50.0f)) {
if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->posRot.pos, 30.0f, 50.0f)) {
this->timer = 100;
}
}

View file

@ -158,7 +158,7 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) {
}
}
} else {
if (func_8008EF5C(globalCtx, &this->actor.posRot.pos, 30.0f, 50.0f)) {
if (Player_IsBurningStickInRange(globalCtx, &this->actor.posRot.pos, 30.0f, 50.0f)) {
bombFlower =
(EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, 0, 0, 0);
@ -347,7 +347,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) {
this->timer = 0;
} else {
// if a lit stick touches the bomb, set timer to 100
if ((this->timer > 100) && func_8008EF5C(globalCtx, &thisx->posRot.pos, 30.0f, 50.0f)) {
if ((this->timer > 100) && Player_IsBurningStickInRange(globalCtx, &thisx->posRot.pos, 30.0f, 50.0f)) {
this->timer = 100;
}
}

View file

@ -251,7 +251,7 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_MultVec3f(&sMultVec1, &vec1);
Matrix_MultVec3f(&sMultVec2, &vec2);
if (func_80090480(globalCtx, &this->collider, &this->unk_1DC, &vec1, &vec2) != 0) {
if (func_80090480(globalCtx, &this->collider, &this->boomerangInfo, &vec1, &vec2) != 0) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2);
}

View file

@ -16,7 +16,7 @@ typedef struct EnBoom {
/* 0x01D4 */ u8 returnTimer; // returns to Link when 0
/* 0x01D5 */ u8 activeTimer; // increments once every update
/* 0x01D8 */ u32 effectIndex; // set by Effect_Add
/* 0x01DC */ Struct_80090480_arg2 unk_1DC;
/* 0x01DC */ WeaponInfo boomerangInfo;
/* 0x01F8 */ EnBoomActionFunc actionFunc;
} EnBoom; // size = 0x01FC

View file

@ -8,7 +8,9 @@ struct EnBox;
typedef struct EnBox {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0xB0];
/* 0x014C */ char unk_14C[0xA8];
/* 0x01F4 */ s16 unk_1F4;
/* 0x01F6 */ char unk_1F6[0x06];
} EnBox; // size = 0x01FC
extern const ActorInit En_Box_InitVars;

View file

@ -138,11 +138,11 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if ((&player->actor != this->collider.base.at) && (&player->actor != this->collider.base.ac) &&
(&player->actor != this->colliderQuad.base.at) && (player->invincibilityTimer <= 0)) {
if (player->invincibilityTimer < -0x27) {
if (player->invincibilityTimer < -39) {
player->invincibilityTimer = 0;
} else {
player->invincibilityTimer = 0;
globalCtx->unk_11D58(globalCtx, -4);
globalCtx->damagePlayer(globalCtx, -4);
}
}
func_8002F71C(globalCtx, &this->actor, 6.0f, tmp32, 6.0f);

View file

@ -146,7 +146,7 @@ void func_809ECA50(EnDha* this, GlobalContext* globalCtx) {
this->unk_1D6.x = this->unk_1D0.y;
if (Math_Vec3f_DistXYZ(&playerPos, &this->unk_1DC) <= 12.0f) {
if (this->unk_1CC == 0) {
if (globalCtx->unk_11D4C(globalCtx, player) != 0) {
if (globalCtx->grabPlayer(globalCtx, player) != 0) {
this->unk_1CA = 0;
this->unk_1CC++;
if (this->actor.parent != NULL) {

View file

@ -8,7 +8,10 @@ struct EnDoor;
typedef struct EnDoor {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x8C];
/* 0x014C */ char unk_14C[0x44];
/* 0x0190 */ u8 unk_190;
/* 0x0191 */ u8 unk_191;
/* 0x0192 */ char unk_192[0x46];
} EnDoor; // size = 0x01D8
extern const ActorInit En_Door_InitVars;

View file

@ -149,7 +149,7 @@ void EnDs_OfferOddPotion(EnDs* this, GlobalContext* globalCtx) {
this->brewTimer = 60;
Flags_SetSwitch(globalCtx, 0x3F);
globalCtx->msgCtx.msgMode = 0x37;
player->exchangeItemId = 0;
player->exchangeItemId = EXCH_ITEM_NONE;
break;
case 1: // no
func_8010B720(globalCtx, 0x504C);
@ -209,7 +209,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
s16 yawDiff;
if (func_8002F194(&this->actor, globalCtx) != 0) {
if (func_8002F368(globalCtx) == 8) {
if (func_8002F368(globalCtx) == EXCH_ITEM_ODD_MUSHROOM) {
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;
@ -229,7 +229,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
this->actor.textId = 0x5048;
if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistFromLink < 200.0f)) {
func_8002F298(this, globalCtx, 100.0f, 8);
func_8002F298(this, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM);
this->unk_1E8 |= 1;
}
}

View file

@ -721,9 +721,9 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND);
EnFloormas_SetupLand(this);
} else if ((this->actor.yDistFromLink < -10.0f) && this->collider.base.maskA & 2 &&
} else if ((this->actor.yDistFromLink < -10.0f) && (this->collider.base.maskA & 2) &&
(&player->actor == this->collider.base.oc)) {
globalCtx->unk_11D4C(globalCtx, player);
globalCtx->grabPlayer(globalCtx, player);
EnFloormas_SetupGrabLink(this, player);
}
}
@ -785,7 +785,7 @@ void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) {
} else {
func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S);
}
globalCtx->unk_11D58(globalCtx, -8);
globalCtx->damagePlayer(globalCtx, -8);
}
}

View file

@ -148,9 +148,9 @@ ShopItemEntry D_80A3C674[] = {
func_80A3BB6C },
{ 0x00DA, 0x0028, func_8002EBCC, 0x0064, 0x0001, 0x00AE, 0x0099, GI_WEIRD_EGG, func_80A3B2AC, func_80A3B968,
func_80A3BB6C },
{ 0x00DF, 0x002F, func_80A3C498, 0x2710, 0x0001, 0x00B4, 0x0085, GI_INVALID, func_80A3B308, func_80A3B9A4,
{ 0x00DF, 0x002F, func_80A3C498, 0x2710, 0x0001, 0x00B4, 0x0085, GI_NONE, func_80A3B308, func_80A3B9A4,
func_80A3BB6C },
{ 0x00DA, 0x0028, func_8002EBCC, 0x2710, 0x0001, 0x00B5, 0x0085, GI_INVALID, func_80A3B318, func_80A3B9D4,
{ 0x00DA, 0x0028, func_8002EBCC, 0x2710, 0x0001, 0x00B5, 0x0085, GI_NONE, func_80A3B318, func_80A3B9D4,
func_80A3BB6C },
{ 0x00D9, 0x0027, func_8002EBCC, 0x0064, 0x000A, 0x00BC, 0x008C, GI_BOMBCHUS_10, func_80A3B328, NULL,
func_80A3BC6C },
@ -658,7 +658,7 @@ void func_80A3B780(GlobalContext* globalCtx, EnGirlA* this) {
void func_80A3B7BC(GlobalContext* globalCtx, EnGirlA* this) {
func_800849EC(globalCtx);
gSaveContext.bgsHitsLeft = 8;
gSaveContext.swordHealth = 8;
Rupees_ChangeBy(-this->unk_1C8);
}
@ -868,7 +868,7 @@ s32 func_80A3BF54(EnGirlA* this, GlobalContext* globalCtx) {
if ((this->actor.params >= 30) && (this->actor.params < 38)) {
params = this->actor.params - 30;
if (INV_CONTENT(ITEM_WEIRD_EGG) == D_80A3C658[params]) {
if (INV_CONTENT(ITEM_TRADE_CHILD) == D_80A3C658[params]) {
func_80A3BEAC(globalCtx, this);
} else {
func_80A3BD8C(globalCtx, this);

View file

@ -145,7 +145,7 @@ void func_80A4E648(EnGs* this, GlobalContext* globalCtx) {
func_8002F374(globalCtx, &this->actor, &sp26, &sp24);
if ((sp26 >= 0) && (sp26 <= SCREEN_WIDTH) && (sp24 >= 0) && (sp24 <= SCREEN_HEIGHT) && (this->unk_19C != 3)) {
if (func_8002F2CC(&this->actor, globalCtx, 40.0f) == 1) {
if (func_8008F080(globalCtx) == 8) {
if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) {
this->actor.textId = 0x2054;
} else {
this->actor.textId = 0x2053;

View file

@ -350,7 +350,7 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) {
var = 0;
if (gSaveContext.infTable[7] & 0x40) {
if (!(gSaveContext.infTable[7] & 0x80)) {
if (func_8008F080(globalCtx) == 1) {
if (Player_GetMask(globalCtx) == PLAYER_MASK_KEATON) {
if (this->unk_309 == 0) {
this->actor.textId = 0x200A; // "Wha-ha-ha-hah! Do you think you're in disguise, Mr. Hero?"
} else {
@ -401,19 +401,19 @@ void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) {
this->unk_300 = 6;
if (func_8002F194(&this->actor, globalCtx) != 0) {
exchangeItemId = func_8002F368(globalCtx);
if (exchangeItemId == 1) { // exchangeItemId = zelda's letter
if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
player->actor.textId = 0x2010; // "Oh, this is...this is surely Princess Zelda's handwriting!"
this->unk_300 = 5;
this->actionFunc = func_80A53C0C;
} else if (exchangeItemId != 0) { // exchangeItemId != nothing
} else if (exchangeItemId != EXCH_ITEM_NONE) {
player->actor.textId = 0x200F; // "I don't want that!"
}
} else {
yawDiffTemp = this->actor.yawTowardsLink - this->actor.shape.rot.y;
yawDiff = ABS(yawDiffTemp);
if (!(120.0f < this->actor.xzDistFromLink) && (yawDiff < 0x4300)) {
func_8002F298(&this->actor, globalCtx, 100.0f, 1);
func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_LETTER_ZELDA);
}
}
}
@ -539,7 +539,7 @@ void func_80A540C0(EnHeishi2* this, GlobalContext* globalCtx) {
case 0:
this->actor.textId = 0x2020; // "My boy will be very happy with this!.."
func_8010B720(globalCtx, this->actor.textId);
func_8008F08C(globalCtx);
Player_UnsetMask(globalCtx);
gSaveContext.infTable[7] |= 0x80;
gSaveContext.itemGetInf[3] |= 0x100;
Item_Give(globalCtx, ITEM_SOLD_OUT);

View file

@ -7,10 +7,39 @@
struct EnHorse;
typedef struct EnHorse {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x2B0];
/* 0x000 */ Actor actor;
/* 0x014C */ s32 unk_14C;
/* 0x0150 */ char unk_150[0x0A0];
/* 0x01F0 */ u32 unk_1F0;
/* 0x01F4 */ char unk_1F4[0x01C];
/* 0x0210 */ s32 unk_210;
/* 0x0214 */ f32 unk_214;
/* 0x0218 */ char unk_218[0x040];
/* 0x0258 */ Vec3f unk_258;
/* 0x0264 */ char unk_264[0x198];
} EnHorse; // size = 0x03FC
#define EN_HORSE_CHECK_1(horseActor) \
(((horseActor)->unk_1F0 & 0x40) \
? true \
: false)
#define EN_HORSE_CHECK_2(horseActor) \
(((horseActor)->unk_1F0 & 0x100) \
? true \
: false)
#define EN_HORSE_CHECK_3(horseActor) \
(((horseActor)->unk_1F0 & 0x200) \
? true \
: false)
#define EN_HORSE_CHECK_4(horseActor) \
(((((horseActor)->unk_14C == 5) || ((horseActor)->unk_14C == 0) || ((horseActor)->unk_14C == 6)) && \
!((horseActor)->unk_1F0 & 0x80000) && !((horseActor)->unk_1F0 & 0x2000000)) \
? true \
: false)
extern const ActorInit En_Horse_InitVars;
#endif

View file

@ -61,7 +61,7 @@ u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) {
} else if (gSaveContext.eventChkInf[3] & 8) {
return 0x401C;
} else {
player->exchangeItemId = 0x1D;
player->exchangeItemId = EXCH_ITEM_LETTER_RUTO;
return 0x401A;
}
}
@ -80,7 +80,7 @@ u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) {
return CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A;
}
} else {
player->exchangeItemId = 0xC;
player->exchangeItemId = EXCH_ITEM_PRESCRIPTION;
return 0x4012;
}
}
@ -219,8 +219,8 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0) != 0) {
if ((this->actor.textId == 0x401A) && (!(gSaveContext.eventChkInf[3] & 8))) {
if (func_8002F368(globalCtx) == 0x1D) {
if ((this->actor.textId == 0x401A) && !(gSaveContext.eventChkInf[3] & 8)) {
if (func_8002F368(globalCtx) == EXCH_ITEM_LETTER_RUTO) {
this->actor.textId = 0x401B;
this->sfxPlayed = false;
} else {
@ -229,22 +229,25 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) {
player->actor.textId = this->actor.textId;
return;
}
if (LINK_IS_ADULT) {
if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) && (func_8002F368(globalCtx) == 0xC)) {
if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) &&
(func_8002F368(globalCtx) == EXCH_ITEM_PRESCRIPTION)) {
this->actor.textId = 0x4014;
this->sfxPlayed = false;
player->actor.textId = this->actor.textId;
this->isTrading = true;
return;
}
this->isTrading = false;
if (gSaveContext.infTable[19] & 0x200) {
this->actor.textId = CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A;
player->actor.textId = this->actor.textId;
return;
} else {
this->actor.textId = CHECK_OWNED_EQUIP(EQUIP_TUNIC, 2) ? 0x401F : 0x4012;
player->actor.textId = this->actor.textId;
}
this->actor.textId = CHECK_OWNED_EQUIP(EQUIP_TUNIC, 2) ? 0x401F : 0x4012;
player->actor.textId = this->actor.textId;
}
}
}

View file

@ -124,7 +124,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
// Only allow Link to talk to her when she is playing the jumping animation
if ((this->jumpTimer == 0) || (func_8008F080(globalCtx) != 0)) {
if ((this->jumpTimer == 0) || (Player_GetMask(globalCtx) != PLAYER_MASK_NONE)) {
this->jumpTimer = 60;
this->actionFunc = EnNiwGirl_Talk;
}
@ -137,21 +137,21 @@ void EnNiwGirl_Talk(EnNiwGirl* this, GlobalContext* globalCtx) {
if ((gSaveContext.eventChkInf[8] & 1) && (this->unk_27A == 0)) {
this->actor.textId = 0x70EA;
}
switch (func_8008F080(globalCtx)) {
case 1:
switch (Player_GetMask(globalCtx)) {
case PLAYER_MASK_KEATON:
this->actor.textId = 0x7118;
break;
case 3:
case PLAYER_MASK_SPOOKY:
this->actor.textId = 0x7119;
break;
case 4:
case 6:
case 7:
case PLAYER_MASK_BUNNY:
case PLAYER_MASK_ZORA:
case PLAYER_MASK_GERUDO:
this->actor.textId = 0x711A;
break;
case 2:
case 5:
case 8:
case PLAYER_MASK_SKULL:
case PLAYER_MASK_GORON:
case PLAYER_MASK_TRUTH:
this->actor.textId = 0x711B;
break;
}

View file

@ -90,14 +90,15 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) {
(this->collider.base.acFlags & 2) || (this->collider.base.maskA & 2)) {
// Checking if the player is using a shield that reflects projectiles
// And if so, reflects the projectile on impact
if ((player->currentShield == 1) || ((player->currentShield == 2) && LINK_IS_ADULT)) {
if ((player->currentShield == PLAYER_SHIELD_DEKU) ||
((player->currentShield == PLAYER_SHIELD_HYLIAN) && LINK_IS_ADULT)) {
if ((this->collider.base.atFlags & 2) && (this->collider.base.atFlags & 0x10) &&
(this->collider.base.atFlags & 4)) {
this->collider.base.atFlags &= ~0x16;
this->collider.base.atFlags |= 0x08;
this->collider.body.toucher.flags = 2;
func_800D20CC(&player->mf_A20, &sp4C, 0);
func_800D20CC(&player->shieldMf, &sp4C, 0);
this->actor.posRot.rot.y = sp4C.y + 0x8000;
this->timer = 30;
return;

View file

@ -1577,7 +1577,7 @@ s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) {
this->actor.floorPolySource; // necessary match, can't move this out of this block unfortunately
dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
if ((dynaActor != NULL) && (dynaActor->actor.id == ACTOR_BG_BDAN_OBJECTS) && (dynaActor->actor.params == 0) &&
(!func_8008E988(globalCtx)) && (globalCtx->msgCtx.unk_E300 == 0)) {
(!Player_InCsMode(globalCtx)) && (globalCtx->msgCtx.unk_E300 == 0)) {
func_80AEE02C(this);
globalCtx->csCtx.segment = &D_80AF10A4;
gSaveContext.cutsceneTrigger = 1;
@ -1641,7 +1641,7 @@ s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) {
s8 curRoomNum = globalCtx->roomCtx.curRoom.num;
if ((!(gSaveContext.infTable[20] & 0x10)) && (func_80AEB124(globalCtx) != 0)) {
if (func_8008E988(globalCtx) == 0) {
if (!Player_InCsMode(globalCtx)) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06004648, 1.0f, 0,
SkelAnime_GetFrameCount(&D_06004350.genericHeader), 0, -8.0f);
func_80AED600(this);

View file

@ -77,7 +77,7 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, this->actor.scale.x);
this->actor.shape.rot.y += 0x400;
if (func_8008E988(globalCtx) == 0) {
if (!Player_InCsMode(globalCtx)) {
func_80AFB748(this, globalCtx);
if (this->collider.base.maskB & 0x1) {

View file

@ -264,7 +264,7 @@ void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) {
ColliderBody* body = &this->colCylinder[0].body;
Player* player = PLAYER;
if (player->stickFlameTimer != 0) {
if (player->unk_860 != 0) {
body->bumper.flags |= 2;
this->colCylinder[1].body.bumper.flags &= ~2;
this->colCylinder[2].body.bumper.flags &= ~2;
@ -358,7 +358,7 @@ s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) {
}
this->gaveDamageSpinTimer = 30;
globalCtx->unk_11D58(globalCtx, -8);
globalCtx->damagePlayer(globalCtx, -8);
Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsLink, 6.0f);
return true;

View file

@ -8,7 +8,7 @@
#define FLAGS 0x00000035
#define THIS ((EnTorch2*)thisx)
#define THIS ((Player*)thisx)
void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx);
@ -21,7 +21,7 @@ const ActorInit En_Torch2_InitVars = {
ACTORTYPE_BOSS,
FLAGS,
OBJECT_TORCH2,
sizeof(EnTorch2),
sizeof(Player),
(ActorFunc)EnTorch2_Init,
(ActorFunc)EnTorch2_Destroy,
(ActorFunc)EnTorch2_Update,

View file

@ -4,12 +4,7 @@
#include <ultra64.h>
#include <global.h>
struct EnTorch2;
typedef struct EnTorch2 {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x948];
} EnTorch2; // size = 0x0A94
// Uses the Player struct (from z64player.h)
extern const ActorInit En_Torch2_InitVars;

View file

@ -265,11 +265,9 @@ void EnWallmas_SetupStun(EnWallmas* this) {
}
void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) {
Vec3f* playerPos;
Player* player;
Player* player = PLAYER;
Vec3f* playerPos = &player->actor.posRot.pos;
player = PLAYER;
playerPos = &player->actor.posRot.pos;
this->actor.posRot.pos = *playerPos;
this->actor.groundY = player->actor.groundY;
this->actor.floorPoly = player->actor.floorPoly;
@ -278,8 +276,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) {
this->timer--;
}
if (((s32)(player->stateFlags1 << 0xB) < 0) || ((s32)(player->stateFlags1 << 4) < 0) ||
((player->actor.bgCheckFlags & 1) == 0) ||
if ((player->stateFlags1 & 0x100000) || (player->stateFlags1 & 0x8000000) || !(player->actor.bgCheckFlags & 1) ||
((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, playerPos)))) {
func_800F8D04(NA_SE_EN_FALL_AIM);
this->timer = 0x82;
@ -296,9 +293,10 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) {
void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (!func_8008E988(globalCtx) && (player->stateFlags2 & 0x10) == 0 && (player->invincibilityTimer >= 0) &&
if (!Player_InCsMode(globalCtx) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) &&
(this->actor.xzDistFromLink < 30.0f) && (this->actor.yDistFromLink < -5.0f) &&
(-(f32)(player->unk_4DA + 0xA) < this->actor.yDistFromLink)) {
(-(f32)(player->cylinder.dim.height + 10) < this->actor.yDistFromLink)) {
EnWallmas_SetupTakePlayer(this, globalCtx);
}
}
@ -396,9 +394,8 @@ void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) {
}
void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) {
Player* player;
Player* player = PLAYER;
player = PLAYER;
if (func_800A56C8(&this->skelAnime, 1.0f) != 0) {
if (LINK_IS_CHILD) {
func_8002F7DC(&this->actor, NA_SE_VO_LI_DAMAGE_S_KID);

View file

@ -167,7 +167,7 @@ void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) {
}
this->unk_158 = 0;
func_8002F1C4(&this->actor, globalCtx, this->unk_15C + 50.0f, 100.0f, 0);
func_8002F1C4(&this->actor, globalCtx, this->unk_15C + 50.0f, 100.0f, EXCH_ITEM_NONE);
}
}
}

View file

@ -504,7 +504,7 @@ void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) {
case 1:
if ((func_8010BDBC(msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) {
this->actor.textId = 0xFFFF;
globalCtx->unk_11D5C(globalCtx, &this->actor);
globalCtx->talkWithPlayer(globalCtx, &this->actor);
func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, 120.0f, 10.0f);
globalCtx->msgCtx.msgMode = 0x36;
globalCtx->msgCtx.unk_E3E7 = 4;

View file

@ -591,8 +591,8 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
{
Player* player = PLAYER;
Matrix_Push();
if (player->unk_15D == 0xFF) {
Matrix_Put(&player->mf_A20);
if (player->rightHandType == 0xFF) {
Matrix_Put(&player->shieldMf);
Matrix_Translate(180.0f, 979.0f, -375.0f, MTXMODE_APPLY);
Matrix_RotateRPY(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY);
Matrix_Scale(1.2f, 1.2f, 1.2f, MTXMODE_APPLY);

View file

@ -52,6 +52,7 @@ void EndTitle_Draw(Actor* thisx, GlobalContext* globalCtx) {
EndTitle* this = THIS;
s32 frameCount = globalCtx->csCtx.frames;
Player* player = PLAYER;
mf = &player->mf_9E0;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 403);

View file

@ -49,7 +49,7 @@ static s16 sDrawItemIndexes[] = {
static s16 sGetItemIds[] = {
GI_BOTTLE, GI_LETTER_RUTO, GI_SHIELD_HYLIAN, GI_QUIVER_40, GI_SCALE_SILVER, GI_SCALE_GOLD, GI_KEY_SMALL,
GI_ARROW_FIRE, GI_INVALID, GI_INVALID, GI_INVALID, GI_INVALID, GI_INVALID, GI_INVALID,
GI_ARROW_FIRE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE,
};
void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionFunc) {

View file

@ -82,7 +82,7 @@ void MagicDark_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, thisx->scale.x);
} else if (this->unk_14C < 55) {
Actor_SetScale(&this->actor, thisx->scale.x * 0.9f);
Math_SmoothScaleMaxMinF(&this->unk_154, player->unk_90C, 0.5f, 3.0f, 1.0f);
Math_SmoothScaleMaxMinF(&this->unk_154, player->bodyPartsPos[0].y, 0.5f, 3.0f, 1.0f);
if (this->unk_14C >= 49) {
func_80B8772C(globalCtx, (54 - this->unk_14C) * 0.2f);
}

View file

@ -144,10 +144,9 @@ void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) {
case 1:
SkelCurve_SetAnim(&this->skelCurve, &sTransformUpdIdx, 60.0f, 0.0f, 60.0f, -1.0f);
MagicWind_SetupAction(this, MagicWind_Shrink);
// "Indicates start" = %s
// Means start
LOG_STRING("表示開始", "../z_magic_wind.c", 486);
func_8002F7DC(player, NA_SE_PL_MAGIC_WIND_WARP);
func_8002F7DC(&player->actor, NA_SE_PL_MAGIC_WIND_WARP);
break;
}
}

View file

@ -72,8 +72,8 @@ void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) {
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode1);
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode2);
func_800876C8(globalCtx);
if (gSaveContext.nayrusLoveTimer && globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].length) {
player->unk_692 |= 0x40;
if ((gSaveContext.nayrusLoveTimer != 0) && (globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].length != 0)) {
player->stateFlags3 |= 0x40;
}
}

View file

@ -64,8 +64,8 @@ void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Player* player = PLAYER;
func_800876C8(globalCtx);
if (gSaveContext.nayrusLoveTimer) {
player->unk_692 |= 0x40;
if (gSaveContext.nayrusLoveTimer != 0) {
player->stateFlags3 |= 0x40;
}
}

View file

@ -48,8 +48,8 @@ void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Player* player = PLAYER;
func_800876C8(globalCtx);
if (gSaveContext.nayrusLoveTimer) {
player->unk_692 |= 0x40;
if (gSaveContext.nayrusLoveTimer != 0) {
player->stateFlags3 |= 0x40;
}
}

View file

@ -43,8 +43,8 @@ void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Player* player = PLAYER;
func_800876C8(globalCtx);
if (gSaveContext.nayrusLoveTimer) {
player->unk_692 |= 0x40;
if (gSaveContext.nayrusLoveTimer != 0) {
player->stateFlags3 |= 0x40;
}
}

View file

@ -44,8 +44,8 @@ void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Player* player = PLAYER;
func_800876C8(globalCtx);
if (gSaveContext.nayrusLoveTimer) {
player->unk_692 |= 0x40;
if (gSaveContext.nayrusLoveTimer != 0) {
player->stateFlags3 |= 0x40;
}
}

View file

@ -172,9 +172,9 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
} else {
if (!(120.0f < this->actor.xzDistFromLink) && gSaveContext.dayTime >= 0x4555 && gSaveContext.dayTime < 0x5000) {
cylinderPos.x = player->unk_95C.x + globalCtx->envCtx.unk_04.x * 0.16666667f;
cylinderPos.y = player->unk_95C.y - 30.0f + globalCtx->envCtx.unk_04.y * 0.16666667f;
cylinderPos.z = player->unk_95C.z + globalCtx->envCtx.unk_04.z * 0.16666667f;
cylinderPos.x = player->bodyPartsPos[7].x + globalCtx->envCtx.unk_04.x * 0.16666667f;
cylinderPos.y = player->bodyPartsPos[7].y - 30.0f + globalCtx->envCtx.unk_04.y * 0.16666667f;
cylinderPos.z = player->bodyPartsPos[7].z + globalCtx->envCtx.unk_04.z * 0.16666667f;
this->hitboxPos = cylinderPos;

File diff suppressed because it is too large Load diff