1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-10 17:00:19 +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

@ -31,7 +31,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx);
const ActorInit En_Karebaba_InitVars = {
ACTOR_EN_KAREBABA,
ACTORTYPE_ENEMY,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_DEKUBABA,
sizeof(EnKarebaba),
@ -84,8 +84,8 @@ static ColliderCylinderInit sHeadColliderInit = {
static CollisionCheckInfoInit sColCheckInfoInit = { 1, 15, 80, MASS_HEAVY };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(unk_4C, 2500, ICHAIN_CONTINUE),
ICHAIN_U8(unk_1F, 1, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, 1, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, 9, ICHAIN_STOP),
};
@ -101,7 +101,7 @@ void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) {
EnKarebaba* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 22.0f);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06002A40, &D_060002B8, this->jointTable, this->morphTable, 8);
Collider_InitCylinder(globalCtx, &this->bodyCollider);
Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyColliderInit);
@ -140,14 +140,14 @@ void EnKarebaba_SetupGrow(EnKarebaba* this) {
Actor_SetScale(&this->actor, 0.0f);
this->actor.shape.rot.x = -0x4000;
this->actionFunc = EnKarebaba_Grow;
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + 14.0f;
this->actor.world.pos.y = this->actor.home.pos.y + 14.0f;
}
void EnKarebaba_SetupIdle(EnKarebaba* this) {
Actor_SetScale(&this->actor, 0.005f);
this->actor.shape.rot.x = -0x4000;
this->actionFunc = EnKarebaba_Idle;
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + 14.0f;
this->actor.world.pos.y = this->actor.home.pos.y + 14.0f;
}
void EnKarebaba_SetupAwaken(EnKarebaba* this) {
@ -181,7 +181,7 @@ void EnKarebaba_SetupDying(EnKarebaba* this) {
this->actor.params = 0;
this->actor.gravity = -0.8f;
this->actor.velocity.y = 4.0f;
this->actor.posRot.rot.y = this->actor.shape.rot.y + 0x8000;
this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000;
this->actor.speedXZ = 3.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKU_JR_DEAD);
this->actor.flags |= 0x30;
@ -191,11 +191,11 @@ void EnKarebaba_SetupDying(EnKarebaba* this) {
void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.03f);
this->actor.shape.rot.x -= 0x4000;
this->actor.shape.unk_08 = 1000.0f;
this->actor.shape.yOffset = 1000.0f;
this->actor.gravity = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.shape.unk_10 = 3.0f;
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_MISC);
this->actor.shape.shadowScale = 3.0f;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC);
this->actor.params = 200;
this->actor.flags &= ~0x20;
this->actionFunc = EnKarebaba_DeadItemDrop;
@ -214,14 +214,14 @@ void EnKarebaba_SetupDead(EnKarebaba* this) {
this->actor.shape.rot.x = -0x4000;
this->actor.params = 200;
this->actor.parent = NULL;
this->actor.shape.unk_10 = 0.0f;
Math_Vec3f_Copy(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
this->actor.shape.shadowScale = 0.0f;
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos);
this->actionFunc = EnKarebaba_Dead;
}
void EnKarebaba_SetupRegrow(EnKarebaba* this) {
this->actor.shape.unk_08 = 0.0f;
this->actor.shape.unk_10 = 22.0f;
this->actor.shape.yOffset = 0.0f;
this->actor.shape.shadowScale = 22.0f;
this->headCollider.dim.radius = sHeadColliderInit.dim.radius;
Actor_SetScale(&this->actor, 0.0f);
this->actionFunc = EnKarebaba_Regrow;
@ -233,14 +233,14 @@ void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) {
this->actor.params++;
scale = this->actor.params * 0.05f;
Actor_SetScale(&this->actor, 0.005f * scale);
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + (14.0f * scale);
this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * scale);
if (this->actor.params == 20) {
EnKarebaba_SetupIdle(this);
}
}
void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx) {
if (this->actor.xzDistToLink < 200.0f && fabsf(this->actor.yDistToLink) < 30.0f) {
if (this->actor.xzDistToPlayer < 200.0f && fabsf(this->actor.yDistToPlayer) < 30.0f) {
EnKarebaba_SetupAwaken(this);
}
}
@ -249,11 +249,11 @@ void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f);
this->actor.scale.y = this->actor.scale.z = this->actor.scale.x;
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 60.0f, 5.0f)) {
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 5.0f)) {
EnKarebaba_SetupUpright(this);
}
this->actor.shape.rot.y += 0x1999;
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.initPosRot.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
}
void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) {
@ -272,7 +272,7 @@ void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) {
if (this->bodyCollider.base.acFlags & AC_HIT) {
EnKarebaba_SetupDying(this);
func_80032C7C(globalCtx, &this->actor);
} else if (Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) > 240.0f) {
} else if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 240.0f) {
EnKarebaba_SetupRetract(this);
} else if (this->actor.params == 0) {
EnKarebaba_SetupSpin(this);
@ -305,12 +305,12 @@ void EnKarebaba_Spin(EnKarebaba* this, GlobalContext* globalCtx) {
this->headCollider.dim.radius = sHeadColliderInit.dim.radius + (value * 2);
this->actor.shape.rot.x = 0xC000 - (value * 0x100);
this->actor.shape.rot.y += value * 0x2C0;
this->actor.posRot.pos.y = (Math_SinS(this->actor.shape.rot.x) * -60.0f) + this->actor.initPosRot.pos.y;
this->actor.world.pos.y = (Math_SinS(this->actor.shape.rot.x) * -60.0f) + this->actor.home.pos.y;
cos60 = Math_CosS(this->actor.shape.rot.x) * 60.0f;
this->actor.posRot.pos.x = (Math_SinS(this->actor.shape.rot.y) * cos60) + this->actor.initPosRot.pos.x;
this->actor.posRot.pos.z = (Math_CosS(this->actor.shape.rot.y) * cos60) + this->actor.initPosRot.pos.z;
this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y) * cos60) + this->actor.home.pos.x;
this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * cos60) + this->actor.home.pos.z;
if (this->bodyCollider.base.acFlags & AC_HIT) {
EnKarebaba_SetupDying(this);
@ -330,13 +330,13 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) {
if (this->actor.params == 0) {
Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.posRot.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
if (this->actor.scale.x > 0.005f && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) {
this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f;
this->actor.speedXZ = 0.0f;
this->actor.flags &= ~5;
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.posRot.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10,
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10,
NULL);
}
@ -345,7 +345,7 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) {
this->actor.params = 1;
}
} else if (this->actor.params == 1) {
Math_Vec3f_Copy(&position, &this->actor.posRot.pos);
Math_Vec3f_Copy(&position, &this->actor.world.pos);
rotation.z = Math_SinS(this->actor.shape.rot.x) * 20.0f;
rotation.x = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y);
rotation.y = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y);
@ -357,7 +357,7 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) {
position.z += rotation.y;
}
func_800286CC(globalCtx, &this->actor.initPosRot.pos, &zeroVec, &zeroVec, 500, 100);
func_800286CC(globalCtx, &this->actor.home.pos, &zeroVec, &zeroVec, 500, 100);
EnKarebaba_SetupDeadItemDrop(this, globalCtx);
}
}
@ -379,12 +379,12 @@ void EnKarebaba_Retract(EnKarebaba* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f);
this->actor.scale.y = this->actor.scale.z = this->actor.scale.x;
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 14.0f, 5.0f)) {
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 14.0f, 5.0f)) {
EnKarebaba_SetupIdle(this);
}
this->actor.shape.rot.y += 0x1999;
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.initPosRot.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
}
void EnKarebaba_Dead(EnKarebaba* this, GlobalContext* globalCtx) {
@ -404,12 +404,12 @@ void EnKarebaba_Regrow(EnKarebaba* this, GlobalContext* globalCtx) {
this->actor.params++;
scaleFactor = this->actor.params * 0.05f;
Actor_SetScale(&this->actor, 0.005f * scaleFactor);
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + (14.0f * scaleFactor);
this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * scaleFactor);
if (this->actor.params == 20) {
this->actor.flags &= ~0x10;
this->actor.flags |= 5;
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_ENEMY);
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY);
EnKarebaba_SetupIdle(this);
}
}
@ -424,9 +424,9 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actionFunc != EnKarebaba_Dead) {
if (this->actionFunc == EnKarebaba_Dying) {
Actor_MoveForward(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 10.0f, 15.0f, 10.0f, 5);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 10.0f, 5);
} else {
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
if (this->boundFloor == NULL) {
this->boundFloor = this->actor.floorPoly;
}
@ -437,11 +437,11 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base);
Actor_SetHeight(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f);
height = this->actor.initPosRot.pos.y + 40.0f;
this->actor.posRot2.pos.x = this->actor.initPosRot.pos.x;
this->actor.posRot2.pos.y = CLAMP_MAX(this->actor.posRot2.pos.y, height);
this->actor.posRot2.pos.z = this->actor.initPosRot.pos.z;
Actor_SetFocus(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f);
height = this->actor.home.pos.y + 40.0f;
this->actor.focus.pos.x = this->actor.home.pos.x;
this->actor.focus.pos.y = CLAMP_MAX(this->actor.focus.pos.y, height);
this->actor.focus.pos.z = this->actor.home.pos.z;
}
}
}
@ -454,8 +454,7 @@ void EnKarebaba_DrawCenterShadow(EnKarebaba* this, GlobalContext* globalCtx) {
func_80094044(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255);
func_80038A28(this->boundFloor, this->actor.initPosRot.pos.x, this->actor.initPosRot.pos.y,
this->actor.initPosRot.pos.z, &mf);
func_80038A28(this->boundFloor, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &mf);
Matrix_Mult(&mf, MTXMODE_NEW);
Matrix_Scale(0.15f, 1.0f, 0.15f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1029),
@ -488,7 +487,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) {
} else if (this->actionFunc != EnKarebaba_Dead) {
func_80026230(globalCtx, &black, 1, 2);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL);
Matrix_Translate(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, MTXMODE_NEW);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
if ((this->actionFunc == EnKarebaba_Regrow) || (this->actionFunc == EnKarebaba_Grow)) {
scale = this->actor.params * 0.0005f;
@ -512,7 +511,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPDisplayList(POLY_OPA_DISP++, dLists[i]);
if (i == 0 && this->actionFunc == EnKarebaba_Dying) {
Matrix_MultVec3f(&zeroVec, &this->actor.posRot2.pos);
Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos);
}
}
@ -520,21 +519,20 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
func_80026230(globalCtx, &black, 1, 2);
Matrix_Translate(this->actor.initPosRot.pos.x, this->actor.initPosRot.pos.y, this->actor.initPosRot.pos.z,
MTXMODE_NEW);
Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW);
if (this->actionFunc != EnKarebaba_Grow) {
scale = 0.01f;
}
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
Matrix_RotateY(this->actor.initPosRot.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
Matrix_RotateY(this->actor.home.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1144),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_060010F0);
if (this->actionFunc == EnKarebaba_Dying) {
Matrix_RotateRPY(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.initPosRot.rot.y), 0, MTXMODE_APPLY);
Matrix_RotateRPY(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1155),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06001828);