Merge pull request #216 from coco875/particle-boat-and-train-

Particle boat and train and fix player particle
This commit is contained in:
coco875
2025-05-27 17:40:42 +00:00
committed by GitHub
7 changed files with 146 additions and 141 deletions
+25 -34
View File
@@ -2596,8 +2596,7 @@ void func_8005CB60(s32 playerId, s32 lapCount) {
case 1: /* switch 1 */
CM_ActivateSecondLapLakitu(playerId); // func_80079084(playerId);
func_800C9060(playerId, SOUND_ARG_LOAD(0x19, 0x00, 0xF0, 0x15));
if ((IsLuigiRaceway()) && (D_80165898 == 0) &&
(gModeSelection != (s32) TIME_TRIALS)) {
if ((IsLuigiRaceway()) && (D_80165898 == 0) && (gModeSelection != (s32) TIME_TRIALS)) {
D_80165898 = 1;
}
break;
@@ -4974,10 +4973,8 @@ void func_800651F4(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) {
}
}
s32 D_func_800652D4_counter = 0;
void func_800652D4(Vec3f arg0, Vec3s arg1, f32 arg2) {
Mat4 mtx;
FrameInterpolation_RecordOpenChild("some_thing", D_func_800652D4_counter++ << 8);
mtxf_translate_rotate(mtx, arg0, arg1);
mtxf_scale(mtx, arg2);
// convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], mtx);
@@ -4985,7 +4982,6 @@ void func_800652D4(Vec3f arg0, Vec3s arg1, f32 arg2) {
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AddEffectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
FrameInterpolation_RecordCloseChild();
}
void func_8006538C(Player* player, s8 arg1, s16 arg2, s8 arg3) {
@@ -5110,7 +5106,6 @@ void func_80065AB0(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
spAC[2] = 0;
// // @port: Tag the transform.
FrameInterpolation_RecordOpenChild("EEEEEEEEE", player->type << 8 | arg2 | var_s0 << 16);
// @port Skip interpolation
// FrameInterpolation_ShouldInterpolateFrame(false);
@@ -5136,7 +5131,6 @@ void func_80065AB0(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
gMatrixEffectCount += 1;
// @port Pop the transform id.
FrameInterpolation_RecordCloseChild();
// @port renable interpolation
// FrameInterpolation_ShouldInterpolateFrame(true);
}
@@ -5691,7 +5685,6 @@ void func_800691B8(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
sp54[2] = player->unk_258[30 + arg2].unk_03A;
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild("func_800691B8", TAG_OBJECT(arg2));
func_800652D4(sp5C, sp54, player->size * 0.5);
gSPDisplayList(gDisplayListHead++, D_0D008D58);
@@ -5706,7 +5699,6 @@ void func_800691B8(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
gMatrixEffectCount++;
// @port Pop the transform id.
FrameInterpolation_RecordCloseChild();
}
}
@@ -5768,7 +5760,6 @@ void func_800696CC(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3, f32 arg4)
sp54[2] = 0;
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild("func_800696CC", TAG_OBJECT(arg2));
func_800652D4(sp5C, sp54, player->size * arg4);
gSPDisplayList(gDisplayListHead++, D_0D008D58);
@@ -5783,7 +5774,6 @@ void func_800696CC(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3, f32 arg4)
gMatrixEffectCount += 1;
// @port Pop the transform id.
FrameInterpolation_RecordCloseChild();
}
}
@@ -5801,9 +5791,6 @@ void func_80069938(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
sp54[1] = player->unk_048[arg3];
sp54[2] = player->unk_258[30 + arg2].unk_038;
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild("func_80069938", TAG_OBJECT(arg2));
func_800652D4(sp5C, sp54, player->unk_258[30 + arg2].unk_00C * player->size);
gSPDisplayList(gDisplayListHead++, D_0D008D58);
gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE);
@@ -5817,7 +5804,6 @@ void func_80069938(Player* player, UNUSED s8 arg1, s16 arg2, s8 arg3) {
gMatrixEffectCount += 1;
// @port Pop the transform id.
FrameInterpolation_RecordCloseChild();
}
}
@@ -6618,8 +6604,7 @@ void func_8006D474(Player* player, s8 playerId, s8 screenId) {
if ((player->unk_002 & (8 << (screenId * 4))) == (8 << (screenId * 4))) {
for (var_s2 = 0; var_s2 < 10; var_s2++) {
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild(
"SmokeDust", TAG_SMOKE_DUST(((u32) player->unk_258[var_s2].unk_012 << 8) + (playerId << 16) + var_s2));
FrameInterpolation_RecordOpenChild("SmokeDust", TAG_SMOKE_DUST((playerId << 8) + var_s2));
switch (player->unk_258[var_s2].unk_012) {
case 1:
@@ -6641,6 +6626,8 @@ void func_8006D474(Player* player, s8 playerId, s8 screenId) {
}
break;
}
FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("SmokeDust", TAG_SMOKE_DUST((playerId << 8) + var_s2 + 30));
switch (player->unk_258[var_s2 + 30].unk_012) {
case 1:
case 9:
@@ -6700,6 +6687,8 @@ void func_8006D474(Player* player, s8 playerId, s8 screenId) {
}
break;
}
FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("SmokeDust", TAG_SMOKE_DUST((playerId << 8) + var_s2 + 10));
switch (player->unk_258[var_s2 + 10].unk_012) {
case 1:
if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
@@ -6764,48 +6753,50 @@ void func_8006DC54(Player* player, s8 arg1, s8 arg2) {
}
}
void func_8006DD3C(Player* arg0, s8 arg1, s8 arg2) {
void func_8006DD3C(Player* player, s8 playerId, s8 arg2) {
s16 temp_s0;
s32 temp_v0;
temp_v0 = 8 << (arg2 * 4);
if (temp_v0 == (arg0->unk_002 & temp_v0)) {
if (temp_v0 == (player->unk_002 & temp_v0)) {
for (temp_s0 = 0; temp_s0 < 10; ++temp_s0) {
temp_v0 = arg0->unk_258[temp_s0].unk_012;
temp_v0 = player->unk_258[temp_s0].unk_012;
if (temp_v0 != 3) {
if (temp_v0 == 5) {
func_8006A280(arg0, arg1, temp_s0, arg2);
func_8006A280(player, playerId, temp_s0, arg2);
}
} else if (gActiveScreenMode == SCREEN_MODE_3P_4P_SPLITSCREEN) {
if (arg2 == arg1) {
func_80066998(arg0, arg1, temp_s0, arg2);
if (arg2 == playerId) {
func_80066998(player, playerId, temp_s0, arg2);
}
} else {
func_80066998(arg0, arg1, temp_s0, arg2);
func_80066998(player, playerId, temp_s0, arg2);
}
}
if (((arg0->type & 0x4000) == 0x4000) && (arg2 == arg1)) {
switch (arg0->unk_258[20].unk_012) {
if (((player->type & 0x4000) == 0x4000) && (arg2 == playerId)) {
FrameInterpolation_RecordOpenChild("onomatopoeia", TAG_SMOKE_DUST((playerId << 8) + 20));
switch (player->unk_258[20].unk_012) {
case 2:
func_80068310(arg0, arg1, arg0->unk_258[20].unk_00C, arg2, 0);
func_80068310(player, playerId, player->unk_258[20].unk_00C, arg2, 0);
break;
case 3:
func_80067964(arg0, arg1, arg0->unk_258[20].unk_00C, arg2, 0);
func_80067964(player, playerId, player->unk_258[20].unk_00C, arg2, 0);
break;
case 4:
func_80068724(arg0, arg1, arg0->unk_258[20].unk_00C, arg2, 0);
func_80068724(player, playerId, player->unk_258[20].unk_00C, arg2, 0);
break;
case 5:
func_80068AA4(arg0, arg1, arg0->unk_258[20].unk_00C, arg2, 0);
func_80068AA4(player, playerId, player->unk_258[20].unk_00C, arg2, 0);
break;
case 6:
func_80068DA0(arg0, arg1, arg0->unk_258[20].unk_00C, arg2, 0);
func_80068DA0(player, playerId, player->unk_258[20].unk_00C, arg2, 0);
break;
}
if (arg0->unk_258[21].unk_012 == 5) {
func_80067D3C(arg0, arg2, D_8018D480, 1, 1.6f, 0xFFFFFF);
func_8006801C(arg0, arg2, D_8018D484, 1, 1.6f, 0xFF);
FrameInterpolation_RecordCloseChild();
if (player->unk_258[21].unk_012 == 5) {
func_80067D3C(player, arg2, D_8018D480, 1, 1.6f, 0xFFFFFF);
func_8006801C(player, arg2, D_8018D484, 1, 1.6f, 0xFF);
}
}
}
+10 -7
View File
@@ -13,6 +13,7 @@ extern "C" {
#include "update_objects.h"
#include "math_util_2.h"
#include "assets/common_data.h"
#include <port/interpolation/FrameInterpolation.h>
}
//! @todo: This should be an Object class one day
@@ -69,7 +70,6 @@ void TrainSmokeTick() {
if (count != 0) {
boat->SmokeTimer = 100;
}
}
}
}
@@ -80,28 +80,31 @@ void TrainSmokeDraw(s32 cameraId) {
for (auto& actor : gWorldInstance.Actors) {
if (auto train = dynamic_cast<ATrain*>(actor)) {
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007AE0);
load_texture_block_i8_nomirror((uint8_t*)D_0D029458, 32, 32);
gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D007AE0);
load_texture_block_i8_nomirror((uint8_t*) D_0D029458, 32, 32);
func_8004B72C(255, 255, 255, 255, 255, 255, 255);
D_80183E80[0] = 0;
D_80183E80[2] = 0x8000;
if ((train->SomeFlags != 0) &&
(is_particle_on_screen(train->Locomotive.position, camera, 0x4000U) != 0)) {
if ((train->SomeFlags != 0) && (is_particle_on_screen(train->Locomotive.position, camera, 0x4000U) != 0)) {
for (size_t i = 0; i < 128; i++) {
FrameInterpolation_RecordOpenChild("TrainSmokeParticle", train->SmokeParticles[i]);
render_object_train_smoke_particle(train->SmokeParticles[i], cameraId);
FrameInterpolation_RecordCloseChild();
}
}
} else if (auto boat = dynamic_cast<ABoat*>(actor)) {
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007AE0);
gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D007AE0);
load_texture_block_i8_nomirror((uint8_t*)D_0D029458, 32, 32);
load_texture_block_i8_nomirror((uint8_t*) D_0D029458, 32, 32);
func_8004B72C(255, 255, 255, 255, 255, 255, 255);
D_80183E80[0] = 0;
D_80183E80[2] = 0x8000;
if ((boat->SomeFlags != 0) && (is_particle_on_screen(boat->Position, camera, 0x4000U) != 0)) {
for (size_t i = 0; i < gObjectParticle2_SIZE; i++) {
FrameInterpolation_RecordOpenChild("BoatSmokeParticle", boat->SmokeParticles[i]);
render_object_paddle_boat_smoke_particle(boat->SmokeParticles[i], cameraId);
FrameInterpolation_RecordCloseChild();
}
}
}
+1 -1
View File
@@ -397,7 +397,7 @@ void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) {
D_800DC5E0 = 72;
// Render only the first player camera onto the television billboard. Screen agnostic screens of other players).
if ((gActiveScreenMode == SCREEN_MODE_1P) && (sp22 >= 10) && (sp22 < 17)) {
if (gActiveScreenMode == SCREEN_MODE_1P) {
prevFrame = (s16) sRenderedFramebuffer - 1;
+37 -36
View File
@@ -27,7 +27,7 @@
#include "port/interpolation/FrameInterpolation.h"
#include <graphic/Fast3D/Fast3dWindow.h>
#include <graphic/Fast3D/interpreter.h>
//#include <Fast3D/gfx_rendering_api.h>
// #include <Fast3D/gfx_rendering_api.h>
#include <SDL2/SDL.h>
#include <utility>
@@ -52,9 +52,9 @@ float gInterpolationStep = 0.0f;
Fast::Interpreter* GetInterpreter() {
return static_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
->GetInterpreterWeak()
.lock()
.get();
->GetInterpreterWeak()
.lock()
.get();
}
GameEngine* GameEngine::Instance;
@@ -63,7 +63,7 @@ GameEngine::GameEngine() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("mk64.o2r");
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("spaghetti.o2r");
std::vector<std::string> archiveFiles;
#ifdef __SWITCH__
@@ -71,7 +71,6 @@ GameEngine::GameEngine() {
Ship::Switch::Init(Ship::PostInitPhase);
#endif
#ifdef _WIN32
AllocConsole();
#endif
@@ -80,7 +79,7 @@ GameEngine::GameEngine() {
archiveFiles.push_back(main_path);
} else {
if (ShowYesNoBox("No O2R Files", "No O2R files found. Generate one now?") == IDYES) {
if(!GenAssetFile()){
if (!GenAssetFile()) {
ShowMessage("Error", "An error occured, no O2R file was generated.\n\nExiting...");
exit(1);
} else {
@@ -107,11 +106,11 @@ GameEngine::GameEngine() {
}
}
this->context =
Ship::Context::CreateUninitializedInstance("Spaghetti Kart", "spaghettify", "spaghettify.cfg.json");
this->context = Ship::Context::CreateUninitializedInstance("Spaghetti Kart", "spaghettify", "spaghettify.cfg.json");
this->context->InitConfiguration(); // without this line InitConsoleVariables fails at Config::Reload()
this->context->InitConsoleVariables(); // without this line the controldeck constructor failes in ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()
this->context->InitConfiguration(); // without this line InitConsoleVariables fails at Config::Reload()
this->context->InitConsoleVariables(); // without this line the controldeck constructor failes in
// ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()
auto controlDeck = std::make_shared<LUS::ControlDeck>();
@@ -121,8 +120,8 @@ GameEngine::GameEngine() {
auto gui = std::make_shared<Ship::SpaghettiGui>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
auto wnd = std::make_shared<Fast::Fast3dWindow>(gui);
//auto wnd = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
//auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
// auto wnd = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
// auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
this->context->Init(archiveFiles, {}, 3, { 26800, 512, 1100 }, wnd, controlDeck);
@@ -159,8 +158,9 @@ GameEngine::GameEngine() {
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML, "Vertex",
static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY,
"DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(),
RESOURCE_FORMAT_BINARY, "DisplayList",
static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML,
"DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
@@ -179,24 +179,21 @@ GameEngine::GameEngine() {
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTrackSectionsV0>(),
RESOURCE_FORMAT_BINARY, "TrackSections",
static_cast<uint32_t>(MK64::ResourceType::TrackSection), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryXMLTrackSectionsV0>(),
RESOURCE_FORMAT_XML, "TrackSections",
static_cast<uint32_t>(MK64::ResourceType::TrackSection), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryXMLTrackSectionsV0>(), RESOURCE_FORMAT_XML,
"TrackSections", static_cast<uint32_t>(MK64::ResourceType::TrackSection), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryTrackWaypointsV0>(),
RESOURCE_FORMAT_BINARY, "Waypoints",
static_cast<uint32_t>(MK64::ResourceType::Waypoints), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryXMLTrackWaypointsV0>(),
RESOURCE_FORMAT_XML, "Paths",
static_cast<uint32_t>(MK64::ResourceType::Waypoints), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryXMLTrackWaypointsV0>(), RESOURCE_FORMAT_XML,
"Paths", static_cast<uint32_t>(MK64::ResourceType::Waypoints), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryActorSpawnDataV0>(),
RESOURCE_FORMAT_BINARY, "SpawnData",
static_cast<uint32_t>(MK64::ResourceType::SpawnData), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryUnkActorSpawnDataV0>(),
RESOURCE_FORMAT_BINARY, "UnkSpawnData",
static_cast<uint32_t>(MK64::ResourceType::UnkSpawnData), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryMinimapV0>(),
RESOURCE_FORMAT_BINARY, "Minimap",
static_cast<uint32_t>(MK64::ResourceType::Minimap), 0);
loader->RegisterResourceFactory(std::make_shared<MK64::ResourceFactoryBinaryMinimapV0>(), RESOURCE_FORMAT_BINARY,
"Minimap", static_cast<uint32_t>(MK64::ResourceType::Minimap), 0);
fontMono = CreateFontWithSize(16.0f, "fonts/Inconsolata-Regular.ttf");
fontMonoLarger = CreateFontWithSize(20.0f, "fonts/Inconsolata-Regular.ttf");
@@ -217,11 +214,13 @@ bool GameEngine::GenAssetFile() {
auto game = extractor->ValidateChecksum();
if (!game.has_value()) {
ShowMessage("Unsupported ROM", "The provided ROM is not supported.\n\nCheck the readme for a list of supported versions.");
ShowMessage("Unsupported ROM",
"The provided ROM is not supported.\n\nCheck the readme for a list of supported versions.");
exit(1);
}
ShowMessage(("Found " + game.value()).c_str(), "The extraction process will now begin.\n\nThis may take a few minutes.", SDL_MESSAGEBOX_INFORMATION);
ShowMessage(("Found " + game.value()).c_str(),
"The extraction process will now begin.\n\nThis may take a few minutes.", SDL_MESSAGEBOX_INFORMATION);
return extractor->GenerateOTR();
}
@@ -239,13 +238,12 @@ uint32_t GameEngine::GetInterpolationFPS() {
return CVarGetInteger("gInterpolationFPS", 30);
}
uint32_t GameEngine::GetInterpolationFrameCount()
{
return ceil((float)GetInterpolationFPS() / (60.0f / 2 /*gVIsPerFrame*/));
uint32_t GameEngine::GetInterpolationFrameCount() {
return ceil((float) GetInterpolationFPS() / (60.0f / 2 /*gVIsPerFrame*/));
}
extern "C" uint32_t GameEngine_GetInterpolationFrameCount() {
return GameEngine::GetInterpolationFrameCount();
return GameEngine::GetInterpolationFrameCount();
}
void GameEngine::ShowMessage(const char* title, const char* message, SDL_MessageBoxFlags type) {
@@ -357,6 +355,9 @@ void GameEngine::RunCommands(Gfx* Commands, const std::vector<std::unordered_map
void GameEngine::ProcessGfxCommands(Gfx* commands) {
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
int target_fps = GameEngine::Instance->GetInterpolationFPS();
if (CVarGetInteger("gModifyInterpolationTargetFPS", 0)) {
target_fps = CVarGetInteger("gInterpolationTargetFPS", 60);
}
static int last_fps;
static int last_update_rate;
static int time;
@@ -382,7 +383,7 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) {
mtx_replacements.emplace_back();
}
}
// printf("mtxf size: %d\n", mtx_replacements.size());
// printf("mtxf size: %d\n", mtx_replacements.size());
time -= fps;
@@ -512,7 +513,7 @@ ImFont* GameEngine::CreateFontWithSize(float size, std::string fontPath) {
initData->Path = fontPath;
std::shared_ptr<Ship::Font> fontData = std::static_pointer_cast<Ship::Font>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
char* fontDataPtr = (char*)malloc(fontData->DataSize);
char* fontDataPtr = (char*) malloc(fontData->DataSize);
memcpy(fontDataPtr, fontData->Data, fontData->DataSize);
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontDataPtr, fontData->DataSize, size);
}
@@ -705,14 +706,14 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
/**
* Centers an item in a given area.
*
*
* Adds the number of extended screen pixels to the location to center.
* This allows stretching the game window really wide, and the item will stay in-place.
*
*
* This is not for centering in the direct center of the screen.
*
*
* How to use:
*
*
* s32 center = OTRCalculateCenterOfAreaFromRightEdge((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2));
* x = center - (texWidth / 2)
* x2 = center + (texWidth / 2)
+68 -51
View File
@@ -15,10 +15,10 @@
#endif
extern "C" {
extern s32 gGamestateNext;
extern s32 gMenuSelection;
#include "audio/external.h"
#include "defines.h"
extern s32 gGamestateNext;
extern s32 gMenuSelection;
#include "audio/external.h"
#include "defines.h"
}
namespace GameUI {
@@ -158,9 +158,8 @@ void PortMenu::AddSettings() {
.IsPercentage());
AddWidget(path, "Main Music Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gMainMusicVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_LEVEL, CVarGetFloat("gMainMusicVolume", 1.0f));
})
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_LEVEL, CVarGetFloat("gMainMusicVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the background music volume.")
.ShowButtons(false)
@@ -168,16 +167,17 @@ void PortMenu::AddSettings() {
.IsPercentage());
AddWidget(path, "Sound Effects Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gSFXMusicVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f));
})
.Options(
FloatSliderOptions().Tooltip("Adjust the sound effects volume.").ShowButtons(false).Format("").IsPercentage());
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the sound effects volume.")
.ShowButtons(false)
.Format("")
.IsPercentage());
AddWidget(path, "Sound Effects Volume: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gEnvironmentVolume")
.Callback([](WidgetInfo& info) {
audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f));
})
.Callback(
[](WidgetInfo& info) { audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f)); })
.Options(FloatSliderOptions()
.Tooltip("Adjust the environment volume.")
.ShowButtons(false)
@@ -332,31 +332,36 @@ void PortMenu::AddEnhancements() {
AddMenuEntry("Enhancements", "gSettings.Menu.EnhancementsSidebarSection");
WidgetPath path = { "Enhancements", "General", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "General", 3);
//UIWidgets::WindowButton("Multiplayer", "gMultiplayerWindowEnabled", GameUI::mMultiplayerWindow,
// { .tooltip = "Shows the multiplayer window" });
// UIWidgets::WindowButton("Freecam", "gFreecam", GameUI::mFreecamWindow,
// { .tooltip = "Allows you to fly around the course" });
// UIWidgets::WindowButton("Multiplayer", "gMultiplayerWindowEnabled", GameUI::mMultiplayerWindow,
// { .tooltip = "Shows the multiplayer window" });
// UIWidgets::WindowButton("Freecam", "gFreecam", GameUI::mFreecamWindow,
// { .tooltip = "Allows you to fly around the course" });
AddWidget(path, "No multiplayer feature cuts", WIDGET_CVAR_CHECKBOX)
.CVar("gMultiplayerNoFeatureCuts")
.Options(CheckboxOptions().Tooltip("Allows full train and jumbotron in multiplayer, etc."));
AddWidget(path, "General Improvements", WIDGET_CVAR_CHECKBOX)
.CVar("gImprovements").Options(CheckboxOptions().Tooltip("General improvements to the game experience."));
.CVar("gImprovements")
.Options(CheckboxOptions().Tooltip("General improvements to the game experience."));
AddWidget(path, "No Level of Detail (LOD)", WIDGET_CVAR_CHECKBOX)
.CVar("gDisableLod")
.Options(CheckboxOptions().Tooltip("Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance"));
.Options(CheckboxOptions().Tooltip(
"Disable Level of Detail (LOD) to avoid models using lower poly versions at a distance"));
AddWidget(path, "Disable Culling", WIDGET_CVAR_CHECKBOX)
.CVar("gNoCulling").Options(CheckboxOptions().Tooltip("Disable original culling of mk64"));
.CVar("gNoCulling")
.Options(CheckboxOptions().Tooltip("Disable original culling of mk64"));
AddWidget(path, "Far Frustrum", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gFarFrustrum")
.Options(FloatSliderOptions().Min(0.0f).Max(10000.0f).DefaultValue(10000.0f)
.Tooltip("Say how Far the Frustrum are when 'Disable Culling' are enable").Step(10.0f));
.Options(FloatSliderOptions()
.Min(0.0f)
.Max(10000.0f)
.DefaultValue(10000.0f)
.Tooltip("Say how Far the Frustrum are when 'Disable Culling' are enable")
.Step(10.0f));
path = { "Enhancements", "Cheats", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "Cheats", 3);
AddWidget(path, "Moon Jump", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableMoonJump");
AddWidget(path, "Enable Custom CC", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableCustomCC");
AddWidget(path, "Moon Jump", WIDGET_CVAR_CHECKBOX).CVar("gEnableMoonJump");
AddWidget(path, "Enable Custom CC", WIDGET_CVAR_CHECKBOX).CVar("gEnableCustomCC");
AddWidget(path, "Custom CC", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gCustomCC")
.Options(FloatSliderOptions().Min(0.0f).Max(1000.0f).DefaultValue(150.0f).Step(10.0f));
@@ -365,23 +370,23 @@ void PortMenu::AddEnhancements() {
.Options(CheckboxOptions().Tooltip("Disable wall collision."));
AddWidget(path, "Min Height", WIDGET_CVAR_SLIDER_FLOAT)
.CVar("gMinHeight")
.Options(FloatSliderOptions().Min(-50.0f).Max(50.0f).DefaultValue(0.0f)
.Tooltip("When Disable Wall Collision are enable what is the minimal height you can get."));
.Options(FloatSliderOptions().Min(-50.0f).Max(50.0f).DefaultValue(0.0f).Tooltip(
"When Disable Wall Collision are enable what is the minimal height you can get."));
#if not defined(__SWITCH__) and not defined(__WIIU__)
#if not defined(__SWITCH__) and not defined(__WIIU__)
path = { "Enhancements", "HM64 Lab", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", "HM64 Lab", 4);
AddWidget(path, "Enable HM64 Labs", WIDGET_CVAR_CHECKBOX)
.CVar("gEditorEnabled")
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Tools")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Scene Explorer")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Content Browser")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Track Properties")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Properties")->ToggleVisibility();
})
.Options(UIWidgets::CheckboxOptions({{ .tooltip = "Edit the universe!"}}));
#endif
.CVar("gEditorEnabled")
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Tools")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Scene Explorer")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Content Browser")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Track Properties")->ToggleVisibility();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Properties")->ToggleVisibility();
})
.Options(UIWidgets::CheckboxOptions({ { .tooltip = "Edit the universe!" } }));
#endif
}
#ifdef __SWITCH__
@@ -402,11 +407,11 @@ void PortMenu::AddDevTools() {
WidgetPath path = { "Developer", "General", SECTION_COLUMN_1 };
#ifdef __SWITCH__
AddWidget(path, "Switch CPU Profile", WIDGET_CVAR_COMBOBOX)
.CVar("gSwitchPerfMode")
.Options(ComboboxOptions()
.Tooltip("Switches the CPU profile to a different one")
.ComboMap(switchCPUProfiles)
.DefaultIndex(Ship::SwitchProfiles::STOCK))
.CVar("gSwitchPerfMode")
.Options(ComboboxOptions()
.Tooltip("Switches the CPU profile to a different one")
.ComboMap(switchCPUProfiles)
.DefaultIndex(Ship::SwitchProfiles::STOCK))
.Callback([](WidgetInfo& info) { Ship::Switch::ApplyOverclock(); });
#endif
AddWidget(path, "Popout Menu", WIDGET_CVAR_CHECKBOX)
@@ -415,6 +420,17 @@ void PortMenu::AddDevTools() {
AddWidget(path, "Debug Mode", WIDGET_CVAR_CHECKBOX)
.CVar("gEnableDebugMode")
.Options(CheckboxOptions().Tooltip("Enables Debug Mode."));
AddWidget(path, "Modify Interpolation Target FPS", WIDGET_CVAR_CHECKBOX)
.CVar("gModifyInterpolationTargetFPS")
.Options(CheckboxOptions().Tooltip("Enables Debug Mode."));
AddWidget(path, "Interpolation Target FPS", WIDGET_CVAR_SLIDER_INT)
.CVar("gInterpolationTargetFPS")
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger("gModifyInterpolationTargetFPS", 0); })
.Options(IntSliderOptions()
.Tooltip("Sets the target FPS for interpolation. When Modify Interpolation Target FPS are enable")
.Min(15)
.Max(360)
.DefaultValue(60));
AddWidget(path, "Render Collision", WIDGET_CVAR_CHECKBOX)
.CVar("gRenderCollisionMesh")
.Options(CheckboxOptions().Tooltip("Renders the collision mesh instead of the course mesh"));
@@ -431,7 +447,8 @@ void PortMenu::AddDevTools() {
AddSidebarEntry("Developer", "Stats", 1);
AddWidget(path, "Popout Stats", WIDGET_WINDOW_BUTTON)
.CVar("gStatsEnabled")
.Options(ButtonOptions().Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"))
.Options(ButtonOptions().Tooltip(
"Shows the stats window, with your FPS and frametimes, and the OS you're playing on"))
.WindowName("Stats");
path = { "Developer", "Console", SECTION_COLUMN_1 };
@@ -447,9 +464,9 @@ PortMenu::PortMenu(const std::string& consoleVariable, const std::string& name)
: Menu(consoleVariable, name, 0, UIWidgets::Colors::LightBlue) {
}
//bool CheckNetworkConnected(disabledInfo& info) {
// return gNetwork.isConnected;
//}
// bool CheckNetworkConnected(disabledInfo& info) {
// return gNetwork.isConnected;
// }
void PortMenu::InitElement() {
Ship::Menu::InitElement();
@@ -533,4 +550,4 @@ void PortMenu::Draw() {
void PortMenu::DrawElement() {
Ship::Menu::DrawElement();
}
} // namespace BenGui
} // namespace GameUI
+4 -5
View File
@@ -767,7 +767,8 @@ void setup_camera(Camera* camera, s32 playerId, s32 cameraId, struct UnkStruct_8
}
// Setup perspective (camera movement)
FrameInterpolation_RecordOpenChild("camera", (FrameInterpolation_GetCameraEpoch() | (((playerId | cameraId) << 8))));
FrameInterpolation_RecordOpenChild("camera",
(FrameInterpolation_GetCameraEpoch() | (((playerId | cameraId) << 8))));
guPerspective(&gGfxPool->mtxPersp[cameraId], &perspNorm, gCameraZoom[cameraId], gScreenAspect,
CM_GetProps()->NearPersp, CM_GetProps()->FarPersp, 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm);
@@ -776,19 +777,17 @@ void setup_camera(Camera* camera, s32 playerId, s32 cameraId, struct UnkStruct_8
// Setup lookAt (camera rotation)
guLookAt(&gGfxPool->mtxLookAt[cameraId], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0],
camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[cameraId]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
FrameInterpolation_RecordCloseChild();
}
extern s32 D_func_800652D4_counter;
void render_screens(s32 mode, s32 cameraId, s32 playerId) {
Mat4 matrix;
s32 screenId = 0;
s32 screenMode = SCREEN_MODE_1P;
D_func_800652D4_counter = 0;
switch (mode) {
case RENDER_SCREEN_MODE_1P_PLAYER_ONE:
@@ -867,7 +866,7 @@ D_func_800652D4_counter = 0;
// Setup camera perspective and lookAt
setup_camera(camera, playerId, cameraId, screen);
// Create a matrix for the track and game objects
FrameInterpolation_RecordOpenChild("track", (playerId | cameraId) << 8);
Mat4 trackMatrix;
+1 -7
View File
@@ -2090,8 +2090,6 @@ void init_smoke_particles(s32 arg0) {
}
}
void init_object_leaf_particle(s32 objectIndex, Vec3f arg1, s32 num) {
UNUSED s32 stackPadding1;
UNUSED u16 stackPadding0;
@@ -2611,7 +2609,6 @@ void func_80078C70(s32 arg0) {
}
}
void func_8007ABFC(s32 playerId, bool arg1) {
s32 itemWindow;
@@ -3458,7 +3455,7 @@ void func_8007BB9C(s32 arg0) {
}
void wrapper_update_boos(void) {
//update_boos();
// update_boos();
}
// Updates the display status on an object based on its relative direction to the camera
@@ -3486,7 +3483,6 @@ void func_8007C420(s32 objectIndex, Player* player, Camera* camera) {
func_8007C360(objectIndex, camera);
}
void func_8007CE0C(s32 objectIndex) {
Object* object;
@@ -3883,8 +3879,6 @@ void func_800842C8(void) {
}
}
void func_80085BB4(s32 objectIndex) {
gObjectList[objectIndex].sizeScaling = 8.0f;
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);