//================================================================================================================================//
// //
// • Game_Main //
// //
//================================================================================================================================//
// Das Main Script regelt alle Startaktionen/Eingebundenen Scripts und Debugging Aktionen des Spiels //
//================================================================================================================================//
//================================================================================================================================//
//================================================================================================================================//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// •• Includings //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define PRAGMA_PATH "Modelle"
#define PRAGMA_PATH "Modelle/Editor/"
#define PRAGMA_PATH "Grafiken"
#define PRAGMA_PATH "Grafiken/Sky/"
#include "acknex.h"
#include "default.c"
#include "game_variables.c"
#include "game_entities.c"
//================================================================================================================================//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// •• Panels //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PANEL* debug =
{
layer = 999;
digits(10,10,10,*,1,pos[0]);
digits(10,20,10,*,1,pos[1]);
flags = SHOW;
}
//================================================================================================================================//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// •• Aktionen //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
action helper()
{
Feldhelper = my;
my.alpha = 100;
set(my,PASSABLE);
set(my,BRIGHT);
while(1)
{
wait(1);
}
}
//================================================================================================================================//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// •• Funktionen //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function editor_raster_scale(var* pos,var tile_size)
{
// ->scale to raster
if(abs(fraction(pos[0]/tile_size)) > 0.5)
{pos[0] += (tile_size/2)*sign(pos[0]);}
if(abs(fraction(pos[1]/tile_size)) > 0.5)
{pos[1] += (tile_size/2)*sign(pos[1]);}
pos[0] = pos[0] * 1/tile_size;
pos[1] = pos[1] * 1/tile_size;
pos[0] = integer(pos[0]);
pos[1] = integer(pos[1]);
pos[0] = pos[0] * tile_size;
pos[1] = pos[1] * tile_size;
Feldhelper.x = pos[0];
Feldhelper.y = pos[1]-16;
Feldhelper.z = 16;
}
function mouse_controll()
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = 1000;
vec_for_screen(temp.x,camera);
c_trace(camera.x,temp.x,IGNORE_ME | IGNORE_PASSABLE);
editor_raster_scale(target.x,32);
}
function cursor()
{
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
if(key_cuu == 1){camera.y += 10*(key_shift*2)*time_step;}
if(key_cud == 1){camera.y -= 10*(key_shift*2)*time_step;}
if(key_cul == 1){camera.x -= 10*(key_shift*2)*time_step;}
if(key_cur == 1){camera.y += 10*(key_shift*2)*time_step;}
wait(1);
}
}
//================================================================================================================================//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// •• Die Main Funktion //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function main()
{
fps_max = 60;
video_set(1024,768,32,0);
video_window(NULL,NULL,16,"Spirit of the Darkness");
level_load(NULL);
draw_begin();
ent_createlayer("Sky_1+6.bmp", SKY | CUBE | SHOW, 0);
sky_color.red = 1;
sky_color.green = 1;
sky_color.blue = 1;
Feldraster = ent_create("Editor_Raster+1.tga",vector(16,0,0),NULL);
Feldraster.tilt = 90;
reset(Feldraster,PASSABLE);
wait(1);
c_setminmax(Feldraster);
wait(1);
vec_set(Feldraster.min_x,vector(Feldraster.min_x,Feldraster.min_y,-10));
vec_set(Feldraster.max_x,vector(Feldraster.max_x,Feldraster.max_y,-1));
wait(3);
camera.pan = 90;
camera.tilt = -45;
camera.roll = 0;
camera.x = 0;
camera.y = -600;
camera.z = 600;
mouse_mode = 2;
mouse_map = bmap_create("cursor.png");
mouse_range = 18000;
ent_create("Helper.mdl",vector(0,0,8),helper);
cursor();
while(1)
{
mouse_controll();
wait(1);
}
}