126 static Mission* current_mission = 0;
127 static Mission* cutscene_mission = 0;
128 static double cutscene_basetime = 0;
129 static int cut_efx_volume = 100;
130 static int cut_wrn_volume = 100;
131 static double time_til_change = 0;
132 static bool exit_latch =
true;
133 static bool show_missions =
false;
134 static bool use_file_system =
false;
135 static bool no_splash =
false;
147 : gamewin(0), menuscreen(0), loadscreen(0), planscreen(0),
148 cmpnscreen(0), gamescreen(0), splash(0), splash_index(0),
149 input(0), loader(0), cam_dir(0), music_dir(0),
150 field_of_view(2), time_mark(0), minutes(0),
151 player_ship(0), net_lobby(0),
152 spinning(false), tactical(false), mouse_x(0), mouse_y(0),
153 game_mode(MENU_MODE), mouse_input(0), head_tracker(0),
154 terminal(0), verdana(0), limerick18(0), limerick12(0),
155 HUDfont(0), GUIfont(0), GUI_small_font(0), title_font(0),
156 ocrb(0), req_change_video(0), video_changed(0),
157 lens_flare(true), corona(true), nebula(true), dust(0),
158 load_step(0), load_progress(0),
159 chat_mode(0), exit_time(1.2), cutscene(0)
164 app_name =
"Starshatter: The Gathering Storm";
178 "The file 'shatter.dat' appears to have been damaged. Please re-install Starshatter." :
179 "Starshatter cannot open the file 'shatter.dat'. Please re-install Starshatter.";
181 ::MessageBox(
hwnd, err_msg,
"Starshatter - Error", MB_OK);
183 ::Print(
"\n\nFATAL ERROR: EXIT.");
197 "The file 'content.dat' appears to have been damaged. Please re-install the latest Starshatter update." :
198 "Starshatter cannot open the file 'content.dat'. Please re-install the latest Starshatter update.";
200 ::MessageBox(
hwnd, err_msg,
"Starshatter - Error", MB_OK);
202 ::Print(
"\n\nFATAL ERROR: EXIT.");
224 ocrb =
new(__FILE__,__LINE__)
Font(
"OCRB");
244 DeleteFile(
"video2.cfg");
331 browser.
OpenURL(
"http://matrixgames.com/support");
351 for (
int i = 0; i < nkeys; i++) {
365 GetAsyncKeyState(key);
366 GetAsyncKeyState(alt);
374 if (strstr(cmdline,
"-win") || strstr(cmdline,
"-dbg")) {
378 Print(
" STARSHATTER RUNNING IN WINDOW MODE\n");
382 if (strstr(cmdline,
"-filesys")) {
383 use_file_system =
true;
384 Print(
" FILE SYSTEM ENABLED\n");
387 if (strstr(cmdline,
"-nosplash")) {
394 return Game::Init(hi, hpi, cmdline, nCmdShow);
421 Print(
" Loaded key.cfg\n\n");
431 ::Print(
"\nStarshatter::InitGame() create joystick\n");
528 savegame.
Load(saved);
556 return use_file_system;
569 if (load_dlg && load_dlg->
IsShown()) {
588 const char* mode_name[] = {
600 Print(
">>> Starshatter::SetGameMode(%d) (%s)\n", m, mode_name[m]);
602 Print(
">>> Starshatter::SetGameMode(%d) (UNKNOWN MODE)\n", m);
623 Print(
" Starting Game...\n");
648 Print(
" Returning to Plan Mode...\n");
659 Print(
" Returning to Main Menu...\n");
672 Print(
" Shutting Down (Returning to Windows)...\n");
766 Print(
" World Created.\n");
786 bool dynamic =
false;
797 Print(
" Mission Instantiated.\n");
872 frame_time = new_time;
881 if (!cutscene_mission) {
930 static bool quick_splash =
false;
967 bool campaign_select =
false;
1052 show_missions =
true;
1135 if (time_til_change > 0)
1142 if (time_til_change <= 0) {
1143 time_til_change = 0.5;
1158 if (load_dlg && load_dlg->
IsShown()) {
1173 if (show_missions) {
1179 show_missions =
false;
1197 if (time_til_change > 0)
1201 if (time_til_change <= 0) {
1202 time_til_change = 1;
1220 show_missions =
true;
1230 if (time_til_change > 0)
1251 time_til_change = 1;
1257 else if (time_til_change <= 0 && exit_latch) {
1258 time_til_change = 1;
1267 if (time_til_change <= 0) {
1269 time_til_change = 1;
1274 time_til_change = 1;
1284 time_til_change = 1;
1297 show_missions =
false;
1476 else if (seln.
size() == 1)
1516 time_til_change = 1;
1524 if (time_til_change > 0)
1609 if (time_til_change <= 0) {
1612 time_til_change = 0.5;
1617 time_til_change = 0.5;
1622 time_til_change = 0.5;
1627 time_til_change = 0.5;
1632 time_til_change = 0.5;
1637 time_til_change = 0.5;
1642 time_til_change = 0.5;
1646 time_til_change = 0.5;
1659 time_til_change = 0.5;
1672 time_til_change = 0.5;
1677 time_til_change = 0.5;
1688 time_til_change = 0.5;
1700 time_til_change = 0.5;
1709 time_til_change = 0.5;
1728 time_til_change = 0.5;
1733 time_til_change = 0.5;
1738 time_til_change = 0.5;
1743 time_til_change = 0.5;
1754 time_til_change = 0.5;
1765 time_til_change = 0.5;
1769 time_til_change = 0.5;
1774 time_til_change = 0.5;
1780 time_til_change = 0.5;
1786 time_til_change = 0.5;
1792 time_til_change = 0.5;
1798 time_til_change = 0.5;
1824 if (
gamescreen &&
player_ship && time_til_change <= 0 && !::GetAsyncKeyState(VK_SHIFT) && !::GetAsyncKeyState(VK_MENU)) {
1827 time_til_change = 0.5;
1833 time_til_change = 0.5;
1839 time_til_change = 0.5;
1845 time_til_change = 0.5;
1917 time_til_change = 0.5;
1937 static bool comm_key =
false;
2032 bool send_chat =
false;
2033 Text name =
"Player";
2052 time_til_change = 0.5;
2074 for (
int i = 1; i <= elem->
NumShips(); i++) {
2100 time_til_change = 0.5;
2108 if (key >=
'A' && key <=
'Z') {
2151 if (mode >= 0 && mode <= 4 && mode !=
chat_mode) {
2167 for (
int i = 1; i < 255; i++) {
2181 if (event_dispatch && event_dispatch->
GetCapture())
2187 static int old_mouse_x = 0;
2188 static int old_mouse_y = 0;
2373 int screen_width = 1024;
2374 int screen_height = 768;
2375 int screen_depth = 32;
2376 int terrain_detail_level = 3;
2377 bool shadows_enabled =
true;
2378 bool spec_maps_enabled =
true;
2379 bool bump_maps_enabled =
true;
2380 bool vertex_shader =
true;
2381 bool pixel_shader =
true;
2387 terrain_detail_level = 4;
2395 FILE* f = ::fopen(filename,
"rb");
2398 ::fseek(f, 0, SEEK_END);
2399 blocklen = ftell(f);
2400 ::fseek(f, 0, SEEK_SET);
2402 block =
new(__FILE__,__LINE__) BYTE[blocklen+1];
2403 block[blocklen] = 0;
2405 ::fread(block, blocklen, 1, f);
2412 Parser parser(
new(__FILE__,__LINE__)
BlockReader((
const char*) block, blocklen));
2416 Print(
"ERROR: could not parse '%s'.\n", filename);
2421 if (!file_type || file_type->
value() !=
"VIDEO") {
2422 Print(
"WARNING: invalid %s file. Using defaults\n", filename);
2442 screen_height = 600;
2446 screen_width = 1024;
2447 screen_height = 768;
2451 screen_width = 1152;
2452 screen_height = 864;
2456 screen_width = 1280;
2457 screen_height = 960;
2461 screen_width = 1440;
2462 screen_height = 900;
2467 screen_height = (w*3)/4;
2472 else if (def->
name()->
value() ==
"height") {
2476 if (screen_width == 1280 && (h == 800 || h == 1024))
2478 else if (screen_width == 1600 && (h == 900 || h == 1200))
2482 else if (def->
name()->
value() ==
"depth" ||
2497 Print(
"WARNING: Invalid screen bpp (%d) in '%s'\n", bpp, filename);
2503 else if (def->
name()->
value() ==
"max_tex") {
2506 if (n >= 64 && n <= 4096)
2510 else if (def->
name()->
value() ==
"gamma") {
2513 if (level >= 0 && level <= 255)
2517 else if (def->
name()->
value() ==
"terrain_detail_level") {
2522 else if (def->
name()->
value() ==
"terrain_texture_enable") {
2529 else if (def->
name()->
value() ==
"shadows") {
2533 else if (def->
name()->
value() ==
"spec_maps") {
2534 GetDefBool(spec_maps_enabled, def, filename);
2537 else if (def->
name()->
value() ==
"bump_maps") {
2538 GetDefBool(bump_maps_enabled, def, filename);
2541 else if (def->
name()->
value() ==
"vertex_shader") {
2545 else if (def->
name()->
value() ==
"pixel_shader") {
2553 else if (def->
name()->
value() ==
"flare") {
2559 else if (def->
name()->
value() ==
"corona") {
2565 else if (def->
name()->
value() ==
"nebula") {
2571 else if (def->
name()->
value() ==
"dust") {
2576 double range_max = 0;
2582 Print(
"WARNING: term ignored in '%s'\n", filename);
2595 if (screen_depth == 16)
2623 FILE* f = fopen(filename,
"w");
2625 fprintf(f,
"VIDEO\n\n");
2631 fprintf(f,
"primary3D: %s\n",
"true");
2632 fprintf(f,
"gamma: %4d\n",
gamma);
2635 fprintf(f,
"terrain_texture_enable: %true\n");
2644 fprintf(f,
"flare: %s\n",
lens_flare ?
"true" :
"false");
2645 fprintf(f,
"corona: %s\n",
corona ?
"true" :
"false");
2646 fprintf(f,
"nebula: %s\n",
nebula ?
"true" :
"false");
2647 fprintf(f,
"dust: %d\n",
dust);
2672 if (
InCutscene() || !msn_file || !*msn_file)
return;
2677 cutscene_mission =
new(__FILE__,__LINE__)
Mission(0);
2680 if (cutscene_mission->
Load(msn_file, path)) {
2684 bool dynamic =
false;
2696 Print(
" Cutscene Instantiated.\n");
2702 delete cutscene_mission;
2703 cutscene_mission = 0;
2704 cutscene_basetime = 0;
2775 if (cutscene_mission) {
2778 if (sim && sim->
GetMission() == cutscene_mission) {
2783 if (cutscene_basetime != 0)
2786 delete cutscene_mission;
2787 cutscene_mission = 0;
2788 cutscene_basetime = 0;
2800 return cutscene_mission;
2806 if (cutscene_mission)
2841 client_config->
Login();