1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +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

@ -39,7 +39,7 @@ static s16 D_80AB85E0 = 0;
const ActorInit En_Niw_InitVars = {
ACTOR_EN_NIW,
ACTORTYPE_PROP,
ACTORCAT_PROP,
FLAGS,
OBJECT_NIW,
sizeof(EnNiw),
@ -114,9 +114,9 @@ static ColliderCylinderInit sCylinderInit2 = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_U8(unk_1F, 6, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE),
ICHAIN_F32(unk_4C, 0, ICHAIN_STOP),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
};
extern FlexSkeletonHeader D_06002530;
@ -157,27 +157,27 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actor.flags |= 1;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 25.0f);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06002530, &D_060000E8, this->jointTable, this->morphTable, 16);
if (globalCtx->sceneNum == SCENE_SPOT01) {
for (i = 0; i < ARRAY_COUNT(sKakarikoPosList); i++) {
if (fabsf(this->actor.posRot.pos.x - sKakarikoPosList[i].x) < 40.0f &&
fabsf(this->actor.posRot.pos.z - sKakarikoPosList[i].z) < 40.0f) {
if (fabsf(this->actor.world.pos.x - sKakarikoPosList[i].x) < 40.0f &&
fabsf(this->actor.world.pos.z - sKakarikoPosList[i].z) < 40.0f) {
this->unk_2AA = i;
osSyncPrintf(VT_FGCOL(YELLOW) " 通常鶏index %d\n" VT_RST, this->unk_2AA);
if (gSaveContext.infTable[25] & sKakarikoFlagList[i]) {
this->actor.posRot.pos.x = 300.0f;
this->actor.posRot.pos.y = 100.0f;
this->actor.posRot.pos.z = 1530.0f;
this->actor.world.pos.x = 300.0f;
this->actor.world.pos.y = 100.0f;
this->actor.world.pos.z = 1530.0f;
this->actor.params = 0;
}
}
}
}
Math_Vec3f_Copy(&this->unk_2AC, &this->actor.posRot.pos);
Math_Vec3f_Copy(&this->unk_2B8, &this->actor.posRot.pos);
Math_Vec3f_Copy(&this->unk_2AC, &this->actor.world.pos);
Math_Vec3f_Copy(&this->unk_2B8, &this->actor.world.pos);
this->unk_304 = 10.0f;
Actor_SetScale(&this->actor, 0.01f);
this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5;
@ -400,12 +400,12 @@ void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) {
this->timer6 = 150;
if (this->timer8 == 0) {
this->timer8 = 70;
this->unk_2E4 = this->actor.yawTowardsLink;
this->unk_2E4 = this->actor.yawTowardsPlayer;
}
}
}
targetRotY = this->unk_2E4 + factor;
Math_SmoothStepToS(&this->actor.posRot.rot.y, targetRotY, 3, this->unk_2FC, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, targetRotY, 3, this->unk_2FC, 0);
Math_ApproachF(&this->unk_2FC, 3000.0f, 1.0f, 500.0f);
func_80AB5BF8(this, globalCtx, 5);
}
@ -438,9 +438,9 @@ void func_80AB6324(EnNiw* this, GlobalContext* globalCtx) {
void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y < 0.0f) {
this->unk_2AC = this->unk_2B8 = this->actor.posRot.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.posRot.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.posRot.pos.z;
this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z;
this->timer5 = this->timer4 = this->unk_29E = 0;
this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ =
@ -455,7 +455,7 @@ void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) {
void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->actor.xzDistToLink < 30.0f && fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 5.0f) {
if (this->actor.xzDistToPlayer < 30.0f && fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 5.0f) {
this->timer6 = 100;
this->actor.gravity = -2.0f;
this->actionFunc = func_80AB7290;
@ -567,11 +567,11 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
if (this->timer4 != 0) {
Math_ApproachZeroF(&this->unk_26C[9], 0.5f, 4000.0f);
tmp = 1;
Math_ApproachF(&this->actor.posRot.pos.x, this->unk_2B8, 1.0f, this->unk_2FC);
Math_ApproachF(&this->actor.posRot.pos.z, this->unk_2C0, 1.0f, this->unk_2FC);
Math_ApproachF(&this->actor.world.pos.x, this->unk_2B8, 1.0f, this->unk_2FC);
Math_ApproachF(&this->actor.world.pos.z, this->unk_2C0, 1.0f, this->unk_2FC);
Math_ApproachF(&this->unk_2FC, 3.0f, 1.0f, 0.3f);
posY = this->unk_2B8 - this->actor.posRot.pos.x;
posZ = this->unk_2C0 - this->actor.posRot.pos.z;
posY = this->unk_2B8 - this->actor.world.pos.x;
posZ = this->unk_2C0 - this->actor.world.pos.z;
if (fabsf(posY) < 10.0f) {
posY = 0.0;
@ -584,7 +584,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
this->unk_29E = 7;
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300, 0);
Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300, 0);
Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f);
}
@ -599,9 +599,9 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) {
s16 pathIndex = this->path - 1;
if (this->path == 0) {
this->unk_2AC = this->unk_2B8 = this->actor.posRot.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.posRot.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.posRot.pos.z;
this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z;
this->timer5 = this->timer4 = this->unk_29E = 0;
this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ =
this->unk_2FC = this->unk_300 = 0.0f;
@ -610,8 +610,8 @@ void func_80AB6A38(EnNiw* this, GlobalContext* globalCtx) {
path = &globalCtx->setupPathList[pathIndex];
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
pointPos += this->waypoint;
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
pathDiffX = pointPos->x - this->actor.world.pos.x;
pathDiffZ = pointPos->z - this->actor.world.pos.z;
this->unk_2E4 = Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI);
func_80AB6100(this, globalCtx, 2);
@ -659,9 +659,9 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) {
return;
}
if (this->actor.params == 0xE) {
this->unk_2AC = this->unk_2B8 = this->actor.posRot.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.posRot.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.posRot.pos.z;
this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z;
this->timer5 = this->timer4 = this->unk_29E = 0;
this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ =
@ -707,7 +707,7 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) {
}
void func_80AB6EB4(EnNiw* this, GlobalContext* globalCtx) {
if (this->actor.posRot.pos.y > 400.0f) {
if (this->actor.world.pos.y > 400.0f) {
Actor_Kill(&this->actor);
}
@ -727,11 +727,11 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) {
this->actor.gravity = 0.0f;
if (this->actor.yDistToWater > 15.0f) {
this->actor.posRot.pos.y += 2.0f;
this->actor.world.pos.y += 2.0f;
}
if (this->timer4 == 0) {
this->timer4 = 30;
Math_Vec3f_Copy(&pos, &this->actor.posRot.pos);
Math_Vec3f_Copy(&pos, &this->actor.world.pos);
pos.y += this->actor.yDistToWater;
EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30);
}
@ -801,7 +801,7 @@ void func_80AB714C(EnNiw* this, GlobalContext* globalCtx) {
}
if (this->timer5 == 0) {
this->timer7 = 10;
this->unk_2E4 = this->actor.yawTowardsLink;
this->unk_2E4 = this->actor.yawTowardsPlayer;
this->actor.flags &= ~1;
this->actionFunc = func_80AB7204;
}
@ -835,9 +835,9 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->timer6 == 0) {
this->unk_2AC = this->unk_2B8 = this->actor.posRot.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.posRot.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.posRot.pos.z;
this->unk_2AC = this->unk_2B8 = this->actor.world.pos.x;
this->unk_2B0 = this->unk_2BC = this->actor.world.pos.y;
this->unk_2B4 = this->unk_2C0 = this->actor.world.pos.z;
this->timer5 = this->timer4 = this->unk_29E = 0;
this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speedXZ =
this->unk_2FC = this->unk_300 = 0.0f;
@ -846,8 +846,8 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
}
this->actionFunc = EnNiw_ResetAction;
} else {
this->unk_2E4 = Math_FAtan2F(this->actor.posRot.pos.x - player->actor.posRot.pos.x,
this->actor.posRot.pos.z - player->actor.posRot.pos.z) *
this->unk_2E4 = Math_FAtan2F(this->actor.world.pos.x - player->actor.world.pos.x,
this->actor.world.pos.z - player->actor.world.pos.z) *
(0x8000 / M_PI);
func_80AB6100(this, globalCtx, 0);
func_80AB5BF8(this, globalCtx, 2);
@ -912,9 +912,9 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
}
for (i = 0; i < featherCount; i++) {
pos.x = Rand_CenteredFloat(10.0f) + thisx->posRot.pos.x;
pos.y = Rand_CenteredFloat(10.0f) + (thisx->posRot.pos.y + this->unk_304);
pos.z = Rand_CenteredFloat(10.0f) + thisx->posRot.pos.z;
pos.x = Rand_CenteredFloat(10.0f) + thisx->world.pos.x;
pos.y = Rand_CenteredFloat(10.0f) + (thisx->world.pos.y + this->unk_304);
pos.z = Rand_CenteredFloat(10.0f) + thisx->world.pos.z;
scale = Rand_ZeroFloat(6.0f) + 6.0f;
if (this->unk_2A6 == 2 && this->unk_304 != 0) {
@ -973,46 +973,46 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->timer9 != 0) {
this->timer9--;
}
thisx->shape.rot = thisx->posRot.rot;
thisx->shape.unk_10 = 15.0f;
thisx->shape.rot = thisx->world.rot;
thisx->shape.shadowScale = 15.0f;
this->actionFunc(this, globalCtx);
Actor_SetHeight(&this->actor, this->unk_304);
Actor_SetFocus(&this->actor, this->unk_304);
Actor_MoveForward(&this->actor);
if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && globalCtx->sceneNum != SCENE_SPOT03) {
func_8002E4B4(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 31);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 31);
}
if (globalCtx->sceneNum == SCENE_SPOT03) {
func_8002E4B4(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 29);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 29);
}
if (thisx->groundY <= BGCHECK_Y_MIN || thisx->groundY >= 32000.0f) {
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->groundY);
if (thisx->floorHeight <= BGCHECK_Y_MIN || thisx->floorHeight >= 32000.0f) {
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->floorHeight);
cam.x = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
cam.y = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
cam.z = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
camResult = cam.y / sqrtf(SQ(cam.x) + SQ(cam.y) + SQ(cam.z));
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外X! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.x);
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.y);
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Z! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.z);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットX! ☆☆☆☆☆ %f\n" VT_RST, thisx->initPosRot.pos.x);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットY! ☆☆☆☆☆ %f\n" VT_RST, thisx->initPosRot.pos.y);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットZ! ☆☆☆☆☆ %f\n" VT_RST, thisx->initPosRot.pos.z);
thisx->posRot.pos.x = thisx->initPosRot.pos.x;
thisx->posRot.pos.z = thisx->initPosRot.pos.z;
thisx->posRot.pos.y = ((thisx->initPosRot.pos.y + globalCtx->view.eye.y) + (camResult * 160.0f));
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外X! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.x);
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.y);
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Z! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.z);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットX! ☆☆☆☆☆ %f\n" VT_RST, thisx->home.pos.x);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットY! ☆☆☆☆☆ %f\n" VT_RST, thisx->home.pos.y);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ セットZ! ☆☆☆☆☆ %f\n" VT_RST, thisx->home.pos.z);
thisx->world.pos.x = thisx->home.pos.x;
thisx->world.pos.z = thisx->home.pos.z;
thisx->world.pos.y = ((thisx->home.pos.y + globalCtx->view.eye.y) + (camResult * 160.0f));
if (thisx->posRot.pos.y < thisx->initPosRot.pos.y) {
thisx->posRot.pos.y = thisx->initPosRot.pos.y + 300.0f;
if (thisx->world.pos.y < thisx->home.pos.y) {
thisx->world.pos.y = thisx->home.pos.y + 300.0f;
}
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後X! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.x);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.y);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後Z! ☆☆☆☆☆ %f\n" VT_RST, thisx->posRot.pos.z);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後X! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.x);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.y);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 修整後Z! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.z);
osSyncPrintf("\n\n");
thisx->speedXZ = 0.0f;
thisx->gravity = -2.0f;
Math_Vec3f_Copy(&this->unk_2AC, &thisx->initPosRot);
Math_Vec3f_Copy(&this->unk_2B8, &thisx->initPosRot);
Math_Vec3f_Copy(&this->unk_2AC, &thisx->home);
Math_Vec3f_Copy(&this->unk_2B8, &thisx->home);
this->unk_300 = 0.0f;
this->unk_2FC = 0.0f;
this->unk_2F0.z = 0.0f;
@ -1042,7 +1042,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) {
thisx->velocity.y = 0.0f;
thisx->gravity = 0.0f;
Math_Vec3f_Copy(&pos, &thisx->posRot);
Math_Vec3f_Copy(&pos, &thisx->world);
pos.y += thisx->yDistToWater;
this->timer4 = 30;
EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400);
@ -1057,7 +1057,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
if (D_80AB85E0 == 0 && this->unk_2A4 <= 0 && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) {
this->timer6 = 100;
if (thisx->xzDistToLink > 10.0f) {
if (thisx->xzDistToPlayer > 10.0f) {
D_80AB85E0 = 1;
this->timer5 = this->timer4 = this->unk_29E = 0;
thisx->speedXZ = 0.0f;
@ -1069,9 +1069,9 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk_26C[8] = 0.0f;
this->sfxTimer1 = 10000;
this->unk_2A8 = 1;
this->unk_2AC = this->unk_2B8 = thisx->posRot.pos.x;
this->unk_2B0 = this->unk_2BC = thisx->posRot.pos.y;
this->unk_2B4 = this->unk_2C0 = thisx->posRot.pos.z;
this->unk_2AC = this->unk_2B8 = thisx->world.pos.x;
this->unk_2B0 = this->unk_2BC = thisx->world.pos.y;
this->unk_2B4 = this->unk_2C0 = thisx->world.pos.z;
this->actionFunc = func_80AB70A0;
return;
}
@ -1079,8 +1079,8 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
dist = 20.0f;
if (this->unk_2A8 != 0 && thisx->xyzDistToLinkSq < SQ(dist) && player->invincibilityTimer == 0) {
func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->posRot.rot.y, 0.0f, 0x10);
if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) {
func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10);
}
func_80AB747C(&this->actor, globalCtx);
@ -1146,7 +1146,7 @@ void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnNiw_OverrideLimbDraw, NULL, this);
if (this->actionFunc == func_80AB6450) {
func_80033C30(&this->actor.posRot.pos, &scale, 255, globalCtx);
func_80033C30(&this->actor.world.pos, &scale, 255, globalCtx);
}
EnNiw_FeatherDraw(this, globalCtx);