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

Actor Struct Changes (and a few related things) (#617)

* reformat header

* type -> category

* done for now i think

* some more stuff

* first -> head

* focus

* flag comment

* ground -> floor

* remove asm, name wrapper funcs

* name func, format

* review

* targetPriority, format

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0305ec2c2"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0305ec2c2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* comment

* review

* feet flags

* horse shadow
This commit is contained in:
fig02 2021-01-18 16:04:04 -05:00 committed by GitHub
parent 20206fba0d
commit 00a5edea71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
697 changed files with 8157 additions and 7942 deletions

View file

@ -202,7 +202,7 @@ static DamageTable sDamageTableWhite = {
const ActorInit En_Bb_InitVars = {
ACTOR_EN_BB,
ACTORTYPE_ENEMY,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_BB,
sizeof(EnBb),
@ -240,7 +240,7 @@ static ColliderJntSphInit sJntSphInit = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(unk_4C, 10, ICHAIN_STOP),
ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP),
};
void EnBb_SetupAction(EnBb* this, EnBbActionFunc actionFunc) {
@ -248,7 +248,7 @@ void EnBb_SetupAction(EnBb* this, EnBbActionFunc actionFunc) {
}
Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) {
Actor* explosive = globalCtx->actorCtx.actorList[ACTORTYPE_EXPLOSIVES].first;
Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head;
f32 dist;
while (explosive != NULL) {
@ -256,7 +256,7 @@ Actor* EnBb_FindExplosive(GlobalContext* globalCtx, EnBb* this, f32 range) {
explosive = explosive->next;
continue;
}
dist = func_8002DB48(&this->actor, explosive);
dist = Actor_WorldDistXYZToActor(&this->actor, explosive);
if ((explosive->params == 0) && (dist <= range)) {
return explosive;
}
@ -271,8 +271,8 @@ void EnBb_SpawnFlameTrail(GlobalContext* globalCtx, EnBb* this, s16 startAtZero)
s32 i;
for (i = 0; i < 5; i++) {
next = (EnBb*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BB, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, 0, 0, 0);
next = (EnBb*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BB, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
if (next != NULL) {
now->actor.child = &next->actor;
next->actor.parent = &now->actor;
@ -328,7 +328,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->params |= 0xFF00;
}
if (thisx->params <= ENBB_BLUE) {
ActorShape_Init(&thisx->shape, 200.0f, ActorShadow_DrawFunc_Circle, 35.0f);
ActorShape_Init(&thisx->shape, 200.0f, ActorShadow_DrawCircle, 35.0f);
}
if (thisx->params & 0xFF00) {
this->timer = 0;
@ -346,7 +346,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->naviEnemyId = 0x1C;
thisx->colChkInfo.damageTable = &sDamageTableBlueGreen;
this->flamePrimBlue = this->flameEnvColor.b = 255;
thisx->posRot.pos.y += 50.0f;
thisx->world.pos.y += 50.0f;
EnBb_SetupBlue(this);
thisx->flags |= 0x4000;
break;
@ -393,7 +393,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBb_InitGreen(this, globalCtx);
break;
}
thisx->posRot2.pos = thisx->posRot.pos;
thisx->focus.pos = thisx->world.pos;
} else {
EnBb_SetupFlameTrail(this);
}
@ -444,10 +444,10 @@ void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) {
this->flamePrimAlpha -= 20;
}
}
this->actor.posRot.pos = this->actor.parent->pos4;
this->actor.world.pos = this->actor.parent->prevPos;
} else {
this->timer--;
this->actor.shape.rot.y = this->actor.posRot.rot.y = this->actor.parent->posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.parent->world.rot.y;
}
}
if (this->actor.parent != NULL) {
@ -457,7 +457,7 @@ void EnBb_FlameTrail(EnBb* this, GlobalContext* globalCtx) {
void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx) {
if (this->actor.params <= ENBB_BLUE) {
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.speedXZ = -7.0f;
this->timer = 5;
this->actor.shape.rot.x += 0x4E20;
@ -489,7 +489,7 @@ void EnBb_Death(EnBb* this, GlobalContext* globalCtx) {
if (!func_8003305C(&this->actor, &this->enPartInfo, globalCtx, sp4E)) {
return;
}
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0xD0);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0);
} else {
if (this->flamePrimAlpha) {
if (this->flamePrimAlpha <= 20) {
@ -507,11 +507,11 @@ void EnBb_SetupDamage(EnBb* this) {
this->action = BB_DAMAGE;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_DAMAGE);
if (this->actor.params > ENBB_GREEN) {
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if ((this->actor.bgCheckFlags & 8) == 0) {
this->actor.speedXZ = -7.0f;
}
this->actor.shape.unk_08 = 1500.0f;
this->actor.shape.yOffset = 1500.0f;
}
if (this->actor.params == ENBB_RED) {
EnBb_KillFlameTrail(this);
@ -524,7 +524,7 @@ void EnBb_SetupDamage(EnBb* this) {
void EnBb_Damage(EnBb* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
if (this->actor.speedXZ == 0.0f) {
this->actor.shape.unk_08 = 200.0f;
this->actor.shape.yOffset = 200.0f;
EnBb_SetupDown(this);
}
}
@ -547,8 +547,8 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->flameScaleY, 80.0f, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&this->flameScaleX, 100.0f, 1.0f, 10.0f, 0.0f);
if (this->actor.groundY > -32000.0f) {
Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.groundY + 50.0f + this->flyHeightMod, 1.0f, 0.5f,
if (this->actor.floorHeight > -32000.0f) {
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 50.0f + this->flyHeightMod, 1.0f, 0.5f,
0.0f);
}
SkelAnime_Update(&this->skelAnime);
@ -559,13 +559,13 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->bobSpeedMod = Rand_ZeroOne() * 4.0f;
}
}
this->actor.posRot.pos.y += Math_CosF(this->bobPhase) * (1.0f + this->bobSpeedMod);
this->actor.world.pos.y += Math_CosF(this->bobPhase) * (1.0f + this->bobSpeedMod);
this->bobPhase += 0.2f;
Math_SmoothStepToF(&this->actor.speedXZ, this->maxSpeed, 1.0f, 0.5f, 0.0f);
if (Math_Vec3f_DistXZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos) > 300.0f) {
this->vMoveAngleY = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->vMoveAngleY, 1, 0x7D0, 0);
if (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) > 300.0f) {
this->vMoveAngleY = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos);
Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0x7D0, 0);
} else {
this->timer--;
if (this->timer <= 0) {
@ -573,10 +573,10 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->flyHeightMod = (s16)(Math_CosF(this->bobPhase) * 10.0f);
this->actor.speedXZ = 0.0f;
if (this->charge && (this->targetActor == NULL)) {
this->vMoveAngleY = this->actor.posRot.rot.y;
if (this->actor.xzDistToLink < 200.0f) {
this->vMoveAngleY = this->actor.world.rot.y;
if (this->actor.xzDistToPlayer < 200.0f) {
Animation_PlayLoop(&this->skelAnime, &D_06000184);
this->vMoveAngleY = this->actor.yawTowardsLink;
this->vMoveAngleY = this->actor.yawTowardsPlayer;
}
this->maxSpeed = (Rand_ZeroOne() * 1.5f) + 6.0f;
this->timer = (Rand_ZeroOne() * 5.0f) + 20.0f;
@ -588,16 +588,16 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->vMoveAngleY = Math_SinF(this->bobPhase) * 65535.0f;
}
}
if ((this->actor.xzDistToLink < 150.0f) && (this->actionState != BBBLUE_NORMAL)) {
if ((this->actor.xzDistToPlayer < 150.0f) && (this->actionState != BBBLUE_NORMAL)) {
if (!this->charge) {
Animation_PlayLoop(&this->skelAnime, &D_06000184);
this->maxSpeed = (Rand_ZeroOne() * 1.5f) + 6.0f;
this->timer = (Rand_ZeroOne() * 5.0f) + 20.0f;
this->vMoveAngleY = this->actor.yawTowardsLink;
this->vMoveAngleY = this->actor.yawTowardsPlayer;
this->actionState = this->charge = true; // Sets actionState to BBBLUE_AGGRO
}
} else if (this->actor.xzDistToLink < 200.0f) {
this->vMoveAngleY = this->actor.yawTowardsLink;
} else if (this->actor.xzDistToPlayer < 200.0f) {
this->vMoveAngleY = this->actor.yawTowardsPlayer;
}
if (this->targetActor == NULL) {
explosive = EnBb_FindExplosive(globalCtx, this, 300.0f);
@ -607,35 +607,35 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
explosive = NULL;
}
if (explosive != NULL) {
this->vMoveAngleY = func_8002DA78(&this->actor, explosive);
this->vMoveAngleY = Actor_WorldYawTowardActor(&this->actor, explosive);
if ((this->vBombHopPhase == 0) && (explosive != this->targetActor)) {
this->vBombHopPhase = -0x8000;
this->targetActor = explosive;
this->actor.speedXZ *= 0.5f;
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->vMoveAngleY, 1, 0x1388, 0);
Math_SmoothStepToF(&this->actor.posRot.pos.x, explosive->posRot.pos.x, 1.0f, 1.5f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.y, explosive->posRot.pos.y + 40.0f, 1.0f, 1.5f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.z, explosive->posRot.pos.z, 1.0f, 1.5f, 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0x1388, 0);
Math_SmoothStepToF(&this->actor.world.pos.x, explosive->world.pos.x, 1.0f, 1.5f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.y, explosive->world.pos.y + 40.0f, 1.0f, 1.5f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.z, explosive->world.pos.z, 1.0f, 1.5f, 0.0f);
} else {
this->targetActor = NULL;
}
if (this->vBombHopPhase != 0) {
this->actor.posRot.pos.y += -Math_CosS(this->vBombHopPhase) * 10.0f;
this->actor.world.pos.y += -Math_CosS(this->vBombHopPhase) * 10.0f;
this->vBombHopPhase += 0x1000;
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->vMoveAngleY, 1, 0x7D0, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0x7D0, 0);
}
thisYawToWall = this->actor.wallPolyRot - this->actor.posRot.rot.y;
moveYawToWall = this->actor.wallPolyRot - this->vMoveAngleY;
thisYawToWall = this->actor.wallYaw - this->actor.world.rot.y;
moveYawToWall = this->actor.wallYaw - this->vMoveAngleY;
if ((this->targetActor == NULL) && (this->actor.bgCheckFlags & 8) &&
(ABS(thisYawToWall) > 0x4000 || ABS(moveYawToWall) > 0x4000)) {
this->vMoveAngleY = this->actor.wallPolyRot + this->actor.wallPolyRot - this->actor.posRot.rot.y - 0x8000;
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->vMoveAngleY, 1, 0xBB8, 0);
this->vMoveAngleY = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000;
Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0xBB8, 0);
}
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->vMoveAngleY, 1, 0x3E8, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0x3E8, 0);
if ((this->collider.base.acFlags & AC_HIT) || (this->collider.base.atFlags & AT_HIT)) {
this->vMoveAngleY = this->actor.yawTowardsLink + 0x8000;
this->vMoveAngleY = this->actor.yawTowardsPlayer + 0x8000;
if (this->collider.base.acFlags & AC_HIT) {
afterHitAngle = -0x8000;
} else {
@ -645,7 +645,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
afterHitAngle = -0x4000;
}
}
this->actor.posRot.rot.y = this->actor.yawTowardsLink + afterHitAngle;
this->actor.world.rot.y = this->actor.yawTowardsPlayer + afterHitAngle;
this->collider.base.acFlags &= ~AC_HIT;
this->collider.base.atFlags &= ~AT_HIT;
}
@ -664,14 +664,14 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
if (((s32)this->skelAnime.curFrame == 0) && (Rand_ZeroOne() < 0.1f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_LAUGH);
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y;
}
void EnBb_SetupDown(EnBb* this) {
Animation_PlayLoop(&this->skelAnime, &D_06000444);
this->action = BB_DOWN;
this->timer = 200;
this->actor.dmgEffectTimer = 0;
this->actor.colorFilterTimer = 0;
this->actor.bgCheckFlags &= ~1;
this->actor.speedXZ = 3.0f;
this->flameScaleX = 0.0f;
@ -682,19 +682,18 @@ void EnBb_SetupDown(EnBb* this) {
}
void EnBb_Down(EnBb* this, GlobalContext* globalCtx) {
s16 yawDiff = this->actor.posRot.rot.y - this->actor.wallPolyRot;
s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw;
SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) {
if (ABS(yawDiff) > 0x4000) {
this->actor.posRot.rot.y =
this->actor.wallPolyRot + this->actor.wallPolyRot - this->actor.posRot.rot.y - 0x8000;
this->actor.world.rot.y = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000;
}
this->actor.bgCheckFlags &= ~8;
}
if (this->actor.bgCheckFlags & 3) {
if (this->actor.params == ENBB_RED) {
s32 floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorPolySource);
s32 floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorType == 2) || (floorType == 3) || (floorType == 9)) {
this->moveMode = BBMOVE_HIDDEN;
@ -713,10 +712,10 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) {
this->actor.velocity.y = 10.0f;
}
this->actor.bgCheckFlags &= ~1;
func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, 7.0f, 2, 2.0f, 0, 0, 0);
Math_SmoothStepToS(&this->actor.posRot.rot.y, -this->actor.yawTowardsLink, 1, 0xBB8, 0);
func_80033260(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, -this->actor.yawTowardsPlayer, 1, 0xBB8, 0);
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y;
if ((s32)this->skelAnime.curFrame == 5) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_WING);
}
@ -738,7 +737,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) {
this->actor.velocity.y = 0.0f;
this->actor.gravity = 0.0f;
EnBb_SetupWhite(globalCtx, this);
this->actor.posRot.pos.y -= 60.0f;
this->actor.world.pos.y -= 60.0f;
break;
}
} else {
@ -761,8 +760,8 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) {
this->timer = 0;
this->actionState = BBRED_WAIT;
this->moveMode = BBMOVE_HIDDEN;
this->actor.posRot.pos.y -= 80.0f;
this->actor.initPosRot.pos = this->actor.posRot.pos;
this->actor.world.pos.y -= 80.0f;
this->actor.home.pos = this->actor.world.pos;
this->actor.velocity.y = this->actor.gravity = this->actor.speedXZ = 0.0f;
this->actor.bgCheckFlags &= ~1;
this->actor.flags &= ~1;
@ -781,10 +780,10 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) {
this->timer--;
}
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
switch (this->actionState) {
case BBRED_WAIT:
if ((func_8002DB48(&this->actor, &player->actor) <= 250.0f) && (ABS(yawDiff) <= 0x4000) &&
if ((Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 250.0f) && (ABS(yawDiff) <= 0x4000) &&
(this->timer == 0)) {
this->actor.speedXZ = 5.0f;
this->actor.gravity = -1.0f;
@ -805,15 +804,15 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->flameScaleY, 80.0f, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&this->flameScaleX, 100.0f, 1.0f, 10.0f, 0.0f);
if (this->actor.bgCheckFlags & 8) {
yawDiff = this->actor.posRot.rot.y - this->actor.wallPolyRot;
yawDiff = this->actor.world.rot.y - this->actor.wallYaw;
if (ABS(yawDiff) > 0x4000) {
this->actor.posRot.rot.y =
this->actor.wallPolyRot + this->actor.wallPolyRot - this->actor.posRot.rot.y - 0x8000;
this->actor.world.rot.y =
this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000;
}
this->actor.bgCheckFlags &= ~8;
}
if (this->actor.bgCheckFlags & 1) {
floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorPolySource);
floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorType == 2) || (floorType == 3) || (floorType == 9)) {
this->moveMode = BBMOVE_HIDDEN;
this->timer = 10;
@ -824,11 +823,11 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) {
if (this->actor.velocity.y > 13.0f) {
this->actor.velocity.y = 13.0f;
}
this->actor.posRot.rot.y = Math_SinF(this->bobPhase) * 65535.0f;
this->actor.world.rot.y = Math_SinF(this->bobPhase) * 65535.0f;
}
this->actor.bgCheckFlags &= ~1;
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y;
if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) {
EnBb_SetupDown(this);
}
@ -840,8 +839,8 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) {
this->actor.velocity.y = 0.0f;
this->actionState = BBRED_WAIT;
this->timer = 120;
this->actor.posRot.pos = this->actor.initPosRot.pos;
this->actor.shape.rot = this->actor.posRot.rot = this->actor.initPosRot.rot;
this->actor.world.pos = this->actor.home.pos;
this->actor.shape.rot = this->actor.world.rot = this->actor.home.rot;
EnBb_KillFlameTrail(this);
}
break;
@ -855,7 +854,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) {
}
void EnBb_FaceWaypoint(EnBb* this) {
this->actor.posRot.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->waypointPos);
this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->waypointPos);
}
void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) {
@ -876,7 +875,7 @@ void EnBb_SetWaypoint(EnBb* this, GlobalContext* globalCtx) {
void EnBb_SetupWhite(GlobalContext* globalCtx, EnBb* this) {
Animation_PlayLoop(&this->skelAnime, &D_06000444);
this->actor.speedXZ = 0.0f;
this->actor.posRot.pos.y += 60.0f;
this->actor.world.pos.y += 60.0f;
this->flameScaleX = 100.0f;
this->action = BB_WHITE;
this->waypoint = 0;
@ -890,15 +889,15 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) {
f32 distL1;
f32 vx;
f32 vz;
s16 pitch = Math_Vec3f_Pitch(&this->actor.posRot.pos, &this->waypointPos);
s16 pitch = Math_Vec3f_Pitch(&this->actor.world.pos, &this->waypointPos);
f32 vy = Math_SinS(pitch) * this->maxSpeed;
f32 vxz = Math_CosS(pitch) * this->maxSpeed;
vx = Math_SinS(this->actor.shape.rot.y) * vxz;
vz = Math_CosS(this->actor.shape.rot.y) * vxz;
distL1 = Math_SmoothStepToF(&this->actor.posRot.pos.x, this->waypointPos.x, 1.0f, ABS(vx), 0.0f);
distL1 += Math_SmoothStepToF(&this->actor.posRot.pos.y, this->waypointPos.y, 1.0f, ABS(vy), 0.0f);
distL1 += Math_SmoothStepToF(&this->actor.posRot.pos.z, this->waypointPos.z, 1.0f, ABS(vz), 0.0f);
distL1 = Math_SmoothStepToF(&this->actor.world.pos.x, this->waypointPos.x, 1.0f, ABS(vx), 0.0f);
distL1 += Math_SmoothStepToF(&this->actor.world.pos.y, this->waypointPos.y, 1.0f, ABS(vy), 0.0f);
distL1 += Math_SmoothStepToF(&this->actor.world.pos.z, this->waypointPos.z, 1.0f, ABS(vz), 0.0f);
this->bobPhase += (0.05f + (Rand_ZeroOne() * 0.01f));
if (distL1 == 0.0f) {
this->timer--;
@ -911,7 +910,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) {
if (this->moveMode != BBMOVE_NORMAL) {
Animation_PlayLoop(&this->skelAnime, &D_06000444);
}
this->actor.posRot.rot.y += 0x1F40;
this->actor.world.rot.y += 0x1F40;
}
this->moveMode = BBMOVE_NORMAL;
this->maxSpeed = 0.0f;
@ -923,7 +922,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_BITE);
this->collider.base.atFlags &= ~AT_HIT;
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y;
} else if (Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f) == 0.0f) {
EnBb_FaceWaypoint(this);
}
@ -947,17 +946,16 @@ void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) {
this->actionState = BBGREEN_FLAME_ON;
this->bobPhase = Rand_ZeroOne();
this->actor.shape.rot.x = this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.yawTowardsLink;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
if (this->actor.params == ENBB_GREEN_BIG) {
EnBb_SetWaypoint(this, globalCtx);
EnBb_FaceWaypoint(this);
}
Matrix_Translate(this->actor.initPosRot.pos.x, this->actor.initPosRot.pos.y, this->actor.initPosRot.pos.z,
MTXMODE_NEW);
Matrix_RotateRPY(this->actor.posRot.rot.x, this->actor.posRot.rot.y, 0, MTXMODE_APPLY);
Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW);
Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY);
Matrix_RotateZ(this->bobPhase, MTXMODE_APPLY);
bobOffset.y = this->bobSize;
Matrix_MultVec3f(&bobOffset, &this->actor.posRot.pos);
Matrix_MultVec3f(&bobOffset, &this->actor.world.pos);
this->targetActor = NULL;
this->action = BB_GREEN;
this->actor.speedXZ = 0.0f;
@ -974,32 +972,32 @@ void EnBb_SetupGreen(EnBb* this) {
this->actor.speedXZ = 0.0f;
this->vFlameTimer = (Rand_ZeroOne() * 30.0f) + 180.0f;
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.yawTowardsLink;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
EnBb_SetupAction(this, EnBb_Green);
}
void EnBb_Green(EnBb* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Vec3f bobOffset = { 0.0f, 0.0f, 0.0f };
Vec3f nextPos = player->actor.posRot.pos;
Vec3f nextPos = player->actor.world.pos;
nextPos.y += 30.0f;
if (this->actor.params == ENBB_GREEN_BIG) {
if (this->actor.speedXZ == 0.0f) {
s16 pitch = Math_Vec3f_Pitch(&this->actor.initPosRot.pos, &this->waypointPos);
s16 yaw = Math_Vec3f_Yaw(&this->actor.initPosRot.pos, &this->waypointPos);
s16 pitch = Math_Vec3f_Pitch(&this->actor.home.pos, &this->waypointPos);
s16 yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &this->waypointPos);
f32 vy = Math_SinS(pitch) * this->maxSpeed;
f32 vxz = Math_CosS(pitch) * this->maxSpeed;
f32 vz;
f32 vx;
f32 distL1;
Math_SmoothStepToS(&this->actor.posRot.rot.y, yaw, 1, 0x3E8, 0);
vx = Math_SinS(this->actor.posRot.rot.y) * vxz;
distL1 = Math_CosS(this->actor.posRot.rot.y) * vxz;
vz = Math_SmoothStepToF(&this->actor.initPosRot.pos.x, this->waypointPos.x, 1.0f, ABS(vx), 0.0f);
vz += Math_SmoothStepToF(&this->actor.initPosRot.pos.y, this->waypointPos.y, 1.0f, ABS(vy), 0.0f);
vz += Math_SmoothStepToF(&this->actor.initPosRot.pos.z, this->waypointPos.z, 1.0f, ABS(distL1), 0.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 0x3E8, 0);
vx = Math_SinS(this->actor.world.rot.y) * vxz;
distL1 = Math_CosS(this->actor.world.rot.y) * vxz;
vz = Math_SmoothStepToF(&this->actor.home.pos.x, this->waypointPos.x, 1.0f, ABS(vx), 0.0f);
vz += Math_SmoothStepToF(&this->actor.home.pos.y, this->waypointPos.y, 1.0f, ABS(vy), 0.0f);
vz += Math_SmoothStepToF(&this->actor.home.pos.z, this->waypointPos.z, 1.0f, ABS(distL1), 0.0f);
this->bobPhase += (0.05f + (Rand_ZeroOne() * 0.01f));
if (vz == 0.0f) {
EnBb_SetWaypoint(this, globalCtx);
@ -1018,27 +1016,26 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_LAUGH);
}
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
this->actor.shape.rot.y = this->actor.world.rot.y;
} else if (Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f) == 0.0f) {
EnBb_FaceWaypoint(this);
}
} else {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 1, 0xFA0, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, Math_Vec3f_Pitch(&this->actor.posRot.pos, &nextPos), 1, 0xFA0, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, Math_Vec3f_Pitch(&this->actor.world.pos, &nextPos), 1, 0xFA0, 0);
}
SkelAnime_Update(&this->skelAnime);
if (Math_CosF(this->bobPhase) <= 0.002f) {
this->bobSpeedMod = Rand_ZeroOne() * 0.05f;
}
Matrix_Translate(this->actor.initPosRot.pos.x, this->actor.initPosRot.pos.y, this->actor.initPosRot.pos.z,
MTXMODE_NEW);
Matrix_RotateRPY(this->actor.posRot.rot.x, this->actor.posRot.rot.y, 0, MTXMODE_APPLY);
Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW);
Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY);
Matrix_RotateZ(this->bobPhase, MTXMODE_APPLY);
bobOffset.y = this->bobSize;
Matrix_MultVec3f(&bobOffset, &nextPos);
Math_SmoothStepToF(&this->actor.posRot.pos.x, nextPos.x, 1.0f, this->bobPhase * 0.75f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.y, nextPos.y, 1.0f, this->bobPhase * 0.75f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.z, nextPos.z, 1.0f, this->bobPhase * 0.75f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.x, nextPos.x, 1.0f, this->bobPhase * 0.75f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.y, nextPos.y, 1.0f, this->bobPhase * 0.75f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.z, nextPos.z, 1.0f, this->bobPhase * 0.75f, 0.0f);
this->bobPhase += 0.1f + this->bobSpeedMod;
if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) || (--this->vFlameTimer == 0)) {
this->actionState++;
@ -1075,7 +1072,7 @@ void EnBb_SetupStunned(EnBb* this) {
if (this->actor.params != ENBB_RED) {
if (this->actor.params > ENBB_GREEN) {
this->actor.gravity = -2.0f;
this->actor.shape.unk_08 = 1500.0f;
this->actor.shape.yOffset = 1500.0f;
}
this->actor.speedXZ = 0.0f;
this->flameScaleX = 0.0f;
@ -1100,12 +1097,11 @@ void EnBb_SetupStunned(EnBb* this) {
}
void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) {
s16 yawDiff = this->actor.posRot.rot.y - this->actor.wallPolyRot;
s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw;
if (this->actor.bgCheckFlags & 8) {
if (ABS(yawDiff) > 0x4000) {
this->actor.posRot.rot.y =
this->actor.wallPolyRot + this->actor.wallPolyRot - this->actor.posRot.rot.y - 0x8000;
this->actor.world.rot.y = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000;
}
this->actor.bgCheckFlags &= ~8;
}
@ -1116,10 +1112,10 @@ void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) {
} else {
this->actor.velocity.y = 0.0f;
}
func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, 7.0f, 2, 2.0f, 0, 0, 0);
func_80033260(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0);
}
if (this->actor.dmgEffectTimer == 0) {
this->actor.shape.unk_08 = 200.0f;
if (this->actor.colorFilterTimer == 0) {
this->actor.shape.yOffset = 200.0f;
if (this->actor.colChkInfo.health != 0) {
if ((this->actor.params == ENBB_GREEN) || (this->actor.params == ENBB_GREEN_BIG)) {
EnBb_SetupGreen(this);
@ -1141,7 +1137,7 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) {
this->collider.base.atFlags &= ~AT_BOUNCED;
if (this->action != BB_DOWN) {
if (this->actor.params >= ENBB_RED) {
this->actor.posRot.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsLink + 0x8000;
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000;
if (this->actor.params == ENBB_RED) {
EnBb_KillFlameTrail(this);
}
@ -1202,7 +1198,7 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) {
EnBb_SetupDeath(this, globalCtx);
//! @bug
//! Because Din's Fire kills the bubble in a single hit, func_8003426C is never called and
//! dmgEffectParams is never set. And because Din's Fire halts updating during its cutscene,
//! colorFilterParams is never set. And because Din's Fire halts updating during its cutscene,
//! EnBb_Death doesn't kill the bubble on the next frame like it should. This combines with
//! the bug in EnBb_Draw below to crash the game.
} else if ((this->actor.params == ENBB_WHITE) &&
@ -1210,7 +1206,7 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
this->actor.speedXZ = -8.0f;
this->maxSpeed = 0.0f;
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_DAMAGE);
} else if (((this->action == BB_DOWN) && (this->timer < 190)) ||
((this->actor.params != ENBB_WHITE) && (this->flameScaleX < 20.0f))) {
@ -1241,22 +1237,22 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) {
Actor_MoveForward(&this->actor);
}
if (this->moveMode == BBMOVE_NORMAL) {
if ((this->actor.posRot.pos.y - 20.0f) <= this->actor.groundY) {
if ((this->actor.world.pos.y - 20.0f) <= this->actor.floorHeight) {
sp34 = 20.0f;
}
func_8002E4B4(globalCtx, &this->actor, sp34, 25.0f, 20.0f, 5);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, sp34, 25.0f, 20.0f, 5);
}
this->actor.posRot2.pos = this->actor.posRot.pos;
this->collider.elements->dim.worldSphere.center.x = this->actor.posRot.pos.x;
this->actor.focus.pos = this->actor.world.pos;
this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x;
this->collider.elements->dim.worldSphere.center.y =
this->actor.posRot.pos.y + (this->actor.shape.unk_08 * this->actor.scale.y);
this->collider.elements->dim.worldSphere.center.z = this->actor.posRot.pos.z;
this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y);
this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z;
if ((this->action > BB_KILL) && ((this->actor.speedXZ != 0.0f) || (this->action == BB_GREEN))) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
if ((this->action > BB_FLAME_TRAIL) &&
((this->actor.dmgEffectTimer == 0) || !(this->actor.dmgEffectParams & 0x4000)) &&
((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) &&
(this->moveMode != BBMOVE_HIDDEN)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
@ -1295,21 +1291,21 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) {
this);
if (this->fireIceTimer != 0) {
this->actor.dmgEffectTimer++;
this->actor.colorFilterTimer++;
//! @bug:
//! The purpose of this is to counteract Actor_UpdateAll decrementing dmgEffectTimer. However,
//! The purpose of this is to counteract Actor_UpdateAll decrementing colorFilterTimer. However,
//! the above bugs mean unk_2A8 can be nonzero without damage effects ever having been set.
//! This routine will then increment dmgEffectTimer, and on the next frame Actor_Draw will try
//! to draw the unset dmgEffectParams. This causes a divide-by-zero error, crashing the game.
//! This routine will then increment colorFilterTimer, and on the next frame Actor_Draw will try
//! to draw the unset colorFilterParams. This causes a divide-by-zero error, crashing the game.
if (1) {}
this->fireIceTimer--;
if ((this->fireIceTimer % 4) == 0) {
Vec3f sp70;
s32 index = this->fireIceTimer >> 2;
sp70.x = this->actor.posRot.pos.x + sFireIceOffsets[index].x;
sp70.y = this->actor.posRot.pos.y + sFireIceOffsets[index].y;
sp70.z = this->actor.posRot.pos.z + sFireIceOffsets[index].z;
sp70.x = this->actor.world.pos.x + sFireIceOffsets[index].x;
sp70.y = this->actor.world.pos.y + sFireIceOffsets[index].y;
sp70.z = this->actor.world.pos.z + sFireIceOffsets[index].z;
if ((this->dmgEffect != 7) && (this->dmgEffect != 5)) {
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &sp70, 0x96, 0x96, 0x96, 0xFA, 0xEB,