Misc Cleanup (#1509)

* begin anim R

* sTexturesDesegmented

* more misc docs

* more misc cleanup

* small adjustments

* oh sneaky

* PR Review

* adj comment, reads better

* missed an enum

* this one actor reverses true/false

* bool

* CARNIVOROUS_LILY
This commit is contained in:
engineer124
2023-11-28 01:54:11 +11:00
committed by GitHub
parent 5284302c8f
commit 55badb7162
117 changed files with 946 additions and 881 deletions
+2 -2
View File
@@ -1401,8 +1401,8 @@ void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) {
uintptr_t startAddr = change->oldAddr;
uintptr_t endAddr = change->oldAddr + change->size;
if (startAddr <= (uintptr_t)sample->sampleAddr && (uintptr_t)sample->sampleAddr < endAddr) {
sample->sampleAddr = sample->sampleAddr - startAddr + change->newAddr;
if (((uintptr_t)sample->sampleAddr >= startAddr) && ((uintptr_t)sample->sampleAddr < endAddr)) {
sample->sampleAddr += -startAddr + change->newAddr;
if (D_801FD120 == 0) {
sample->medium = change->newMedium;
} else {
+1 -1
View File
@@ -1726,7 +1726,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) {
asyncLoad->bytesRemaining -= asyncLoad->chunkSize;
asyncLoad->curDevAddr += asyncLoad->chunkSize;
asyncLoad->curRamAddr = asyncLoad->curRamAddr + asyncLoad->chunkSize;
asyncLoad->curRamAddr += asyncLoad->chunkSize;
}
void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size) {
+1 -1
View File
@@ -85,7 +85,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) {
}
dstEnd = dst + ((Yaz0Header*)src)->decSize;
src = src + sizeof(Yaz0Header);
src += sizeof(Yaz0Header);
do {
if (bitIdx == 0) {
+2 -2
View File
@@ -2041,10 +2041,10 @@ s32 Camera_Normal1(Camera* camera) {
spD8.y -= focalActorHeight + roData->unk_00;
spC4 = Camera_Vec3fMagnitude(&spD8);
if ((roData->unk_04 + roData->unk_08) < spC4) {
if (spC4 > (roData->unk_04 + roData->unk_08)) {
spC4 = 1.0f;
} else {
spC4 = spC4 / (roData->unk_04 + roData->unk_08);
spC4 /= roData->unk_04 + roData->unk_08;
}
spD0 = 0.2f;
+5 -5
View File
@@ -329,7 +329,7 @@ void func_800A640C(EnItem00* this, PlayState* play) {
if ((this->actor.params <= ITEM00_RUPEE_RED) ||
((this->actor.params == ITEM00_RECOVERY_HEART) && (this->unk152 < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
this->actor.shape.rot.y += 0x3C0;
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_DEKU_NUTS_10) &&
(this->actor.params < ITEM00_BOMBS_0)) {
if (this->unk152 == -1) {
@@ -343,7 +343,7 @@ void func_800A640C(EnItem00* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
} else if ((this->actor.params == ITEM00_MAP) || (this->actor.params == ITEM00_COMPASS)) {
this->unk152 = -1;
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
this->actor.shape.rot.y += 0x3C0;
}
if ((this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) {
@@ -381,7 +381,7 @@ void func_800A6650(EnItem00* this, PlayState* play) {
Vec3f pos;
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
this->actor.shape.rot.y += 0x3C0;
}
if ((play->gameplayFrames & 1) != 0) {
@@ -395,7 +395,7 @@ void func_800A6650(EnItem00* this, PlayState* play) {
if (this->actor.velocity.y > -2.0f) {
this->actionFunc = func_800A640C;
} else {
this->actor.velocity.y = this->actor.velocity.y * -0.8f;
this->actor.velocity.y *= -0.8f;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
}
}
@@ -1430,7 +1430,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP
spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f;
Actor_SetScale(&spawnedActor->actor, 0.0f);
spawnedActor->actionFunc = func_800A6780;
spawnedActor->actor.flags = spawnedActor->actor.flags | ACTOR_FLAG_10;
spawnedActor->actor.flags |= ACTOR_FLAG_10;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
+1 -1
View File
@@ -690,7 +690,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 arg2) {
envCtx->lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE;
R_TIME_SPEED = envCtx->sceneTimeSpeed = 0;
R_TIME_SPEED = R_TIME_SPEED;
R_TIME_SPEED = R_TIME_SPEED; // Set to itself
R_ENV_DISABLE_DBG = false;
CREG(64) = 0;
+4 -4
View File
@@ -691,10 +691,10 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed) {
f0 = Math3D_Vec3fMagnitude(&diff);
if (speed < f0) {
f2 = speed / f0;
f0 = f0 - speed;
start->x = start->x + f2 * diff.x;
start->y = start->y + f2 * diff.y;
start->z = start->z + f2 * diff.z;
f0 -= speed;
start->x += f2 * diff.x;
start->y += f2 * diff.y;
start->z += f2 * diff.z;
} else {
Math_Vec3f_Copy(start, target);
f0 = 0.0f;
+1 -1
View File
@@ -2284,7 +2284,7 @@ void Message_Decode(PlayState* play) {
} else if (curChar == 0x203) {
msgCtx->unk11F18 = 1;
msgCtx->choiceNum = 3;
msgCtx->unk11FF8 = msgCtx->unk11FF8 + 0x16;
msgCtx->unk11FF8 += 0x16;
} else if (curChar == 0x204) {
Message_GetTimerDigits(((void)0, gSaveContext.timerCurTimes[curChar - 0x204]), spAC);
+1 -1
View File
@@ -1098,7 +1098,7 @@ void Message_DecodeNES(PlayState* play) {
} else if (curChar == 0xC3) {
msgCtx->unk11F18 = 0;
msgCtx->choiceNum = 3;
msgCtx->unk11FF8 = msgCtx->unk11FF8 + 0x16;
msgCtx->unk11FF8 += 0x16;
} else if (curChar == 0xC4) {
Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8);
+1 -1
View File
@@ -3177,7 +3177,7 @@ void func_80127DA4(PlayState* play, struct_801F58B0 arg1[], struct_80128388_arg1
if (play->actorCtx.flags & ACTORCTX_FLAG_3) {
phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -0.8f, 0.8f);
} else {
phi_s1->unk_0C.y = phi_s1->unk_0C.y;
phi_s1->unk_0C.y = phi_s1->unk_0C.y; // Set to itself
f20 = Math_SinS(arg1->unk_1A);
phi_s1->unk_0C.y += (((f22 * Math_CosS(arg1->unk_1A)) + (f24 * f20)) * 0.2f);
phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -2.0f, 4.0f);
+2 -1
View File
@@ -569,7 +569,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == count - 1) {
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
@@ -578,6 +578,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
}
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) {
reached = true;
}
@@ -288,9 +288,9 @@ void func_80B84568(BgDblueWaterfall* this, PlayState* play) {
}
void func_80B84610(BgDblueWaterfall* this, PlayState* play) {
s32 pad[2];
Vec3f sp34;
s32 pad;
Player* player = GET_PLAYER(play);
Vec3f sp34;
if (this->unk_1A7 <= 0) {
this->unk_1A7 = 16;
@@ -300,18 +300,10 @@ void func_80B84610(BgDblueWaterfall* this, PlayState* play) {
if (this->unk_1A7 >= 6) {
this->unk_1A8 += Rand_ZeroOne() * 0.1f;
if (this->unk_1A8 > 0.5f) {
this->unk_1A8 = 0.5f;
} else {
this->unk_1A8 = this->unk_1A8;
}
this->unk_1A8 = CLAMP_MAX(this->unk_1A8, 0.5f);
} else {
this->unk_1A8 -= Rand_ZeroOne() * 0.2f;
if (this->unk_1A8 > -0.5f) {
this->unk_1A8 = -0.5f;
} else {
this->unk_1A8 = this->unk_1A8;
}
this->unk_1A8 = CLAMP_MAX(this->unk_1A8, -0.5f);
}
Matrix_Push();
@@ -321,10 +313,13 @@ void func_80B84610(BgDblueWaterfall* this, PlayState* play) {
player->actor.world.pos.x += sp34.x;
player->actor.world.pos.z += sp34.z;
//! FAKE:
if (this && this && this) {}
player->pushedSpeed = 8.0f;
player->pushedYaw = this->actor.yawTowardsPlayer;
{
s32 requiredScopeTemp;
player->pushedSpeed = 8.0f;
player->pushedYaw = this->actor.yawTowardsPlayer;
}
}
static InitChainEntry sInitChain[] = {
@@ -77,7 +77,7 @@ void BgIcicle_Init(Actor* thisx, PlayState* play) {
paramsHigh = (thisx->params >> 8) & 0xFF;
paramsMid = (thisx->params >> 2) & 0x3F;
this->unk_161 = (thisx->params >> 8) & 0xFF;
thisx->params = thisx->params & 3;
thisx->params &= 3;
if (thisx->params == ICICLE_STALAGMITE_RANDOM_DROP || thisx->params == ICICLE_STALAGMITE_FIXED_DROP) {
this->unk_160 = ((thisx->params == ICICLE_STALAGMITE_RANDOM_DROP) ? paramsHigh : paramsMid);
@@ -598,8 +598,8 @@ void func_80B81234(BgIkanaRotaryroom* this, PlayState* play) {
sp64 &= Math_ScaledStepToS(&player->actor.shape.rot.y, ptr->unk_40.y, 2000);
sp64 &= Math_ScaledStepToS(&player->actor.shape.rot.z, ptr->unk_40.z, 2000);
ptr->unk_48 = ptr->unk_48 - 2.1f;
ptr->unk_48 = ptr->unk_48 * 0.98f;
ptr->unk_48 -= 2.1f;
ptr->unk_48 *= 0.98f;
if (ptr->unk_48 < -30.0f) {
ptr->unk_48 = -30.0f;
}
@@ -218,7 +218,7 @@ void func_80C0AE5C(BgIkninSusceil* this, PlayState* play) {
this->dyna.actor.velocity.y += -0.1f;
this->dyna.actor.velocity.y *= 0.95f;
this->dyna.actor.velocity.y = CLAMP_MIN(this->dyna.actor.velocity.y, 1.0f);
this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + this->dyna.actor.velocity.y;
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if ((this->dyna.actor.home.pos.y + 365.0f) < this->dyna.actor.world.pos.y) {
BgIkninSusceil_RequestQuakeAndRumble(this, play, 3, 14, 2);
func_80C0AB14(this);
@@ -74,6 +74,7 @@ void BgSpoutFire_Init(Actor* thisx, PlayState* play) {
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->collider.dim.pos.y = this->actor.world.pos.y;
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(sFlameTextures); i++) {
sFlameTextures[i] = Lib_SegmentedToVirtual(sFlameTextures[i]);
+1 -1
View File
@@ -572,7 +572,7 @@ void func_809ED45C(Boss04* this, PlayState* play) {
this->collider1.elements[0].info.bumperFlags &= ~BUMP_HIT;
Actor_PlaySfx(&this->actor, NA_SE_EN_ME_DAMAGE);
damage = this->actor.colChkInfo.damage;
this->actor.colChkInfo.health = this->actor.colChkInfo.health - damage;
this->actor.colChkInfo.health -= damage;
if ((s8)this->actor.colChkInfo.health <= 0) {
func_809ED224(this);
this->unk_1FE = 100;
@@ -141,10 +141,10 @@ void func_80C16760(DemoSyoten* this, PlayState* play) {
Vec3f sp2C;
this->unk_3EC = 0;
if (DEMOSYOTEN_GET_7E00(&this->actor) != DEMOSYOTEN_7E00_3F) {
this->unk_3E8 = &play->setupPathList[DEMOSYOTEN_GET_7E00(&this->actor)];
if (this->unk_3E8 != NULL) {
points = Lib_SegmentedToVirtual(this->unk_3E8->points);
if (DEMOSYOTEN_GET_PATH_INDEX(&this->actor) != DEMOSYOTEN_PATH_INDEX_NONE) {
this->path = &play->setupPathList[DEMOSYOTEN_GET_PATH_INDEX(&this->actor)];
if (this->path != NULL) {
points = Lib_SegmentedToVirtual(this->path->points);
Math_Vec3s_ToVec3f(&this->actor.world.pos, &points[0]);
this->unk_3EC++;
points++;
@@ -153,13 +153,13 @@ void func_80C16760(DemoSyoten* this, PlayState* play) {
this->actor.world.rot.x = Math_Vec3f_Pitch(&this->actor.world.pos, &sp2C);
}
} else {
this->unk_3E8 = NULL;
this->path = NULL;
}
}
s32 func_80C16818(DemoSyoten* this) {
s32 pad;
Path* path = this->unk_3E8;
Path* path = this->path;
Vec3s* points;
Vec3f sp28;
@@ -167,7 +167,7 @@ s32 func_80C16818(DemoSyoten* this) {
return true;
}
points = Lib_SegmentedToVirtual(this->unk_3E8->points);
points = Lib_SegmentedToVirtual(this->path->points);
points += this->unk_3EC;
Math_Vec3s_ToVec3f(&sp28, points);
this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp28);
@@ -181,14 +181,14 @@ s32 func_80C16818(DemoSyoten* this) {
void func_80C168D0(DemoSyoten* this, PlayState* play) {
s32 pad;
Path* path = this->unk_3E8;
Path* path = this->path;
Vec3s* points;
Vec3f worldPos;
Vec3f projectedPos;
f32 invW;
if (path != NULL) {
points = Lib_SegmentedToVirtual(this->unk_3E8->points);
points = Lib_SegmentedToVirtual(this->path->points);
points += this->unk_3EC;
Math_Vec3s_ToVec3f(&worldPos, points);
Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW);
@@ -248,6 +248,9 @@ void func_80C16A74(DemoSyoten* this, PlayState* play) {
case 4:
this->actor.draw = NULL;
break;
default:
break;
}
}
@@ -315,7 +318,7 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) {
case 4:
this->actor.speed =
play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->rot.z * 0.005493164f;
if (this->unk_3EC < this->unk_3E8->count) {
if (this->unk_3EC < this->path->count) {
if (func_80C16818(this)) {
this->unk_3EC++;
}
@@ -8,9 +8,9 @@ struct DemoSyoten;
typedef void (*DemoSyotenActionFunc)(struct DemoSyoten*, PlayState*);
#define DEMOSYOTEN_GET_F(thisx) ((thisx)->params & 0xF)
#define DEMOSYOTEN_GET_7E00(thisx) (((thisx)->params & 0x7E00) >> 9)
#define DEMOSYOTEN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9)
#define DEMOSYOTEN_7E00_3F 0x3F
#define DEMOSYOTEN_PATH_INDEX_NONE 0x3F
typedef enum {
/* 0 */ DEMOSYOTEN_F_0,
@@ -30,7 +30,7 @@ typedef struct DemoSyoten {
/* 0x3E0 */ AnimatedMaterial* unk_3E0;
/* 0x3E4 */ u16 unk_3E4;
/* 0x3E6 */ s16 unk_3E6;
/* 0x3E8 */ Path* unk_3E8;
/* 0x3E8 */ Path* path;
/* 0x3EC */ s32 unk_3EC;
/* 0x3F0 */ u16 cueType;
/* 0x3F2 */ u16 cueId;
@@ -146,8 +146,11 @@ void DmChar02_Update(Actor* thisx, PlayState* play) {
DmChar02* this = THIS;
SkelAnime_Update(&this->skelAnime);
this->unk_2F0 = this->unk_2F0;
this->unk_2F0 = this->unk_2F0; // Set to itself
this->actionFunc(this, play);
if (!Actor_HasParent(&this->actor, play)) {
Actor_OfferGetItem(&this->actor, play, GI_OCARINA_OF_TIME, 30.0f, 80.0f);
} else {
@@ -71,7 +71,7 @@ void DmChar09_Destroy(Actor* thisx, PlayState* play) {
}
void func_80AB1FA0(DmChar09* this, s32 arg1) {
Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->unk_224[arg1]);
Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[arg1]);
}
void func_80AB1FDC(DmChar09* this, PlayState* play) {
@@ -85,7 +85,7 @@ void func_80AB1FDC(DmChar09* this, PlayState* play) {
Vec3s* temp_v1;
Math_Vec3f_Copy(&sp40, &thisx->world.pos);
Math_Vec3s_ToVec3f(&sp58, this->unk_224 + this->unk_21C + this->unk_220);
Math_Vec3s_ToVec3f(&sp58, this->pathPoints + this->unk_21C + this->unk_220);
Math_Vec3f_Diff(&sp58, &thisx->world.pos, &thisx->velocity);
sp54 = Math3D_Vec3fMagnitude(&thisx->velocity);
if ((sp54 < (this->speed * 8.0f)) && (this->speed > 2.0f)) {
@@ -107,9 +107,9 @@ void func_80AB1FDC(DmChar09* this, PlayState* play) {
phi_a1 = true;
if (((this->unk_21C >= this->unk_218) && (this->unk_220 > 0)) ||
((this->unk_21C <= 0) && (this->unk_220 < 0))) {
temp_v1 = this->unk_224 + this->unk_218;
if (((this->unk_224->x == temp_v1->x) && (this->unk_224->y == temp_v1->y)) &&
(this->unk_224->z == temp_v1->z)) {
temp_v1 = &this->pathPoints[this->unk_218];
if (((this->pathPoints[0].x == temp_v1->x) && (this->pathPoints[0].y == temp_v1->y)) &&
(this->pathPoints[0].z == temp_v1->z)) {
this->unk_21C = 0;
this->unk_220 = 1;
} else {
@@ -179,7 +179,7 @@ void DmChar09_HandleCutscene(DmChar09* this, PlayState* play) {
path = &play->setupPathList[pathIndex];
}
this->unk_224 = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
this->unk_214 = path->count;
this->unk_21C = 0;
this->unk_218 = path->count - 1;
@@ -26,7 +26,7 @@ typedef struct DmChar09 {
/* 0x218 */ s32 unk_218;
/* 0x21C */ s32 unk_21C;
/* 0x220 */ s32 unk_220;
/* 0x224 */ Vec3s* unk_224;
/* 0x224 */ Vec3s* pathPoints;
/* 0x228 */ s16 unk_228;
/* 0x22A */ s16 unk_22A;
/* 0x22C */ UNK_TYPE1 pad22C[2];
+3 -3
View File
@@ -1166,7 +1166,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
this->fadeInState = SK_FADE_IN_STATE_NONE;
this->fadeOutState = SK_FADE_OUT_STATE_NONE;
this->fadeOutTimer = 0;
this->alpha = this->alpha;
this->alpha = this->alpha; // Set to itself
this->actor.targetArrowOffset = 1100.0f;
this->cueId = 99;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
@@ -1824,7 +1824,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
}
this->alpha = this->alpha;
this->alpha = this->alpha; // Set to itself
this->actionFunc(this, play);
@@ -2098,7 +2098,7 @@ void DmStk_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
this->alpha = this->alpha;
this->alpha = this->alpha; // Set to itself
Gfx_SetupDL25_Opa(play->state.gfxCtx);
if (this->alpha < 255) {
@@ -182,47 +182,48 @@ void func_80BECC7C(EnAkindonuts* this, PlayState* play) {
}
}
s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 idx = arg2;
s32 sp50 = false;
f32 phi_f12;
f32 phi_f14;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnAkindonuts_HasReachedPoint(EnAkindonuts* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &sp5C[idx]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (idx == 0) {
phi_f12 = sp5C[1].x - sp5C[0].x;
phi_f14 = sp5C[1].z - sp5C[0].z;
} else if (idx == (sp58 - 1)) {
phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x;
phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z;
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = sp5C[idx + 1].x - sp5C[idx - 1].x;
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return sp50;
return reached;
}
f32 func_80BECEAC(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) {
Vec3s* temp;
Vec3s* points;
Vec3f sp20;
Vec3s* point;
if (path != NULL) {
temp = Lib_SegmentedToVirtual(path->points);
point = &temp[arg1];
points = Lib_SegmentedToVirtual(path->points);
point = &points[arg1];
sp20.x = point->x;
sp20.y = point->y;
@@ -236,12 +237,12 @@ f32 func_80BECEAC(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) {
}
s16 func_80BECF6C(Path* path) {
Vec3s* sp34 = Lib_SegmentedToVirtual(path->points);
Vec3s* points = Lib_SegmentedToVirtual(path->points);
Vec3f sp28;
Vec3f sp1C;
Math_Vec3s_ToVec3f(&sp28, &sp34[0]);
Math_Vec3s_ToVec3f(&sp1C, &sp34[1]);
Math_Vec3s_ToVec3f(&sp28, &points[0]);
Math_Vec3s_ToVec3f(&sp1C, &points[1]);
return Math_Vec3f_Yaw(&sp28, &sp1C);
}
@@ -1639,7 +1640,7 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) {
this->unk_352 += this->unk_362;
this->actor.world.rot.x = -sp38.x;
if (func_80BECD10(this, this->path, this->unk_334) && (sp34 < 10.0f)) {
if (EnAkindonuts_HasReachedPoint(this, this->path, this->unk_334) && (sp34 < 10.0f)) {
if (this->unk_334 >= (this->path->count - 1)) {
CutsceneManager_Stop(this->csId);
this->actionFunc = func_80BEFD74;
+5 -4
View File
@@ -346,8 +346,8 @@ void EnAz_Init(Actor* thisx, PlayState* play2) {
}
}
if (this->unk_374 & 1) {
SubS_CopyPointFromPathList(play->setupPathList, BEAVER_GET_PARAM_FF(thisx),
play->setupPathList[BEAVER_GET_PARAM_FF(thisx)].count - 1, &D_80A99E80);
SubS_CopyPointFromPathList(play->setupPathList, BEAVER_GET_PATH_INDEX(thisx),
play->setupPathList[BEAVER_GET_PATH_INDEX(thisx)].count - 1, &D_80A99E80);
}
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) {
if (this->unk_374 & 2) {
@@ -622,7 +622,7 @@ void func_80A95DA0(EnAz* this, PlayState* play) {
ActorPathing* sp40 = &this->unk_300;
SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, sp40, play->setupPathList,
BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 1);
BEAVER_GET_PATH_INDEX(&this->actor), 0, 0, 1, 1);
this->unk_36C = 4.0f;
this->actor.speed = 4.0f;
this->actor.gravity = 0.0f;
@@ -1614,7 +1614,7 @@ void func_80A97E48(EnAz* this, PlayState* play) {
void func_80A97EAC(EnAz* this, PlayState* play) {
SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, &this->unk_300, play->setupPathList,
BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 0);
BEAVER_GET_PATH_INDEX(&this->actor), 0, 0, 1, 0);
this->unk_36C = 8.0f;
this->actor.speed = 8.0f;
this->actor.gravity = 0.0f;
@@ -1974,6 +1974,7 @@ s32 EnAz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
*dList = NULL;
}
if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_NONE) {
// Set to itself
rot->x = rot->x;
rot->y = rot->y;
rot->z = rot->z;
+1 -1
View File
@@ -9,7 +9,7 @@ struct EnAz;
typedef void (*EnAzActionFunc)(struct EnAz*, PlayState*);
#define BEAVER_GET_PARAM_F00(thisx) (((thisx)->params >> 8) & 0xF)
#define BEAVER_GET_PARAM_FF(thisx) ((thisx)->params & 0xFF)
#define BEAVER_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF)
typedef struct EnAz {
/* 0x000 */ Actor actor;
@@ -130,7 +130,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_STOP),
};
s32 D_80A29778 = 0;
static s32 sTexturesDesegmented = false;
Vec3f D_80A2977C = { 0.0f, 1.0f, 0.0f };
Color_RGBA8 D_80A29788 = { 250, 250, 250, 255 };
Color_RGBA8 D_80A2978C = { 180, 180, 180, 255 };
@@ -151,11 +151,11 @@ void EnBigpamet_Init(Actor* thisx, PlayState* play) {
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
if (!D_80A29778) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(D_80A29754); i++) {
D_80A29754[i] = Lib_SegmentedToVirtual(D_80A29754[i]);
}
D_80A29778 = true;
sTexturesDesegmented = true;
}
this->actor.params = ENBIGPAMET_1;
@@ -532,9 +532,9 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) {
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
if ((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0) {
this->actor.world.rot.y = this->actor.world.rot.y - 0x300;
this->actor.world.rot.y -= 0x300;
} else {
this->actor.world.rot.y = this->actor.world.rot.y + 0x300;
this->actor.world.rot.y += 0x300;
}
}
@@ -1067,7 +1067,7 @@ void EnBigpo_FlameCircleCutscene(EnBigpo* this, PlayState* play) {
if (magnitude > 0.0001f) {
Math_Vec3f_Scale(&posDiff, 1.0f / magnitude);
}
magnitude = magnitude / this->idleTimer;
magnitude /= this->idleTimer;
this->actor.world.pos.x -= magnitude * posDiff.x;
this->actor.world.pos.y -= magnitude * posDiff.y;
this->actor.world.pos.z -= magnitude * posDiff.z;
@@ -447,10 +447,12 @@ s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
*dList = NULL;
}
if (limbIndex == SHIKASHI_LIMB_NONE) {
// Set to itself
rot->x = rot->x;
rot->y = rot->y;
rot->z = rot->z;
}
switch (limbIndex) {
case SHIKASHI_LIMB_TORSO:
rot->x += this->torsoXRotStep;
+1 -1
View File
@@ -290,7 +290,7 @@ void EnBom_Move(EnBom* this, PlayState* play) {
if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) {
this->actor.velocity.y = 0.0f;
} else {
this->actor.velocity.y = this->actor.velocity.y * sp58->z;
this->actor.velocity.y *= sp58->z;
}
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
}
@@ -389,7 +389,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
}
if ((this->timer == 3) || (this->timer == 30) || (this->timer == 50) || (this->timer == 70)) {
this->unk_1FE = this->unk_1FE >> 1;
this->unk_1FE >>= 1;
}
if ((this->timer < 100) && (this->timer & (this->unk_1FE + 1))) {
+1 -5
View File
@@ -537,11 +537,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f);
this->drawDmgEffFrozenSteamScale = (this->drawDmgEffAlpha + 1.0f) * 0.25f;
if (this->drawDmgEffFrozenSteamScale > 0.5f) {
this->drawDmgEffFrozenSteamScale = 0.5f;
} else {
this->drawDmgEffFrozenSteamScale = this->drawDmgEffFrozenSteamScale;
}
this->drawDmgEffFrozenSteamScale = CLAMP_MAX(this->drawDmgEffFrozenSteamScale, 0.5f);
} else if (!Math_StepToF(&this->drawDmgEffScale, 0.5f, 0.5f * 0.025f)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
+11 -10
View File
@@ -266,8 +266,8 @@ void EnDg_GetFloorRot(EnDg* this, Vec3f* floorRot) {
s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 pathCount = path->count;
s32 currentPoint = pointIndex;
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
@@ -276,21 +276,22 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) {
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[currentPoint]);
if (currentPoint == 0) {
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (currentPoint == pathCount - 1) {
diffX = points[pathCount - 1].x - points[pathCount - 2].x;
diffZ = points[pathCount - 1].z - points[pathCount - 2].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
diffX = points[currentPoint + 1].x - points[currentPoint - 1].x;
diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
@@ -259,7 +259,7 @@ static InitChainEntry sInitChain[] = {
};
void EnDinofos_Init(Actor* thisx, PlayState* play) {
static s32 D_8089E364 = 0;
static s32 sTexturesDesegmented = false;
static EffectBlureInit2 D_8089E368 = {
0, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8,
0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
@@ -277,11 +277,11 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gDinolfosSkel, &gDinolfosIdleAnim, this->jointTable, this->morphTable,
DINOLFOS_LIMB_MAX);
if (D_8089E364 == 0) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) {
sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]);
}
D_8089E364 = 1;
sTexturesDesegmented = true;
}
this->unk_288 = 255;
@@ -499,7 +499,7 @@ void func_80876DC4(EnDodongo* this, PlayState* play) {
sp68.x = this->bodyPartsPos[DODONGO_BODYPART_0].x + (temp_f20 * 6.0f * this->unk_334);
sp68.z = this->bodyPartsPos[DODONGO_BODYPART_0].z - (temp_f22 * 6.0f * this->unk_334);
sp80.x *= -1.0f;
sp80.z = sp80.z * -1.0f;
sp80.z *= -1.0f;
sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334;
sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * temp_f22 * this->unk_334;
func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14);
@@ -150,7 +150,7 @@ void EnEncount3_Update(Actor* thisx, PlayState* play2) {
func_800B8D50(play, &this->actor, 10.0f, Math_Atan2S_XY(sp38, sp3C), 0.0f, 1);
}
}
this->child->colChkInfo = this->child->colChkInfo;
this->child->colChkInfo = this->child->colChkInfo; // Set to itself
}
this->unk168 = this->unk16C;
+1 -1
View File
@@ -730,7 +730,7 @@ void func_8091EFE8(Actor* thisx, PlayState* play) {
temp_v0_2 = BINANG_SUB(this->unk_268, this->actor.shape.rot.x);
temp_v0_2 = ABS_ALT(temp_v0_2);
temp_v0_2 = temp_v0_2 / 11;
temp_v0_2 /= 11;
if (temp_v0_2 > 800) {
temp_v0_2 = 800;
} else if (temp_v0_2 < 100) {
+9 -9
View File
@@ -135,13 +135,13 @@ void func_809616E0(EnFu* this, PlayState* play) {
this->unk_54C = 0;
for (i = 0; i < this->unk_520; i++) {
temp_f20 = this->actor.world.pos.x - this->unk_538[i].x;
temp_f22 = this->actor.world.pos.z - this->unk_538[i].z;
temp_f20 = this->actor.world.pos.x - this->pathPoints[i].x;
temp_f22 = this->actor.world.pos.z - this->pathPoints[i].z;
atan = Math_Atan2S_XY(temp_f22, temp_f20);
if (!spA0 || ((i % 2) != 0)) {
Actor_Spawn(&play->actorCtx, play, this->unk_544, this->unk_538[i].x, this->unk_538[i].y,
this->unk_538[i].z, 0, atan, 0, i);
Actor_Spawn(&play->actorCtx, play, this->unk_544, this->pathPoints[i].x, this->pathPoints[i].y,
this->pathPoints[i].z, 0, atan, 0, i);
this->unk_54C++;
}
@@ -151,9 +151,9 @@ void func_809616E0(EnFu* this, PlayState* play) {
Color_RGBA8 sp78 = { 255, 255, 255, 255 };
Color_RGBA8 sp74 = { 198, 198, 198, 255 };
sp94.x = this->unk_538[i].x;
sp94.y = this->unk_538[i].y;
sp94.z = this->unk_538[i].z;
sp94.x = this->pathPoints[i].x;
sp94.y = this->pathPoints[i].y;
sp94.z = this->pathPoints[i].z;
func_800B0EB0(play, &sp94, &sp88, &sp7C, &sp78, &sp74, 100, 150, 10);
sp94.x -= 0.1f * temp_f20;
sp94.z -= 0.1f * temp_f22;
@@ -164,7 +164,7 @@ void func_809616E0(EnFu* this, PlayState* play) {
void func_809619D0(EnFu* this, PlayState* play) {
s32 i;
Path* path = &play->setupPathList[ENFU_GET_FF00(&this->actor)];
Path* path = &play->setupPathList[ENFU_GET_PATH_INDEX(&this->actor)];
switch (CURRENT_DAY) {
case 1:
@@ -193,7 +193,7 @@ void func_809619D0(EnFu* this, PlayState* play) {
}
this->unk_520 = path->count;
this->unk_538 = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
func_809616E0(this, play);
}
+2 -2
View File
@@ -9,7 +9,7 @@ struct EnFu;
typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*);
#define ENFU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF)
#define ENFU_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF)
typedef struct {
/* 0x00 */ f32 unk_00;
@@ -38,7 +38,7 @@ typedef struct EnFu {
/* 0x524 */ s16 unk_524[3];
/* 0x52A */ s16 unk_52A[3];
/* 0x530 */ UNK_TYPE1 unk530[0x8];
/* 0x538 */ Vec3s* unk_538;
/* 0x538 */ Vec3s* pathPoints;
/* 0x53C */ s16 unk_53C;
/* 0x53E */ s16 unk_53E;
/* 0x540 */ s16 unk_540;
@@ -102,7 +102,7 @@ void EnFuMato_Init(Actor* thisx, PlayState* play) {
this->collider.dim.worldSphere.radius = 30;
} else {
this->collider.dim.worldSphere.radius = 17;
this->unk_2F8 = fu->unk_538;
this->unk_2F8 = fu->pathPoints;
this->unk_2F4 = fu->unk_520;
this->unk_2F0 = ENFUMATO_GET(&this->dyna.actor);
}
@@ -312,11 +312,7 @@ void func_80ACECFC(EnFuMato* this, PlayState* play) {
ptr->unk_24.z += ptr->unk_2A.z;
if ((this->unk_302 == 2) && (ptr->unk_30 == 1) && (ptr->unk_00.y < (this->dyna.actor.floorHeight + 10.0f))) {
if (ptr->unk_0C.y < 0.0f) {
ptr->unk_0C.y = -ptr->unk_0C.y;
} else {
ptr->unk_0C.y = ptr->unk_0C.y;
}
ptr->unk_0C.y = ABS_ALT(ptr->unk_0C.y);
ptr->unk_0C.y *= 0.5f;
ptr->unk_0C.x *= (Rand_Centered() * 1.5f) + 2.0f;
ptr->unk_0C.z *= (Rand_Centered() * 1.5f) + 2.0f;
+27 -26
View File
@@ -23,7 +23,7 @@ void func_80B3B120(EnGg2* this, PlayState* play);
void func_80B3B21C(EnGg2* this, PlayState* play);
void func_80B3B294(EnGg2* this, PlayState* play);
void func_80B3B5D4(EnGg2* this, PlayState* play);
s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_);
s32 EnGg2_HasReachedPoint(EnGg2* this, Path* path, s32 pointIndex);
f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3);
ActorInit En_Gg2_InitVars = {
@@ -217,7 +217,7 @@ void func_80B3B120(EnGg2* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.world.rot.y;
Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1);
this->actor.world.rot.x = -this->actor.shape.rot.x;
if (func_80B3B648(this, this->path, this->unk_1DC) != 0) {
if (EnGg2_HasReachedPoint(this, this->path, this->unk_1DC)) {
if (this->unk_1DC >= (this->path->count - 2)) {
this->actionFunc = func_80B3AE60;
this->actor.speed = 0.0f;
@@ -262,7 +262,7 @@ void func_80B3B294(EnGg2* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1);
this->actor.world.rot.x = -this->actor.shape.rot.x;
if (func_80B3B648(this, this->path, this->unk_1DC)) {
if (EnGg2_HasReachedPoint(this, this->path, this->unk_1DC)) {
if (this->unk_1DC < (this->path->count - 1)) {
this->unk_1DC++;
} else {
@@ -313,37 +313,38 @@ void func_80B3B5D4(EnGg2* this, PlayState* play) {
}
}
s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) {
s32 EnGg2_HasReachedPoint(EnGg2* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 arg2 = arg2_;
s32 ret = false;
f32 phi_f12;
f32 phi_f14;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &points[arg2]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (arg2 == 0) {
phi_f12 = points[1].x - points[0].x;
phi_f14 = points[1].z - points[0].z;
} else if ((sp58 - 1) == arg2) {
phi_f12 = points[sp58 - 1].x - points[sp58 - 2].x;
phi_f14 = points[sp58 - 1].z - points[sp58 - 2].z;
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = points[arg2 + 1].x - points[arg2 - 1].x;
phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
+27 -25
View File
@@ -389,36 +389,38 @@ void func_80B50B38(EnGk* this, PlayState* play) {
}
}
s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 arg2 = arg2_;
s32 ret = false;
f32 phi_f12;
f32 phi_f14;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnGk_HasReachedPoint(EnGk* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]);
if (arg2 == 0) {
phi_f12 = sp5C[1].x - sp5C[0].x;
phi_f14 = sp5C[1].z - sp5C[0].z;
} else if ((sp58 - 1) == arg2) {
phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x;
phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z;
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = sp5C[arg2 + 1].x - sp5C[arg2 - 1].x;
phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
f32 func_80B50E14(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
@@ -854,7 +856,7 @@ void func_80B51EA4(EnGk* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, sp38.y, 5, 0x1000, 0x100);
this->actor.shape.rot.y = this->actor.world.rot.y;
sp36 = this->actor.shape.rot.y - sp38.y;
if (func_80B50C78(this, this->path, this->unk_1EC)) {
if (EnGk_HasReachedPoint(this, this->path, this->unk_1EC)) {
if (this->unk_1EC >= (this->path->count - 1)) {
CutsceneManager_Stop(this->csId);
Actor_Kill(&this->actor);
@@ -189,17 +189,17 @@ void func_8093EB58(EnGoroiwa* this, PlayState* play) {
f32 func_8093EB74(EnGoroiwa* this, PlayState* play) {
s32 i;
Path* path = &play->setupPathList[ENGOROIWA_GET_FF(&this->actor)];
Path* path = &play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)];
s32 temp_s4 = path->count;
f32 temp_f20 = 0.0f;
Vec3f sp54;
Vec3f sp48;
Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[0]);
Math_Vec3s_ToVec3f(&sp48, &this->pathPoints[0]);
for (i = 1; i < temp_s4; i++) {
Math_Vec3f_Copy(&sp54, &sp48);
Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[i]);
Math_Vec3s_ToVec3f(&sp48, &this->pathPoints[i]);
temp_f20 += Math3D_Distance(&sp54, &sp48);
}
@@ -207,7 +207,7 @@ f32 func_8093EB74(EnGoroiwa* this, PlayState* play) {
}
void func_8093EC50(EnGoroiwa* this) {
Vec3s* var = &this->unk_1D0[this->unk_1D8];
Vec3s* var = &this->pathPoints[this->unk_1D8];
Vec3f sp18;
sp18.x = var->x;
@@ -255,21 +255,21 @@ void func_8093EDB0(EnGoroiwa* this) {
}
void func_8093EDD8(EnGoroiwa* this, PlayState* play) {
this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1;
this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)].count - 1;
this->unk_1D6 = 0;
this->unk_1D8 = 1;
this->unk_1DA = 1;
}
void func_8093EE18(EnGoroiwa* this, PlayState* play) {
this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1;
this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)].count - 1;
this->unk_1D6 = this->actor.home.rot.y;
this->unk_1D8 = this->unk_1D6 + 1;
this->unk_1DA = 1;
}
void func_8093EE64(EnGoroiwa* this, s32 arg1) {
Vec3s* temp_v0 = &this->unk_1D0[arg1];
Vec3s* temp_v0 = &this->pathPoints[arg1];
this->actor.world.pos.x = temp_v0->x;
this->actor.world.pos.y = temp_v0->y;
@@ -283,8 +283,8 @@ void func_8093EEBC(EnGoroiwa* this) {
}
s32 func_8093EEDC(EnGoroiwa* this) {
Vec3s* temp_v1 = &this->unk_1D0[this->unk_1D8];
Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D6];
Vec3s* temp_v1 = &this->pathPoints[this->unk_1D8];
Vec3s* temp_v0 = &this->pathPoints[this->unk_1D6];
if ((temp_v1->x == temp_v0->x) && (temp_v1->z == temp_v0->z)) {
if (temp_v0->y < temp_v1->y) {
@@ -360,7 +360,7 @@ s32 func_8093F34C(EnGoroiwa* this) {
Math_StepToF(&this->actor.speed, D_80942DFC[this->unk_1E4], 0.3f);
Actor_UpdateVelocityWithGravity(&this->actor);
temp_v0 = &this->unk_1D0[this->unk_1D8];
temp_v0 = &this->pathPoints[this->unk_1D8];
this->actor.velocity.y *= 0.97f;
x = temp_v0->x;
z = temp_v0->z;
@@ -387,7 +387,7 @@ s32 func_8093F498(EnGoroiwa* this) {
s32 pad;
f32 temp_f0;
Vec3f sp2C;
Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D8];
Vec3s* temp_v0 = &this->pathPoints[this->unk_1D8];
sp2C.x = temp_v0->x;
sp2C.y = temp_v0->y;
@@ -415,7 +415,7 @@ s32 func_8093F498(EnGoroiwa* this) {
s32 func_8093F5EC(EnGoroiwa* this) {
s32 pad;
Vec3s* sp18 = &this->unk_1D0[this->unk_1D8];
Vec3s* sp18 = &this->pathPoints[this->unk_1D8];
if (this->actor.velocity.y < 0.0f) {
this->actor.velocity.y = 0.0f;
@@ -436,7 +436,7 @@ s32 func_8093F5EC(EnGoroiwa* this) {
s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) {
f32 temp_f14;
Vec3s* sp80 = &this->unk_1D0[this->unk_1D8];
Vec3s* sp80 = &this->pathPoints[this->unk_1D8];
f32 sp7C = sp80->y;
f32 sp78;
f32 temp_f2;
@@ -948,11 +948,11 @@ void func_80941274(EnGoroiwa* this, PlayState* play) {
}
void EnGoroiwa_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnGoroiwa* this = THIS;
f32 temp_f0;
s32 params = ENGOROIWA_GET_FF(&this->actor);
s32 sp28 = params * 8;
Path* sp2C = &play->setupPathList[params];
s32 pathIndex = ENGOROIWA_GET_PATH_INDEX(&this->actor);
Path* path = &play->setupPathList[pathIndex];
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actor.world.rot.x = 0;
@@ -965,17 +965,17 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) {
func_8093E91C(this);
func_8093E9B0(this, play);
if (sp28 == 0x7F8) {
if (pathIndex == ENGOROIWA_PATH_INDEX_NONE) {
Actor_Kill(&this->actor);
return;
}
if (sp2C->count < 2) {
if (path->count < 2) {
Actor_Kill(&this->actor);
return;
}
if ((this->actor.home.rot.y >= (sp2C->count - 1)) && (this->actor.home.rot.y < 0)) {
if ((this->actor.home.rot.y >= (path->count - 1)) && (this->actor.home.rot.y < 0)) {
this->actor.home.rot.y = 0;
}
@@ -984,7 +984,7 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) {
this->actor.shape.shadowAlpha = 200;
func_8093EB58(this, play);
this->unk_1D0 = Lib_SegmentedToVirtual(sp2C->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
func_8093EE18(this, play);
func_8093EE64(this, this->actor.home.rot.y);
@@ -12,7 +12,9 @@ typedef s32 (*EnGoroiwaUnkFunc)(struct EnGoroiwa*);
#define ENGOROIWA_GET_3000(thisx) (((thisx)->params >> 0xC) & 3)
#define ENGOROIWA_GET_400(thisx) (((thisx)->params >> 0xA) & 1)
#define ENGOROIWA_GET_300(thisx) (((thisx)->params >> 0x8) & 3)
#define ENGOROIWA_GET_FF(thisx) ((thisx)->params & 0xFF)
#define ENGOROIWA_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF)
#define ENGOROIWA_PATH_INDEX_NONE 0xFF
typedef enum {
/* 0 */ ENGOROIWA_300_0,
@@ -66,7 +68,7 @@ typedef struct EnGoroiwa {
/* 0x1CA */ s16 unk_1CA;
/* 0x1CC */ s16 unk_1CC;
/* 0x1CE */ s16 unk_1CE;
/* 0x1D0 */ Vec3s* unk_1D0;
/* 0x1D0 */ Vec3s* pathPoints;
/* 0x1D4 */ s16 unk_1D4;
/* 0x1D6 */ s16 unk_1D6;
/* 0x1D8 */ s16 unk_1D8;
@@ -71,7 +71,7 @@ static TexturePtr sSilverEyeTextures[HONOTRAP_EYE_MAX] = {
gEyeSwitchSilverClosedTex,
};
static s32 sIsFirstInitEye = true;
static s32 sTexturesNotDesegmented = true;
ActorInit En_Honotrap_InitVars = {
/**/ ACTOR_EN_HONOTRAP,
@@ -187,8 +187,8 @@ void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) {
Actor_SetScale(&this->actor, 0.1f);
if (sIsFirstInitEye) {
sIsFirstInitEye = false;
if (sTexturesNotDesegmented) {
sTexturesNotDesegmented = false;
for (k = 0; k < HONOTRAP_EYE_MAX; k++) {
sSilverEyeTextures[k] = Lib_SegmentedToVirtual(sSilverEyeTextures[k]);
}
+17 -17
View File
@@ -314,7 +314,7 @@ void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnY
void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
s32 spA4;
Vec3s* spA0;
Vec3s* pathPoints;
f32 phi_f12;
f32 phi_f14;
Vec3f sp8C;
@@ -331,18 +331,18 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
Vec3f sp50;
spA4 = path->count;
spA0 = Lib_SegmentedToVirtual(path->points);
Math_Vec3s_ToVec3f(&sp8C, &spA0[this->curRaceWaypoint]);
pathPoints = Lib_SegmentedToVirtual(path->points);
Math_Vec3s_ToVec3f(&sp8C, &pathPoints[this->curRaceWaypoint]);
if (this->curRaceWaypoint == 0) {
phi_f12 = spA0[1].x - spA0[0].x;
phi_f14 = spA0[1].z - spA0[0].z;
phi_f12 = pathPoints[1].x - pathPoints[0].x;
phi_f14 = pathPoints[1].z - pathPoints[0].z;
} else if ((this->curRaceWaypoint + 1) == path->count) {
phi_f12 = spA0[path->count - 1].x - spA0[path->count - 2].x;
phi_f14 = spA0[path->count - 1].z - spA0[path->count - 2].z;
phi_f12 = pathPoints[path->count - 1].x - pathPoints[path->count - 2].x;
phi_f14 = pathPoints[path->count - 1].z - pathPoints[path->count - 2].z;
} else {
phi_f12 = spA0[this->curRaceWaypoint + 1].x - spA0[this->curRaceWaypoint - 1].x;
phi_f14 = spA0[this->curRaceWaypoint + 1].z - spA0[this->curRaceWaypoint - 1].z;
phi_f12 = pathPoints[this->curRaceWaypoint + 1].x - pathPoints[this->curRaceWaypoint - 1].x;
phi_f14 = pathPoints[this->curRaceWaypoint + 1].z - pathPoints[this->curRaceWaypoint - 1].z;
}
func_8017B7F8(&sp8C, Math_Atan2S(phi_f12, phi_f14), &sp7C, &sp78, &sp74);
@@ -352,13 +352,13 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
if (this->curRaceWaypoint >= spA4) {
this->curRaceWaypoint = spA4 - 1;
}
Math_Vec3s_ToVec3f(&sp8C, &spA0[this->curRaceWaypoint]);
Math_Vec3s_ToVec3f(&sp8C, &pathPoints[this->curRaceWaypoint]);
}
if (this->curRaceWaypoint == 0) {
Math_Vec3s_ToVec3f(&sp80, &spA0[1]);
Math_Vec3s_ToVec3f(&sp80, &pathPoints[1]);
} else {
Math_Vec3s_ToVec3f(&sp80, &spA0[this->curRaceWaypoint - 1]);
Math_Vec3s_ToVec3f(&sp80, &pathPoints[this->curRaceWaypoint - 1]);
}
func_8017D7C0(this->actor.world.pos.x, this->actor.world.pos.z, sp80.x, sp80.z, sp8C.x, sp8C.z, &sp70);
@@ -398,12 +398,12 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
sp64 = 1.0e+38;
sp60 = sp68 + 5;
if (path->count < sp60) {
if (sp60 > path->count) {
sp60 = path->count;
}
for (i = sp68; i < sp60; i++) {
Math_Vec3s_ToVec3f(&sp50, &spA0[i]);
Math_Vec3s_ToVec3f(&sp50, &pathPoints[i]);
temp_f0 = Math3D_Distance(&this->actor.world.pos, &sp50);
if (temp_f0 < sp64) {
sp64 = temp_f0;
@@ -411,7 +411,7 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
}
}
this->unk_398 = spA0[this->curRaceWaypoint].y * 0.01f;
this->unk_398 = pathPoints[this->curRaceWaypoint].y * 0.01f;
if ((this->unk_1EC & 0x100) && !(this->stateFlags & ENHORSE_JUMPING) &&
((this->colliderCylinder1.base.acFlags & AC_HIT) || (this->colliderCylinder2.base.acFlags & AC_HIT) ||
(this->unk_58C > 0))) {
@@ -836,8 +836,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements);
if (this->type == HORSE_TYPE_2) {
this->colliderCylinder1.dim.radius = this->colliderCylinder1.dim.radius * 0.8f;
this->colliderCylinder2.dim.radius = this->colliderCylinder2.dim.radius * 0.8f;
this->colliderCylinder1.dim.radius *= 0.8f;
this->colliderCylinder2.dim.radius *= 0.8f;
this->colliderJntSph.elements[0].dim.modelSphere.radius *= 0.6f;
} else if (this->type == HORSE_TYPE_DONKEY) {
this->colliderCylinder1.dim.radius = 50;
+1 -5
View File
@@ -916,11 +916,7 @@ void EnIk_Update(Actor* thisx, PlayState* play2) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f);
this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.325f;
if ((this->drawDmgEffAlpha + 1.0f) * 0.325f > 0.65f) {
this->drawDmgEffScale = 0.65f;
} else {
this->drawDmgEffScale = this->drawDmgEffScale;
}
this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.65f);
} else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.65f, 0.01625f)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
+13 -12
View File
@@ -218,10 +218,10 @@ s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
s32 EnJg_HasReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 pathCount = path->count;
s32 currentPoint = pointIndex;
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
@@ -230,21 +230,22 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[pointIndex]);
if (currentPoint == 0) {
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (currentPoint == (pathCount - 1)) {
diffX = points[pathCount - 1].x - points[pathCount - 2].x;
diffZ = points[pathCount - 1].z - points[pathCount - 2].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
diffX = points[currentPoint + 1].x - points[currentPoint - 1].x;
diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
@@ -456,7 +457,7 @@ void EnJg_Walk(EnJg* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (EnJg_ReachedPoint(this, this->path, this->currentPoint)) {
if (EnJg_HasReachedPoint(this, this->path, this->currentPoint)) {
if (this->currentPoint >= (this->path->count - 1)) {
// Force the elder to walk in place
this->animIndex = EN_JG_ANIM_WALK;
@@ -116,7 +116,7 @@ void EnJgameTsn_Init(Actor* thisx, PlayState* play) {
}
void func_80C13A2C(EnJgameTsn* this, PlayState* play) {
Path* path = &play->setupPathList[ENJGAMETSN_GET_FF(&this->actor)];
Path* path = &play->setupPathList[ENJGAMETSN_GET_PATH_INDEX(&this->actor)];
s32 i;
if (path == NULL) {
@@ -8,7 +8,7 @@ struct EnJgameTsn;
typedef void (*EnJgameTsnActionFunc)(struct EnJgameTsn*, PlayState*);
#define ENJGAMETSN_GET_FF(thisx) ((thisx)->params & 0xFF)
#define ENJGAMETSN_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF)
typedef struct {
/* 0x00 */ Vec3s* points;
+1 -5
View File
@@ -887,11 +887,7 @@ void EnKame_Update(Actor* thisx, PlayState* play) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f);
this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.3f;
if (this->drawDmgEffScale > 0.6f) {
this->drawDmgEffScale = 0.6f;
} else {
this->drawDmgEffScale = this->drawDmgEffScale;
}
this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.6f);
} else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.6f, 15.0f * 0.001f)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
@@ -590,11 +590,7 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f);
this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f;
if (this->drawDmgEffScale > 0.75f) {
this->drawDmgEffScale = 0.75f;
} else {
this->drawDmgEffScale = this->drawDmgEffScale;
}
this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f);
} else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
@@ -136,9 +136,9 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4);
if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) {
Path* path = &play->setupPathList[ENKENDOJS_GET_FF00(&this->actor)];
Path* path = &play->setupPathList[ENKENDOJS_GET_PATH_INDEX(&this->actor)];
this->unk_274 = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
}
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
@@ -749,9 +749,9 @@ void func_80B279AC(EnKendoJs* this, PlayState* play) {
}
void func_80B279F0(EnKendoJs* this, PlayState* play, s32 arg2) {
f32 x = this->unk_274[arg2].x;
f32 y = this->unk_274[arg2].y;
f32 z = this->unk_274[arg2].z;
f32 x = this->pathPoints[arg2].x;
f32 y = this->pathPoints[arg2].y;
f32 z = this->pathPoints[arg2].z;
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MARUTA, x, y, z, 0, 0, 0, 0);
this->unk_28C++;
@@ -9,7 +9,7 @@ struct EnKendoJs;
typedef void (*EnKendoJsActionFunc)(struct EnKendoJs*, PlayState*);
#define ENKENDOJS_GET_FF(thisx) ((thisx)->params & 0xFF)
#define ENKENDOJS_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8)
#define ENKENDOJS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8)
#define ENKENDOJS_FF_1 1
@@ -20,7 +20,7 @@ typedef struct EnKendoJs {
/* 0x1D4 */ EnKendoJsActionFunc actionFunc;
/* 0x1D8 */ Vec3s jointTable[OBJECT_JS_LIMB_MAX];
/* 0x226 */ Vec3s morphTable[OBJECT_JS_LIMB_MAX];
/* 0x274 */ Vec3s* unk_274;
/* 0x274 */ Vec3s* pathPoints;
/* 0x278 */ Vec3s unk_278;
/* 0x27E */ Vec3s unk_27E;
/* 0x284 */ s16 unk_284;
@@ -72,7 +72,7 @@ static u16 sIsFrogReturnedFlags[] = {
WEEKEVENTREG_33_02, // FROG_WHITE
};
static s32 sIsInitialized = false;
static s32 sTexturesDesegmented = false;
static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, -800, ICHAIN_STOP),
@@ -89,11 +89,11 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
if (!sIsInitialized) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) {
sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]);
}
sIsInitialized = true;
sTexturesDesegmented = true;
}
this->frogIndex = (this->actor.params & 0xF);
+2 -2
View File
@@ -569,7 +569,7 @@ void func_80B5C910(EnOt* this, PlayState* play) {
this->actor.shape.rot.x = 0;
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
// This is weird
// Set to itself
this->actor.world.rot.x = this->actor.world.rot.x;
this->actor.world.rot.y = this->actor.world.rot.y;
this->actor.world.rot.z = this->actor.world.rot.z;
@@ -595,7 +595,7 @@ void func_80B5C9D0(EnOt* this, PlayState* play) {
this->actor.shape.rot.x = 0;
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
// This is weird
// Set to itself
this->actor.world.rot.x = this->actor.world.rot.x;
this->actor.world.rot.y = this->actor.world.rot.y;
this->actor.world.rot.z = this->actor.world.rot.z;
+4 -4
View File
@@ -87,13 +87,13 @@ static InitChainEntry sInitChain[] = {
};
void func_8095A510(EnOwl* this, PlayState* play) {
this->unk_3FC = ENOWL_GET_F000(&this->actor);
if (this->unk_3FC == 15) {
this->unk_3FC = -1;
this->pathIndex = ENOWL_GET_PATH_INDEX(&this->actor);
if (this->pathIndex == ENOWL_PATH_INDEX_NONE) {
this->pathIndex = PATH_INDEX_NONE;
this->path = NULL;
} else {
this->unk_3F8 = 0;
this->path = &play->setupPathList[this->unk_3FC];
this->path = &play->setupPathList[this->pathIndex];
}
}
+3 -2
View File
@@ -9,10 +9,11 @@ struct EnOwl;
typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*);
typedef void (*EnOwlFunc)(struct EnOwl*);
#define ENOWL_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC)
#define ENOWL_GET_PATH_INDEX(thisx) (((thisx)->params & 0xF000) >> 0xC)
#define ENOWL_GET_TYPE(thisx) (((thisx)->params & 0xF80) >> 7)
#define ENOWL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
#define ENOWL_PATH_INDEX_NONE 0xF
#define ENOWL_SWITCH_FLAG_NONE 0x7F
typedef enum {
@@ -46,7 +47,7 @@ typedef struct EnOwl {
/* 0x3F0 */ f32 unk_3F0;
/* 0x3F4 */ Path* path;
/* 0x3F8 */ s32 unk_3F8;
/* 0x3FC */ s32 unk_3FC;
/* 0x3FC */ s32 pathIndex;
/* 0x400 */ s16 csIdList[3];
/* 0x406 */ s16 csIdIndex;
/* 0x408 */ u8 unk_408;
+2 -2
View File
@@ -73,8 +73,8 @@ void func_808654C4(EnPart* this, PlayState* play) {
this->unk146--;
if (this->unk146 > 0) {
this->actor.shape.rot.x += 0x3A98;
this->actor.shape.rot.y = this->actor.shape.rot.y;
this->actor.shape.rot.z = this->actor.shape.rot.z;
this->actor.shape.rot.y = this->actor.shape.rot.y; // Set to itself
this->actor.shape.rot.z = this->actor.shape.rot.z; // Set to itself
if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 20.0f)) {
this->unk146 = 0;
}
@@ -224,15 +224,23 @@ typedef enum {
/* 16 */ RACEDOG_ANIM_MAX
} RacedogAnimation;
static AnimationInfoS sAnimationInfo[] = {
{ &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 },
{ &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 },
{ &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 },
{ &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 },
{ &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 },
{ &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 },
{ &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 },
static AnimationInfoS sAnimationInfo[RACEDOG_ANIM_MAX] = {
{ &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_IDLE
{ &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_WALK_1
{ &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_RUN
{ &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_BARK
{ &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_SIT_DOWN_ONCE
{ &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, // RACEDOG_ANIM_SIT_DOWN
{ &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_1
{ &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_LYING_DOWN_LOOP
{ &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_2
{ &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_3
{ &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_4
{ &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_WALK_BACKWARDS
{ &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_JUMP
{ &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_LONG_JUMP
{ &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_JUMP_ATTACK
{ &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_SWIM
};
static InitChainEntry sInitChain[] = {
@@ -240,17 +248,17 @@ static InitChainEntry sInitChain[] = {
};
void EnRacedog_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) {
f32 frameCount;
f32 endFrame;
animationInfo += animIndex;
if (animationInfo->frameCount < 0) {
frameCount = Animation_GetLastFrame(animationInfo->animation);
endFrame = Animation_GetLastFrame(animationInfo->animation);
} else {
frameCount = animationInfo->frameCount;
endFrame = animationInfo->frameCount;
}
Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed + (BREG(88) * 0.1f),
animationInfo->startFrame, frameCount, animationInfo->mode, animationInfo->morphFrames);
animationInfo->startFrame, endFrame, animationInfo->mode, animationInfo->morphFrames);
}
void EnRacedog_UpdateCollision(EnRacedog* this, PlayState* play) {
+125 -105
View File
@@ -35,38 +35,29 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc
void EnRaf_UpdateEffects(EnRaf* this, PlayState* play);
void EnRaf_DrawEffects(EnRaf* this, PlayState* play);
typedef enum {
/* 0 */ EN_RAF_ANIM_IDLE,
/* 1 */ EN_RAF_ANIM_CLOSE,
/* 2 */ EN_RAF_ANIM_CHEW,
/* 3 */ EN_RAF_ANIM_SPIT,
/* 4 */ EN_RAF_ANIM_CONVULSE,
/* 5 */ EN_RAF_ANIM_DEATH
} EnRafAnimation;
typedef enum CarnivorousLilyAction {
/* 0 */ CARNIVOROUS_LILY_ACTION_IDLE,
/* 1 */ CARNIVOROUS_LILY_ACTION_GRAB,
/* 2 */ CARNIVOROUS_LILY_ACTION_CHEW,
/* 3 */ CARNIVOROUS_LILY_ACTION_THROW,
/* 4 */ CARNIVOROUS_LILY_ACTION_EXPLODE,
/* 5 */ CARNIVOROUS_LILY_ACTION_CONVULSE,
/* 6 */ CARNIVOROUS_LILY_ACTION_DISSOLVE,
/* 7 */ CARNIVOROUS_LILY_ACTION_DORMANT
} CarnivorousLilyAction;
typedef enum {
/* 0 */ EN_RAF_ACTION_IDLE,
/* 1 */ EN_RAF_ACTION_GRAB,
/* 2 */ EN_RAF_ACTION_CHEW,
/* 3 */ EN_RAF_ACTION_THROW,
/* 4 */ EN_RAF_ACTION_EXPLODE,
/* 5 */ EN_RAF_ACTION_CONVULSE,
/* 6 */ EN_RAF_ACTION_DISSOLVE,
/* 7 */ EN_RAF_ACTION_DORMANT
} EnRafAction;
typedef enum CarnivorousLilyGrabTarget {
/* 0 */ CARNIVOROUS_LILY_GRAB_TARGET_PLAYER,
/* 1 */ CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE,
/* 2 */ CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER
} CarnivorousLilyGrabTarget;
typedef enum {
/* 0 */ EN_RAF_GRAB_TARGET_PLAYER,
/* 1 */ EN_RAF_GRAB_TARGET_EXPLOSIVE,
/* 2 */ EN_RAF_GRAB_TARGET_GORON_PLAYER
} EnRafGrabTarget;
typedef enum {
/* 0 */ EN_RAF_PETAL_SCALE_TYPE_DEAD,
/* 1 */ EN_RAF_PETAL_SCALE_TYPE_GRAB,
/* 2 */ EN_RAF_PETAL_SCALE_TYPE_CHEW,
/* 3 */ EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW
} EnRafPetalScaleType;
typedef enum CarnivorousLilyPetalScaleType {
/* 0 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD,
/* 1 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB,
/* 2 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW,
/* 3 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW
} CarnivorousLilyPetalScaleType;
ActorInit En_Raf_InitVars = {
/**/ ACTOR_EN_RAF,
@@ -222,10 +213,10 @@ void EnRaf_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.colChkInfo.damageTable = &sDamageTable;
this->dyna.actor.colChkInfo.health = BREG(1) + 2;
this->mainType = EN_RAF_GET_TYPE(&this->dyna.actor);
this->reviveTimer = EN_RAF_GET_REVIVE_TIMER(&this->dyna.actor);
this->switchFlag = EN_RAF_GET_SWITCH_FLAG(&this->dyna.actor);
if (this->switchFlag == EN_RAF_SWITCH_FLAG_NONE) {
this->mainType = CARNIVOROUS_LILY_GET_TYPE(&this->dyna.actor);
this->reviveTimer = CARNIVOROUS_LILY_GET_REVIVE_TIMER(&this->dyna.actor);
this->switchFlag = CARNIVOROUS_LILY_GET_SWITCH_FLAG(&this->dyna.actor);
if (this->switchFlag == CARNIVOROUS_LILY_SWITCH_FLAG_NONE) {
this->switchFlag = SWITCH_FLAG_NONE;
}
@@ -235,9 +226,9 @@ void EnRaf_Init(Actor* thisx, PlayState* play) {
this->reviveTimer = 30;
}
if (((this->switchFlag > SWITCH_FLAG_NONE) || (this->mainType == EN_RAF_TYPE_DORMANT) ||
if (((this->switchFlag > SWITCH_FLAG_NONE) || (this->mainType == CARNIVOROUS_LILY_TYPE_DORMANT) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) &&
(Flags_GetSwitch(play, this->switchFlag) || (this->mainType == EN_RAF_TYPE_DORMANT))) {
(Flags_GetSwitch(play, this->switchFlag) || (this->mainType == CARNIVOROUS_LILY_TYPE_DORMANT))) {
s32 i;
for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT;
@@ -261,25 +252,46 @@ void EnRaf_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
typedef enum CarnivorousLilyAnimation {
/* 0 */ CARNIVOROUS_LILY_ANIM_IDLE,
/* 1 */ CARNIVOROUS_LILY_ANIM_CLOSE,
/* 2 */ CARNIVOROUS_LILY_ANIM_CHEW,
/* 3 */ CARNIVOROUS_LILY_ANIM_SPIT,
/* 4 */ CARNIVOROUS_LILY_ANIM_CONVULSE,
/* 5 */ CARNIVOROUS_LILY_ANIM_DEATH,
/* 6 */ CARNIVOROUS_LILY_ANIM_MAX
} CarnivorousLilyAnimation;
static AnimationHeader* sAnimations[CARNIVOROUS_LILY_ANIM_MAX] = {
&gCarnivorousLilyPadSpitAnim, // CARNIVOROUS_LILY_ANIM_IDLE
&gCarnivorousLilyPadCloseAnim, // CARNIVOROUS_LILY_ANIM_CLOSE
&gCarnivorousLilyPadChewAnim, // CARNIVOROUS_LILY_ANIM_CHEW
&gCarnivorousLilyPadSpitAnim, // CARNIVOROUS_LILY_ANIM_SPIT
&gCarnivorousLilyPadConvulseAnim, // CARNIVOROUS_LILY_ANIM_CONVULSE
&gCarnivorousLilyPadDeathAnim, // CARNIVOROUS_LILY_ANIM_DEATH
};
static u8 sAnimationModes[CARNIVOROUS_LILY_ANIM_MAX] = {
ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_IDLE
ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_CLOSE
ANIMMODE_LOOP, // CARNIVOROUS_LILY_ANIM_CHEW
ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_SPIT
ANIMMODE_LOOP, // CARNIVOROUS_LILY_ANIM_CONVULSE
ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_DEATH
};
void EnRaf_ChangeAnim(EnRaf* this, s32 animIndex) {
static AnimationHeader* sAnimations[] = {
&gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadCloseAnim, &gCarnivorousLilyPadChewAnim,
&gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadConvulseAnim, &gCarnivorousLilyPadDeathAnim,
};
static u8 sAnimationModes[] = {
ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE,
};
f32 startFrame = 0.0f;
f32 playSpeed = 1.0f;
this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]);
if (animIndex == EN_RAF_ANIM_IDLE) {
startFrame = this->endFrame;
} else if (animIndex == EN_RAF_ANIM_CLOSE) {
this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
if (animIndex == CARNIVOROUS_LILY_ANIM_IDLE) {
startFrame = this->animEndFrame;
} else if (animIndex == CARNIVOROUS_LILY_ANIM_CLOSE) {
playSpeed = 2.0f;
}
Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, startFrame, this->endFrame,
Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, startFrame, this->animEndFrame,
sAnimationModes[animIndex], -4.0f);
}
@@ -287,14 +299,14 @@ void EnRaf_SetupIdle(EnRaf* this) {
Vec3f targetLimbScale = { 1.0f, 1.0f, 1.0f };
s32 i;
EnRaf_ChangeAnim(this, EN_RAF_ANIM_IDLE);
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_IDLE);
for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) {
Math_Vec3f_Copy(&this->targetLimbScale[i], &targetLimbScale);
}
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = EN_RAF_ACTION_IDLE;
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = CARNIVOROUS_LILY_ACTION_IDLE;
this->actionFunc = EnRaf_Idle;
}
@@ -314,10 +326,10 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) {
DynaPolyActor_IsPlayerOnTop(&this->dyna) && !(player->stateFlags1 & PLAYER_STATE1_8000000) &&
play->grabPlayer(play, player))) {
player->actor.parent = &this->dyna.actor;
this->grabTarget = EN_RAF_GRAB_TARGET_PLAYER;
this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_PLAYER;
if (player->transformation == PLAYER_FORM_GORON) {
this->grabTarget = EN_RAF_GRAB_TARGET_GORON_PLAYER;
this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER;
} else {
player->av2.actionVar2 = 50;
}
@@ -345,7 +357,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) {
if ((fabsf(xDiff) < 80.0f) && (fabsf(yDiff) < 30.0f) && (fabsf(zDiff) < 80.0f) &&
(explosive->update != NULL) && (explosive->velocity.y != 0.0f)) {
Actor_Kill(explosive);
this->grabTarget = EN_RAF_GRAB_TARGET_EXPLOSIVE;
this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE;
this->collider.dim.radius = 30;
this->collider.dim.height = 90;
this->collider.dim.yShift = -10;
@@ -359,10 +371,10 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) {
}
void EnRaf_SetupGrab(EnRaf* this) {
EnRaf_ChangeAnim(this, EN_RAF_ANIM_CLOSE);
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_GRAB;
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CLOSE);
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB;
Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_DRINK);
this->action = EN_RAF_ACTION_GRAB;
this->action = CARNIVOROUS_LILY_ACTION_GRAB;
this->actionFunc = EnRaf_Grab;
}
@@ -373,14 +385,14 @@ void EnRaf_Grab(EnRaf* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 curFrame = this->skelAnime.curFrame;
if ((this->grabTarget != EN_RAF_GRAB_TARGET_EXPLOSIVE) && (player->stateFlags2 & PLAYER_STATE2_80) &&
if ((this->grabTarget != CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) && (player->stateFlags2 & PLAYER_STATE2_80) &&
(&this->dyna.actor == player->actor.parent)) {
Math_ApproachF(&player->actor.world.pos.x, this->dyna.actor.world.pos.x, 0.3f, 10.0f);
Math_ApproachF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.3f, 10.0f);
Math_ApproachF(&player->actor.world.pos.z, this->dyna.actor.world.pos.z, 0.3f, 10.0f);
}
if (this->endFrame <= curFrame) {
if (curFrame >= this->animEndFrame) {
EnRaf_SetupChew(this);
}
}
@@ -388,7 +400,7 @@ void EnRaf_Grab(EnRaf* this, PlayState* play) {
void EnRaf_SetupChew(EnRaf* this) {
s32 i;
EnRaf_ChangeAnim(this, EN_RAF_ANIM_CHEW);
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CHEW);
this->chewCount = 0;
for (i = 0; i < ARRAY_COUNT(this->chewLimbRot); i++) {
this->chewLimbRot[i].x = Rand_S16Offset(8, 8) << 8;
@@ -396,8 +408,8 @@ void EnRaf_SetupChew(EnRaf* this) {
this->chewLimbRot[i].z = Rand_S16Offset(8, 8) << 8;
}
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_CHEW;
this->action = EN_RAF_ACTION_CHEW;
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW;
this->action = CARNIVOROUS_LILY_ACTION_CHEW;
this->actionFunc = EnRaf_Chew;
}
@@ -415,21 +427,21 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) {
targetChewScale = (BREG(51) / 100.0f) + 0.2f;
Math_ApproachF(&this->chewScale, targetChewScale, 0.2f, 0.03f);
if ((player->stateFlags2 & PLAYER_STATE2_80) && (this->grabTarget != EN_RAF_GRAB_TARGET_EXPLOSIVE) &&
if ((player->stateFlags2 & PLAYER_STATE2_80) && (this->grabTarget != CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) &&
(&this->dyna.actor == player->actor.parent)) {
Math_ApproachF(&player->actor.world.pos.x, this->dyna.actor.world.pos.x, 0.3f, 10.0f);
Math_ApproachF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.3f, 10.0f);
Math_ApproachF(&player->actor.world.pos.z, this->dyna.actor.world.pos.z, 0.3f, 10.0f);
}
if (this->endFrame <= curFrame) {
if (curFrame >= this->animEndFrame) {
if (BREG(52) == 0) {
this->chewCount++;
}
Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_EAT);
switch (this->grabTarget) {
case EN_RAF_GRAB_TARGET_PLAYER:
case CARNIVOROUS_LILY_GRAB_TARGET_PLAYER:
play->damagePlayer(play, -2);
//! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be
@@ -444,7 +456,7 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) {
}
break;
case EN_RAF_GRAB_TARGET_EXPLOSIVE:
case CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE:
Actor_ApplyDamage(&this->dyna.actor);
if (this->chewCount > (BREG(54) + 4)) {
EnRaf_Explode(this, play);
@@ -452,13 +464,16 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) {
}
break;
case EN_RAF_GRAB_TARGET_GORON_PLAYER:
case CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER:
if (this->chewCount > (BREG(54) + 4)) {
player->actor.parent = NULL;
player->av2.actionVar2 = 1000;
EnRaf_Explode(this, play);
}
break;
default:
break;
}
}
}
@@ -466,10 +481,10 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) {
void EnRaf_SetupThrow(EnRaf* this, PlayState* play) {
Player* player = GET_PLAYER(play);
EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT);
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_SPIT);
player->actor.freezeTimer = 10;
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = EN_RAF_ACTION_THROW;
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = CARNIVOROUS_LILY_ACTION_THROW;
this->actionFunc = EnRaf_Throw;
}
@@ -490,9 +505,9 @@ void EnRaf_Throw(EnRaf* this, PlayState* play) {
player->actor.freezeTimer = 10;
}
if (this->endFrame <= curFrame) {
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = EN_RAF_ACTION_IDLE;
if (curFrame >= this->animEndFrame) {
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = CARNIVOROUS_LILY_ACTION_IDLE;
this->timer = 20;
this->actionFunc = EnRaf_Idle;
}
@@ -508,7 +523,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) {
s32 i;
s32 pad;
this->action = EN_RAF_ACTION_EXPLODE;
this->action = CARNIVOROUS_LILY_ACTION_EXPLODE;
Math_Vec3f_Copy(&explosionPos, &this->dyna.actor.world.pos);
explosionPos.y += 10.0f;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, 0, 0,
@@ -519,7 +534,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) {
Flags_SetSwitch(play, this->switchFlag);
}
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD;
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD;
for (i = 0; i < BREG(57) + 30; i++) {
accel.x = (Rand_ZeroOne() - 0.5f) * 0.5f;
accel.y = -0.3f;
@@ -536,7 +551,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) {
}
this->timer = 5;
if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) {
if (this->grabTarget == CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) {
Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_ENEMY);
this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY);
}
@@ -554,7 +569,7 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) {
Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_PROP);
this->dyna.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY);
EnRaf_SetupDormant(this);
} else if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) {
} else if (this->grabTarget == CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) {
this->collider.dim.radius = 80;
this->collider.dim.height = 50;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
@@ -562,9 +577,9 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) {
}
void EnRaf_SetupConvulse(EnRaf* this) {
EnRaf_ChangeAnim(this, EN_RAF_ANIM_CONVULSE);
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CONVULSE);
this->chewCount = 0;
this->action = EN_RAF_ACTION_CONVULSE;
this->action = CARNIVOROUS_LILY_ACTION_CONVULSE;
this->actionFunc = EnRaf_Convulse;
}
@@ -576,7 +591,7 @@ void EnRaf_SetupConvulse(EnRaf* this) {
void EnRaf_Convulse(EnRaf* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
if (this->endFrame <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->chewCount++;
if (this->chewCount > (BREG(2) + 2)) {
if (this->switchFlag > SWITCH_FLAG_NONE) {
@@ -589,8 +604,8 @@ void EnRaf_Convulse(EnRaf* this, PlayState* play) {
}
void EnRaf_SetupDissolve(EnRaf* this) {
EnRaf_ChangeAnim(this, EN_RAF_ANIM_DEATH);
this->action = EN_RAF_ACTION_DISSOLVE;
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_DEATH);
this->action = CARNIVOROUS_LILY_ACTION_DISSOLVE;
this->dissolveTimer = 0;
this->actionFunc = EnRaf_Dissolve;
}
@@ -604,7 +619,7 @@ void EnRaf_Dissolve(EnRaf* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
s32 i;
if (this->endFrame <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->dissolveTimer++;
if (this->dissolveTimer < (BREG(3) + 105)) {
for (i = 0; i < (BREG(4) + 5); i++) {
@@ -651,10 +666,10 @@ void EnRaf_Dissolve(EnRaf* this, PlayState* play) {
}
void EnRaf_SetupDormant(EnRaf* this) {
if (this->action == EN_RAF_ACTION_EXPLODE) {
if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) {
this->timer = 90;
} else {
this->action = EN_RAF_ACTION_DORMANT;
this->action = CARNIVOROUS_LILY_ACTION_DORMANT;
}
this->actionFunc = EnRaf_Dormant;
@@ -669,23 +684,23 @@ void EnRaf_Dormant(EnRaf* this, PlayState* play) {
s32 i;
if (this->timer == 0) {
this->action = EN_RAF_ACTION_DORMANT;
this->action = CARNIVOROUS_LILY_ACTION_DORMANT;
}
if (this->reviveTimer >= 0) {
DECR(this->reviveTimer);
if (this->reviveTimer == 0) {
EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT);
EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_SPIT);
for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT;
i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) {
Math_Vec3f_Copy(&this->targetLimbScale[i], &targetLimbScale);
}
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = EN_RAF_ACTION_IDLE;
this->reviveTimer = EN_RAF_GET_REVIVE_TIMER(&this->dyna.actor);
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW;
this->action = CARNIVOROUS_LILY_ACTION_IDLE;
this->reviveTimer = CARNIVOROUS_LILY_GET_REVIVE_TIMER(&this->dyna.actor);
this->reviveTimer += 30;
this->actionFunc = EnRaf_Idle;
}
@@ -705,8 +720,8 @@ void EnRaf_Update(Actor* thisx, PlayState* play) {
DECR(this->timer);
this->actionFunc(this, play);
if ((this->action == EN_RAF_ACTION_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) {
this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD;
if ((this->action == CARNIVOROUS_LILY_ACTION_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) {
this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD;
EnRaf_SetupConvulse(this);
return;
}
@@ -723,7 +738,8 @@ void EnRaf_Update(Actor* thisx, PlayState* play) {
this->bobPhase += 3000.0f;
this->bobOffset = 2.0f * Math_SinS(this->bobPhase);
if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) {
if (this->mainType != CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS) {
ySurface = BREG(60) + (this->dyna.actor.world.pos.y - 60.0f);
if (WaterBox_GetSurface1(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z,
&ySurface, &waterBox)) {
@@ -731,7 +747,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) {
Math_ApproachF(&this->dyna.actor.world.pos.y, this->heightDiffFromPlayer + ySurface, 0.5f, 40.0f);
if (this->rippleTimer == 0) {
this->rippleTimer = 30;
if (this->petalScaleType == EN_RAF_PETAL_SCALE_TYPE_CHEW) {
if (this->petalScaleType == CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW) {
this->rippleTimer = 10;
}
@@ -746,12 +762,13 @@ void EnRaf_Update(Actor* thisx, PlayState* play) {
}
Math_ApproachZeroF(&this->heightDiffFromPlayer, 0.3f, 2.0f);
if (this->action == EN_RAF_ACTION_EXPLODE) {
if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) {
EnRaf_UpdateEffects(this, play);
}
for (i = 0; i < ARRAY_COUNT(this->limbScale); i++) {
if (this->action < EN_RAF_ACTION_EXPLODE) {
if (this->action < CARNIVOROUS_LILY_ACTION_EXPLODE) {
Math_ApproachF(&this->limbScale[i].x, this->targetLimbScale[i].x, 0.4f, 0.5f);
Math_ApproachF(&this->limbScale[i].y, this->targetLimbScale[i].y, 0.4f, 0.5f);
Math_ApproachF(&this->limbScale[i].z, this->targetLimbScale[i].z, 0.4f, 0.5f);
@@ -763,7 +780,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) {
}
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
if (this->action < EN_RAF_ACTION_EXPLODE) {
if (this->action < CARNIVOROUS_LILY_ACTION_EXPLODE) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
}
@@ -798,7 +815,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
s32 i;
switch (this->petalScaleType) {
case EN_RAF_PETAL_SCALE_TYPE_GRAB:
case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB:
if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) {
@@ -820,7 +837,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
}
break;
case EN_RAF_PETAL_SCALE_TYPE_CHEW:
case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW:
if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) {
@@ -844,7 +861,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
}
break;
case EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW:
case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW:
if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) ||
(limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) {
@@ -865,6 +882,9 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) {
}
}
break;
default:
break;
}
Matrix_Scale(this->limbScale[limbIndex].x, this->limbScale[limbIndex].y, this->limbScale[limbIndex].z,
@@ -879,14 +899,14 @@ void EnRaf_Draw(Actor* thisx, PlayState* play) {
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, NULL, NULL, EnRaf_TransformLimbDraw, &this->dyna.actor);
if (this->action == EN_RAF_ACTION_EXPLODE) {
if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) {
EnRaf_DrawEffects(this, play);
}
}
void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer) {
s16 i;
EnRafEffect* effect = this->effects;
CarnivorousLilyEffect* effect = this->effects;
for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) {
if (!effect->isEnabled) {
@@ -906,7 +926,7 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc
void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) {
s32 i;
EnRafEffect* effect = this->effects;
CarnivorousLilyEffect* effect = this->effects;
for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) {
if (effect->isEnabled) {
@@ -920,7 +940,7 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) {
effect->velocity.y += effect->accel.y;
effect->velocity.z += effect->accel.z;
if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) {
if (this->mainType != CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS) {
if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) {
EffectSsGSplash_Spawn(play, &effect->pos, NULL, NULL, 0, effect->scale * 200000.0f);
SoundSource_PlaySfxAtFixedWorldPos(play, &effect->pos, 50, NA_SE_EV_BOMB_DROP_WATER);
@@ -944,7 +964,7 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) {
void EnRaf_DrawEffects(EnRaf* this, PlayState* play) {
s16 i;
EnRafEffect* effect = this->effects;
CarnivorousLilyEffect* effect = this->effects;
GraphicsContext* gfxCtx = play->state.gfxCtx;
OPEN_DISPS(gfxCtx);
+13 -13
View File
@@ -4,17 +4,17 @@
#include "global.h"
#include "objects/object_raf/object_raf.h"
#define EN_RAF_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF)
#define EN_RAF_GET_REVIVE_TIMER(thisx) (((thisx)->params >> 7) & 0x1F)
#define EN_RAF_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
#define CARNIVOROUS_LILY_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF)
#define CARNIVOROUS_LILY_GET_REVIVE_TIMER(thisx) (((thisx)->params >> 7) & 0x1F)
#define CARNIVOROUS_LILY_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
#define EN_RAF_SWITCH_FLAG_NONE 0x7F
#define CARNIVOROUS_LILY_SWITCH_FLAG_NONE 0x7F
typedef enum {
/* 0 */ EN_RAF_TYPE_NORMAL,
/* 1 */ EN_RAF_TYPE_DORMANT, // Spawns without trap, so it can't eat bombs/player
/* 2 */ EN_RAF_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and effects won't produce splashes
} EnRafType;
typedef enum CarnivorousLilyType {
/* 0 */ CARNIVOROUS_LILY_TYPE_NORMAL,
/* 1 */ CARNIVOROUS_LILY_TYPE_DORMANT, // Spawns without trap, so it can't eat bombs/player
/* 2 */ CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and effects won't produce splashes
} CarnivorousLilyType;
struct EnRaf;
@@ -28,9 +28,9 @@ typedef struct {
/* 0x28 */ Vec3s rot;
/* 0x30 */ f32 scale;
/* 0x34 */ s16 timer;
} EnRafEffect; // size = 0x38
} CarnivorousLilyEffect; // size = 0x38
#define EN_RAF_EFFECT_COUNT 31
#define CARNIVOROUS_LILY_EFFECT_COUNT 31
typedef struct EnRaf {
/* 0x000 */ DynaPolyActor dyna;
@@ -43,7 +43,7 @@ typedef struct EnRaf {
/* 0x354 */ Vec3s chewLimbRot[CARNIVOROUS_LILY_PAD_LIMB_MAX];
/* 0x39C */ s16 grabTarget;
/* 0x39E */ u8 isCurrentlyInRidingMovingState;
/* 0x3A0 */ f32 endFrame;
/* 0x3A0 */ f32 animEndFrame;
/* 0x3A4 */ f32 chewScale;
/* 0x3A8 */ f32 bobOffset;
/* 0x3AC */ f32 heightDiffFromPlayer;
@@ -63,7 +63,7 @@ typedef struct EnRaf {
/* 0x3CC */ s16 petalClearPixelSecondPassIndex;
/* 0x3CE */ s16 teethClearPixelSecondPassIndex;
/* 0x3D0 */ ColliderCylinder collider;
/* 0x41C */ EnRafEffect effects[EN_RAF_EFFECT_COUNT];
/* 0x41C */ CarnivorousLilyEffect effects[CARNIVOROUS_LILY_EFFECT_COUNT];
} EnRaf; // size = 0xAE4
#endif // Z_EN_RAF_H
@@ -63,20 +63,38 @@ ActorInit En_Rail_Skb_InitVars = {
/**/ EnRailSkb_Draw,
};
static AnimationInfo sAnimationInfo[] = {
{ &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f },
{ &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f },
{ &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
{ &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
{ &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f },
{ &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
{ &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
{ &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
typedef enum EnRailSkbAnimation {
/* -1 */ ENRAILSKB_ANIM_NONE = -1,
/* 0 */ ENRAILSKB_ANIM_0,
/* 1 */ ENRAILSKB_ANIM_1,
/* 2 */ ENRAILSKB_ANIM_2,
/* 3 */ ENRAILSKB_ANIM_3,
/* 4 */ ENRAILSKB_ANIM_4,
/* 5 */ ENRAILSKB_ANIM_5,
/* 6 */ ENRAILSKB_ANIM_6,
/* 7 */ ENRAILSKB_ANIM_7,
/* 8 */ ENRAILSKB_ANIM_8,
/* 9 */ ENRAILSKB_ANIM_9,
/* 10 */ ENRAILSKB_ANIM_10,
/* 11 */ ENRAILSKB_ANIM_11,
/* 12 */ ENRAILSKB_ANIM_12,
/* 13 */ ENRAILSKB_ANIM_MAX
} EnRailSkbAnimation;
static AnimationInfo sAnimationInfo[ENRAILSKB_ANIM_MAX] = {
{ &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_0
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // ENRAILSKB_ANIM_1
{ &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, // ENRAILSKB_ANIM_2
{ &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENRAILSKB_ANIM_3
{ &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENRAILSKB_ANIM_4
{ &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_5
{ &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_6
{ &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_7
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_8
{ &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, // ENRAILSKB_ANIM_9
{ &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_10
{ &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_11
{ &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENRAILSKB_ANIM_12
};
static ColliderJntSphElementInit sJntSphElementsInit[2] = {
@@ -156,11 +174,11 @@ static DamageTable sDamageTable = {
void func_80B708C0(EnRailSkb* this, PlayState* play) {
static s32 D_80B7348C = 0;
Path* path = &play->setupPathList[ENRAILSKB_GET_FF00(&this->actor)];
Path* path = &play->setupPathList[ENRAILSKB_GET_PATH_INDEX(&this->actor)];
Vec3f sp70;
s32 phi_a3;
this->unk_230 = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
this->unk_2E0 = D_80B7348C;
this->unk_2E8 = path->count;
@@ -175,9 +193,9 @@ void func_80B708C0(EnRailSkb* this, PlayState* play) {
D_80B7348C = 0;
}
this->actor.world.pos.x = this->unk_230[this->unk_2E0].x;
this->actor.world.pos.y = this->unk_230[this->unk_2E0].y;
this->actor.world.pos.z = this->unk_230[this->unk_2E0].z;
this->actor.world.pos.x = this->pathPoints[this->unk_2E0].x;
this->actor.world.pos.y = this->pathPoints[this->unk_2E0].y;
this->actor.world.pos.z = this->pathPoints[this->unk_2E0].z;
if (this->unk_2E0 < (this->unk_2E8 - 1)) {
phi_a3 = this->unk_2E0 + 1;
@@ -185,9 +203,9 @@ void func_80B708C0(EnRailSkb* this, PlayState* play) {
phi_a3 = 0;
}
sp70.x = this->unk_230[phi_a3].x;
sp70.y = this->unk_230[phi_a3].y;
sp70.z = this->unk_230[phi_a3].z;
sp70.x = this->pathPoints[phi_a3].x;
sp70.y = this->pathPoints[phi_a3].y;
sp70.z = this->pathPoints[phi_a3].z;
this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp70);
}
@@ -213,10 +231,10 @@ s32 func_80B70B04(EnRailSkb* this, Vec3f pos) {
s32 i = 0;
s32 j;
sp60.x = this->unk_230[0].z - pos.z;
sp60.z = this->unk_230[0].x - pos.x;
sp58.x = this->unk_230[1].z - pos.z;
sp58.z = this->unk_230[1].x - pos.x;
sp60.x = this->pathPoints[0].z - pos.z;
sp60.z = this->pathPoints[0].x - pos.x;
sp58.x = this->pathPoints[1].z - pos.z;
sp58.z = this->pathPoints[1].x - pos.x;
j = 1;
temp_s3 = func_80B70AB4(sp60, sp58);
@@ -229,10 +247,10 @@ s32 func_80B70B04(EnRailSkb* this, Vec3f pos) {
j = 0;
}
sp60.x = this->unk_230[i].z - pos.z;
sp60.z = this->unk_230[i].x - pos.x;
sp58.x = this->unk_230[j].z - pos.z;
sp58.z = this->unk_230[j].x - pos.x;
sp60.x = this->pathPoints[i].z - pos.z;
sp60.z = this->pathPoints[i].x - pos.x;
sp58.x = this->pathPoints[j].z - pos.z;
sp58.z = this->pathPoints[j].x - pos.x;
if (func_80B70AB4(sp60, sp58) != temp_s3) {
ret = false;
@@ -313,7 +331,7 @@ void EnRailSkb_Destroy(Actor* thisx, PlayState* play) {
void func_80B70FA0(EnRailSkb* this) {
this->unk_3F2 = 0;
if (this->actionFunc != func_80B716A8) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0);
}
this->actionFunc = func_80B70FF8;
}
@@ -357,7 +375,7 @@ void func_80B7114C(EnRailSkb* this, PlayState* play) {
this->drawDmgEffAlpha = 0.0f;
if (this->actor.colChkInfo.health != 0) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
this->unk_402 |= 1;
func_80B712FC(this);
@@ -381,7 +399,7 @@ void func_80B7123C(EnRailSkb* this, PlayState* play) {
this->drawDmgEffAlpha = 0.0f;
if (this->actor.colChkInfo.health != 0) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
this->unk_402 |= 1;
func_80B712FC(this);
@@ -407,7 +425,7 @@ void func_80B71314(EnRailSkb* this, PlayState* play) {
void func_80B71354(EnRailSkb* this) {
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2);
this->actionFunc = func_80B713A4;
}
@@ -416,7 +434,7 @@ void func_80B713A4(EnRailSkb* this, PlayState* play) {
if ((this->actor.xzDistToPlayer > 65.0f) || (Player_GetMask(play) == PLAYER_MASK_CAPTAIN)) {
func_80B70FA0(this);
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2);
}
}
@@ -457,7 +475,7 @@ void func_80B7151C(EnRailSkb* this) {
this->actor.draw = EnRailSkb_Draw;
this->actor.shape.shadowAlpha = 0;
this->actor.shape.rot.y = this->actor.world.rot.y;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_1);
this->actionFunc = func_80B715AC;
}
@@ -480,7 +498,7 @@ void func_80B715AC(EnRailSkb* this, PlayState* play) {
void func_80B71650(EnRailSkb* this) {
this->unk_3FE = 0;
if (this->actionFunc != func_80B70FF8) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0);
}
this->actionFunc = func_80B716A8;
}
@@ -497,7 +515,7 @@ void func_80B716A8(EnRailSkb* this, PlayState* play) {
Message_StartTextbox(play, 0x13F5, &this->actor);
this->unk_400 = 0x13F5;
}
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_12);
func_80B717C8(this);
} else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) {
Actor_OfferTalk(&this->actor, play, 100.0f);
@@ -559,7 +577,7 @@ void func_80B718C4(EnRailSkb* this, PlayState* play) {
}
void func_80B71910(EnRailSkb* this) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0);
this->actionFunc = func_80B71954;
}
@@ -577,7 +595,7 @@ void func_80B71954(EnRailSkb* this, PlayState* play) {
void func_80B71A08(EnRailSkb* this) {
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2);
this->actionFunc = func_80B71A58;
}
@@ -586,7 +604,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2);
if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) {
this->unk_22C->dyna.actor.colChkInfo.health--;
} else {
@@ -609,7 +627,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) {
void func_80B71B6C(EnRailSkb* this) {
this->unk_3F2 = 10;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0);
this->actionFunc = func_80B71BB8;
}
@@ -642,7 +660,7 @@ void func_80B71BB8(EnRailSkb* this, PlayState* play) {
if ((sp34 < 50.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_9);
this->actor.velocity.y = 10.0f;
for (i = 0; i < 4; i++) {
@@ -675,7 +693,7 @@ void func_80B71DF0(EnRailSkb* this) {
this->drawDmgEffTimer = 0;
}
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_11);
this->actionFunc = func_80B71EA8;
}
@@ -806,9 +824,9 @@ void func_80B72190(EnRailSkb* this, PlayState* play) {
if ((this->actionFunc != func_80B71EA8) && (this->actionFunc != func_80B71954) &&
(this->actionFunc != func_80B71A58) && (this->actionFunc != func_80B71BB8)) {
sp38.x = this->unk_230[this->unk_2E0].x;
sp38.y = this->unk_230[this->unk_2E0].y;
sp38.z = this->unk_230[this->unk_2E0].z;
sp38.x = this->pathPoints[this->unk_2E0].x;
sp38.y = this->pathPoints[this->unk_2E0].y;
sp38.z = this->pathPoints[this->unk_2E0].z;
sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp38);
if (Math_Vec3f_DistXZ(&this->actor.world.pos, &sp38) > 100.0f) {
@@ -1001,7 +1019,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) {
this->drawDmgEffScale = 0.0f;
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3);
this->unk_402 |= 1;
func_80B712FC(this);
break;
@@ -1027,7 +1045,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) {
this->drawDmgEffScale = 0.5f;
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3);
func_80B71228(this);
break;
@@ -1046,7 +1064,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) {
case 13:
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3);
func_80B712FC(this);
break;
@@ -9,7 +9,7 @@ struct EnRailSkb;
typedef void (*EnRailSkbActionFunc)(struct EnRailSkb*, PlayState*);
typedef void (*EnRailSkbUnkFunc)(struct EnRailSkb*);
#define ENRAILSKB_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF)
#define ENRAILSKB_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF)
#define ENRAILSKB_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0xFF)
typedef enum EnRailSkbBodyPart {
@@ -37,7 +37,7 @@ typedef struct EnRailSkb {
/* 0x1E4 */ SkelAnime skelAnime;
/* 0x228 */ EnRailSkbActionFunc actionFunc;
/* 0x22C */ ObjHakaisi* unk_22C;
/* 0x230 */ Vec3s* unk_230;
/* 0x230 */ Vec3s* pathPoints;
/* 0x234 */ Vec3f bodyPartsPos[ENRAILSKB_BODYPART_MAX];
/* 0x2DC */ s32 bodyPartsCount;
/* 0x2E0 */ s32 unk_2E0;
@@ -198,7 +198,7 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Pl
Vec3f targetPos;
Path* path = &play->setupPathList[ENRAILGIBUD_GET_PATH_INDEX(&this->actor)];
this->points = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
this->currentPoint = currentGibdoIndex;
this->pathCount = path->count;
@@ -218,18 +218,18 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Pl
currentGibdoIndex = 0;
}
this->actor.world.pos.x = this->points[this->currentPoint].x;
this->actor.world.pos.y = this->points[this->currentPoint].y;
this->actor.world.pos.z = this->points[this->currentPoint].z;
this->actor.world.pos.x = this->pathPoints[this->currentPoint].x;
this->actor.world.pos.y = this->pathPoints[this->currentPoint].y;
this->actor.world.pos.z = this->pathPoints[this->currentPoint].z;
if (this->currentPoint < (this->pathCount - 1)) {
nextPoint = this->currentPoint + 1;
} else {
nextPoint = 0;
}
targetPos.x = this->points[nextPoint].x;
targetPos.y = this->points[nextPoint].y;
targetPos.z = this->points[nextPoint].z;
targetPos.x = this->pathPoints[nextPoint].x;
targetPos.y = this->pathPoints[nextPoint].y;
targetPos.z = this->pathPoints[nextPoint].z;
this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPos);
this->actor.home = this->actor.world;
@@ -296,9 +296,9 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) {
s32 pad;
s16 yRotation;
targetPos.x = this->points[this->currentPoint].x;
targetPos.y = this->points[this->currentPoint].y;
targetPos.z = this->points[this->currentPoint].z;
targetPos.x = this->pathPoints[this->currentPoint].x;
targetPos.y = this->pathPoints[this->currentPoint].y;
targetPos.z = this->pathPoints[this->currentPoint].z;
if ((this->actor.xzDistToPlayer <= 100.0f) && func_800B715C(play) && (Player_GetMask(play) != PLAYER_MASK_GIBDO)) {
this->actor.home = this->actor.world;
@@ -311,8 +311,7 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) {
// If we're not supposed to walk forward, then stop here;
// don't rotate the Gibdo or move it around.
if (this->actor.parent == NULL) {
if (this->shouldWalkForward) {
} else {
if (!this->shouldWalkForward) {
return;
}
} else {
@@ -482,6 +481,9 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) {
Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 400.0f, 0.0f);
}
break;
default:
break;
}
}
@@ -844,6 +846,9 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) {
EnRailgibud_SetupStunned(this);
}
break;
default:
break;
}
}
}
@@ -990,6 +995,7 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) {
case TEXT_STATE_CLOSING:
case TEXT_STATE_3:
case TEXT_STATE_CHOICE:
default:
break;
}
}
@@ -1240,6 +1246,9 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) {
}
}
break;
default:
break;
}
Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel);
@@ -39,7 +39,7 @@ typedef struct EnRailgibud {
/* 0x1D8 */ Vec3f bodyPartsPos[ENRAILGIBUD_BODYPART_MAX];
/* 0x28C */ s32 bodyPartIndex;
/* 0x290 */ UNK_TYPE1 unk290[0x4];
/* 0x294 */ Vec3s* points;
/* 0x294 */ Vec3s* pathPoints;
/* 0x298 */ s32 currentPoint;
/* 0x29C */ s32 pathCount;
/* 0x2A0 */ f32 drawDmgEffAlpha;
+5 -5
View File
@@ -141,11 +141,11 @@ void EnRr_Init(Actor* thisx, PlayState* play) {
this->actor.scale.y = 0.022499999f;
this->actor.scale.x = 0.028499998f;
this->actor.scale.z = 0.028499998f;
this->collider1.dim.radius = this->collider1.dim.radius * 1.5f;
this->collider1.dim.height = this->collider1.dim.height * 1.5f;
this->collider2.dim.radius = this->collider2.dim.radius * 1.5f;
this->collider2.dim.height = this->collider2.dim.height * 1.5f;
this->collider2.dim.yShift = this->collider2.dim.yShift * 1.5f;
this->collider1.dim.radius *= 1.5f;
this->collider1.dim.height *= 1.5f;
this->collider2.dim.radius *= 1.5f;
this->collider2.dim.height *= 1.5f;
this->collider2.dim.yShift *= 1.5f;
}
Collider_UpdateCylinder(&this->actor, &this->collider2);
@@ -31,8 +31,8 @@ void EnRuppecrow_ShatterIce(EnRuppecrow*, PlayState*);
void EnRuppecrow_UpdatePosition(EnRuppecrow*, PlayState*);
s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState*);
void EnRuppecrow_HandleSongCutscene(EnRuppecrow*, PlayState*);
s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow*, Path*, s32);
s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow*, Path*, s32);
s32 EnRuppecrow_HasReachedPointClockwise(EnRuppecrow*, Path*, s32);
s32 EnRuppecrow_HasReachedPointCounterClockwise(EnRuppecrow*, Path*, s32);
f32 EnRuppecrow_GetPointDirection(Path*, s32, PosRot*, Vec3s*);
s32 EnRuppecrow_CanSpawnBlueRupees(PlayState*);
void EnRuppecrow_SpawnRupee(EnRuppecrow*, PlayState*);
@@ -136,10 +136,10 @@ s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, PlayState* play) {
return true;
}
s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) {
s32 EnRuppecrow_HasReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 pathCount = path->count;
s32 currentPoint = pointIndex;
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
@@ -148,31 +148,32 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[currentPoint]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (currentPoint == 0) {
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (currentPoint == (pathCount - 1)) {
diffX = points[pathCount - 1].x - points[pathCount - 2].x;
diffZ = points[pathCount - 1].z - points[pathCount - 2].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
diffX = points[currentPoint + 1].x - points[currentPoint - 1].x;
diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return reached;
}
s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) {
s32 EnRuppecrow_HasReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 pathCount = path->count;
s32 currentPoint = pointIndex;
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
@@ -181,21 +182,22 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[currentPoint]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (currentPoint == 0) {
if (index == 0) {
diffX = points[0].x - points[1].x;
diffZ = points[0].z - points[1].z;
} else if (currentPoint == (pathCount - 1)) {
diffX = points[pathCount - 2].x - points[pathCount - 1].x;
diffZ = points[pathCount - 2].z - points[pathCount - 1].z;
} else if (index == (count - 1)) {
diffX = points[count - 2].x - points[count - 1].x;
diffZ = points[count - 2].z - points[count - 1].z;
} else {
diffX = points[currentPoint - 1].x - points[currentPoint + 1].x;
diffZ = points[currentPoint - 1].z - points[currentPoint + 1].z;
diffX = points[index - 1].x - points[index + 1].x;
diffZ = points[index - 1].z - points[index + 1].z;
}
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
@@ -339,7 +341,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.x, -nextPointDirection.x, 0x4, 0x3E8, 0x1);
if (this->isGoingCounterClockwise & 1) {
if (EnRuppecrow_ReachedPointCounterClockwise(this, this->path, this->currentPoint)) {
if (EnRuppecrow_HasReachedPointCounterClockwise(this, this->path, this->currentPoint)) {
if (this->currentPoint <= 0) {
this->currentPoint = this->path->count - 1;
} else {
@@ -351,7 +353,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) {
EnRuppecrow_SpawnRupee(this, play);
}
}
} else if (EnRuppecrow_ReachedPointClockwise(this, this->path, this->currentPoint)) {
} else if (EnRuppecrow_HasReachedPointClockwise(this, this->path, this->currentPoint)) {
if (this->currentPoint >= this->path->count - 1) {
this->currentPoint = 0;
} else {
+10 -9
View File
@@ -167,10 +167,10 @@ void EnSb_SetupWaitOpen(EnSb* this) {
}
void EnSb_SetupLunge(EnSb* this) {
f32 frameCount = Animation_GetLastFrame(&object_sb_Anim_000124);
f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_000124);
f32 playbackSpeed = this->actor.depthInWater > 0.0f ? 1.0f : 0.0f;
Animation_Change(&this->skelAnime, &object_sb_Anim_000124, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0);
Animation_Change(&this->skelAnime, &object_sb_Anim_000124, playbackSpeed, 0.0f, endFrame, ANIMMODE_ONCE, 0);
this->state = SHELLBLADE_LUNGE;
this->actionFunc = EnSb_Lunge;
Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE);
@@ -184,10 +184,10 @@ void EnSb_SetupBounce(EnSb* this) {
}
void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) {
f32 frameCount = Animation_GetLastFrame(&object_sb_Anim_00004C);
f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_00004C);
if (this->state != SHELLBLADE_WAIT_CLOSED) {
Animation_Change(&this->skelAnime, &object_sb_Anim_00004C, 1.0f, 0, frameCount, ANIMMODE_ONCE, 0.0f);
Animation_Change(&this->skelAnime, &object_sb_Anim_00004C, 1.0f, 0, endFrame, ANIMMODE_ONCE, 0.0f);
}
this->state = SHELLBLADE_WAIT_CLOSED;
if (changeSpeed) {
@@ -215,9 +215,10 @@ void EnSb_Idle(EnSb* this, PlayState* play) {
}
void EnSb_Open(EnSb* this, PlayState* play) {
f32 currentFrame = this->skelAnime.curFrame;
f32 curFrame = this->skelAnime.curFrame;
f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_000194);
if (Animation_GetLastFrame(&object_sb_Anim_000194) <= currentFrame) {
if (curFrame >= endFrame) {
this->vulnerableTimer = 20;
EnSb_SetupWaitOpen(this);
} else {
@@ -280,11 +281,11 @@ void EnSb_Lunge(EnSb* this, PlayState* play) {
void EnSb_Bounce(EnSb* this, PlayState* play) {
s32 pad;
f32 currentFrame = currentFrame = this->skelAnime.curFrame;
f32 frameCount = frameCount = Animation_GetLastFrame(&object_sb_Anim_0000B4);
f32 curFrame = this->skelAnime.curFrame;
f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_0000B4);
Math_StepToF(&this->actor.speed, 0.0f, 0.2f);
if (currentFrame == frameCount) {
if (curFrame == endFrame) {
if (this->bounceCounter != 0) {
this->bounceCounter--;
this->attackTimer = 1;
@@ -169,35 +169,38 @@ void func_80BCD2BC(EnScopecrow* this, PlayState* play) {
this->actor.csId, this->actor.halfDaysBits, NULL);
}
s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) {
s32 EnScopecrow_HasReachedPoint(EnScopecrow* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 count = path->count;
s32 index = pointIndex;
s32 ret = false;
f32 phi_fa0;
f32 phi_fa1;
Vec3f sp3C;
Vec3f sp30;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &points[index]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
phi_fa0 = points[1].x - points[0].x;
phi_fa1 = points[1].z - points[0].z;
} else if ((sp58 - 1) == index) {
phi_fa0 = points[sp58 - 1].x - points[sp58 - 2].x;
phi_fa1 = points[sp58 - 1].z - points[sp58 - 2].z;
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_fa0 = points[index + 1].x - points[index - 1].x;
phi_fa1 = points[index + 1].z - points[index - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) {
ret = true;
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
f32 func_80BCD4D0(Path* path, s32 count, Vec3f* arg2, Vec3s* arg3) {
@@ -244,7 +247,7 @@ void func_80BCD640(EnScopecrow* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.world.rot.y;
Math_SmoothStepToS(&this->actor.world.rot.x, -sp30.x, 4, 0x3E8, 1);
if (func_80BCD334(this, this->path, this->unk_1FC)) {
if (EnScopecrow_HasReachedPoint(this, this->path, this->unk_1FC)) {
if ((this->unk_1FC == this->unk_262) && func_80BCD1AC(this->unk_260)) {
func_80BCD2BC(this, play);
}
@@ -30,7 +30,7 @@ void func_80BCBD28(EnScopenuts* this, PlayState* play);
void func_80BCBF0C(EnScopenuts* this, PlayState* play);
void func_80BCBFFC(EnScopenuts* this, PlayState* play);
void func_80BCC288(EnScopenuts* this, PlayState* play);
s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_);
s32 EnScopenuts_HasReachedPoint(EnScopenuts* this, Path* path, s32 pointIndex);
f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3);
ActorInit En_Scopenuts_InitVars = {
@@ -100,12 +100,12 @@ static InitChainEntry sInitChain[] = {
};
s16 func_80BCABF0(Path* path) {
Vec3s* sp34 = Lib_SegmentedToVirtual(path->points);
Vec3s* points = Lib_SegmentedToVirtual(path->points);
Vec3f sp28;
Vec3f sp1C;
Math_Vec3s_ToVec3f(&sp28, &sp34[0]);
Math_Vec3s_ToVec3f(&sp1C, &sp34[1]);
Math_Vec3s_ToVec3f(&sp28, &points[0]);
Math_Vec3s_ToVec3f(&sp1C, &points[1]);
return Math_Vec3f_Yaw(&sp28, &sp1C);
}
@@ -216,7 +216,7 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) {
this->unk_33E = 0x1000;
this->unk_340 += 0x1C71;
this->actor.world.rot.x = -sp30.x;
if (func_80BCC2AC(this, this->path, this->unk_334)) {
if (EnScopenuts_HasReachedPoint(this, this->path, this->unk_334)) {
if (this->unk_334 >= (this->path->count - 1)) {
this->actionFunc = func_80BCB1C8;
this->actor.speed = 0.0f;
@@ -579,7 +579,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) {
this->unk_340 += this->unk_34C;
this->actor.world.rot.x = -sp38.x;
if (func_80BCC2AC(this, this->path, this->unk_334)) {
if (EnScopenuts_HasReachedPoint(this, this->path, this->unk_334)) {
sp32 = 1;
}
@@ -629,49 +629,50 @@ void func_80BCC288(EnScopenuts* this, PlayState* play) {
Actor_Kill(&this->actor);
}
s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 arg2 = arg2_;
s32 sp50 = false;
f32 phi_f12;
f32 phi_f14;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnScopenuts_HasReachedPoint(EnScopenuts* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (arg2 == 0) {
phi_f12 = sp5C[1].x - sp5C[0].x;
phi_f14 = sp5C[1].z - sp5C[0].z;
} else if ((sp58 - 1) == arg2) {
phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x;
phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z;
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = sp5C[arg2 + 1].x - sp5C[arg2 - 1].x;
phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return sp50;
return reached;
}
f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
Vec3s* temp_v1;
Vec3s* points;
Vec3f sp20;
if (path != NULL) {
temp_v1 = Lib_SegmentedToVirtual(path->points);
temp_v1 = &temp_v1[arg1];
sp20.x = temp_v1[0].x;
sp20.y = temp_v1[0].y;
sp20.z = temp_v1[0].z;
points = Lib_SegmentedToVirtual(path->points);
points = &points[arg1];
sp20.x = points[0].x;
sp20.y = points[0].y;
sp20.z = points[0].z;
}
arg3->y = Math_Vec3f_Yaw(arg2, &sp20);
@@ -32,7 +32,7 @@ void func_80ADC6D0(EnSellnuts* this, PlayState* play);
void func_80ADC7B4(EnSellnuts* this, PlayState* play);
void func_80ADC8C4(EnSellnuts* this, PlayState* play);
void func_80ADCA64(EnSellnuts* this, PlayState* play);
s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2);
s32 EnSellnuts_HasReachedPoint(EnSellnuts* this, Path* path, s32 pointIndex);
f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3);
static u16 D_80ADD910[] = { 0x0614, 0x060E, 0x0628 };
@@ -657,7 +657,7 @@ void func_80ADC37C(EnSellnuts* this, PlayState* play) {
this->unk_342 = 0x1000;
this->unk_344 += this->unk_364;
this->actor.world.rot.x = -sp30.x;
if (func_80ADCE4C(this, this->path, this->unk_334) && (sp2C < 500.0f)) {
if (EnSellnuts_HasReachedPoint(this, this->path, this->unk_334) && (sp2C < 500.0f)) {
if (this->unk_334 >= (this->path->count - 1)) {
CutsceneManager_Stop(this->csId);
this->actionFunc = func_80ADC580;
@@ -788,7 +788,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) {
this->unk_342 = 0x1000;
this->unk_344 += 0x1C71;
this->actor.world.rot.x = -sp30.x;
if (func_80ADCE4C(this, this->path, this->unk_334)) {
if (EnSellnuts_HasReachedPoint(this, this->path, this->unk_334)) {
if (this->unk_334 >= (this->path->count - 1)) {
this->unk_34C = 22;
this->actor.gravity = -1.0f;
@@ -892,36 +892,38 @@ void func_80ADCD3C(EnSellnuts* this, PlayState* play) {
}
}
s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) {
s32 EnSellnuts_HasReachedPoint(EnSellnuts* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 var = arg2;
s32 ret = false;
f32 pointX;
f32 pointY;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &points[var]);
if (var == 0) {
pointX = points[1].x - points[0].x;
pointY = points[1].z - points[0].z;
} else if ((u32)count == (u32)(var + 1)) {
pointX = points[count - 1].x - points[count - 2].x;
pointY = points[count - 1].z - points[count - 2].z;
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
pointX = points[var + 1].x - points[var - 1].x;
pointY = points[var + 1].z - points[var - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(pointX, pointY)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) {
@@ -600,64 +600,72 @@ s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq)
return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX));
}
s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 index = arg2;
s32 ret = false;
f32 sp54;
f32 sp48;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnSuttari_HasReachedPointForward(EnSuttari* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[index]);
Math_Vec3s_ToVec3f(&sp30, &sp5C[index]);
if (index == 0) {
sp54 = sp5C[1].x - sp5C[0].x;
sp48 = sp5C[1].z - sp5C[0].z;
} else if (index == sp58 - 1) {
sp54 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x;
sp48 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z;
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
sp54 = sp5C[index + 1].x - sp5C[index - 1].x;
sp48 = sp5C[index + 1].z - sp5C[index - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C);
if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 index = arg2;
s32 ret = false;
f32 sp54;
f32 sp48;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnSuttari_HasReachedPointReverse(EnSuttari* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&point, &points[index]);
Math_Vec3s_ToVec3f(&sp30, &sp5C[index]);
if (index == 0) {
sp54 = sp5C[0].x - sp5C[1].x;
sp48 = sp5C[0].z - sp5C[1].z;
} else if (index == sp58 - 1) {
sp54 = sp5C[sp58 - 2].x - sp5C[sp58 - 1].x;
sp48 = sp5C[sp58 - 2].z - sp5C[sp58 - 1].z;
diffX = points[0].x - points[1].x;
diffZ = points[0].z - points[1].z;
} else if (index == (count - 1)) {
diffX = points[count - 2].x - points[count - 1].x;
diffZ = points[count - 2].z - points[count - 1].z;
} else {
sp54 = sp5C[index - 1].x - sp5C[index + 1].x;
sp48 = sp5C[index - 1].z - sp5C[index + 1].z;
diffX = points[index - 1].x - points[index + 1].x;
diffZ = points[index - 1].z - points[index + 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C);
if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) {
@@ -675,7 +683,7 @@ void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) {
}
Math_SmoothStepToS(&this->actor.world.rot.y, target, 4, 0x3E8, 1);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (func_80BAB758(this, this->paths[arg1], this->unk1F4[arg1])) {
if (EnSuttari_HasReachedPointForward(this, this->paths[arg1], this->unk1F4[arg1])) {
if (this->unk1F4[arg1] >= (this->paths[arg1]->count - 1)) {
if (arg2 == 0) {
this->unk1F4[arg1] = 0;
@@ -700,7 +708,7 @@ void func_80BABB90(EnSuttari* this, s32 arg1) {
}
Math_SmoothStepToS(&this->actor.world.rot.y, target, 1, 0xBB8, 0);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (func_80BAB8F4(this, this->paths[arg1], this->unk1F4[arg1])) {
if (EnSuttari_HasReachedPointReverse(this, this->paths[arg1], this->unk1F4[arg1])) {
if (this->unk1F4[arg1] <= 0) {
this->unk1F4[arg1] = -0x63;
} else {
@@ -311,7 +311,7 @@ void EnSyatekiWf_Run(EnSyatekiWf* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.world.rot.y;
if (distToTarget < 50.0f) {
if (this->actor.speed > 3.0f) {
this->actor.speed = this->actor.speed - 0.5f;
this->actor.speed -= 0.5f;
} else {
this->actor.speed = this->actor.speed;
}
@@ -62,7 +62,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP),
};
u32 sTexturesDesegmented = false;
static s32 sTexturesDesegmented = false;
u16 D_80ADFB2C[PLAYER_FORM_MAX] = {
0x76D, // PLAYER_FORM_FIERCE_DEITY
@@ -106,6 +106,7 @@ void EnTakaraya_Init(Actor* thisx, PlayState* play) {
this->morphTable, TREASURE_CHEST_SHOP_GAL_LIMB_MAX);
this->switchFlag = EN_TAKARAYA_GET_SWITCH_FLAG(thisx);
thisx->params &= 0xFF;
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(sEyesDownTextures); i++) {
sEyesUpTextures[i] = Lib_SegmentedToVirtual(sEyesUpTextures[i]);
@@ -113,6 +114,7 @@ void EnTakaraya_Init(Actor* thisx, PlayState* play) {
}
sTexturesDesegmented = true;
}
this->eyeTexIndex = 2;
if (gSaveContext.save.entrance == ENTRANCE(TREASURE_CHEST_SHOP, 1)) {
Audio_StopSubBgm();
@@ -223,7 +223,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) {
this->actor.world.pos.x += this->actor.velocity.x;
this->actor.world.pos.y += this->actor.velocity.y;
this->actor.world.pos.z += this->actor.velocity.z;
this->actor.velocity.y = this->actor.velocity.y - 2.0f;
this->actor.velocity.y -= 2.0f;
if (this->actor.world.pos.y <= this->actor.floorHeight) {
this->actor.world.pos.y = this->actor.floorHeight;
@@ -316,7 +316,7 @@ void func_80BB6F78(EnTanron2* this, PlayState* play) {
case 1:
if (this->unk_14E == 0) {
this->actor.world.pos.y += this->actor.velocity.y;
this->actor.velocity.y = this->actor.velocity.y - 2.0f;
this->actor.velocity.y -= 2.0f;
if (this->actor.world.pos.y <= this->actor.floorHeight) {
this->actor.world.pos.y = this->actor.floorHeight;
+4 -4
View File
@@ -132,7 +132,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP),
};
static s32 D_80896B60 = 0;
static s32 sTexturesDesegmented = false;
static Vec3f D_80896B64 = { 0.0f, 0.3f, 0.0f };
void EnTite_Init(Actor* thisx, PlayState* play) {
@@ -151,13 +151,13 @@ void EnTite_Init(Actor* thisx, PlayState* play) {
this->updBgCheckInfoFlags =
UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10;
if (!D_80896B60) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(D_80896B24); i++) {
for (j = 0; j < ARRAY_COUNT(D_80896B24[0]); j++) {
D_80896B24[i][j] = Lib_SegmentedToVirtual(D_80896B24[i][j]);
}
}
D_80896B60 = true;
sTexturesDesegmented = true;
}
if (this->actor.params == ENTITE_MINUS_3) {
@@ -452,7 +452,7 @@ void func_80894638(EnTite* this, PlayState* play) {
temp_v1 = (s32)(temp_v0 * (1.0f / 42.0f)) - 10;
}
this->actor.shape.rot.y = this->actor.shape.rot.y + (temp_v1 * 2);
this->actor.shape.rot.y += temp_v1 * 2;
this->actor.world.rot.y = this->actor.shape.rot.y;
this->skelAnime.playSpeed = temp_v1 * 0.01f;
SkelAnime_Update(&this->skelAnime);
+1 -1
View File
@@ -1406,7 +1406,7 @@ void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) {
}
void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) {
u8 talkState = talkState = Message_GetState(&play->msgCtx);
u8 talkState = Message_GetState(&play->msgCtx);
Player* player = GET_PLAYER(play);
PlayerItemAction itemAction;
+34 -36
View File
@@ -16,7 +16,7 @@ void EnTrt2_Destroy(Actor* thisx, PlayState* play);
void EnTrt2_Update(Actor* thisx, PlayState* play);
void func_80AD46F8(EnTrt2* this);
s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2);
s32 EnTrt2_HasReachedPoint(EnTrt2* this, Path* path, s32 pointIndex);
s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3);
f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3);
void func_80AD4A78(EnTrt2* this, PlayState* play);
@@ -170,7 +170,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) {
}
Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 1000, 1);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (func_80AD475C(this, this->path, this->unk_1E4)) {
if (EnTrt2_HasReachedPoint(this, this->path, this->unk_1E4)) {
if (this->unk_1E4 >= (this->path->count - 1)) {
this->unk_1E4 = 0;
} else {
@@ -261,7 +261,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.world.rot.y;
Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 1000, 1);
this->actor.world.rot.x = -this->actor.shape.rot.x;
if (func_80AD475C(this, this->path, this->unk_1E4)) {
if (EnTrt2_HasReachedPoint(this, this->path, this->unk_1E4)) {
if (this->unk_1E4 >= (this->path->count - 1)) {
CutsceneManager_Stop(this->csId);
this->unk_3D9 = 2;
@@ -565,40 +565,38 @@ void func_80AD46F8(EnTrt2* this) {
}
}
s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2) {
Vec3s* points;
s32 count;
f32 phi_f12;
s32 ret;
f32 phi_f14;
s32 arg = arg2;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnTrt2_HasReachedPoint(EnTrt2* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
points = Lib_SegmentedToVirtual(path->points);
count = path->count;
ret = false;
Math_Vec3s_ToVec3f(&sp30, &points[arg]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (arg == 0) {
phi_f12 = points[1].x - points[0].x;
phi_f14 = points[1].z - points[0].z;
} else if ((count - 1) == arg) {
phi_f12 = points[count - 1].x - points[count - 2].x;
phi_f14 = points[count - 1].z - points[count - 2].z;
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = points[arg + 1].x - points[arg - 1].x;
phi_f14 = points[arg + 1].z - points[arg - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return ret;
return reached;
}
s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) {
@@ -622,15 +620,15 @@ s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) {
f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
s32 pad;
Vec3f sp20;
Vec3s* temp_v1;
Vec3s* points;
if (path != NULL) {
temp_v1 = Lib_SegmentedToVirtual(path->points);
temp_v1 = &temp_v1[arg1];
points = Lib_SegmentedToVirtual(path->points);
points = &points[arg1];
sp20.x = temp_v1->x;
sp20.y = temp_v1->y;
sp20.z = temp_v1->z;
sp20.x = points->x;
sp20.y = points->y;
sp20.z = points->z;
}
arg3->y = Math_Vec3f_Yaw(arg2, &sp20);
arg3->x = Math_Vec3f_Pitch(arg2, &sp20);
+31 -30
View File
@@ -263,12 +263,12 @@ f32 func_80B76540(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
Vec3f sp20;
if (path != NULL) {
Vec3s* temp_v1 = Lib_SegmentedToVirtual(path->points);
Vec3s* points = Lib_SegmentedToVirtual(path->points);
temp_v1 = &temp_v1[arg1];
sp20.x = temp_v1->x;
sp20.y = temp_v1->y;
sp20.z = temp_v1->z;
points = &points[arg1];
sp20.x = points->x;
sp20.y = points->y;
sp20.z = points->z;
}
arg3->y = Math_Vec3f_Yaw(arg2, &sp20);
arg3->x = Math_Vec3f_Pitch(arg2, &sp20);
@@ -276,37 +276,38 @@ f32 func_80B76540(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
return sp20.y - arg2->y;
}
s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) {
Vec3s* sp5C = Lib_SegmentedToVirtual(path->points);
s32 sp58 = path->count;
s32 idx = arg2;
s32 sp50 = false;
f32 phi_f12;
f32 phi_f14;
f32 sp44;
f32 sp40;
f32 sp3C;
Vec3f sp30;
s32 EnTruMt_HasReachedPoint(EnTruMt* this, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
Math_Vec3s_ToVec3f(&sp30, &sp5C[idx]);
Math_Vec3s_ToVec3f(&point, &points[index]);
if (idx == 0) {
phi_f12 = sp5C[1].x - sp5C[0].x;
phi_f14 = sp5C[1].z - sp5C[0].z;
} else if (idx == (sp58 - 1)) {
phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x;
phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z;
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == (count - 1)) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
phi_f12 = sp5C[idx + 1].x - sp5C[idx - 1].x;
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
return sp50;
return reached;
}
void func_80B7679C(EnTruMt* this, PlayState* play) {
@@ -375,7 +376,7 @@ void func_80B76A64(EnTruMt* this, PlayState* play) {
this->actor.shape.rot.z = CLAMP(this->actor.world.rot.y, -0x1770, 0x1770);
this->actor.world.rot.z = this->actor.shape.rot.z;
if (func_80B76600(this, this->path, this->unk_36C)) {
if (EnTruMt_HasReachedPoint(this, this->path, this->unk_36C)) {
if (this->unk_36C >= (this->path->count - 1)) {
this->actionFunc = func_80B76C38;
this->actor.speed = 0.0f;
+4 -1
View File
@@ -117,7 +117,10 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) {
if (this->unk_1D8 == NULL) {
Actor_Kill(&this->actor);
} else if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_1) {
return;
}
if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_1) {
Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP);
}
}
+3 -3
View File
@@ -154,7 +154,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_S8(hintId, TATL_HINT_ID_BEAMOS, ICHAIN_STOP),
};
s32 D_808CD5B8 = false;
static s32 sTexturesDesegmented = false;
Color_RGBA8 D_808CD5BC = { 0, 0, 255, 0 };
@@ -181,11 +181,11 @@ void EnVm_Init(Actor* thisx, PlayState* play) {
thisx->params &= 0xFF;
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400;
if (!D_808CD5B8) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(D_808CD58C); i++) {
D_808CD58C[i] = Lib_SegmentedToVirtual(D_808CD58C[i]);
}
D_808CD5B8 = true;
sTexturesDesegmented = true;
}
func_808CC420(this);
}
@@ -438,7 +438,7 @@ void func_80A59C04(Actor* thisx, PlayState* play2) {
ptr->unk_04.x += ptr->unk_10.x;
ptr->unk_04.y += ptr->unk_10.y;
ptr->unk_04.z += ptr->unk_10.z;
ptr->unk_10.y = ptr->unk_10.y + ptr->unk_1C.y;
ptr->unk_10.y += ptr->unk_1C.y;
if (ptr->unk_00 == 4) {
if (ptr->unk_2A > 0) {
@@ -58,7 +58,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) {
EnWeatherTag* this = THIS;
s32 pad;
Path* path;
s32 pathID;
s32 pathIndex;
// flag: is targetable. Should do nothing as not set by default above
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
@@ -100,8 +100,8 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) {
break;
case WEATHERTAG_TYPE_WATERMURK:
pathID = WEATHER_TAG_PATHID(&this->actor);
path = &play->setupPathList[pathID];
pathIndex = WEATHER_TAG_GET_PATH_INDEX(&this->actor);
path = &play->setupPathList[pathIndex];
this->pathPoints = Lib_SegmentedToVirtual(path->points);
this->pathCount = path->count;
EnWeatherTag_SetupAction(this, func_809672DC);
@@ -20,7 +20,7 @@ typedef struct EnWeatherTag {
} EnWeatherTag; // size = 0x15C
#define WEATHER_TAG_TYPE(thisx) ((thisx)->params & 0xF)
#define WEATHER_TAG_PATHID(thisx) (((thisx)->params >> 4) & 0xF)
#define WEATHER_TAG_GET_PATH_INDEX(thisx) (((thisx)->params >> 4) & 0xF)
#define WEATHER_TAG_RANGE100(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100.0f)
#define WEATHER_TAG_GET_SKYBOX_NUM_STARS(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100)
+4 -8
View File
@@ -259,7 +259,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
};
static s32 D_809942D8 = 0;
static s32 sTexturesDesegmented = false;
void EnWf_Init(Actor* thisx, PlayState* play) {
EnWf* this = THIS;
@@ -341,12 +341,12 @@ void EnWf_Init(Actor* thisx, PlayState* play) {
Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY);
if (D_809942D8 == 0) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(sNormalEyeTextures); i++) {
sNormalEyeTextures[i] = Lib_SegmentedToVirtual(sNormalEyeTextures[i]);
sWhiteEyeTextures[i] = Lib_SegmentedToVirtual(sWhiteEyeTextures[i]);
}
D_809942D8 = 1;
sTexturesDesegmented = true;
}
this->unk_2A2 = Rand_ZeroFloat(96.0f);
}
@@ -1529,11 +1529,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) {
if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) {
Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f);
this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f;
if (this->drawDmgEffScale > 0.75f) {
this->drawDmgEffScale = 0.75f;
} else {
this->drawDmgEffScale = this->drawDmgEffScale;
}
this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f);
} else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG);
}
+11 -11
View File
@@ -31,7 +31,7 @@ void func_80B94E34(EnZog* this, PlayState* play);
void func_80B95128(EnZog* this, PlayState* play);
void func_80B95240(EnZog* this, PlayState* play);
static u8 D_80B95E10;
static u8 sTexturesDesegmented;
ActorInit En_Zog_InitVars = {
/**/ ACTOR_EN_ZOG,
@@ -140,9 +140,9 @@ void func_80B93310(Actor* thisx, Lights* mapper, PlayState* play) {
void func_80B93468(EnZog* this, PlayState* play) {
Vec3s* points;
this->unk_2E8 = &play->setupPathList[ENZOG_GET_FC00(&this->actor)];
if (this->unk_2E8 != NULL) {
points = &((Vec3s*)Lib_SegmentedToVirtual(this->unk_2E8->points))[this->unk_2EC];
this->path = &play->setupPathList[ENZOG_GET_PATH_INDEX(&this->actor)];
if (this->path != NULL) {
points = &((Vec3s*)Lib_SegmentedToVirtual(this->path->points))[this->unk_2EC];
points++;
this->actor.world.pos.x = points[-1].x;
@@ -158,7 +158,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) {
s32 i;
s16 csId;
if (!D_80B95E10) {
if (!sTexturesDesegmented) {
for (i = 0; i < ARRAY_COUNT(D_80B958AC); i++) {
D_80B958AC[i] = Lib_SegmentedToVirtual(D_80B958AC[i]);
}
@@ -167,7 +167,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) {
D_80B958B8[i] = Lib_SegmentedToVirtual(D_80B958B8[i]);
}
D_80B95E10 = true;
sTexturesDesegmented = true;
}
ActorShape_Init(&this->actor.shape, 0.0f, func_80B93310, 24.0f);
@@ -208,10 +208,10 @@ void EnZog_Init(Actor* thisx, PlayState* play) {
}
this->unk_2EC = 0;
if (ENZOG_GET_FC00(&this->actor) != ENZOG_FC00_63) {
if (ENZOG_GET_PATH_INDEX(&this->actor) != ENZOG_FC00_63) {
func_80B93468(this, play);
} else {
this->unk_2E8 = NULL;
this->path = NULL;
}
this->unk_2FC = 0;
@@ -321,11 +321,11 @@ void func_80B93BA8(EnZog* this, s16 csIdIndex) {
}
s32 func_80B93BE0(EnZog* this, PlayState* play) {
Path* path = this->unk_2E8;
Path* path = this->path;
s16 temp_v0;
Vec3s* points;
if (this->unk_2E8 == 0) {
if (this->path == NULL) {
return false;
}
@@ -343,7 +343,7 @@ s32 func_80B93BE0(EnZog* this, PlayState* play) {
if (ABS_ALT(temp_v0 - this->actor.world.rot.y) > 0x4000) {
this->unk_2EC++;
func_80B93468(this, play);
if ((this->unk_2EC + 1) >= this->unk_2E8->count) {
if ((this->unk_2EC + 1) >= this->path->count) {
this->unk_30A |= 1;
return true;
}
+2 -2
View File
@@ -8,7 +8,7 @@ struct EnZog;
typedef void (*EnZogActionFunc)(struct EnZog*, PlayState*);
#define ENZOG_GET_F(thisx) ((thisx)->params & 0xF)
#define ENZOG_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA)
#define ENZOG_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA)
#define ENZOG_F_2 2
#define ENZOG_FC00_63 63
@@ -19,7 +19,7 @@ typedef struct EnZog {
/* 0x190 */ SkelAnime skelAnime;
/* 0x1D4 */ Vec3s jointTable[23];
/* 0x25E */ Vec3s morphTable[23];
/* 0x2E8 */ Path* unk_2E8;
/* 0x2E8 */ Path* path;
/* 0x2EC */ s32 unk_2EC;
/* 0x2F0 */ Vec3f unk_2F0;
/* 0x2FC */ s16 unk_2FC;
@@ -213,13 +213,13 @@ void func_80937238(ObjBean* this) {
}
void func_80937268(ObjBean* this, PlayState* play) {
this->unk_1D8 = play->setupPathList[OBJBEAN_GET_3F00(&this->dyna.actor)].count - 1;
this->unk_1D8 = play->setupPathList[OBJBEAN_GET_PATH_INDEX(&this->dyna.actor)].count - 1;
this->unk_1DA = 0;
this->unk_1DC = 1;
}
void func_809372A8(ObjBean* this) {
Math_Vec3s_ToVec3f(&this->unk_1BC, this->unk_1D4);
Math_Vec3s_ToVec3f(&this->unk_1BC, this->pathPoints);
}
void func_809372D0(ObjBean* this) {
@@ -229,7 +229,7 @@ void func_809372D0(ObjBean* this) {
f32 temp_f2;
f32 temp_f12;
Math_Vec3s_ToVec3f(&sp38, &this->unk_1D4[this->unk_1DC]);
Math_Vec3s_ToVec3f(&sp38, &this->pathPoints[this->unk_1DC]);
Math_Vec3f_Diff(&sp38, &this->unk_1BC, &actor->velocity);
sp34 = Math3D_Vec3fMagnitude(&actor->velocity);
@@ -385,8 +385,8 @@ void ObjBean_Init(Actor* thisx, PlayState* play) {
Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_ITEMACTION);
func_80937DD8(this);
} else {
s32 params2 = OBJBEAN_GET_3F00(&this->dyna.actor);
Path* path = &play->setupPathList[params2];
s32 pathIndex = OBJBEAN_GET_PATH_INDEX(&this->dyna.actor);
Path* path = &play->setupPathList[pathIndex];
this->unk_1DE = OBJBEAN_GET_3(&this->dyna.actor);
this->dyna.actor.world.rot.z = 0;
@@ -398,7 +398,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit1);
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
this->unk_1D4 = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
func_80937268(this, play);
func_809372A8(this);
@@ -10,7 +10,7 @@ typedef void (*ObjBeanUnkFunc)(struct ObjBean*);
#define OBJBEAN_GET_SWITCH_FLAG_1(thisx, offset) (((thisx)->params + (offset)) & 0x7F)
#define OBJBEAN_GET_80(thisx) (((thisx)->params >> 7) & 1)
#define OBJBEAN_GET_3F00(thisx) (((thisx)->params >> 8) & 0x3F)
#define OBJBEAN_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0x3F)
#define OBJBEAN_GET_SWITCH_FLAG_2(thisx, offset) ((((thisx)->params >> 7) + (offset)) & 0x7F)
#define OBJBEAN_GET_C000(thisx) (((thisx)->params >> 0xE) & 3)
@@ -36,7 +36,7 @@ typedef struct ObjBean {
/* 0x1C8 */ f32 unk_1C8;
/* 0x1CC */ f32 unk_1CC;
/* 0x1D0 */ f32 unk_1D0;
/* 0x1D4 */ Vec3s* unk_1D4;
/* 0x1D4 */ Vec3s* pathPoints;
/* 0x1D8 */ s16 unk_1D8;
/* 0x1DA */ s16 unk_1DA;
/* 0x1DC */ s16 unk_1DC;
@@ -116,14 +116,14 @@ void ObjBigicicle_Init(Actor* thisx, PlayState* play) {
sp30 = sp28 * (1.0f / 60.0f);
Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1);
this->collider1.dim.radius = this->collider1.dim.radius * sp30;
this->collider1.dim.height = this->collider1.dim.height * sp30;
this->collider1.dim.yShift = this->collider1.dim.yShift * sp30;
this->collider1.dim.radius *= sp30;
this->collider1.dim.height *= sp30;
this->collider1.dim.yShift *= sp30;
Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2);
this->collider2.dim.radius = this->collider2.dim.radius * sp30;
this->collider2.dim.height = this->collider2.dim.height * sp30;
this->collider2.dim.yShift = this->collider2.dim.yShift * sp30;
this->collider2.dim.radius *= sp30;
this->collider2.dim.height *= sp30;
this->collider2.dim.yShift *= sp30;
if (Flags_GetSwitch(play, OBJBIGICLE_GET_SWITCH_FLAG(&this->actor))) {
Actor_Kill(&this->actor);
@@ -46,7 +46,7 @@ static InitChainEntry sInitChain[] = {
*/
s16 ObjBoat_GetNextPoint(ObjBoat* this, Vec3f* nextPoint) {
s16 yaw;
Vec3s* curPoint = &this->points[(s32)this->curPointIndex];
Vec3s* curPoint = &this->pathPoints[(s32)this->curPointIndex];
Math_Vec3s_ToVec3f(nextPoint, &curPoint[this->direction]);
yaw = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, nextPoint);
@@ -68,10 +68,10 @@ void ObjBoat_Init(Actor* thisx, PlayState* play) {
} else {
path = &play->setupPathList[OBJBOAT_GET_PATH_INDEX(thisx)];
this->maxPointIndex = path->count - 1;
this->points = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
this->direction = 1;
this->dyna.actor.world.pos.x = this->points[this->curPointIndex].x;
this->dyna.actor.world.pos.z = this->points[this->curPointIndex].z;
this->dyna.actor.world.pos.x = this->pathPoints[this->curPointIndex].x;
this->dyna.actor.world.pos.z = this->pathPoints[this->curPointIndex].z;
this->dyna.actor.shape.rot.y = ObjBoat_GetNextPoint(this, &sp24);
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y;
this->direction = -this->direction;
@@ -164,10 +164,10 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) {
}
this->maxPointIndex = path->count;
this->points = Lib_SegmentedToVirtual(path->points);
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->pathPoints);
this->dyna.actor.speed = cue->rot.z * (45.0f / 0x2000);
this->points++;
this->pathPoints++;
this->curPointIndex = 1;
}
@@ -177,10 +177,10 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) {
Vec3f posTarget;
f32 distRemaining;
Math_Vec3s_ToVec3f(&posTarget, this->points);
Math_Vec3s_ToVec3f(&posTarget, this->pathPoints);
distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &posTarget, this->dyna.actor.speed);
if ((this->curPointIndex < this->maxPointIndex) && (distRemaining < this->dyna.actor.speed)) {
this->points++;
this->pathPoints++;
this->curPointIndex++;
}
}
@@ -20,7 +20,7 @@ typedef struct ObjBoat {
/* 0x160 */ s16 angle; // Angle used to set rotations
/* 0x162 */ UNK_TYPE1 pad_162;
/* 0x163 */ u8 maxPointIndex; // point at the other end from 0
/* 0x164 */ Vec3s* points;
/* 0x164 */ Vec3s* pathPoints;
} ObjBoat; // size = 0x168
#endif // Z_OBJ_BOAT_H
@@ -223,9 +223,9 @@ void ObjChan_ChandelierAction(ObjChan* this, PlayState* play) {
if (this->unk1D0 > 0.0f) {
this->unk1D4 += 0x190;
if (this->unk1D0 <= 400.0f) {
this->unk1D0 = this->unk1D0 * 0.99f;
this->unk1D0 *= 0.99f;
} else {
this->unk1D0 = this->unk1D0 - 1.0f;
this->unk1D0 -= 1.0f;
}
if (this->unk1D0 < 0.0f) {
this->unk1D4 = 0;
@@ -41,7 +41,7 @@ static InitChainEntry sInitChain[] = {
};
void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index) {
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]);
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[index]);
}
void ObjDanpeilift_Init(Actor* thisx, PlayState* play) {
@@ -72,7 +72,7 @@ void ObjDanpeilift_Init(Actor* thisx, PlayState* play) {
this->curPoint = OBJDANPEILIFT_GET_STARTING_POINT(thisx);
this->endPoint = path->count - 1;
this->direction = 1;
this->points = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
ObjDanpeilift_UpdatePosition(this, this->curPoint);
this->actionFunc = ObjDanpeilift_Move;
}
@@ -96,7 +96,7 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) {
s32 isPosUpdated;
Vec3s* endPoint;
Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction);
Math_Vec3s_ToVec3f(&nextPoint, this->pathPoints + this->curPoint + this->direction);
Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity);
speed = Math3D_Vec3fMagnitude(&thisx->velocity);
if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) {
@@ -125,10 +125,10 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) {
this->waitTimer = 10;
this->actionFunc = ObjDanpeilift_Wait;
} else {
endPoint = &this->points[this->endPoint];
endPoint = &this->pathPoints[this->endPoint];
this->curPoint = this->direction > 0 ? 0 : this->endPoint;
if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) ||
(this->points[0].z != endPoint->z)) {
if ((this->pathPoints[0].x != endPoint->x) || (this->pathPoints[0].y != endPoint->y) ||
(this->pathPoints[0].z != endPoint->z)) {
this->actionFunc = ObjDanpeilift_Teleport;
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
isPosUpdated = false;
@@ -22,7 +22,7 @@ typedef struct ObjDanpeilift {
/* 0x164 */ s32 endPoint;
/* 0x168 */ s32 curPoint;
/* 0x16C */ s32 direction;
/* 0x170 */ Vec3s* points;
/* 0x170 */ Vec3s* pathPoints;
/* 0x174 */ s32 isPlayerOnTop;
/* 0x178 */ s32 isPlayerOnTopPrev;
/* 0x17C */ f32 cycleSpeed;
@@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = {
};
void func_80A66570(ObjDriftice* this, s32 arg1) {
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->unk_16C[arg1]);
Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[arg1]);
}
void func_80A665AC(s16* arg0, s16 arg1) {
@@ -308,12 +308,12 @@ void ObjDriftice_Init(Actor* thisx, PlayState* play) {
} else {
this->dyna.actor.flags |= ACTOR_FLAG_10;
path = &play->setupPathList[OBJDRIFTICE_GET_1FC(&this->dyna.actor)];
path = &play->setupPathList[OBJDRIFTICE_GET_PATH_INDEX(&this->dyna.actor)];
this->unk_164 = 0;
this->unk_160 = path->count - 1;
this->unk_168 = 1;
this->unk_16C = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
func_80A66570(this, this->unk_164);
func_80A671CC(this);
}
@@ -345,7 +345,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) {
s32 sp30;
Actor* thisx = &this->dyna.actor;
Math_Vec3s_ToVec3f(&sp40, &(&this->unk_16C[this->unk_164])[this->unk_168]);
Math_Vec3s_ToVec3f(&sp40, &(&this->pathPoints[this->unk_164])[this->unk_168]);
Math_Vec3f_Diff(&sp40, &this->dyna.actor.world.pos, &thisx->velocity);
sp3C = Math3D_Vec3fMagnitude(&thisx->velocity);
@@ -377,7 +377,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) {
this->unk_168 = -this->unk_168;
func_80A674A8(this);
} else {
points = &this->unk_16C[this->unk_160];
points = &this->pathPoints[this->unk_160];
if (this->unk_168 > 0) {
this->unk_164 = 0;
@@ -385,8 +385,8 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) {
this->unk_164 = this->unk_160;
}
if ((this->unk_16C[0].x != points->x) || (this->unk_16C[0].y != points->y) ||
(this->unk_16C[0].z != points->z)) {
if ((this->pathPoints[0].x != points->x) || (this->pathPoints[0].y != points->y) ||
(this->pathPoints[0].z != points->z)) {
func_80A6743C(this);
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
sp30 = false;
@@ -8,7 +8,7 @@ struct ObjDriftice;
typedef void (*ObjDrifticeActionFunc)(struct ObjDriftice*, PlayState*);
#define OBJDRIFTICE_GET_3(thisx) ((thisx)->params & 3)
#define OBJDRIFTICE_GET_1FC(thisx) (((thisx)->params >> 2) & 0x7F)
#define OBJDRIFTICE_GET_PATH_INDEX(thisx) (((thisx)->params >> 2) & 0x7F)
#define OBJDRIFTICE_GET_E00(thisx) (((thisx)->params >> 9) & 7)
#define OBJDRIFTICE_GET_1000(thisx) (((thisx)->params >> 0xC) & 1)
#define OBJDRIFTICE_GET_ROT(thisx) ((thisx)->home.rot.x & 3)
@@ -49,7 +49,7 @@ typedef struct ObjDriftice {
/* 0x160 */ s32 unk_160;
/* 0x164 */ s32 unk_164;
/* 0x168 */ s32 unk_168;
/* 0x16C */ Vec3s* unk_16C;
/* 0x16C */ Vec3s* pathPoints;
/* 0x170 */ ObjDrifticeStruct unk_170;
/* 0x23C */ f32 unk_23C;
/* 0x240 */ f32 unk_240;
@@ -71,7 +71,7 @@ void ObjLupygamelift_Init(Actor* thisx, PlayState* play) {
if (this->pointIndex >= this->count) {
this->pointIndex = 0;
}
this->points = Lib_SegmentedToVirtual(path->points);
this->pathPoints = Lib_SegmentedToVirtual(path->points);
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ETCETERA, this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x,
this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 0);
@@ -138,9 +138,9 @@ void func_80AF0530(ObjLupygamelift* this, PlayState* play) {
f32 distRemaining;
Vec3f target;
target.x = this->points[this->pointIndex].x;
target.y = this->points[this->pointIndex].y;
target.z = this->points[this->pointIndex].z;
target.x = this->pathPoints[this->pointIndex].x;
target.y = this->pathPoints[this->pointIndex].y;
target.z = this->pathPoints[this->pointIndex].z;
distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &target, this->dyna.actor.speed);
if (distRemaining > 30.0f) {
Math_SmoothStepToF(&this->dyna.actor.speed, this->targetSpeedXZ, 0.5f, 5.0f, 0.1f);
@@ -17,7 +17,7 @@ typedef struct ObjLupygamelift {
/* 0x160 */ f32 targetSpeedXZ;
/* 0x164 */ s32 count;
/* 0x168 */ s32 pointIndex;
/* 0x16C */ Vec3s* points;
/* 0x16C */ Vec3s* pathPoints;
/* 0x170 */ s16 timer;
} ObjLupygamelift; /* size = 0x174 */

Some files were not shown because too many files have changed in this diff Show More