mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 23:10:22 +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:
parent
20206fba0d
commit
00a5edea71
697 changed files with 8157 additions and 7942 deletions
|
@ -57,7 +57,7 @@ static Gfx D_80B04400[] = {
|
|||
|
||||
const ActorInit En_Ssh_InitVars = {
|
||||
ACTOR_EN_SSH,
|
||||
ACTORTYPE_NPC,
|
||||
ACTORCAT_NPC,
|
||||
FLAGS,
|
||||
OBJECT_SSH,
|
||||
sizeof(EnSsh),
|
||||
|
@ -144,9 +144,9 @@ void EnSsh_SpawnShockwave(EnSsh* this, GlobalContext* globalCtx) {
|
|||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f pos;
|
||||
|
||||
pos.x = this->actor.posRot.pos.x;
|
||||
pos.y = this->actor.groundY;
|
||||
pos.z = this->actor.posRot.pos.z;
|
||||
pos.x = this->actor.world.pos.x;
|
||||
pos.y = this->actor.floorHeight;
|
||||
pos.z = this->actor.world.pos.z;
|
||||
EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &pos, &zeroVec, &zeroVec, 100, 220, 8);
|
||||
}
|
||||
|
||||
|
@ -179,10 +179,10 @@ s32 EnSsh_CheckCeilingPos(EnSsh* this, GlobalContext* globalCtx) {
|
|||
s32 bgId;
|
||||
Vec3f posB;
|
||||
|
||||
posB.x = this->actor.posRot.pos.x;
|
||||
posB.y = this->actor.posRot.pos.y + 1000.0f;
|
||||
posB.z = this->actor.posRot.pos.z;
|
||||
if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.posRot.pos, &posB, &this->ceilingPos, &poly, false,
|
||||
posB.x = this->actor.world.pos.x;
|
||||
posB.y = this->actor.world.pos.y + 1000.0f;
|
||||
posB.z = this->actor.world.pos.z;
|
||||
if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, false,
|
||||
false, true, true, &bgId)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -263,7 +263,7 @@ void EnSsh_SetReturnAnimation(EnSsh* this) {
|
|||
}
|
||||
|
||||
void EnSsh_SetLandAnimation(EnSsh* this) {
|
||||
this->actor.posRot.pos.y = this->groundYoffset + this->actor.groundY;
|
||||
this->actor.world.pos.y = this->floorHeightOffset + this->actor.floorHeight;
|
||||
this->animTimer = EnSsh_SetAnimation(this, SSH_ANIM_LAND);
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ void EnSsh_SetStunned(EnSsh* this) {
|
|||
if (this->stunTimer == 0) {
|
||||
this->stateFlags |= SSH_STATE_ATTACKED;
|
||||
this->stunTimer = 120;
|
||||
this->actor.dmgEffectTimer = 0;
|
||||
this->actor.colorFilterTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ void EnSsh_SetColliderScale(EnSsh* this, f32 scale, f32 radiusMod) {
|
|||
this->colCylinder[i].dim.height = height;
|
||||
}
|
||||
Actor_SetScale(&this->actor, 0.04f * scale);
|
||||
this->groundYoffset = 40.0f * scale;
|
||||
this->floorHeightOffset = 40.0f * scale;
|
||||
this->colliderScale = scale * 1.5f;
|
||||
}
|
||||
|
||||
|
@ -334,18 +334,18 @@ void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) {
|
|||
this->hitTimer--;
|
||||
}
|
||||
if (DECR(this->spinTimer) != 0) {
|
||||
this->actor.posRot.rot.y += 10000.0f * (this->spinTimer / 30.0f);
|
||||
this->actor.world.rot.y += 10000.0f * (this->spinTimer / 30.0f);
|
||||
} else if ((this->swayTimer == 0) && (this->stunTimer == 0)) {
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 4, 0x2710, 1);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 4, 0x2710, 1);
|
||||
}
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
}
|
||||
|
||||
void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) {
|
||||
if ((this->swayTimer == 0) && (this->stunTimer == 0)) {
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink ^ 0x8000, 4, this->maxTurnRate, 1);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer ^ 0x8000, 4, this->maxTurnRate, 1);
|
||||
}
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
if (this->stunTimer < 30) {
|
||||
if (this->stunTimer & 1) {
|
||||
this->actor.shape.rot.y += 0x7D0;
|
||||
|
@ -389,16 +389,16 @@ s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (this->actor.xzDistToLink > 160.0f) {
|
||||
if (this->actor.xzDistToPlayer > 160.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
yDist = this->actor.posRot.pos.y - player->actor.posRot.pos.y;
|
||||
yDist = this->actor.world.pos.y - player->actor.world.pos.y;
|
||||
if (yDist < 0.0f || yDist > 400.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player->actor.posRot.pos.y < this->actor.groundY) {
|
||||
if (player->actor.world.pos.y < this->actor.floorHeight) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -406,9 +406,9 @@ s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) {
|
|||
|
||||
s32 EnSsh_IsCloseToHome(EnSsh* this) {
|
||||
f32 vel = this->actor.velocity.y;
|
||||
f32 nextY = this->actor.posRot.pos.y + 2.0f * this->actor.velocity.y;
|
||||
f32 nextY = this->actor.world.pos.y + 2.0f * this->actor.velocity.y;
|
||||
|
||||
if (nextY >= this->actor.initPosRot.pos.y) {
|
||||
if (nextY >= this->actor.home.pos.y) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -416,9 +416,9 @@ s32 EnSsh_IsCloseToHome(EnSsh* this) {
|
|||
|
||||
s32 EnSsh_IsCloseToGround(EnSsh* this) {
|
||||
f32 vel = this->actor.velocity.y;
|
||||
f32 nextY = this->actor.posRot.pos.y + 2.0f * this->actor.velocity.y;
|
||||
f32 nextY = this->actor.world.pos.y + 2.0f * this->actor.velocity.y;
|
||||
|
||||
if ((nextY - this->actor.groundY) <= this->groundYoffset) {
|
||||
if ((nextY - this->actor.floorHeight) <= this->floorHeightOffset) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -438,18 +438,18 @@ void EnSsh_Sway(EnSsh* this) {
|
|||
}
|
||||
temp = this->swayTimer * (1.0f / 6);
|
||||
swayAngle = temp * (0x10000 / 360.0f) * Math_SinS(this->swayAngle);
|
||||
temp = this->actor.posRot.pos.y - this->ceilingPos.y;
|
||||
temp = this->actor.world.pos.y - this->ceilingPos.y;
|
||||
swayVecBase.x = Math_SinS(swayAngle) * temp;
|
||||
swayVecBase.y = Math_CosS(swayAngle) * temp;
|
||||
swayVecBase.z = 0.0f;
|
||||
Matrix_Push();
|
||||
Matrix_Translate(this->ceilingPos.x, this->ceilingPos.y, this->ceilingPos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(this->actor.posRot.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateY(this->actor.world.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_MultVec3f(&swayVecBase, &swayVec);
|
||||
Matrix_Pull();
|
||||
this->actor.shape.rot.z = -(swayAngle * 2);
|
||||
this->actor.posRot.pos.x = swayVec.x;
|
||||
this->actor.posRot.pos.z = swayVec.z;
|
||||
this->actor.world.pos.x = swayVec.x;
|
||||
this->actor.world.pos.z = swayVec.z;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ s32 EnSsh_CheckHitLink(EnSsh* this, GlobalContext* globalCtx) {
|
|||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_ROLL);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_VO_ST_ATTACK);
|
||||
globalCtx->damagePlayer(globalCtx, -8);
|
||||
func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsLink, 6.0f);
|
||||
func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f);
|
||||
this->hitCount--;
|
||||
return true;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ void EnSsh_SetBodyCylinderAC(EnSsh* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void EnSsh_SetLegsCylinderAC(EnSsh* this, GlobalContext* globalCtx) {
|
||||
s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y));
|
||||
s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
|
||||
|
||||
if (angleTowardsLink < 90 * (0x10000 / 360)) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]);
|
||||
|
@ -591,7 +591,7 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
cylPos = this->actor.posRot.pos;
|
||||
cylPos = this->actor.world.pos;
|
||||
cyloffsets[i].x *= this->colliderScale;
|
||||
cyloffsets[i].y *= this->colliderScale;
|
||||
cyloffsets[i].z *= this->colliderScale;
|
||||
|
@ -638,7 +638,7 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 30.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060052E0, NULL, this->jointTable, this->morphTable, 30);
|
||||
Animation_Change(&this->skelAnime, &D_06000304, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f);
|
||||
this->blureIdx = EnSsh_CreateBlureEffect(globalCtx);
|
||||
|
@ -652,7 +652,7 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
EnSsh_SetColliderScale(this, 0.75f, 1.0f);
|
||||
}
|
||||
this->actor.gravity = 0.0f;
|
||||
this->initialYaw = this->actor.posRot.rot.y;
|
||||
this->initialYaw = this->actor.world.rot.y;
|
||||
EnSsh_SetupAction(this, EnSsh_Start);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ void EnSsh_Land(EnSsh* this, GlobalContext* globalCtx) {
|
|||
if ((this->animTimer != 0) && (DECR(this->animTimer) == 0)) {
|
||||
EnSsh_SetAnimation(this, SSH_ANIM_WAIT);
|
||||
}
|
||||
if ((this->actor.groundY + this->groundYoffset) <= this->actor.posRot.pos.y) {
|
||||
if ((this->actor.floorHeight + this->floorHeightOffset) <= this->actor.world.pos.y) {
|
||||
EnSsh_SetupAction(this, EnSsh_Idle);
|
||||
} else {
|
||||
Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.6f, 1000.0f, 0.0f);
|
||||
|
@ -837,7 +837,7 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
func_8002D7EC(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
EnSsh_UpdateYaw(this, globalCtx);
|
||||
|
@ -849,7 +849,7 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->blinkState = 0;
|
||||
}
|
||||
EnSsh_SetColliders(this, globalCtx);
|
||||
Actor_SetHeight(&this->actor, 0.0f);
|
||||
Actor_SetFocus(&this->actor, 0.0f);
|
||||
}
|
||||
|
||||
s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct EnSsh {
|
|||
/* 0x0536 */ s16 swayTimer;
|
||||
/* 0x0538 */ s32 blureIdx;
|
||||
/* 0x053C */ f32 colliderScale;
|
||||
/* 0x0540 */ f32 groundYoffset;
|
||||
/* 0x0540 */ f32 floorHeightOffset;
|
||||
/* 0x0544 */ Vec3f ceilingPos;
|
||||
/* 0x0558 */ char unk_558[0x78];
|
||||
/* 0x05C8 */ s16 swayAngle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue