mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Run clang-format
This commit is contained in:
+4
-4
@@ -166,10 +166,10 @@ GameEngine::GameEngine() : dictionary(nullptr) {
|
||||
static_cast<uint32_t>(SM64::ResourceType::SDialog), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SM64::DictionaryFactoryV0>(), RESOURCE_FORMAT_BINARY, "Dictionary",
|
||||
static_cast<uint32_t>(SM64::ResourceType::Dictionary), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY,
|
||||
"Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(),
|
||||
|
||||
@@ -570,9 +570,8 @@ void process_cmd_node_generated() {
|
||||
GraphNodeFunc func = GetFunctionByAddr(addr, "NODE_ASM");
|
||||
|
||||
CALL_CANCELLABLE_EVENT(GeoLayoutCallASM, &func, ¶m) {
|
||||
GraphNodeGenerated* graphNode =
|
||||
init_graph_node_generated(gGraphNodePool, nullptr, func, // asm function
|
||||
param); // parameter
|
||||
GraphNodeGenerated* graphNode = init_graph_node_generated(gGraphNodePool, nullptr, func, // asm function
|
||||
param); // parameter
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ ResourceFactoryBinaryAssetArrayV0::ReadResource(std::shared_ptr<Ship::File> file
|
||||
auto count = reader->ReadUInt32();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
auto asset = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(reader->ReadUInt64());
|
||||
if(asset != nullptr) {
|
||||
if (asset != nullptr) {
|
||||
auto data = asset->GetInitData();
|
||||
if(data->Type == (uint32_t) Fast::ResourceType::Texture) {
|
||||
array->mPaths.push_back("__OTR__"+data->Path);
|
||||
if (data->Type == (uint32_t)Fast::ResourceType::Texture) {
|
||||
array->mPaths.push_back("__OTR__" + data->Path);
|
||||
array->mPtrs.push_back(reinterpret_cast<uintptr_t>(array->mPaths.back().c_str()));
|
||||
} else {
|
||||
array->mPtrs.push_back(reinterpret_cast<uintptr_t>(asset->GetRawPointer()));
|
||||
|
||||
@@ -8,20 +8,18 @@
|
||||
|
||||
namespace MK64 {
|
||||
std::unordered_map<Fast::TextureType, float> TexturePixelMultipliers = {
|
||||
{ Fast::TextureType::RGBA32bpp, 4.0f },
|
||||
{ Fast::TextureType::RGBA16bpp, 2.0f },
|
||||
{ Fast::TextureType::Palette4bpp, 0.5f },
|
||||
{ Fast::TextureType::Palette8bpp, 1.0f },
|
||||
{ Fast::TextureType::Grayscale4bpp, 0.5f },
|
||||
{ Fast::TextureType::Grayscale8bpp, 1.0f },
|
||||
{ Fast::TextureType::GrayscaleAlpha4bpp, 0.5f },
|
||||
{ Fast::TextureType::GrayscaleAlpha8bpp, 1.0f },
|
||||
{ Fast::TextureType::RGBA32bpp, 4.0f }, { Fast::TextureType::RGBA16bpp, 2.0f },
|
||||
{ Fast::TextureType::Palette4bpp, 0.5f }, { Fast::TextureType::Palette8bpp, 1.0f },
|
||||
{ Fast::TextureType::Grayscale4bpp, 0.5f }, { Fast::TextureType::Grayscale8bpp, 1.0f },
|
||||
{ Fast::TextureType::GrayscaleAlpha4bpp, 0.5f }, { Fast::TextureType::GrayscaleAlpha8bpp, 1.0f },
|
||||
{ Fast::TextureType::GrayscaleAlpha16bpp, 2.0f },
|
||||
};
|
||||
|
||||
std::shared_ptr<Ship::IResource> loadPngTexture(std::shared_ptr<Ship::File> filePng, std::shared_ptr<Ship::ResourceInitData> initData) {
|
||||
std::shared_ptr<Ship::IResource> loadPngTexture(std::shared_ptr<Ship::File> filePng,
|
||||
std::shared_ptr<Ship::ResourceInitData> initData) {
|
||||
auto texture = std::make_shared<Fast::Texture>(initData);
|
||||
const auto res = std::static_pointer_cast<Fast::Texture>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(initData->Path, true));
|
||||
const auto res = std::static_pointer_cast<Fast::Texture>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(initData->Path, true));
|
||||
|
||||
int height, width = 0;
|
||||
texture->ImageData = stbi_load_from_memory((const stbi_uc*)filePng->Buffer.get()->data(),
|
||||
@@ -31,8 +29,9 @@ std::shared_ptr<Ship::IResource> loadPngTexture(std::shared_ptr<Ship::File> file
|
||||
texture->Type = Fast::TextureType::RGBA32bpp;
|
||||
texture->ImageDataSize = texture->Width * texture->Height * 4;
|
||||
texture->Flags = TEX_FLAG_LOAD_AS_IMG;
|
||||
if(res != nullptr) {
|
||||
texture->HByteScale = (res->Width / texture->Width) * (TexturePixelMultipliers[texture->Type] / TexturePixelMultipliers[res->Type]);
|
||||
if (res != nullptr) {
|
||||
texture->HByteScale = (res->Width / texture->Width) *
|
||||
(TexturePixelMultipliers[texture->Type] / TexturePixelMultipliers[res->Type]);
|
||||
texture->VPixelScale = res->Height / texture->Height;
|
||||
} else {
|
||||
texture->VPixelScale = 1.0f;
|
||||
@@ -41,18 +40,17 @@ std::shared_ptr<Ship::IResource> loadPngTexture(std::shared_ptr<Ship::File> file
|
||||
return texture;
|
||||
}
|
||||
|
||||
std::vector<std::string> extension = {".png", ".PNG", ".jpg", ".JPG", ".jpeg", ".JPEG", ".bmp", ".BMP"};
|
||||
std::vector<std::string> extension = { ".png", ".PNG", ".jpg", ".JPG", ".jpeg", ".JPEG", ".bmp", ".BMP" };
|
||||
|
||||
std::shared_ptr<Ship::IResource>
|
||||
ResourceFactoryBinaryTextureV0::ReadResource(std::shared_ptr<Ship::File> file,
|
||||
std::shared_ptr<Ship::ResourceInitData> initData) {
|
||||
std::shared_ptr<Ship::ResourceInitData> initData) {
|
||||
if (!FileHasValidFormatAndReader(file, initData)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (const auto& ext : extension) {
|
||||
auto filePng = Ship::Context::GetInstance()->GetResourceManager()->LoadFileProcess(
|
||||
initData->Path + ext);
|
||||
auto filePng = Ship::Context::GetInstance()->GetResourceManager()->LoadFileProcess(initData->Path + ext);
|
||||
|
||||
if (filePng != nullptr) {
|
||||
return loadPngTexture(filePng, initData);
|
||||
@@ -83,7 +81,7 @@ ResourceFactoryBinaryTextureV1::ReadResource(std::shared_ptr<Ship::File> file,
|
||||
for (const auto& ext : extension) {
|
||||
std::shared_ptr<Ship::File> texture;
|
||||
|
||||
if(initData->Path.find(ext) != std::string::npos) {
|
||||
if (initData->Path.find(ext) != std::string::npos) {
|
||||
texture = Ship::Context::GetInstance()->GetResourceManager()->LoadFileProcess(initData->Path);
|
||||
} else {
|
||||
texture = Ship::Context::GetInstance()->GetResourceManager()->LoadFileProcess(initData->Path + ext);
|
||||
@@ -110,4 +108,4 @@ ResourceFactoryBinaryTextureV1::ReadResource(std::shared_ptr<Ship::File> file,
|
||||
|
||||
return texture;
|
||||
}
|
||||
} // namespace Fast
|
||||
} // namespace MK64
|
||||
@@ -793,8 +793,7 @@ void FrameInterpolation_RecordMatrixTranslate(Mat4* matrix, Vec3f b) {
|
||||
append(Op::MatrixTranslate).matrix_translate = { matrix, *((Vec3fInterp*)b) };
|
||||
}
|
||||
|
||||
void FrameInterpolation_RecordOrtho(Mtx* m, f32 left, f32 right, f32 bottom, f32 oTop, f32 oNear, f32 oFar,
|
||||
f32 scale) {
|
||||
void FrameInterpolation_RecordOrtho(Mtx* m, f32 left, f32 right, f32 bottom, f32 oTop, f32 oNear, f32 oFar, f32 scale) {
|
||||
if (!check_if_recording()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+101
-104
@@ -211,27 +211,20 @@ static const LevelSelectEntry entries[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const char* ttcSpeeds[] = {
|
||||
"Slow",
|
||||
"Fast",
|
||||
"Random",
|
||||
"Stopped"
|
||||
};
|
||||
static const char* ttcSpeeds[] = { "Slow", "Fast", "Random", "Stopped" };
|
||||
|
||||
static const char* thiSizes[] = {
|
||||
"Tiny", "Huge"
|
||||
};
|
||||
static const char* thiSizes[] = { "Tiny", "Huge" };
|
||||
|
||||
extern "C" void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
|
||||
|
||||
s32 BetterLevelSelect_UpdateArea(s16 a, s32 b) {
|
||||
if(self.areaChanged && self.currentAreaIndex > 0) {
|
||||
if (self.areaChanged && self.currentAreaIndex > 0) {
|
||||
LevelSelectEntry entry = entries[self.currentLevelIndex];
|
||||
LevelArea area = entry.areas[self.currentAreaIndex - 1];
|
||||
change_area(area.areaId);
|
||||
ObjectWarpNode* warpNode = area_get_warp_node(area.warpId);
|
||||
initiate_warp(warpNode->node.destLevel & 0x7F, warpNode->node.destArea,
|
||||
warpNode->node.destNode, sDelayedWarpArg);
|
||||
initiate_warp(warpNode->node.destLevel & 0x7F, warpNode->node.destArea, warpNode->node.destNode,
|
||||
sDelayedWarpArg);
|
||||
level_set_transition(2, NULL);
|
||||
self.areaChanged = false;
|
||||
}
|
||||
@@ -240,12 +233,12 @@ s32 BetterLevelSelect_UpdateArea(s16 a, s32 b) {
|
||||
}
|
||||
|
||||
s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
if(self.forceReload) {
|
||||
if (self.forceReload) {
|
||||
self.forceReload = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0){
|
||||
if (arg != LVL_INTRO_LEVEL_SELECT || CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0) {
|
||||
return lvl_intro_update(arg, b);
|
||||
}
|
||||
|
||||
@@ -253,7 +246,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
|
||||
gCurrSaveFileNum = 4;
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & BTN_A) {
|
||||
if (gPlayer1Controller->buttonPressed & BTN_A) {
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
|
||||
gCurrActNum = self.currentActIndex + 1;
|
||||
gDialogCourseActNum = gCurrActNum;
|
||||
@@ -261,12 +254,13 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
case LEVEL_TTC:
|
||||
gTTCSpeedSetting = self.ttcSpeedIndex;
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return entries[self.currentLevelIndex].levelId;
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonDown & U_JPAD) {
|
||||
if (gPlayer1Controller->buttonDown & U_JPAD) {
|
||||
if (self.lockUp) {
|
||||
self.timerUp = 0;
|
||||
}
|
||||
@@ -277,7 +271,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
}
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonDown & D_JPAD) {
|
||||
if (gPlayer1Controller->buttonDown & D_JPAD) {
|
||||
if (self.lockDown) {
|
||||
self.timerDown = 0;
|
||||
}
|
||||
@@ -287,51 +281,52 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
self.verticalInput = -self.update_rate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (self.verticalInput == 0) {
|
||||
self.verticalInputAccumulator = 0;
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & BTN_Z) {
|
||||
if (gPlayer1Controller->buttonPressed & BTN_Z) {
|
||||
self.currentActIndex--;
|
||||
if(self.currentActIndex < 0) {
|
||||
if (self.currentActIndex < 0) {
|
||||
self.currentActIndex = 5;
|
||||
}
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & BTN_R) {
|
||||
if (gPlayer1Controller->buttonPressed & BTN_R) {
|
||||
self.currentActIndex++;
|
||||
self.currentActIndex %= 6;
|
||||
}
|
||||
|
||||
switch (entries[self.currentLevelIndex].levelId) {
|
||||
case LEVEL_TTC: {
|
||||
if(gPlayer1Controller->buttonPressed & L_JPAD) {
|
||||
if (gPlayer1Controller->buttonPressed & L_JPAD) {
|
||||
self.ttcSpeedIndex--;
|
||||
if(self.ttcSpeedIndex < 0) {
|
||||
if (self.ttcSpeedIndex < 0) {
|
||||
self.ttcSpeedIndex = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & R_JPAD) {
|
||||
if (gPlayer1Controller->buttonPressed & R_JPAD) {
|
||||
self.ttcSpeedIndex++;
|
||||
self.ttcSpeedIndex %= 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & BTN_CLEFT) {
|
||||
if (gPlayer1Controller->buttonPressed & BTN_CLEFT) {
|
||||
self.currentAreaIndex--;
|
||||
if(self.currentAreaIndex < 0) {
|
||||
if (self.currentAreaIndex < 0) {
|
||||
self.currentAreaIndex = 0;
|
||||
}
|
||||
self.areaChanged = true;
|
||||
}
|
||||
|
||||
if(gPlayer1Controller->buttonPressed & BTN_CRIGHT) {
|
||||
if (gPlayer1Controller->buttonPressed & BTN_CRIGHT) {
|
||||
self.currentAreaIndex++;
|
||||
self.currentAreaIndex %= entries[self.currentLevelIndex].areas.size() + 1;
|
||||
self.areaChanged = true;
|
||||
@@ -339,7 +334,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
|
||||
self.verticalInputAccumulator += self.verticalInput;
|
||||
|
||||
if(self.verticalInputAccumulator < -7) {
|
||||
if (self.verticalInputAccumulator < -7) {
|
||||
self.verticalInput = 0;
|
||||
self.verticalInputAccumulator = 0;
|
||||
|
||||
@@ -355,7 +350,7 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
}
|
||||
}
|
||||
|
||||
if(self.verticalInputAccumulator > 7) {
|
||||
if (self.verticalInputAccumulator > 7) {
|
||||
self.verticalInput = 0;
|
||||
self.verticalInputAccumulator = 0;
|
||||
|
||||
@@ -379,25 +374,25 @@ s32 BetterLevelSelect_UpdateMenu(s16 arg, s32 b) {
|
||||
self.currentLevelIndex = (self.currentLevelIndex + count) % count;
|
||||
self.topDisplayedLevel = (self.topDisplayedLevel + count) % count;
|
||||
|
||||
if(self.timerUp != 0) {
|
||||
if (self.timerUp != 0) {
|
||||
self.timerUp--;
|
||||
}
|
||||
|
||||
if(self.timerUp == 0){
|
||||
if (self.timerUp == 0) {
|
||||
self.lockUp = false;
|
||||
}
|
||||
|
||||
if(self.timerDown != 0) {
|
||||
if (self.timerDown != 0) {
|
||||
self.timerDown--;
|
||||
}
|
||||
|
||||
if(self.timerDown == 0){
|
||||
if (self.timerDown == 0) {
|
||||
self.lockDown = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *context) {
|
||||
Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode* node, UNUSED void* context) {
|
||||
if (state != 1 || CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) != 1) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -409,73 +404,75 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
|
||||
gDPSetRenderMode(head++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
|
||||
gDPSetCycleType(head++, G_CYC_FILL);
|
||||
gDPSetFillColor(head++, 0x0001);
|
||||
gDPFillWideRectangle(head++,
|
||||
GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(0), BORDER_HEIGHT,
|
||||
GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(0) - 1, SCREEN_HEIGHT - BORDER_HEIGHT - 1);
|
||||
gDPFillWideRectangle(head++, GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(0), BORDER_HEIGHT,
|
||||
GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(0) - 1, SCREEN_HEIGHT - BORDER_HEIGHT - 1);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
|
||||
GfxPrint_Init(&printer);
|
||||
|
||||
GfxPrint_Open(&printer, head);
|
||||
GfxPrint_SetColor(&printer, 255, 255, 255, 255);
|
||||
GfxPrint_SetPos(&printer, 12, 2);
|
||||
GfxPrint_Printf(&printer, "Scene Selection");
|
||||
GfxPrint_SetColor(&printer, 255, 255, 255, 255);
|
||||
GfxPrint_SetPos(&printer, 12, 2);
|
||||
GfxPrint_Printf(&printer, "Scene Selection");
|
||||
|
||||
for(int i = 0; i < 20; i++) {
|
||||
int idx = (self.topDisplayedLevel + i + count) % count;
|
||||
LevelSelectEntry entry = entries[idx];
|
||||
GfxPrint_SetPos(&printer, 3, i + 4);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
int idx = (self.topDisplayedLevel + i + count) % count;
|
||||
LevelSelectEntry entry = entries[idx];
|
||||
GfxPrint_SetPos(&printer, 3, i + 4);
|
||||
|
||||
if(idx == self.currentLevelIndex) {
|
||||
GfxPrint_SetColor(&printer, 255, 100, 100, 255);
|
||||
} else {
|
||||
GfxPrint_SetColor(&printer, 175, 175, 175, 255);
|
||||
}
|
||||
|
||||
GfxPrint_Printf(&printer, "%3d %s", idx, language ? entry.japaneseName : entry.englishName);
|
||||
if (idx == self.currentLevelIndex) {
|
||||
GfxPrint_SetColor(&printer, 255, 100, 100, 255);
|
||||
} else {
|
||||
GfxPrint_SetColor(&printer, 175, 175, 175, 255);
|
||||
}
|
||||
|
||||
std::vector<const char*> acts = language ? entries[self.currentLevelIndex].actsJp : entries[self.currentLevelIndex].actsEn;
|
||||
GfxPrint_Printf(&printer, "%3d %s", idx, language ? entry.japaneseName : entry.englishName);
|
||||
}
|
||||
|
||||
if(!acts.empty()) {
|
||||
int y = 25;
|
||||
GfxPrint_SetPos(&printer, 2, y);
|
||||
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
|
||||
GfxPrint_Printf(&printer, "(Z/R) Act:");
|
||||
GfxPrint_SetColor(&printer, 200, 200, 50, 255);
|
||||
GfxPrint_Printf(&printer, "%s", acts[self.currentActIndex]);
|
||||
std::vector<const char*> acts =
|
||||
language ? entries[self.currentLevelIndex].actsJp : entries[self.currentLevelIndex].actsEn;
|
||||
|
||||
auto areas = entries[self.currentLevelIndex].areas;
|
||||
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);
|
||||
}
|
||||
if (!acts.empty()) {
|
||||
int y = 25;
|
||||
GfxPrint_SetPos(&printer, 2, y);
|
||||
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
|
||||
GfxPrint_Printf(&printer, "(Z/R) Act:");
|
||||
GfxPrint_SetColor(&printer, 200, 200, 50, 255);
|
||||
GfxPrint_Printf(&printer, "%s", acts[self.currentActIndex]);
|
||||
|
||||
auto areas = entries[self.currentLevelIndex].areas;
|
||||
if (entries[self.currentLevelIndex].levelId == LEVEL_THI) {
|
||||
y++;
|
||||
GfxPrint_SetPos(&printer, 2, y);
|
||||
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
|
||||
|
||||
switch (entries[self.currentLevelIndex].levelId) {
|
||||
// case LEVEL_WDW: {
|
||||
// GfxPrint_Printf(&printer, "Water Level:");
|
||||
// GfxPrint_SetColor(&printer, 55, 200, 50, 255);
|
||||
// GfxPrint_Printf(&printer, "%s", ttcSpeeds[self.ttcSpeedIndex]);
|
||||
// break;
|
||||
// }
|
||||
case LEVEL_TTC: {
|
||||
GfxPrint_Printf(&printer, "(Dpad L/R) Speed:");
|
||||
GfxPrint_SetColor(&printer, 55, 200, 50, 255);
|
||||
GfxPrint_Printf(&printer, "%s", ttcSpeeds[self.ttcSpeedIndex]);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
y++;
|
||||
GfxPrint_SetPos(&printer, 2, y);
|
||||
GfxPrint_SetColor(&printer, 100, 100, 100, 255);
|
||||
|
||||
switch (entries[self.currentLevelIndex].levelId) {
|
||||
// case LEVEL_WDW: {
|
||||
// GfxPrint_Printf(&printer, "Water Level:");
|
||||
// GfxPrint_SetColor(&printer, 55, 200, 50, 255);
|
||||
// GfxPrint_Printf(&printer, "%s", ttcSpeeds[self.ttcSpeedIndex]);
|
||||
// break;
|
||||
// }
|
||||
case LEVEL_TTC: {
|
||||
GfxPrint_Printf(&printer, "(Dpad L/R) Speed:");
|
||||
GfxPrint_SetColor(&printer, 55, 200, 50, 255);
|
||||
GfxPrint_Printf(&printer, "%s", ttcSpeeds[self.ttcSpeedIndex]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
head = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
gSPEndDisplayList(head);
|
||||
@@ -483,39 +480,39 @@ Gfx* BetterLevelSelect_DrawMenu(s32 state, struct GraphNode *node, UNUSED void *
|
||||
}
|
||||
|
||||
static const GeoLayout BetterLevelSelect_GeoWrapper[] = {
|
||||
GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2),
|
||||
GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_NODE_ORTHO(100),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(0, BetterLevelSelect_DrawMenu),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_ZBUFFER(0),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_NODE_ORTHO(100),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_ASM(0, BetterLevelSelect_DrawMenu),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_END(),
|
||||
};
|
||||
|
||||
static void Init() {
|
||||
REGISTER_LISTENER(LevelScriptBeginArea, EVENT_PRIORITY_NORMAL, [](IEvent* event) {
|
||||
LevelScriptBeginArea* ev = (LevelScriptBeginArea*) event;
|
||||
LevelScriptBeginArea* ev = (LevelScriptBeginArea*)event;
|
||||
|
||||
if (strcmp((char*) *ev->geoLayoutAddr, intro_geo_000414) != 0) {
|
||||
if (strcmp((char*)*ev->geoLayoutAddr, intro_geo_000414) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0){
|
||||
*ev->geoLayoutAddr = (void*) intro_geo_000414;
|
||||
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"), 1) == 0) {
|
||||
*ev->geoLayoutAddr = (void*)intro_geo_000414;
|
||||
} else {
|
||||
*ev->geoLayoutAddr = (void*) BetterLevelSelect_GeoWrapper;
|
||||
*ev->geoLayoutAddr = (void*)BetterLevelSelect_GeoWrapper;
|
||||
}
|
||||
});
|
||||
|
||||
REGISTER_LISTENER(LevelScriptCallLoop, EVENT_PRIORITY_NORMAL, [](IEvent* event) {
|
||||
LevelScriptCallLoop* ev = (LevelScriptCallLoop*) event;
|
||||
LevelScriptCallLoop* ev = (LevelScriptCallLoop*)event;
|
||||
|
||||
if(*ev->func == lvl_intro_update) {
|
||||
if(*ev->arg == LVL_INTRO_LEVEL_SELECT) {
|
||||
if (*ev->func == lvl_intro_update) {
|
||||
if (*ev->arg == LVL_INTRO_LEVEL_SELECT) {
|
||||
self.loaded = true;
|
||||
}
|
||||
*ev->func = BetterLevelSelect_UpdateMenu;
|
||||
@@ -524,7 +521,7 @@ static void Init() {
|
||||
|
||||
self.loaded = false;
|
||||
|
||||
if(*ev->func == lvl_init_or_update) {
|
||||
if (*ev->func == lvl_init_or_update) {
|
||||
*ev->func = BetterLevelSelect_UpdateArea;
|
||||
return;
|
||||
}
|
||||
@@ -532,7 +529,7 @@ static void Init() {
|
||||
}
|
||||
|
||||
void BetterLevelSelect_HandleReload() {
|
||||
if(!self.loaded){
|
||||
if (!self.loaded) {
|
||||
return;
|
||||
}
|
||||
self.forceReload = true;
|
||||
|
||||
@@ -22,8 +22,8 @@ bool sHasArchiveTexture = false;
|
||||
|
||||
// Checks if we have a gfx font as a resource in an archive, which needs to be rendered differently
|
||||
bool GfxPrint_HasArchiveTexture() {
|
||||
// return ResourceMgr_FileExists(rGfxPrintFontData) ||
|
||||
// (ResourceMgr_IsAltAssetsEnabled() && ResourceMgr_FileExists(rGfxPrintFontDataAlt));
|
||||
// return ResourceMgr_FileExists(rGfxPrintFontData) ||
|
||||
// (ResourceMgr_IsAltAssetsEnabled() && ResourceMgr_FileExists(rGfxPrintFontDataAlt));
|
||||
return false;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
@@ -19,7 +19,8 @@ static const std::unordered_map<int32_t, const char*> debugInfoPages = {
|
||||
};
|
||||
|
||||
static const std::unordered_map<int32_t, const char*> language = {
|
||||
{ 0, "English" }, { 1, "Japanese" },
|
||||
{ 0, "English" },
|
||||
{ 1, "Japanese" },
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -66,19 +67,16 @@ void GhostshipMenu::AddMenuDevTools() {
|
||||
.CVar(CVAR_DEVELOPER_TOOLS("BetterLevelSelect"))
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Tweaks to the level select screen, like naming and allowing C-buttons to be used."))
|
||||
.Callback([](WidgetInfo& info) {
|
||||
BetterLevelSelect_HandleReload();
|
||||
})
|
||||
.Callback([](WidgetInfo& info) { BetterLevelSelect_HandleReload(); })
|
||||
.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)); });
|
||||
.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"));
|
||||
|
||||
@@ -48,11 +48,11 @@ void GhostshipMenu::AddMenuEnhancements() {
|
||||
.CVar("gHUDAspectRatio.Selection")
|
||||
.RaceDisable(false)
|
||||
.Options(ComboboxOptions()
|
||||
.ComboMap(hudAspects)
|
||||
.Tooltip("Changes the aspect ratio of the HUD elements.")
|
||||
.DefaultIndex(0)
|
||||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far))
|
||||
.ComboMap(hudAspects)
|
||||
.Tooltip("Changes the aspect ratio of the HUD elements.")
|
||||
.DefaultIndex(0)
|
||||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far))
|
||||
.Callback([](WidgetInfo& info) {
|
||||
CVarSetInteger("gHUDAspectRatio.Enabled", 1);
|
||||
switch (CVarGetInteger("gHUDAspectRatio.Selection", 0)) {
|
||||
@@ -62,10 +62,10 @@ void GhostshipMenu::AddMenuEnhancements() {
|
||||
CVarSetInteger("gHUDAspectRatio.Y", 0);
|
||||
break;
|
||||
case 1:
|
||||
if (CVarGetInteger("gHUDAspectRatio.X", 0) <= 0){
|
||||
if (CVarGetInteger("gHUDAspectRatio.X", 0) <= 0) {
|
||||
CVarSetInteger("gHUDAspectRatio.X", 1);
|
||||
}
|
||||
if (CVarGetInteger("gHUDAspectRatio.Y", 0) <= 0){
|
||||
if (CVarGetInteger("gHUDAspectRatio.Y", 0) <= 0) {
|
||||
CVarSetInteger("gHUDAspectRatio.Y", 1);
|
||||
}
|
||||
break;
|
||||
@@ -89,9 +89,9 @@ void GhostshipMenu::AddMenuEnhancements() {
|
||||
CVarSetInteger("gHUDAspectRatio.X", 21);
|
||||
CVarSetInteger("gHUDAspectRatio.Y", 9);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
AddWidget(path, "Custom HUD Aspect Ratio X", WIDGET_CVAR_SLIDER_INT)
|
||||
.CVar("gHUDAspectRatio.X")
|
||||
.RaceDisable(false)
|
||||
|
||||
Reference in New Issue
Block a user