Skip to content
Open
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
3 changes: 3 additions & 0 deletions assets/data/lang/sc/gui.en_US.json.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"apConnection": "Connection Info",
"apTextClient": "AP Text Client",
"apGameInfoMenu": "AP Game Info"
},
"new-game": {
"modifyOptions": "Modify Options"
}
},
"title-screen": {
Expand Down
7 changes: 6 additions & 1 deletion src/patches/gui-misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ export function patch(plugin: MwRandomizer) {
this.buttongroup.addFocusGui(this.connect, 0, this.fields.length);

this.disconnect = new sc.ButtonGui("Disconnect", sc.BUTTON_MENU_WIDTH);
this.disconnect.onButtonPress = () => { sc.multiworld.disconnect() };
this.disconnect.onButtonPress = () => {
sc.multiworld.disconnect();
if (!sc.model.isGame()) {
sc.multiworld.unsetVars();
}
};
this.disconnect.setPos(sc.BUTTON_MENU_WIDTH + this.hSpacer);
this.disconnect.data = ig.lang.get("sc.gui.mw.connection-menu.disconnect");
this.buttongroup.addFocusGui(this.disconnect, 1, this.fields.length);
Expand Down
2 changes: 1 addition & 1 deletion src/patches/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function patch(plugin: MwRandomizer) {
newGameButton.onButtonPress = () => {
sc.menu.setDirectMode(true, sc.MENU_SUBMENU.AP_TEXT_CLIENT);
sc.menu.exitCallback = () => {
if (sc.multiworld.client.authenticated) {
if (sc.multiworld.client.authenticated && sc.newgame.active) {
// unset New Game Plus to get the behavior I want from the callback.
let oldNGP = this._newGamePlus;
this._newGamePlus = false;
Expand Down
40 changes: 38 additions & 2 deletions src/patches/new-game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ declare global {
apGui: sc.NewGameModeDialogButton;
oldCallback: this["callback"];
}

interface NewGameToggleSet {
setName: string;
}
}
}

export function patch(plugin: MwRandomizer) {
sc.TrophyManager.inject({
getTotalPoints() {
return 1e9;
}
});

sc.NewGamePlusModel.inject({
options: { "rhombus-start": true },
onReset() {
Expand All @@ -23,11 +33,34 @@ export function patch(plugin: MwRandomizer) {
sc.NewGamePlusMenu.inject({
init() {
this.parent();
this.button.setActive(sc.newgame.hasAnyOptions());
if (!sc.menu.newGameViewMode && sc.model.isGame()) {
// this.button.setActive(sc.newgame.hasAnyOptions());
const oldWidth = this.button.hook.size.x;
this.button.setText(
"\\i[help2]" + ig.lang.get("sc.gui.menu.new-game.modifyOptions")
)
const newWidth = this.button.hook.size.x;
this.button.hook.pos.x -= (newWidth - oldWidth) / 2;
this.button.setActive(true);
}
},

onBeginButtonPressed() {
if (!sc.menu.newGameViewMode && sc.model.isGame()) {
sc.menu.popBackCallback();
sc.menu.popMenu();
} else {
this.parent();
}
},
});

sc.NewGameToggleSet.inject({
init(set, list, yOffset, listIndex, counter) {
this.parent(set, list, yOffset, listIndex, counter);
this.setName = set;
},

updateActiveState(
totalPoints: number,
newGameCost: number,
Expand All @@ -36,7 +69,10 @@ export function patch(plugin: MwRandomizer) {
this.parent(totalPoints, newGameCost, remainingCredits);

for (const button of this.buttons) {
if (button.data.id == "rhombus-start") {
if (
button.data.id == "rhombus-start" ||
this.setName == "carry-over" && !sc.menu.newGameViewMode && sc.model.isGame()
) {
button.setActive(false);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/patches/text-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export function patch(plugin: MwRandomizer) {
}

this.buttons.gameInfo.setActive(!!sc.multiworld.options);
this.buttons.newGamePlus.setActive(!!sc.multiworld.options);

this.addObservers();

Expand Down