Code:
var video_mode= 8;
var video_screen= 1;
var video_depth= 32;
include <level_loader_top.wdl>;
include <level_loader_car.wdl>;
string level1_wmb= <carmovesnd.wmb>;
string level2_wmb= <top_move_test.wmb>;
bmap back_pcx = <mrcode.pcx>;
bmap mouse_pcx = <cursor.pcx>;
bmap imBack = <back.pcx>;
bmap imBackOn = <back_on.pcx>;
bmap imBackOver = <back_ovr.pcx>;
bmap imCar3d = <car3d.pcx>;
bmap imCar3dOn = <car3d_on.pcx>;
bmap imCar3dOver = <car3d_ovr.pcx>;
bmap imExitOn = <exit_on.pcx>;
bmap imExitOff = <exit_off.pcx>;
bmap imExitOver = <exit_ovr.pcx>;
bmap imTopSpinner = <top_spinner.pcx>;
bmap imTopSpinnerOn = <topspinner_on.pcx>;
bmap imTopSpinnerOver = <topspinner_ovr.pcx>;
/************************************
fMouseCLoop
*************************************/
function fMouseCLoop() {
proc_kill(4);
mouse_map = mouse_pcx;
while(1) {
if (mouse_mode > 0) {
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
}
wait(1);
}
}
panel back_pan {
pos_x= 0;
pos_y= 0;
bmap= back_pcx;
flags= visible;
}
panel button1_pan {
pos_x = 350;
pos_y = 250;
button = 0, 0, imTopSpinnerOn, imTopSpinner, imTopSpinnerOver, load_lvl1, null, null;
layer= 2;
flags= visible;
}
panel button2_pan {
pos_x = 350;
pos_y = 350;
button = 0, 0, imgCar3dOn, imgCar3d, imCar3dOver, load_lvl2,null,null;
layer= 2;
flags= visible;
}
panel exit_pan {
pos_x = 350;
pos_y = 450;
button = 0, 0, imExitOn, imExitOff, imExitOver, exit, null,null;
layer= 2;
flags= visible;
}
panel back_button {
pos_x = 0;
pos_y = 0;
button = 0, 0, imBackOn, imBack, imBackOver, go_back,null,null;
layer= 3;
}
function load_lvl1() {
wait(1);
button1_pan.visible= off;
wait(1);
button2_pan.visible= off;
wait(1);
exit_pan.visible= off;
wait(1);
back_pan.visible= off;
wait(1);
back_button.visible= on;
wait(2);
level_load (level2_wmb);
wait(1);
camera.x= 0;
camera.y= -876;
camera.z= 664;
camera.pan= 90;
camera.tilt= -62;
camera.roll= 0;
}
function load_lvl2() {
wait(1);
button2_pan.visible= off;
wait(1);
button1_pan.visible= off;
wait(1);
exit_pan.visible= off;
wait(1);
back_pan.visible= off;
wait(1);
back_button.visible= on;
wait(2);
level_load (level1_wmb);
wait(2);
camera.x= -714;
camera.y= 0;
camera.z= 845;
camera.pan= 360;
camera.tilt= -71;
camera.roll= 0;
}
function exit() {
sys_exit (null);
}
function go_back() {
wait(1);
back_pan.visible= on;
wait(1);
button1_pan.visible= on;
wait(1);
button2_pan.visible= on;
wait(1);
exit_pan.visible= on;
wait(1);
back_button.visible= off;
}
/************************************
uiFreshen
*************************************/
function uiFreshen() {
var w;
var h;
var posX;
var posY;
var offset; offset = 10;
//imCar3d is the new standard for fresh ui
w = bmap_width(imCar3d);
h = bmap_height(imCar3d);
posX = int(screen_size.x / 2 - w / 2);
posY = int(screen_size.y / 2 - ((h * 3 + offset * 2) / 2)); //exit button is bigger but shouldn't be
button1_pan.pos_x = posX;
button1_pan.pos_y = posY;
posY += offset;
button2_pan.pos_x = posX;
button2_pan.pos_y = posY;
posY += offset;
exit_pan.pos_x = posX;
exit_pan.pos_y = posY;
}
/************************************
main
*************************************/
function main() {
//wait(3);
uiFreshen();
fMouseCLoop();
mouse_mode = 2;
}