mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-02 16:23:57 +03:00
Prevent loading checkpoints in the wrong level
This commit is contained in:
parent
9506a4297b
commit
eb44ba0f04
@ -4678,7 +4678,7 @@ void Player_Setup(Player* playerx) {
|
|||||||
gDisplayedHitCount = gHitCount;
|
gDisplayedHitCount = gHitCount;
|
||||||
D_hud_80161730 = 0;
|
D_hud_80161730 = 0;
|
||||||
|
|
||||||
if (CVarGetInteger("gCheckpoint.Set", 0)) {
|
if (CVarGetInteger("gCheckpoint.Set", 0) && CVarGetInteger("gCheckpoint.gSavedLevel", -1) == gCurrentLevel) {
|
||||||
gSavedGroundSurface = CVarGetInteger("gCheckpoint.gSavedGroundSurface", gSavedGroundSurface);
|
gSavedGroundSurface = CVarGetInteger("gCheckpoint.gSavedGroundSurface", gSavedGroundSurface);
|
||||||
gSavedPathProgress = CVarGetFloat("gCheckpoint.gSavedPathProgress", gSavedPathProgress);
|
gSavedPathProgress = CVarGetFloat("gCheckpoint.gSavedPathProgress", gSavedPathProgress);
|
||||||
gSavedObjectLoadIndex = CVarGetInteger("gCheckpoint.gSavedObjectLoadIndex", gSavedObjectLoadIndex);
|
gSavedObjectLoadIndex = CVarGetInteger("gCheckpoint.gSavedObjectLoadIndex", gSavedObjectLoadIndex);
|
||||||
|
@ -599,7 +599,17 @@ void DrawDebugMenu() {
|
|||||||
.tooltip = "Jump to credits at the main menu"
|
.tooltip = "Jump to credits at the main menu"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CVarGetInteger("gCheckpoint.Set", 0)) {
|
if (CVarGetInteger("gCheckpoint.Set", 0)) {
|
||||||
|
LevelId savedLevel = CVarGetInteger("gCheckpoint.gSavedLevel", -1);
|
||||||
|
std::string CheckpointLabel = "Checkpoint is at ";
|
||||||
|
if (savedLevel == 77){
|
||||||
|
CheckpointLabel += "Warp Zone";
|
||||||
|
} else if (savedLevel < 0 || savedLevel >= sizeof(GameUI::LevelNameLookup)/sizeof(GameUI::LevelNameLookup[0])) {
|
||||||
|
CheckpointLabel += "Unknown (out of bounds)";
|
||||||
|
} else {
|
||||||
|
CheckpointLabel += GameUI::LevelNameLookup[CVarGetInteger("gCheckpoint.gSavedLevel", -1)];
|
||||||
|
}
|
||||||
|
ImGui::Text(CheckpointLabel.c_str());
|
||||||
if (UIWidgets::Button("Clear Checkpoint")) {
|
if (UIWidgets::Button("Clear Checkpoint")) {
|
||||||
CVarClear("gCheckpoint.Set");
|
CVarClear("gCheckpoint.Set");
|
||||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||||
@ -607,6 +617,7 @@ void DrawDebugMenu() {
|
|||||||
} else if (gPlayer != NULL) {
|
} else if (gPlayer != NULL) {
|
||||||
if (UIWidgets::Button("Set Checkpoint")) {
|
if (UIWidgets::Button("Set Checkpoint")) {
|
||||||
CVarSetInteger("gCheckpoint.Set", 1);
|
CVarSetInteger("gCheckpoint.Set", 1);
|
||||||
|
CVarSetInteger("gCheckpoint.gSavedLevel", gCurrentLevel);
|
||||||
CVarSetInteger("gCheckpoint.gSavedPathProgress", gGroundSurface);
|
CVarSetInteger("gCheckpoint.gSavedPathProgress", gGroundSurface);
|
||||||
CVarSetFloat("gCheckpoint.gSavedPathProgress", (-gPlayer->pos.z) - 250.0f);
|
CVarSetFloat("gCheckpoint.gSavedPathProgress", (-gPlayer->pos.z) - 250.0f);
|
||||||
CVarSetInteger("gCheckpoint.gSavedObjectLoadIndex", gObjectLoadIndex);
|
CVarSetInteger("gCheckpoint.gSavedObjectLoadIndex", gObjectLoadIndex);
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
#include <libultraship/libultraship.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
namespace GameUI {
|
namespace GameUI {
|
||||||
|
const std::string LevelNameLookup[] =
|
||||||
|
{
|
||||||
|
"Corneria", "Meteo", "Sector X", "Area 6",
|
||||||
|
"Unknown", "Sector Y", "Venom 1", "Solar",
|
||||||
|
"Zoness", "Andross", "Training", "Macbeth",
|
||||||
|
"Titania", "Aquas", "Fortuna", "Unknown",
|
||||||
|
"Katina", "Bolse", "Sector Z", "Venom 2",
|
||||||
|
"Versus"
|
||||||
|
};
|
||||||
void SetupGuiElements();
|
void SetupGuiElements();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user