diff options
| author | Lucas Shaw <49287729+shawlucas@users.noreply.github.com> | 2021-03-27 14:17:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-27 16:17:41 -0500 |
| commit | 623b6d531855aecb3f64cdb678843e9d423ce415 (patch) | |
| tree | bfa2514d5320425eb74764290057f2a21155f4d7 /src/code | |
| parent | fee7a49abc84fbe91116f969a90570cff15decde (diff) | |
Some OOT transfers, some renaming, etc (#75)
* Progress on various files
* gfxprint stuff
* split some rodata, add iconv for rodata string parsing
* z_std_dma rodata
* 2 nonmatchings in gfxprint
* mtxuty-cvt ok
* more
* match a function in idle.c
* progress
* Cleanup
* Rename BgPolygon to CollisionPoly
* progress
* some effect stuff
* more effect progress
* updates
* made suggested changes
* z_effect_soft_sprite_old_init mostly ok
Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com>
Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_0x800A5AC0.c | 4 | ||||
| -rw-r--r-- | src/code/code_0x800AF710.c | 4 | ||||
| -rw-r--r-- | src/code/code_0x800CAAD0.c | 4 | ||||
| -rw-r--r-- | src/code/code_0x8017FEB0.c | 12 | ||||
| -rw-r--r-- | src/code/sys_matrix.c | 99 | ||||
| -rw-r--r-- | src/code/z_actor.c | 163 | ||||
| -rw-r--r-- | src/code/z_bgcheck.c | 2 | ||||
| -rw-r--r-- | src/code/z_collision_check.c | 14 | ||||
| -rw-r--r-- | src/code/z_eff_blure.c | 105 | ||||
| -rw-r--r-- | src/code/z_eff_footmark.c | 8 | ||||
| -rw-r--r-- | src/code/z_effect_soft_sprite.c | 74 | ||||
| -rw-r--r-- | src/code/z_effect_soft_sprite_old_init.c | 1035 | ||||
| -rw-r--r-- | src/code/z_lib.c | 20 | ||||
| -rw-r--r-- | src/code/z_lights.c | 10 | ||||
| -rw-r--r-- | src/code/z_rcp.c | 8 | ||||
| -rw-r--r-- | src/code/z_room.c | 4 | ||||
| -rw-r--r-- | src/code/z_scene.c | 44 | ||||
| -rw-r--r-- | src/code/z_skelanime.c | 88 | ||||
| -rw-r--r-- | src/code/z_view.c | 4 |
19 files changed, 1534 insertions, 168 deletions
diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index b4af897f3..bb2934a7c 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -8,11 +8,9 @@ void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) { s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300; s0->base.params = (s0->base.params & 0xFF) - 9; Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar); - - Actor_SetDrawParams(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12); + ActorShape_Init(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12); Collider_InitAndSetCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit); Collider_UpdateCylinder((Actor*)s0, &s0->collision); - s0->base.colChkInfo.mass = 255; s0->update = (ActorFunc)EnAObj_Update1; } diff --git a/src/code/code_0x800AF710.c b/src/code/code_0x800AF710.c index 33697927d..b7d9c50f1 100644 --- a/src/code/code_0x800AF710.c +++ b/src/code/code_0x800AF710.c @@ -10,14 +10,14 @@ EffInfo sEffInfoTable[] = { (eff_draw_func)EffectSpark_Draw, }, { - sizeof(EffBlureParams), + sizeof(EffectBlure), (eff_init_func)EffectBlure_Init1, (eff_destroy_func)EffectBlure_Destroy, (eff_update_func)EffectBlure_Update, (eff_draw_func)EffectBlure_Draw, }, { - sizeof(EffBlureParams), + sizeof(EffectBlure), (eff_init_func)EffectBlure_Init2, (eff_destroy_func)EffectBlure_Destroy, (eff_update_func)EffectBlure_Update, diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index 97bd8412e..ab53cc983 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -38,8 +38,8 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac bgCtxt->dyna.actorMeshArr[index].currParams.pos.y, bgCtxt->dyna.actorMeshArr[index].currParams.pos.z); - Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv); - Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos); + SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv); + SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos); actor->world.pos = newPos; } diff --git a/src/code/code_0x8017FEB0.c b/src/code/code_0x8017FEB0.c new file mode 100644 index 000000000..c51208bad --- /dev/null +++ b/src/code/code_0x8017FEB0.c @@ -0,0 +1,12 @@ +#include <ultra64.h> +#include <global.h> + +#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans_first_8th.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/Math_FAtan2F.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan_flip.asm") diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c new file mode 100644 index 000000000..8a02487dd --- /dev/null +++ b/src/code/sys_matrix.c @@ -0,0 +1,99 @@ +#include <ultra64.h> +#include <global.h> + +void Matrix_Init(GameState* state) { + sMatrixStack = (MtxF *)THA_AllocEndAlign16(&state->heap, 0x500); + sCurrentMatrix = sMatrixStack; +} + +void Matrix_Push(void) { + MtxF* prev = sCurrentMatrix; + + sCurrentMatrix++; + Matrix_MtxFCopy(sCurrentMatrix, prev); + +} + +void Matrix_Pop(void) { + sCurrentMatrix--; +} + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Put.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertMatrix.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertTranslation.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Scale.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_s.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_f.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateStateAroundXAxis.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateXRotation.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_RotateY.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertYRotation_f.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_s.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_f.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotation.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateAndTranslateState.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateRotationAndTranslation.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_ToRSPMatrix.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateAsRSPMatrix.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_NewMtx.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_AppendToPolyOpaDisp.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByState.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslation.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledX.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledY.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledZ.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fXZByCurrentState.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_MtxFCopy.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_FromRSPMatrix.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByMatrix.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_TransposeXYZ.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_NormalizeXYZ.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_8018219C.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_801822C4.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_f.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_s.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182C90.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CA0.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CBC.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CCC.asm") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 57058949a..2a4699860 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -5,26 +5,139 @@ #define ABS(x) ((x) < 0 ? -(x) : (x)) #define DECR(x) ((x) == 0 ? 0 : ((x) -= 1)) -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PrintLists.asm") +void Actor_PrintLists(ActorContext *actorCtx) { + ActorListEntry* actorList = &actorCtx->actorList[0]; + Actor* actor; + s32 i; + + FaultDrawer_SetCharPad(-2, 0); + FaultDrawer_Printf(D_801DC9D0, gMaxActorId); + FaultDrawer_Printf(D_801DC9D8); + + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { + actor = actorList[i].first; + + while (actor != NULL) { + FaultDrawer_Printf(D_801DC9F8, i, actor, actor->id, actor->category, D_801DCA10); + actor = actor->next; + } + + } +} -void Actor_SetDrawParams(ActorShape* actorShape, f32 yOffset, ActorShadowFunc func, f32 scale) { +void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) { actorShape->yOffset = yOffset; - actorShape->shadowDraw = func; - actorShape->shadowScale = scale; + actorShape->shadowDraw = shadowDraw; + actorShape->shadowScale = shadowScale; actorShape->shadowAlpha = 255; } -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PostDraw.asm") +#ifdef NON_MATCHING +void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { + if (actor->floorPoly != NULL) { + f32 dy = actor->world.pos.y - actor->floorHeight; + + if (dy >= -50.0f && dy < 500.0f) { + f32 shadowScale; + MtxF mtx; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + + POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); + + gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, + COMBINED); + + dy = CLAMP(dy, 0.0f, 150.0f); + shadowScale = 1.0f - (dy * D_801DCA14); + + if (color != NULL) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->red, color->green, color->blue, + (u8)(actor->shape.shadowAlpha * shadowScale)); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(actor->shape.shadowAlpha * shadowScale)); + } + + func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx); + Matrix_Put(&mtx); + + if (dlist != D_04076BC0) { + Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); + } + + shadowScale = 1.0f - (dy * D_801DCA14); + shadowScale *= actor->shape.shadowScale; + Matrix_Scale(shadowScale * actor->scale.x, 1.0f, shadowScale * actor->scale.z, MTXMODE_APPLY); -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B3FC0.asm") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, dlist); -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4024.asm") + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + } +} +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//ActorShadow_Draw.asm") +#endif -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4088.asm") +/* ActorShadow_DrawCircle */ +void func_800B3FC0(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + if (actor->bgCheckFlags & 0x400) { + func_800B4AEC(globalCtx, actor, 50.0f); + } -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40B8.asm") + ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, NULL); +} -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40E0.asm") +/* ActorShadow_DrawSquare */ +void func_800B4024(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + if (actor->bgCheckFlags & 0x400) { + func_800B4AEC(globalCtx, actor, 50.0f); + } + + ActorShadow_Draw(actor, lights, globalCtx, D_04075A40, NULL); +} + +/* ActorShadow_DrawWhiteCircle */ +void func_800B4088(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, &D_801AEC80); +} + +/* ActorShadow_DrawHorse */ +void func_800B40B8(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + ActorShadow_Draw(actor, lights, globalCtx, D_04077480, NULL); +} + +/* ActorShadow_DrawFoot */ +#ifdef NON_MATCHING +void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { + s32 pad1; + s16 sp58; + s32 pad2[2]; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, + (u32)(((arg3 * D_801DCA18) > 1.0f ? 1.0f : (arg3 * D_801DCA18)) * arg4) & 0xFF); + + sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]); + arg6 *= (4.5f - (light->l.dir[1] * D_801DCA1C)); + arg6 = (arg6 < 1.0f) ? 1.0f : arg6; + Matrix_Put(arg2); + Matrix_RotateY(sp58, MTXMODE_APPLY); + Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, D_04075B30); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800B40E0.asm") +#endif #pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B42F8.asm") @@ -214,10 +327,10 @@ void Actor_SetScale(Actor* actor, f32 scale) { void Actor_SetObjectSegment(GlobalContext* ctxt, Actor* actor) { // TODO: Segment number enum - gRspSegmentPhysAddrs[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].vramAddr); + gSegments[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].segment); } -#ifdef NON_MATCHING +#if 0 void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) { Actor_InitCurrPosition(actor); Actor_InitDrawRotation(actor); @@ -271,11 +384,11 @@ void Actor_ApplyMovement(Actor* actor) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_ApplyMovement.asm") #endif -#ifdef NON_MATCHING +#if 0 void Actor_SetVelocityYRotationAndGravity(Actor* actor) { - actor->velocity.x = actor->speedXZ * Math_Sins(actor->world.rot.x); + actor->velocity.x = actor->speedXZ * Math_SinS(actor->world.rot.x); actor->velocity.y = actor->velocity.y + actor->gravity; - actor->velocity.z = actor->speedXZ * Math_Coss(actor->world.rot.x); + actor->velocity.z = actor->speedXZ * Math_CosS(actor->world.rot.x); if (actor->velocity.y < actor->minYVelocity) { actor->velocity.y = actor->minYVelocity; @@ -291,10 +404,10 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) { } void Actor_SetVelocityXYRotation(Actor* actor) { - f32 velX = Math_Coss(actor->world.rot.x) * actor->speedXZ; - actor->velocity.x = Math_Sins(actor->world.rot.y) * velX; - actor->velocity.y = Math_Sins(actor->world.rot.x) * actor->speedXZ; - actor->velocity.z = Math_Coss(actor->world.rot.y) * velX; + f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ; + actor->velocity.x = Math_SinS(actor->world.rot.y) * velX; + actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ; + actor->velocity.z = Math_CosS(actor->world.rot.y) * velX; } void Actor_SetVelocityAndMoveXYRotation(Actor* actor) { @@ -303,10 +416,10 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) { } void Actor_SetVelocityXYRotationReverse(Actor* actor) { - f32 velX = Math_Coss(-actor->world.rot.x) * actor->speedXZ; - actor->velocity.x = Math_Sins(actor->world.rot.y) * velX; - actor->velocity.y = Math_Sins(-actor->world.rot.x) * actor->speedXZ; - actor->velocity.z = Math_Coss(actor->world.rot.y) * velX; + f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ; + actor->velocity.x = Math_SinS(actor->world.rot.y) * velX; + actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ; + actor->velocity.z = Math_CosS(actor->world.rot.y) * velX; } void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) { @@ -364,8 +477,8 @@ void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f* f32 imm_x; f32 imm_z; - cos_rot_y = Math_Coss(actor->shape.rot.y); - sin_rot_y = Math_Sins(actor->shape.rot.y); + cos_rot_y = Math_CosS(actor->shape.rot.y); + sin_rot_y = Math_SinS(actor->shape.rot.y); imm_x = point->x - actor->world.pos.x; imm_z = point->z - actor->world.pos.z; offset->x = ((imm_x * cos_rot_y) - (imm_z * sin_rot_y)); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 58e5df6c9..2cd6522f3 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -162,7 +162,7 @@ void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vec3f* vector) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm") -f32 func_800C411C(CollisionContext* bgCtxt, BgPolygon* arg1, s32* arg2, Actor* actor, Vec3f* pos) { +f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Actor* actor, Vec3f* pos) { return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0); } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index cbb29f8a6..f3fd2acd7 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1455,7 +1455,7 @@ void CollisionCheck_GreenBlood(GlobalContext* ctxt, Collider* collider, Vec3f* v * Used by collider type HIT4. */ void CollisionCheck_WaterBurst(GlobalContext* ctxt, Collider* collider, Vec3f* v) { - func_800B249C(ctxt, v); + EffectSsSibuki_SpawnBurst(ctxt, v); CollisionCheck_SpawnWaterDroplets(ctxt, v); } @@ -1481,28 +1481,28 @@ void CollisionCheck_HitSolid(GlobalContext* ctxt, ColliderInfo* info, Collider* s32 flags = info->toucherFlags & TOUCH_SFX_NONE; if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) { - func_800B2684(ctxt, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos); if (collider->actor == NULL) { play_sound(0x1806); } else { func_8019F1C0(&collider->actor->projectedPos, 0x1806); } } else if (flags == TOUCH_SFX_NORMAL) { - func_800B2684(ctxt, 3, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, 3, hitPos); if (collider->actor == NULL) { CollisionCheck_SpawnShieldParticlesMetal(ctxt, hitPos); } else { CollisionCheck_SpawnShieldParticlesMetalSound(ctxt, hitPos, &collider->actor->projectedPos); } } else if (flags == TOUCH_SFX_HARD) { - func_800B2684(ctxt, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos); if (collider->actor == NULL) { play_sound(0x1806); } else { func_8019F1C0(&collider->actor->projectedPos, 0x1806); } } else if (flags == TOUCH_SFX_WOOD) { - func_800B2684(ctxt, 1, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, 1, hitPos); if (collider->actor == NULL) { play_sound(0x1837); } else { @@ -1568,13 +1568,13 @@ void CollisionCheck_HitEffects(GlobalContext* ctxt, Collider* at, ColliderInfo* CollisionCheck_SpawnShieldParticlesWood(ctxt, hitPos, &at->actor->projectedPos); } } else if (sHitInfo[ac->colType].effect != HIT_NONE) { - func_800B2684(ctxt, sHitInfo[ac->colType].effect, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, sHitInfo[ac->colType].effect, hitPos); if (!(acInfo->bumperFlags & BUMP_NO_SWORD_SFX)) { CollisionCheck_SwordHitAudio(at, acInfo); } } } else { - func_800B2684(ctxt, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos); if (ac->actor == NULL) { play_sound(0x1806); } else { diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c new file mode 100644 index 000000000..c2e28b619 --- /dev/null +++ b/src/code/z_eff_blure.c @@ -0,0 +1,105 @@ +#include <ultra64.h> +#include <global.h> +#ifdef NON_MATCHING +void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) { + EffectBlureElement* elem; + s32 numElements; + Vec3f sp16C; + Vec3f sp160; + Vec3f sp154; + f32 scale; + MtxF sp110; + MtxF spD0; + MtxF sp90; + MtxF sp50; + Vec3f sp44; + Vec3f sp38; + + if (this != NULL) { + numElements = this->numElements; + if (numElements >= 16) { + return; + } + + elem = &this->elements[numElements]; + elem->state = 1; + + if (!(this->flags & 2)) { + elem->p1.x = p1->x; + elem->p1.y = p1->y; + elem->p1.z = p1->z; + elem->p2.x = p2->x; + elem->p2.y = p2->y; + elem->p2.z = p2->z; + } else { + sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f; + sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f; + sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f; + sp160.x = (p1->x + p2->x) * 0.5f; + sp160.y = (p1->y + p2->y) * 0.5f; + sp160.z = (p1->z + p2->z) * 0.5f; + + Math_Vec3f_Diff(&sp160, &sp16C, &sp154); + scale = Math3D_Vec3fMagnitude(&sp154); + if (!(fabsf(scale) < D_801DC080)) { + scale = 1.0f / scale; + Math_Vec3f_Scale(&sp154, scale); + + SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z); + Matrix_MakeRotationAroundUnitVector(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z); + SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90); + SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z); + SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50); + SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p1, &sp38); + SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p2, &sp44); + + elem->p1.x = sp38.x; + elem->p1.y = sp38.y; + elem->p1.z = sp38.z; + elem->p2.x = sp44.x; + elem->p2.y = sp44.y; + elem->p2.z = sp44.z; + } + } + + elem->timer = 1; + this->numElements++; + } +} +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A81F0.asm") +#endif + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8514.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Initcommon.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init1.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init2.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Destroy.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Update.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8C78.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8DE8.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A92FC.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9330.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9804.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA190.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA460.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA498.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA700.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AABE0.asm") + +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Draw.asm") diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c index 2405e39fd..df1d91e21 100644 --- a/src/code/z_eff_footmark.c +++ b/src/code/z_eff_footmark.c @@ -52,7 +52,7 @@ void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, if (destination == NULL) { destination = oldest; } - SysMatrix_Copy(&destination->displayMatrix,displayMatrix); + Matrix_MtxFCopy(&destination->displayMatrix,displayMatrix); destination->actor = actor; destination->location.x = location->x; destination->location.y = location->y; @@ -106,10 +106,10 @@ void EffFootmark_Draw(GlobalContext* ctxt) { for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { - SysMatrix_SetCurrentState(&footmark->displayMatrix); - SysMatrix_InsertScale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1); + Matrix_Put(&footmark->displayMatrix); + Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1); - gSPMatrix(gfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8); diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 3755a7aa2..05dc808cb 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -3,10 +3,10 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) { u32 i; - LoadedParticleEntry* iter; + EffectSs* iter; ParticleOverlay* iter2; - EffectSS2Info.data_table = (LoadedParticleEntry*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(LoadedParticleEntry)); + EffectSS2Info.data_table = (EffectSs*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(EffectSs)); EffectSS2Info.searchIndex = 0; EffectSS2Info.size = numEntries; @@ -21,7 +21,7 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) { void EffectSS_Clear(GlobalContext* ctxt) { u32 i; - LoadedParticleEntry* iter; + EffectSs* iter; ParticleOverlay* iter2; void* addr; @@ -44,47 +44,47 @@ void EffectSS_Clear(GlobalContext* ctxt) { } } -LoadedParticleEntry* EffectSS_GetTable() { +EffectSs* EffectSS_GetTable() { return EffectSS2Info.data_table; } -void EffectSS_Delete(LoadedParticleEntry* a0) { +void EffectSS_Delete(EffectSs* a0) { if (a0->flags & 0x2) { - func_801A72CC((UNK_PTR)&a0->position); + func_801A72CC((UNK_PTR)&a0->pos); } if (a0->flags & 0x4) { - func_801A72CC((UNK_PTR)&a0->unk2C); + func_801A72CC((UNK_PTR)&a0->vec); } EffectSS_ResetEntry(a0); } -void EffectSS_ResetEntry(LoadedParticleEntry* particle) { +void EffectSS_ResetEntry(EffectSs* particle) { u32 i; particle->type = EFFECT_SS2_TYPE_LAST_LABEL; - particle->acceleration.z = 0; - particle->acceleration.y = 0; - particle->acceleration.x = 0; + particle->accel.z = 0; + particle->accel.y = 0; + particle->accel.x = 0; particle->velocity.z = 0; particle->velocity.y = 0; particle->velocity.x = 0; - particle->unk2C.z = 0; - particle->unk2C.y = 0; - particle->unk2C.x = 0; - particle->position.z = 0; - particle->position.y = 0; - particle->position.x = 0; + particle->vec.z = 0; + particle->vec.y = 0; + particle->vec.x = 0; + particle->pos.z = 0; + particle->pos.y = 0; + particle->pos.x = 0; particle->life = -1; particle->flags = 0; particle->priority = 128; particle->draw = NULL; particle->update = NULL; - particle->displayList = 0; - particle->unk3C = 0; + particle->gfx = NULL; + particle->actor = NULL; - for (i = 0; i != 13; i++) { + for (i = 0; i != ARRAY_COUNT(particle->regs); i++) { particle->regs[i] = 0; } } @@ -148,7 +148,7 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_FindFreeSpace.asm") #endif -void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) { +void EffectSS_Copy(GlobalContext* ctxt, EffectSs* a1) { u32 index; if (func_8016A01C(ctxt) != 1) { if (EffectSS_FindFreeSpace(a1->priority, &index) == 0) { @@ -159,7 +159,7 @@ void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) { } #ifdef NON_MATCHING -void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* initData) { +void EffectSs_Spawn(GlobalContext* ctxt, s32 type, s32 priority, void* initData) { u32 index; u32 initRet; u32 overlaySize; @@ -208,20 +208,20 @@ void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* in } } #else -#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_LoadParticle.asm") +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSs_Spawn.asm") #endif void EffectSS_UpdateParticle(GlobalContext* ctxt, s32 index) { - LoadedParticleEntry* particle = &EffectSS2Info.data_table[index]; + EffectSs* particle = &EffectSS2Info.data_table[index]; if (particle->update != NULL) { - particle->velocity.x += particle->acceleration.x; - particle->velocity.y += particle->acceleration.y; - particle->velocity.z += particle->acceleration.z; + particle->velocity.x += particle->accel.x; + particle->velocity.y += particle->accel.y; + particle->velocity.z += particle->accel.z; - particle->position.x += particle->velocity.x; - particle->position.y += particle->velocity.y; - particle->position.z += particle->velocity.z; + particle->pos.x += particle->velocity.x; + particle->pos.y += particle->velocity.y; + particle->pos.z += particle->velocity.z; (*particle->update)(ctxt, index, particle); } @@ -246,7 +246,7 @@ void EffectSS_UpdateAllParticles(GlobalContext* ctxt) { } void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) { - LoadedParticleEntry* entry = &EffectSS2Info.data_table[index]; + EffectSs* entry = &EffectSS2Info.data_table[index]; if (entry->draw != 0) { (*entry->draw)(ctxt, index, entry); } @@ -262,12 +262,12 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) { for (i = 0; i < EffectSS2Info.size; i++) { if (EffectSS2Info.data_table[i].life > -1) { - if (EffectSS2Info.data_table[i].position.x > 32000 || - EffectSS2Info.data_table[i].position.x < -32000 || - EffectSS2Info.data_table[i].position.y > 32000 || - EffectSS2Info.data_table[i].position.y < -32000 || - EffectSS2Info.data_table[i].position.z > 32000 || - EffectSS2Info.data_table[i].position.z < -32000 + if (EffectSS2Info.data_table[i].pos.x > 32000 || + EffectSS2Info.data_table[i].pos.x < -32000 || + EffectSS2Info.data_table[i].pos.y > 32000 || + EffectSS2Info.data_table[i].pos.y < -32000 || + EffectSS2Info.data_table[i].pos.z > 32000 || + EffectSS2Info.data_table[i].pos.z < -32000 ) { EffectSS_Delete(&EffectSS2Info.data_table[i]); } else { diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c new file mode 100644 index 000000000..bc2ac56c9 --- /dev/null +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -0,0 +1,1035 @@ +#include <ultra64.h> +#include <global.h> + +void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + f32 scale; + MtxF mfTrans; + MtxF mfScale; + MtxF mfResult; + MtxF mfTrans11DA0; + s32 pad1; + Mtx* mtx; + void* object = globalCtx->sceneContext.objects[this->rgObjBankIdx].segment; + + OPEN_DISPS(gfxCtx); + + scale = this->rgScale * D_801DC100; + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); + Matrix_MakeScale(&mfScale, scale, scale, scale); + SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_187FC, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); + gSegments[6] = PHYSICAL_TO_VIRTUAL(object); + gSPSegment(POLY_XLU_DISP++, 0x06, object); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_PtrSegToVirt(texture)); + func_8012C9BC(gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rgPrimColorR, this->rgPrimColorG, this->rgPrimColorB, + this->rgPrimColorA); + gDPSetEnvColor(POLY_XLU_DISP++, this->rgEnvColorR, this->rgEnvColorG, this->rgEnvColorB, this->rgEnvColorA); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + } + + CLOSE_DISPS(gfxCtx); +} + +// EffectSsDust Spawn Functions + +void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, + u8 updateMode) { + EffectSsDustInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.primColor = *primColor; + initParams.envColor = *envColor; + initParams.drawFlags = drawFlags; + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.life = life; + initParams.updateMode = updateMode; + + EffectSs_Spawn(globalCtx, EFFECT_SS_DUST, 128, &initParams); +} + +void func_800B0DE0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); +} + +void func_800B0E48(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0); +} + +void func_800B0EB0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { + EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); +} + +void func_800B0F18(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { + EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); +} + +void func_800B0F80(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) { + EffectSsDust_Spawn(globalCtx, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0); +} + +void func_800B0FE8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); +} + +void func_800B1054(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); +} + +extern Color_RGBA8 D_801AE3B0; +extern Color_RGBA8 D_801AE3B4; + +void func_800B10C0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, 100, 5, 10, 0); +} + +void func_800B1130(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, 100, 5, 10, 0); +} + +void func_800B11A0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, 10, 0); +} + +void func_800B1210(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, 10, 0); +} + +void func_800B1280(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 life) { + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, life, 0); +} +void func_800B12F0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 life) { + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, life, 0); +} + +void func_800B1360(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor) { + func_800B0DE0(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); +} + +void func_800B139C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor) { + func_800B0E48(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); +} + +void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) { + s16 randAngle; + f32 rand = Rand_ZeroOne() * randScale; + + randAngle = (Rand_ZeroOne() * 65536.0f); + + *newPos = *srcPos; + + newPos->x += Math_SinS(randAngle) * rand; + newPos->z += Math_CosS(randAngle) * rand; + + velocity->y = 1.0f; + velocity->x = Math_SinS(randAngle); + velocity->z = Math_CosS(randAngle); + + accel->x = 0.0f; + accel->y = 0.0f; + accel->z = 0.0f; +} + +void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { + s32 i; + Vec3f pos; + Vec3f velocity; + Vec3f accel; + + for (i = 0; i < 20; i++) { + func_800B13D8(srcPos, randScale, &pos, &velocity, &accel); + func_800B1280(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + } +} + +void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { + s32 i; + Vec3f pos; + Vec3f velocity; + Vec3f accel; + + for (i = 0; i < 20; i++) { + func_800B13D8(srcPos, randScale, &pos, &velocity, &accel); + func_800B12F0(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + } +} + +extern Color_RGBA8 D_801AE3B8; +extern Color_RGBA8 D_801AE3BC; + +void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + Color_RGBA8 primColor = D_801AE3B8; + Color_RGBA8 envColor = D_801AE3BC; + + EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); +} + +void EffectSsKiraKira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor) { + EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16); +} + +void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { + EffectSsKiraKiraInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + initParams.velocity.y = ((Rand_ZeroOne() * initParams.velocity.y) + initParams.velocity.y) * 0.5f; + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.accel.y = ((Rand_ZeroOne() * initParams.accel.y) + initParams.accel.y) * 0.5f; + initParams.life = life; + initParams.updateMode = 0; + initParams.rotSpeed = 0x1518; + initParams.yaw = Rand_ZeroOne() * 16384.0f; + initParams.scale = scale; + initParams.primColor = *primColor; + initParams.envColor = *envColor; + initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); + + EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); +} + +void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) { + EffectSsKiraKiraInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.life = life; + initParams.updateMode = 1; + initParams.rotSpeed = 0x1518; + initParams.yaw = Rand_ZeroOne() * 16384.0f; + initParams.scale = scale; + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); + + EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); +} + +void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsBomb2InitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = 100; + initParams.scaleStep = 0; + initParams.drawMode = 0; + + EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams); +} + +void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 scaleStep) { + EffectSsBomb2InitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.drawMode = 1; + + EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams); +} + +// EffectSsBlast Spawn Functions + +void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) { + EffectSsBlastInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.sclaeStepDecay = sclaeStepDecay; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_BLAST, 128, &initParams); +} + +extern Color_RGBA8 D_801AE3C0; +extern Color_RGBA8 D_801AE3C4; + +void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 scaleStep, s16 life) { + EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, &D_801AE3C0, &D_801AE3C4, scale, scaleStep, 35, life); +} + +void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 life) { + EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, primColor, envColor, 100, 375, 35, life); +} + +extern Color_RGBA8 D_801AE3C8; +extern Color_RGBA8 D_801AE3CC; + +void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &D_801AE3C8, &D_801AE3CC, 10); +} + +// EffectSsGSpk Spawn Functions + +void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsGSpkInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.actor = actor; + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.updateMode = 0; + + EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); +} + +// unused +void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) { + EffectSsGSpkInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.actor = actor; + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.updateMode = 1; + + EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); +} + +extern Color_RGBA8 D_801AE3D0; +extern Color_RGBA8 D_801AE3D4; + +void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + Color_RGBA8 primColor = D_801AE3D0; + Color_RGBA8 envColor = D_801AE3D4; + + EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor); +} + + +extern Color_RGBA8 D_801AE3D8; +extern Color_RGBA8 D_801AE3DC; + +// unused +void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + s16 scale, s16 scaleStep) { + Color_RGBA8 primColor = D_801AE3D8; + Color_RGBA8 envColor = D_801AE3DC; + s32 randOffset = (Rand_ZeroOne() * 20.0f) - 10.0f; + + primColor.r += randOffset; + primColor.g += randOffset; + primColor.b += randOffset; + primColor.a += randOffset; + envColor.r += randOffset; + envColor.g += randOffset; + envColor.b += randOffset; + envColor.a += randOffset; + + EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep); +} + +void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor) { + EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, primColor, envColor, 100, 5); +} + +// EffectSsDFire Spawn Functions +#ifdef NON_MATCHING +void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 alpha, s16 fadeDelay, s16 life) { + EffectSsDFireInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.a = alpha; + initParams.fadeDelay = fadeDelay; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams); +} +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsDFire_Spawn.asm") +#endif + +// EffectSsBubble Spawn Functions + +void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, + f32 scale) { + EffectSsBubbleInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + initParams.yPosOffset = yPosOffset; + initParams.yPosRandScale = yPosRandScale; + initParams.xzPosRandScale = xzPosRandScale; + initParams.scale = scale; + + EffectSs_Spawn(globalCtx, EFFECT_SS_BUBBLE, 128, &initParams); +} + +// EffectSsGRipple Spawn Functions + +void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) { + EffectSsGRippleInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + initParams.radius = radius; + initParams.radiusMax = radiusMax; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_G_RIPPLE, 128, &initParams); +} + +// EffectSsGSplash Spawn Functions + +void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, + s16 type, s16 scale) { + EffectSsGSplashInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + initParams.type = type; + initParams.scale = scale; + + if (primColor != NULL) { + initParams.primColor = *primColor; + initParams.envColor = *envColor; + initParams.customColor = 1; + } else { + initParams.customColor = 0; + } + + EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams); +} + +// EffectSsGFire Spawn Functions + +void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos) { + EffectSsGFireInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + + EffectSs_Spawn(globalCtx, EFFECT_SS_G_FIRE, 128, &initParams); +} + +// EffectSsLightning Spawn Functions + +void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, + s16 scale, s16 yaw, s16 life, s16 numBolts) { + EffectSsLightningInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.scale = scale; + initParams.yaw = yaw; + initParams.life = life; + initParams.numBolts = numBolts; + + EffectSs_Spawn(globalCtx, EFFECT_SS_LIGHTNING, 128, &initParams); +} + +// EffectSsDtBubble Spawn Functions + +void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 life, s16 colorProfile, s16 randXZ) { + EffectSsDtBubbleInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.customColor = 0; + initParams.colorProfile = colorProfile; + initParams.scale = scale; + initParams.life = life; + initParams.randXZ = randXZ; + + EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); +} + +void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ) { + EffectSsDtBubbleInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.scale = scale; + initParams.life = life; + initParams.randXZ = randXZ; + initParams.customColor = 1; + + EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); +} + +// EffectSsHahen Spawn Functions + +/** + * Spawn a single fragment + * + * Notes: + * - if a display list is not provided, D_0400C0D0 (wilted deku fragment) will be used as default + * - the unused arg does not do anything, any value can be passed here + * - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will + * only live for 200 frames + */ +void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, + s16 objId, s16 life, Gfx* dList) { + EffectSsHahenInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.dList = dList; + initParams.unused = unused; + initParams.scale = scale; + initParams.objId = objId; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_HAHEN, 128, &initParams); +} + +/** + * Spawn a burst of fragments, with the amount of fragments specifed by count and burst speed set by <arg2> + * + * Notes: + * - if a display list is not provided, D_0400C0D0 (wilted deku fragment) will be used as default + * - the unused arg does not do anything, any value can be passed here + * - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will + * only live for 200 frames + */ +#ifdef NON_MATCHING +void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, + s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList) { + s32 i; + Vec3f velocity; + Vec3f accel; + + accel.y = D_801DC104 * burstScale; + accel.x = accel.z = 0.0f; + + for (i = 0; i < count; i++) { + velocity.x = (Rand_ZeroOne() - 0.5f) * burstScale; + velocity.z = (Rand_ZeroOne() - 0.5f) * burstScale; + velocity.y = ((Rand_ZeroOne() * 0.5f) + 0.5f) * burstScale; + + EffectSsHahen_Spawn(globalCtx, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId, + life, dList); + } +} +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsHahen_SpawnBurst.asm") +#endif + +extern Vec3f D_801AE3E0; + +void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) { + Vec3f posVec = D_801AE3E0; + + EffectSsHahen_Spawn(globalCtx, pos, &D_801D15B0, &posVec, 1, 5, 1, 10, dList); +} + +// EffectSsStick Spawn Functions + +/** + * As child, spawn a broken stick fragment + * As adult, spawn a broken sword fragment + */ +void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw) { + EffectSsStickInitParams initParams; + + initParams.pos = *pos; + initParams.yaw = yaw; + + EffectSs_Spawn(globalCtx, EFFECT_SS_STICK, 128, &initParams); +} + +// EffectSsSibuki Spawn Functions + +void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, + s16 direction, s16 scale) { + EffectSsSibukiInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.moveDelay = moveDelay; + initParams.direction = direction; + initParams.scale = scale; + + EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI, 128, &initParams); +} + +extern Vec3f D_801AE3EC; +extern Vec3f D_801AE3F8; + +void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { + s16 i; + Vec3f zeroVec = D_801AE3EC; + s16 randDirection = Rand_ZeroOne() * D_801DC108; + + for (i = 0; i < KREG(19) + 30; i++) { + EffectSsSibuki_Spawn(globalCtx, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40); + } +} + +// EffectSsStone1 Spawn Functions + +void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2) { + EffectSsStone1InitParams initParams; + + initParams.pos = *pos; + initParams.unk_C = arg2; + + EffectSs_Spawn(globalCtx, EFFECT_SS_STONE1, 128, &initParams); +} + +// EffectSsHitMark Spawn Functions + +void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { + EffectSsHitMarkInitParams initParams; + + initParams.type = type; + initParams.scale = scale; + Math_Vec3f_Copy(&initParams.pos, pos); + + EffectSs_Spawn(globalCtx, EFFECT_SS_HITMARK, 128, &initParams); +} + +void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos) { + EffectSsHitMark_Spawn(globalCtx, type, 300, pos); +} + +void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) { + EffectSsHitMark_Spawn(globalCtx, type, scale, pos); +} + +// EffectSsFhgFlash Spawn Functions + +/** + * Spawn a shock effect + * + * param determines where the ligntning should go + * 0: dont attach to any actor. spawns at the position specified by pos + * 1: spawn at one of Player's body parts, chosen at random + * 2: spawn at one of Phantom Ganon's body parts, chosen at random + */ +void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param) { + EffectSsFhgFlashInitParams initParams; + + initParams.actor = actor; + Math_Vec3f_Copy(&initParams.pos, pos); + initParams.scale = scale; + initParams.param = param; + initParams.type = FHGFLASH_SHOCK; + + EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams); +} + +// EffectSsKFire Spawn Functions + +void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) { + EffectSsKFireInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scaleMax = scaleMax; + initParams.type = type; + + EffectSs_Spawn(globalCtx, EFFECT_SS_K_FIRE, 128, &initParams); +} + +// EffectSsSolderSrchBall Spawn Functions + +void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, + s16* linkDetected, s16 drawFlag) { + EffectSsSolderSrchBallInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.unused = unused; + initParams.linkDetected = linkDetected; + initParams.drawFlag = drawFlag; + + EffectSs_Spawn(globalCtx, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams); +} + +// EffectSsKakera Spawn Functions + +void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, + s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, + s16 objId, Gfx* dList) { + EffectSsKakeraInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.unk_18, arg3); + initParams.gravity = gravity; + initParams.unk_26 = arg5; + initParams.unk_28 = arg6; + initParams.unk_2A = arg7; + initParams.unk_2C = arg8; + initParams.scale = scale; + initParams.unk_30 = arg10; + initParams.unk_32 = arg11; + initParams.life = life; + initParams.colorIdx = colorIdx; + initParams.objId = objId; + initParams.dList = dList; + + EffectSs_Spawn(globalCtx, EFFECT_SS_KAKERA, 101, &initParams); +} + +// EffectSsIcePiece Spawn Functions + +void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) { + EffectSsIcePieceInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.life = life; + EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams); +} + +extern Vec3f D_801AE3F8; +extern Vec3f D_801AE404[10]; + +#ifdef NON_MATCHING +/* needs data migration to match */ +void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) { + static Vec3f accel = { 0.0f, 0.0f, 0.0f }; + static Vec3f vecScales[] = { + { 0.0f, 70.0f, 0.0f }, + { 0.0f, 45.0f, 20.0f }, + { 17.320474f, 45.0f, 9.999695f }, + { 17.320474f, 45.0f, -9.999695f }, + { 0.0f, 45.0f, -20.0f }, + { -17.320474f, 45.0f, -9.999695f }, + { -17.320474f, 45.0f, 9.999695f }, + { 0.0f, 20.0f, 20.0f }, + { 17.320474f, 20.0f, -9.999695f }, + { -17.320474f, 20.0f, -9.999695f }, + }; + s32 i; + Vec3f velocity; + Vec3f pos; + f32 velocityScale; + + accel.y = -0.2f; + + for (i = 0; i < ARRAY_COUNT(vecScales); i++) { + pos = *refPos; + velocityScale = Rand_ZeroFloat(1.0f) + 0.5f; + velocity.x = (vecScales[i].x * 0.18f) * velocityScale; + velocity.y = (vecScales[i].y * 0.18f) * velocityScale; + velocity.z = (vecScales[i].z * 0.18f) * velocityScale; + pos.x += vecScales[i].x; + pos.y += vecScales[i].y; + pos.z += vecScales[i].z; + + EffectSsIcePiece_Spawn(globalCtx, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, + &accel, 25); + } +} +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_SpawnBurst.asm") +#endif + +// EffectSsEnIce Spawn Functions + +void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f * pos, Color_RGBA8 * prim, Color_RGBA8 * env, f32 scale) { + + EffectSsEnIceInitParams initParams; + + initParams.actor = actor; + Math_Vec3f_Copy(&initParams.pos, pos); + Color_RGBA8_Copy(&initParams.primColor, prim); + Color_RGBA8_Copy(&initParams.envColor, env); + initParams.type = 0; + initParams.scale = scale; + + if (actor != NULL) { + Audio_PlayActorSound2(actor, 0x874); + } + + EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); +} + +extern Color_RGBA8 D_801AE47C; +extern Color_RGBA8 D_801AE480; + +void func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale) { + EffectSsEnIce_SpawnFlyingVec3f(globalCtx, actor, pos, &D_801AE47C, &D_801AE480, scale); +} + +void func_800B2B7C(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, f32 scale) { + Vec3f dest; + + Math_Vec3s_ToVec3f(&dest, arg2); + func_800B2B44(globalCtx, actor, &dest, scale); +} + +void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life) { + EffectSsEnIceInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.scale = scale; + initParams.life = life; + initParams.type = 1; + + EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 128, &initParams); +} + +// EffectSsFireTail Spawn Functions + +void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life) { + EffectSsFireTailInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.unk_14, arg4); + Color_RGBA8_Copy(&initParams.primColor, primColor); + Color_RGBA8_Copy(&initParams.envColor, envColor); + initParams.unk_20 = arg5; + initParams.actor = actor; + initParams.scale = scale; + initParams.type = type; + initParams.bodyPart = bodyPart; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_FIRE_TAIL, 128, &initParams); +} + +extern Color_RGBA8 D_801AE484; +extern Color_RGBA8 D_801AE488; + +#ifdef NON_MATCHING +// needs data migration to match +void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, + f32 colorIntensity) { + + D_801AE484.g = (s32)(255.0f * colorIntensity); + D_801AE484.b = 0; + + D_801AE488.g = 0; + D_801AE488.b = 0; + D_801AE484.r = D_801AE488.r = (s32)(255.0f * colorIntensity); + + EffectSsFireTail_Spawn(globalCtx, actor, pos, arg3, &actor->velocity, 15, &D_801AE484, &D_801AE488, + (colorIntensity == 1.0f) ? 0 : 1, bodyPart, 1); +} +#else +void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, + f32 colorIntensity); +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsFireTail_SpawnFlame.asm") +#endif + +void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) { + ActorPlayer* player = PLAYER; + + EffectSsFireTail_SpawnFlame(globalCtx, &player->base, &player->bodyPartsPos[bodyPart], scale, bodyPart, + colorIntensity); +} + +// EffectSsEnFire Spawn Functions + +void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, + s16 bodyPart) { + EffectSsEnFireInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + initParams.actor = actor; + initParams.scale = scale; + initParams.unk_12 = arg4; + initParams.flags = flags; + initParams.bodyPart = bodyPart; + + if (actor != NULL) { + Audio_PlayActorSound2(actor, 0x2822); + } + + EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); +} + +void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, + s16 bodyPart) { + EffectSsEnFireInitParams initParams; + + initParams.pos.x = pos->x; + initParams.pos.y = pos->y; + initParams.pos.z = pos->z; + initParams.actor = actor; + initParams.scale = scale; + initParams.unk_12 = arg4; + initParams.flags = flags | 0x8000; + initParams.bodyPart = bodyPart; + + if (actor != NULL) { + Audio_PlayActorSound2(actor, 0x2822); + } + + EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); +} + +// EffectSsExtra Spawn Functions + +void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) { + EffectSsExtraInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scoreIdx = scoreIdx; + + EffectSs_Spawn(globalCtx, EFFECT_SS_EXTRA, 100, &initParams); +} + +// EffectSsDeadDb Spawn Functions +void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, + s16 scale, s16 scaleStep, s32 unk) { + EffectSsDeadDbInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.primColor.r = prim->r; + initParams.primColor.g = prim->g; + initParams.primColor.b = prim->b; + initParams.primColor.a = prim->a; + initParams.envColor.r = env->r; + initParams.envColor.g = env->g; + initParams.envColor.b = env->b; + initParams.unk_30 = unk; + + EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams); +} + +extern Color_RGBA8 D_801AE48C; +extern Color_RGBA8 D_801AE490[4]; + +void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex) { + EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &D_801AE48C, &D_801AE490[colorIndex], scale, scaleStep, 9); +} + +// EffectSsDeadDd Spawn Functions + +void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) { + EffectSsDeadDdInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.primColor.r = prim->r; + initParams.primColor.g = prim->g; + initParams.primColor.b = prim->b; + initParams.primColor.a = prim->a; + initParams.envColor.r = env->r; + initParams.envColor.g = env->g; + initParams.envColor.b = env->b; + initParams.type = 0; + initParams.alphaStep = alphaStep; + initParams.life = life; + + EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams); +} + +// EffectSsDeadDs Spawn Functions + +void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 alpha, s32 life) { + EffectSsDeadDsInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + initParams.scaleStep = scaleStep; + initParams.alpha = alpha; + initParams.life = life; + EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DS, 100, &initParams); +} + +void func_800B31BC(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) { + EffectSsDeadDs_Spawn(globalCtx, pos, &D_801D15B0, &D_801D15B0, scale, scaleStep, alpha, life); +} + +// EffectSsIceSmoke Spawn Functions + +void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { + EffectSsIceSmokeInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + + EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_SMOKE, 128, &initParams); +} + +// EffectSsIceBlock Spawn Functions + +void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { + EffectSsIceBlockInitParams initParams; + + Math_Vec3f_Copy(&initParams.pos, pos); + Math_Vec3f_Copy(&initParams.velocity, velocity); + Math_Vec3f_Copy(&initParams.accel, accel); + initParams.scale = scale; + + EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_BLOCK, 128, &initParams); +} diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 9e99b9d85..de911c257 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -28,11 +28,11 @@ void* Lib_MemSet(u8* a0, u32 a1, u32 a2) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/Lib_MemSet.asm") #endif -f32 Math_Coss(s16 angle) { +f32 Math_CosS(s16 angle) { return coss(angle) * D_801DDA80; } -f32 Math_Sins(s16 angle) { +f32 Math_SinS(s16 angle) { return sins(angle) * D_801DDA84; } @@ -212,12 +212,12 @@ void func_800FF3A0(void) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/func_800FF3A0.asm") #endif -s16 Math_Rand_S16Offset(s16 base, s16 range) { - return (s16)(randZeroOne() * range) + base; +s16 Rand_S16Offset(s16 base, s16 range) { + return (s16)(Rand_ZeroOne() * range) + base; } s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) { - return (s16)(randZeroOne() * range) * stride + base; + return (s16)(Rand_ZeroOne() * range) * stride + base; } void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) { @@ -373,11 +373,11 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) { s16 Math_Vec3f_Yaw(Vec3f* from, Vec3f* to) { f32 f14 = to->x - from->x; f32 f12 = to->z - from->z; - return atans_flip(f12, f14); + return Math_FAtan2F(f12, f14); } s16 Math_Vec3f_Pitch(Vec3f* from, Vec3f* to) { - return atans_flip(Math_Vec3f_DistXZ(from, to), from->y - to->y); + return Math_FAtan2F(Math_Vec3f_DistXZ(from, to), from->y - to->y); } void Actor_ProcessInitChain(Actor* actor, InitChainEntry* init) { @@ -561,8 +561,8 @@ void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src, f32 sp1C; f32 f0; - sp1C = Math_Coss(rotation); - f0 = Math_Sins(rotation); + sp1C = Math_CosS(rotation); + f0 = Math_SinS(rotation); dst->x = translation->x + (src->x * sp1C + src->z * f0); dst->y = translation->y + src->y; dst->z = translation->z + (src->z * sp1C - src->x * f0); @@ -585,7 +585,7 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) { f32 f0; Math_Vec3f_Diff(pusher, start, &sp24); - f0 = Math3D_Length(&sp24); + f0 = Math3D_Vec3fMagnitude(&sp24); if (distanceToApproach < f0) { f2 = distanceToApproach / f0; f0 = f0 - distanceToApproach; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index c1c36d35c..6fb516e7c 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -132,7 +132,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global posF.x = params->point.x; posF.y = params->point.y; posF.z = params->point.z; - Matrix_MultiplyByVectorXYZ(&globalCtx->unk187B0,&posF,&adjustedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0,&posF,&adjustedPos); if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) && @@ -398,6 +398,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { } } +#if 1 void Lights_DrawGlow(GlobalContext* globalCtx) { Gfx* dl; LightPoint* params; @@ -424,9 +425,9 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50); SysMatrix_InsertTranslation(params->x, params->y, params->z, 0); - SysMatrix_InsertScale(scale,scale,scale,1); + Matrix_Scale(scale,scale,scale, MTXMODE_APPLY); - gSPMatrix(dl++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dl++, &D_04029CF0); } @@ -440,3 +441,6 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); } } +#else +#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lights/Lights_DrawGlow.asm") +#endif diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index beb04ef70..5026740ed 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1229,9 +1229,9 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u s32 i; Gfx* gfx; - gRspSegmentPhysAddrs[0] = 0; - gRspSegmentPhysAddrs[14] = (u32)graphDlEntry; - gRspSegmentPhysAddrs[15] = (u32)gCtxt->framebuffer; + gSegments[0] = 0; + gSegments[14] = (u32)graphDlEntry; + gSegments[15] = (u32)gCtxt->framebuffer; gfx = graphDlEntry + 0x16; gSPDisplayList(gfx + 0, &D_0E000140); @@ -1285,7 +1285,7 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u if (i == 0xE) { gSPNoOp(gfx + i); } else { - gSPSegment(gfx + i, i, gRspSegmentPhysAddrs[i]); + gSPSegment(gfx + i, i, gSegments[i]); } } gSPEndDisplayList(gfx + i); diff --git a/src/code/z_room.c b/src/code/z_room.c index 2c04cabe8..04842eeb6 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -110,7 +110,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) { roomCtxt->unk31 = 0; roomCtxt->currRoom.segment = roomCtxt->activeRoomVram; // TODO: Segment number enum - gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram); + gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram); Scene_ProcessHeader(ctxt, (SceneCmd*)roomCtxt->currRoom.segment); func_80123140(ctxt, (ActorPlayer*)ctxt->actorCtx.actorList[2].first); @@ -135,7 +135,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) { void Room_Draw(GlobalContext* ctxt, Room* room, u32 flags) { if (room->segment != NULL) { // TODO: Segment number enum - gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(room->segment); + gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment); roomDrawFuncs[room->mesh->type0.type](ctxt, room, flags); } return; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 8a0ed87b7..671f60447 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -19,14 +19,14 @@ s32 Scene_LoadObject(SceneContext* sceneCtxt, s16 id) { if (sceneCtxt) {} if (size) { - DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].vramAddr, objectFileTable[id].vromStart, size); + DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].segment, objectFileTable[id].vromStart, size); } // TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT if (sceneCtxt->objectCount < 0x22) { - sceneCtxt->objects[sceneCtxt->objectCount + 1].vramAddr = + sceneCtxt->objects[sceneCtxt->objectCount + 1].segment = // UB to cast pointer to u32 - (void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].vramAddr + size); + (void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].segment + size); } sceneCtxt->objectCount++; @@ -59,18 +59,18 @@ void Scene_Init(GlobalContext* ctxt, SceneContext* sceneCtxt) { // TODO: 0x23 is OBJECT_EXCHANGE_BANK_MAX in OOT for (i = 0; i < 0x23; i++) sceneCtxt->objects[i].id = 0; - sceneCtxt->objectVramStart = sceneCtxt->objects[0].vramAddr = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize); + sceneCtxt->objectVramStart = sceneCtxt->objects[0].segment = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize); // UB to cast sceneCtxt->objectVramStart to s32 sceneCtxt->objectVramEnd = (void*)((u32)sceneCtxt->objectVramStart + spaceSize); // TODO: Second argument here is an object enum sceneCtxt->mainKeepIndex = Scene_LoadObject(sceneCtxt, 1); // TODO: Segment number enum? - gRspSegmentPhysAddrs[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].vramAddr); + gSegments[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].segment); } void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) { s32 i; - SceneObject* status; + ObjectStatus* status; ObjectFileTableEntry* objectFile; u32 size; @@ -86,7 +86,7 @@ void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) { status->id = 0; } else { osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1); - DmaMgr_SendRequestImpl(&status->dmaReq, status->vramAddr, objectFile->vromStart, + DmaMgr_SendRequestImpl(&status->dmaReq, status->segment, objectFile->vromStart, size, 0, &status->loadQueue, NULL); } } else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) { @@ -128,7 +128,7 @@ void Scene_DmaAllObjects(SceneContext* sceneCtxt) { continue; } - DmaMgr_SendRequest0(sceneCtxt->objects[i].vramAddr, objectFileTable[id].vromStart, vromSize); + DmaMgr_SendRequest0(sceneCtxt->objects[i].segment, objectFileTable[id].vromStart, vromSize); } } @@ -143,7 +143,7 @@ void* func_8012F73C(SceneContext* sceneCtxt, s32 iParm2, s16 id) { fileTableEntry = &objectFileTable[id]; vromSize = fileTableEntry->vromEnd - fileTableEntry->vromStart; // TODO: UB to cast void to u32 - addr = ((u32)sceneCtxt->objects[iParm2].vramAddr) + vromSize; + addr = ((u32)sceneCtxt->objects[iParm2].segment) + vromSize; addr = ALIGN16(addr); // UB to cast u32 to pointer return (void*)addr; @@ -167,7 +167,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) { } loadedCount = Scene_LoadObject(&ctxt->sceneContext, OBJECT_LINK_CHILD); - objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].vramAddr; + objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].segment; ctxt->sceneContext.objectCount = loadedCount; ctxt->sceneContext.spawnedObjectCount = loadedCount; unk20 = gSaveContext.perm.unk20; @@ -175,7 +175,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) { gActorOverlayTable[0].initInfo->objectId = temp16; Scene_LoadObject(&ctxt->sceneContext, temp16); - ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].vramAddr = objectVramAddr; + ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].segment = objectVramAddr; } // Scene Command 0x01: Actor List @@ -198,7 +198,7 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) { temp_ret = (BgMeshHeader*)Lib_PtrSegToVirt(entry->colHeader.segment); temp_s0 = temp_ret; temp_s0->vertices = (BgVertex*)Lib_PtrSegToVirt(temp_ret->vertices); - temp_s0->polygons = (BgPolygon*)Lib_PtrSegToVirt(temp_s0->polygons); + temp_s0->polygons = (CollisionPoly*)Lib_PtrSegToVirt(temp_s0->polygons); if (temp_s0->attributes != 0) { temp_s0->attributes = (BgPolygonAttributes*)Lib_PtrSegToVirt(temp_s0->attributes); } @@ -229,8 +229,8 @@ void Scene_HeaderCommand07(GlobalContext* ctxt, SceneCmd* entry) { ctxt->sceneContext.keepObjectId = Scene_LoadObject(&ctxt->sceneContext, entry->specialFiles.keepObjectId); // TODO: Segment number enum? - gRspSegmentPhysAddrs[5] = - PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].vramAddr); + gSegments[5] = + PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].segment); } if (entry->specialFiles.cUpElfMsgNum != 0) { @@ -256,9 +256,9 @@ void Scene_HeaderCommand0A(GlobalContext* ctxt, SceneCmd* entry) { // Scene Command 0x0B: Object List void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) { s32 i, j, k; - SceneObject* firstObject; - SceneObject* status; - SceneObject* status2; + ObjectStatus* firstObject; + ObjectStatus* status; + ObjectStatus* status2; s16* objectEntry; void* nextPtr; @@ -292,7 +292,7 @@ void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) { // TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT if (i < 0x22) { - firstObject[i + 1].vramAddr = nextPtr; + firstObject[i + 1].segment = nextPtr; } i++; k++; @@ -386,15 +386,15 @@ void Scene_HeaderCommand10(GlobalContext *ctxt, SceneCmd *entry) { if (gSaveContext.extra.unk2b8 == 0) { // TODO: Needs REG macro - gStaticContext->data[0x0F] = ctxt->kankyoContext.unk2; + gGameInfo->data[0x0F] = ctxt->kankyoContext.unk2; } dayTime = gSaveContext.perm.time; - ctxt->kankyoContext.unk4 = -(Math_Sins(dayTime - 0x8000) * 120.0f) * 25.0f; + ctxt->kankyoContext.unk4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f; dayTime = gSaveContext.perm.time; - ctxt->kankyoContext.unk8 = (Math_Coss(dayTime - 0x8000) * 120.0f) * 25.0f; + ctxt->kankyoContext.unk8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f; dayTime = gSaveContext.perm.time; - ctxt->kankyoContext.unkC = (Math_Coss(dayTime - 0x8000) * 20.0f) * 25.0f; + ctxt->kankyoContext.unkC = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f; if (ctxt->kankyoContext.unk2 == 0 && gSaveContext.perm.cutscene < 0xFFF0) { gSaveContext.extra.environmentTime = gSaveContext.perm.time; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 4612cd33e..09ac2403c 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -38,7 +38,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; rot = limbDrawTable[limbIndex]; @@ -53,7 +53,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk if (dList != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; - gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(polyTemp + 1, dList); gfxCtx->polyOpa.p = polyTemp + 2; @@ -69,7 +69,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk postLimbDraw, actor, dListIndex); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -96,7 +96,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb gfxCtx = globalCtx->state.gfxCtx; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); pos.x = limbDrawTable[0].x; @@ -111,7 +111,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb if (dList != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; - gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(polyTemp + 1, dList); @@ -128,7 +128,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb postLimbDraw, actor, dListIndex); } - SysMatrix_StatePop(); + Matrix_Pop(); } /* @@ -145,7 +145,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -181,7 +181,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* postLimbDraw, actor, dListIndex, mtx); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -215,7 +215,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li gfxCtx = globalCtx->state.gfxCtx; gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); pos.x = limbDrawTable[0].x; @@ -251,7 +251,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li postLimbDraw, actor, dListIndex, &mtx); } - SysMatrix_StatePop(); + Matrix_Pop(); } /* @@ -266,7 +266,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -281,7 +281,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele if (dList != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; - gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(polyTemp + 1, dList); gfxCtx->polyOpa.p = polyTemp + 2; } @@ -296,7 +296,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele postLimbDraw, actor); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw, @@ -320,7 +320,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra gfxCtx = globalCtx->state.gfxCtx; - SysMatrix_StatePush(); + Matrix_Push(); rootLimb = Lib_PtrSegToVirt(skeleton->limbs[0]); pos.x = limbDrawTable[0].x; @@ -335,7 +335,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra if (dList != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; - gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(polyTemp + 1, dList); gfxCtx->polyOpa.p = polyTemp + 2; } @@ -350,7 +350,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra postLimbDraw, actor); } - SysMatrix_StatePop(); + Matrix_Pop(); } void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, @@ -363,7 +363,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -398,7 +398,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske postLimbDraw, actor, limbMatricies); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -427,7 +427,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); @@ -465,7 +465,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD postLimbDraw, actor, &mtx); } - SysMatrix_StatePop(); + Matrix_Pop(); } void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, @@ -478,7 +478,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad2; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -493,7 +493,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); - SysMatrix_StatePush(); + Matrix_Push(); unkDraw(globalCtx, limbIndex, actor); if (dList[1] != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; @@ -508,7 +508,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, (*mtx)++; } } - SysMatrix_StatePop(); + Matrix_Pop(); } if (postLimbDraw != NULL) { @@ -520,7 +520,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, unkDraw, actor, mtx); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { func_80134148(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw, @@ -549,7 +549,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); @@ -563,7 +563,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); - SysMatrix_StatePush(); + Matrix_Push(); unkDraw(globalCtx, 1, actor); if (dList[1] != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; @@ -577,7 +577,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw SysMatrix_GetStateAsRSPMatrix(mtx++); } } - SysMatrix_StatePop(); + Matrix_Pop(); } if (postLimbDraw != NULL) { @@ -589,7 +589,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw unkDraw, actor, &mtx); } - SysMatrix_StatePop(); + Matrix_Pop(); } /* @@ -639,7 +639,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel Vec3f pos; Vec3s rot; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -654,7 +654,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(gfx + 1, dList); gfx = gfx + 2; } @@ -669,7 +669,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel postLimbDraw, actor, gfx); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -695,7 +695,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr return NULL; } - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); @@ -709,7 +709,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(gfx + 1, dList); gfx = gfx + 2; } @@ -724,7 +724,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr postLimbDraw, actor, gfx); } - SysMatrix_StatePop(); + Matrix_Pop(); return gfx; } @@ -742,7 +742,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk Vec3f pos; Vec3s rot; - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]); limbIndex++; @@ -778,7 +778,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk postLimbDraw, actor, mtx, gfx); } - SysMatrix_StatePop(); + Matrix_Pop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -806,7 +806,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb gSPSegment(gfx++, 0xD, mtx); - SysMatrix_StatePush(); + Matrix_Push(); limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]); @@ -842,7 +842,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb postLimbDraw, actor, &mtx, gfx); } - SysMatrix_StatePop(); + Matrix_Pop(); return gfx; } @@ -1462,11 +1462,11 @@ s32 func_80136D98(SkelAnime* skelAnime) { } temp_a1 = (s16)(skelAnime->transCurrentFrame * 16384.0f); if (skelAnime->unk03 < 0) { - sp28 = 1.0f - Math_Coss(temp_a2); - phi_f2 = 1.0f - Math_Coss(temp_a1); + sp28 = 1.0f - Math_CosS(temp_a2); + phi_f2 = 1.0f - Math_CosS(temp_a1); } else { - sp28 = Math_Sins(temp_a2); - phi_f2 = Math_Sins(temp_a1); + sp28 = Math_SinS(temp_a2); + phi_f2 = Math_SinS(temp_a1); } if (phi_f2 != 0.0f) { phi_f2 /= sp28; @@ -1691,8 +1691,8 @@ void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle) { // `angle` rotation around y axis. x = skelAnime->limbDrawTbl->x - skelAnime->prevFramePos.x; z = skelAnime->limbDrawTbl->z - skelAnime->prevFramePos.z; - sin = Math_Sins(angle); - cos = Math_Coss(angle); + sin = Math_SinS(angle); + cos = Math_CosS(angle); pos->x = x * cos + z * sin; pos->z = z * cos - x * sin; } diff --git a/src/code/z_view.c b/src/code/z_view.c index f72b77ec0..1ceb239b2 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -256,11 +256,11 @@ s32 View_StepQuake(View* view, RSPMatrix* matrix) { } SysMatrix_FromRSPMatrix(matrix, &mf); - SysMatrix_SetCurrentState(&mf); + Matrix_Put(&mf); SysMatrix_RotateStateAroundXAxis(view->currQuakeRot.x); SysMatrix_InsertYRotation_f(view->currQuakeRot.y, 1); SysMatrix_InsertZRotation_f(view->currQuakeRot.z, 1); - SysMatrix_InsertScale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1); + Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1); SysMatrix_InsertZRotation_f(-view->currQuakeRot.z, 1); SysMatrix_InsertYRotation_f(-view->currQuakeRot.y, 1); SysMatrix_RotateStateAroundXAxis(-view->currQuakeRot.x); |
