1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

allow scenarios from any location to be started via command line

This commit is contained in:
IntelOrca
2014-09-08 19:58:15 +01:00
parent 8f586ae245
commit 31eec46c4d
3 changed files with 22 additions and 12 deletions

View File

@@ -307,6 +307,9 @@ void check_cmdline_arg()
else if (!_stricmp(processed_arg + last_period, "sc6"))
{
//TODO: scenario install
rct_scenario_basic scenarioBasic;
strcpy(scenarioBasic.path, processed_arg);
scenario_load_and_play_from_path(scenarioBasic.path);
}
else if (!_stricmp(processed_arg + last_period, "td6") || !_stricmp(processed_arg + last_period, "td4"))
{

View File

@@ -83,7 +83,7 @@ int scenario_load_basic(const char *path)
* rct2: 0x00676053
* scenario (ebx)
*/
void scenario_load(const char *path)
int scenario_load(const char *path)
{
FILE *file;
int i, j;
@@ -96,7 +96,7 @@ void scenario_load(const char *path)
fclose(file);
RCT2_GLOBAL(0x009AC31B, uint8) = 255;
RCT2_GLOBAL(0x009AC31C, uint16) = STR_FILE_CONTAINS_INVALID_DATA;
return;
return 0;
}
// Read first chunk
@@ -158,7 +158,7 @@ void scenario_load(const char *path)
RCT2_CALLPROC_EBPSAFE(0x006A9FC0);
map_update_tile_pointers();
reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
return;
return 1;
}
fclose(file);
@@ -166,6 +166,7 @@ void scenario_load(const char *path)
RCT2_GLOBAL(0x009AC31B, uint8) = 255;
RCT2_GLOBAL(0x009AC31C, uint16) = STR_FILE_CONTAINS_INVALID_DATA;
return 0;
}
/**
@@ -173,7 +174,15 @@ void scenario_load(const char *path)
* rct2: 0x00678282
* scenario (ebx)
*/
void scenario_load_and_play(const rct_scenario_basic *scenario)
int scenario_load_and_play(const rct_scenario_basic *scenario)
{
char path[MAX_PATH];
subsitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), scenario->path);
return scenario_load_and_play_from_path(path);
}
int scenario_load_and_play_from_path(const char *path)
{
rct_window *mainWindow;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
@@ -185,12 +194,9 @@ void scenario_load_and_play(const rct_scenario_basic *scenario)
RCT2_CALLPROC_EBPSAFE(0x006CBCC3);
subsitute_path(
RCT2_ADDRESS(0x0141EF68, char),
RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char),
scenario->path
);
scenario_load((char*)0x0141EF68);
if (!scenario_load(path))
return 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
viewport_init_all();
game_create_windows();

View File

@@ -402,8 +402,9 @@ extern rct_scenario_basic *gScenarioList;
int scenario_scores_save();
void scenario_load_list();
int scenario_load_basic(const char *path);
void scenario_load(const char *path);
void scenario_load_and_play(const rct_scenario_basic *scenario);
int scenario_load(const char *path);
int scenario_load_and_play(const rct_scenario_basic *scenario);
int scenario_load_and_play_from_path(const char *path);
void scenario_update();
int scenario_rand();