mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 23:36:22 +00:00
parent
76cffddf29
commit
38bcbdb0b9
3 changed files with 61 additions and 71 deletions
|
@ -119,55 +119,45 @@ void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) {
|
||||
s16 phi_v1_2;
|
||||
s16 quarterTurn;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
f32 distToBurn;
|
||||
BossDodongo* bossDodongo;
|
||||
s16 i;
|
||||
s16 phi_v1;
|
||||
s32 temp;
|
||||
|
||||
bossDodongo = ((BossDodongo*)this->actor.parent);
|
||||
this->unk_158 = bossDodongo->unk_1A2;
|
||||
phi_v1_2 = 0;
|
||||
quarterTurn = false;
|
||||
if (this->actor.params == 0) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EN_DODO_K_FIRE - SFX_FLAG, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
Math_SmoothStepToF(&this->actor.scale.x, this->unk_188, 0.3f, 0.5f, 0.0f);
|
||||
Actor_SetScale(&this->actor, this->actor.scale.x);
|
||||
if (this->actor.world.pos.x < -1390.0f) {
|
||||
if (this->actor.velocity.x < -10.0f) {
|
||||
this->actor.world.pos.x = -1390.0f;
|
||||
phi_v1_2 = 1;
|
||||
}
|
||||
if ((this->actor.world.pos.x < -1390.0f) && (this->actor.velocity.x < -10.0f)) {
|
||||
this->actor.world.pos.x = -1390.0f;
|
||||
quarterTurn = true;
|
||||
}
|
||||
if ((this->actor.world.pos.x > -390.0f) && (this->actor.velocity.x > 10.0f)) {
|
||||
this->actor.world.pos.x = -390.0f;
|
||||
phi_v1_2 = 1;
|
||||
quarterTurn = true;
|
||||
}
|
||||
if ((this->actor.world.pos.z > -2804.0f) && (this->actor.velocity.z > 10.0f)) {
|
||||
this->actor.world.pos.z = -2804.0f;
|
||||
phi_v1_2 = 1;
|
||||
quarterTurn = true;
|
||||
}
|
||||
if ((this->actor.world.pos.z < -3804.0f) && (this->actor.velocity.z < -10.0f)) {
|
||||
this->actor.world.pos.z = -3804.0f;
|
||||
phi_v1_2 = 1;
|
||||
quarterTurn = true;
|
||||
}
|
||||
if (phi_v1_2 != 0) {
|
||||
if (quarterTurn) {
|
||||
if (this->unk_158 == 0) {
|
||||
this->actor.world.rot.y += 0x4000;
|
||||
} else {
|
||||
this->actor.world.rot.y -= 0x4000;
|
||||
}
|
||||
}
|
||||
if (this->unk_154 == 0) {
|
||||
temp = 0;
|
||||
} else {
|
||||
this->unk_154--;
|
||||
temp = this->unk_154;
|
||||
}
|
||||
if (temp == 0) {
|
||||
if (DECR(this->unk_154) == 0) {
|
||||
Math_SmoothStepToF(&this->unk_18C, 0.0f, 1.0f, 10.0f, 0.0f);
|
||||
if (this->unk_18C < 10.0f) {
|
||||
Actor_Kill(&this->actor);
|
||||
|
@ -200,11 +190,11 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) {
|
|||
object_kingdodongo_Tex_0294E0, object_kingdodongo_Tex_02A4E0, object_kingdodongo_Tex_02B4E0,
|
||||
object_kingdodongo_Tex_02C4E0, object_kingdodongo_Tex_02D4E0,
|
||||
};
|
||||
s16 temp;
|
||||
s16 texIndex;
|
||||
s32 pad;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 612);
|
||||
temp = this->unk_156 & 7;
|
||||
texIndex = this->unk_156 & 7;
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
func_80094BC4(globalCtx->state.gfxCtx);
|
||||
POLY_XLU_DISP = func_80094968(POLY_XLU_DISP);
|
||||
|
@ -214,7 +204,7 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) {
|
|||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 100, (s8)this->unk_18C);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 0);
|
||||
gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809BCB10[temp]));
|
||||
gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809BCB10[texIndex]));
|
||||
Matrix_Translate(0.0f, 11.0f, 0.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 647),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -62,13 +62,13 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static AnimationHeader* D_809FCECC[] = { &gDoor3Anim, &gDoor1Anim, &gDoor4Anim, &gDoor2Anim };
|
||||
static AnimationHeader* sDoorAnims[] = { &gDoor3Anim, &gDoor1Anim, &gDoor4Anim, &gDoor2Anim };
|
||||
|
||||
static u8 sDoorAnimOpenFrames[] = { 25, 25, 25, 25 };
|
||||
|
||||
static u8 sDoorAnimCloseFrames[] = { 60, 70, 60, 70 };
|
||||
|
||||
static Gfx* D_809FCEE4[5][2] = {
|
||||
static Gfx* sDoorDLists[5][2] = {
|
||||
{ gDoorLeftDL, gDoorRightDL },
|
||||
{ gFireTempleDoorWithHandleFrontDL, gFireTempleDoorWithHandleBackDL },
|
||||
{ gWaterTempleDoorLeftDL, gWaterTempleDoorRightDL },
|
||||
|
@ -185,13 +185,13 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) {
|
|||
Player* player = GET_PLAYER(globalCtx);
|
||||
s32 doorType;
|
||||
Vec3f playerPosRelToDoor;
|
||||
s16 phi_v0;
|
||||
s16 yawDiff;
|
||||
|
||||
doorType = this->actor.params >> 7 & 7;
|
||||
func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos);
|
||||
if (this->playerIsOpening != 0) {
|
||||
this->actionFunc = EnDoor_Open;
|
||||
Animation_PlayOnceSetSpeed(&this->skelAnime, D_809FCECC[this->animStyle],
|
||||
Animation_PlayOnceSetSpeed(&this->skelAnime, sDoorAnims[this->animStyle],
|
||||
(player->stateFlags1 & PLAYER_STATE1_27) ? 0.75f : 1.5f);
|
||||
if (this->lockTimer != 0) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--;
|
||||
|
@ -201,11 +201,11 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) {
|
|||
} else if (!Player_InCsMode(globalCtx)) {
|
||||
if (fabsf(playerPosRelToDoor.y) < 20.0f && fabsf(playerPosRelToDoor.x) < 20.0f &&
|
||||
fabsf(playerPosRelToDoor.z) < 50.0f) {
|
||||
phi_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y;
|
||||
yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y;
|
||||
if (playerPosRelToDoor.z > 0.0f) {
|
||||
phi_v0 = 0x8000 - phi_v0;
|
||||
yawDiff = 0x8000 - yawDiff;
|
||||
}
|
||||
if (ABS(phi_v0) < 0x3000) {
|
||||
if (ABS(yawDiff) < 0x3000) {
|
||||
if (this->lockTimer != 0) {
|
||||
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) {
|
||||
Player* player2 = GET_PLAYER(globalCtx);
|
||||
|
@ -299,27 +299,27 @@ void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
s32 pad;
|
||||
TransitionActorEntry* transitionEntry;
|
||||
Gfx** temp_a2;
|
||||
Gfx** doorDLists;
|
||||
s32 pad2;
|
||||
s16 phi_v0_2;
|
||||
s32 phi_v0;
|
||||
s16 rotDiff;
|
||||
s32 doorDListIndex;
|
||||
EnDoor* this = (EnDoor*)thisx;
|
||||
|
||||
if (limbIndex == 4) {
|
||||
temp_a2 = D_809FCEE4[this->dListIndex];
|
||||
doorDLists = sDoorDLists[this->dListIndex];
|
||||
transitionEntry = &globalCtx->transiActorCtx.list[(u16)this->actor.params >> 0xA];
|
||||
rot->z += this->actor.world.rot.y;
|
||||
if ((globalCtx->roomCtx.prevRoom.num >= 0) ||
|
||||
(transitionEntry->sides[0].room == transitionEntry->sides[1].room)) {
|
||||
phi_v0_2 = ((this->actor.shape.rot.y + this->skelAnime.jointTable[3].z) + rot->z) -
|
||||
Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.world.pos);
|
||||
*dList = (ABS(phi_v0_2) < 0x4000) ? temp_a2[0] : temp_a2[1];
|
||||
rotDiff = ((this->actor.shape.rot.y + this->skelAnime.jointTable[3].z) + rot->z) -
|
||||
Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.world.pos);
|
||||
*dList = (ABS(rotDiff) < 0x4000) ? doorDLists[0] : doorDLists[1];
|
||||
} else {
|
||||
phi_v0 = this->unk_192;
|
||||
doorDListIndex = this->unk_192;
|
||||
if (transitionEntry->sides[0].room != this->actor.room) {
|
||||
phi_v0 ^= 1;
|
||||
doorDListIndex ^= 1;
|
||||
}
|
||||
*dList = temp_a2[phi_v0];
|
||||
*dList = doorDLists[doorDListIndex];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -118,7 +118,7 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 pad;
|
||||
WaterBox* outWaterBox;
|
||||
f32 ySurface;
|
||||
s32 sp30;
|
||||
s32 floorBgId;
|
||||
|
||||
Actor_ProcessInitChain(thisx, sInitChain);
|
||||
this->numShots = (thisx->params >> 8) & 0xFF;
|
||||
|
@ -133,7 +133,7 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->numShots = 1;
|
||||
}
|
||||
thisx->floorHeight =
|
||||
BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &sp30, thisx, &thisx->world.pos);
|
||||
BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &floorBgId, thisx, &thisx->world.pos);
|
||||
//! @bug calls WaterBox_GetSurfaceImpl directly
|
||||
if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface,
|
||||
&outWaterBox) ||
|
||||
|
@ -262,20 +262,20 @@ void EnOkuta_SetupFreeze(EnOkuta* this) {
|
|||
void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Vec3f velocity;
|
||||
f32 sin = Math_SinS(this->actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->actor.shape.rot.y);
|
||||
f32 sinY = Math_SinS(this->actor.shape.rot.y);
|
||||
f32 cosY = Math_CosS(this->actor.shape.rot.y);
|
||||
|
||||
pos.x = this->actor.world.pos.x + (25.0f * sin);
|
||||
pos.x = this->actor.world.pos.x + (25.0f * sinY);
|
||||
pos.y = this->actor.world.pos.y - 6.0f;
|
||||
pos.z = this->actor.world.pos.z + (25.0f * cos);
|
||||
pos.z = this->actor.world.pos.z + (25.0f * cosY);
|
||||
if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x,
|
||||
this->actor.shape.rot.y, this->actor.shape.rot.z, 0x10) != NULL) {
|
||||
pos.x = this->actor.world.pos.x + (40.0f * sin);
|
||||
pos.z = this->actor.world.pos.z + (40.0f * cos);
|
||||
pos.x = this->actor.world.pos.x + (40.0f * sinY);
|
||||
pos.z = this->actor.world.pos.z + (40.0f * cosY);
|
||||
pos.y = this->actor.world.pos.y;
|
||||
velocity.x = 1.5f * sin;
|
||||
velocity.x = 1.5f * sinY;
|
||||
velocity.y = 0.0f;
|
||||
velocity.z = 1.5f * cos;
|
||||
velocity.z = 1.5f * cosY;
|
||||
EnOkuta_SpawnDust(&pos, &velocity, 20, globalCtx);
|
||||
}
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW);
|
||||
|
@ -333,8 +333,8 @@ void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) {
|
||||
s16 temp_v0_2;
|
||||
s32 phi_v1;
|
||||
s16 yawDiff;
|
||||
s32 absYawDiff;
|
||||
|
||||
this->actor.world.pos.y = this->actor.home.pos.y;
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
@ -349,9 +349,9 @@ void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.xzDistToPlayer < 160.0f || this->actor.xzDistToPlayer > 560.0f) {
|
||||
EnOkuta_SetupHide(this);
|
||||
} else {
|
||||
temp_v0_2 = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C, 0x38E);
|
||||
phi_v1 = ABS(temp_v0_2);
|
||||
if ((phi_v1 < 0x38E) && (this->timer == 0) && (this->actor.yDistToPlayer < 200.0f)) {
|
||||
yawDiff = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C, 0x38E);
|
||||
absYawDiff = ABS(yawDiff);
|
||||
if ((absYawDiff < 0x38E) && (this->timer == 0) && (this->actor.yDistToPlayer < 200.0f)) {
|
||||
EnOkuta_SetupShoot(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
s16 temp_v1;
|
||||
s16 posParam;
|
||||
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
|
@ -456,10 +456,10 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
EnOkuta_SetupDie(this);
|
||||
}
|
||||
if ((this->timer >= 64) && (this->timer & 1)) {
|
||||
temp_v1 = (this->timer - 64) >> 1;
|
||||
pos.y = (this->actor.world.pos.y - 32.0f) + (8.0f * (8 - temp_v1));
|
||||
pos.x = this->actor.world.pos.x + ((temp_v1 & 2) ? 10.0f : -10.0f);
|
||||
pos.z = this->actor.world.pos.z + ((temp_v1 & 1) ? 10.0f : -10.0f);
|
||||
posParam = (this->timer - 64) >> 1;
|
||||
pos.y = (this->actor.world.pos.y - 32.0f) + (8.0f * (8 - posParam));
|
||||
pos.x = this->actor.world.pos.x + ((posParam & 2) ? 10.0f : -10.0f);
|
||||
pos.z = this->actor.world.pos.z + ((posParam & 1) ? 10.0f : -10.0f);
|
||||
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255,
|
||||
(Rand_ZeroOne() * 0.2f) + 1.9f);
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3s sp40;
|
||||
Vec3s shieldRot;
|
||||
|
||||
this->timer--;
|
||||
if (this->timer == 0) {
|
||||
|
@ -491,8 +491,8 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY);
|
||||
this->collider.base.atFlags |= AT_TYPE_PLAYER;
|
||||
this->collider.info.toucher.dmgFlags = 2;
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp40, 0);
|
||||
this->actor.world.rot.y = sp40.y + 0x8000;
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, 0);
|
||||
this->actor.world.rot.y = shieldRot.y + 0x8000;
|
||||
this->timer = 30;
|
||||
} else {
|
||||
pos.x = this->actor.world.pos.x;
|
||||
|
@ -575,8 +575,8 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
Player* player = GET_PLAYER(globalCtx);
|
||||
WaterBox* outWaterBox;
|
||||
f32 ySurface;
|
||||
Vec3f sp38;
|
||||
s32 sp34;
|
||||
Vec3f prevPos;
|
||||
s32 canRestorePrevPos;
|
||||
|
||||
if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29))) {
|
||||
if (this->actor.params == 0) {
|
||||
|
@ -599,23 +599,23 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
(((sOctorockColliderInit.dim.height * this->headScale.y) - this->collider.dim.yShift) *
|
||||
this->actor.scale.y * 100.0f);
|
||||
} else {
|
||||
sp34 = false;
|
||||
canRestorePrevPos = false;
|
||||
Actor_MoveForward(&this->actor);
|
||||
Math_Vec3f_Copy(&sp38, &this->actor.world.pos);
|
||||
Math_Vec3f_Copy(&prevPos, &this->actor.world.pos);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 30.0f,
|
||||
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
|
||||
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) &&
|
||||
SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) {
|
||||
sp34 = true;
|
||||
canRestorePrevPos = true;
|
||||
this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL;
|
||||
}
|
||||
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
|
||||
SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) {
|
||||
sp34 = true;
|
||||
canRestorePrevPos = true;
|
||||
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
|
||||
}
|
||||
if (sp34 && !(this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL))) {
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &sp38);
|
||||
if (canRestorePrevPos && !(this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL))) {
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &prevPos);
|
||||
}
|
||||
}
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
|
|
Loading…
Reference in a new issue