//////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
//////////////////////////////////////////////////////////////////////////
STRING* dummy_wmb = "dummy.wmb"; // this level is loaded while the menu is visible
STRING* level1_wmb = "level1.wmb"; // this will be the first level of the "real" game
STRING* level2_wmb = "level2.wmb"; // this will be the first level of the "real" game
STRING* level3_wmb = "level3.wmb"; // this will be the first level of the "real" game
//////////////////////////////////////////////////////////////////////////
function quit_game();
function load_levels();
function set_camera(); // sets the camera position and angles at startup
//////////////////////////////////////////////////////////////////////////
#include "menu1.c"
#include "myProj.c"
/////////////////////////////////////////////////////////////////////////
function mouse_over(); // this function runs when the mouse is placed over one of the menu buttons
/////////////////////////////////////////////////////////////////////////
function main()
{
fps_max = 70;
soundtrack_volume = 80;
video_mode = 8; // start the game at 1024x768 pixels
video_screen = 1; // start in full screen mode
mouse_spot.x = 1; // make the tip of the arrow pointer the hot spot area
mouse_spot.y = 1; // (1, 1 on the mouse pointer bitmap)
master_vol = 70; // default volume
on_esc = quit_game;
on_mouse_right = start;
set_camera();
level_load (dummy_wmb); // dummy level
wait (3);
settings_handle = file_open_read("settings.ini");
if (settings_handle)
{
saved_sounds = file_var_read(settings_handle);
saved_music = file_var_read(settings_handle);
saved_cdaudio = file_var_read(settings_handle);
saved_master = file_var_read(settings_handle);
saved_resolution = file_var_read(settings_handle);
wait (2);
if (integer(video_value + 0.5) != video_mode) // the resolution has changed?
{
if (video_switch(video_value, 0, 0) == 0) // can't switch to the new resolution?
{
video_switch(7, 0, 0); // then default to 800x600 pixels, which should work fine on any decent system
}
}
saved_details = file_var_read(settings_handle);
viewing_distance = file_var_read(settings_handle);
saved_gamma = file_var_read(settings_handle);
saved_difficulty = file_var_read(settings_handle);
file_str_read(settings_handle, key_forward);
file_str_read(settings_handle, key_backward);
file_str_read(settings_handle, key_left);
file_str_read(settings_handle, key_right);
file_str_read(settings_handle, key_fly);
file_close (settings_handle);
}
settings_handle = file_open_read("save1.dat");
if (settings_handle)
{
file_str_read(settings_handle, load_slot1_str);
file_close(settings_handle);
}
else
{
str_cpy (load_slot1_str, " "); // reset the text for the loading slot
}
settings_handle = file_open_read("save2.dat");
if (settings_handle)
{
file_str_read(settings_handle, load_slot2_str);
file_close(settings_handle);
}
else
{
str_cpy (load_slot2_str, " "); // reset the text for the loading slot
}
settings_handle = file_open_read("save3.dat");
if (settings_handle)
{
file_str_read(settings_handle, load_slot3_str);
file_close(settings_handle);
}
else
{
str_cpy (load_slot3_str, " "); // reset the text for the loading slot
}
settings_handle = file_open_read("save4.dat");
if (settings_handle)
{
file_str_read(settings_handle, load_slot4_str);
file_close(settings_handle);
}
else
{
str_cpy (load_slot4_str, " "); // reset the text for the loading slot
}
wait (3);
set (main_pan, VISIBLE); // show the main panel
soundtrack_handle = media_loop("splash.mp3", NULL, soundtrack_volume); // play this track while the menu is being displayed
vec_set (camera.x, nullvector); // move the camera to the origin
while (game_started == 0) // this loop runs until the player presses the "New game" button
{
camera.pan += 0.1 * time_step; // rotate the camera gently
camera.tilt += 0.02 * time_step; // on all the axis
camera.roll += 0.05 * time_step;
wait (1);
}
}
function start_game() // this function starts running when the player presses the "New game" button on the main panel
{
reset (main_pan, VISIBLE); // hide the main menu panel
game_started = 1;
mouse_mode = 0; // hide the cursor
var temp_volume = 0;
temp_volume = soundtrack_volume; // store the current volume of the soundtrack
while (soundtrack_volume > 0) // decrease the volume for the main menu soundtrack gently
{
media_tune(soundtrack_handle, soundtrack_volume, 100, 0);
soundtrack_volume -= 4 * time_step; // 4 gives the fading out speed
wait (1);
}
media_stop (soundtrack_handle); // the volume is zero here, so we can stop the main menu soundtrack now
soundtrack_volume = temp_volume; // restore the initial volume of the soundtrack - it will be used for the following soundtracks
level_load (level1_wmb); // now load the real level
wait (3); // wait until the level is loaded
freeze_mode = 0; //FREEZE MODE =0
soundtrack_handle = media_loop("track1.mp3", NULL, soundtrack_volume);
}
function mouse_over() // this function runs when we move the mouse over one of the buttons on the panel
{
snd_play (mouseover_wav, sound_vol, 0);
}
function mouse_startup() // displays the mouse pointer
{
mouse_map = cursor_tga;
while (1) // this loop runs until the game is started
{
if (!game_started)
{
vec_set(mouse_pos, mouse_cursor);
mouse_mode = 2;
}
else
{
mouse_mode = 0;
}
wait (1);
}
}