add 2 more launch types

This commit is contained in:
2025-01-11 21:08:21 -06:00
committed by Celtic Minstrel
parent 3db902ea37
commit 9739ab2f61
8 changed files with 91 additions and 24 deletions

View File

@@ -86,7 +86,10 @@ BEGIN
END
POPUP "&Scenario"
BEGIN
MENUITEM "Launch Scenario Here", IDM_SCEN_LAUNCH
MENUITEM "Launch From Here", IDM_SCEN_LAUNCH_HERE
MENUITEM "Launch From Start", IDM_SCEN_LAUNCH_START
MENUITEM "Launch From Town Entrance", IDM_SCEN_LAUNCH_ENTRANCE
MENUITEM SEPARATOR
MENUITEM "&Create New Town", IDM_SCEN_NEW_TOWN
MENUITEM "Resize Outdoors", IDM_SCEN_RESIZE_OUTDOORS
MENUITEM SEPARATOR

View File

@@ -343,7 +343,33 @@
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="142725491">
<reference key="NSMenu" ref="399390342"/>
<string key="NSTitle">Launch Scenario Here</string>
<string key="NSTitle">Launch From Here</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="142725492">
<reference key="NSMenu" ref="399390342"/>
<string key="NSTitle">Launch From Start</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="142725493">
<reference key="NSMenu" ref="399390342"/>
<string key="NSTitle">Launch From Town Entrance</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="610226443">
<reference key="NSMenu" ref="399390342"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>

View File

@@ -72,7 +72,9 @@
#define IDM_SCEN_RESIZE_OUTDOORS 167
#define IDM_SCEN_ADV_IMPORT_OUT 168
#define IDM_GRAYED_LABEL 169
#define IDM_SCEN_LAUNCH 170
#define IDM_SCEN_LAUNCH_HERE 170
#define IDM_SCEN_LAUNCH_START 171
#define IDM_SCEN_LAUNCH_ENTRANCE 172
// Next default values for new objects
//
@@ -81,6 +83,6 @@
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40014
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 171
#define _APS_NEXT_SYMED_VALUE 173
#endif
#endif

View File

@@ -460,8 +460,9 @@ static void handle_scenario_args() {
town_entrance = *scen_arg_town_entrance;
}else if(scen_arg_loc){
town_entrance = 9;
town_location = *scen_arg_loc;
}
force_town_enter(*scen_arg_town, *scen_arg_loc);
force_town_enter(*scen_arg_town, town_location);
start_town_mode(*scen_arg_town, town_entrance);
}else if(scen_arg_out_sec){
if(!party_in_memory || !univ.party.is_in_scenario() ||

View File

@@ -2,6 +2,7 @@
#include <cstdio>
#include <string>
#include <memory>
#include <vector>
#include <boost/filesystem/operations.hpp>
#include <boost/process/child.hpp>
#include <boost/process/io.hpp>
@@ -31,6 +32,7 @@
#include "tools/winutil.hpp"
#include "tools/cursors.hpp"
#include "dialogxml/dialogs/strdlog.hpp"
#include "dialogxml/dialogs/strchoice.hpp"
#include "dialogxml/dialogs/choicedlog.hpp"
#include "scen.menus.hpp"
#include "fileio/resmgr/res_dialog.hpp"
@@ -95,17 +97,26 @@ fs::path game_dir;
fs::path game_binary;
extern std::string last_load_file;
void launch_scenario() {
enum eLaunchType {LOC,START,ENTRANCE};
void launch_scenario(eLaunchType type) {
if(boost::ends_with(last_load_file, ".exs")){
showError("The scenario editor cannot launch an unpacked scenario directly. You'll need to re-open the scenario from its .boes archive.");
return;
}
// Make sure scenario is loaded and currently editing the terrain of a town or outdoor section
if(type == LOC){
if(overall_mode >= MODE_MAIN_SCREEN){
showError("Must be viewing the terrain of a town or outdoor section at the place where you want to put the debug party.");
return;
}
}
// Make sure scenario is loaded
else if(overall_mode == MODE_INTRO_SCREEN){
showError("Must have a scenario loaded.");
return;
}
// Prompt to save first
if(!save_check("save-before-launch", false)) return;
@@ -121,12 +132,27 @@ void launch_scenario() {
std::ostringstream command_stream;
command_stream << bp::search_path(game_binary, {fs::current_path()}) << " --scenario \"" << last_load_file << "\" ";
if(type == LOC){
if(editing_town){
command_stream << "--town " << cur_town;
}else{
command_stream << "--out-sec (" << cur_out.x << "," << cur_out.y << ")";
}
command_stream << " --loc (" << cen_x << "," << cen_y << ")";
}else if(type == ENTRANCE){
command_stream << "--town " << cur_town;
std::ostringstream prompt;
prompt << "Launch in " << scenario.towns[cur_town]->name << " at which entrance?";
std::vector<std::string> choices = {"North", "East", "South", "West"};
cStringChoice dlog(choices, prompt.str());
size_t choice = dlog.show(0);
if(dlog->accepted()){
command_stream << " --entrance " << choice;
}else{
// Cancel
return;
}
}
LOG(command_stream.str());
@@ -475,8 +501,14 @@ void handle_menu_choice(eMenu item_hit) {
editKey.k = key_selectall;
isEdit = true;
break;
case eMenu::LAUNCH:
launch_scenario();
case eMenu::LAUNCH_HERE:
launch_scenario(LOC);
break;
case eMenu::LAUNCH_START:
launch_scenario(START);
break;
case eMenu::LAUNCH_ENTRANCE:
launch_scenario(ENTRANCE);
break;
case eMenu::TOWN_CREATE:
if(scenario.towns.size() >= 200) {

View File

@@ -74,7 +74,9 @@ void OpenBoESceneditMenu::add_persistent_menu_items(tgui::MenuBar::Ptr& menubar)
// { { "Scenario", "Advanced", "Scenario Specials Dump" }, eMenu::NONE },
// { { "Scenario", "Advanced", "Scenario Object Data Dump" }, eMenu::NONE },
{ { "Scenario", "Launch Scenario Here" }, eMenu::LAUNCH },
{ { "Scenario", "Launch From Here" }, eMenu::LAUNCH_HERE },
{ { "Scenario", "Launch From Start" }, eMenu::LAUNCH_START },
{ { "Scenario", "Launch From Town Entrance" }, eMenu::LAUNCH_ENTRANCE },
{ { "Scenario", "Create New Town" }, eMenu::TOWN_CREATE },
{ { "Scenario", "Resize Outdoors" }, eMenu::OUT_RESIZE },
{ { "Scenario", "Scenario Details" }, eMenu::SCEN_DETAILS },

View File

@@ -19,7 +19,7 @@ enum class eMenu {
EDIT_UNDO, EDIT_REDO, EDIT_CUT, EDIT_COPY, EDIT_PASTE, EDIT_DELETE, EDIT_SELECT_ALL,
HELP_TOC, HELP_START, HELP_TEST, HELP_DIST, HELP_CONTEST,
// Scenario menu
LAUNCH, TOWN_CREATE, OUT_RESIZE, SCEN_DETAILS, SCEN_INTRO, TOWN_START,
LAUNCH_HERE, LAUNCH_START, LAUNCH_ENTRANCE, TOWN_CREATE, OUT_RESIZE, SCEN_DETAILS, SCEN_INTRO, TOWN_START,
SCEN_SPECIALS, SCEN_TEXT, SCEN_JOURNALS, TOWN_IMPORT, OUT_IMPORT,
SCEN_SAVE_ITEM_RECTS,
TOWN_VARYING, SCEN_TIMERS, SCEN_ITEM_SHORTCUTS, TOWN_DELETE,

View File

@@ -56,7 +56,8 @@ void init_menubar() {
eMenu::EDIT_CUT, eMenu::EDIT_COPY, eMenu::EDIT_PASTE, eMenu::EDIT_DELETE, eMenu::EDIT_SELECT_ALL,
};
static const eMenu scen_choices[] = {
eMenu::LAUNCH, eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
eMenu::LAUNCH_HERE, eMenu::LAUNCH_START, eMenu::LAUNCH_ENTRANCE, eMenu::NONE,
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,