mirror of
https://github.com/zeldaret/oot.git
synced 2025-02-19 05:15:18 +00:00
Merge branch 'master' into cleanup_angle_macros_names
This commit is contained in:
commit
913cf1e3e0
25 changed files with 184 additions and 164 deletions
|
@ -660,7 +660,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId)
|
|||
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
s32 SurfaceType_IsConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
|
|
|
@ -1403,7 +1403,7 @@ typedef enum {
|
|||
/* 16 */ F_B8
|
||||
} FloorID;
|
||||
|
||||
// All arrays pointed in this struct are indexed by "map indexes"
|
||||
// All arrays pointed in this struct are indexed by "map indices"
|
||||
// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc)
|
||||
// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc)
|
||||
typedef struct {
|
||||
|
|
|
@ -608,8 +608,8 @@ typedef struct Player {
|
|||
/* 0x08A2 */ s16 unk_8A2;
|
||||
/* 0x08A4 */ f32 unk_8A4;
|
||||
/* 0x08A8 */ f32 unk_8A8;
|
||||
/* 0x08AC */ f32 windSpeed;
|
||||
/* 0x08B0 */ s16 windDirection;
|
||||
/* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces
|
||||
/* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed
|
||||
/* 0x08B4 */ WeaponInfo meleeWeaponInfo[3];
|
||||
/* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX];
|
||||
/* 0x09E0 */ MtxF mf_9E0;
|
||||
|
|
|
@ -4113,10 +4113,15 @@ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly*
|
|||
}
|
||||
|
||||
/**
|
||||
* CollisionPoly is conveyor enabled
|
||||
* Returns true if `poly` is a conveyor surface, else false
|
||||
* Checks if poly is a floor conveyor
|
||||
*
|
||||
* A conveyor surface is enabled with non-zero speed.
|
||||
* When enabled, the conveyor will exhibit two types of behaviour depending on the return value:
|
||||
*
|
||||
* If true, then it is a floor conveyor and will push player only while being stood on
|
||||
* If false, then it is a water conveyor and will push player only while in water
|
||||
*/
|
||||
s32 SurfaceType_IsConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
u32 flags;
|
||||
|
||||
if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) {
|
||||
|
|
|
@ -2345,7 +2345,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
{ 255, 255, 150 },
|
||||
{ 255, 255, 50 },
|
||||
};
|
||||
static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 };
|
||||
static s16 sMagicBorderIndices[] = { 0, 1, 1, 0 };
|
||||
static s16 sMagicBorderRatio = 2;
|
||||
static s16 sMagicBorderStep = 1;
|
||||
MessageContext* msgCtx = &globalCtx->msgCtx;
|
||||
|
@ -2410,7 +2410,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
temp = sMagicBorderIndexes[sMagicBorderStep];
|
||||
temp = sMagicBorderIndices[sMagicBorderStep];
|
||||
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
|
||||
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
|
||||
|
@ -2475,7 +2475,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
temp = sMagicBorderIndexes[sMagicBorderStep];
|
||||
temp = sMagicBorderIndices[sMagicBorderStep];
|
||||
borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
|
||||
borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio;
|
||||
|
|
|
@ -804,7 +804,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
|
|||
return var + 1;
|
||||
}
|
||||
|
||||
u8 sEyeMouthIndexes[][2] = {
|
||||
u8 sEyeMouthIndices[][2] = {
|
||||
{ 0, 0 }, { 1, 0 }, { 2, 0 }, { 0, 0 }, { 1, 0 }, { 2, 0 }, { 4, 0 }, { 5, 1 },
|
||||
{ 7, 2 }, { 0, 2 }, { 3, 0 }, { 4, 0 }, { 2, 2 }, { 1, 1 }, { 0, 2 }, { 0, 0 },
|
||||
};
|
||||
|
@ -868,7 +868,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
|
|||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1721);
|
||||
|
||||
if (eyeIndex < 0) {
|
||||
eyeIndex = sEyeMouthIndexes[face][0];
|
||||
eyeIndex = sEyeMouthIndices[face][0];
|
||||
}
|
||||
|
||||
#ifndef AVOID_UB
|
||||
|
@ -878,7 +878,7 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
|
|||
#endif
|
||||
|
||||
if (mouthIndex < 0) {
|
||||
mouthIndex = sEyeMouthIndexes[face][1];
|
||||
mouthIndex = sEyeMouthIndices[face][1];
|
||||
}
|
||||
|
||||
#ifndef AVOID_UB
|
||||
|
|
|
@ -141,7 +141,7 @@ s32 func_800A698C(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parent
|
|||
}
|
||||
|
||||
/**
|
||||
* Recursively applies matrix tranformations to each limb
|
||||
* Recursively applies matrix transformations to each limb
|
||||
*/
|
||||
s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation) {
|
||||
s32 i;
|
||||
|
|
|
@ -193,7 +193,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
GlobalContext* globalCtx = globalCtx2;
|
||||
u32 stateFrames;
|
||||
EnArrow* arrow;
|
||||
Actor* tranform;
|
||||
Actor* transform;
|
||||
|
||||
stateFrames = globalCtx->state.frames;
|
||||
arrow = (EnArrow*)this->actor.parent;
|
||||
|
@ -201,14 +201,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
|
||||
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
|
||||
if (1) {}
|
||||
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618);
|
||||
|
||||
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(tranform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(tranform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(tranform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
|
||||
|
||||
// Draw red effect over the screen when arrow hits
|
||||
|
|
|
@ -192,7 +192,7 @@ void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowIce* this = (ArrowIce*)thisx;
|
||||
s32 pad;
|
||||
Actor* tranform;
|
||||
Actor* transform;
|
||||
u32 stateFrames = globalCtx->state.frames;
|
||||
EnArrow* arrow = (EnArrow*)this->actor.parent;
|
||||
|
||||
|
@ -200,14 +200,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
|
||||
if (1) {}
|
||||
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610);
|
||||
|
||||
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(tranform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(tranform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(tranform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
|
||||
|
||||
// Draw blue effect over the screen when arrow hits
|
||||
|
|
|
@ -192,20 +192,20 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 pad;
|
||||
u32 stateFrames = globalCtx->state.frames;
|
||||
EnArrow* arrow = (EnArrow*)this->actor.parent;
|
||||
Actor* tranform;
|
||||
Actor* transform;
|
||||
|
||||
if (1) {}
|
||||
|
||||
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
|
||||
if (1) {}
|
||||
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 598);
|
||||
|
||||
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(tranform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(tranform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(tranform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
|
||||
Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY);
|
||||
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
|
||||
|
||||
// Draw yellow effect over the screen when arrow hits
|
||||
|
|
|
@ -436,8 +436,8 @@ void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) {
|
|||
|
||||
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) &&
|
||||
(GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||
player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
|
||||
player->windDirection = this->dyna.actor.shape.rot.y;
|
||||
player->pushedSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
|
||||
player->pushedYaw = this->dyna.actor.shape.rot.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ const ActorInit Bg_Mizu_Water_InitVars = {
|
|||
static f32 sUnused1 = 0;
|
||||
static f32 sUnused2 = 110.0f;
|
||||
|
||||
static u32 sWaterBoxIndexes[] = { 2, 3, 5, 7, 12, 20, 21, 22 };
|
||||
static u32 sWaterBoxIndices[] = { 2, 3, 5, 7, 12, 20, 21, 22 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F(scale, 1, ICHAIN_STOP),
|
||||
|
@ -84,7 +84,7 @@ void BgMizuWater_SetWaterBoxesHeight(WaterBox* waterBoxes, s16 height) {
|
|||
u32 i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
waterBoxes[sWaterBoxIndexes[i]].ySurface = height;
|
||||
waterBoxes[sWaterBoxIndices[i]].ySurface = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1026,8 +1026,8 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) {
|
|||
|
||||
for (i = 0; i < 4; i++) {
|
||||
//! @bug this 0-indexes into this->defeatedLimbPositions which is initialized with
|
||||
// this->defeatedLimbPositions[limb], but limb is 1-indexed in skelanime callbacks, this means effects
|
||||
// should spawn at this->defeatedLimbPositions[0] too, which is uninitialized, so map origin?
|
||||
//! this->defeatedLimbPositions[limb], but limb is 1-indexed in skelanime callbacks, this means effects
|
||||
//! should spawn at this->defeatedLimbPositions[0] too, which is uninitialized, so map origin?
|
||||
j = (s16)(Rand_ZeroOne() * (BOSSGOMA_LIMB_MAX - 1));
|
||||
if (this->defeatedLimbPositions[j].y < 10000.0f) {
|
||||
pos.x = Rand_CenteredFloat(20.0f) + this->defeatedLimbPositions[j].x;
|
||||
|
@ -1083,8 +1083,8 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) {
|
|||
|
||||
for (i = 0; i < 4; i++) {
|
||||
BossGoma_ClearPixels(sClearPixelTableFirstPass, this->decayingProgress);
|
||||
//! @bug this allows this->decayingProgress = 0x100 = 256 which is out of bounds when accessing
|
||||
// sClearPixelTableFirstPass, though timers may prevent this from ever happening?
|
||||
//! @bug this allows this->decayingProgress = 0x100 = 256 which
|
||||
//! is out of bounds when accessing sClearPixelTableFirstPass
|
||||
if (this->decayingProgress < 0x100) {
|
||||
this->decayingProgress++;
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ void DemoGj_InitCommon(DemoGj* this, GlobalContext* globalCtx, CollisionHeader*
|
|||
}
|
||||
|
||||
// TODO: find a better name
|
||||
s32 DemoGj_InitSetIndexes(DemoGj* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig,
|
||||
s32 DemoGj_InitSetIndices(DemoGj* this, GlobalContext* globalCtx, s32 updateMode, s32 drawConfig,
|
||||
CollisionHeader* header) {
|
||||
if (!DemoGj_IsSceneInvalid()) {
|
||||
this->updateMode = updateMode;
|
||||
|
@ -565,7 +565,7 @@ void DemoGj_CheckIfTransformedIntoGanon(DemoGj* this) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile1(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 1, 2, &gGanonsCastleRubble2Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 1, 2, &gGanonsCastleRubble2Col);
|
||||
}
|
||||
|
||||
void func_8097A000(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -630,7 +630,7 @@ void DemoGj_DrawRotatedRubble2(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile2(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 2, 3, &gGanonsCastleRubble3Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 2, 3, &gGanonsCastleRubble3Col);
|
||||
}
|
||||
|
||||
void func_8097A238(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -695,7 +695,7 @@ void DemoGj_DrawRotatedRubble3(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile3(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 3, 4, &gGanonsCastleRubble4Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 3, 4, &gGanonsCastleRubble4Col);
|
||||
}
|
||||
|
||||
void func_8097A474(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -743,7 +743,7 @@ void DemoGj_DrawRotatedRubble4(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile4(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 4, 5, &gGanonsCastleRubble5Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 4, 5, &gGanonsCastleRubble5Col);
|
||||
}
|
||||
|
||||
void func_8097A644(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -791,7 +791,7 @@ void DemoGj_DrawRotatedRubble5(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile5(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 5, 6, &gGanonsCastleRubble6Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 5, 6, &gGanonsCastleRubble6Col);
|
||||
}
|
||||
|
||||
void func_8097A814(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -839,7 +839,7 @@ void DemoGj_DrawRotatedRubble6(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile6(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 6, 7, &gGanonsCastleRubble7Col);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 6, 7, &gGanonsCastleRubble7Col);
|
||||
}
|
||||
|
||||
void func_8097A9E4(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -887,7 +887,7 @@ void DemoGj_DrawRotatedRubble7(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubblePile7(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 7, 8, &gGanonsCastleRubbleTallCol);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 7, 8, &gGanonsCastleRubbleTallCol);
|
||||
}
|
||||
|
||||
void func_8097ABB4(DemoGj* this, GlobalContext* globalCtx) {
|
||||
|
@ -952,7 +952,7 @@ void DemoGj_DrawRotatedRubbleTall(DemoGj* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void DemoGj_InitRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 0, 1, &gGanonsCastleRubbleAroundArenaCol);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 0, 1, &gGanonsCastleRubbleAroundArenaCol);
|
||||
}
|
||||
|
||||
// func_8097ADF0
|
||||
|
@ -969,7 +969,7 @@ void DemoGj_DrawRubbleAroundArena(DemoGj* this, GlobalContext* globalCtx) {
|
|||
|
||||
// Inits the three cylinders with `sCylinderInit1`
|
||||
void DemoGj_InitDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 15, 0, NULL);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 15, 0, NULL);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit1);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit1);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit1);
|
||||
|
@ -1102,7 +1102,7 @@ void DemoGj_DrawDestructableRubble1(DemoGj* this, GlobalContext* globalCtx) {
|
|||
|
||||
// Inits the three cylinders with `sCylinderInit2`
|
||||
void DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 16, 0, NULL);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 16, 0, NULL);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit2);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[1], &sCylinderInit2);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[2], &sCylinderInit2);
|
||||
|
@ -1233,7 +1233,7 @@ void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, GlobalContext* globalCt
|
|||
|
||||
// Inits the first cylinder (only that one) with `sCylinderInit3`
|
||||
void DemoGj_InitDestructableRubbleTall(DemoGj* this, GlobalContext* globalCtx) {
|
||||
DemoGj_InitSetIndexes(this, globalCtx, 17, 0, NULL);
|
||||
DemoGj_InitSetIndices(this, globalCtx, 17, 0, NULL);
|
||||
DemoGj_InitCylinder(this, globalCtx, &this->cylinders[0], &sCylinderInit3);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
sActionFuncs[this->action](this, globalCtx);
|
||||
}
|
||||
|
||||
s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) {
|
||||
s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) {
|
||||
s32 pad;
|
||||
DemoTreLgt* this = (DemoTreLgt*)thisx;
|
||||
|
||||
|
@ -147,6 +147,11 @@ s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve,
|
|||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_tre_lgt.c", 448);
|
||||
|
||||
//! @bug missing return
|
||||
// If the return value ends up being false (0), the limb won't draw (meaning no limb at all will draw).
|
||||
// In MQ Debug, `Graph_CloseDisps` has the last instruction writing to v0 before this function ends.
|
||||
// That instruction sets v0 to a non-NULL pointer, which is "true", so the limbs get drawn.
|
||||
}
|
||||
|
||||
void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
@ -161,7 +166,7 @@ void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
func_80093D84(gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0);
|
||||
SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_PostLimbDraw, NULL, 1, thisx);
|
||||
SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, thisx);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_demo_tre_lgt.c", 476);
|
||||
}
|
||||
|
|
|
@ -357,17 +357,17 @@ void EnBomChu_WaitForKill(EnBomChu* this, GlobalContext* globalCtx) {
|
|||
|
||||
/**
|
||||
* Transform coordinates from model space to world space, according to current orientation.
|
||||
* `posModel` is expected to already be at world scale (1/100 compared to model scale)
|
||||
* `modelPos` is expected to already be at world scale (1/100 compared to model scale)
|
||||
*/
|
||||
void EnBomChu_ModelToWorld(EnBomChu* this, Vec3f* posModel, Vec3f* dest) {
|
||||
f32 x = posModel->x + this->visualJitter;
|
||||
void EnBomChu_ModelToWorld(EnBomChu* this, Vec3f* modelPos, Vec3f* dest) {
|
||||
f32 x = modelPos->x + this->visualJitter;
|
||||
|
||||
dest->x = this->actor.world.pos.x + (this->axisLeft.x * x) + (this->axisUp.x * posModel->y) +
|
||||
(this->axisForwards.x * posModel->z);
|
||||
dest->y = this->actor.world.pos.y + (this->axisLeft.y * x) + (this->axisUp.y * posModel->y) +
|
||||
(this->axisForwards.y * posModel->z);
|
||||
dest->z = this->actor.world.pos.z + (this->axisLeft.z * x) + (this->axisUp.z * posModel->y) +
|
||||
(this->axisForwards.z * posModel->z);
|
||||
dest->x = this->actor.world.pos.x + (this->axisLeft.x * x) + (this->axisUp.x * modelPos->y) +
|
||||
(this->axisForwards.x * modelPos->z);
|
||||
dest->y = this->actor.world.pos.y + (this->axisLeft.y * x) + (this->axisUp.y * modelPos->y) +
|
||||
(this->axisForwards.y * modelPos->z);
|
||||
dest->z = this->actor.world.pos.z + (this->axisLeft.z * x) + (this->axisUp.z * modelPos->y) +
|
||||
(this->axisForwards.z * modelPos->z);
|
||||
}
|
||||
|
||||
void EnBomChu_SpawnRipples(EnBomChu* this, GlobalContext* globalCtx, f32 y) {
|
||||
|
|
|
@ -170,7 +170,7 @@ s32 func_809CC020(EnBubble* this) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void EnBubble_Vec3fNormalizedRelfect(Vec3f* vec1, Vec3f* vec2, Vec3f* ret) {
|
||||
void EnBubble_Vec3fNormalizedReflect(Vec3f* vec1, Vec3f* vec2, Vec3f* ret) {
|
||||
f32 norm;
|
||||
|
||||
Math3D_Vec3fReflect(vec1, vec2, ret);
|
||||
|
@ -237,7 +237,7 @@ void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) {
|
|||
sp60.x = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
sp60.y = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
sp60.z = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
EnBubble_Vec3fNormalizedRelfect(&sp54, &sp60, &sp54);
|
||||
EnBubble_Vec3fNormalizedReflect(&sp54, &sp60, &sp54);
|
||||
this->bounceDirection = sp54;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
|
@ -256,7 +256,7 @@ void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) {
|
|||
} else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && sp54.y < 0.0f) {
|
||||
sp60.x = sp60.z = 0.0f;
|
||||
sp60.y = 1.0f;
|
||||
EnBubble_Vec3fNormalizedRelfect(&sp54, &sp60, &sp54);
|
||||
EnBubble_Vec3fNormalizedReflect(&sp54, &sp60, &sp54);
|
||||
this->bounceDirection = sp54;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
|
|
|
@ -3442,7 +3442,7 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, GlobalContext* globalCtx) {
|
|||
return 0;
|
||||
}
|
||||
conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
|
||||
conveyorDir = (conveyorDir << 10) - this->actor.world.rot.y;
|
||||
conveyorDir = (conveyorDir * (0x10000 / 64)) - this->actor.world.rot.y;
|
||||
if (conveyorDir > 800.0f) {
|
||||
this->actor.world.rot.y += 800.0f;
|
||||
} else if (conveyorDir < -800.0f) {
|
||||
|
@ -3803,13 +3803,13 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbInd
|
|||
gEponaEyeHalfTex,
|
||||
gEponaEyeClosedTex,
|
||||
};
|
||||
static u8 eyeBlinkIndexes[] = { 0, 1, 2, 1 };
|
||||
static u8 eyeBlinkIndices[] = { 0, 1, 2, 1 };
|
||||
EnHorse* this = (EnHorse*)thisx;
|
||||
s32 drawOriginalLimb = true;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse.c", 8582);
|
||||
if (limbIndex == 13 && this->type == HORSE_EPONA) {
|
||||
u8 index = eyeBlinkIndexes[this->blinkTimer];
|
||||
u8 index = eyeBlinkIndices[this->blinkTimer];
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[index]));
|
||||
} else if (this->type == HORSE_HNI && this->stateFlags & ENHORSE_FLAG_18 && limbIndex == 30) {
|
||||
|
|
|
@ -373,10 +373,10 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
static s16 textAlpha = 0;
|
||||
static s16 textFadeDirection = 0;
|
||||
static s16 textFadeTimer = 0;
|
||||
static u8 noControllerFontIndexes[] = {
|
||||
static u8 noControllerFontIndices[] = {
|
||||
0x17, 0x18, 0x0C, 0x18, 0x17, 0x1D, 0x1B, 0x18, 0x15, 0x15, 0x0E, 0x1B,
|
||||
};
|
||||
static u8 pressStartFontIndexes[] = {
|
||||
static u8 pressStartFontIndices[] = {
|
||||
0x19, 0x1B, 0x0E, 0x1C, 0x1C, 0x1C, 0x1D, 0x0A, 0x1B, 0x1D,
|
||||
};
|
||||
static void* effectMaskTextures[] = {
|
||||
|
@ -487,8 +487,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
|
||||
|
||||
rectLeft = VREG(19) + 1;
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndices); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 172);
|
||||
rectLeft += VREG(21);
|
||||
if (i == 1) {
|
||||
|
@ -501,8 +501,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
gDPSetPrimColor(gfx++, 0, 0, 100, 255, 255, textAlpha);
|
||||
|
||||
rectLeft = VREG(19);
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
for (i = 0; i < ARRAY_COUNT(noControllerFontIndices); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 171);
|
||||
rectLeft += VREG(21);
|
||||
if (i == 1) {
|
||||
|
@ -523,8 +523,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha);
|
||||
|
||||
rectLeft = YREG(7) + 1;
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 172);
|
||||
rectLeft += YREG(8);
|
||||
if (i == 4) {
|
||||
|
@ -537,8 +537,8 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) {
|
|||
gDPSetPrimColor(gfx++, 0, 0, YREG(4), YREG(5), YREG(6), textAlpha);
|
||||
|
||||
rectLeft = YREG(7);
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndexes); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndexes[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) {
|
||||
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
|
||||
YREG(10) + 171);
|
||||
rectLeft += YREG(8);
|
||||
if (i == 4) {
|
||||
|
|
|
@ -1448,7 +1448,7 @@ void EnMb_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
static Vec3f unused = { 1100.0f, -700.0f, 0.0f };
|
||||
static Vec3f feetPos = { 0.0f, 0.0f, 0.0f };
|
||||
static Vec3f effSpawnPosModel = { 0.0f, -8000.0f, 0.0f };
|
||||
static Vec3f effSpawnModelPos = { 0.0f, -8000.0f, 0.0f };
|
||||
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
s32 bodyPart = -1;
|
||||
EnMb* this = (EnMb*)thisx;
|
||||
|
@ -1456,7 +1456,7 @@ void EnMb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
|
|||
|
||||
if (this->actor.params == ENMB_TYPE_CLUB) {
|
||||
if (limbIndex == ENMB_LIMB_LHAND) {
|
||||
Matrix_MultVec3f(&effSpawnPosModel, &this->effSpawnPos);
|
||||
Matrix_MultVec3f(&effSpawnModelPos, &this->effSpawnPos);
|
||||
if (this->attack > ENMB_ATTACK_NONE) {
|
||||
EnMb_ClubUpdateAttackCollider(&this->actor, globalCtx);
|
||||
}
|
||||
|
|
|
@ -548,7 +548,7 @@ void EnOssan_UpdateCameraDirection(EnOssan* this, GlobalContext* globalCtx, f32
|
|||
Camera_SetCameraData(GET_ACTIVE_CAM(globalCtx), 0xC, NULL, NULL, cameraFaceAngle, 0, 0);
|
||||
}
|
||||
|
||||
s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, GlobalContext* globalCtx, s16* objectIds) {
|
||||
s32 EnOssan_TryGetObjBankIndices(EnOssan* this, GlobalContext* globalCtx, s16* objectIds) {
|
||||
if (objectIds[1] != OBJECT_ID_MAX) {
|
||||
this->objBankIndex2 = Object_GetIndex(&globalCtx->objectCtx, objectIds[1]);
|
||||
if (this->objBankIndex2 < 0) {
|
||||
|
@ -616,7 +616,7 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (EnOssan_TryGetObjBankIndexes(this, globalCtx, objectIds) == 0) {
|
||||
if (EnOssan_TryGetObjBankIndices(this, globalCtx, objectIds) == 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
osSyncPrintf(VT_COL(RED, WHITE));
|
||||
osSyncPrintf("予備バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]);
|
||||
|
|
|
@ -163,8 +163,8 @@ void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) {
|
|||
Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.1f);
|
||||
}
|
||||
|
||||
player->windDirection = this->appliedYaw;
|
||||
player->windSpeed = this->appliedSpeed;
|
||||
player->pushedYaw = this->appliedYaw;
|
||||
player->pushedSpeed = this->appliedSpeed;
|
||||
}
|
||||
} else {
|
||||
if (this->applySpeed) {
|
||||
|
|
|
@ -91,11 +91,11 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) {
|
|||
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
|
||||
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
|
||||
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
|
||||
player->windDirection = RAD_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
|
||||
player->pushedYaw = RAD_TO_BINANG(Math_FAtan2F(-posDifference.x, -posDifference.z));
|
||||
if (xzDist > 3.0f) {
|
||||
Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f);
|
||||
Math_SmoothStepToF(&player->pushedSpeed, 3.0f, 0.5f, xzDist, 0.0f);
|
||||
} else {
|
||||
player->windSpeed = 0.0f;
|
||||
player->pushedSpeed = 0.0f;
|
||||
Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 0.5f, 3.0f, 0.0f);
|
||||
Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 0.5f, 3.0f, 0.0f);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ static s16 sObjectIds[] = {
|
|||
OBJECT_GI_RUPY, OBJECT_GI_RUPY, OBJECT_GI_HEARTS, OBJECT_GI_KEY,
|
||||
};
|
||||
|
||||
// Indexes passed to the item table in z_draw.c
|
||||
static s16 sDrawItemIndexes[] = {
|
||||
// Indices passed to the item table in z_draw.c
|
||||
static s16 sDrawItemIndices[] = {
|
||||
GID_BOTTLE, GID_LETTER_RUTO, GID_SHIELD_HYLIAN, GID_QUIVER_40, GID_SCALE_SILVER,
|
||||
GID_SCALE_GOLDEN, GID_KEY_SMALL, GID_ARROW_FIRE, GID_RUPEE_GREEN, GID_RUPEE_BLUE,
|
||||
GID_RUPEE_RED, GID_RUPEE_PURPLE, GID_HEART_PIECE, GID_KEY_SMALL,
|
||||
|
@ -71,7 +71,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
this->objBankIndex = objBankIndex;
|
||||
}
|
||||
this->giDrawId = sDrawItemIndexes[type];
|
||||
this->giDrawId = sDrawItemIndices[type];
|
||||
this->getItemId = sGetItemIds[type];
|
||||
this->futureActionFunc = func_80B85824;
|
||||
this->drawFunc = ItemEtcetera_Draw;
|
||||
|
|
|
@ -476,9 +476,9 @@ static s32 D_808535E4 = 0;
|
|||
static f32 D_808535E8 = 1.0f;
|
||||
static f32 D_808535EC = 1.0f;
|
||||
static u32 D_808535F0 = 0;
|
||||
static u32 D_808535F4 = 0;
|
||||
static s16 D_808535F8 = 0;
|
||||
static s16 D_808535FC = 0;
|
||||
static u32 sConveyorSpeedIndex = 0;
|
||||
static s16 sIsFloorConveyor = false;
|
||||
static s16 sConveyorYaw = 0;
|
||||
static f32 D_80853600 = 0.0f;
|
||||
static s32 D_80853604 = 0;
|
||||
static s32 D_80853608 = 0;
|
||||
|
@ -2152,7 +2152,7 @@ s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typ
|
|||
if (this->stateFlags1 & PLAYER_STATE1_23) {
|
||||
*typePtr = ARROW_NORMAL_HORSE;
|
||||
} else {
|
||||
*typePtr = this->heldItemActionParam - 6;
|
||||
*typePtr = ARROW_NORMAL + (this->heldItemActionParam - PLAYER_AP_BOW);
|
||||
}
|
||||
} else {
|
||||
*itemPtr = ITEM_SLINGSHOT;
|
||||
|
@ -4186,8 +4186,8 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u
|
|||
gSaveContext.entranceSpeed = linearVel;
|
||||
}
|
||||
|
||||
if (D_808535F4 != 0) {
|
||||
yaw = D_808535FC;
|
||||
if (sConveyorSpeedIndex != 0) {
|
||||
yaw = sConveyorYaw;
|
||||
} else {
|
||||
yaw = this->actor.world.rot.y;
|
||||
}
|
||||
|
@ -5998,12 +5998,12 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void func_8083E298(CollisionPoly* arg0, Vec3f* arg1, s16* arg2) {
|
||||
arg1->x = COLPOLY_GET_NORMAL(arg0->normal.x);
|
||||
arg1->y = COLPOLY_GET_NORMAL(arg0->normal.y);
|
||||
arg1->z = COLPOLY_GET_NORMAL(arg0->normal.z);
|
||||
void Player_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* downwardSlopeYaw) {
|
||||
slopeNormal->x = COLPOLY_GET_NORMAL(floorPoly->normal.x);
|
||||
slopeNormal->y = COLPOLY_GET_NORMAL(floorPoly->normal.y);
|
||||
slopeNormal->z = COLPOLY_GET_NORMAL(floorPoly->normal.z);
|
||||
|
||||
*arg2 = Math_Atan2S(arg1->z, arg1->x);
|
||||
*downwardSlopeYaw = Math_Atan2S(slopeNormal->z, slopeNormal->x);
|
||||
}
|
||||
|
||||
static LinkAnimationHeader* D_80854590[] = {
|
||||
|
@ -6011,30 +6011,36 @@ static LinkAnimationHeader* D_80854590[] = {
|
|||
&gPlayerAnim_0031D0,
|
||||
};
|
||||
|
||||
s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) {
|
||||
s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* floorPoly) {
|
||||
s32 pad;
|
||||
s16 sp4A;
|
||||
Vec3f sp3C;
|
||||
s16 sp3A;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
s16 temp3;
|
||||
s16 playerVelYaw;
|
||||
Vec3f slopeNormal;
|
||||
s16 downwardSlopeYaw;
|
||||
f32 slopeSlowdownSpeed;
|
||||
f32 slopeSlowdownSpeedStep;
|
||||
s16 velYawToDownwardSlope;
|
||||
|
||||
if (!Player_InBlockingCsMode(globalCtx, this) && (func_8084F390 != this->func_674) &&
|
||||
(SurfaceType_GetSlope(&globalCtx->colCtx, arg2, this->actor.floorBgId) == 1)) {
|
||||
sp4A = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
||||
func_8083E298(arg2, &sp3C, &sp3A);
|
||||
temp3 = sp3A - sp4A;
|
||||
(SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) == 1)) {
|
||||
|
||||
if (ABS(temp3) > 16000) {
|
||||
temp1 = (1.0f - sp3C.y) * 40.0f;
|
||||
temp2 = (temp1 * temp1) * 0.015f;
|
||||
if (temp2 < 1.2f) {
|
||||
temp2 = 1.2f;
|
||||
// Get direction of movement relative to the downward direction of the slope
|
||||
playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
||||
Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw);
|
||||
velYawToDownwardSlope = downwardSlopeYaw - playerVelYaw;
|
||||
|
||||
if (ABS(velYawToDownwardSlope) > 0x3E80) { // 87.9 degrees
|
||||
// moving parallel or upwards on the slope, player does not slip but does slow down
|
||||
slopeSlowdownSpeed = (1.0f - slopeNormal.y) * 40.0f;
|
||||
slopeSlowdownSpeedStep = SQ(slopeSlowdownSpeed) * 0.015f;
|
||||
if (slopeSlowdownSpeedStep < 1.2f) {
|
||||
slopeSlowdownSpeedStep = 1.2f;
|
||||
}
|
||||
this->windDirection = sp3A;
|
||||
Math_StepToF(&this->windSpeed, temp1, temp2);
|
||||
|
||||
// slows down speed as player is climbing a slope
|
||||
this->pushedYaw = downwardSlopeYaw;
|
||||
Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep);
|
||||
} else {
|
||||
// moving downward on the slope, causing player to slip
|
||||
func_80835C58(globalCtx, this, func_8084F390, 0);
|
||||
func_80832564(globalCtx, this);
|
||||
if (D_80853610 >= 0) {
|
||||
|
@ -6042,12 +6048,12 @@ s32 func_8083E318(GlobalContext* globalCtx, Player* this, CollisionPoly* arg2) {
|
|||
}
|
||||
func_80832BE8(globalCtx, this, D_80854590[this->unk_84F]);
|
||||
this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z));
|
||||
this->currentYaw = sp4A;
|
||||
return 1;
|
||||
this->currentYaw = playerVelYaw;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// unknown data (unused)
|
||||
|
@ -8831,9 +8837,9 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) {
|
|||
if (this->stateFlags1 & PLAYER_STATE1_0) {
|
||||
sp34 = gSaveContext.entranceSpeed;
|
||||
|
||||
if (D_808535F4 != 0) {
|
||||
this->unk_450.x = (Math_SinS(D_808535FC) * 400.0f) + this->actor.world.pos.x;
|
||||
this->unk_450.z = (Math_CosS(D_808535FC) * 400.0f) + this->actor.world.pos.z;
|
||||
if (sConveyorSpeedIndex != 0) {
|
||||
this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x;
|
||||
this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z;
|
||||
}
|
||||
} else if (this->unk_850 < 0) {
|
||||
this->unk_850++;
|
||||
|
@ -9642,7 +9648,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) {
|
|||
}
|
||||
|
||||
D_80853600 = this->actor.world.pos.y - this->actor.floorHeight;
|
||||
D_808535F4 = 0;
|
||||
sConveyorSpeedIndex = 0;
|
||||
|
||||
floorPoly = this->actor.floorPoly;
|
||||
|
||||
|
@ -9675,16 +9681,17 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) {
|
|||
}
|
||||
}
|
||||
|
||||
D_808535F4 = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||
if (D_808535F4 != 0) {
|
||||
D_808535F8 = SurfaceType_IsConveyor(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||
if (((D_808535F8 == 0) && (this->actor.yDistToWater > 20.0f) &&
|
||||
// This block extracts the conveyor properties from the floor poly
|
||||
sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||
if (sConveyorSpeedIndex != 0) {
|
||||
sIsFloorConveyor = SurfaceType_IsFloorConveyor(&globalCtx->colCtx, floorPoly, this->actor.floorBgId);
|
||||
if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) &&
|
||||
(this->currentBoots != PLAYER_BOOTS_IRON)) ||
|
||||
((D_808535F8 != 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
|
||||
D_808535FC = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, floorPoly, this->actor.floorBgId)
|
||||
<< 10;
|
||||
(sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
|
||||
sConveyorYaw = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) *
|
||||
(0x10000 / 64);
|
||||
} else {
|
||||
D_808535F4 = 0;
|
||||
sConveyorSpeedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10090,8 +10097,8 @@ static s8 D_808547C4[] = {
|
|||
|
||||
static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f };
|
||||
|
||||
static f32 D_80854820[] = { 2.0f, 4.0f, 7.0f };
|
||||
static f32 D_8085482C[] = { 0.5f, 1.0f, 3.0f };
|
||||
static f32 sWaterConveyorSpeeds[] = { 2.0f, 4.0f, 7.0f };
|
||||
static f32 sFloorConveyorSpeeds[] = { 0.5f, 1.0f, 3.0f };
|
||||
|
||||
void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
||||
s32 pad;
|
||||
|
@ -10252,11 +10259,11 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
|||
|
||||
func_8002D868(&this->actor);
|
||||
|
||||
if ((this->windSpeed != 0.0f) && !Player_InCsMode(globalCtx) &&
|
||||
if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(globalCtx) &&
|
||||
!(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) &&
|
||||
(func_80845668 != this->func_674) && (func_808507F4 != this->func_674)) {
|
||||
this->actor.velocity.x += this->windSpeed * Math_SinS(this->windDirection);
|
||||
this->actor.velocity.z += this->windSpeed * Math_CosS(this->windDirection);
|
||||
this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw);
|
||||
this->actor.velocity.z += this->pushedSpeed * Math_CosS(this->pushedYaw);
|
||||
}
|
||||
|
||||
func_8002D7EC(&this->actor);
|
||||
|
@ -10287,31 +10294,33 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
|||
}
|
||||
}
|
||||
|
||||
D_808535F4 = 0;
|
||||
this->windSpeed = 0.0f;
|
||||
sConveyorSpeedIndex = 0;
|
||||
this->pushedSpeed = 0.0f;
|
||||
}
|
||||
|
||||
if ((D_808535F4 != 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||
f32 sp48;
|
||||
// This block applies the bg conveyor to pushedSpeed
|
||||
if ((sConveyorSpeedIndex != 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||
f32 conveyorSpeed;
|
||||
|
||||
D_808535F4--;
|
||||
// converts 1-index to 0-index
|
||||
sConveyorSpeedIndex--;
|
||||
|
||||
if (D_808535F8 == 0) {
|
||||
sp48 = D_80854820[D_808535F4];
|
||||
if (!sIsFloorConveyor) {
|
||||
conveyorSpeed = sWaterConveyorSpeeds[sConveyorSpeedIndex];
|
||||
|
||||
if (!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
||||
sp48 *= 0.25f;
|
||||
conveyorSpeed *= 0.25f;
|
||||
}
|
||||
} else {
|
||||
sp48 = D_8085482C[D_808535F4];
|
||||
conveyorSpeed = sFloorConveyorSpeeds[sConveyorSpeedIndex];
|
||||
}
|
||||
|
||||
Math_StepToF(&this->windSpeed, sp48, sp48 * 0.1f);
|
||||
Math_StepToF(&this->pushedSpeed, conveyorSpeed, conveyorSpeed * 0.1f);
|
||||
|
||||
Math_ScaledStepToS(&this->windDirection, D_808535FC,
|
||||
((this->stateFlags1 & PLAYER_STATE1_27) ? 400.0f : 800.0f) * sp48);
|
||||
} else if (this->windSpeed != 0.0f) {
|
||||
Math_StepToF(&this->windSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f);
|
||||
Math_ScaledStepToS(&this->pushedYaw, sConveyorYaw,
|
||||
((this->stateFlags1 & PLAYER_STATE1_27) ? 400.0f : 800.0f) * conveyorSpeed);
|
||||
} else if (this->pushedSpeed != 0.0f) {
|
||||
Math_StepToF(&this->pushedSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_27) ? 0.5f : 1.0f);
|
||||
}
|
||||
|
||||
if (!Player_InBlockingCsMode(globalCtx, this) && !(this->stateFlags2 & PLAYER_STATE2_18)) {
|
||||
|
@ -12557,9 +12566,9 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
|||
f32 sp50;
|
||||
f32 sp4C;
|
||||
f32 sp48;
|
||||
s16 sp46;
|
||||
s16 downwardSlopeYaw;
|
||||
s16 sp44;
|
||||
Vec3f sp38;
|
||||
Vec3f slopeNormal;
|
||||
|
||||
this->stateFlags2 |= PLAYER_STATE2_5 | PLAYER_STATE2_6;
|
||||
LinkAnimation_Update(globalCtx, &this->skelAnime);
|
||||
|
@ -12574,25 +12583,25 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
func_8083E298(floorPoly, &sp38, &sp46);
|
||||
Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw);
|
||||
|
||||
sp44 = sp46;
|
||||
sp44 = downwardSlopeYaw;
|
||||
if (this->unk_84F != 0) {
|
||||
sp44 = sp46 + 0x8000;
|
||||
sp44 = downwardSlopeYaw + 0x8000;
|
||||
}
|
||||
|
||||
if (this->linearVelocity < 0) {
|
||||
sp46 += 0x8000;
|
||||
downwardSlopeYaw += 0x8000;
|
||||
}
|
||||
|
||||
sp50 = (1.0f - sp38.y) * 40.0f;
|
||||
sp50 = (1.0f - slopeNormal.y) * 40.0f;
|
||||
sp50 = CLAMP(sp50, 0, 10.0f);
|
||||
sp4C = (sp50 * sp50) * 0.015f;
|
||||
sp48 = sp38.y * 0.01f;
|
||||
sp48 = slopeNormal.y * 0.01f;
|
||||
|
||||
if (SurfaceType_GetSlope(&globalCtx->colCtx, floorPoly, this->actor.floorBgId) != 1) {
|
||||
sp50 = 0;
|
||||
sp48 = sp38.y * 10.0f;
|
||||
sp48 = slopeNormal.y * 10.0f;
|
||||
}
|
||||
|
||||
if (sp4C < 1.0f) {
|
||||
|
@ -12601,6 +12610,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
|
||||
LinkAnimationHeader* anim;
|
||||
|
||||
if (this->unk_84F == 0) {
|
||||
anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_42, this->modelAnimType);
|
||||
} else {
|
||||
|
@ -12609,7 +12619,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
|||
func_8083A098(this, anim, globalCtx);
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->currentYaw, sp46, 10, 4000, 800);
|
||||
Math_SmoothStepToS(&this->currentYaw, downwardSlopeYaw, 10, 4000, 800);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue