You don't need includes in each wdl. You
can put them all in your main wdl.
and I don't think
#include is neccessary. I have used just
include for one of my tests.
Code:
var video_mode= 8;
var video_screen= 1;
var video_depth= 32;
var screen_color[3]= 8,8,8;
include <level_loader_top.wdl>;
include <level_loader_car.wdl>;
string level1_wmb= <carmovesnd.wmb>;
string level2_wmb= <top_move_test.wmb>;
string desc_back= "Go back to main menu";
bmap main_pcx= "mrcode.pcx";
bmap mouse_pcx= "bcursor.pcx";
panel main_pan
{
pos_x= 0;
pos_y= 0;
bmap= main_pcx;
flags= visible;
}
panel button1_pan
{
button= (384,250,"topspinner_on.pcx","top_spinner.pcx","topspinner_ovr.pcx",load_lvl1,null,null);
layer= 2;
flags= visible;
}
panel button2_pan
{
button= (350,350,"car3d_on.pcx","car_3d.pcx","car3d_ovr.pcx",load_lvl2,null,null);
layer= 2;
flags= visible;
}
panel exit_pan
{
button (290,450,"exit_on.pcx","exit_off.pcx","exit_ovr.pcx",exit,null,null);
layer= 2;
flags= visible;
}
panel back_button
{
button= (0,0,"back_on.pcx","back.pcx","back_ovr.pcx",go_back,back_desc_off,back_desc_on);
layer= 4;
}
function main()
{
mouse_map= mouse_pcx;
mouse_mode= 2;
while(1)
{
mouse_pos.x= pointer.x;
mouse_pos.y= pointer.y;
wait(1);
}
}
function load_lvl1()
{
wait(1);
button1_pan.visible= off;
wait(1);
button2_pan.visible= off;
wait(1);
exit_pan.visible= off;
wait(1);
main_pan.visible= off;
wait(1);
back_button.visible= on;
wait(1);
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);
main_pan.visible= off;
wait(1);
back_button.visible= on;
wait(1);
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);
}
text desc_txt
{
pos_x= 70;
pos_y= 10;
string= desc_back;
}
function go_back()
{
wait(1);
main_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;
wait(1);
desc_txt.visible= off;
}
function back_desc_on()
{
desc_txt.visible= on;
}
function back_desc_off()
{
desc_txt.visible= off;
}
The code for the two levels is in the other two files. "#include" is used for preprocessing, whereas "include" reads from the files after compilation.