2020-10-03 15:22:44 +00:00
|
|
|
|
#include "global.h"
|
|
|
|
|
#include "vt.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-03 15:22:44 +00:00
|
|
|
|
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
|
2020-05-01 18:26:16 +00:00
|
|
|
|
#include "overlays/actors/ovl_En_Part/z_en_part.h"
|
2022-06-06 19:37:25 +00:00
|
|
|
|
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
|
|
|
|
#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
|
|
|
|
|
#include "assets/objects/object_bdoor/object_bdoor.h"
|
2020-05-01 18:26:16 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
static CollisionPoly* sCurCeilingPoly;
|
|
|
|
|
static s32 sCurCeilingBgId;
|
|
|
|
|
|
2021-01-18 21:36:41 +00:00
|
|
|
|
void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
shape->yOffset = yOffset;
|
|
|
|
|
shape->shadowDraw = shadowDraw;
|
|
|
|
|
shape->shadowScale = shadowScale;
|
|
|
|
|
shape->shadowAlpha = 255;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist, Color_RGBA8* color) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 temp1;
|
|
|
|
|
f32 temp2;
|
|
|
|
|
MtxF sp60;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->floorPoly != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
temp1 = actor->world.pos.y - actor->floorHeight;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (temp1 >= -50.0f && temp1 < 500.0f) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1553);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-11-19 21:49:08 +00:00
|
|
|
|
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
|
|
|
|
|
COMBINED);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
temp2 = 1.0f - (temp1 * (1.0f / 350));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (color != NULL) {
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->r, color->g, color->b,
|
2021-01-18 21:04:04 +00:00
|
|
|
|
(u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
func_80038A28(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &sp60);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Matrix_Put(&sp60);
|
|
|
|
|
|
2021-01-25 00:36:40 +00:00
|
|
|
|
if (dlist != gCircleShadowDL) {
|
2022-03-20 00:16:33 +00:00
|
|
|
|
Matrix_RotateY(BINANG_TO_RAD(actor->shape.rot.y), MTXMODE_APPLY);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY);
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 1588),
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, dlist);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1594);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) {
|
|
|
|
|
ActorShadow_Draw(actor, lights, play, gCircleShadowDL, NULL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
static Color_RGBA8 white = { 255, 255, 255, 255 };
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &white);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play) {
|
|
|
|
|
ActorShadow_Draw(actor, lights, play, gHorseShadowDL, NULL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_DrawFoot(PlayState* play, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
2020-08-29 23:00:17 +00:00
|
|
|
|
s32 pad1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 sp58;
|
2020-08-29 23:00:17 +00:00
|
|
|
|
s32 pad2[2];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1661);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
(u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF);
|
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg6 *= (4.5f - (light->l.dir[1] * 0.035f));
|
|
|
|
|
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
|
|
|
|
|
Matrix_Put(arg2);
|
|
|
|
|
Matrix_RotateY(sp58, MTXMODE_APPLY);
|
|
|
|
|
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 1687), G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-01-25 00:36:40 +00:00
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gFootShadowDL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1693);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
f32 distToFloor = actor->world.pos.y - actor->floorHeight;
|
|
|
|
|
|
|
|
|
|
if (distToFloor > 20.0f) {
|
|
|
|
|
f32 shadowScale = actor->shape.shadowScale;
|
|
|
|
|
u8 shadowAlpha = actor->shape.shadowAlpha;
|
|
|
|
|
f32 alphaRatio;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->shape.shadowScale *= 0.3f;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
alphaRatio = (distToFloor - 20.0f) * 0.02f;
|
|
|
|
|
actor->shape.shadowAlpha = (f32)actor->shape.shadowAlpha * CLAMP_MAX(alphaRatio, 1.0f);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
ActorShadow_DrawCircle(actor, lights, play);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
actor->shape.shadowScale = shadowScale;
|
|
|
|
|
actor->shape.shadowAlpha = shadowAlpha;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (distToFloor < 200.0f) {
|
|
|
|
|
MtxF floorMtx;
|
|
|
|
|
f32 floorHeight[2]; // One for each foot
|
|
|
|
|
f32 distToFloor;
|
|
|
|
|
f32 shadowAlpha;
|
|
|
|
|
f32 shadowScaleX;
|
|
|
|
|
f32 shadowScaleZ;
|
|
|
|
|
Light* lightPtr;
|
|
|
|
|
s32 lightNum;
|
|
|
|
|
s32 lightNumMax;
|
|
|
|
|
s32 i;
|
|
|
|
|
s32 j;
|
|
|
|
|
s32 numLights = lights->numLights - 2;
|
|
|
|
|
Light* firstLightPtr = &lights->l.l[0];
|
|
|
|
|
Vec3f* feetPosPtr = actor->shape.feetPos;
|
|
|
|
|
f32* floorHeightPtr = floorHeight;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1741);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
|
2022-04-29 18:29:49 +00:00
|
|
|
|
// feetFloorFlag is temporarily a bitfield where the bits are set if the foot is on ground
|
|
|
|
|
// feetFloorFlag & 2 is left foot, feetFloorFlag & 1 is right foot
|
|
|
|
|
actor->shape.feetFloorFlag = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-23 00:38:25 +00:00
|
|
|
|
for (i = 0; i < 2; i++) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
feetPosPtr->y += 50.0f;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
*floorHeightPtr = func_800BFCB8(play, &floorMtx, feetPosPtr);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
feetPosPtr->y -= 50.0f;
|
2022-04-29 18:29:49 +00:00
|
|
|
|
actor->shape.feetFloorFlag <<= 1;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
distToFloor = feetPosPtr->y - *floorHeightPtr;
|
|
|
|
|
|
|
|
|
|
if ((-1.0f <= distToFloor) && (distToFloor < 500.0f)) {
|
|
|
|
|
if (distToFloor <= 0.0f) {
|
2022-04-29 18:29:49 +00:00
|
|
|
|
actor->shape.feetFloorFlag++;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2021-09-19 02:45:41 +00:00
|
|
|
|
distToFloor = CLAMP_MAX(distToFloor, 30.0f);
|
|
|
|
|
shadowAlpha = (f32)actor->shape.shadowAlpha * (1.0f - (distToFloor * (1.0f / 30.0f)));
|
|
|
|
|
distToFloor = CLAMP_MAX(distToFloor, 30.0f);
|
|
|
|
|
shadowScaleZ = 1.0f - (distToFloor * (1.0f / (30.0f + 40.0f)));
|
|
|
|
|
shadowScaleX = shadowScaleZ * actor->shape.shadowScale * actor->scale.x;
|
|
|
|
|
lightNumMax = 0;
|
|
|
|
|
lightPtr = firstLightPtr;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < numLights; j++) {
|
|
|
|
|
if (lightPtr->l.dir[1] > 0) {
|
|
|
|
|
lightNum =
|
|
|
|
|
(lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1]);
|
|
|
|
|
if (lightNum > 0) {
|
|
|
|
|
lightNumMax += lightNum;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX,
|
2021-09-19 02:45:41 +00:00
|
|
|
|
shadowScaleZ);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-19 02:45:41 +00:00
|
|
|
|
lightPtr++;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
for (j = 0; j < 2; j++) {
|
|
|
|
|
if (lightPtr->l.dir[1] > 0) {
|
|
|
|
|
lightNum =
|
|
|
|
|
((lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) * ABS(lightPtr->l.dir[1])) -
|
|
|
|
|
(lightNumMax * 8);
|
|
|
|
|
if (lightNum > 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
ActorShadow_DrawFoot(play, lightPtr, &floorMtx, lightNum, shadowAlpha, shadowScaleX,
|
2021-09-19 02:45:41 +00:00
|
|
|
|
shadowScaleZ);
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2021-09-19 02:45:41 +00:00
|
|
|
|
lightPtr++;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-19 02:45:41 +00:00
|
|
|
|
feetPosPtr++;
|
|
|
|
|
floorHeightPtr++;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
2022-04-29 18:29:49 +00:00
|
|
|
|
actor->shape.feetFloorFlag = 0;
|
|
|
|
|
} else if (actor->shape.feetFloorFlag == 3) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
f32 footDistY = actor->shape.feetPos[FOOT_LEFT].y - actor->shape.feetPos[FOOT_RIGHT].y;
|
|
|
|
|
|
2022-04-29 18:29:49 +00:00
|
|
|
|
if ((floorHeight[FOOT_LEFT] + footDistY) < (floorHeight[FOOT_RIGHT] - footDistY)) {
|
|
|
|
|
actor->shape.feetFloorFlag = 2;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
} else {
|
2022-04-29 18:29:49 +00:00
|
|
|
|
actor->shape.feetFloorFlag = 1;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1831);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex,
|
|
|
|
|
Vec3f* rightFootPos) {
|
|
|
|
|
if (limbIndex == leftFootIndex) {
|
|
|
|
|
Matrix_MultVec3f(leftFootPos, &actor->shape.feetPos[FOOT_LEFT]);
|
|
|
|
|
} else if (limbIndex == rightFootIndex) {
|
|
|
|
|
Matrix_MultVec3f(rightFootPos, &actor->shape.feetPos[FOOT_RIGHT]);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_ProjectPos(PlayState* play, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest) {
|
|
|
|
|
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, src, xyzDest, cappedInvWDest);
|
2022-01-31 09:36:58 +00:00
|
|
|
|
*cappedInvWDest = (*cappedInvWDest < 1.0f) ? 1.0f : (1.0f / *cappedInvWDest);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
typedef struct {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
/* 0x00 */ Color_RGBA8 inner;
|
|
|
|
|
/* 0x04 */ Color_RGBA8 outer;
|
|
|
|
|
} NaviColor; // size = 0x8
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
NaviColor sNaviColorList[] = {
|
2020-07-17 01:37:53 +00:00
|
|
|
|
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } },
|
|
|
|
|
{ { 255, 255, 255, 255 }, { 0, 0, 255, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } },
|
|
|
|
|
{ { 150, 150, 255, 255 }, { 150, 150, 255, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } },
|
|
|
|
|
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } },
|
|
|
|
|
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } },
|
|
|
|
|
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } },
|
|
|
|
|
{ { 0, 255, 0, 255 }, { 0, 255, 0, 0 } },
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// unused
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Gfx D_80115FF0[] = {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 arg4) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->arr_50[index].pos.x = arg2;
|
|
|
|
|
targetCtx->arr_50[index].pos.y = arg3;
|
|
|
|
|
targetCtx->arr_50[index].pos.z = arg4;
|
|
|
|
|
targetCtx->arr_50[index].unk_0C = targetCtx->unk_44;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
TargetContextEntry* entry;
|
|
|
|
|
NaviColor* naviColor;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Math_Vec3f_Copy(&targetCtx->targetCenterPos, &play->view.eye);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_44 = 500.0f;
|
|
|
|
|
targetCtx->unk_48 = 0x100;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
naviColor = &sNaviColorList[actorCategory];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
entry = &targetCtx->arr_50[0];
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(targetCtx->arr_50); i++) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_8002BE64(targetCtx, i, 0.0f, 0.0f, 0.0f);
|
|
|
|
|
entry->color.r = naviColor->inner.r;
|
|
|
|
|
entry->color.g = naviColor->inner.g;
|
|
|
|
|
entry->color.b = naviColor->inner.b;
|
|
|
|
|
entry++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
NaviColor* naviColor = &sNaviColorList[actorCategory];
|
|
|
|
|
targetCtx->naviRefPos.x = actor->focus.pos.x;
|
|
|
|
|
targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y);
|
|
|
|
|
targetCtx->naviRefPos.z = actor->focus.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->naviInner.r = naviColor->inner.r;
|
|
|
|
|
targetCtx->naviInner.g = naviColor->inner.g;
|
|
|
|
|
targetCtx->naviInner.b = naviColor->inner.b;
|
|
|
|
|
targetCtx->naviInner.a = naviColor->inner.a;
|
|
|
|
|
targetCtx->naviOuter.r = naviColor->outer.r;
|
|
|
|
|
targetCtx->naviOuter.g = naviColor->outer.g;
|
|
|
|
|
targetCtx->naviOuter.b = naviColor->outer.b;
|
|
|
|
|
targetCtx->naviOuter.a = naviColor->outer.a;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002C0C0(TargetContext* targetCtx, Actor* actor, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->arrowPointedActor = NULL;
|
|
|
|
|
targetCtx->targetedActor = NULL;
|
|
|
|
|
targetCtx->unk_40 = 0.0f;
|
|
|
|
|
targetCtx->unk_8C = NULL;
|
2021-12-05 17:13:53 +00:00
|
|
|
|
targetCtx->bgmEnemy = NULL;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_4B = 0;
|
|
|
|
|
targetCtx->unk_4C = 0;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_SetNaviToActor(targetCtx, actor, actor->category, play);
|
|
|
|
|
func_8002BE98(targetCtx, actor->category, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002C124(TargetContext* targetCtx, PlayState* play) {
|
2020-08-15 18:03:03 +00:00
|
|
|
|
Actor* actor = targetCtx->targetedActor;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2029);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (targetCtx->unk_48 != 0) {
|
2020-08-29 23:00:17 +00:00
|
|
|
|
TargetContextEntry* entry;
|
|
|
|
|
Player* player;
|
|
|
|
|
s16 spCE;
|
|
|
|
|
f32 temp1;
|
2022-01-31 09:36:58 +00:00
|
|
|
|
Vec3f projTargetCenter;
|
2020-08-29 23:00:17 +00:00
|
|
|
|
s32 spB8;
|
2022-01-31 09:36:58 +00:00
|
|
|
|
f32 projTargetCappedInvW;
|
2020-08-29 23:00:17 +00:00
|
|
|
|
s32 spB0;
|
|
|
|
|
s32 spAC;
|
|
|
|
|
f32 var1;
|
|
|
|
|
f32 var2;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
spCE = 0xFF;
|
|
|
|
|
var1 = 1.0f;
|
|
|
|
|
|
2020-03-23 23:11:21 +00:00
|
|
|
|
if (targetCtx->unk_4B != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spB8 = 1;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spB8 = 3;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-23 00:38:25 +00:00
|
|
|
|
if (actor != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->focus.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var1 = (500.0f - targetCtx->unk_44) / 420.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-23 00:38:25 +00:00
|
|
|
|
targetCtx->unk_48 -= 120;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
if (targetCtx->unk_48 < 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_48 = 0;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spCE = targetCtx->unk_48;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_ProjectPos(play, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
projTargetCenter.x = (160 * (projTargetCenter.x * projTargetCappedInvW)) * var1;
|
|
|
|
|
projTargetCenter.x = CLAMP(projTargetCenter.x, -320.0f, 320.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
projTargetCenter.y = (120 * (projTargetCenter.y * projTargetCappedInvW)) * var1;
|
|
|
|
|
projTargetCenter.y = CLAMP(projTargetCenter.y, -240.0f, 240.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
projTargetCenter.z = projTargetCenter.z * var1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
targetCtx->unk_4C--;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
if (targetCtx->unk_4C < 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_4C = 2;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
func_8002BE64(targetCtx, targetCtx->unk_4C, projTargetCenter.x, projTargetCenter.y, projTargetCenter.z);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-12 13:04:37 +00:00
|
|
|
|
if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->unk_664)) {
|
2022-06-03 22:25:48 +00:00
|
|
|
|
OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-15 18:03:03 +00:00
|
|
|
|
for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
entry = &targetCtx->arr_50[spAC];
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (entry->unk_0C < 500.0f) {
|
2020-03-23 23:11:21 +00:00
|
|
|
|
if (entry->unk_0C <= 120.0f) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var2 = 0.15f;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var2 = ((entry->unk_0C - 120.0f) * 0.001f) + 0.15f;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW);
|
|
|
|
|
Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY);
|
|
|
|
|
|
2020-11-19 21:49:08 +00:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, entry->color.r, entry->color.g, entry->color.b, (u8)spCE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
Matrix_RotateZ((targetCtx->unk_4B & 0x7F) * (M_PI / 64), MTXMODE_APPLY);
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < 4; i++) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY);
|
|
|
|
|
Matrix_Push();
|
|
|
|
|
Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2116),
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-01-25 00:36:40 +00:00
|
|
|
|
gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL);
|
2021-02-24 19:28:04 +00:00
|
|
|
|
Matrix_Pop();
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-15 18:03:03 +00:00
|
|
|
|
spCE -= 0xFF / 3;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
if (spCE < 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spCE = 0;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor = targetCtx->unk_94;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
NaviColor* naviColor = &sNaviColorList[actor->category];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_7);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f,
|
|
|
|
|
actor->focus.pos.z, MTXMODE_NEW);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Matrix_RotateY(BINANG_TO_RAD((u16)(play->gameplayFrames * 3000)), MTXMODE_APPLY);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY);
|
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 2153),
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-11-28 10:47:55 +00:00
|
|
|
|
gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2158);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 pad;
|
|
|
|
|
Actor* unkActor;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s32 actorCategory;
|
2022-01-31 09:36:58 +00:00
|
|
|
|
Vec3f projectedFocusPos;
|
|
|
|
|
f32 cappedInvWDest;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 temp1;
|
|
|
|
|
f32 temp2;
|
|
|
|
|
f32 temp3;
|
|
|
|
|
f32 temp4;
|
|
|
|
|
f32 temp5;
|
|
|
|
|
f32 temp6;
|
|
|
|
|
s32 lockOnSfxId;
|
|
|
|
|
|
|
|
|
|
unkActor = NULL;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_94 = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80032AF0(play, &play->actorCtx, &unkActor, player);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_94 = unkActor;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (targetCtx->unk_8C != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
unkActor = targetCtx->unk_8C;
|
|
|
|
|
targetCtx->unk_8C = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (actorArg != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
unkActor = actorArg;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (unkActor != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCategory = unkActor->category;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCategory = player->actor.category;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if ((unkActor != targetCtx->arrowPointedActor) || (actorCategory != targetCtx->activeCategory)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->arrowPointedActor = unkActor;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
targetCtx->activeCategory = actorCategory;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_40 = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (unkActor == NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
unkActor = &player->actor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
if (Math_StepToF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
temp1 = 0.25f / targetCtx->unk_40;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
temp2 = unkActor->world.pos.x - targetCtx->naviRefPos.x;
|
|
|
|
|
temp3 = (unkActor->world.pos.y + (unkActor->targetArrowOffset * unkActor->scale.y)) - targetCtx->naviRefPos.y;
|
|
|
|
|
temp4 = unkActor->world.pos.z - targetCtx->naviRefPos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->naviRefPos.x += temp2 * temp1;
|
|
|
|
|
targetCtx->naviRefPos.y += temp3 * temp1;
|
|
|
|
|
targetCtx->naviRefPos.z += temp4 * temp1;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_SetNaviToActor(targetCtx, unkActor, actorCategory, play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_ProjectPos(play, &actorArg->focus.pos, &projectedFocusPos, &cappedInvWDest);
|
2022-02-12 23:29:48 +00:00
|
|
|
|
if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * cappedInvWDest))) ||
|
|
|
|
|
(1.0f <= fabsf(projectedFocusPos.y * cappedInvWDest))) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorArg = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorArg != NULL) {
|
|
|
|
|
if (actorArg != targetCtx->targetedActor) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002BE98(targetCtx, actorArg->category, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->targetedActor = actorArg;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorArg->id == ACTOR_EN_BOOM) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_48 = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-06 00:11:38 +00:00
|
|
|
|
lockOnSfxId = CHECK_FLAG_ALL(actorArg->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON
|
|
|
|
|
: NA_SE_SY_LOCK_ON_HUMAN;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_80078884(lockOnSfxId);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
targetCtx->targetCenterPos.x = actorArg->world.pos.x;
|
|
|
|
|
targetCtx->targetCenterPos.y = actorArg->world.pos.y - (actorArg->shape.yOffset * actorArg->scale.y);
|
|
|
|
|
targetCtx->targetCenterPos.z = actorArg->world.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (targetCtx->unk_4B == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
temp5 = (500.0f - targetCtx->unk_44) * 3.0f;
|
|
|
|
|
temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
if (Math_StepToF(&targetCtx->unk_44, 80.0f, temp6) != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_4B++;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->unk_4B = (targetCtx->unk_4B + 3) | 0x80;
|
|
|
|
|
targetCtx->unk_44 = 120.0f;
|
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
targetCtx->targetedActor = NULL;
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_StepToF(&targetCtx->unk_44, 500.0f, 80.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if current scene switch flag is set.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetSwitch(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.swch & (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.tempSwch & (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current scene switch flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetSwitch(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.swch |= (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.tempSwch |= (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unsets current scene switch flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_UnsetSwitch(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.swch &= ~(1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-03-16 21:14:56 +00:00
|
|
|
|
* Tests if unknown flag is set.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetUnknown(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.unk0 & (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.unk1 & (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-03-16 21:14:56 +00:00
|
|
|
|
* Sets unknown flag.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetUnknown(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.unk0 |= (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.unk1 |= (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-03-16 21:14:56 +00:00
|
|
|
|
* Unsets unknown flag.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_UnsetUnknown(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.unk0 &= ~(1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.unk1 &= ~(1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if current scene chest flag is set.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetTreasure(PlayState* play, s32 flag) {
|
|
|
|
|
return play->actorCtx.flags.chest & (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current scene chest flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetTreasure(PlayState* play, s32 flag) {
|
|
|
|
|
play->actorCtx.flags.chest |= (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if current scene clear flag is set.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetClear(PlayState* play, s32 flag) {
|
|
|
|
|
return play->actorCtx.flags.clear & (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current scene clear flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetClear(PlayState* play, s32 flag) {
|
|
|
|
|
play->actorCtx.flags.clear |= (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unsets current scene clear flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_UnsetClear(PlayState* play, s32 flag) {
|
|
|
|
|
play->actorCtx.flags.clear &= ~(1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if current scene temp clear flag is set.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetTempClear(PlayState* play, s32 flag) {
|
|
|
|
|
return play->actorCtx.flags.tempClear & (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current scene temp clear flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetTempClear(PlayState* play, s32 flag) {
|
|
|
|
|
play->actorCtx.flags.tempClear |= (1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unsets current scene temp clear flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_UnsetTempClear(PlayState* play, s32 flag) {
|
|
|
|
|
play->actorCtx.flags.tempClear &= ~(1 << flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if current scene collectible flag is set.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Flags_GetCollectible(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.collect & (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return play->actorCtx.flags.tempCollect & (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current scene collectible flag.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Flags_SetCollectible(PlayState* play, s32 flag) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag != 0) {
|
|
|
|
|
if (flag < 0x20) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.collect |= (1 << flag);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->actorCtx.flags.tempCollect |= (1 << (flag - 0x20));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void TitleCard_Init(PlayState* play, TitleCardContext* titleCtx) {
|
2021-04-05 17:37:46 +00:00
|
|
|
|
titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensity = titleCtx->alpha = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void TitleCard_InitBossName(PlayState* play, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width,
|
2021-04-09 23:02:16 +00:00
|
|
|
|
u8 height) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
titleCtx->texture = texture;
|
2021-04-05 17:37:46 +00:00
|
|
|
|
titleCtx->x = x;
|
|
|
|
|
titleCtx->y = y;
|
|
|
|
|
titleCtx->width = width;
|
|
|
|
|
titleCtx->height = height;
|
|
|
|
|
titleCtx->durationTimer = 80;
|
|
|
|
|
titleCtx->delayTimer = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width,
|
|
|
|
|
s32 height, s32 delay) {
|
|
|
|
|
SceneTableEntry* loadedScene = play->loadedScene;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
u32 size = loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((size != 0) && (size <= 0x3000)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
DmaMgr_SendRequest1(texture, loadedScene->titleFile.vromStart, size, "../z_actor.c", 2765);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
titleCtx->texture = texture;
|
2021-04-05 17:37:46 +00:00
|
|
|
|
titleCtx->x = x;
|
|
|
|
|
titleCtx->y = y;
|
|
|
|
|
titleCtx->width = width;
|
|
|
|
|
titleCtx->height = height;
|
|
|
|
|
titleCtx->durationTimer = 80;
|
|
|
|
|
titleCtx->delayTimer = delay;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void TitleCard_Update(PlayState* play, TitleCardContext* titleCtx) {
|
2021-04-05 17:37:46 +00:00
|
|
|
|
if (DECR(titleCtx->delayTimer) == 0) {
|
|
|
|
|
if (DECR(titleCtx->durationTimer) == 0) {
|
|
|
|
|
Math_StepToS(&titleCtx->alpha, 0, 30);
|
|
|
|
|
Math_StepToS(&titleCtx->intensity, 0, 70);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-05 17:37:46 +00:00
|
|
|
|
Math_StepToS(&titleCtx->alpha, 255, 10);
|
|
|
|
|
Math_StepToS(&titleCtx->intensity, 255, 20);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) {
|
2022-01-31 09:36:58 +00:00
|
|
|
|
s32 width;
|
|
|
|
|
s32 height;
|
|
|
|
|
s32 unused;
|
|
|
|
|
s32 titleX;
|
|
|
|
|
s32 doubleWidth;
|
|
|
|
|
s32 titleY;
|
|
|
|
|
s32 titleSecondY;
|
|
|
|
|
s32 textureLanguageOffset;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-05 17:37:46 +00:00
|
|
|
|
if (titleCtx->alpha != 0) {
|
2022-01-31 09:36:58 +00:00
|
|
|
|
width = titleCtx->width;
|
|
|
|
|
height = titleCtx->height;
|
|
|
|
|
titleX = (titleCtx->x * 4) - (width * 2);
|
|
|
|
|
titleY = (titleCtx->y * 4) - (height * 2);
|
|
|
|
|
doubleWidth = width * 2;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2824);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
textureLanguageOffset = width * height * gSaveContext.language;
|
|
|
|
|
height = (width * height > 0x1000) ? 0x1000 / width : height;
|
|
|
|
|
titleSecondY = titleY + (height * 4);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
OVERLAY_DISP = Gfx_SetupDL_52NoCD(OVERLAY_DISP);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-05 17:37:46 +00:00
|
|
|
|
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
|
|
|
|
|
(u8)titleCtx->alpha);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-12 23:29:48 +00:00
|
|
|
|
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + textureLanguageOffset, G_IM_FMT_IA, G_IM_SIZ_8b,
|
|
|
|
|
width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
|
|
|
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-12 23:29:48 +00:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1,
|
|
|
|
|
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
height = titleCtx->height - height;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-31 09:36:58 +00:00
|
|
|
|
// If texture is bigger than 0x1000, display the rest
|
|
|
|
|
if (height > 0) {
|
2022-02-12 23:29:48 +00:00
|
|
|
|
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + textureLanguageOffset + 0x1000, G_IM_FMT_IA,
|
|
|
|
|
G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
|
|
|
|
|
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-12 23:29:48 +00:00
|
|
|
|
gSPTextureRectangle(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
|
|
|
|
|
titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2880);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 TitleCard_Clear(PlayState* play, TitleCardContext* titleCtx) {
|
|
|
|
|
if ((play->actorCtx.titleCtx.delayTimer != 0) || (play->actorCtx.titleCtx.alpha != 0)) {
|
2021-04-05 17:37:46 +00:00
|
|
|
|
titleCtx->durationTimer = 0;
|
|
|
|
|
titleCtx->delayTimer = 0;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Actor_Kill(Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->draw = NULL;
|
|
|
|
|
actor->update = NULL;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags &= ~ACTOR_FLAG_0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_SetWorldToHome(Actor* actor) {
|
|
|
|
|
actor->world = actor->home;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_SetFocus(Actor* actor, f32 yOffset) {
|
|
|
|
|
actor->focus.pos.x = actor->world.pos.x;
|
|
|
|
|
actor->focus.pos.y = actor->world.pos.y + yOffset;
|
|
|
|
|
actor->focus.pos.z = actor->world.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->focus.rot.x = actor->world.rot.x;
|
|
|
|
|
actor->focus.rot.y = actor->world.rot.y;
|
|
|
|
|
actor->focus.rot.z = actor->world.rot.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_SetWorldRotToShape(Actor* actor) {
|
|
|
|
|
actor->world.rot = actor->shape.rot;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_SetShapeRotToWorld(Actor* actor) {
|
|
|
|
|
actor->shape.rot = actor->world.rot;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Actor_SetScale(Actor* actor, f32 scale) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->scale.z = scale;
|
|
|
|
|
actor->scale.y = scale;
|
|
|
|
|
actor->scale.x = scale;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_SetObjectDependency(PlayState* play, Actor* actor) {
|
|
|
|
|
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_Init(Actor* actor, PlayState* play) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor_SetWorldToHome(actor);
|
|
|
|
|
Actor_SetShapeRotToWorld(actor);
|
|
|
|
|
Actor_SetFocus(actor, 0.0f);
|
|
|
|
|
Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_SetScale(actor, 0.01f);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->targetMode = 3;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->minVelocityY = -20.0f;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->xyzDistToPlayerSq = FLT_MAX;
|
2022-04-18 22:23:12 +00:00
|
|
|
|
actor->naviEnemyId = NAVI_ENEMY_NONE;
|
2020-06-25 01:20:31 +00:00
|
|
|
|
actor->uncullZoneForward = 1000.0f;
|
|
|
|
|
actor->uncullZoneScale = 350.0f;
|
|
|
|
|
actor->uncullZoneDownward = 700.0f;
|
2021-01-18 02:13:36 +00:00
|
|
|
|
CollisionCheck_InitInfo(&actor->colChkInfo);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->floorBgId = BGCHECK_SCENE;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
|
|
|
|
Actor_SetObjectDependency(play, actor);
|
|
|
|
|
actor->init(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->init = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_Destroy(Actor* actor, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
|
char* name;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->destroy != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->destroy(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->destroy = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
overlayEntry = actor->overlayEntry;
|
|
|
|
|
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "No Actor class destruct [%s]"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf("Actorクラス デストラクトがありません [%s]\n" VT_RST, name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-12 11:02:45 +00:00
|
|
|
|
void func_8002D7EC(Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 speedRate = R_UPDATE_RATE * 0.5f;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->world.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x;
|
|
|
|
|
actor->world.pos.y += (actor->velocity.y * speedRate) + actor->colChkInfo.displacement.y;
|
|
|
|
|
actor->world.pos.z += (actor->velocity.z * speedRate) + actor->colChkInfo.displacement.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002D868(Actor* actor) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->velocity.x = Math_SinS(actor->world.rot.y) * actor->speedXZ;
|
|
|
|
|
actor->velocity.z = Math_CosS(actor->world.rot.y) * actor->speedXZ;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actor->velocity.y += actor->gravity;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->velocity.y < actor->minVelocityY) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->velocity.y = actor->minVelocityY;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Actor_MoveForward(Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_8002D868(actor);
|
|
|
|
|
func_8002D7EC(actor);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002D908(Actor* actor) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 sp24 = Math_CosS(actor->world.rot.x) * actor->speedXZ;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->velocity.x = Math_SinS(actor->world.rot.y) * sp24;
|
|
|
|
|
actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ;
|
|
|
|
|
actor->velocity.z = Math_CosS(actor->world.rot.y) * sp24;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002D97C(Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_8002D908(actor);
|
|
|
|
|
func_8002D7EC(actor);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002D9A4(Actor* actor, f32 arg1) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->speedXZ = Math_CosS(actor->world.rot.x) * arg1;
|
|
|
|
|
actor->velocity.y = -Math_SinS(actor->world.rot.x) * arg1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
|
void func_8002D9F8(Actor* actor, SkelAnime* skelAnime) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f sp1C;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
|
SkelAnime_UpdateTranslation(skelAnime, &sp1C, actor->shape.rot.y);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->world.pos.x += sp1C.x * actor->scale.x;
|
|
|
|
|
actor->world.pos.y += sp1C.y * actor->scale.y;
|
|
|
|
|
actor->world.pos.z += sp1C.z * actor->scale.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_Yaw(&actorA->world.pos, &actorB->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_FocusYawTowardActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_Yaw(&actorA->focus.pos, &actorB->focus.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint) {
|
|
|
|
|
return Math_Vec3f_Yaw(&actor->world.pos, refPoint);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_WorldPitchTowardActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_Pitch(&actorA->world.pos, &actorB->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_FocusPitchTowardActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_Pitch(&actorA->focus.pos, &actorB->focus.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
s16 Actor_WorldPitchTowardPoint(Actor* actor, Vec3f* refPoint) {
|
|
|
|
|
return Math_Vec3f_Pitch(&actor->world.pos, refPoint);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 Actor_WorldDistXYZToActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_DistXYZ(&actorA->world.pos, &actorB->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 Actor_WorldDistXYZToPoint(Actor* actor, Vec3f* refPoint) {
|
|
|
|
|
return Math_Vec3f_DistXYZ(&actor->world.pos, refPoint);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 Actor_WorldDistXZToActor(Actor* actorA, Actor* actorB) {
|
|
|
|
|
return Math_Vec3f_DistXZ(&actorA->world.pos, &actorB->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint) {
|
|
|
|
|
return Math_Vec3f_DistXZ(&actor->world.pos, refPoint);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 cosRot2Y;
|
|
|
|
|
f32 sinRot2Y;
|
|
|
|
|
f32 deltaX;
|
|
|
|
|
f32 deltaZ;
|
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
cosRot2Y = Math_CosS(actor->shape.rot.y);
|
|
|
|
|
sinRot2Y = Math_SinS(actor->shape.rot.y);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
deltaX = arg2->x - actor->world.pos.x;
|
|
|
|
|
deltaZ = arg2->z - actor->world.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
result->x = (deltaX * cosRot2Y) - (deltaZ * sinRot2Y);
|
|
|
|
|
result->z = (deltaX * sinRot2Y) + (deltaZ * cosRot2Y);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
result->y = arg2->y - actor->world.pos.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return actorB->world.pos.y - actorA->world.pos.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
f32 Player_GetHeight(Player* player) {
|
2022-01-18 00:04:07 +00:00
|
|
|
|
f32 offset = (player->stateFlags1 & PLAYER_STATE1_23) ? 32.0f : 0.0f;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (LINK_IS_ADULT) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return offset + 68.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return offset + 44.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
f32 func_8002DCE4(Player* player) {
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if (player->stateFlags1 & PLAYER_STATE1_23) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return 8.0f;
|
2022-01-18 00:04:07 +00:00
|
|
|
|
} else if (player->stateFlags1 & PLAYER_STATE1_27) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return R_RUN_SPEED_LIMIT / 100.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 func_8002DD6C(Player* player) {
|
2022-01-18 00:04:07 +00:00
|
|
|
|
return player->stateFlags1 & PLAYER_STATE1_3;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 func_8002DD78(Player* player) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return func_8002DD6C(player) && player->unk_834;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002DDA8(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002DDE4(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
return player->stateFlags2 & PLAYER_STATE2_3;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002DDF4(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
return player->stateFlags2 & PLAYER_STATE2_12;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB) {
|
|
|
|
|
ArmsHook* hookshot = (ArmsHook*)Actor_Find(&play->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-06-17 19:44:22 +00:00
|
|
|
|
hookshot->grabbed = actorB;
|
|
|
|
|
hookshot->grabbedDistDiff.x = 0.0f;
|
|
|
|
|
hookshot->grabbedDistDiff.y = 0.0f;
|
|
|
|
|
hookshot->grabbedDistDiff.z = 0.0f;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actorB->flags |= ACTOR_FLAG_13;
|
|
|
|
|
actorA->flags &= ~ACTOR_FLAG_13;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002DE74(PlayState* play, Player* player) {
|
2022-06-21 00:31:53 +00:00
|
|
|
|
if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && Play_CamIsNotFixed(play)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_HORSE);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
|
2020-09-19 01:45:39 +00:00
|
|
|
|
player->rideActor = horse;
|
2022-01-18 00:04:07 +00:00
|
|
|
|
player->stateFlags1 |= PLAYER_STATE1_23;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
horse->child = &player->actor;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 func_8002DEEC(Player* player) {
|
2022-01-18 00:04:07 +00:00
|
|
|
|
return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csMode != 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002DF18(PlayState* play, Player* player) {
|
|
|
|
|
func_8006DC68(play, player);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
|
|
player->csMode = csMode;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
player->unk_448 = actor;
|
2022-06-17 18:25:42 +00:00
|
|
|
|
player->doorBgCamIndex = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002DF38(play, actor, csMode);
|
2022-06-17 18:25:42 +00:00
|
|
|
|
player->doorBgCamIndex = 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002DF90(DynaPolyActor* dynaActor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
dynaActor->unk_154 = 0.0f;
|
|
|
|
|
dynaActor->unk_150 = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
dynaActor->unk_150 += arg1;
|
|
|
|
|
dynaActor->unk_158 = arg2;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if the player is facing the specified actor.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2021-06-21 23:51:04 +00:00
|
|
|
|
s16 yawDiff = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if `actorB` is facing `actorA`.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
*
|
|
|
|
|
* This function is unused in the original game.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_ActorBIsFacingActorA(Actor* actorA, Actor* actorB, s16 maxAngle) {
|
|
|
|
|
s16 yawDiff = (s16)(Actor_WorldYawTowardActor(actorA, actorB) + 0x8000) - actorB->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if the specified actor is facing the player.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_IsFacingPlayer(Actor* actor, s16 maxAngle) {
|
|
|
|
|
s16 yawDiff = actor->yawTowardsPlayer - actor->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if `actorA` is facing `actorB`.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
*
|
|
|
|
|
* This function is unused in the original game.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_ActorAIsFacingActorB(Actor* actorA, Actor* actorB, s16 maxAngle) {
|
|
|
|
|
s16 yawDiff = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if the specified actor is facing the player and is nearby.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
* The minimum distance that qualifies as "nearby" is specified by `range`.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 maxAngle) {
|
|
|
|
|
s16 yawDiff = actor->yawTowardsPlayer - actor->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (xyzDistanceFromLink < range) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Chcek if `actorA` is facing `actorB` and is nearby.
|
|
|
|
|
* The maximum angle difference that qualifies as "facing" is specified by `maxAngle`.
|
|
|
|
|
* The minimum distance that qualifies as "nearby" is specified by `range`.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 maxAngle) {
|
|
|
|
|
if (Actor_WorldDistXYZToActor(actorA, actorB) < range) {
|
|
|
|
|
s16 yawDiff = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if (ABS(yawDiff) < maxAngle) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && (arg1 < -11.0f)) {
|
|
|
|
|
actor->bgCheckFlags &= ~BGCHECKFLAG_GROUND;
|
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_LEAVE;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-20 23:41:55 +00:00
|
|
|
|
if ((actor->velocity.y < 0.0f) && (arg2 & UPDBGCHECKINFO_FLAG_4)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->velocity.y = 0.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002E2AC(PlayState* play, Actor* actor, Vec3f* arg2, s32 arg3) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 floorHeightDiff;
|
|
|
|
|
s32 floorBgId;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
arg2->y += 50.0f;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->floorHeight = BgCheck_EntityRaycastFloor5(play, &play->colCtx, &actor->floorPoly, &floorBgId, actor, arg2);
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->floorHeight <= BGCHECK_Y_MIN) {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return func_8002E234(actor, BGCHECK_Y_MIN, arg3);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
floorHeightDiff = actor->floorHeight - actor->world.pos.y;
|
|
|
|
|
actor->floorBgId = floorBgId;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (floorHeightDiff >= 0.0f) { // actor is on or below the ground
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_STRICT;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if (actor->bgCheckFlags & BGCHECKFLAG_CEILING) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (floorBgId != sCurCeilingBgId) {
|
|
|
|
|
if (floorHeightDiff > 15.0f) {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_CRUSHED;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->world.pos.x = actor->prevPos.x;
|
|
|
|
|
actor->world.pos.z = actor->prevPos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->world.pos.y = actor->floorHeight;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->velocity.y <= 0.0f) {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH;
|
2022-02-20 23:41:55 +00:00
|
|
|
|
} else if ((arg3 & UPDBGCHECKINFO_FLAG_3) && (actor->gravity < 0.0f)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->velocity.y = -4.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->velocity.y = 0.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_GROUND;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80043334(&play->colCtx, actor, actor->floorBgId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2021-01-18 21:04:04 +00:00
|
|
|
|
} else { // actor is above ground
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && (floorHeightDiff >= -11.0f)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80043334(&play->colCtx, actor, actor->floorBgId);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return func_8002E234(actor, floorHeightDiff, arg3);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius,
|
2021-06-21 23:51:04 +00:00
|
|
|
|
f32 ceilingCheckHeight, s32 flags) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 sp74;
|
|
|
|
|
s32 pad;
|
|
|
|
|
Vec3f sp64;
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
s32 bgId;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
CollisionPoly* wallPoly;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 sp58;
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
WaterBox* waterBox;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 waterBoxYSurface;
|
2020-09-30 00:18:46 +00:00
|
|
|
|
Vec3f ripplePos;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp74 = actor->world.pos.y - actor->prevPos.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_800433A4(&play->colCtx, actor->floorBgId, actor);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-20 23:41:55 +00:00
|
|
|
|
if (flags & UPDBGCHECKINFO_FLAG_0) {
|
|
|
|
|
if ((!(flags & UPDBGCHECKINFO_FLAG_7) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
BgCheck_EntitySphVsWall3(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius,
|
2021-06-21 23:51:04 +00:00
|
|
|
|
&actor->wallPoly, &bgId, actor, wallCheckHeight)) ||
|
2022-02-20 23:41:55 +00:00
|
|
|
|
((flags & UPDBGCHECKINFO_FLAG_7) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
BgCheck_EntitySphVsWall4(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius,
|
2021-06-21 23:51:04 +00:00
|
|
|
|
&actor->wallPoly, &bgId, actor, wallCheckHeight))) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
wallPoly = actor->wallPoly;
|
|
|
|
|
Math_Vec3f_Copy(&actor->world.pos, &sp64);
|
|
|
|
|
actor->wallYaw = Math_Atan2S(wallPoly->normal.z, wallPoly->normal.x);
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_WALL;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->wallBgId = bgId;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags &= ~BGCHECKFLAG_WALL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp64.x = actor->world.pos.x;
|
|
|
|
|
sp64.z = actor->world.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-20 23:41:55 +00:00
|
|
|
|
if (flags & UPDBGCHECKINFO_FLAG_1) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp64.y = actor->prevPos.y + 10.0f;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (BgCheck_EntityCheckCeiling(&play->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f,
|
2021-06-21 23:51:04 +00:00
|
|
|
|
&sCurCeilingPoly, &sCurCeilingBgId, actor)) {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_CEILING;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->world.pos.y = (sp58 + sp74) - 10.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags &= ~BGCHECKFLAG_CEILING;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-20 23:41:55 +00:00
|
|
|
|
if (flags & UPDBGCHECKINFO_FLAG_2) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp64.y = actor->prevPos.y;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002E2AC(play, actor, &sp64, flags);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
waterBoxYSurface = actor->world.pos.y;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &waterBoxYSurface,
|
|
|
|
|
&waterBox)) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->yDistToWater = waterBoxYSurface - actor->world.pos.y;
|
2020-12-31 20:00:30 +00:00
|
|
|
|
if (actor->yDistToWater < 0.0f) {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) {
|
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_WATER_TOUCH;
|
2022-02-20 23:41:55 +00:00
|
|
|
|
if (!(flags & UPDBGCHECKINFO_FLAG_6)) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
ripplePos.x = actor->world.pos.x;
|
|
|
|
|
ripplePos.y = waterBoxYSurface;
|
|
|
|
|
ripplePos.z = actor->world.pos.z;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0);
|
|
|
|
|
EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 4);
|
|
|
|
|
EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 8);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags |= BGCHECKFLAG_WATER;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-02-19 02:16:19 +00:00
|
|
|
|
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
actor->yDistToWater = BGCHECK_Y_MIN;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
|
Mtx D_8015BBA8;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite) {
|
2021-02-14 00:49:40 +00:00
|
|
|
|
LookAt* lookAt;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 correctedEyeX;
|
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
|
lookAt = Graph_Alloc(gfxCtx, sizeof(LookAt));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
correctedEyeX = (eye->x == object->x) && (eye->z == object->z) ? eye->x + 0.001f : eye->x;
|
|
|
|
|
|
|
|
|
|
*hilite = Graph_Alloc(gfxCtx, sizeof(Hilite));
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(80) == 6) {
|
2020-10-13 16:32:19 +00:00
|
|
|
|
osSyncPrintf("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX,
|
|
|
|
|
eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-04-08 22:50:28 +00:00
|
|
|
|
View_ErrorCheckEyePosition(correctedEyeX, eye->y, eye->z);
|
2020-04-22 17:20:49 +00:00
|
|
|
|
guLookAtHilite(&D_8015BBA8, lookAt, *hilite, correctedEyeX, eye->y, eye->z, object->x, object->y, object->z, 0.0f,
|
|
|
|
|
1.0f, 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 0x10,
|
|
|
|
|
0x10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
gSPLookAt(gfx++, lookAt);
|
|
|
|
|
gDPSetHilite1Tile(gfx++, 1, *hilite, 0x10, 0x10);
|
|
|
|
|
|
|
|
|
|
return gfx;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Hilite* hilite;
|
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
OPEN_DISPS(gfxCtx, "../z_actor.c", 4306);
|
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
POLY_OPA_DISP = func_8002E830(object, eye, lightDir, gfxCtx, POLY_OPA_DISP, &hilite);
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_actor.c", 4313);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return hilite;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Hilite* hilite;
|
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
OPEN_DISPS(gfxCtx, "../z_actor.c", 4332);
|
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
POLY_XLU_DISP = func_8002E830(object, eye, lightDir, gfxCtx, POLY_XLU_DISP, &hilite);
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_actor.c", 4339);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return hilite;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002EBCC(Actor* actor, PlayState* play, s32 flag) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Hilite* hilite;
|
|
|
|
|
Vec3f lightDir;
|
|
|
|
|
Gfx* displayListHead;
|
|
|
|
|
Gfx* displayList;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
lightDir.x = play->envCtx.dirLight1.params.dir.x;
|
|
|
|
|
lightDir.y = play->envCtx.dirLight1.params.dir.y;
|
|
|
|
|
lightDir.z = play->envCtx.dirLight1.params.dir.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(80) == 6) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", play->view.eye.x, play->view.eye.y,
|
|
|
|
|
play->view.eye.z);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
hilite = func_8002EABC(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag != 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
displayListHead = displayList;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 4384);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10);
|
|
|
|
|
gSPEndDisplayList(displayListHead);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x07, displayList);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 4394);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002ED80(Actor* actor, PlayState* play, s32 flag) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Hilite* hilite;
|
|
|
|
|
Vec3f lightDir;
|
|
|
|
|
Gfx* displayListHead;
|
|
|
|
|
Gfx* displayList;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
lightDir.x = play->envCtx.dirLight1.params.dir.x;
|
|
|
|
|
lightDir.y = play->envCtx.dirLight1.params.dir.y;
|
|
|
|
|
lightDir.z = play->envCtx.dirLight1.params.dir.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
hilite = func_8002EB44(&actor->world.pos, &play->view.eye, &lightDir, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (flag != 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
displayList = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Gfx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
displayListHead = displayList;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 4429);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10);
|
|
|
|
|
gSPEndDisplayList(displayListHead);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x07, displayList);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 4439);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
PosRot* Actor_GetFocus(PosRot* dest, Actor* actor) {
|
|
|
|
|
*dest = actor->focus;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return dest;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
PosRot* Actor_GetWorld(PosRot* dest, Actor* actor) {
|
|
|
|
|
*dest = actor->world;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return dest;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
PosRot sp1C;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Math_Vec3f_Copy(&sp1C.pos, &actor->world.pos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
sp1C.rot = actor->shape.rot;
|
|
|
|
|
*arg0 = sp1C;
|
|
|
|
|
|
|
|
|
|
return arg0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
s16 yawTemp = (s16)(actor->yawTowardsPlayer - 0x8000) - arg2;
|
|
|
|
|
s16 yawTempAbs = ABS(yawTemp);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (player->unk_664 != NULL) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return FLT_MAX;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
f32 ret =
|
|
|
|
|
actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawTempAbs) * (1.0f / 0x8000));
|
2021-11-30 23:40:42 +00:00
|
|
|
|
|
2020-07-05 15:51:48 +00:00
|
|
|
|
return ret;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-05 15:51:48 +00:00
|
|
|
|
if (yawTempAbs > 0x2AAA) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return FLT_MAX;
|
2020-03-23 23:11:21 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return actor->xyzDistToPlayerSq;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
typedef struct {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
/* 0x0 */ f32 rangeSq;
|
|
|
|
|
/* 0x4 */ f32 leashScale;
|
|
|
|
|
} TargetRangeParams; // size = 0x8
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 02:13:36 +00:00
|
|
|
|
#define TARGET_RANGE(range, leash) \
|
|
|
|
|
{ SQ(range), (f32)range / leash }
|
|
|
|
|
|
|
|
|
|
TargetRangeParams D_80115FF8[] = {
|
|
|
|
|
TARGET_RANGE(70, 140), TARGET_RANGE(170, 255), TARGET_RANGE(280, 5600), TARGET_RANGE(350, 525),
|
|
|
|
|
TARGET_RANGE(700, 1050), TARGET_RANGE(1000, 1500), TARGET_RANGE(100, 105.36842), TARGET_RANGE(140, 163.33333),
|
|
|
|
|
TARGET_RANGE(240, 576), TARGET_RANGE(280, 280000),
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
u32 func_8002F090(Actor* actor, f32 arg1) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return arg1 < D_80115FF8[actor->targetMode].rangeSq;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (!flag) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
s16 var = (s16)(actor->yawTowardsPlayer - 0x8000) - player->actor.shape.rot.y;
|
|
|
|
|
s16 abs_var = ABS(var);
|
|
|
|
|
f32 dist;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
dist = FLT_MAX;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
dist = actor->xyzDistToPlayerSq;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return !func_8002F090(actor, D_80115FF8[actor->targetMode].leashScale * dist);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 Actor_ProcessTalkRequest(Actor* actor, PlayState* play) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if (actor->flags & ACTOR_FLAG_8) {
|
|
|
|
|
actor->flags &= ~ACTOR_FLAG_8;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchangeItemId) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) ||
|
2021-01-18 21:04:04 +00:00
|
|
|
|
(!actor->isTargeted &&
|
|
|
|
|
((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) ||
|
|
|
|
|
(arg2 < actor->xzDistToPlayer)))) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
|
player->targetActor = actor;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
player->targetActorDistance = actor->xzDistToPlayer;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
player->exchangeItemId = exchangeItemId;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F298(Actor* actor, PlayState* play, f32 arg2, u32 exchangeItemId) {
|
|
|
|
|
return func_8002F1C4(actor, play, arg2, arg2, exchangeItemId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F2CC(Actor* actor, PlayState* play, f32 arg2) {
|
|
|
|
|
return func_8002F298(actor, play, arg2, EXCH_ITEM_NONE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F2F4(Actor* actor, PlayState* play) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
f32 var1 = 50.0f + actor->colChkInfo.cylRadius;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return func_8002F2CC(actor, play, var1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) {
|
|
|
|
|
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s8 func_8002F368(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return player->exchangeItemId;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) {
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
Vec3f projectedPos;
|
2022-01-31 09:36:58 +00:00
|
|
|
|
f32 cappedInvW;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_ProjectPos(play, &actor->focus.pos, &projectedPos, &cappedInvW);
|
2022-01-31 09:36:58 +00:00
|
|
|
|
*x = projectedPos.x * cappedInvW * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2);
|
|
|
|
|
*y = projectedPos.y * cappedInvW * -(SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 Actor_HasParent(Actor* actor, PlayState* play) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
if (actor->parent != NULL) {
|
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
|
|
|
|
|
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) &&
|
|
|
|
|
Player_GetExplosiveHeld(player) < 0) {
|
2020-09-19 01:45:39 +00:00
|
|
|
|
if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) &&
|
|
|
|
|
(getItemId < GI_MAX)) ||
|
2022-01-18 00:04:07 +00:00
|
|
|
|
(!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
|
|
|
|
|
s32 absYawDiff = ABS(yawDiff);
|
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
|
if ((getItemId != GI_NONE) || (player->getItemDirection < absYawDiff)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
player->getItemId = getItemId;
|
|
|
|
|
player->interactRangeActor = actor;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
player->getItemDirection = absYawDiff;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F554(Actor* actor, PlayState* play, s32 getItemId) {
|
|
|
|
|
func_8002F434(actor, play, getItemId, 50.0f, 10.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F580(Actor* actor, PlayState* play) {
|
|
|
|
|
func_8002F554(actor, play, GI_NONE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 Actor_HasNoParent(Actor* actor, PlayState* play) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
if (actor->parent == NULL) {
|
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
Actor* parent = actorA->parent;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-29 22:25:16 +00:00
|
|
|
|
if (parent->id == ACTOR_PLAYER) {
|
|
|
|
|
Player* player = (Player*)parent;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
player->heldActor = actorB;
|
|
|
|
|
player->interactRangeActor = actorB;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-29 22:25:16 +00:00
|
|
|
|
parent->child = actorB;
|
|
|
|
|
actorB->parent = parent;
|
|
|
|
|
actorA->parent = NULL;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F5F0(Actor* actor, PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->xyzDistToPlayerSq < player->unk_6A4) {
|
|
|
|
|
player->unk_6A4 = actor->xyzDistToPlayerSq;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Actor_IsMounted(PlayState* play, Actor* horse) {
|
2021-04-12 01:23:40 +00:00
|
|
|
|
if (horse->child != NULL) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if (!(player->stateFlags1 &
|
|
|
|
|
(PLAYER_STATE1_7 | PLAYER_STATE1_11 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
|
|
|
|
|
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21))) {
|
2020-09-19 01:45:39 +00:00
|
|
|
|
player->rideActor = horse;
|
2021-04-12 01:23:40 +00:00
|
|
|
|
player->mountSide = mountSide;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Actor_NotMounted(PlayState* play, Actor* horse) {
|
2021-04-12 01:23:40 +00:00
|
|
|
|
if (horse->child == NULL) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
player->unk_8A0 = arg6;
|
|
|
|
|
player->unk_8A1 = arg5;
|
|
|
|
|
player->unk_8A2 = arg3;
|
|
|
|
|
player->unk_8A4 = arg2;
|
|
|
|
|
player->unk_8A8 = arg4;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) {
|
|
|
|
|
func_8002F698(play, actor, arg2, arg3, arg4, 2, arg5);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) {
|
|
|
|
|
func_8002F6D4(play, actor, arg2, arg3, arg4, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) {
|
|
|
|
|
func_8002F698(play, actor, arg2, arg3, arg4, 1, arg5);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) {
|
|
|
|
|
func_8002F758(play, actor, arg2, arg3, arg4, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002F7DC(Actor* actor, u16 sfxId) {
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlaySfxGeneral(sfxId, &actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-07-30 13:05:27 +00:00
|
|
|
|
void Audio_PlayActorSfx2(Actor* actor, u16 sfxId) {
|
2020-06-25 01:20:31 +00:00
|
|
|
|
func_80078914(&actor->projectedPos, sfxId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002F850(PlayState* play, Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 sfxId;
|
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
if (actor->bgCheckFlags & BGCHECKFLAG_WATER) {
|
2020-12-31 20:00:30 +00:00
|
|
|
|
if (actor->yDistToWater < 20.0f) {
|
2020-07-05 03:30:21 +00:00
|
|
|
|
sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-07-05 03:30:21 +00:00
|
|
|
|
sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-06-25 01:20:31 +00:00
|
|
|
|
func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND);
|
2020-07-05 03:30:21 +00:00
|
|
|
|
func_80078914(&actor->projectedPos, sfxId + SFX_FLAG);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002F8F0(Actor* actor, u16 sfxId) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
actor->sfx = sfxId;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_19;
|
|
|
|
|
actor->flags &= ~(ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002F91C(Actor* actor, u16 sfxId) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
actor->sfx = sfxId;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_20;
|
|
|
|
|
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002F948(Actor* actor, u16 sfxId) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
actor->sfx = sfxId;
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_21;
|
|
|
|
|
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_28);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_8002F974(Actor* actor, u16 sfxId) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
2020-06-14 04:09:51 +00:00
|
|
|
|
actor->sfx = sfxId;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-05 03:30:21 +00:00
|
|
|
|
void func_8002F994(Actor* actor, s32 arg1) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_28;
|
|
|
|
|
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21);
|
2020-07-05 03:30:21 +00:00
|
|
|
|
if (arg1 < 40) {
|
|
|
|
|
actor->sfx = NA_SE_PL_WALK_DIRT - SFX_FLAG;
|
|
|
|
|
} else if (arg1 < 100) {
|
|
|
|
|
actor->sfx = NA_SE_PL_WALK_CONCRETE - SFX_FLAG;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-07-05 03:30:21 +00:00
|
|
|
|
actor->sfx = NA_SE_PL_WALK_SAND - SFX_FLAG;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
// Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) {
|
|
|
|
|
if (func_80041D4C(&play->colCtx, poly, bgId) == 8) {
|
|
|
|
|
play->roomCtx.unk_74[0] = 1;
|
|
|
|
|
CollisionCheck_BlueBlood(play, NULL, pos);
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlayActorSfx2(actor, NA_SE_IT_WALL_HIT_BUYO);
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Local data used for Farore's Wind light (stored in BSS, possibly a struct?)
|
2020-09-05 13:45:10 +00:00
|
|
|
|
LightInfo D_8015BC00;
|
|
|
|
|
LightNode* D_8015BC10;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 D_8015BC14;
|
|
|
|
|
f32 D_8015BC18;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8002FA60(PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f lightPos;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (gSaveContext.fw.set) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0x28;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = gSaveContext.fw.pos.x;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = gSaveContext.fw.pos.y;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = gSaveContext.fw.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].yaw = gSaveContext.fw.yaw;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = gSaveContext.fw.playerParams;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex = gSaveContext.fw.entranceIndex;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex = gSaveContext.fw.roomIndex;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].tempSwchFlags = gSaveContext.fw.tempSwchFlags;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].tempCollectFlags = gSaveContext.fw.tempCollectFlags;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = 0.0f;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = 0.0f;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lightPos.x = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x;
|
|
|
|
|
lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f;
|
|
|
|
|
lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z;
|
|
|
|
|
|
2020-09-05 13:45:10 +00:00
|
|
|
|
Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
D_8015BC10 = LightContext_InsertLight(play, &play->lightCtx, &D_8015BC00);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BC14 = 0;
|
|
|
|
|
D_8015BC18 = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_DrawFaroresWindPointer(PlayState* play) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
s32 lightRadius = -1;
|
|
|
|
|
s32 params;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 5308);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
params = gSaveContext.respawn[RESPAWN_MODE_TOP].data;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
if (params) {
|
|
|
|
|
f32 yOffset = LINK_IS_ADULT ? 80.0f : 60.0f;
|
|
|
|
|
f32 ratio = 1.0f;
|
|
|
|
|
s32 alpha = 255;
|
|
|
|
|
s32 temp = params - 40;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
if (temp < 0) {
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = ++params;
|
|
|
|
|
ratio = ABS(params) * 0.025f;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BC14 = 60;
|
|
|
|
|
D_8015BC18 = 1.0f;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
} else if (D_8015BC14) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BC14--;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (D_8015BC18 > 0.0f) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
static Vec3f effectVel = { 0.0f, -0.05f, 0.0f };
|
|
|
|
|
static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f };
|
|
|
|
|
static Color_RGBA8 effectPrimCol = { 255, 255, 255, 0 };
|
|
|
|
|
static Color_RGBA8 effectEnvCol = { 100, 200, 0, 0 };
|
|
|
|
|
Vec3f* curPos = &gSaveContext.respawn[RESPAWN_MODE_TOP].pos;
|
|
|
|
|
Vec3f* nextPos = &gSaveContext.respawn[RESPAWN_MODE_DOWN].pos;
|
|
|
|
|
f32 prevNum = D_8015BC18;
|
|
|
|
|
Vec3f dist;
|
|
|
|
|
f32 diff = Math_Vec3f_DistXYZAndStoreDiff(nextPos, curPos, &dist);
|
|
|
|
|
Vec3f effectPos;
|
|
|
|
|
f32 factor;
|
|
|
|
|
f32 length;
|
|
|
|
|
f32 dx;
|
|
|
|
|
f32 speed;
|
|
|
|
|
|
|
|
|
|
if (diff < 20.0f) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BC18 = 0.0f;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
Math_Vec3f_Copy(curPos, nextPos);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
length = diff * (1.0f / D_8015BC18);
|
|
|
|
|
speed = 20.0f / length;
|
|
|
|
|
speed = CLAMP_MIN(speed, 0.05f);
|
|
|
|
|
Math_StepToF(&D_8015BC18, 0.0f, speed);
|
|
|
|
|
factor = (diff * (D_8015BC18 / prevNum)) / diff;
|
|
|
|
|
curPos->x = nextPos->x + (dist.x * factor);
|
|
|
|
|
curPos->y = nextPos->y + (dist.y * factor);
|
|
|
|
|
curPos->z = nextPos->z + (dist.z * factor);
|
|
|
|
|
length *= 0.5f;
|
|
|
|
|
dx = diff - length;
|
|
|
|
|
yOffset += sqrtf(SQ(length) - SQ(dx)) * 0.2f;
|
|
|
|
|
osSyncPrintf("-------- DISPLAY Y=%f\n", yOffset);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
effectPos.x = curPos->x + Rand_CenteredFloat(6.0f);
|
|
|
|
|
effectPos.y = curPos->y + 80.0f + (6.0f * Rand_ZeroOne());
|
|
|
|
|
effectPos.z = curPos->z + Rand_CenteredFloat(6.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVel, &effectAccel, &effectPrimCol, &effectEnvCol,
|
|
|
|
|
1000, 16);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (D_8015BC18 == 0.0f) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP] = gSaveContext.respawn[RESPAWN_MODE_DOWN];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = 0x06FF;
|
2021-04-14 23:10:03 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 40;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos = *curPos;
|
|
|
|
|
} else if (temp > 0) {
|
|
|
|
|
Vec3f* curPos = &gSaveContext.respawn[RESPAWN_MODE_TOP].pos;
|
|
|
|
|
f32 nextRatio = 1.0f - temp * 0.1f;
|
|
|
|
|
f32 curRatio = 1.0f - (f32)(temp - 1) * 0.1f;
|
|
|
|
|
Vec3f eye;
|
|
|
|
|
Vec3f dist;
|
|
|
|
|
f32 diff;
|
|
|
|
|
|
|
|
|
|
if (nextRatio > 0.0f) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
eye.x = play->view.eye.x;
|
|
|
|
|
eye.y = play->view.eye.y - yOffset;
|
|
|
|
|
eye.z = play->view.eye.z;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
diff = Math_Vec3f_DistXYZAndStoreDiff(&eye, curPos, &dist);
|
|
|
|
|
diff = (diff * (nextRatio / curRatio)) / diff;
|
|
|
|
|
curPos->x = eye.x + (dist.x * diff);
|
|
|
|
|
curPos->y = eye.y + (dist.y * diff);
|
|
|
|
|
curPos->z = eye.z + (dist.z * diff);
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].pos = *curPos;
|
2021-04-14 23:10:03 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
alpha = 255 - (temp * 30);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
if (alpha < 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSaveContext.fw.set = 0;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0;
|
2021-09-19 02:45:41 +00:00
|
|
|
|
alpha = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_TOP].data = ++params;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
ratio = 1.0f + ((f32)temp * 0.2); // required to match
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
lightRadius = 500.0f * ratio;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((play->csCtx.state == CS_STATE_IDLE) &&
|
2021-09-19 02:45:41 +00:00
|
|
|
|
(((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex) ==
|
|
|
|
|
((void)0, gSaveContext.entranceIndex)) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
(((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex) == play->roomCtx.curRoom.num)) {
|
2021-09-19 02:45:41 +00:00
|
|
|
|
f32 scale = 0.025f * ratio;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_25);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
|
|
|
|
|
Matrix_Translate(((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x),
|
|
|
|
|
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset,
|
|
|
|
|
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), MTXMODE_NEW);
|
|
|
|
|
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
Matrix_Push();
|
|
|
|
|
|
|
|
|
|
gDPPipeSync(POLY_XLU_DISP++);
|
|
|
|
|
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, alpha);
|
|
|
|
|
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255);
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Matrix_RotateZ(BINANG_TO_RAD_ALT2((play->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY);
|
|
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 5458),
|
2021-09-19 02:45:41 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
|
|
|
|
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
|
|
|
|
|
|
|
|
|
|
Matrix_Pop();
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Matrix_RotateZ(BINANG_TO_RAD_ALT2(~((play->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 5463),
|
2021-09-19 02:45:41 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
|
|
|
|
gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL);
|
2021-04-14 23:10:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-19 02:45:41 +00:00
|
|
|
|
Lights_PointNoGlowSetInfo(&D_8015BC00, ((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x),
|
|
|
|
|
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset,
|
|
|
|
|
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), 255, 255, 255, lightRadius);
|
2021-04-14 23:10:03 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 5474);
|
2021-09-19 02:45:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80030488(PlayState* play) {
|
|
|
|
|
LightContext_RemoveLight(play, &play->lightCtx, D_8015BC10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_DisableLens(PlayState* play) {
|
|
|
|
|
if (play->actorCtx.lensActive) {
|
|
|
|
|
play->actorCtx.lensActive = false;
|
2022-05-23 16:52:01 +00:00
|
|
|
|
Magic_Reset(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
// Actor_InitContext
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorOverlay* overlayEntry;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
SavedSceneFlags* savedSceneFlags;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
savedSceneFlags = &gSaveContext.sceneFlags[play->sceneNum];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
bzero(actorCtx, sizeof(*actorCtx));
|
|
|
|
|
|
|
|
|
|
ActorOverlayTable_Init();
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Matrix_MtxFCopy(&play->billboardMtxF, &gMtxFClear);
|
|
|
|
|
Matrix_MtxFCopy(&play->viewProjectionMtxF, &gMtxFClear);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
overlayEntry = &gActorOverlayTable[0];
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
overlayEntry->loadedRamAddr = NULL;
|
2021-08-15 23:15:58 +00:00
|
|
|
|
overlayEntry->numLoaded = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
overlayEntry++;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
actorCtx->flags.chest = savedSceneFlags->chest;
|
|
|
|
|
actorCtx->flags.swch = savedSceneFlags->swch;
|
|
|
|
|
actorCtx->flags.clear = savedSceneFlags->clear;
|
|
|
|
|
actorCtx->flags.collect = savedSceneFlags->collect;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
TitleCard_Init(play, &actorCtx->titleCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actorCtx->absoluteSpace = NULL;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_SpawnEntry(actorCtx, actorEntry, play);
|
|
|
|
|
func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play);
|
|
|
|
|
func_8002FA60(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-17 20:30:30 +00:00
|
|
|
|
u32 D_80116068[ACTORCAT_MAX] = {
|
2022-01-18 00:04:07 +00:00
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
|
|
|
|
0,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
|
|
|
|
|
PLAYER_STATE1_7,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
|
|
|
|
|
PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
|
|
|
|
0,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
|
|
|
|
|
0,
|
|
|
|
|
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor* refActor;
|
|
|
|
|
Actor* actor;
|
|
|
|
|
Player* player;
|
|
|
|
|
u32* sp80;
|
|
|
|
|
u32 unkFlag;
|
|
|
|
|
u32 unkCondition;
|
|
|
|
|
Actor* sp74;
|
|
|
|
|
ActorEntry* actorEntry;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (0) {
|
2021-04-29 18:39:46 +00:00
|
|
|
|
// This ASSERT is optimized out but it exists due to its presence in rodata
|
|
|
|
|
ASSERT(gMaxActorId == ACTOR_ID_MAX, "MaxProfile == ACTOR_DLF_MAX", "../z_actor.c", UNK_LINE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sp74 = NULL;
|
|
|
|
|
unkFlag = 0;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (play->numSetupActors != 0) {
|
|
|
|
|
actorEntry = &play->setupActorList[0];
|
|
|
|
|
for (i = 0; i < play->numSetupActors; i++) {
|
|
|
|
|
Actor_SpawnEntry(&play->actorCtx, actorEntry++, play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->numSetupActors = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorCtx->unk_02 != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorCtx->unk_02--;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (KREG(0) == -100) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
refActor = &GET_PLAYER(play)->actor;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
KREG(0) = 0;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, refActor->world.pos.y + 100.0f,
|
|
|
|
|
refActor->world.pos.z, 0, 0, 0, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sp80 = &D_80116068[0];
|
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if (player->stateFlags2 & PLAYER_STATE2_27) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
unkFlag = ACTOR_FLAG_25;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
|
sp74 = player->targetActor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, sp80++) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
unkCondition = (*sp80 & player->stateFlags1);
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor = actorCtx->actorLists[i].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->world.pos.y < -25000.0f) {
|
|
|
|
|
actor->world.pos.y = -25000.0f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-06-14 04:09:51 +00:00
|
|
|
|
actor->sfx = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->init != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
|
|
|
|
Actor_SetObjectDependency(play, actor);
|
|
|
|
|
actor->init(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->init = NULL;
|
|
|
|
|
}
|
|
|
|
|
actor = actor->next;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_Kill(actor);
|
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if ((unkFlag && !(actor->flags & unkFlag)) ||
|
2020-09-19 01:45:39 +00:00
|
|
|
|
(!unkFlag && unkCondition && (sp74 != actor) && (actor != player->naviActor) &&
|
2020-08-29 22:25:16 +00:00
|
|
|
|
(actor != player->heldActor) && (&player->actor != actor->parent))) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
CollisionCheck_ResetDamage(&actor->colChkInfo);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (actor->update == NULL) {
|
2020-06-25 01:20:31 +00:00
|
|
|
|
if (!actor->isDrawn) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor = Actor_Delete(&play->actorCtx, actor, play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Destroy(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos);
|
|
|
|
|
actor->xzDistToPlayer = Actor_WorldDistXZToActor(actor, &player->actor);
|
|
|
|
|
actor->yDistToPlayer = Actor_HeightDiff(actor, &player->actor);
|
|
|
|
|
actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor);
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags &= ~ACTOR_FLAG_24;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor == player->unk_664) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->isTargeted = true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->isTargeted = false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if ((actor->targetPriority != 0) && (player->unk_664 == NULL)) {
|
|
|
|
|
actor->targetPriority = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_SetObjectDependency(play, actor);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->colorFilterTimer != 0) {
|
|
|
|
|
actor->colorFilterTimer--;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->update(actor, play);
|
2022-06-25 13:53:26 +00:00
|
|
|
|
DynaPoly_UnsetAllInteractFlags(play, &play->colCtx.dyna, actor);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 02:13:36 +00:00
|
|
|
|
CollisionCheck_ResetDamage(&actor->colChkInfo);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (i == ACTORCAT_BG) {
|
2022-06-25 13:53:26 +00:00
|
|
|
|
DynaPoly_UpdateContext(play, &play->colCtx.dyna);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor = player->unk_664;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((actor != NULL) && (actor->update == NULL)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = NULL;
|
|
|
|
|
func_8008EDF0(player);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((actor == NULL) || (player->unk_66C < 5)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorCtx->targetCtx.unk_4B != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorCtx->targetCtx.unk_4B = 0;
|
|
|
|
|
func_80078884(NA_SE_SY_LOCK_OFF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002C7BC(&actorCtx->targetCtx, player, actor, play);
|
|
|
|
|
TitleCard_Update(play, &actorCtx->titleCtx);
|
|
|
|
|
DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Actor_FaultPrint(Actor* actor, char* command) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
|
char* name;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((actor == NULL) || (actor->overlayEntry == NULL)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
FaultDrawer_SetCursor(48, 24);
|
|
|
|
|
FaultDrawer_Printf("ACTOR NAME is NULL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
overlayEntry = actor->overlayEntry;
|
|
|
|
|
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("アクターの名前(%08x:%s)\n", actor, name); // "Actor name (%08x:%s)"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (command != NULL) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("コメント:%s\n", command); // "Command:%s"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
FaultDrawer_SetCursor(48, 24);
|
|
|
|
|
FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_Draw(PlayState* play, Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
FaultClient faultClient;
|
2020-09-05 13:45:10 +00:00
|
|
|
|
Lights* lights;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw");
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 6035);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
|
|
|
|
|
Lights_Draw(lights, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if (actor->flags & ACTOR_FLAG_12) {
|
2022-06-24 23:45:05 +00:00
|
|
|
|
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x,
|
|
|
|
|
actor->world.pos.y +
|
|
|
|
|
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
|
|
|
|
|
actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-01-10 23:28:01 +00:00
|
|
|
|
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
|
|
|
|
actor->world.pos.z, &actor->shape.rot);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_SetObjectDependency(play, actor);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
|
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->colorFilterTimer != 0) {
|
2021-08-08 11:28:28 +00:00
|
|
|
|
Color_RGBA8 color = { 0, 0, 0, 255 };
|
2020-09-30 00:18:46 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->colorFilterParams & 0x8000) {
|
2021-08-08 11:28:28 +00:00
|
|
|
|
color.r = color.g = color.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
} else if (actor->colorFilterParams & 0x4000) {
|
2021-08-08 11:28:28 +00:00
|
|
|
|
color.r = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-08-08 11:28:28 +00:00
|
|
|
|
color.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->colorFilterParams & 0x2000) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80026860(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80026400(play, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->draw(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->colorFilterTimer != 0) {
|
|
|
|
|
if (actor->colorFilterParams & 0x2000) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80026A6C(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80026608(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->shape.shadowDraw != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->shape.shadowDraw(actor, lights, play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6119);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
Fault_RemoveClient(&faultClient);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_80030ED8(Actor* actor) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if (actor->flags & ACTOR_FLAG_19) {
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlaySfxGeneral(actor->sfx, &actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
2021-12-06 00:11:38 +00:00
|
|
|
|
} else if (actor->flags & ACTOR_FLAG_20) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
func_80078884(actor->sfx);
|
2021-12-06 00:11:38 +00:00
|
|
|
|
} else if (actor->flags & ACTOR_FLAG_21) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
func_800788CC(actor->sfx);
|
2021-12-06 00:11:38 +00:00
|
|
|
|
} else if (actor->flags & ACTOR_FLAG_28) {
|
2022-04-23 14:55:18 +00:00
|
|
|
|
func_800F4C58(&gSfxDefaultPos, NA_SE_SY_TIMER - SFX_FLAG, (s8)(actor->sfx - 1));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-06-25 01:20:31 +00:00
|
|
|
|
func_80078914(&actor->projectedPos, actor->sfx);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
#define LENS_MASK_WIDTH 64
|
|
|
|
|
#define LENS_MASK_HEIGHT 64
|
|
|
|
|
// 26 and 6 are for padding between the mask texture and the screen borders
|
|
|
|
|
#define LENS_MASK_OFFSET_S ((SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) - 26)
|
|
|
|
|
#define LENS_MASK_OFFSET_T ((SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) - 6)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) {
|
|
|
|
|
OPEN_DISPS(gfxCtx, "../z_actor.c", 6161);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, LENS_MASK_WIDTH,
|
|
|
|
|
LENS_MASK_HEIGHT, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD,
|
|
|
|
|
G_TX_NOLOD);
|
|
|
|
|
|
|
|
|
|
gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, (SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2,
|
|
|
|
|
(SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, (SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1) << 2,
|
|
|
|
|
(SCREEN_HEIGHT / 2 + LENS_MASK_HEIGHT - 1) << 2);
|
|
|
|
|
gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE,
|
|
|
|
|
LENS_MASK_OFFSET_S << 5, LENS_MASK_OFFSET_T << 5,
|
|
|
|
|
(1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH,
|
|
|
|
|
(1 << 10) * (SCREEN_HEIGHT - 2 * LENS_MASK_OFFSET_T) / SCREEN_HEIGHT);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPPipeSync(POLY_XLU_DISP++);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invisibleActors) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor** invisibleActor;
|
|
|
|
|
GraphicsContext* gfxCtx;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gfxCtx = play->state.gfxCtx;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
OPEN_DISPS(gfxCtx, "../z_actor.c", 6197);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ START", 0); // "Magic lens START"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPPipeSync(POLY_XLU_DISP++);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) {
|
2022-01-24 23:42:36 +00:00
|
|
|
|
// Update both the color frame buffer and the z-buffer
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetOtherMode(POLY_XLU_DISP++,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
|
|
|
|
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2);
|
2022-01-24 23:42:36 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
|
|
|
|
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255);
|
2022-01-24 23:42:36 +00:00
|
|
|
|
|
|
|
|
|
// the z-buffer will later only allow drawing inside the lens circle
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-01-24 23:42:36 +00:00
|
|
|
|
// Update the z-buffer but not the color frame buffer
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetOtherMode(POLY_XLU_DISP++,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
|
|
|
|
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
|
|
|
|
G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL |
|
|
|
|
|
GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) |
|
|
|
|
|
GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA));
|
2022-01-24 23:42:36 +00:00
|
|
|
|
|
|
|
|
|
// inverts the mask image, which initially is 0 inner and 74 outer,
|
|
|
|
|
// by setting the combiner to draw 74 - image instead of the image
|
2020-11-19 21:49:08 +00:00
|
|
|
|
gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0,
|
|
|
|
|
PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 74, 74, 74, 74);
|
2022-01-24 23:42:36 +00:00
|
|
|
|
|
|
|
|
|
// the z-buffer will later only allow drawing outside the lens circle
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
// Together with the depth source set above, this sets the depth to the closest.
|
|
|
|
|
// For a pixel with such a depth value, the z-buffer will reject drawing to that pixel.
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimDepth(POLY_XLU_DISP++, 0, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
// The z-buffer will be updated where the mask is not fully transparent.
|
|
|
|
|
Actor_DrawLensOverlay(gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Magic lens invisible Actor display START"
|
2021-08-15 23:15:58 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", numInvisibleActors);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
invisibleActor = &invisibleActors[0];
|
2021-08-15 23:15:58 +00:00
|
|
|
|
for (i = 0; i < numInvisibleActors; i++) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Magic lens invisible Actor display"
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示", i);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Draw(play, *(invisibleActor++));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Magic lens invisible Actor display END"
|
2021-08-15 23:15:58 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
|
2022-01-24 23:42:36 +00:00
|
|
|
|
// Draw the lens overlay to the color frame buffer
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPPipeSync(POLY_XLU_DISP++);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetOtherMode(POLY_XLU_DISP++,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
|
|
|
|
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
G_AC_THRESHOLD | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
|
|
|
|
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-24 23:42:36 +00:00
|
|
|
|
Actor_DrawLensOverlay(gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 1); // "Blue spectacles (exterior)"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ END", 0); // "Magic lens END"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_actor.c", 6284);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800314B0(PlayState* play, Actor* actor) {
|
|
|
|
|
return func_800314D4(play, actor, &actor->projectedPos, actor->projectedW);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 var;
|
|
|
|
|
|
2020-06-25 01:20:31 +00:00
|
|
|
|
if ((arg2->z > -actor->uncullZoneScale) && (arg2->z < (actor->uncullZoneForward + actor->uncullZoneScale))) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var = (arg3 < 1.0f) ? 1.0f : 1.0f / arg3;
|
|
|
|
|
|
2020-07-05 15:51:48 +00:00
|
|
|
|
if ((((fabsf(arg2->x) - actor->uncullZoneScale) * var) < 1.0f) &&
|
|
|
|
|
(((arg2->y + actor->uncullZoneDownward) * var) > -1.0f) &&
|
2020-06-25 01:20:31 +00:00
|
|
|
|
(((arg2->y - actor->uncullZoneScale) * var) < 1.0f)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 invisibleActorCounter;
|
|
|
|
|
Actor* invisibleActors[INVISIBLE_ACTOR_MAX];
|
|
|
|
|
ActorListEntry* actorListEntry;
|
|
|
|
|
Actor* actor;
|
2020-08-29 23:00:17 +00:00
|
|
|
|
s32 i;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
invisibleActorCounter = 0;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 6336);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorListEntry = &actorCtx->actorLists[0];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, actorListEntry++) {
|
|
|
|
|
actor = actorListEntry->head;
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2020-08-29 23:00:17 +00:00
|
|
|
|
ActorOverlay* overlayEntry = actor->overlayEntry;
|
|
|
|
|
char* actorName = overlayEntry->name != NULL ? overlayEntry->name : "";
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPNoOpString(POLY_OPA_DISP++, actorName, i);
|
|
|
|
|
gDPNoOpString(POLY_XLU_DISP++, actorName, i);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
HREG(66) = i;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos,
|
2020-08-08 15:23:16 +00:00
|
|
|
|
&actor->projectedW);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) {
|
2020-06-14 04:09:51 +00:00
|
|
|
|
if (actor->sfx != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_80030ED8(actor);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (func_800314B0(play, actor)) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_6;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags &= ~ACTOR_FLAG_6;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->isDrawn = false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) {
|
|
|
|
|
if ((actor->flags & ACTOR_FLAG_7) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || play->actorCtx.lensActive ||
|
|
|
|
|
(actor->room != play->roomCtx.curRoom.num))) {
|
2021-04-29 18:39:46 +00:00
|
|
|
|
ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX,
|
|
|
|
|
"invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
invisibleActors[invisibleActorCounter] = actor;
|
|
|
|
|
invisibleActorCounter++;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
|
|
|
|
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Draw(play, actor);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->isDrawn = true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || (HREG(73) != 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Effect_DrawAll(play->state.gfxCtx);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || (HREG(74) != 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
EffectSs_DrawAll(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || (HREG(72) != 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (play->actorCtx.lensActive) {
|
|
|
|
|
Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors);
|
|
|
|
|
if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) {
|
|
|
|
|
Actor_DisableLens(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_DrawFaroresWindPointer(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (IREG(32) == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Lights_DrawGlow(play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || (HREG(75) != 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
TitleCard_Draw(play, &actorCtx->titleCtx);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((HREG(64) != 1) || (HREG(76) != 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CollisionCheck_DrawCollision(play, &play->colChkCtx);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6563);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80031A28(PlayState* play, ActorContext* actorCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor* actor;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) {
|
|
|
|
|
actor = actorCtx->actorLists[i].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_Kill(actor);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
u8 sEnemyActorCategories[] = { ACTORCAT_ENEMY, ACTORCAT_BOSS };
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_FreezeAllEnemies(PlayState* play, ActorContext* actorCtx, s32 duration) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor* actor;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(sEnemyActorCategories); i++) {
|
|
|
|
|
actor = actorCtx->actorLists[sEnemyActorCategories[i]].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2020-07-09 19:12:03 +00:00
|
|
|
|
actor->freezeTimer = duration;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80031B14(PlayState* play, ActorContext* actorCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor* actor;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) {
|
|
|
|
|
actor = actorCtx->actorLists[i].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((actor->room >= 0) && (actor->room != play->roomCtx.curRoom.num) &&
|
|
|
|
|
(actor->room != play->roomCtx.prevRoom.num)) {
|
2020-06-25 01:20:31 +00:00
|
|
|
|
if (!actor->isDrawn) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor = Actor_Delete(actorCtx, actor, play);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_Kill(actor);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Destroy(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CollisionCheck_ClearContext(play, &play->colChkCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorCtx->flags.tempClear = 0;
|
|
|
|
|
actorCtx->flags.tempSwch &= 0xFFFFFF;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play->msgCtx.unk_E3F4 = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
// Actor_CleanupContext
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80031C3C(ActorContext* actorCtx, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor* actor;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) {
|
|
|
|
|
actor = actorCtx->actorLists[i].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Delete(actorCtx, actor, play);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor = actorCtx->actorLists[i].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("絶対魔法領域解放\n"); // "Absolute magic field deallocation"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorCtx->absoluteSpace != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ZeldaArena_FreeDebug(actorCtx->absoluteSpace, "../z_actor.c", 6731);
|
|
|
|
|
actorCtx->absoluteSpace = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Play_SaveSceneFlags(play);
|
|
|
|
|
func_80030488(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorOverlayTable_Cleanup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-18 21:04:04 +00:00
|
|
|
|
* Adds a given actor instance at the front of the actor list of the specified category.
|
|
|
|
|
* Also sets the actor instance as being of that category.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2021-01-18 21:04:04 +00:00
|
|
|
|
void Actor_AddToCategory(ActorContext* actorCtx, Actor* actorToAdd, u8 actorCategory) {
|
|
|
|
|
Actor* prevHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorToAdd->category = actorCategory;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actorCtx->total++;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCtx->actorLists[actorCategory].length++;
|
|
|
|
|
prevHead = actorCtx->actorLists[actorCategory].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (prevHead != NULL) {
|
|
|
|
|
prevHead->prev = actorToAdd;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCtx->actorLists[actorCategory].head = actorToAdd;
|
|
|
|
|
actorToAdd->next = prevHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes a given actor instance from its actor list.
|
|
|
|
|
* Also sets the temp clear flag of the current room if the actor removed was the last enemy loaded.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor* newHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actorCtx->total--;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCtx->actorLists[actorToRemove->category].length--;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorToRemove->prev != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorToRemove->prev->next = actorToRemove->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actorCtx->actorLists[actorToRemove->category].head = actorToRemove->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
newHead = actorToRemove->next;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (newHead != NULL) {
|
|
|
|
|
newHead->prev = actorToRemove->prev;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actorToRemove->next = NULL;
|
|
|
|
|
actorToRemove->prev = NULL;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((actorToRemove->room == play->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) &&
|
2021-01-18 21:04:04 +00:00
|
|
|
|
(actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Flags_SetTempClear(play, play->roomCtx.curRoom.num);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return newHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Actor_FreeOverlay(ActorOverlay* actorOverlay) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf(VT_FGCOL(CYAN));
|
|
|
|
|
|
2021-08-15 23:15:58 +00:00
|
|
|
|
if (actorOverlay->numLoaded == 0) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("アクタークライアントが0になりました\n"); // "Actor client is now 0"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorOverlay->loadedRamAddr != NULL) {
|
2022-06-20 20:17:09 +00:00
|
|
|
|
if (actorOverlay->allocType & ACTOROVL_ALLOC_PERSISTENT) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("オーバーレイ解放しません\n"); // "Overlay will not be deallocated"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-06-20 20:17:09 +00:00
|
|
|
|
} else if (actorOverlay->allocType & ACTOROVL_ALLOC_ABSOLUTE) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Absolute magic field reserved, so deallocation will not occur"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf("絶対魔法領域確保なので解放しません\n");
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorOverlay->loadedRamAddr = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("オーバーレイ解放します\n"); // "Overlay deallocated"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ZeldaArena_FreeDebug(actorOverlay->loadedRamAddr, "../z_actor.c", 6834);
|
|
|
|
|
actorOverlay->loadedRamAddr = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "%d of actor client remains"
|
2021-08-15 23:15:58 +00:00
|
|
|
|
osSyncPrintf("アクタークライアントはあと %d 残っています\n", actorOverlay->numLoaded);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX,
|
|
|
|
|
s16 rotY, s16 rotZ, s16 params) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 pad;
|
|
|
|
|
Actor* actor;
|
|
|
|
|
ActorInit* actorInit;
|
|
|
|
|
s32 objBankIndex;
|
|
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
|
u32 temp;
|
|
|
|
|
char* name;
|
|
|
|
|
u32 overlaySize;
|
|
|
|
|
|
|
|
|
|
overlayEntry = &gActorOverlayTable[actorId];
|
2021-04-29 18:39:46 +00:00
|
|
|
|
ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
|
|
|
|
overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Actor class addition [%d:%s]"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf("アクタークラス追加 [%d:%s]\n", actorId, name);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorCtx->total > ACTOR_NUMBER_MAX) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Actor set number exceeded"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf(VT_COL(YELLOW, BLACK) "Actorセット数オーバー\n" VT_RST);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (overlayEntry->vramStart == 0) {
|
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("オーバーレイではありません\n"); // "Not an overlay"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
actorInit = overlayEntry->initInfo;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (overlayEntry->loadedRamAddr != NULL) {
|
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("既にロードされています\n"); // "Already loaded"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-06-20 20:17:09 +00:00
|
|
|
|
if (overlayEntry->allocType & ACTOROVL_ALLOC_ABSOLUTE) {
|
|
|
|
|
ASSERT(overlaySize <= ACTOROVL_ABSOLUTE_SPACE_SIZE, "actor_segsize <= AM_FIELD_SIZE", "../z_actor.c",
|
|
|
|
|
6934);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorCtx->absoluteSpace == NULL) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "AMF: absolute magic field"
|
2022-06-20 20:17:09 +00:00
|
|
|
|
actorCtx->absoluteSpace =
|
|
|
|
|
ZeldaArena_MallocRDebug(ACTOROVL_ABSOLUTE_SPACE_SIZE, "AMF:絶対魔法領域", 0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Absolute magic field reservation - %d bytes reserved"
|
2022-06-20 20:17:09 +00:00
|
|
|
|
osSyncPrintf("絶対魔法領域確保 %d バイト確保\n", ACTOROVL_ABSOLUTE_SPACE_SIZE);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
overlayEntry->loadedRamAddr = actorCtx->absoluteSpace;
|
2022-06-20 20:17:09 +00:00
|
|
|
|
} else if (overlayEntry->allocType & ACTOROVL_ALLOC_PERSISTENT) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize, name, 0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
overlayEntry->loadedRamAddr = ZeldaArena_MallocDebug(overlaySize, name, 0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (overlayEntry->loadedRamAddr == NULL) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Cannot reserve actor program memory"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "Actorプログラムメモリが確保できません\n" VT_RST);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Overlay_Load(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd,
|
|
|
|
|
overlayEntry->loadedRamAddr);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
osSyncPrintf("OVL(a):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", overlayEntry->vramStart,
|
|
|
|
|
overlayEntry->vramEnd, overlayEntry->loadedRamAddr,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
(u32)overlayEntry->loadedRamAddr + (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
(u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, name);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
|
2021-08-15 23:15:58 +00:00
|
|
|
|
overlayEntry->numLoaded = 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-01 15:09:20 +00:00
|
|
|
|
actorInit = (void*)(u32)((overlayEntry->initInfo != NULL)
|
|
|
|
|
? (void*)((u32)overlayEntry->initInfo -
|
|
|
|
|
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr))
|
|
|
|
|
: NULL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
if ((objBankIndex < 0) ||
|
2022-05-21 18:23:43 +00:00
|
|
|
|
((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "No data bank!! <data bank=%d> (profilep->bank=%d)"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST,
|
|
|
|
|
objBankIndex, actorInit->objectId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_FreeOverlay(overlayEntry);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor = ZeldaArena_MallocDebug(actorInit->instanceSize, name, 1);
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor == NULL) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Actor class cannot be reserved! %s <size=%d bytes>"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "Actorクラス確保できません! %s <サイズ=%dバイト>\n", VT_RST, name,
|
|
|
|
|
actorInit->instanceSize);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_FreeOverlay(overlayEntry);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-15 23:15:58 +00:00
|
|
|
|
ASSERT(overlayEntry->numLoaded < 255, "actor_dlftbl->clients < 255", "../z_actor.c", 7031);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-08-15 23:15:58 +00:00
|
|
|
|
overlayEntry->numLoaded++;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Actor client No. %d"
|
2021-08-15 23:15:58 +00:00
|
|
|
|
osSyncPrintf("アクタークライアントは %d 個目です\n", overlayEntry->numLoaded);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
|
Lib_MemSet((u8*)actor, actorInit->instanceSize, 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->overlayEntry = overlayEntry;
|
|
|
|
|
actor->id = actorInit->id;
|
|
|
|
|
actor->flags = actorInit->flags;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actorInit->id == ACTOR_EN_PART) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->objBankIndex = rotZ;
|
|
|
|
|
rotZ = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->objBankIndex = objBankIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor->init = actorInit->init;
|
|
|
|
|
actor->destroy = actorInit->destroy;
|
|
|
|
|
actor->update = actorInit->update;
|
|
|
|
|
actor->draw = actorInit->draw;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->room = play->roomCtx.curRoom.num;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->home.pos.x = posX;
|
|
|
|
|
actor->home.pos.y = posY;
|
|
|
|
|
actor->home.pos.z = posZ;
|
|
|
|
|
actor->home.rot.x = rotX;
|
|
|
|
|
actor->home.rot.y = rotY;
|
|
|
|
|
actor->home.rot.z = rotZ;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->params = params;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor_AddToCategory(actorCtx, actor, actorInit->category);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
temp = gSegments[6];
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Init(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gSegments[6] = temp;
|
|
|
|
|
|
|
|
|
|
return actor;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY,
|
|
|
|
|
f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) {
|
|
|
|
|
Actor* spawnedActor = Actor_Spawn(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params);
|
2022-01-17 20:30:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (spawnedActor == NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-08-29 22:25:16 +00:00
|
|
|
|
parent->child = spawnedActor;
|
|
|
|
|
spawnedActor->parent = parent;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (spawnedActor->room >= 0) {
|
2020-08-29 22:25:16 +00:00
|
|
|
|
spawnedActor->room = parent->room;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return spawnedActor;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
TransitionActorEntry* transitionActor;
|
2021-08-15 23:15:58 +00:00
|
|
|
|
u8 numActors;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
transitionActor = play->transiActorCtx.list;
|
|
|
|
|
numActors = play->transiActorCtx.numActors;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-08-15 23:15:58 +00:00
|
|
|
|
for (i = 0; i < numActors; i++) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (transitionActor->id >= 0) {
|
2020-09-19 01:45:39 +00:00
|
|
|
|
if (((transitionActor->sides[0].room >= 0) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
((transitionActor->sides[0].room == play->roomCtx.curRoom.num) ||
|
|
|
|
|
(transitionActor->sides[0].room == play->roomCtx.prevRoom.num))) ||
|
2020-09-19 01:45:39 +00:00
|
|
|
|
((transitionActor->sides[1].room >= 0) &&
|
2022-05-21 18:23:43 +00:00
|
|
|
|
((transitionActor->sides[1].room == play->roomCtx.curRoom.num) ||
|
|
|
|
|
(transitionActor->sides[1].room == play->roomCtx.prevRoom.num)))) {
|
|
|
|
|
Actor_Spawn(actorCtx, play, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
transitionActor->pos.y, transitionActor->pos.z, 0, transitionActor->rotY, 0,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
(i << 0xA) + transitionActor->params);
|
|
|
|
|
|
|
|
|
|
transitionActor->id = -transitionActor->id;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
numActors = play->transiActorCtx.numActors;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
transitionActor++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play) {
|
|
|
|
|
return Actor_Spawn(actorCtx, play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, actorEntry->params);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
char* name;
|
|
|
|
|
Player* player;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor* newHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
overlayEntry = actor->overlayEntry;
|
|
|
|
|
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("アクタークラス削除 [%s]\n", name); // "Actor class deleted [%s]"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((player != NULL) && (actor == player->unk_664)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_8008EDF0(player);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor == actorCtx->targetCtx.arrowPointedActor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorCtx->targetCtx.arrowPointedActor = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor == actorCtx->targetCtx.unk_8C) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actorCtx->targetCtx.unk_8C = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-05 17:13:53 +00:00
|
|
|
|
if (actor == actorCtx->targetCtx.bgmEnemy) {
|
|
|
|
|
actorCtx->targetCtx.bgmEnemy = NULL;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
|
Audio_StopSfxByPos(&actor->projectedPos);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_Destroy(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
newHead = Actor_RemoveFromCategory(play, actorCtx, actor);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
ZeldaArena_FreeDebug(actor, "../z_actor.c", 7242);
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (overlayEntry->vramStart == 0) {
|
|
|
|
|
if (HREG(20) != 0) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("オーバーレイではありません\n"); // "Not an overlay"
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2021-04-29 18:39:46 +00:00
|
|
|
|
ASSERT(overlayEntry->loadedRamAddr != NULL, "actor_dlftbl->allocp != NULL", "../z_actor.c", 7251);
|
2021-08-15 23:15:58 +00:00
|
|
|
|
ASSERT(overlayEntry->numLoaded > 0, "actor_dlftbl->clients > 0", "../z_actor.c", 7252);
|
|
|
|
|
overlayEntry->numLoaded--;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_FreeOverlay(overlayEntry);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
return newHead;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80032880(PlayState* play, Actor* actor) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 sp1E;
|
|
|
|
|
s16 sp1C;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_GetScreenPos(play, actor, &sp1E, &sp1C);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return (sp1E > -20) && (sp1E < 340) && (sp1C > -160) && (sp1C < 400);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Actor* D_8015BBE8;
|
|
|
|
|
Actor* D_8015BBEC;
|
|
|
|
|
f32 D_8015BBF0;
|
2021-12-05 17:13:53 +00:00
|
|
|
|
f32 sbgmEnemyDistSq;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 D_8015BBF8;
|
|
|
|
|
s16 D_8015BBFC;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800328D4(PlayState* play, ActorContext* actorCtx, Player* player, u32 actorCategory) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 var;
|
|
|
|
|
Actor* actor;
|
|
|
|
|
Actor* sp84;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
CollisionPoly* sp80;
|
2021-11-30 23:40:42 +00:00
|
|
|
|
s32 sp7C;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f sp70;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor = actorCtx->actorLists[actorCategory].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
sp84 = player->unk_664;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) {
|
2021-12-05 17:13:53 +00:00
|
|
|
|
|
|
|
|
|
// This block below is for determining the closest actor to player in determining the volume
|
|
|
|
|
// used while playing enemy bgm music
|
2021-12-06 00:11:38 +00:00
|
|
|
|
if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) &&
|
2021-12-05 17:13:53 +00:00
|
|
|
|
(actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sbgmEnemyDistSq)) {
|
|
|
|
|
actorCtx->targetCtx.bgmEnemy = actor;
|
|
|
|
|
sbgmEnemyDistSq = actor->xyzDistToPlayerSq;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor != sp84) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var = func_8002EFC0(actor, player, D_8015BBFC);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(play, actor) &&
|
|
|
|
|
(!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, &sp80,
|
|
|
|
|
1, 1, 1, 1, &sp7C) ||
|
|
|
|
|
SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C))) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->targetPriority != 0) {
|
|
|
|
|
if (actor->targetPriority < D_8015BBF8) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BBEC = actor;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
D_8015BBF8 = actor->targetPriority;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BBE8 = actor;
|
|
|
|
|
D_8015BBF0 = var;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
u8 D_801160A0[] = {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
ACTORCAT_BOSS, ACTORCAT_ENEMY, ACTORCAT_BG, ACTORCAT_EXPLOSIVE, ACTORCAT_NPC, ACTORCAT_ITEMACTION,
|
|
|
|
|
ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH,
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
|
|
|
|
u8* entry;
|
|
|
|
|
|
|
|
|
|
D_8015BBE8 = D_8015BBEC = NULL;
|
2021-12-05 17:13:53 +00:00
|
|
|
|
D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BBF8 = 0x7FFFFFFF;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (!Player_InCsMode(play)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
entry = &D_801160A0[0];
|
|
|
|
|
|
2021-12-05 17:13:53 +00:00
|
|
|
|
actorCtx->targetCtx.bgmEnemy = NULL;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
D_8015BBFC = player->actor.shape.rot.y;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < 3; i++) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_800328D4(play, actorCtx, player, *entry);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
entry++;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (D_8015BBE8 == NULL) {
|
2021-02-14 00:49:40 +00:00
|
|
|
|
for (; i < ARRAY_COUNT(D_801160A0); i++) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_800328D4(play, actorCtx, player, *entry);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
entry++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (D_8015BBE8 == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*actorPtr = D_8015BBEC;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*actorPtr = D_8015BBE8;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return *actorPtr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-18 21:04:04 +00:00
|
|
|
|
* Finds the first actor instance of a specified ID and category if there is one.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory) {
|
|
|
|
|
Actor* actor = actorCtx->actorLists[actorCategory].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
|
|
|
|
if (actorId == actor->id) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return actor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Play the death sound effect and flash the screen white for 4 frames.
|
|
|
|
|
* While the screen flashes, the game freezes.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Enemy_StartFinishingBlow(PlayState* play, Actor* actor) {
|
|
|
|
|
play->actorCtx.freezeFlashTimer = 5;
|
2022-07-30 13:05:27 +00:00
|
|
|
|
SfxSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
|
|
|
|
if (DECR(arg0[1]) == 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
arg0[1] = Rand_S16Offset(arg1, arg2);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((arg0[1] - arg3) > 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg0[0] = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (((arg0[1] - arg3) > -2) || (arg0[1] < 2)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg0[0] = 1;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg0[0] = 2;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return arg0[0];
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
|
|
|
|
if (DECR(arg0[1]) == 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
arg0[1] = Rand_S16Offset(arg1, arg2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg0[0]++;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if ((arg0[0] % 3) == 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
arg0[0] = (s32)(Rand_ZeroOne() * arg3) * 3;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return arg0[0];
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
|
2021-04-28 01:32:15 +00:00
|
|
|
|
u32 matricesSize;
|
|
|
|
|
u32 dListsSize;
|
|
|
|
|
u32 objectIdsSize;
|
|
|
|
|
|
|
|
|
|
matricesSize = (count + 1) * sizeof(*bodyBreak->matrices);
|
|
|
|
|
bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, "../z_actor.c", 7540);
|
|
|
|
|
|
|
|
|
|
if (bodyBreak->matrices != NULL) {
|
|
|
|
|
dListsSize = (count + 1) * sizeof(*bodyBreak->dLists);
|
|
|
|
|
bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, "../z_actor.c", 7543);
|
|
|
|
|
|
|
|
|
|
if (bodyBreak->dLists != NULL) {
|
|
|
|
|
objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds);
|
|
|
|
|
bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, "../z_actor.c", 7546);
|
|
|
|
|
|
|
|
|
|
if (bodyBreak->objectIds != NULL) {
|
|
|
|
|
Lib_MemSet((u8*)bodyBreak->matrices, matricesSize, 0);
|
|
|
|
|
Lib_MemSet((u8*)bodyBreak->dLists, dListsSize, 0);
|
|
|
|
|
Lib_MemSet((u8*)bodyBreak->objectIds, objectIdsSize, 0);
|
|
|
|
|
bodyBreak->val = 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (bodyBreak->matrices != NULL) {
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7558);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (bodyBreak->dLists != NULL) {
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7561);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (bodyBreak->objectIds != NULL) {
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7564);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList,
|
|
|
|
|
s16 objectId) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
PlayState* play = Effect_GetPlayState();
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) {
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) {
|
|
|
|
|
bodyBreak->dLists[bodyBreak->val] = *dList;
|
|
|
|
|
Matrix_Get(&bodyBreak->matrices[bodyBreak->val]);
|
|
|
|
|
bodyBreak->objectIds[bodyBreak->val] = objectId;
|
|
|
|
|
bodyBreak->val++;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (limbIndex != bodyBreak->prevLimbIndex) {
|
|
|
|
|
bodyBreak->count++;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if ((u32)bodyBreak->count >= count) {
|
|
|
|
|
bodyBreak->count = bodyBreak->val - 1;
|
|
|
|
|
bodyBreak->val = BODYBREAK_STATUS_READY;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
bodyBreak->prevLimbIndex = limbIndex;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) {
|
2020-05-01 18:26:16 +00:00
|
|
|
|
EnPart* spawnedEnPart;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
MtxF* mtx;
|
|
|
|
|
s16 objBankIndex;
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (bodyBreak->val != BODYBREAK_STATUS_READY) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
while (bodyBreak->count > 0) {
|
|
|
|
|
Matrix_Put(&bodyBreak->matrices[bodyBreak->count]);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Matrix_Scale(1.0f / actor->scale.x, 1.0f / actor->scale.y, 1.0f / actor->scale.z, MTXMODE_APPLY);
|
2021-04-28 01:32:15 +00:00
|
|
|
|
Matrix_Get(&bodyBreak->matrices[bodyBreak->count]);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
if (1) {
|
|
|
|
|
if (bodyBreak->objectIds[bodyBreak->count] >= 0) {
|
|
|
|
|
objBankIndex = bodyBreak->objectIds[bodyBreak->count];
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
objBankIndex = actor->objBankIndex;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
mtx = &bodyBreak->matrices[bodyBreak->count];
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw,
|
|
|
|
|
mtx->zw, 0, 0, objBankIndex, type);
|
2021-04-28 01:32:15 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (spawnedEnPart != NULL) {
|
2021-08-22 15:25:17 +00:00
|
|
|
|
Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0);
|
2021-04-28 01:32:15 +00:00
|
|
|
|
spawnedEnPart->displayList = bodyBreak->dLists[bodyBreak->count];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spawnedEnPart->actor.scale = actor->scale;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
bodyBreak->count--;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 01:32:15 +00:00
|
|
|
|
bodyBreak->val = BODYBREAK_STATUS_FINISHED;
|
|
|
|
|
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7678);
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7679);
|
|
|
|
|
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7680);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne,
|
2021-08-08 11:28:28 +00:00
|
|
|
|
f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting) {
|
2020-07-19 13:54:24 +00:00
|
|
|
|
Vec3f pos;
|
|
|
|
|
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
|
|
|
|
Vec3f accel = { 0.0f, 0.3f, 0.0f };
|
2021-08-08 11:28:28 +00:00
|
|
|
|
f32 angle;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-08-08 11:28:28 +00:00
|
|
|
|
angle = (Rand_ZeroOne() - 0.5f) * (2.0f * 3.14f);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
pos.y = actor->floorHeight;
|
2020-12-26 10:44:53 +00:00
|
|
|
|
accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-08-08 11:28:28 +00:00
|
|
|
|
for (i = amountMinusOne; i >= 0; i--) {
|
|
|
|
|
pos.x = Math_SinF(angle) * radius + posXZ->x;
|
|
|
|
|
pos.z = Math_CosF(angle) * radius + posXZ->z;
|
2021-06-21 23:51:04 +00:00
|
|
|
|
accel.x = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
|
|
|
|
|
accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-07-19 13:54:24 +00:00
|
|
|
|
if (scale == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002857C(play, &pos, &velocity, &accel);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-08-08 11:28:28 +00:00
|
|
|
|
if (useLighting) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep);
|
2021-08-08 11:28:28 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep);
|
2021-08-08 11:28:28 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-08-08 11:28:28 +00:00
|
|
|
|
angle += (2.0f * 3.14f) / (amountMinusOne + 1.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80033480(PlayState* play, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase,
|
2021-12-11 01:21:19 +00:00
|
|
|
|
s16 scaleStep, u8 arg6) {
|
2020-07-19 13:54:24 +00:00
|
|
|
|
Vec3f pos;
|
|
|
|
|
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
|
|
|
|
Vec3f accel = { 0.0f, 0.3f, 0.0f };
|
|
|
|
|
s16 scale;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
u32 var2;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-12-11 01:21:19 +00:00
|
|
|
|
for (i = amountMinusOne; i >= 0; i--) {
|
|
|
|
|
pos.x = posBase->x + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
|
|
|
|
pos.y = posBase->y + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
|
|
|
|
pos.z = posBase->z + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-11 01:21:19 +00:00
|
|
|
|
scale = (s16)((Rand_ZeroOne() * scaleBase) * 0.2f) + scaleBase;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
var2 = arg6;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (var2 != 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_800286CC(play, &pos, &velocity, &accel, scale, scaleStep);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002865C(play, &pos, &velocity, &accel, scale, scaleStep);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_GetCollidedExplosive(PlayState* play, Collider* collider) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if ((collider->acFlags & AC_HIT) && (collider->ac->category == ACTORCAT_EXPLOSIVE)) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
collider->acFlags &= ~AC_HIT;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return collider->ac;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* func_80033684(PlayState* play, Actor* explosiveActor) {
|
|
|
|
|
Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
|
|
|
|
if ((actor == explosiveActor) || (actor->params != 1)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (Actor_WorldDistXYZToActor(explosiveActor, actor) <= (actor->shape.rot.z * 10) + 80.0f) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return actor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-18 21:04:04 +00:00
|
|
|
|
* Dynamically changes the category of a given actor instance.
|
|
|
|
|
* This is done by moving it to the corresponding category list and setting its category variable accordingly.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_ChangeCategory(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory) {
|
|
|
|
|
Actor_RemoveFromCategory(play, actorCtx, actor);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
Actor_AddToCategory(actorCtx, actor, actorCategory);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Checks if a hookshot or arrow actor is going to collide with the cylinder denoted by the
|
|
|
|
|
* actor's `cylRadius` and `cylHeight`.
|
|
|
|
|
* The check is only peformed if the projectile actor is within the provided sphere radius.
|
|
|
|
|
*
|
|
|
|
|
* Returns the actor if there will be collision, NULL otherwise.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius) {
|
2021-06-21 23:51:04 +00:00
|
|
|
|
Actor* actor;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f spA8;
|
|
|
|
|
f32 deltaX;
|
|
|
|
|
f32 deltaY;
|
|
|
|
|
f32 deltaZ;
|
|
|
|
|
Vec3f sp90;
|
|
|
|
|
Vec3f sp84;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
|
|
|
|
if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-06-21 23:51:04 +00:00
|
|
|
|
//! @bug The projectile actor gets unsafely casted to a hookshot to check its timer, even though
|
|
|
|
|
// it can also be an arrow.
|
|
|
|
|
// Luckily, the field at the same offset in the arrow actor is the x component of a vector
|
2021-11-30 23:40:42 +00:00
|
|
|
|
// which will rarely ever be 0. So it's very unlikely for this bug to cause an issue.
|
2021-06-21 23:51:04 +00:00
|
|
|
|
if ((Math_Vec3f_DistXYZ(&refActor->world.pos, &actor->world.pos) > radius) ||
|
|
|
|
|
(((ArmsHook*)actor)->timer == 0)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-06-21 23:51:04 +00:00
|
|
|
|
deltaX = Math_SinS(actor->world.rot.y) * (actor->speedXZ * 10.0f);
|
|
|
|
|
deltaY = actor->velocity.y + (actor->gravity * 10.0f);
|
|
|
|
|
deltaZ = Math_CosS(actor->world.rot.y) * (actor->speedXZ * 10.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
spA8.x = actor->world.pos.x + deltaX;
|
|
|
|
|
spA8.y = actor->world.pos.y + deltaY;
|
|
|
|
|
spA8.z = actor->world.pos.z + deltaZ;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (CollisionCheck_CylSideVsLineSeg(refActor->colChkInfo.cylRadius, refActor->colChkInfo.cylHeight,
|
2021-06-21 23:51:04 +00:00
|
|
|
|
0.0f, &refActor->world.pos, &actor->world.pos, &spA8, &sp90,
|
|
|
|
|
&sp84)) {
|
|
|
|
|
return actor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the actor's text id with a dynamic prefix based on the current scene.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_SetTextWithPrefix(PlayState* play, Actor* actor, s16 baseTextId) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 prefix;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
switch (play->sceneNum) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case SCENE_YDAN:
|
|
|
|
|
case SCENE_YDAN_BOSS:
|
|
|
|
|
case SCENE_MORIBOSSROOM:
|
|
|
|
|
case SCENE_KOKIRI_HOME:
|
|
|
|
|
case SCENE_KOKIRI_HOME3:
|
|
|
|
|
case SCENE_KOKIRI_HOME4:
|
|
|
|
|
case SCENE_KOKIRI_HOME5:
|
|
|
|
|
case SCENE_KOKIRI_SHOP:
|
|
|
|
|
case SCENE_LINK_HOME:
|
|
|
|
|
case SCENE_SPOT04:
|
|
|
|
|
case SCENE_SPOT05:
|
|
|
|
|
case SCENE_SPOT10:
|
|
|
|
|
case 112:
|
|
|
|
|
prefix = 0x1000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_MALON_STABLE:
|
|
|
|
|
case SCENE_SPOT00:
|
|
|
|
|
case SCENE_SPOT20:
|
|
|
|
|
prefix = 0x2000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_HIDAN:
|
|
|
|
|
case SCENE_DDAN_BOSS:
|
|
|
|
|
case SCENE_FIRE_BS:
|
|
|
|
|
case SCENE_SPOT16:
|
|
|
|
|
case SCENE_SPOT17:
|
|
|
|
|
case SCENE_SPOT18:
|
|
|
|
|
prefix = 0x3000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_BDAN:
|
|
|
|
|
case SCENE_BDAN_BOSS:
|
|
|
|
|
case SCENE_SPOT03:
|
|
|
|
|
case SCENE_SPOT07:
|
|
|
|
|
case SCENE_SPOT08:
|
|
|
|
|
prefix = 0x4000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_HAKADAN:
|
|
|
|
|
case SCENE_HAKADAN_BS:
|
|
|
|
|
case SCENE_KAKARIKO:
|
|
|
|
|
case SCENE_KAKARIKO3:
|
|
|
|
|
case SCENE_IMPA:
|
|
|
|
|
case SCENE_HUT:
|
|
|
|
|
case SCENE_HAKAANA:
|
|
|
|
|
case SCENE_HAKASITARELAY:
|
|
|
|
|
case SCENE_SPOT01:
|
|
|
|
|
case SCENE_SPOT02:
|
|
|
|
|
prefix = 0x5000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_JYASINZOU:
|
|
|
|
|
case SCENE_JYASINBOSS:
|
|
|
|
|
case SCENE_LABO:
|
|
|
|
|
case SCENE_TENT:
|
|
|
|
|
case SCENE_SPOT06:
|
|
|
|
|
case SCENE_SPOT09:
|
|
|
|
|
case SCENE_SPOT11:
|
|
|
|
|
prefix = 0x6000;
|
|
|
|
|
break;
|
|
|
|
|
case SCENE_ENTRA:
|
|
|
|
|
case SCENE_MARKET_ALLEY:
|
|
|
|
|
case SCENE_MARKET_ALLEY_N:
|
|
|
|
|
case SCENE_MARKET_DAY:
|
|
|
|
|
case SCENE_MARKET_NIGHT:
|
|
|
|
|
case SCENE_MARKET_RUINS:
|
|
|
|
|
case SCENE_SPOT15:
|
|
|
|
|
prefix = 0x7000;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
prefix = 0x0000;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor->textId = prefix | baseTextId;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-08 11:28:28 +00:00
|
|
|
|
/**
|
|
|
|
|
* Checks if a given actor will be standing on the ground after being translated
|
|
|
|
|
* by the provided distance and angle.
|
|
|
|
|
*
|
|
|
|
|
* Returns true if the actor will be standing on ground.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 angle) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 ret;
|
2021-08-08 11:28:28 +00:00
|
|
|
|
s16 prevBgCheckFlags;
|
|
|
|
|
f32 dx;
|
|
|
|
|
f32 dz;
|
|
|
|
|
Vec3f prevActorPos;
|
|
|
|
|
|
|
|
|
|
Math_Vec3f_Copy(&prevActorPos, &actor->world.pos);
|
|
|
|
|
prevBgCheckFlags = actor->bgCheckFlags;
|
|
|
|
|
|
|
|
|
|
dx = Math_SinS(angle) * distance;
|
|
|
|
|
dz = Math_CosS(angle) * distance;
|
|
|
|
|
actor->world.pos.x += dx;
|
|
|
|
|
actor->world.pos.z += dz;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
|
2021-08-08 11:28:28 +00:00
|
|
|
|
|
|
|
|
|
Math_Vec3f_Copy(&actor->world.pos, &prevActorPos);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-19 02:16:19 +00:00
|
|
|
|
ret = actor->bgCheckFlags & BGCHECKFLAG_GROUND;
|
2021-08-08 11:28:28 +00:00
|
|
|
|
actor->bgCheckFlags = prevBgCheckFlags;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns true if the player is targeting the provided actor
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Actor_IsTargeted(PlayState* play, Actor* actor) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isTargeted) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* Returns true if the player is targeting an actor other than the provided actor
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
|
if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isTargeted) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 ret = 0.0f;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg4 <= Math_Vec3f_DistXYZ(arg0, arg1)) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
ret = Math_SmoothStepToF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
|
|
|
|
ret += Math_SmoothStepToF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
|
|
|
|
ret += Math_SmoothStepToF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else if (arg5 < Math_Vec3f_DistXYZ(arg0, arg1)) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
ret = Math_SmoothStepToF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
|
|
|
|
ret += Math_SmoothStepToF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
|
|
|
|
ret += Math_SmoothStepToF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
MtxF sp60;
|
|
|
|
|
f32 var;
|
|
|
|
|
Vec3f sp50;
|
|
|
|
|
CollisionPoly* sp4C;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8120);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (0) {} // Necessary to match
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
sp50.x = arg0->x;
|
|
|
|
|
sp50.y = arg0->y + 1.0f;
|
|
|
|
|
sp50.z = arg0->z;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
var = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp4C, &sp50);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (sp4C != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_80038A28(sp4C, arg0->x, var, arg0->z, &sp60);
|
|
|
|
|
Matrix_Put(&sp60);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Matrix_Translate(arg0->x, arg0->y, arg0->z, MTXMODE_NEW);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY);
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8149), G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-11-28 10:47:55 +00:00
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gCircleShadowDL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8155);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) {
|
|
|
|
|
s16 var = Quake_Add(&play->mainCamera, 3);
|
2021-11-30 23:40:42 +00:00
|
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
|
Quake_SetSpeed(var, 20000);
|
|
|
|
|
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
|
|
|
|
|
Quake_SetCountdown(var, arg2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) {
|
|
|
|
|
s16 var = Quake_Add(&play->mainCamera, 3);
|
2021-11-30 23:40:42 +00:00
|
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
|
Quake_SetSpeed(var, arg3);
|
|
|
|
|
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
|
|
|
|
|
Quake_SetCountdown(var, arg2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg2 >= 5) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80033DB8(play, arg2, arg3);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
f32 Rand_ZeroFloat(f32 f) {
|
|
|
|
|
return Rand_ZeroOne() * f;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
f32 Rand_CenteredFloat(f32 f) {
|
|
|
|
|
return (Rand_ZeroOne() - 0.5f) * f;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
typedef struct {
|
2021-12-02 00:32:23 +00:00
|
|
|
|
/* 0x00 */ f32 chainAngle;
|
|
|
|
|
/* 0x04 */ f32 chainLength;
|
|
|
|
|
/* 0x08 */ f32 yShift;
|
|
|
|
|
/* 0x0C */ f32 chainsScale;
|
|
|
|
|
/* 0x10 */ f32 chainsRotZInit;
|
|
|
|
|
/* 0x14 */ Gfx* chainDL;
|
|
|
|
|
/* 0x18 */ Gfx* lockDL;
|
|
|
|
|
} DoorLockInfo; // size = 0x1C
|
|
|
|
|
|
|
|
|
|
static DoorLockInfo sDoorLocksInfo[] = {
|
|
|
|
|
/* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainsDL, gDoorLockDL },
|
|
|
|
|
/* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, object_bdoor_DL_001530, object_bdoor_DL_001400 },
|
|
|
|
|
/* DOORLOCK_NORMAL_SPIRIT */ { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainsDL, gDoorLockDL },
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Draws chains and lock of a locked door, of the specified `type` (see `DoorLockType`).
|
|
|
|
|
* `frame` can be 0 to 10, where 0 is "open" and 10 is "closed", the chains slide accordingly.
|
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) {
|
2021-12-02 00:32:23 +00:00
|
|
|
|
DoorLockInfo* entry;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
2021-12-02 00:32:23 +00:00
|
|
|
|
MtxF baseMtxF;
|
|
|
|
|
f32 chainRotZ;
|
|
|
|
|
f32 chainsTranslateX;
|
|
|
|
|
f32 chainsTranslateY;
|
|
|
|
|
f32 rotZStep;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
entry = &sDoorLocksInfo[type];
|
|
|
|
|
chainRotZ = entry->chainsRotZInit;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8265);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY);
|
|
|
|
|
Matrix_Get(&baseMtxF);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
chainsTranslateX = sinf(entry->chainAngle - chainRotZ) * -(10 - frame) * 0.1f * entry->chainLength;
|
|
|
|
|
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < 4; i++) {
|
2021-12-02 00:32:23 +00:00
|
|
|
|
Matrix_Put(&baseMtxF);
|
|
|
|
|
Matrix_RotateZ(chainRotZ, MTXMODE_APPLY);
|
|
|
|
|
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
if (entry->chainsScale != 1.0f) {
|
|
|
|
|
Matrix_Scale(entry->chainsScale, entry->chainsScale, entry->chainsScale, MTXMODE_APPLY);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8299),
|
2020-03-22 21:19:43 +00:00
|
|
|
|
G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-12-02 00:32:23 +00:00
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, entry->chainDL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (i % 2) {
|
2021-12-02 00:32:23 +00:00
|
|
|
|
rotZStep = 2.0f * entry->chainAngle;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-12-02 00:32:23 +00:00
|
|
|
|
rotZStep = M_PI - (2.0f * entry->chainAngle);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
chainRotZ += rotZStep;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-02 00:32:23 +00:00
|
|
|
|
Matrix_Put(&baseMtxF);
|
2020-12-03 21:51:22 +00:00
|
|
|
|
Matrix_Scale(frame * 0.1f, frame * 0.1f, frame * 0.1f, MTXMODE_APPLY);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_actor.c", 8314), G_MTX_MODELVIEW | G_MTX_LOAD);
|
2021-12-02 00:32:23 +00:00
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, entry->lockDL);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8319);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8003424C(PlayState* play, Vec3f* arg1) {
|
|
|
|
|
CollisionCheck_SpawnShieldParticlesMetal(play, arg1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-15 18:41:55 +00:00
|
|
|
|
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration) {
|
|
|
|
|
if ((colorFlag == 0x8000) && !(colorIntensityMax & 0x8000)) {
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlayActorSfx2(actor, NA_SE_EN_LIGHT_ARROW_HIT);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-02-15 18:41:55 +00:00
|
|
|
|
actor->colorFilterParams = colorFlag | xluFlag | ((colorIntensityMax & 0xF8) << 5) | duration;
|
|
|
|
|
actor->colorFilterTimer = duration;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Hilite* func_800342EC(Vec3f* object, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f lightDir;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
lightDir.x = play->envCtx.dirLight1.params.dir.x;
|
|
|
|
|
lightDir.y = play->envCtx.dirLight1.params.dir.y;
|
|
|
|
|
lightDir.z = play->envCtx.dirLight1.params.dir.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return func_8002EABC(object, &play->view.eye, &lightDir, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Hilite* func_8003435C(Vec3f* object, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f lightDir;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
lightDir.x = play->envCtx.dirLight1.params.dir.x;
|
|
|
|
|
lightDir.y = play->envCtx.dirLight1.params.dir.y;
|
|
|
|
|
lightDir.z = play->envCtx.dirLight1.params.dir.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
return func_8002EB44(object, &play->view.eye, &lightDir, play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800343CC(PlayState* play, Actor* actor, s16* arg2, f32 interactRange, callback1_800343CC unkFunc1,
|
2020-05-29 21:20:00 +00:00
|
|
|
|
callback2_800343CC unkFunc2) {
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
s16 x;
|
|
|
|
|
s16 y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Actor_ProcessTalkRequest(actor, play)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*arg2 = 1;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (*arg2 != 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
*arg2 = unkFunc2(play, actor);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_GetScreenPos(play, actor, &x, &y);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
if ((x < 0) || (x > SCREEN_WIDTH) || (y < 0) || (y > SCREEN_HEIGHT)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (!func_8002F2CC(actor, play, interactRange)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
actor->textId = unkFunc1(play, actor);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
/* 0x00 */ s16 unk_00;
|
|
|
|
|
/* 0x02 */ s16 unk_02;
|
|
|
|
|
/* 0x04 */ s16 unk_04;
|
|
|
|
|
/* 0x06 */ s16 unk_06;
|
|
|
|
|
/* 0x08 */ s16 unk_08;
|
|
|
|
|
/* 0x0A */ s16 unk_0A;
|
|
|
|
|
/* 0x0C */ u8 unk_0C;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
} struct_80116130_0; // size = 0x10
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
typedef struct {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
/* 0x00 */ struct_80116130_0 sub_00;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
/* 0x10 */ f32 unk_10;
|
|
|
|
|
/* 0x14 */ s16 unk_14;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
} struct_80116130; // size = 0x18
|
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
static struct_80116130 D_80116130[] = {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
{ { 0x2AA8, 0xF1C8, 0x18E2, 0x1554, 0x0000, 0x0000, 1 }, 170.0f, 0x3FFC },
|
|
|
|
|
{ { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, 1 }, 170.0f, 0x3FFC },
|
|
|
|
|
{ { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, 1 }, 170.0f, 0x3FFC },
|
|
|
|
|
{ { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, 1 }, 170.0f, 0x3FFC },
|
|
|
|
|
{ { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, 1 }, 170.0f, 0x3FFC },
|
|
|
|
|
{ { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, 1 }, 170.0f, 0x3FFC },
|
2020-03-22 21:19:43 +00:00
|
|
|
|
{ { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 1 }, 0.0f, 0x0000 },
|
|
|
|
|
{ { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 },
|
2020-03-17 04:31:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7,
|
|
|
|
|
u8 arg8) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 sp46;
|
|
|
|
|
s16 sp44;
|
|
|
|
|
s16 temp2;
|
2020-03-23 00:38:25 +00:00
|
|
|
|
s16 sp40;
|
|
|
|
|
s16 temp1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Vec3f sp30;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp30.x = actor->world.pos.x;
|
|
|
|
|
sp30.y = actor->world.pos.y + arg1->unk_14;
|
|
|
|
|
sp30.z = actor->world.pos.z;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18);
|
|
|
|
|
sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18);
|
2021-01-18 21:04:04 +00:00
|
|
|
|
sp40 = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18) - actor->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-07-15 15:23:57 +00:00
|
|
|
|
temp1 = CLAMP(sp40, -arg2, arg2);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
|
|
|
|
|
arg1->unk_08.y = CLAMP(arg1->unk_08.y, -temp1, temp1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
sp40 -= arg1->unk_08.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-07-15 15:23:57 +00:00
|
|
|
|
temp1 = CLAMP(sp40, -arg5, arg5);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg1->unk_0E.y, temp1, 6, 2000, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
temp1 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
|
|
|
|
|
arg1->unk_0E.y = CLAMP(arg1->unk_0E.y, -temp1, temp1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
if (arg8) {
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&actor->shape.rot.y, sp44, 6, 2000, 1);
|
2020-03-23 00:38:25 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-14 23:10:03 +00:00
|
|
|
|
temp1 = CLAMP(sp46, arg4, (s16)(u16)arg3);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg1->unk_08.x, temp1, 6, 2000, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-18 08:50:41 +00:00
|
|
|
|
temp2 = sp46 - arg1->unk_08.x;
|
2020-03-23 00:38:25 +00:00
|
|
|
|
|
2020-07-15 15:23:57 +00:00
|
|
|
|
temp1 = CLAMP(temp2, arg7, arg6);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg1->unk_0E.x, temp1, 6, 2000, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s16 func_800347E8(s16 arg0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return D_80116130[arg0].unk_14;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, s16 arg4) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 pad;
|
|
|
|
|
s16 var;
|
|
|
|
|
s16 abs_var;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg4 != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return arg4;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg1->unk_00 != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return 4;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (arg2 < Math_Vec3f_DistXYZ(&actor->world.pos, &arg1->unk_18)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg1->unk_04 = 0;
|
|
|
|
|
arg1->unk_06 = 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
var = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
abs_var = ABS((s16)((f32)var - actor->shape.rot.y));
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg3 >= abs_var) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg1->unk_04 = 0;
|
|
|
|
|
arg1->unk_06 = 0;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (DECR(arg1->unk_04) != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return arg1->unk_02;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (arg1->unk_06) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0:
|
|
|
|
|
case 2:
|
2020-12-26 10:44:53 +00:00
|
|
|
|
arg1->unk_04 = Rand_S16Offset(30, 30);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg1->unk_06++;
|
|
|
|
|
return 1;
|
|
|
|
|
case 1:
|
2020-12-26 10:44:53 +00:00
|
|
|
|
arg1->unk_04 = Rand_S16Offset(10, 10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg1->unk_06++;
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
struct_80116130_0 sp38;
|
|
|
|
|
|
|
|
|
|
arg1->unk_02 = func_80034810(actor, arg1, D_80116130[arg2].unk_10, D_80116130[arg2].unk_14, arg3);
|
|
|
|
|
|
|
|
|
|
sp38 = D_80116130[arg2].sub_00;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (arg1->unk_02) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 1:
|
|
|
|
|
sp38.unk_00 = 0;
|
|
|
|
|
sp38.unk_04 = 0;
|
|
|
|
|
sp38.unk_02 = 0;
|
2022-06-03 16:51:23 +00:00
|
|
|
|
FALLTHROUGH;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 3:
|
|
|
|
|
sp38.unk_06 = 0;
|
|
|
|
|
sp38.unk_0A = 0;
|
|
|
|
|
sp38.unk_08 = 0;
|
2022-06-03 16:51:23 +00:00
|
|
|
|
FALLTHROUGH;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 2:
|
|
|
|
|
sp38.unk_0C = 0;
|
2022-06-03 16:51:23 +00:00
|
|
|
|
break;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
func_800344BC(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, sp38.unk_06, sp38.unk_0A, sp38.unk_08,
|
|
|
|
|
sp38.unk_0C);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Gfx* func_80034B28(GraphicsContext* gfxCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Gfx* displayList;
|
|
|
|
|
|
|
|
|
|
displayList = Graph_Alloc(gfxCtx, sizeof(Gfx));
|
|
|
|
|
gSPEndDisplayList(displayList);
|
|
|
|
|
|
|
|
|
|
return displayList;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Gfx* func_80034B54(GraphicsContext* gfxCtx) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Gfx* displayListHead;
|
2020-06-25 14:03:40 +00:00
|
|
|
|
Gfx* displayList;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-06-25 14:03:40 +00:00
|
|
|
|
displayList = displayListHead = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-05 19:41:49 +00:00
|
|
|
|
gDPSetRenderMode(displayListHead++, G_RM_FOG_SHADE_A,
|
2020-03-22 21:19:43 +00:00
|
|
|
|
AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
|
|
|
|
|
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-06-25 14:03:40 +00:00
|
|
|
|
gSPEndDisplayList(displayListHead++);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return displayList;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80034BA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw,
|
|
|
|
|
Actor* actor, s16 alpha) {
|
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8831);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
|
|
|
|
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, alpha);
|
|
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80034B28(play->state.gfxCtx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount,
|
2020-12-02 03:19:56 +00:00
|
|
|
|
overrideLimbDraw, postLimbDraw, actor, POLY_OPA_DISP);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8860);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw,
|
|
|
|
|
Actor* actor, s16 alpha) {
|
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 8876);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
|
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gDPPipeSync(POLY_XLU_DISP++);
|
|
|
|
|
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha);
|
2022-05-21 18:23:43 +00:00
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x0C, func_80034B54(play->state.gfxCtx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
POLY_XLU_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount,
|
2020-12-02 03:19:56 +00:00
|
|
|
|
overrideLimbDraw, postLimbDraw, actor, POLY_XLU_DISP);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8904);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 var;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) {
|
|
|
|
|
var = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (arg3 < var) {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags &= ~ACTOR_FLAG_0;
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-12-06 00:11:38 +00:00
|
|
|
|
actor->flags |= ACTOR_FLAG_0;
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return arg2;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-12 02:10:43 +00:00
|
|
|
|
void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 frameCount;
|
|
|
|
|
|
2022-01-12 02:10:43 +00:00
|
|
|
|
animationInfo += index;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-12 02:10:43 +00:00
|
|
|
|
if (animationInfo->frameCount > 0.0f) {
|
|
|
|
|
frameCount = animationInfo->frameCount;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-01-12 02:10:43 +00:00
|
|
|
|
frameCount = Animation_GetLastFrame(animationInfo->animation);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-01-12 02:10:43 +00:00
|
|
|
|
Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame,
|
|
|
|
|
frameCount, animationInfo->mode, animationInfo->morphFrames);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3) {
|
|
|
|
|
u32 frames = play->gameplayFrames;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 i;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
for (i = 0; i < arg3; i++) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
arg1[i] = (0x814 + 50 * i) * frames;
|
|
|
|
|
arg2[i] = (0x940 + 50 * i) * frames;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Actor_Noop(Actor* actor, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80035124(Actor* actor, PlayState* play) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 ret = 0;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (actor->params) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Actor_HasParent(actor, play)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->params = 1;
|
2022-02-19 02:16:19 +00:00
|
|
|
|
} else if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Actor_MoveForward(actor);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Math_SmoothStepToF(&actor->speedXZ, 0.0f, 1.0f, 0.1f, 0.0f);
|
2022-02-19 02:16:19 +00:00
|
|
|
|
} else if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (actor->velocity.y < -4.0f)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 1;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->shape.rot.x = actor->shape.rot.z = 0;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_8002F580(actor, play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Actor_HasNoParent(actor, play)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->params = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-20 23:41:55 +00:00
|
|
|
|
Actor_UpdateBgCheckInfo(
|
2022-05-21 18:23:43 +00:00
|
|
|
|
play, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, actor->colChkInfo.cylRadius,
|
2022-02-20 23:41:55 +00:00
|
|
|
|
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 00:09:21 +00:00
|
|
|
|
#include "z_cheap_proc.c"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u8 func_800353E8(PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return player->unk_845;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-18 21:04:04 +00:00
|
|
|
|
* Finds the first actor instance of a specified ID and category within a given range from
|
|
|
|
|
* an actor if there is one. If the ID provided is -1, this will look for any actor of the
|
|
|
|
|
* specified category rather than a specific ID.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* Actor_FindNearby(PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) {
|
|
|
|
|
Actor* actor = play->actorCtx.actorLists[actorCategory].head;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
while (actor != NULL) {
|
|
|
|
|
if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (Actor_WorldDistXYZToActor(refActor, actor) <= range) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return actor;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor = actor->next;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 var1;
|
|
|
|
|
s16 var2;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
var1 = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y;
|
|
|
|
|
var2 = actor->yawTowardsPlayer - arg5;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
|
if ((actor->xzDistToPlayer <= range) && (player->meleeWeaponState != 0) && (arg4 >= ABS(var1)) &&
|
|
|
|
|
(arg3 >= ABS(var2))) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
|
2021-02-14 00:49:40 +00:00
|
|
|
|
Color_RGBA8 color1;
|
|
|
|
|
Color_RGBA8 color2;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
|
color1.r = 200;
|
|
|
|
|
color1.g = 160;
|
|
|
|
|
color1.b = 120;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
|
color2.r = 130;
|
|
|
|
|
color2.g = 90;
|
|
|
|
|
color2.b = 50;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
|
//! @bug color1 and color2 alpha components not set before being passed on
|
2022-05-21 18:23:43 +00:00
|
|
|
|
EffectSsKiraKira_SpawnSmall(play, pos, velocity, accel, &color1, &color2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vec3f D_80116268 = { 0.0f, -1.5f, 0.0f };
|
|
|
|
|
Vec3f D_80116274 = { 0.0f, -0.2f, 0.0f };
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
Gfx D_80116280[] = {
|
2020-04-05 19:41:49 +00:00
|
|
|
|
gsDPSetRenderMode(G_RM_FOG_SHADE_A, AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU |
|
|
|
|
|
FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)),
|
2020-03-17 04:31:30 +00:00
|
|
|
|
gsDPSetAlphaCompare(G_AC_THRESHOLD),
|
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800355B8(PlayState* play, Vec3f* pos) {
|
|
|
|
|
func_8003555C(play, pos, &D_80116268, &D_80116274);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u8 func_800355E4(PlayState* play, Collider* collider) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
|
if ((collider->acFlags & AC_TYPE_PLAYER) && (player->meleeWeaponState != 0) &&
|
2022-03-09 17:52:28 +00:00
|
|
|
|
(player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
u8 Actor_ApplyDamage(Actor* actor) {
|
z_collision_check.c (#73)
* func_8005B280 ok
* func_8005B65C OK
* split out func_8005BD50
* func_8005B7C0 OK
* func_8005B7F4 OK
* func_8005B824 OK
* func_8005B860 ok
* improve sanity
* func_8005B6B0 ok, ColliderInit_Actor structs added
* func_8005B884 ok
* func_8005BBF8 ok, split out func_8005BF50
* split more stuff out of func_8005C050.s
* func_8005C050 OK
* func_8005BA30 fakish OK, func_8005BAD8 real OK
* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues
* func_8005BB10 Ok
* func_8005BF50 OK
* func_8005BE50 OK
* func_8005BD50 OK
* func_8005BCC8 Ok
* func_8005BC28
* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok
* save my work commit
* func_8005C2BC fake OK
* func_8005C5B0 ok
* func_8005C608 ok
* func_8005C6C0 ok
* func_8005C6F8 ok
* func_8005C730 ok
* func_8005C774 func_8005C798 func_8005C7BC OK
* func_8005C7E0 ok, func_8005C810 split
* func_8005C810 OK
* func_8005C8C8 ok
* func_8005C964 OK
* func_8005CA88 ok
* func_8005CBAC ok
* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK
* func_8005CD34 func_8005CDD0 Ok
* func_8005CE6C ok
* func_8005CEC4 ok
* func_8005CEDC ok
* func_8005CF90 Ok
* standardize type names/vars more
* func_8005D3BC ok
* func_8005D40C OK, z64.h CollisionCheckContext
* func_8005D4B4 func_8005D4C8 ok
* partial data section migration
* improve function documentation, OT->OC
* Actor_CollisionCheck_SetOC ok
* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok
* func_8005BA84 ok
* func_800611A0 ok
* func_80061274 ok
* clean up func_80061274
* func_8006139C ok
* func_8005E9C0 and dependencies OK
* minor cleanup to func_8005E9C0
* func_8005EC6C OK!
* func_8005E81C ok
* func_8005E604 ok
* func_8005E2EC func_8005E4F8 OK
* func_8005DE9C OK func_8005D8AC disassembled
* func_8006146C func_8006268C ok
* func_8005EEE0 ok
* func_8005F17C
* func_8005F39C ok
* func_8005F5B0 decompiled, not matching
* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK
* func_8005FA30 ok, split more functions
* func_8005FC04 ok
* func_8005FDCC k
* func_8005FF90 OK OK OK
* func_80060204 dead
* func_800604B0 ok
* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish
* func_800635D0 ok, func_80062ECC not so much
* OcLine oks
* D_8011DF28 functions disassembled
* D_8011DF5C functions OK
* setAT_SAC. setAC_SAC, setOC_SAC OK
* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK
* func_800617D4 ok, func_800614A4 disassembled
* CollisionCheck_OC D_8011DFAC functions OK
* func_80062530 ok
* CollisionCheck_generalLineOcCheck subfunctions OK
* func_800622E4 ok
* after a long fought battle, func_80061F64 has fallen.
* func_800628A4 disassembled
* func_800627A0 func_8006285C OK
* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok
* func_80062CD4 decompiled, import EffShield/EffSpark types from MM
* various SubActor98 struct functions OK
* func_8005D4DC func_8005D62C ok
* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs
* func_80060C2C ok
* minor code tweaks
* func_80061C98 ok somehow
* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types
* Apply changes
* formatting
* tweak a couple function names
* krim changes, func naming
* missed some things
* function renames
* Implement GenColliderInit.py utility
* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching
* func_800614A4 ok
* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE
* collisionCheckCtx -> colChkCtx, fix small things
2020-04-26 02:43:35 +00:00
|
|
|
|
if (actor->colChkInfo.damage >= actor->colChkInfo.health) {
|
|
|
|
|
actor->colChkInfo.health = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
z_collision_check.c (#73)
* func_8005B280 ok
* func_8005B65C OK
* split out func_8005BD50
* func_8005B7C0 OK
* func_8005B7F4 OK
* func_8005B824 OK
* func_8005B860 ok
* improve sanity
* func_8005B6B0 ok, ColliderInit_Actor structs added
* func_8005B884 ok
* func_8005BBF8 ok, split out func_8005BF50
* split more stuff out of func_8005C050.s
* func_8005C050 OK
* func_8005BA30 fakish OK, func_8005BAD8 real OK
* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues
* func_8005BB10 Ok
* func_8005BF50 OK
* func_8005BE50 OK
* func_8005BD50 OK
* func_8005BCC8 Ok
* func_8005BC28
* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok
* save my work commit
* func_8005C2BC fake OK
* func_8005C5B0 ok
* func_8005C608 ok
* func_8005C6C0 ok
* func_8005C6F8 ok
* func_8005C730 ok
* func_8005C774 func_8005C798 func_8005C7BC OK
* func_8005C7E0 ok, func_8005C810 split
* func_8005C810 OK
* func_8005C8C8 ok
* func_8005C964 OK
* func_8005CA88 ok
* func_8005CBAC ok
* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK
* func_8005CD34 func_8005CDD0 Ok
* func_8005CE6C ok
* func_8005CEC4 ok
* func_8005CEDC ok
* func_8005CF90 Ok
* standardize type names/vars more
* func_8005D3BC ok
* func_8005D40C OK, z64.h CollisionCheckContext
* func_8005D4B4 func_8005D4C8 ok
* partial data section migration
* improve function documentation, OT->OC
* Actor_CollisionCheck_SetOC ok
* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok
* func_8005BA84 ok
* func_800611A0 ok
* func_80061274 ok
* clean up func_80061274
* func_8006139C ok
* func_8005E9C0 and dependencies OK
* minor cleanup to func_8005E9C0
* func_8005EC6C OK!
* func_8005E81C ok
* func_8005E604 ok
* func_8005E2EC func_8005E4F8 OK
* func_8005DE9C OK func_8005D8AC disassembled
* func_8006146C func_8006268C ok
* func_8005EEE0 ok
* func_8005F17C
* func_8005F39C ok
* func_8005F5B0 decompiled, not matching
* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK
* func_8005FA30 ok, split more functions
* func_8005FC04 ok
* func_8005FDCC k
* func_8005FF90 OK OK OK
* func_80060204 dead
* func_800604B0 ok
* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish
* func_800635D0 ok, func_80062ECC not so much
* OcLine oks
* D_8011DF28 functions disassembled
* D_8011DF5C functions OK
* setAT_SAC. setAC_SAC, setOC_SAC OK
* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK
* func_800617D4 ok, func_800614A4 disassembled
* CollisionCheck_OC D_8011DFAC functions OK
* func_80062530 ok
* CollisionCheck_generalLineOcCheck subfunctions OK
* func_800622E4 ok
* after a long fought battle, func_80061F64 has fallen.
* func_800628A4 disassembled
* func_800627A0 func_8006285C OK
* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok
* func_80062CD4 decompiled, import EffShield/EffSpark types from MM
* various SubActor98 struct functions OK
* func_8005D4DC func_8005D62C ok
* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs
* func_80060C2C ok
* minor code tweaks
* func_80061C98 ok somehow
* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types
* Apply changes
* formatting
* tweak a couple function names
* krim changes, func naming
* missed some things
* function renames
* Implement GenColliderInit.py utility
* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching
* func_800614A4 ok
* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE
* collisionCheckCtx -> colChkCtx, fix small things
2020-04-26 02:43:35 +00:00
|
|
|
|
actor->colChkInfo.health -= actor->colChkInfo.damage;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
z_collision_check.c (#73)
* func_8005B280 ok
* func_8005B65C OK
* split out func_8005BD50
* func_8005B7C0 OK
* func_8005B7F4 OK
* func_8005B824 OK
* func_8005B860 ok
* improve sanity
* func_8005B6B0 ok, ColliderInit_Actor structs added
* func_8005B884 ok
* func_8005BBF8 ok, split out func_8005BF50
* split more stuff out of func_8005C050.s
* func_8005C050 OK
* func_8005BA30 fakish OK, func_8005BAD8 real OK
* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues
* func_8005BB10 Ok
* func_8005BF50 OK
* func_8005BE50 OK
* func_8005BD50 OK
* func_8005BCC8 Ok
* func_8005BC28
* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok
* save my work commit
* func_8005C2BC fake OK
* func_8005C5B0 ok
* func_8005C608 ok
* func_8005C6C0 ok
* func_8005C6F8 ok
* func_8005C730 ok
* func_8005C774 func_8005C798 func_8005C7BC OK
* func_8005C7E0 ok, func_8005C810 split
* func_8005C810 OK
* func_8005C8C8 ok
* func_8005C964 OK
* func_8005CA88 ok
* func_8005CBAC ok
* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK
* func_8005CD34 func_8005CDD0 Ok
* func_8005CE6C ok
* func_8005CEC4 ok
* func_8005CEDC ok
* func_8005CF90 Ok
* standardize type names/vars more
* func_8005D3BC ok
* func_8005D40C OK, z64.h CollisionCheckContext
* func_8005D4B4 func_8005D4C8 ok
* partial data section migration
* improve function documentation, OT->OC
* Actor_CollisionCheck_SetOC ok
* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok
* func_8005BA84 ok
* func_800611A0 ok
* func_80061274 ok
* clean up func_80061274
* func_8006139C ok
* func_8005E9C0 and dependencies OK
* minor cleanup to func_8005E9C0
* func_8005EC6C OK!
* func_8005E81C ok
* func_8005E604 ok
* func_8005E2EC func_8005E4F8 OK
* func_8005DE9C OK func_8005D8AC disassembled
* func_8006146C func_8006268C ok
* func_8005EEE0 ok
* func_8005F17C
* func_8005F39C ok
* func_8005F5B0 decompiled, not matching
* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK
* func_8005FA30 ok, split more functions
* func_8005FC04 ok
* func_8005FDCC k
* func_8005FF90 OK OK OK
* func_80060204 dead
* func_800604B0 ok
* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish
* func_800635D0 ok, func_80062ECC not so much
* OcLine oks
* D_8011DF28 functions disassembled
* D_8011DF5C functions OK
* setAT_SAC. setAC_SAC, setOC_SAC OK
* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK
* func_800617D4 ok, func_800614A4 disassembled
* CollisionCheck_OC D_8011DFAC functions OK
* func_80062530 ok
* CollisionCheck_generalLineOcCheck subfunctions OK
* func_800622E4 ok
* after a long fought battle, func_80061F64 has fallen.
* func_800628A4 disassembled
* func_800627A0 func_8006285C OK
* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok
* func_80062CD4 decompiled, import EffShield/EffSpark types from MM
* various SubActor98 struct functions OK
* func_8005D4DC func_8005D62C ok
* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs
* func_80060C2C ok
* minor code tweaks
* func_80061C98 ok somehow
* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types
* Apply changes
* formatting
* tweak a couple function names
* krim changes, func naming
* missed some things
* function renames
* Implement GenColliderInit.py utility
* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching
* func_800614A4 ok
* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE
* collisionCheckCtx -> colChkCtx, fix small things
2020-04-26 02:43:35 +00:00
|
|
|
|
return actor->colChkInfo.health;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
void Actor_SetDropFlag(Actor* actor, ColliderInfo* colInfo, s32 freezeFlag) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
if (colInfo->acHitInfo == NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x00;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (freezeFlag &&
|
|
|
|
|
(colInfo->acHitInfo->toucher.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
actor->freezeTimer = colInfo->acHitInfo->toucher.damage;
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x00;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_FIRE) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x01;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_ICE) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x02;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK1) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x04;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK2) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x08;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK3) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x10;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_LIGHT) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x20;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (colInfo->acHitInfo->toucher.dmgFlags & DMG_MAGIC_LIGHT) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (freezeFlag) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
actor->freezeTimer = colInfo->acHitInfo->toucher.damage;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x40;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x00;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 23:51:04 +00:00
|
|
|
|
void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSph, s32 freezeFlag) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
ColliderInfo* curColInfo;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 flag;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag = 0x00;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
z_collision_check.c (#73)
* func_8005B280 ok
* func_8005B65C OK
* split out func_8005BD50
* func_8005B7C0 OK
* func_8005B7F4 OK
* func_8005B824 OK
* func_8005B860 ok
* improve sanity
* func_8005B6B0 ok, ColliderInit_Actor structs added
* func_8005B884 ok
* func_8005BBF8 ok, split out func_8005BF50
* split more stuff out of func_8005C050.s
* func_8005C050 OK
* func_8005BA30 fakish OK, func_8005BAD8 real OK
* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues
* func_8005BB10 Ok
* func_8005BF50 OK
* func_8005BE50 OK
* func_8005BD50 OK
* func_8005BCC8 Ok
* func_8005BC28
* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok
* save my work commit
* func_8005C2BC fake OK
* func_8005C5B0 ok
* func_8005C608 ok
* func_8005C6C0 ok
* func_8005C6F8 ok
* func_8005C730 ok
* func_8005C774 func_8005C798 func_8005C7BC OK
* func_8005C7E0 ok, func_8005C810 split
* func_8005C810 OK
* func_8005C8C8 ok
* func_8005C964 OK
* func_8005CA88 ok
* func_8005CBAC ok
* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK
* func_8005CD34 func_8005CDD0 Ok
* func_8005CE6C ok
* func_8005CEC4 ok
* func_8005CEDC ok
* func_8005CF90 Ok
* standardize type names/vars more
* func_8005D3BC ok
* func_8005D40C OK, z64.h CollisionCheckContext
* func_8005D4B4 func_8005D4C8 ok
* partial data section migration
* improve function documentation, OT->OC
* Actor_CollisionCheck_SetOC ok
* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok
* func_8005BA84 ok
* func_800611A0 ok
* func_80061274 ok
* clean up func_80061274
* func_8006139C ok
* func_8005E9C0 and dependencies OK
* minor cleanup to func_8005E9C0
* func_8005EC6C OK!
* func_8005E81C ok
* func_8005E604 ok
* func_8005E2EC func_8005E4F8 OK
* func_8005DE9C OK func_8005D8AC disassembled
* func_8006146C func_8006268C ok
* func_8005EEE0 ok
* func_8005F17C
* func_8005F39C ok
* func_8005F5B0 decompiled, not matching
* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK
* func_8005FA30 ok, split more functions
* func_8005FC04 ok
* func_8005FDCC k
* func_8005FF90 OK OK OK
* func_80060204 dead
* func_800604B0 ok
* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish
* func_800635D0 ok, func_80062ECC not so much
* OcLine oks
* D_8011DF28 functions disassembled
* D_8011DF5C functions OK
* setAT_SAC. setAC_SAC, setOC_SAC OK
* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK
* func_800617D4 ok, func_800614A4 disassembled
* CollisionCheck_OC D_8011DFAC functions OK
* func_80062530 ok
* CollisionCheck_generalLineOcCheck subfunctions OK
* func_800622E4 ok
* after a long fought battle, func_80061F64 has fallen.
* func_800628A4 disassembled
* func_800627A0 func_8006285C OK
* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok
* func_80062CD4 decompiled, import EffShield/EffSpark types from MM
* various SubActor98 struct functions OK
* func_8005D4DC func_8005D62C ok
* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs
* func_80060C2C ok
* minor code tweaks
* func_80061C98 ok somehow
* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types
* Apply changes
* formatting
* tweak a couple function names
* krim changes, func naming
* missed some things
* function renames
* Implement GenColliderInit.py utility
* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching
* func_800614A4 ok
* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE
* collisionCheckCtx -> colChkCtx, fix small things
2020-04-26 02:43:35 +00:00
|
|
|
|
for (i = jntSph->count - 1; i >= 0; i--) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
curColInfo = &jntSph->elements[i].info;
|
|
|
|
|
if (curColInfo->acHitInfo == NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x00;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (freezeFlag &&
|
|
|
|
|
(curColInfo->acHitInfo->toucher.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
actor->freezeTimer = curColInfo->acHitInfo->toucher.damage;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x00;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_FIRE) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x01;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_ICE) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x02;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x04;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK2) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x08;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_UNK3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x10;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_ARROW_LIGHT) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x20;
|
2022-06-03 18:36:04 +00:00
|
|
|
|
} else if (curColInfo->acHitInfo->toucher.dmgFlags & DMG_MAGIC_LIGHT) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (freezeFlag) {
|
2021-01-18 02:13:36 +00:00
|
|
|
|
actor->freezeTimer = curColInfo->acHitInfo->toucher.damage;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x40;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
flag = 0x00;
|
|
|
|
|
}
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->dropFlag |= flag;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-15 22:59:59 +00:00
|
|
|
|
void func_80035844(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 dx = arg1->x - arg0->x;
|
|
|
|
|
f32 dz = arg1->z - arg0->z;
|
|
|
|
|
f32 dy = arg3 ? (arg1->y - arg0->y) : (arg0->y - arg1->y);
|
|
|
|
|
|
2021-02-15 22:59:59 +00:00
|
|
|
|
arg2->y = Math_Atan2S(dz, dx);
|
|
|
|
|
arg2->x = Math_Atan2S(sqrtf(SQ(dx) + SQ(dz)), dy);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-08-29 22:25:16 +00:00
|
|
|
|
* Spawns En_Part (Dissipating Flames) actor as a child of the given actor.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, PlayState* play,
|
2022-06-16 00:15:44 +00:00
|
|
|
|
s16 params, Gfx* dList) {
|
2020-05-01 18:26:16 +00:00
|
|
|
|
EnPart* spawnedEnPart;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y,
|
|
|
|
|
spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (spawnedEnPart != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
spawnedEnPart->actor.scale = actor->scale;
|
2020-10-01 22:51:05 +00:00
|
|
|
|
spawnedEnPart->actor.speedXZ = arg3[0];
|
2022-06-16 00:15:44 +00:00
|
|
|
|
spawnedEnPart->displayList = dList;
|
2020-10-01 22:51:05 +00:00
|
|
|
|
spawnedEnPart->action = 2;
|
2020-12-04 00:25:36 +00:00
|
|
|
|
spawnedEnPart->timer = timer;
|
2020-10-01 22:51:05 +00:00
|
|
|
|
spawnedEnPart->rotZ = arg3[1];
|
|
|
|
|
spawnedEnPart->rotZSpeed = arg3[2];
|
2021-02-02 23:44:24 +00:00
|
|
|
|
return &spawnedEnPart->actor;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) {
|
2022-03-09 00:43:07 +00:00
|
|
|
|
f32 floorPolyNormalX;
|
|
|
|
|
f32 floorPolyNormalY;
|
|
|
|
|
f32 floorPolyNormalZ;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
f32 sp38;
|
|
|
|
|
f32 sp34;
|
|
|
|
|
f32 sp30;
|
|
|
|
|
f32 sp2C;
|
|
|
|
|
f32 sp28;
|
|
|
|
|
f32 sp24;
|
|
|
|
|
CollisionPoly* floorPoly;
|
|
|
|
|
s32 pad;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (actor->floorPoly != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
floorPoly = actor->floorPoly;
|
2022-03-09 00:43:07 +00:00
|
|
|
|
floorPolyNormalX = COLPOLY_GET_NORMAL(floorPoly->normal.x);
|
|
|
|
|
floorPolyNormalY = COLPOLY_GET_NORMAL(floorPoly->normal.y);
|
|
|
|
|
floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
sp38 = Math_SinS(arg1);
|
|
|
|
|
sp34 = Math_CosS(arg1);
|
2022-03-09 00:43:07 +00:00
|
|
|
|
sp28 = (-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34));
|
2022-04-24 14:23:49 +00:00
|
|
|
|
arg2->x = -RAD_TO_BINANG(Math_FAtan2F(sp28 * floorPolyNormalY, 1.0f));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
|
sp2C = Math_SinS(arg1 - 16375);
|
|
|
|
|
sp30 = Math_CosS(arg1 - 16375);
|
2022-03-09 00:43:07 +00:00
|
|
|
|
sp24 = (-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30));
|
2022-04-24 14:23:49 +00:00
|
|
|
|
arg2->z = -RAD_TO_BINANG(Math_FAtan2F(sp24 * floorPolyNormalY, 1.0f));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_80035B18(PlayState* play, Actor* actor, u16 textId) {
|
|
|
|
|
Message_ContinueTextbox(play, textId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
actor->textId = textId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if event_chk_inf flag is set.
|
|
|
|
|
*/
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 Flags_GetEventChkInf(s32 flag) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
return GET_EVENTCHKINF(flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets event_chk_inf flag.
|
|
|
|
|
*/
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Flags_SetEventChkInf(s32 flag) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
SET_EVENTCHKINF(flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-24 23:45:05 +00:00
|
|
|
|
* Tests if inf_table flag is set.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2020-03-22 21:19:43 +00:00
|
|
|
|
s32 Flags_GetInfTable(s32 flag) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
return GET_INFTABLE(flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-24 23:45:05 +00:00
|
|
|
|
* Sets inf_table flag.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*/
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void Flags_SetInfTable(s32 flag) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
SET_INFTABLE(flag);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u32 func_80035BFC(PlayState* play, s16 arg1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
u16 retTextId = 0;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (arg1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_05)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1048;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1047;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_02)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_03)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1032;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1031;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_00)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_01)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1003;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1002;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1001;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_10)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1046;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1045;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_03)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_0E)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1034;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1033;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_0C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1030;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x102F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_19)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1071;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1070;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_0B)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_17)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1068;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1067;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_15)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1061;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1060;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1042;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1004;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1072;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_41)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1055;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1056;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_1E)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1005;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1073;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x105A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1042;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1007;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1072;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_47)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x105E;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x105D;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1044;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_22)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1009;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1008;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1075;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x105B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1042;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_24)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x100B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x100A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1056;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x105F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1043;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_26)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x100D;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x100C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1057;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1057;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1043;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_28)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1019;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x100E;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1077;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_51)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1058;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1059;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1049;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1035;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1079;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2021-10-03 03:17:09 +00:00
|
|
|
|
retTextId = 0x104E;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 10:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x104A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1038;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1079;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_59)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1050;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x104F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 11:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x104B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x103C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2021-10-03 03:17:09 +00:00
|
|
|
|
retTextId = 0x107B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1051;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 12:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x104C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x103D;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x107C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1052;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 13:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x104D;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x103E;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x106E;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_61)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1053;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1054;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 15:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_5C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1078;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_66)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1066;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x1062;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 16:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (play->sceneNum == SCENE_SPOT15) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7002;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_6A)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7004;
|
2022-05-20 18:40:13 +00:00
|
|
|
|
} else if ((gSaveContext.dayTime >= CLOCK_TIME(6, 0)) && (gSaveContext.dayTime <= CLOCK_TIME(18, 30))) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7002;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7003;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 17:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_6C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7008;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7007;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 19:
|
|
|
|
|
retTextId = 0x702D;
|
|
|
|
|
break;
|
|
|
|
|
case 18:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_12)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_71)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7072;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7071;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7029;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 20:
|
|
|
|
|
case 21:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_42)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2012;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_41)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_76)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2011;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2010;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_40)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x200F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x200E;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 24:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7044;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7015;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 25:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7045;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_C2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7016;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 26:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7046;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_C2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7018;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 27:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7047;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701A;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_C6)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 28:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7048;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_CA);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701D;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 29:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7049;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_CC);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x701F;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 30:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x704A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_CE);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7021;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 31:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x704B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_D0);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7023;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 32:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x704C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_D2);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7025;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 33:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
|
|
|
|
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x704D;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_D4);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x7027;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 34:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_GetInfTable(INFTABLE_D6);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x403C;
|
|
|
|
|
break;
|
|
|
|
|
case 35:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_D8)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5029;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5028;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 37:
|
|
|
|
|
retTextId = 0x5002;
|
|
|
|
|
break;
|
|
|
|
|
case 38:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_23)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3021;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_E0)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3008;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_20)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 39:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_23)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3026;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3009;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_2A)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 40:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_23)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3026;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_EB)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x300A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_2B)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 41:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_F0)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3015;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3014;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_2C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 42:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_F4)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3017;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3016;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_2C)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 43:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3027;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_F8)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3019;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3018;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_2D)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x302A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 48:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_25)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x3029;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_20) && Flags_GetEventChkInf(EVENTCHKINF_21)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x301B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x301A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 49:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402D;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4007;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 50:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402E;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_124)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4009;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4008;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 51:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402D;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_31)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_12A)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x400B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x400A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 52:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402E;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x400C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 53:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402D;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_33)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4010;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x400F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 54:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402E;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_30)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4011;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x4006;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 55:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x402B;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_31)) {
|
|
|
|
|
if (Flags_GetInfTable(INFTABLE_138)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x401C;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x401B;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x401A;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 58:
|
|
|
|
|
retTextId = 0x500F;
|
|
|
|
|
break;
|
|
|
|
|
case 59:
|
|
|
|
|
retTextId = 0x5010;
|
|
|
|
|
break;
|
|
|
|
|
case 60:
|
|
|
|
|
retTextId = 0x5012;
|
|
|
|
|
break;
|
|
|
|
|
case 61:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_166)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5001;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5000;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 62:
|
|
|
|
|
retTextId = 0x5012;
|
|
|
|
|
break;
|
|
|
|
|
case 63:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_16A)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5001;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x5000;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 71:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_16)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2049;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_15)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2048;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2047;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_12) && !Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2044;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetEventChkInf(EVENTCHKINF_10)) {
|
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2043;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2042;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2041;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case 72:
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2040;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_94)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2040;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x203F;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if (!IS_DAY) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x204E;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
} else if (Flags_GetInfTable(INFTABLE_9A)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2031;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0x2030;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (retTextId == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
retTextId = 1;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
|
|
return retTextId;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
void func_80036E50(u16 textId, s16 arg1) {
|
|
|
|
|
switch (arg1) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (textId) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0x1001:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_00);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1002:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_01);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1031:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_03);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_03);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1047:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_05);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 1:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (textId) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0x102F:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_02);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_0C);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1033:
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_04);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_0E);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1045:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_10);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1060:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_15);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1067:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_0A);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_17);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 0x1070:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_19);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 2:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x1056) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_41);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 3:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x1005) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_1E);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 4:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x105D) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_47);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 5:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x1008) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_22);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 6:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x100A) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_24);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 7:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x100C) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_26);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 8:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x100E) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_28);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x1059) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_51);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 10:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x104F) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_59);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 13:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x1054) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_61);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 15:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x1062) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_66);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 16:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7002) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_6A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x7003) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_6A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 17:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7007) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_6C);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 18:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7071) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_71);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 20:
|
|
|
|
|
case 21:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x2010) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_76);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 25:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7016) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_C2);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 26:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7018) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_C4);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 28:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x701D) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_CA);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 29:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x701F) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_CC);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 30:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7021) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_CE);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 31:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7023) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_D0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 32:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7025) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_D2);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 33:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x7027) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_D4);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 34:
|
2021-10-03 03:17:09 +00:00
|
|
|
|
if (textId == 0x403C) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_D6);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 35:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x5028) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_D8);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 38:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x3008) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_E0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 40:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x300B) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_EB);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 41:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x3014) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_F0);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 42:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x3016) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_F4);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 43:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x3018) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_20);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_F8);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 48:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x3020) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_22);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_113);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 49:
|
|
|
|
|
case 52:
|
|
|
|
|
case 53:
|
|
|
|
|
case 54:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x4006) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_30);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 50:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x4006) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_30);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x4008) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_124);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 51:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x4006) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_30);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x400A) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_32);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x402F) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_12A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 55:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x401B) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_33);
|
|
|
|
|
Flags_SetInfTable(INFTABLE_138);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 61:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x5000) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_166);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 63:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x5013) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_16A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 71:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (textId == 0x2041) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_10);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x2044) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_12);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x2047) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_15);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (textId == 0x2048) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetEventChkInf(EVENTCHKINF_16);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
return;
|
|
|
|
|
case 72:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800374E0(PlayState* play, Actor* actor, u16 textId) {
|
|
|
|
|
MessageContext* msgCtx = &play->msgCtx;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s32 ret = 1;
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
switch (textId) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
case 0x1035:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_2A)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1036);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1041);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_2B)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1037);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1041);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x1038:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_2E)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1039);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1041);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_2F)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x103A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1041);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 2) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_30)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x103B);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1041);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x103E:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x103F);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1040);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x1041:
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
if (msgCtx->choiceTextId == 0x1035) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1036);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_2A);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1037);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_2B);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
if (msgCtx->choiceTextId == 0x1038) {
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1039);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_2E);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x103A);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_2F);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 2) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x103B);
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_30);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x1062:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1063);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x1064);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x2030:
|
|
|
|
|
case 0x2031:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
|
|
|
|
if (gSaveContext.rupees >= 10) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x2034);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
Rupees_ChangeBy(-10);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x2032);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x2032);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-04-29 18:19:48 +00:00
|
|
|
|
Flags_SetInfTable(INFTABLE_9A);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x2036:
|
|
|
|
|
case 0x2037:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x201F);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x205A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x2038:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x205A);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x2034:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex != 0) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x2035);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x2043:
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_12)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x2044);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x205A:
|
|
|
|
|
break;
|
|
|
|
|
case 0x300A:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetEventChkInf(EVENTCHKINF_22)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x300B);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x300C);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x300D);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x301B:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x301D);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (Flags_GetInfTable(INFTABLE_113)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x301F);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x301E);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x301E:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x3020);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x400C:
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (msgCtx->choiceIndex == 0) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x400D);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
if (msgCtx->choiceIndex == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x400E);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x7007:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x703E);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x703E:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x703F);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x703F:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80035B18(play, actor, 0x7042);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
u16 func_80037C30(PlayState* play, s16 arg1) {
|
|
|
|
|
return func_80035BFC(play, arg1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80037C5C(PlayState* play, s16 arg1, u16 textId) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
func_80036E50(textId, arg1);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80037C94(PlayState* play, Actor* actor, s32 arg2) {
|
|
|
|
|
return func_800374E0(play, actor, actor->textId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80037CB8(PlayState* play, Actor* actor, s16 arg2) {
|
|
|
|
|
MessageContext* msgCtx = &play->msgCtx;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
s32 ret = false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
switch (Message_GetState(msgCtx)) {
|
|
|
|
|
case TEXT_STATE_CLOSING:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
func_80037C5C(play, arg2, actor->textId);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
ret = true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
break;
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
case TEXT_STATE_CHOICE:
|
|
|
|
|
case TEXT_STATE_EVENT:
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Message_ShouldAdvance(play) && func_80037C94(play, actor, arg2)) {
|
2022-07-30 13:05:27 +00:00
|
|
|
|
Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
msgCtx->msgMode = MSGMODE_TEXT_CLOSING;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
ret = true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
s16 var;
|
|
|
|
|
s16 sp2C;
|
|
|
|
|
s16 sp2A;
|
|
|
|
|
s16 abs_var;
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (Actor_ProcessTalkRequest(actor, play)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*arg3 = 1;
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (*arg3 == 1) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (func_80037CB8(play, actor, arg2)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
*arg3 = 0;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Actor_GetScreenPos(play, actor, &sp2C, &sp2A);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (0) {} // Necessary to match
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-09-15 19:10:19 +00:00
|
|
|
|
if ((sp2C < 0) || (sp2C > SCREEN_WIDTH) || (sp2A < 0) || (sp2A > SCREEN_HEIGHT)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
var = actor->yawTowardsPlayer - actor->shape.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
abs_var = ABS(var);
|
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (abs_var >= 0x4300) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
if ((actor->xyzDistToPlayerSq > SQ(160.0f)) && !actor->isTargeted) {
|
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
if (actor->xyzDistToPlayerSq <= SQ(80.0f)) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (func_8002F2CC(actor, play, 80.0f)) {
|
|
|
|
|
actor->textId = func_80037C30(play, arg2);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (func_8002F2F4(actor, play)) {
|
|
|
|
|
actor->textId = func_80037C30(play, arg2);
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
s32 Actor_TrackNone(Vec3s* headRot, Vec3s* torsoRot) {
|
|
|
|
|
Math_SmoothStepToS(&headRot->y, 0, 6, 6200, 100);
|
|
|
|
|
Math_SmoothStepToS(&headRot->x, 0, 6, 6200, 100);
|
|
|
|
|
Math_SmoothStepToS(&torsoRot->y, 0, 6, 6200, 100);
|
|
|
|
|
Math_SmoothStepToS(&torsoRot->x, 0, 6, 6200, 100);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
s32 Actor_TrackPoint(Actor* actor, Vec3f* target, Vec3s* headRot, Vec3s* torsoRot) {
|
|
|
|
|
s16 pitch;
|
|
|
|
|
s16 yaw;
|
|
|
|
|
s16 yawDiff;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
pitch = Math_Vec3f_Pitch(&actor->focus.pos, target);
|
|
|
|
|
yaw = Math_Vec3f_Yaw(&actor->focus.pos, target) - actor->world.rot.y;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
Math_SmoothStepToS(&headRot->x, pitch, 6, 2000, 1);
|
|
|
|
|
headRot->x = CLAMP(headRot->x, -6000, 6000);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
yawDiff = Math_SmoothStepToS(&headRot->y, yaw, 6, 2000, 1);
|
|
|
|
|
headRot->y = CLAMP(headRot->y, -8000, 8000);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
if ((yawDiff != 0) && (ABS(headRot->y) < 8000)) {
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
Math_SmoothStepToS(&torsoRot->y, yaw - headRot->y, 4, 2000, 1);
|
|
|
|
|
torsoRot->y = CLAMP(torsoRot->y, -12000, 12000);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Same as Actor_TrackPlayer, except use the actor's world position as the focus point, with the height
|
|
|
|
|
* specified.
|
|
|
|
|
*
|
|
|
|
|
* @param play
|
|
|
|
|
* @param actor
|
|
|
|
|
* @param headRot the computed actor's head's rotation step
|
|
|
|
|
* @param torsoRot the computed actor's torso's rotation step
|
|
|
|
|
* @param focusHeight the height of the focus point relative to their world position
|
|
|
|
|
*
|
|
|
|
|
* @return true if rotated towards player, false if rotations were stepped back to zero.
|
|
|
|
|
*
|
|
|
|
|
* @note same note as Actor_TrackPlayer
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusHeight) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Player* player = GET_PLAYER(play);
|
2022-06-03 18:29:23 +00:00
|
|
|
|
s16 yaw;
|
|
|
|
|
Vec3f target;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
actor->focus.pos = actor->world.pos;
|
2022-06-03 18:29:23 +00:00
|
|
|
|
actor->focus.pos.y += focusHeight;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (!(((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0))) {
|
2022-07-12 16:17:07 +00:00
|
|
|
|
yaw = ABS((s16)(actor->yawTowardsPlayer - actor->shape.rot.y));
|
2022-06-03 18:29:23 +00:00
|
|
|
|
if (yaw >= 0x4300) {
|
|
|
|
|
Actor_TrackNone(headRot, torsoRot);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0)) {
|
2022-06-03 18:29:23 +00:00
|
|
|
|
target = play->view.eye;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-06-03 18:29:23 +00:00
|
|
|
|
target = player->actor.focus.pos;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
Actor_TrackPoint(actor, &target, headRot, torsoRot);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* Computes the necessary HeadRot and TorsoRot steps to be added to the normal rotation to smoothly turn an actors's
|
|
|
|
|
* head and torso towards the player if within a certain yaw, else smoothly returns the rotations back to zero.
|
|
|
|
|
* Also sets the focus position with the specified point.
|
|
|
|
|
*
|
|
|
|
|
* @param play
|
|
|
|
|
* @param actor
|
|
|
|
|
* @param headRot the computed actor's head's rotation step
|
|
|
|
|
* @param torsoRot the computed actor's torso's rotation step
|
|
|
|
|
* @param focusPos the point to set as the actor's focus position
|
|
|
|
|
*
|
|
|
|
|
* @return true if rotated towards player, false if rotations were stepped back to zero.
|
|
|
|
|
*
|
|
|
|
|
* @note if in a cutscene or debug camera is enabled, and the last entrance used was Kokiri Forest spawn 0, the computed
|
|
|
|
|
* rotation will instead turn towards the view eye no matter the yaw.
|
|
|
|
|
*/
|
|
|
|
|
s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Player* player = GET_PLAYER(play);
|
2022-06-03 18:29:23 +00:00
|
|
|
|
s16 yaw;
|
|
|
|
|
Vec3f target;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
actor->focus.pos = focusPos;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (!(((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0))) {
|
2022-07-12 16:17:07 +00:00
|
|
|
|
yaw = ABS((s16)(actor->yawTowardsPlayer - actor->shape.rot.y));
|
2022-06-03 18:29:23 +00:00
|
|
|
|
if (yaw >= 0x4300) {
|
|
|
|
|
Actor_TrackNone(headRot, torsoRot);
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return false;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
if (((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) && (gSaveContext.entranceIndex == ENTR_SPOT04_0)) {
|
2022-06-03 18:29:23 +00:00
|
|
|
|
target = play->view.eye;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-06-03 18:29:23 +00:00
|
|
|
|
target = player->actor.focus.pos;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-06-03 18:29:23 +00:00
|
|
|
|
Actor_TrackPoint(actor, &target, headRot, torsoRot);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-04-09 23:02:16 +00:00
|
|
|
|
return true;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|