Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ modding/
*.log
node_modules
/src/port/build.c
/properties.h
14 changes: 0 additions & 14 deletions properties.h

This file was deleted.

55 changes: 29 additions & 26 deletions src/port/mods/BetterLevelSelect.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "BetterLevelSelect.h"

#include "sm64.h"
#include "port/ui/cvar_prefixes.h"
#include "game/area.h"
#include "audio/external.h"
#include "game/game_init.h"
Expand Down Expand Up @@ -244,7 +245,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
return 1;
}

if(arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger("gDeveloperTools.BetterLevelSelect", 1) == 0){
if(arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0){
return lvl_intro_update(arg, b);
}

Expand All @@ -270,28 +271,26 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
self.timerUp = 0;
}
if (self.timerUp == 0) {
self.timerUp = 20;
self.timerUp = 40;
self.lockUp = true;
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource);
self.verticalInput = self.update_rate;
}
}

if(gPlayer1Controller->buttonDown & U_JPAD && self.timerUp == 0) {
self.verticalInput = self.update_rate * 3;
}

if(gPlayer1Controller->buttonDown & D_JPAD) {
if (self.lockDown) {
self.timerDown = 0;
}
if (self.timerDown == 0) {
self.timerDown = 20;
self.timerDown = 40;
self.lockDown = true;
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource);
self.verticalInput = -self.update_rate;
}
}

if (self.verticalInput == 0) {
self.verticalInputAccumulator = 0;
}

if(gPlayer1Controller->buttonPressed & BTN_Z) {
self.currentActIndex--;
Expand Down Expand Up @@ -338,10 +337,6 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
self.areaChanged = true;
}

if(gPlayer1Controller->buttonDown & D_JPAD && self.timerDown == 0) {
self.verticalInput = -self.update_rate * 3;
}

self.verticalInputAccumulator += self.verticalInput;

if(self.verticalInputAccumulator < -7) {
Expand All @@ -352,6 +347,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
self.currentActIndex = 0;
self.currentLevelIndex++;
self.currentLevelIndex = (self.currentLevelIndex + count) % count;
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource);

if (self.currentLevelIndex == ((self.topDisplayedLevel + count + 19) % count)) {
self.topDisplayedLevel++;
Expand All @@ -372,6 +368,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
self.currentActIndex = 0;
self.currentLevelIndex--;
self.currentLevelIndex = (self.currentLevelIndex + count) % count;
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource);

if (self.currentLevelIndex == ((self.topDisplayedLevel + count) % count)) {
self.topDisplayedLevel--;
Expand Down Expand Up @@ -401,10 +398,11 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
}

Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *context) {
if(state != 1 || CVarGetInteger("gDeveloperTools.BetterLevelSelect", 1) != 1) {
if (state != 1 || CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) != 1) {
return NULL;
}

int language = CVarGetInteger(CVAR_DEVELOPER_TOOLS("BLSLanguage"), ROM_JP);
int32_t count = ARRAY_COUNT(entries);
GfxPrint printer;
Gfx* head = &self.pool[0];
Expand Down Expand Up @@ -434,26 +432,31 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
GfxPrint_SetColor(&printer, 175, 175, 175, 255);
}

GfxPrint_Printf(&printer, "%3d %s", idx, ROM_JP ? entry.japaneseName : entry.englishName);
GfxPrint_Printf(&printer, "%3d %s", idx, language ? entry.japaneseName : entry.englishName);
}

std::vector<const char*> acts = ROM_JP ? entries[self.currentLevelIndex].actsJp : entries[self.currentLevelIndex].actsEn;
std::vector<const char*> acts = language ? entries[self.currentLevelIndex].actsJp : entries[self.currentLevelIndex].actsEn;

if(!acts.empty()) {
GfxPrint_SetPos(&printer, 2, 25);
int y = 25;
GfxPrint_SetPos(&printer, 2, y);
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
GfxPrint_Printf(&printer, "(Z/R)Act:");
GfxPrint_Printf(&printer, "(Z/R) Act:");
GfxPrint_SetColor(&printer, 200, 200, 50, 255);
GfxPrint_Printf(&printer, "%s", acts[self.currentActIndex]);

GfxPrint_SetPos(&printer, 2, 26);
auto areas = entries[self.currentLevelIndex].areas;
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
GfxPrint_Printf(&printer, "Area:");
GfxPrint_SetColor(&printer, 200, 50, 50, 255);
GfxPrint_Printf(&printer, "%s", self.currentAreaIndex == 0 ? "Default" : areas[self.currentAreaIndex - 1].name);
if (entries[self.currentLevelIndex].levelId == LEVEL_THI) {
y++;
GfxPrint_SetPos(&printer, 2, y);
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
GfxPrint_Printf(&printer, "(C L/R) Area:");
GfxPrint_SetColor(&printer, 200, 50, 50, 255);
GfxPrint_Printf(&printer, "%s", self.currentAreaIndex == 0 ? "Default" : areas[self.currentAreaIndex - 1].name);
}

GfxPrint_SetPos(&printer, 2, 27);
y++;
GfxPrint_SetPos(&printer, 2, y);
GfxPrint_SetColor(&printer, 100, 100, 100, 255);

switch (entries[self.currentLevelIndex].levelId) {
Expand All @@ -464,7 +467,7 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
// break;
// }
case LEVEL_TTC: {
GfxPrint_Printf(&printer, "Speed:");
GfxPrint_Printf(&printer, "(Dpad L/R) Speed:");
GfxPrint_SetColor(&printer, 55, 200, 50, 255);
GfxPrint_Printf(&printer, "%s", ttcSpeeds[self.ttcSpeedIndex]);
break;
Expand Down Expand Up @@ -501,7 +504,7 @@ static void Init() {
return;
}

if(CVarGetInteger("gDeveloperTools.BetterLevelSelect", 1) == 0){
if(CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0){
*ev->geoLayoutAddr = (void*) intro_geo_000414;
} else {
*ev->geoLayoutAddr = (void*) BetterLevelSelect_GeoWrapper;
Expand Down
2 changes: 0 additions & 2 deletions src/port/ui/GhostshipGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <spdlog/spdlog.h>
#include <imgui.h>
#include <imgui_internal.h>
#include "UIWidgets.hpp"

#ifdef __APPLE__
#include <fast/backends/gfx_metal.h>
Expand All @@ -14,7 +13,6 @@
#endif

#include "Notification.h"
#include "GhostshipMenu.h"
#include "GhostshipInputEditorWindow.h"
#include "SaveEditor.h"

Expand Down
2 changes: 2 additions & 0 deletions src/port/ui/GhostshipGui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
#include "UIWidgets.hpp"
#include "InputViewer.h"
#include "GhostshipModals.h"
#include "GhostshipMenu.h"

namespace GhostshipGui {
void SetupHooks();
void SetupGuiElements();
void Draw();
void Destroy();
UIWidgets::Colors GetMenuThemeColor();
extern std::shared_ptr<GhostshipMenu> mGhostshipMenu;
} // namespace GhostshipGui

#define THEME_COLOR GhostshipGui::GetMenuThemeColor()
12 changes: 12 additions & 0 deletions src/port/ui/GhostshipMenuDevTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ static const std::unordered_map<int32_t, const char*> debugInfoPages = {
{ DEBUG_PAGE_EFFECTINFO, "Effect" }, { DEBUG_PAGE_ENEMYINFO, "Enemy" },
};

static const std::unordered_map<int32_t, const char*> language = {
{ 0, "English" }, { 1, "Japanese" },
};

#ifdef _DEBUG
DebugLogOption defaultLogLevel = DEBUG_LOG_TRACE;
#else
Expand Down Expand Up @@ -67,6 +71,14 @@ void GhostshipMenu::AddMenuDevTools() {
})
.PreFunc(
[](WidgetInfo& info) { info.options->Disabled(!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugMode"), 0)); });
AddWidget(path, "Level Select Language", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_DEVELOPER_TOOLS("BLSLanguage"))
.Options(ComboboxOptions()
.Tooltip("Language used in Better Level Select")
.ComboMap(language))
.PreFunc(
[](WidgetInfo& info) { info.options->Disabled(!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugMode"), 0) ||
!CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 0)); });
AddWidget(path, "Draw Debug Info", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_DEVELOPER_TOOLS("DrawDebugInfo"))
.Options(CheckboxOptions().Tooltip("Draws Debug Related Information"));
Expand Down
Loading