////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////
var camrad = 2500;//Umlaufradius der Camera
var campan = 1;//Winkel pro step für Kamera-pan
var camtilt = 1;//Winkel pro step für Kamera-tilt
var camspeed = 10;//Kmerageschwindigkeit vertikal
var cam_max_z = 2500;//höchste Kamera-Position
var cam_min_z = -2500;//niedrigste Kamera-Position
////////////////////////////////////////////////////////////
var _plid = 0;
var x_rad[3] = {200,400,600};
var y_rad[3] = {200,400,1000};
var z_rad[3] = {200,0,100};
var winkel[3] = {0,90,180};
var pl_speed[3] = {5,10,15};
////////////////////////////////////////////////////////////
FONT* ari_12 = "Arial#12";
FONT* ari_14 = "Arial#14";
FONT* ari_18 = "Arial#18";
FONT* ari_24 = "Arial#24";
////////////////////////////////////////////////////////////
BMAP* maus_pcx = "maus.pcx";
////////////////////////////////////////////////////////////
ENTITY* sonne;
ENTITY* start;//aktueller Planet, der mit links angeklickt wurde
////////////////////////////////////////////////////////////
function sonnenlicht()
{
if(event_type == EVENT_TOUCH)
{
my.ambient = 300;
my.lightrange = 2500;
}
if(event_type == EVENT_RELEASE)
{
my.ambient = 0;
my.lightrange = 0;
}
}
////////////////////////////////////////////////////////////
function planet_data()
{
if(event_type == EVENT_TOUCH)
{
my.ambient = 100;
my.lightrange = 1500;
}
if(event_type == EVENT_RELEASE)
{
my.ambient = 0;
my.lightrange = 0;
}
if(event_type == EVENT_CLICK)
{
_plid = my.skill1;
beep(1);
}
}
////////////////////////////////////////////////////////////
action planet_ini()
{
my.emask = ENABLE_TOUCH | ENABLE_RELEASE | ENABLE_CLICK | ENABLE_RIGHTCLICK;
my.event = planet_data;
var plid = my.skill1;
while(1)
{
my.x = cos(winkel[plid]) * x_rad[plid];
my.y = sin(winkel[plid]) * y_rad[plid];
my.z = sin(winkel[plid]) * z_rad[plid];
winkel[plid] += pl_speed[plid];
wait(-1);
}
}
////////////////////////////////////////////////////////////
function camsteuerung()
{
my.emask = ENABLE_TOUCH | ENABLE_RELEASE;
my.event = sonnenlicht;
vec_set(camera.x,vector(-2500,0,0));
vec_set(camera.pan,vector(0,0,0));
while(1)
{
if(key_a)
{
sonne.pan += campan * time_step;
camera.pan = sonne.pan-180;
camera.x = cos(sonne.pan) * camrad;
camera.y = sin(sonne.pan) * camrad;
}
if(key_d)
{
sonne.pan -= campan * time_step;
camera.pan = sonne.pan-180;
camera.x = cos(sonne.pan) * camrad;
camera.y = sin(sonne.pan) * camrad;
}
if(key_w)
{
camera.tilt += camtilt * time_step;
}
if(key_s)
{
camera.tilt -= camtilt * time_step;
}
if(key_q)
{
camera.z += camspeed * time_step;
}
if(key_e)
{
camera.z -= camspeed * time_step;
}
//map.pos_x += 10 * (key_a - key_d) * time_step;
//map.pos_y += 10 * (key_w - key_s) * time_step;
wait(1);
}
}
////////////////////////////////////////////////////////////
function erstellewelt()
{
sonne = ent_create("null.mdl",vector(0,0,0),camsteuerung);
/*
pl[0] = ent_create("planet_0.mdl",vector(plx[0],ply[0],plz[0]),planet_ini);
pl[1] = ent_create("planet_1.mdl",vector(plx[1],ply[1],plz[1]),planet_ini);
pl[2] = ent_create("planet_1.mdl",vector(plx[2],ply[2],plz[2]),planet_ini);
*/
}
////////////////////////////////////////////////////////////
PANEL* testpanel =
{
bmap = "testpanel.pcx";
pos_x = 824;
pos_y = 0;
layer = 10;
blue = 200;
green = 128;
red = 128;
digits(5,5,"Kamera-Pan = %.2f",ari_12,1,camera.pan);
digits(5,20,"Kamera-Tilt = %.2f",ari_12,1,camera.tilt);
digits(5,35,"ID = %.2f",ari_12,1,_plid);
flags = VISIBLE;
}
////////////////////////////////////////////////////////////
function main()
{
video_screen = 1;//Vollbildmodus
video_mode = 8;//Auflösung = 1024 * 768 Pixel
level_load("stco_neu.wmb");//Lade Level
wait(3); //Warte bis Level geladen ist
mouse_mode = 2;
mouse_map = maus_pcx;
mouse_range = 5000;
//camsteuerung();
//kreissbahn();
erstellewelt();
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}