mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-07 22:22:32 -04:00
Merge branch 'transformfuncsforint' of https://github.com/HarbourMasters/SpaghettiKart into transformfuncsforint
This commit is contained in:
@@ -17,9 +17,6 @@ void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
|
||||
f32 height;
|
||||
UNUSED s32 pad[4];
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("rock", TAG_ITEM_ADDR(rock)); //Not working properly just yet
|
||||
|
||||
if (rock->respawnTimer != 0) {
|
||||
return;
|
||||
}
|
||||
@@ -54,8 +51,13 @@ void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
|
||||
}
|
||||
}
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("rock", (uintptr_t) rock);
|
||||
|
||||
mtxf_pos_rotation_xyz(mtx, rock->pos, rock->rot);
|
||||
if (render_set_position(mtx, 0) == 0) {
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
return;
|
||||
}
|
||||
gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_dl_falling_rock);
|
||||
|
||||
@@ -939,6 +939,10 @@ void func_80058F48(void) {
|
||||
|
||||
void func_80058F78(void) {
|
||||
if (gHUDDisable == 0) {
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("HudMatrix", 0);
|
||||
|
||||
set_matrix_hud_screen();
|
||||
if ((!gDemoMode) && (gIsHUDVisible != 0) && (D_801657D8 == 0)) {
|
||||
draw_item_window(PLAYER_ONE);
|
||||
@@ -951,6 +955,9 @@ void func_80058F78(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Bat.h"
|
||||
#include "World.h"
|
||||
#include "CoreMath.h"
|
||||
#include "port/interpolation/FrameInterpolation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "render_objects.h"
|
||||
@@ -113,6 +114,8 @@ void OBat::Draw(s32 cameraId) {
|
||||
D_80183E80[2] = gObjectList[objectIndex].orientation[2];
|
||||
if ((D_8018CFB0 != 0) || (D_8018CFC8 != 0)) {
|
||||
for (var_s2 = 0; var_s2 < 40; var_s2++) {
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Bat set 1", var_s2);
|
||||
objectIndex = gObjectParticle2[var_s2];
|
||||
if (objectIndex == -1) {
|
||||
continue;
|
||||
@@ -124,10 +127,14 @@ void OBat::Draw(s32 cameraId) {
|
||||
func_800431B0(gObjectList[objectIndex].pos, D_80183E80, gObjectList[objectIndex].sizeScaling,
|
||||
(Vtx*)D_0D0062B0);
|
||||
}
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
if ((D_8018CFE8 != 0) || (D_8018D000 != 0)) {
|
||||
for (var_s2 = 0; var_s2 < 30; var_s2++) {
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Bat set 2", var_s2);
|
||||
objectIndex = gObjectParticle3[var_s2];
|
||||
if (objectIndex == -1) {
|
||||
continue;
|
||||
@@ -139,6 +146,8 @@ void OBat::Draw(s32 cameraId) {
|
||||
func_800431B0(gObjectList[objectIndex].pos, D_80183E80, gObjectList[objectIndex].sizeScaling,
|
||||
(Vtx*)D_0D0062B0);
|
||||
}
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Boos.h"
|
||||
#include "World.h"
|
||||
#include "CoreMath.h"
|
||||
#include "port/interpolation/FrameInterpolation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "render_objects.h"
|
||||
@@ -82,6 +83,8 @@ void OBoos::Draw(s32 cameraId) {
|
||||
s32 objectIndex;
|
||||
|
||||
for (size_t i = 0; i < _numBoos; i++) {
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Boo", i);
|
||||
objectIndex = _indices[i]; //indexObjectList3[i];
|
||||
if (gObjectList[objectIndex].state >= 2) {
|
||||
temp_s2 = func_8008A364(objectIndex, cameraId, 0x4000U, 0x00000320);
|
||||
@@ -92,6 +95,8 @@ void OBoos::Draw(s32 cameraId) {
|
||||
func_800523B8(objectIndex, cameraId, temp_s2);
|
||||
}
|
||||
}
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "TrashBin.h"
|
||||
#include "World.h"
|
||||
#include "port/Game.h"
|
||||
#include "port/interpolation/FrameInterpolation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "main.h"
|
||||
@@ -62,11 +63,18 @@ void OTrashBin::Draw(s32 cameraId) {
|
||||
Mat4 mtx;
|
||||
Vec3f Pos = { _pos.x + 63, _pos.y + 12, _pos.z + 25 };
|
||||
Vec3s Rot = { 0, 0x4000, 0 };
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Bin", mtx);
|
||||
|
||||
mtxf_pos_rotation_xyz(mtx, Pos, Rot);
|
||||
//mtxf_scale(mtx, 1.0f);
|
||||
if (render_set_position(mtx, 0) != 0) {
|
||||
gSPDisplayList(gDisplayListHead++, BinMod);
|
||||
}
|
||||
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -233,10 +233,10 @@ uint32_t GameEngine::GetInterpolationFPS() {
|
||||
} else if (CVarGetInteger("gVsyncEnabled", 1) ||
|
||||
!Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
|
||||
return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(),
|
||||
CVarGetInteger("gInterpolationFPS", 60));
|
||||
CVarGetInteger("gInterpolationFPS", 30));
|
||||
}
|
||||
|
||||
return CVarGetInteger("gInterpolationFPS", 60);
|
||||
return CVarGetInteger("gInterpolationFPS", 30);
|
||||
}
|
||||
|
||||
uint32_t GameEngine::GetInterpolationFrameCount()
|
||||
@@ -360,7 +360,7 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) {
|
||||
int fps = target_fps;
|
||||
int original_fps = 60 / 2 /*gVIsPerFrame*/;
|
||||
|
||||
if (target_fps == 20 || original_fps > target_fps) {
|
||||
if (target_fps == 30 || original_fps > target_fps) {
|
||||
fps = original_fps;
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) {
|
||||
|
||||
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
|
||||
if (wnd != nullptr) {
|
||||
wnd->SetTargetFps(CVarGetInteger("gInterpolationFPS", 30));
|
||||
wnd->SetTargetFps(GetInterpolationFPS());
|
||||
wnd->SetMaximumFrameLatency(1);
|
||||
}
|
||||
RunCommands(commands, mtx_replacements);
|
||||
|
||||
@@ -565,7 +565,7 @@ void FrameInterpolation_StartRecord(void) {
|
||||
is_recording = false;
|
||||
return;
|
||||
}
|
||||
if (GameEngine::GetInterpolationFPS() != 20) {
|
||||
if (GameEngine::GetInterpolationFPS() != 30) {
|
||||
is_recording = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,11 +258,11 @@ void PortMenu::AddSettings() {
|
||||
if (mPortMenu->disabledMap.at(DISABLE_FOR_MATCH_REFRESH_RATE_ON).active)
|
||||
info.activeDisables.push_back(DISABLE_FOR_MATCH_REFRESH_RATE_ON);
|
||||
})
|
||||
.Options(IntSliderOptions().Tooltip(tooltip).Min(20).Max(maxFps).DefaultValue(20));
|
||||
.Options(IntSliderOptions().Tooltip(tooltip).Min(30).Max(maxFps).DefaultValue(30));
|
||||
AddWidget(path, "Match Refresh Rate", WIDGET_BUTTON)
|
||||
.Callback([](WidgetInfo& info) {
|
||||
int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
|
||||
if (hz >= 20 && hz <= 360) {
|
||||
if (hz >= 30 && hz <= 360) {
|
||||
CVarSetInteger("gInterpolationFPS", hz);
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
}
|
||||
|
||||
+25
-8
@@ -8,12 +8,14 @@
|
||||
#include "math.h"
|
||||
#include "memory.h"
|
||||
#include "engine/Matrix.h"
|
||||
#include "course.h"
|
||||
#include "port/Game.h"
|
||||
#include <port/interpolation/FrameInterpolation.h>
|
||||
#include <port/interpolation/matrix.h>
|
||||
|
||||
#pragma intrinsic(sqrtf, fabs)
|
||||
|
||||
extern s16 gCurrentCourseId;
|
||||
|
||||
s32 D_802B91C0[2] = { 13, 13 };
|
||||
Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -55,7 +57,7 @@ s32 render_set_position(Mat4 mtx, s32 arg1) {
|
||||
if (gMatrixObjectCount >= MTX_OBJECT_POOL_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
//mtxf_to_mtx(&gGfxPool->mtxObject[gMatrixObjectCount], arg0);
|
||||
// mtxf_to_mtx(&gGfxPool->mtxObject[gMatrixObjectCount], arg0);
|
||||
switch (arg1) { /* irregular */
|
||||
case 0:
|
||||
AddObjectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
@@ -1103,16 +1105,22 @@ s32 is_visible_between_angle(u16 arg0, u16 arg1, u16 arg2) {
|
||||
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov,
|
||||
f32 maxDistance) {
|
||||
u16 angleObject;
|
||||
UNUSED u16 pad;
|
||||
u16 temp_v0;
|
||||
f32 distanceX;
|
||||
f32 distance;
|
||||
f32 distanceY;
|
||||
f32 scaleFov;
|
||||
f32 maxDistance2;
|
||||
s32 plus_fov_angle;
|
||||
s32 minus_fov_angle;
|
||||
u16 temp;
|
||||
UNUSED s32 pad2[3];
|
||||
u16 extended_fov = ((u16) fov * 0xB6);
|
||||
s32 count = 0;
|
||||
|
||||
maxDistance *= 6.5f;
|
||||
maxDistance2 = 1.0f;
|
||||
scaleFov = 1.25;
|
||||
|
||||
f32 extended_fov = ((f32) fov * 0xB6 * scaleFov); // Sets the Culling for objects on the left and right
|
||||
|
||||
distanceX = objectPos[0] - cameraPos[0];
|
||||
distanceX = distanceX * distanceX;
|
||||
@@ -1141,19 +1149,28 @@ f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY
|
||||
|
||||
if (minDistance == 0.0f) {
|
||||
if (is_visible_between_angle((orientationY + extended_fov), (orientationY - extended_fov), angleObject) == 1) {
|
||||
return distance;
|
||||
if (gCurrentCourseId == 0xB /* COURSE_KALAMARI_DESERT */) {
|
||||
return distance / 6.5f; // set for better DD settings in Desert
|
||||
} else {
|
||||
return distance / 10.0f; // Items
|
||||
}
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
if (is_visible_between_angle((u16) plus_fov_angle, (u16) minus_fov_angle, angleObject) == 1) {
|
||||
return distance;
|
||||
if (gCurrentCourseId == 0xB /* COURSE_KALAMARI_DESERT */) {
|
||||
return distance / 2.0f;
|
||||
} else {
|
||||
return distance / 10.0f; // DD Vhicles
|
||||
}
|
||||
}
|
||||
|
||||
temp_v0 = func_802B7CA8(minDistance / distance);
|
||||
temp = angleObject + temp_v0;
|
||||
|
||||
if (is_visible_between_angle(plus_fov_angle, minus_fov_angle, temp) == 1) {
|
||||
return distance;
|
||||
return 0;
|
||||
}
|
||||
|
||||
temp = angleObject - temp_v0;
|
||||
|
||||
+47
-25
@@ -2629,6 +2629,8 @@ void draw_simplified_lap_count(s32 playerId) {
|
||||
}
|
||||
|
||||
void func_8004E800(s32 playerId) {
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Player place HUD", playerId << 8);
|
||||
if (playerHUD[playerId].unk_81 != 0) {
|
||||
if (playerHUD[playerId].lapCount != 3) {
|
||||
func_8004A384(playerHUD[playerId].rankX + playerHUD[playerId].slideRankX,
|
||||
@@ -2644,6 +2646,8 @@ void func_8004E800(s32 playerId) {
|
||||
0x00000040, 0x00000080, 0x00000040);
|
||||
}
|
||||
}
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
|
||||
void func_8004E998(s32 playerId) {
|
||||
@@ -3051,47 +3055,57 @@ void func_8004FDB4(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 characterId, s32
|
||||
void func_80050320(void) {
|
||||
s16 temp_v0;
|
||||
s16 characterId;
|
||||
s32 var_s0;
|
||||
s32 i;
|
||||
s32 lapCount;
|
||||
s32 var_a0;
|
||||
|
||||
if (D_801657E2 == 0) {
|
||||
for (var_s0 = 0; var_s0 < 4; var_s0++) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
var_a0 = 0;
|
||||
if (D_8018D050[var_s0] >= 0.0f) {
|
||||
if (D_8018D078[var_s0] < 0.0) {
|
||||
if (D_8018D050[i] >= 0.0f) {
|
||||
if (D_8018D078[i] < 0.0) {
|
||||
var_a0 = 1;
|
||||
}
|
||||
temp_v0 = gGPCurrentRacePlayerIdByRank[var_s0];
|
||||
characterId = gGPCurrentRaceCharacterIdByRank[var_s0];
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("ranking portraits", i | var_a0 << 16);
|
||||
|
||||
temp_v0 = gGPCurrentRacePlayerIdByRank[i];
|
||||
characterId = gGPCurrentRaceCharacterIdByRank[i];
|
||||
lapCount = gLapCountByPlayerId[temp_v0];
|
||||
if (characterId == gPlayerOne->characterId) {
|
||||
func_8004FDB4(D_8018D028[var_s0], D_8018D050[var_s0], var_s0, lapCount, characterId, 0x000000FF, 1,
|
||||
var_a0, 0);
|
||||
func_8004FDB4(D_8018D028[i], D_8018D050[i], i, lapCount, characterId, 0x000000FF, 1, var_a0, 0);
|
||||
} else {
|
||||
func_8004FDB4(D_8018D028[var_s0], D_8018D050[var_s0], var_s0, lapCount, characterId, D_8018D3E0, 0,
|
||||
var_a0, 0);
|
||||
func_8004FDB4(D_8018D028[i], D_8018D050[i], i, lapCount, characterId, D_8018D3E0, 0, var_a0, 0);
|
||||
}
|
||||
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var_s0 = 0; var_s0 < 8; var_s0++) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
var_a0 = 0;
|
||||
if (D_8018D050[var_s0] >= 0.0f) {
|
||||
if (D_8018D078[var_s0] <= 0.0) {
|
||||
if (D_8018D050[i] >= 0.0f) {
|
||||
if (D_8018D078[i] <= 0.0) {
|
||||
var_a0 = 1;
|
||||
}
|
||||
temp_v0 = gGPCurrentRacePlayerIdByRank[var_s0];
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("ranking portraits 2", i | var_a0 << 16);
|
||||
|
||||
temp_v0 = gGPCurrentRacePlayerIdByRank[i];
|
||||
// ????
|
||||
characterId = (gPlayerOne + temp_v0)->characterId;
|
||||
lapCount = gLapCountByPlayerId[temp_v0];
|
||||
if (temp_v0 == 0) {
|
||||
func_8004FDB4(D_8018D028[var_s0], D_8018D050[var_s0], var_s0, lapCount, characterId, 0x000000FF, 1,
|
||||
var_a0, 1);
|
||||
func_8004FDB4(D_8018D028[i], D_8018D050[i], i, lapCount, characterId, 0x000000FF, 1, var_a0, 1);
|
||||
} else {
|
||||
func_8004FDB4(D_8018D028[var_s0], D_8018D050[var_s0], var_s0, lapCount, characterId, 0x000000FF, 0,
|
||||
var_a0, 1);
|
||||
func_8004FDB4(D_8018D028[i], D_8018D050[i], i, lapCount, characterId, 0x000000FF, 0, var_a0, 1);
|
||||
}
|
||||
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3387,15 +3401,19 @@ void func_800514BC(void) {
|
||||
}
|
||||
|
||||
void render_object_leaf_particle(UNUSED s32 cameraId) {
|
||||
s32 someIndex;
|
||||
size_t i;
|
||||
s32 leafIndex;
|
||||
Object* object;
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_0D0079C8);
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BOTH);
|
||||
load_texture_block_rgba16_mirror((u8*) common_texture_particle_leaf, 0x00000020, 0x00000010);
|
||||
for (someIndex = 0; someIndex < gLeafParticle_SIZE; someIndex++) {
|
||||
leafIndex = gLeafParticle[someIndex];
|
||||
for (i = 0; i < gLeafParticle_SIZE; i++) {
|
||||
leafIndex = gLeafParticle[i];
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("Leaves", leafIndex);
|
||||
|
||||
if (leafIndex != -1) {
|
||||
object = &gObjectList[leafIndex];
|
||||
if ((object->state >= 2) && (object->unk_0D5 == 7) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) {
|
||||
@@ -3403,23 +3421,27 @@ void render_object_leaf_particle(UNUSED s32 cameraId) {
|
||||
gSPDisplayList(gDisplayListHead++, D_0D0069C8);
|
||||
}
|
||||
}
|
||||
|
||||
// @port Pop the transform id.
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
|
||||
gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF);
|
||||
}
|
||||
|
||||
void render_object_snowflakes_particles(void) {
|
||||
s32 someIndex;
|
||||
size_t i;
|
||||
s32 snowflakeIndex;
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_0D007AE0);
|
||||
gDPSetCombineLERP(gDisplayListHead++, 1, 0, SHADE, 0, 0, 0, 0, TEXEL0, 1, 0, SHADE, 0, 0, 0, 0, TEXEL0);
|
||||
func_80044F34(D_0D0293D8, 0x10, 0x10);
|
||||
for (someIndex = 0; someIndex < NUM_SNOWFLAKES; someIndex++) {
|
||||
snowflakeIndex = gObjectParticle1[someIndex];
|
||||
for (i = 0; i < NUM_SNOWFLAKES; i++) {
|
||||
snowflakeIndex = gObjectParticle1[i];
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("SnowFlakes", snowflakeIndex);
|
||||
|
||||
if (gObjectList[snowflakeIndex].state >= 2) {
|
||||
rsp_set_matrix_gObjectList(snowflakeIndex);
|
||||
gSPDisplayList(gDisplayListHead++, D_0D006980);
|
||||
@@ -3454,7 +3476,7 @@ void func_800518F8(s32 objectIndex, s16 x, s16 y) {
|
||||
}
|
||||
|
||||
if (gObjectList[objectIndex].status & 0x10) {
|
||||
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("func_800518F8", (uintptr_t) &gObjectList[objectIndex]);
|
||||
|
||||
|
||||
+1
-1
@@ -1892,7 +1892,7 @@ void render_player_ice_reflection(Player* player, s8 playerId, s8 screenId, s8 a
|
||||
}
|
||||
|
||||
// @port: Tag the transform.
|
||||
FrameInterpolation_RecordOpenChild("PlayerReflection", playerId);
|
||||
FrameInterpolation_RecordOpenChild("PlayerReflection", playerId | screenId << 8);
|
||||
|
||||
mtxf_translate_rotate(mtx, sp9C, sp94);
|
||||
mtxf_scale(mtx, gCharacterSize[player->characterId] * player->size);
|
||||
|
||||
Reference in New Issue
Block a user