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.");
190 #ifndef STARSHATTER_DEMO_RELEASE
199 "The file 'content.dat' appears to have been damaged. Please re-install the latest Starshatter update." :
200 "Starshatter cannot open the file 'content.dat'. Please re-install the latest Starshatter update.";
202 ::MessageBox(
hwnd, err_msg,
"Starshatter - Error", MB_OK);
204 ::Print(
"\n\nFATAL ERROR: EXIT.");
226 ocrb =
new(__FILE__,__LINE__)
Font(
"OCRB");
246 DeleteFile(
"video2.cfg");
333 browser.
OpenURL(
"http://matrixgames.com/support");
353 for (
int i = 0; i < nkeys; i++) {
367 GetAsyncKeyState(key);
368 GetAsyncKeyState(alt);
376 if (strstr(cmdline,
"-win") || strstr(cmdline,
"-dbg")) {
380 Print(
" STARSHATTER RUNNING IN WINDOW MODE\n");
384 if (strstr(cmdline,
"-filesys")) {
385 use_file_system =
true;
386 Print(
" FILE SYSTEM ENABLED\n");
389 if (strstr(cmdline,
"-nosplash")) {
396 return Game::Init(hi, hpi, cmdline, nCmdShow);
423 Print(
" Loaded key.cfg\n\n");
433 ::Print(
"\nStarshatter::InitGame() create joystick\n");
530 savegame.
Load(saved);
558 return use_file_system;
571 if (load_dlg && load_dlg->
IsShown()) {
590 const char* mode_name[] = {
602 Print(
">>> Starshatter::SetGameMode(%d) (%s)\n", m, mode_name[m]);
604 Print(
">>> Starshatter::SetGameMode(%d) (UNKNOWN MODE)\n", m);
625 Print(
" Starting Game...\n");
650 Print(
" Returning to Plan Mode...\n");
661 Print(
" Returning to Main Menu...\n");
674 Print(
" Shutting Down (Returning to Windows)...\n");
768 Print(
" World Created.\n");
788 bool dynamic =
false;
799 Print(
" Mission Instantiated.\n");
874 frame_time = new_time;
883 if (!cutscene_mission) {
932 static bool quick_splash =
false;
969 bool campaign_select =
false;
1054 show_missions =
true;
1137 if (time_til_change > 0)
1144 if (time_til_change <= 0) {
1145 time_til_change = 0.5;
1160 if (load_dlg && load_dlg->
IsShown()) {
1175 if (show_missions) {
1181 show_missions =
false;
1199 if (time_til_change > 0)
1203 if (time_til_change <= 0) {
1204 time_til_change = 1;
1222 show_missions =
true;
1232 if (time_til_change > 0)
1253 time_til_change = 1;
1259 else if (time_til_change <= 0 && exit_latch) {
1260 time_til_change = 1;
1269 if (time_til_change <= 0) {
1271 time_til_change = 1;
1276 time_til_change = 1;
1286 time_til_change = 1;
1299 show_missions =
false;
1478 else if (seln.
size() == 1)
1518 time_til_change = 1;
1526 if (time_til_change > 0)
1611 if (time_til_change <= 0) {
1614 time_til_change = 0.5;
1619 time_til_change = 0.5;
1624 time_til_change = 0.5;
1629 time_til_change = 0.5;
1634 time_til_change = 0.5;
1639 time_til_change = 0.5;
1644 time_til_change = 0.5;
1648 time_til_change = 0.5;
1661 time_til_change = 0.5;
1674 time_til_change = 0.5;
1679 time_til_change = 0.5;
1690 time_til_change = 0.5;
1702 time_til_change = 0.5;
1711 time_til_change = 0.5;
1730 time_til_change = 0.5;
1735 time_til_change = 0.5;
1740 time_til_change = 0.5;
1745 time_til_change = 0.5;
1756 time_til_change = 0.5;
1767 time_til_change = 0.5;
1771 time_til_change = 0.5;
1776 time_til_change = 0.5;
1782 time_til_change = 0.5;
1788 time_til_change = 0.5;
1794 time_til_change = 0.5;
1800 time_til_change = 0.5;
1826 if (
gamescreen &&
player_ship && time_til_change <= 0 && !::GetAsyncKeyState(VK_SHIFT) && !::GetAsyncKeyState(VK_MENU)) {
1829 time_til_change = 0.5;
1835 time_til_change = 0.5;
1841 time_til_change = 0.5;
1847 time_til_change = 0.5;
1919 time_til_change = 0.5;
1939 static bool comm_key =
false;
2034 bool send_chat =
false;
2035 Text name =
"Player";
2054 time_til_change = 0.5;
2076 for (
int i = 1; i <= elem->
NumShips(); i++) {
2102 time_til_change = 0.5;
2110 if (key >=
'A' && key <=
'Z') {
2153 if (mode >= 0 && mode <= 4 && mode !=
chat_mode) {
2169 for (
int i = 1; i < 255; i++) {
2183 if (event_dispatch && event_dispatch->
GetCapture())
2189 static int old_mouse_x = 0;
2190 static int old_mouse_y = 0;
2375 int screen_width = 1024;
2376 int screen_height = 768;
2377 int screen_depth = 32;
2378 int terrain_detail_level = 3;
2379 bool shadows_enabled =
true;
2380 bool spec_maps_enabled =
true;
2381 bool bump_maps_enabled =
true;
2382 bool vertex_shader =
true;
2383 bool pixel_shader =
true;
2389 terrain_detail_level = 4;
2397 FILE* f = ::fopen(filename,
"rb");
2400 ::fseek(f, 0, SEEK_END);
2401 blocklen = ftell(f);
2402 ::fseek(f, 0, SEEK_SET);
2404 block =
new(__FILE__,__LINE__) BYTE[blocklen+1];
2405 block[blocklen] = 0;
2407 ::fread(block, blocklen, 1, f);
2414 Parser parser(
new(__FILE__,__LINE__)
BlockReader((
const char*) block, blocklen));
2418 Print(
"ERROR: could not parse '%s'.\n", filename);
2423 if (!file_type || file_type->
value() !=
"VIDEO") {
2424 Print(
"WARNING: invalid %s file. Using defaults\n", filename);
2444 screen_height = 600;
2448 screen_width = 1024;
2449 screen_height = 768;
2453 screen_width = 1152;
2454 screen_height = 864;
2458 screen_width = 1280;
2459 screen_height = 960;
2463 screen_width = 1440;
2464 screen_height = 900;
2469 screen_height = (w*3)/4;
2474 else if (def->
name()->
value() ==
"height") {
2478 if (screen_width == 1280 && (h == 800 || h == 1024))
2480 else if (screen_width == 1600 && (h == 900 || h == 1200))
2484 else if (def->
name()->
value() ==
"depth" ||
2499 Print(
"WARNING: Invalid screen bpp (%d) in '%s'\n", bpp, filename);
2505 else if (def->
name()->
value() ==
"max_tex") {
2508 if (n >= 64 && n <= 4096)
2512 else if (def->
name()->
value() ==
"gamma") {
2515 if (level >= 0 && level <= 255)
2519 else if (def->
name()->
value() ==
"terrain_detail_level") {
2524 else if (def->
name()->
value() ==
"terrain_texture_enable") {
2531 else if (def->
name()->
value() ==
"shadows") {
2535 else if (def->
name()->
value() ==
"spec_maps") {
2536 GetDefBool(spec_maps_enabled, def, filename);
2539 else if (def->
name()->
value() ==
"bump_maps") {
2540 GetDefBool(bump_maps_enabled, def, filename);
2543 else if (def->
name()->
value() ==
"vertex_shader") {
2547 else if (def->
name()->
value() ==
"pixel_shader") {
2555 else if (def->
name()->
value() ==
"flare") {
2561 else if (def->
name()->
value() ==
"corona") {
2567 else if (def->
name()->
value() ==
"nebula") {
2573 else if (def->
name()->
value() ==
"dust") {
2578 double range_max = 0;
2584 Print(
"WARNING: term ignored in '%s'\n", filename);
2597 if (screen_depth == 16)
2625 FILE* f = fopen(filename,
"w");
2627 fprintf(f,
"VIDEO\n\n");
2633 fprintf(f,
"primary3D: %s\n",
"true");
2634 fprintf(f,
"gamma: %4d\n",
gamma);
2637 fprintf(f,
"terrain_texture_enable: %true\n");
2646 fprintf(f,
"flare: %s\n",
lens_flare ?
"true" :
"false");
2647 fprintf(f,
"corona: %s\n",
corona ?
"true" :
"false");
2648 fprintf(f,
"nebula: %s\n",
nebula ?
"true" :
"false");
2649 fprintf(f,
"dust: %d\n",
dust);
2674 if (
InCutscene() || !msn_file || !*msn_file)
return;
2679 cutscene_mission =
new(__FILE__,__LINE__)
Mission(0);
2682 if (cutscene_mission->
Load(msn_file, path)) {
2686 bool dynamic =
false;
2698 Print(
" Cutscene Instantiated.\n");
2704 delete cutscene_mission;
2705 cutscene_mission = 0;
2706 cutscene_basetime = 0;
2777 if (cutscene_mission) {
2780 if (sim && sim->
GetMission() == cutscene_mission) {
2785 if (cutscene_basetime != 0)
2788 delete cutscene_mission;
2789 cutscene_mission = 0;
2790 cutscene_basetime = 0;
2802 return cutscene_mission;
2808 if (cutscene_mission)
2843 client_config->
Login();