This commit is contained in:
MegaMech
2025-05-16 23:35:21 -06:00
parent 1228f206e1
commit b551dd5f54
3 changed files with 58 additions and 9 deletions
+14 -5
View File
@@ -1,6 +1,7 @@
#include <actors.h>
#include <main.h>
#include <assets/choco_mountain_data.h>
#include "port/interpolation/FrameInterpolation.h"
/**
* @brief Renders the falling rock actor.
@@ -12,7 +13,7 @@
void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
Vec3s sp98;
Vec3f sp8C;
Mat4 sp4C;
Mat4 mtx;
f32 height;
UNUSED s32 pad[4];
@@ -41,16 +42,24 @@ void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
sp98[1] = 0;
sp98[2] = 0;
sp8C[1] = height + 2.0f;
mtxf_pos_rotation_xyz(sp4C, sp8C, sp98);
if (render_set_position(sp4C, 0) == 0) {
FrameInterpolation_RecordMatrixPush(mtx);
mtxf_pos_rotation_xyz(mtx, sp8C, sp98);
if (render_set_position(mtx, 0) == 0) {
return;
}
gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_dl_6F88);
FrameInterpolation_RecordMatrixPop(mtx);
}
}
mtxf_pos_rotation_xyz(sp4C, rock->pos, rock->rot);
if (render_set_position(sp4C, 0) == 0) {
FrameInterpolation_RecordMatrixPush(mtx);
mtxf_pos_rotation_xyz(mtx, rock->pos, rock->rot);
if (render_set_position(mtx, 0) == 0) {
return;
}
gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_dl_falling_rock);
FrameInterpolation_RecordMatrixPop(mtx);
}
+43 -4
View File
@@ -27,8 +27,6 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
f32 temp_f2_2;
f32 someMultiplier;
FrameInterpolation_RecordMatrixPush(someMatrix1);
FrameInterpolation_RecordMatrixPush(someMatrix2);
temp_f0 = is_within_render_distance(camera->pos, item_box->pos, camera->rot[1], 0.0f, gCameraZoom[camera - camera1],
4000000.0f);
@@ -43,6 +41,8 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
someVec2[0] = item_box->pos[0];
someVec2[1] = item_box->resetDistance + 2.0f;
someVec2[2] = item_box->pos[2];
FrameInterpolation_RecordMatrixPush(someMatrix1);
mtxf_pos_rotation_xyz(someMatrix1, someVec2, someRot);
if (!render_set_position(someMatrix1, 0)) {
@@ -50,8 +50,13 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D002EE8);
FrameInterpolation_RecordMatrixPop(someMatrix1);
someRot[1] = item_box->rot[1] * 2;
someVec2[1] = item_box->pos[1];
FrameInterpolation_RecordMatrixPush(someMatrix1);
mtxf_pos_rotation_xyz(someMatrix1, someVec2, someRot);
if (!render_set_position(someMatrix1, 0)) {
@@ -59,8 +64,13 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, itemBoxQuestionMarkModel);
FrameInterpolation_RecordMatrixPop(someMatrix1);
}
if (item_box->state == 5) {
FrameInterpolation_RecordMatrixPush(someMatrix1);
mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
if (!render_set_position(someMatrix1, 0)) {
@@ -68,8 +78,12 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, itemBoxQuestionMarkModel);
FrameInterpolation_RecordMatrixPop(someMatrix1);
}
if (item_box->state != 3) {
FrameInterpolation_RecordMatrixPush(someMatrix1);
mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
if (!render_set_position(someMatrix1, 0)) {
@@ -92,11 +106,15 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPDisplayList(gDisplayListHead++, D_0D003090);
FrameInterpolation_RecordMatrixPop(someMatrix1);
} else {
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
thing = item_box->someTimer;
FrameInterpolation_RecordMatrixPush(someMatrix2);
mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
if (thing < 10.0f) {
someMultiplier = 1.0f;
@@ -120,6 +138,11 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D003158);
FrameInterpolation_RecordMatrixPop(someMatrix2);
FrameInterpolation_RecordMatrixPush(someMatrix2);
temp_f2_2 = 0.8f * thing;
temp_f12 = 0.5f * thing;
someVec1[0] = temp_f2_2;
@@ -132,10 +155,14 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D0031B8);
FrameInterpolation_RecordMatrixPop(someMatrix2);
temp_f0_2 = -0.5f * thing;
someVec1[0] = temp_f2_2;
someVec1[1] = 1.2f * thing;
someVec1[2] = temp_f0_2;
FrameInterpolation_RecordMatrixPush(someMatrix2);
add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
if (!render_set_position(someMatrix2, 0)) {
@@ -143,6 +170,8 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D003128);
FrameInterpolation_RecordMatrixPop(someMatrix2);
if (!(item_box->someTimer & 1)) {
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
} else {
@@ -151,6 +180,8 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
someVec1[0] = 0.0f;
someVec1[1] = 1.8f * thing;
someVec1[2] = -1.0f * thing;
FrameInterpolation_RecordMatrixPush(someMatrix2);
add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
if (!render_set_position(someMatrix2, 0)) {
@@ -158,10 +189,14 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D0031E8);
FrameInterpolation_RecordMatrixPop(someMatrix2);
temp_f0_3 = -0.8f * thing;
someVec1[0] = temp_f0_3;
someVec1[1] = 0.6f * thing;
someVec1[2] = temp_f0_2;
FrameInterpolation_RecordMatrixPush(someMatrix2);
add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
if (!render_set_position(someMatrix2, 0)) {
@@ -169,9 +204,13 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D003188);
FrameInterpolation_RecordMatrixPop(someMatrix2);
someVec1[0] = temp_f0_3;
someVec1[1] = temp_f2;
someVec1[2] = temp_f12;
FrameInterpolation_RecordMatrixPop(someMatrix2);
add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
if (!render_set_position(someMatrix2, 0)) {
@@ -179,11 +218,11 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) {
}
gSPDisplayList(gDisplayListHead++, D_0D0030F8);
FrameInterpolation_RecordMatrixPop(someMatrix2);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
}
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
}
FrameInterpolation_RecordMatrixPop(someMatrix1);
FrameInterpolation_RecordMatrixPop(someMatrix2);
}
+1
View File
@@ -14,6 +14,7 @@ void AddMatrix(std::vector<Mtx>& stack, Mat4 mtx, s32 flags) {
stack.emplace_back();
// Convert to a fixed-point matrix
FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mtx, &stack.back());
guMtxF2L(mtx, &stack.back());
// Load the matrix