//include <default.fx>;
//include <mtlFX.wdl>;
//include <default.fx>;
//include <mtlFX.wdl>;
#include <acknex.h>
#include <default.c>
#include "mtlFX.c"
#define PRAGMA_PATH "%EXE_DIR%\code";
#define PRAGMA_PATH "images";
#define PRAGMA_PATH "terrains";
#define PRAGMA_PATH "levels";
#define PRAGMA_PATH "models";
////////////////////////////////////////////////////////////////////
#define xmax 1024
#define ymax 768
#define fscreen 1
BMAP* nneglogo = "nnegamingLOGO.bmp";
BMAP* dhlogo = "dementia_hillsLOGO.bmp";
BMAP* dhmenustart = "dhmenustart.bmp";
BMAP* dhmenustartover = "dhmenustart_over.bmp";
BMAP* mcursor = "brokenarrow.pcx";
ENTITY* skycube;
PANEL* splash1 = {
pos_x=0;
pos_y=0;
layer=2;
bmap = nneglogo;
flags = VISIBLE;
}
PANEL* splash2 = {
pos_x=0;
pos_y=0;
layer=1;
bmap = dhlogo;
flags = VISIBLE;
}
PANEL* mainmenu = {
pos_x=0;
pos_y=350;
layer=3;
button(0,0,dhmenustart,dhmenustart,dhmenustartover,startworld,NULL,NULL);
flags = OVERLAY;
}
function startworld(){
toggle(mainmenu,VISIBLE);
toggle(splash1,VISIBLE);
toggle(splash2,VISIBLE);
//Start Loading Shit
camera.arc = 30; //Zoom Factor
while(player == NULL) { wait(1); }
player.x = 570;
player.y = -1996;
player.z = 330;
player.pan = 323;
vec_set(camera.x,vector(-180,0,50));
vec_rotate(camera.x,player.pan);
vec_add(camera.x,player.x);
camera.pan = player.pan;
camera.tilt = -15;
}
action players_code() {
var anim_percentage; // animation percentage
VECTOR movement_speed; // player's movement speed
var distance_to_ground; // the distance between player's origin and the ground
VECTOR temp;
player = my; // I'm the player
while (1) {
//THIS PART CAUSE FLICKERING WHY????!!!
vec_set(camera.x,vector(-180,0,50));
vec_rotate(camera.x,player.pan);
vec_add(camera.x,player.x);
camera.pan = player.pan;
camera.tilt = -15;
//THAT^ PART CAUSE FLICKERING WHY????!!!
my.pan += 6 * (key_a - key_d) * time_step; // rotate the player using the "A" and "D" keys
vec_set (temp.x, my.x); // copy player's position to temp
temp.z -= 5000; // set temp.z 5000 quants below player's origin
distance_to_ground = c_trace (my.x, temp.x, IGNORE_ME | USE_BOX);
movement_speed.x = 10 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv(-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, GLIDE); // move the player
if ((key_w == OFF) && (key_s == OFF)) {
ent_animate(my, "Standa", anim_percentage, ANM_CYCLE); // play the "stand" animation
} else {
ent_animate(my, "Walka", anim_percentage, ANM_CYCLE); // play the "walk" animation
}
anim_percentage += 8 * time_step; // 5 = animation speed
wait (1);
}
}
function main()
{
video_set(xmax,ymax,32,fscreen);
screen_color.blue=0;
screen_color.red=0;
screen_color.green=0;
wait(2);
wait(-8);
splash1.bmap=dhlogo;
while(splash1.pos_x <= 125) {
splash1.pos_x += 3 * time_step;
wait(1);
}
toggle(mainmenu,VISIBLE);
level_load("dh.wmb");
skycube = ent_createlayer("Sky_2+6.tga", SKY | CUBE | VISIBLE, 0);
mouse_map= mcursor;
mouse_mode = 2;
//delay the inevitable
while(key_pressed(key_for_str("q")) == 0) {
//Process Mouse
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
//if (player != NULL) {
//I even tried putting the flicker causing code here
//still works
//still flickers
// :(
//}
//next cycle
wait(1);
}
sys_exit("p00!");
}