///////////////////////////////////////////////////////////////////////////////////
// Dragonquest
////////////////////////////////////////////////////////////////////////////

//PATH "C:\\Database\\Programmieren\\GStudio\\PDTM04";	// Path to WDL templates subdirectory
SAVEDIR "\\Highscore";


var sng1;
var sng2;
var sng3;
var sng4;
var sng5;
//var soft_drift;
//var Casting;

var Eisig = OFF;
var Wetterschalter;
var TEMP2;
var sceenie;
var cam_view;
var Statta;
var Stattax2;
var NODAMAGE = OFF;
var LOWHEAT = OFF;
var Farmlevel;

var Pausierung;

DEFINE _Framespeed, SKILL2;
DEFINE _charakter, SKILL3;
DEFINE _Maus, SKILL4;
DEFINE _Kraft, SKILL5;
DEFINE _Aktion, SKILL6;
DEFINE _Move_anim, SKILL7;

BMAP Spritzer, <flare0.pcx>;
BMAP butt1x, <butt1x.bmp>;
BMAP butt1y, <butt1y.bmp>;
BMAP butt1z, <butt1z.bmp>;
BMAP butt2x, <butt2x.bmp>;
BMAP butt2y, <butt2y.bmp>;
BMAP butt2z, <butt2z.bmp>;
BMAP butt3x, <butt4x.bmp>;
BMAP butt3y, <butt4y.bmp>;
BMAP butt3z, <butt4z.bmp>;
BMAP butt4x, <butt3x.bmp>;
BMAP butt4y, <butt3y.bmp>;
BMAP butt4z, <butt3z.bmp>;

BMAP optx1, <optx1.bmp>;
BMAP optx2, <optx2.bmp>;
BMAP optx3, <optx3.bmp>;
BMAP optx4, <optx4.bmp>;
BMAP optx, <optx.bmp>;
BMAP opty, <opty.bmp>;
BMAP optz, <optz.bmp>;

BMAP leftx, <leftx.bmp>;
BMAP lefty, <lefty.bmp>;
BMAP leftz, <leftz.bmp>;
BMAP rightx, <rightx.bmp>;
BMAP righty, <righty.bmp>;
BMAP rightz, <rightz.bmp>;

BMAP schw1, <schw1.bmp>;
BMAP schw2, <schw2.bmp>;
BMAP schw3, <schw3.bmp>;
BMAP Laut1, <Laut1.bmp>;
BMAP Laut2, <Laut2.bmp>;
BMAP Laut3, <Laut3.bmp>;
BMAP Laut4, <Laut4.bmp>;
BMAP Maus1, <Maus1.bmp>;
BMAP Maus2, <Maus2.bmp>;
BMAP Maus3, <Maus3.bmp>;
BMAP Res1,  <Res1.bmp>;
BMAP Res2,  <Res2.bmp>;

BMAP F1x, <F1x.bmp>;
BMAP F1y, <F1y.bmp>;
BMAP F1z, <F1z.bmp>;

BMAP Mission_a, <Mission_a.bmp>;
BMAP Mission_b, <Mission_b.bmp>;

BMAP Maus, <Maus.bmp>;
var Mausempfindlichkeit = 15;
DEFINE shadowsprite,<shadow.pcx>;


FONT abra_font, <abrafont.bmp>,8,10;

BMAP habba,<habba.bmp>;
BMAP htgrnd,<htgrnd.bmp>;

STRING fw = <fw-190.mdl>;
STRING bf = <bf-109.mdl>;
STRING hu = <huhn.mdl>;
STRING pt = <pat.mdl>;
STRING Explosion = <exp+16.pcx>;
STRING Feder = <Feder.mdl>;
STRING kt1 = <kt1.mdl>;
STRING kt2 = <kt2.mdl>;
STRING gt1 = <fwflgl.mdl>;
STRING gt2 = <bfflgl.mdl>;
STRING gt3 = <fwheck.mdl>;
STRING gt4 = <bfheck.mdl>;
STRING fwprop = <fwprop.mdl>;
STRING bfprop = <bfprop.mdl>;
STRING Bombe = <Bombe.mdl>;
STRING Ei = <Ei.mdl>;

SOUND wp1,<wp1.wav>;
SOUND wp2,<wp2.wav>;
SOUND bh1,<bh1.wav>;
SOUND explo1,<Booom.wav>;

SOUND sfw190,<fw190.wav>;
SOUND sme109,<me109.wav>;
SOUND Huhns,<Huhn.wav>;

var Data1;
var Data2;
var Data3;
var Data4;
var Data5;
var Data6;

var Punkte;

var Hitze;
var Zustand = 100;
var Formation;

var XVECTOR;

var Sound50;
var Sound75;
var Sound100;
var Sound2500;
var Lautstaerke = 3;
var Schwierigkeitsgrad = 1;

var_nsave Prop_handle_fw1 = NULL;
var_nsave Prop_handle_fw2 = NULL;
var_nsave Prop_handle_fw3 = NULL;
var_nsave Prop_handle_fw4 = NULL;

var_nsave Prop_handle_bf1 = NULL;
var_nsave Prop_handle_bf2 = NULL;
var_nsave Prop_handle_bf3 = NULL;
var_nsave Prop_handle_bf4 = NULL;

DEFINE _Treffer, SKILL1;

DEFINE _Framespeed, SKILL2;
DEFINE _Fallspeed, SKILL3;

DEFINE _Schaden, SKILL6;
DEFINE _Schaden_X, SKILL6;
DEFINE _Schaden_Y, SKILL7;
DEFINE _Schaden_Z, SKILL8;

DEFINE _SPEED, SKILL11;
DEFINE _SPEED_X, SKILL11;
DEFINE _SPEED_Y, SKILL12;
DEFINE _SPEED_Z, SKILL13;

DEFINE _Bombenx, SKILL14;

DEFINE _TIMER, SKILL30;

entity* ENT_mf;
entity* ENT_sw;
//entity* ENT_ca;
//entity* ENT_cb;

var Punktz[10] = 600, 540, 480, 420, 360, 300, 240, 180, 120, 60;
var Platz;
String Platz1  = "Unbenannt0";
String Platz2  = "Unbenannt1";
String Platz3  = "Unbenannt2";
String Platz4  = "Unbenannt3";
String Platz5  = "Unbenannt4";
String Platz6  = "Unbenannt5";
String Platz7  = "Unbenannt6";
String Platz8  = "Unbenannt7";
String Platz9  = "Unbenannt8";
String Platz10 = "Unbenannt9";

function Flieger_fw();
function Flieger_bf();
function Flieger_fw_Form();
function Flieger_bf_Form();
function Huhn();
function Huhn_Form();
function Miniteile();


function Level1();


//BMAP horizon1_map = <pansky02.bmp>;
//BMAP horizon2_map = <pansky03.bmp>;

SKY Nacht
{
	TYPE = <Skynight.mdl>;
	LAYER = 0;
	SCALE_X = 920;
	SCALE_Y = 920;
	SCALE_Z = 920;
	FLAGS = SCENE, VISIBLE;
}
SKY Tag
{
	TYPE = <skyday.mdl>;
	LAYER = 1;
	SCALE_X = 770;
	SCALE_Y = 770;
	SCALE_Z = 385;
	FLAGS = SCENE, TRANSPARENT, VISIBLE;
}
SKY Hintergrund
{
	TYPE = <horizon2.bmp>;
	LAYER = 3;
	SCALE_X = 0.1;
	TILT = -5;
	FLAGS = SCENE, OVERLAY, VISIBLE;
}

ENTITY Logofw
{
	TYPE = <LOGO.bmp>;
	LAYER = 2;
	X = 1000;
	Y = 0;
	Z = 350;
	FLAGS = FLARE, BRIGHT;
}

ENTITY Eigesapper
{
	TYPE = <Eisapper.bmp>;
	LAYER = 5;
	VIEW = CAMERA;
	FLAGS = FLARE, BRIGHT, TRANSPARENT;
}

PANEL Mission_1
{
	POS_X = 0;
	POS_Y = 0;
	BUTTON 0, 0, Mission_a, Mission_a, Mission_a, Level1, NULL, NULL;
}
PANEL Mission_2
{
	POS_X = 0;
	POS_Y = 0;
	BUTTON 0, 0, Mission_b, Mission_b, Mission_b, Level1, NULL, NULL;
}

include <Mp3Adv.wdl>;
//include <Players.wdl>;
//include <items.wdl>;
//include <waffen.wdl>;
//include <Gegner.wdl>;
include <Wetter.wdl>;
include <Effekte.wdl>;
//include <Gewitter.wdl>;
//include <Zauber.wdl>;
//include <Faehigkeiten.wdl>;
//include <menue.wdl>;
//include <quaternion.wdl>;


var Mp3AdvAppHandle;
var VIDEO_SCREEN =  1;
var VIDEO_MODE   = 8;
var VIDEO_DEPTH  = 16;

STRING level_str = <Intro.WMB>;

BMAP splashmap = <logodark.bmp>;
PANEL splashscreen {
	bmap = splashmap;
	flags = refresh,d3d;
}
BMAP splash1 = <Start.bmp>;
PANEL splashscreen1 {
	bmap = splash1;
	flags = refresh,d3d;
}

TEXT show_all
{
	POS_X 900;
	POS_Y 40;
	FONT abra_font;
	STRING "Zustand (%)\n\nTemperatur (C)\n\nAbschuesse\n\nEntkommen\n\nPunkte";
}

BMAP Lade, <Loading.bmp>;
PANEL Loading
{
	BMAP Lade;
	POS_X 0;
	POS_Y 0;
	LAYER 10;
	FLAGS REFRESH,d3d;
}

PANEL Menue
{
	POS_X = 0;
	POS_Y = 100;
	BUTTON 290, 100, butt1z, butt1y, butt1x, Mission, NULL, NULL;	//115
	BUTTON 370, 200, butt2z, butt2y, butt2x, Scor, NULL, NULL;		//305
	BUTTON 450, 300, butt3z, butt3y, butt3x, Opts, NULL, NULL;		//495
	BUTTON 530, 400, butt4z, butt4y, butt4x, Schluss, NULL, NULL;	//685
}

PANEL Data
{
	POS_X 0;
	POS_Y 0;
//	BMAP anzeige;
//	DIGITS 900, 40, 4, abra_font, 1, Data1;
	DIGITS 860,  40, 4, abra_font, 1, Data2;
	DIGITS 860,  60, 4, abra_font, 1, Data3;
//	DIGITS 900,  41, 4, abra_font, 1, Data4;
	DIGITS 860,  80, 4, abra_font, 1, Data5;
	DIGITS 860, 100, 4, abra_font, 1, Data6;
	DIGITS 860, 120, 4, abra_font, 1, Punkte;
	LAYER 5;
	FLAGS REFRESH, OVERLAY;
}

PANEL Optionen
{
	POS_X = 0;
	POS_Y = 0;
	BUTTON 300, 316, optx1, optx1, optx1, NULL, NULL, NULL;
	BUTTON 300, 371, optx2, optx2, optx2, NULL, NULL, NULL;
	BUTTON 300, 426, optx3, optx3, optx3, NULL, NULL, NULL;
	BUTTON 300, 481, optx4, optx4, optx4, NULL, NULL, NULL;
	BUTTON 530, 685, optz, opty, optx, Zurueck, NULL, NULL;

	BUTTON 500, 316, leftz, lefty, leftx, minus_schw, NULL, NULL;
	BUTTON 500, 371, leftz, lefty, leftx, minus_laut, NULL, NULL;
	BUTTON 500, 426, leftz, lefty, leftx, minus_maus, NULL, NULL;
	BUTTON 500, 481, leftz, lefty, leftx, Aufloesung, NULL, NULL;

	BUTTON 725, 316, rightz, righty, rightx, plus_schw,  NULL, NULL;
	BUTTON 725, 371, rightz, righty, rightx, plus_laut,  NULL, NULL;
	BUTTON 725, 426, rightz, righty, rightx, plus_maus,  NULL, NULL;
	BUTTON 725, 481, rightz, righty, rightx, Aufloesung, NULL, NULL;
}
Panel Highscore
{
	POS_X = 0;
	POS_Y = 0;
	BUTTON 530, 685, optz, opty, optx, Zurueck, NULL, NULL;
}

// schw, Laut, Maus
PANEL Schwere1
{
	POS_X = 550;
	POS_Y = 316;
	BMAP = schw1;
	FLAGS REFRESH, VISIBLE;
}
PANEL Schwere2
{
	POS_X = 550;
	POS_Y = 316;
	BMAP = schw2;
	FLAGS REFRESH, VISIBLE;
}
PANEL Schwere3
{
	POS_X = 550;
	POS_Y = 316;
	BMAP = schw3;
	FLAGS REFRESH, VISIBLE;
}

PANEL Vol1
{
	POS_X = 550;
	POS_Y = 371;
	BMAP = Laut1;
	FLAGS REFRESH, VISIBLE;
}
PANEL Vol2
{
	POS_X = 550;
	POS_Y = 371;
	BMAP = Laut2;
	FLAGS REFRESH, VISIBLE;
}
PANEL Vol3
{
	POS_X = 550;
	POS_Y = 371;
	BMAP = Laut3;
	FLAGS REFRESH, VISIBLE;
}
PANEL Vol4
{
	POS_X = 550;
	POS_Y = 371;
	BMAP = Laut4;
	FLAGS REFRESH, VISIBLE;
}

PANEL Mausa1
{
	POS_X = 550;
	POS_Y = 426;
	BMAP = Maus1;
	FLAGS REFRESH, VISIBLE;
}
PANEL Mausa2
{
	POS_X = 550;
	POS_Y = 426;
	BMAP = Maus2;
	FLAGS REFRESH, VISIBLE;
}
PANEL Mausa3
{
	POS_X = 550;
	POS_Y = 426;
	BMAP = Maus3;
	FLAGS REFRESH, VISIBLE;
}
PANEL Resol1
{
	POS_X = 550;
	POS_Y = 481;
	BMAP = Res1;
	FLAGS REFRESH, VISIBLE;
}
PANEL Resol2
{
	POS_X = 550;
	POS_Y = 481;
	BMAP = Res2;
	FLAGS REFRESH, VISIBLE;
}

PANEL Status
{
	POS_X = 0;
	POS_Y = 678;
	HBAR = 412, 0, 200, habba, 1, Hitze;
//	WINDOW = 412, 0, 200, 20, habba, 0, 0;
	LAYER 5;
	FLAGS REFRESH, VISIBLE;
}

PANEL Background
{
	POS_X = 400;
	POS_Y = 666;
	BMAP = htgrnd;
	LAYER 4;
	FLAGS REFRESH, OVERLAY;
}

TEXT Punkteliste
{
	POS_X 400;
	POS_Y 200;
	FONT abra_font;
	STRING "Rang    Name         Punkte\n\n  1\n\n  2\n\n  3\n\n  4\n\n  5\n\n  6\n\n  7\n\n  8\n\n  9\n\n 10";
}
TEXT pl1
{
	POS_X 464;
	POS_Y 220;
	FONT abra_font;
	STRING Platz1;
}
TEXT pl2
{
	POS_X 464;
	POS_Y 240;
	FONT abra_font;
	STRING Platz2;
}
TEXT pl3
{
	POS_X 464;
	POS_Y 260;
	FONT abra_font;
	STRING Platz3;
}
TEXT pl4
{
	POS_X 464;
	POS_Y 280;
	FONT abra_font;
	STRING Platz4;
}
TEXT pl5
{
	POS_X 464;
	POS_Y 300;
	FONT abra_font;
	STRING Platz5;
}
TEXT pl6
{
	POS_X 464;
	POS_Y 320;
	FONT abra_font;
	STRING Platz6;
}
TEXT pl7
{
	POS_X 464;
	POS_Y 340;
	FONT abra_font;
	STRING Platz7;
}
TEXT pl8
{
	POS_X 464;
	POS_Y 360;
	FONT abra_font;
	STRING Platz8;
}
TEXT pl9
{
	POS_X 464;
	POS_Y 380;
	FONT abra_font;
	STRING Platz9;
}
TEXT pl10
{
	POS_X 464;
	POS_Y 400;
	FONT abra_font;
	STRING Platz10;
}
PANEL Score_Data
{
	POS_X 400;
	POS_Y 200;
	DIGITS 176,   20, 4, abra_font, 1, Punktz[0];
	DIGITS 176,   40, 4, abra_font, 1, Punktz[1];
	DIGITS 176,   60, 4, abra_font, 1, Punktz[2];
	DIGITS 176,   80, 4, abra_font, 1, Punktz[3];
	DIGITS 176,  100, 4, abra_font, 1, Punktz[4];
	DIGITS 176,  120, 4, abra_font, 1, Punktz[5];
	DIGITS 176,  140, 4, abra_font, 1, Punktz[6];
	DIGITS 176,  160, 4, abra_font, 1, Punktz[7];
	DIGITS 176,  180, 4, abra_font, 1, Punktz[8];
	DIGITS 176,  200, 4, abra_font, 1, Punktz[9];
	LAYER 5;
	FLAGS REFRESH, OVERLAY;
}


//MUSIC tune, <wishmaster.mid>;

//var Mp3AdvAppHandle;
//var quadd;

function Ende()
{
	IF ((Statta == 0) && (Pausierung == 0)) { NODAMAGE = OFF; LOWHEAT = OFF; Pausierung = 0; GAME_SAVE ("Save", NULL, SV_VARS + SV_STRINGS); Exit; } ELSE {
	IF (Pausierung == 0) {
		GAME_SAVE ("Save", NULL, SV_ALL - SV_INFO);
		Pausierung = 1;
		Statta = 0;
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
		StopSong(sng1);
		StopSong(sng2);
		StopSong(sng3);
		StopSong(sng4);
		StopSong(sng5);
		Background.VISIBLE = OFF;
		Status.VISIBLE = OFF;
		Data.VISIBLE = OFF;
		show_all.VISIBLE = OFF;
		Loading.VISIBLE = ON;
		WAIT (1);
		LEVEL_LOAD ("Intro.wmb");
		CAMERA.ARC = 60;
		WAIT (1);
		WAITT (8);
		Loading.VISIBLE = OFF;
		Menue.VISIBLE= ON;
		Logofw.VISIBLE = ON;
		MOUSE_MODE = 2;
		Maeusli();
	} ELSE {
		Loading.VISIBLE = ON;
		WAIT (1);
		GAME_LOAD ("save", NULL);
		WAIT (1);
		show_all.VISIBLE = ON;
		Pausierung = 0;
	}
	}
}
on_Esc = Ende;

function plus_schw()
{ Schwierigkeitsgrad += 1; IF (Schwierigkeitsgrad > 3) { Schwierigkeitsgrad = 1; } }
function minus_schw()
{ Schwierigkeitsgrad -= 1; IF (Schwierigkeitsgrad < 1) { Schwierigkeitsgrad = 3; } }

function plus_laut()
{ Lautstaerke += 1; IF (Lautstaerke > 3) { Lautstaerke = 0; } }
function minus_laut()
{ Lautstaerke -= 1; IF (Lautstaerke < 0) { Lautstaerke = 3; } }

function plus_maus()
{ Mausempfindlichkeit += 5; IF (Mausempfindlichkeit > 20) { Mausempfindlichkeit = 10; } }
function minus_maus()
{ Mausempfindlichkeit -= 5; IF (Mausempfindlichkeit < 10) { Mausempfindlichkeit = 20; } }


function Schluss() { WAITT (2); NODAMAGE = OFF; LOWHEAT = OFF; Pausierung = 0; GAME_SAVE ("Save", NULL, SV_VARS + SV_STRINGS); Exit; }

function Zurueck()
{
Optionen.VISIBLE = OFF;
Menue.VISIBLE = ON;
Stattax2 = 0;
schwere1.VISIBLE = OFF;
schwere2.VISIBLE = OFF;
schwere3.VISIBLE = OFF;
Vol1.VISIBLE = OFF;
Vol2.VISIBLE = OFF;
Vol3.VISIBLE = OFF;
Vol4.VISIBLE = OFF;
Mausa1.VISIBLE = OFF;
Mausa2.VISIBLE = OFF;
Mausa3.VISIBLE = OFF;
Resol1.VISIBLE = OFF;
Resol2.VISIBLE = OFF;
	Punkteliste.VISIBLE = OFF;
	Score_Data.VISIBLE = OFF;
	Highscore.VISIBLE = OFF;
	pl1.VISIBLE = OFF;
	pl2.VISIBLE = OFF;
	pl3.VISIBLE = OFF;
	pl4.VISIBLE = OFF;
	pl5.VISIBLE = OFF;
	pl6.VISIBLE = OFF;
	pl7.VISIBLE = OFF;
	pl8.VISIBLE = OFF;
	pl9.VISIBLE = OFF;
	pl10.VISIBLE = OFF;
}

function Opts()
{
Menue.VISIBLE = OFF;
Optionen.VISIBLE = ON;
Stattax2 = 1;
IF (Schwierigkeitsgrad == 1) { Schwere1.VISIBLE = ON; }
IF (Schwierigkeitsgrad == 2) { Schwere2.VISIBLE = ON; }
IF (Schwierigkeitsgrad == 3) { Schwere3.VISIBLE = ON; }
IF (Lautstaerke == 0) { Vol1.VISIBLE = ON; }
IF (Lautstaerke == 1) { Vol2.VISIBLE = ON; }
IF (Lautstaerke == 2) { Vol3.VISIBLE = ON; }
IF (Lautstaerke == 3) { Vol4.VISIBLE = ON; }
IF (Mausempfindlichkeit == 10) { Mausa1.VISIBLE = ON; }
IF (Mausempfindlichkeit == 15) { Mausa2.VISIBLE = ON; }
IF (Mausempfindlichkeit == 20) { Mausa3.VISIBLE = ON; }
IF (Video_Mode == 8) { Resol1.VISIBLE = ON; } ELSE { Resol2.VISIBLE = ON; }

	WHILE (Stattax2 == 1) {
		Sound50 = 16 * Lautstaerke;
		Sound75 = 25 * Lautstaerke;
		Sound100 = 40 * Lautstaerke;
		Sound2500 = 2500 * Lautstaerke;
		IF (Schwierigkeitsgrad == 1) { Schwere1.VISIBLE = ON; Schwere2.VISIBLE = OFF; Schwere3.VISIBLE = OFF; }
		IF (Schwierigkeitsgrad == 2) { Schwere2.VISIBLE = ON; Schwere1.VISIBLE = OFF; Schwere3.VISIBLE = OFF; }
		IF (Schwierigkeitsgrad == 3) { Schwere3.VISIBLE = ON; Schwere1.VISIBLE = OFF; Schwere2.VISIBLE = OFF; }
		IF (Lautstaerke == 0) { Vol1.VISIBLE = ON; Vol2.VISIBLE = OFF; Vol3.VISIBLE = OFF; Vol4.VISIBLE = OFF; }
		IF (Lautstaerke == 1) { Vol2.VISIBLE = ON; Vol1.VISIBLE = OFF; Vol3.VISIBLE = OFF; Vol4.VISIBLE = OFF; }
		IF (Lautstaerke == 2) { Vol3.VISIBLE = ON; Vol1.VISIBLE = OFF; Vol2.VISIBLE = OFF; Vol4.VISIBLE = OFF; }
		IF (Lautstaerke == 3) { Vol4.VISIBLE = ON; Vol1.VISIBLE = OFF; Vol2.VISIBLE = OFF; Vol3.VISIBLE = OFF; }
		IF (Mausempfindlichkeit == 10) { Mausa1.VISIBLE = ON; Mausa2.VISIBLE = OFF; Mausa3.VISIBLE = OFF; }
		IF (Mausempfindlichkeit == 15) { Mausa2.VISIBLE = ON; Mausa1.VISIBLE = OFF; Mausa3.VISIBLE = OFF; }
		IF (Mausempfindlichkeit == 20) { Mausa3.VISIBLE = ON; Mausa1.VISIBLE = OFF; Mausa2.VISIBLE = OFF; }
		IF (Video_Mode == 8) { Resol1.VISIBLE = ON; Resol2. VISIBLE = OFF; } ELSE { Resol1.VISIBLE = OFF; Resol2.VISIBLE = ON; }
	WAIT (1);
	}
}

function Scor()
{
Menue.VISIBLE = OFF;
	Punkteliste.VISIBLE = ON;
	Score_Data.VISIBLE = ON;
	Highscore.VISIBLE = ON;
	pl1.VISIBLE = ON;
	pl2.VISIBLE = ON;
	pl3.VISIBLE = ON;
	pl4.VISIBLE = ON;
	pl5.VISIBLE = ON;
	pl6.VISIBLE = ON;
	pl7.VISIBLE = ON;
	pl8.VISIBLE = ON;
	pl9.VISIBLE = ON;
	pl10.VISIBLE = ON;
Stattax2 = 1;
}
function Scoridori()
{
		Statta = 0;
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
		Background.VISIBLE = OFF;
		Status.VISIBLE = OFF;
		Data.VISIBLE = OFF;
		show_all.VISIBLE = OFF;
		Loading.VISIBLE = ON;
		WAIT (1);
		LEVEL_LOAD ("Intro.wmb");
		CAMERA.ARC = 60;
		WAIT (1);
		WAITT (8);
		Loading.VISIBLE = OFF;
		MOUSE_MODE = 2;
		Maeusli();
	Punkteliste.VISIBLE = ON;
	Score_Data.VISIBLE = ON;
	Highscore.VISIBLE = ON;
	pl1.VISIBLE = ON;
	pl2.VISIBLE = ON;
	pl3.VISIBLE = ON;
	pl4.VISIBLE = ON;
	pl5.VISIBLE = ON;
	pl6.VISIBLE = ON;
	pl7.VISIBLE = ON;
	pl8.VISIBLE = ON;
	pl9.VISIBLE = ON;
	pl10.VISIBLE = ON;
Stattax2 = 1;
}


function Zooom()
{
	WHILE (Statta == 1) {
		CAMERA.ARC -= MICKEY.Z/50 + KEY_FORCE.Y;
		IF (CAMERA.ARC <= 35) { CAMERA.ARC = 35; }
		IF (CAMERA.ARC >= 85) { CAMERA.ARC = 85; }
	WAIT (1);
	}
}

function Mission()
{
Logofw.VISIBLE = OFF;
Menue.VISIBLE= OFF;
XLevel.VISIBLE = OFF;
IF (Video_Mode == 8) { Mission_1.VISIBLE = ON; } ELSE { Mission_2.VISIBLE = ON; }
}

function Level1()
{
WAITT (2);
Klimazone = 1;
Wetterschalter = 0;
MOUSE_MODE = 0;
Loading.VISIBLE = ON;
Logofw.VISIBLE = OFF;
Mission_1.VISIBLE = OFF;
Mission_2.VISIBLE = OFF;
Eisig = OFF;
Eigesapper.VISIBLE = OFF;
WAIT (1);
Data4 = 1;
Pausierung = 0;
Hintergrund.VISIBLE = ON;
LEVEL_LOAD ("Level1.wmb");
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
Menue.VISIBLE = OFF;
show_all.VISIBLE = ON;
Platz = 0;
Hitze = 0;
Zustand = 100;
Data5 = 0;
Data6 = 0;
cam_view = 0;
Punkte = 0;
WAIT (1);
WAITT (8);
Loading.VISIBLE = OFF;
SetPosition(sng1, 0);
PlaySong(sng1, 1);
//PLAYER.PAN = 180;
Statta = 1;
Namensxy();
Zooom();
Data4 = 1;
		IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
}

function Level2()
{
WAITT (2);
Klimazone = 2;
Wetterschalter = 0;
MOUSE_MODE = 0;
Loading.VISIBLE = ON;
WAIT (1);
Data4 = 2;
Hintergrund.VISIBLE = OFF;
LEVEL_LOAD ("Level2.wmb");
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
Menue.VISIBLE = OFF;
Hitze = 0;
Zustand = 100;
Data5 = 0;
Data6 = 0;
WAIT (1);
WAITT (8);
SetPosition(sng2, 0);
PlaySong(sng2, 1);
Loading.VISIBLE = OFF;
Statta = 1;
Data4 = 2;
		IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
}

function Level3()
{
WAITT (2);
Klimazone = 3;
Wetterschalter = 0;
MOUSE_MODE = 0;
Loading.VISIBLE = ON;
WAIT (1);
Data4 = 3;
Hintergrund.VISIBLE = OFF;
LEVEL_LOAD ("Level3.wmb");
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
Menue.VISIBLE = OFF;
Hitze = 0;
Zustand = 100;
Data5 = 0;
Data6 = 0;
WAIT (1);
WAITT (8);
SetPosition(sng3, 0);
PlaySong(sng3, 1);
Loading.VISIBLE = OFF;
Statta = 1;
Data4 = 3;
		IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
}

function Level4()
{
WAITT (2);
Klimazone = 4;
Wetterschalter = 0;
MOUSE_MODE = 0;
Loading.VISIBLE = ON;
WAIT (1);
Data4 = 4;
Hintergrund.VISIBLE = ON;
LEVEL_LOAD ("Level4.wmb");
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
Menue.VISIBLE = OFF;
Hitze = 0;
Zustand = 100;
Data5 = 0;
Data6 = 0;
WAIT (1);
WAITT (8);
SetPosition(sng4, 0);
PlaySong(sng4, 1);
Loading.VISIBLE = OFF;
Statta = 1;
Data4 = 4;
		IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
}

function Farm()
{
WAITT (2);
Klimazone = 1;
Wetterschalter = 0;
MOUSE_MODE = 0;
Loading.VISIBLE = ON;
Logofw.VISIBLE = OFF;
WAIT (1);
Data4 = 10;
Hintergrund.VISIBLE = ON;
LEVEL_LOAD ("Level5.wmb");
		Prop_handle_fw1 = NULL;
		Prop_handle_fw2 = NULL;
		Prop_handle_fw3 = NULL;
		Prop_handle_fw4 = NULL;
		Prop_handle_bf1 = NULL;
		Prop_handle_bf2 = NULL;
		Prop_handle_bf3 = NULL;
		Prop_handle_bf4 = NULL;
Menue.VISIBLE = OFF;
show_all.VISIBLE = ON;
Platz = 0;
Hitze = 0;
Zustand = 100;
Data5 = 0;
Data6 = 0;
cam_view = 0;
Punkte = 0;
WAIT (1);
WAITT (8);
SetPosition(sng5, 0);
PlaySong(sng5, 1);
Loading.VISIBLE = OFF;
Statta = 1;
Namensxy();
Zooom();
Data4 = 10;
		IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
}

function Maeusli()
{
  WHILE (MOUSE_MODE > 0) { 
    MOUSE_POS.X = POINTER.X * Mausempfindlichkeit/10;
    MOUSE_POS.Y = POINTER.Y * Mausempfindlichkeit/10;
    WAIT (1);
  }
}

function init_environment()
{
Mp3AdvAppHandle = dll_open("Mp3AdvDll.dll");
InitMp3Adv();

//	SCENE_MAP = horizon1_map;	// horizon backdrop overlay

	RANDOMIZE();

	FPS_MAX = 50;

	SHADOW_OFFSET = 2;

	DETAIL_SIZE = 15;
//	d3d_fogcolor1.red = 255;
//	d3d_fogcolor1.green = 255;
//	d3d_fogcolor1.blue = 255; // weisser Nebel
//	FOG_COLOR = 1;
//	CAMERA.FOG = 5;
	d3d_lightres = off;
	d3d_autotransparency = on;
//	max_lights = 8;
//	RENDER_INFLATE = 0;

//	CLIP_RANGE = 5000;
//	CLIP_FACTOR = 1;
	CLIP_SIZE = 1;

//	CLIP_RANGE = 15000;
	CLIP_PARTICLES = 1;
	CAMERA.CLIP_NEAR = 10;
	CAMERA.CLIP_FAR  = 15000;

	CAMERA.FOG_START = 0.6 * CAMERA.CLIP_FAR;
	CAMERA.FOG_END = 0.9 * CAMERA.CLIP_FAR;
	FOG_COLOR = 1;
//	CAMERA.FOG = 100;

//	SCENE_NOFILTER = OFF;

	FLOOR_RANGE = 2000;

	SKY_SPEED.X = 0;
	SKY_SPEED.Y = 0;
	CLOUD_SPEED.X = 0;
	CLOUD_SPEED.Y = 0;

//	SKY_SCALE = 1;
//	SKY_CURVE = 1;

//	SCENE_FIELD = 360;
//	SCENE_ANGLE.TILT = -30;
	SUN_LIGHT = 10;

//	SKY_CLIP = SCENE_ANGLE.TILT;

//	MIDI_VOL = 30;
//	PLAY_SONG tune, 30;
	sng1 = LoadSongSlot("Lied1.mp3");
	sng2 = LoadSongSlot("Lied2.mp3");
	sng3 = LoadSongSlot("Lied3.mp3");
	sng4 = LoadSongSlot("Lied4.mp3");
	sng5 = LoadSongSlot("Lied5.mp3");
IF (Lautstaerke == 0) {
	SetVolume(sng1, 0);
	SetVolume(sng2, 0);
	SetVolume(sng3, 0);
	SetVolume(sng4, 0);
	SetVolume(sng5, 0);
}
IF (Lautstaerke == 1) {
	SetVolume(sng1, 5000);
	SetVolume(sng2, 5000);
	SetVolume(sng3, 5000);
	SetVolume(sng4, 5000);
	SetVolume(sng5, 5000);
}
IF (Lautstaerke == 2) {
	SetVolume(sng1, 7500);
	SetVolume(sng2, 7500);
	SetVolume(sng3, 7500);
	SetVolume(sng4, 7500);
	SetVolume(sng5, 7500);
}
IF (Lautstaerke == 3) {
	SetVolume(sng1, 10000);
	SetVolume(sng2, 10000);
	SetVolume(sng3, 10000);
	SetVolume(sng4, 10000);
	SetVolume(sng5, 10000);
}
//	PlaySong(sng1, 1);
//	scene();
//	god_of_war();
//	Gegnerstatusanzeige();
//	Pflanzenverzerrung();
}

/////////////////////////////////////////////////////////////////
// Main Funktion
FUNCTION MAIN()
{
	TEX_SHARE = ON;

	splashscreen.pos_x = (screen_size.x - bmap_width(splashmap))/2;
	splashscreen.pos_y = (screen_size.y - bmap_height(splashmap))/2;
	splashscreen.alpha = 0;
	splashscreen1.pos_x = (screen_size.x - bmap_width(splash1))/2;
	splashscreen1.pos_y = (screen_size.y - bmap_height(splash1))/2;
	splashscreen1.alpha = 0;

	splashscreen1.visible = on;

	WAITT (40);

	splashscreen1.visible = off;
	splashscreen.visible = on;


	init_environment();
	level_load(level_str);
	FREEZE_MODE = 1;

	WAITT (30);
  	splashscreen.visible = off;
	BMAP_PURGE (splashmap);

IFDEF CAPS_FLARE;
//	lensflare_start();
ENDIF;

	FREEZE_MODE = 0;

	GAME_LOAD ("save", NULL);

Logofw.VISIBLE = ON;

MOUSE_MODE = 2;
MOUSE_MAP = Maus;

schwere1.VISIBLE = OFF;
schwere2.VISIBLE = OFF;
schwere3.VISIBLE = OFF;
Vol1.VISIBLE = OFF;
Vol2.VISIBLE = OFF;
Vol3.VISIBLE = OFF;
Vol4.VISIBLE = OFF;
Mausa1.VISIBLE = OFF;
Mausa2.VISIBLE = OFF;
Mausa3.VISIBLE = OFF;
Resol1.VISIBLE = OFF;
Resol2.VISIBLE = OFF;
Status.VISIBLE = OFF;

		Sound50 = 16 * Lautstaerke;
		Sound75 = 25 * Lautstaerke;
		Sound100 = 40 * Lautstaerke;
IF (Lautstaerke == 0) {
	SetVolume(sng1, 0);
	SetVolume(sng2, 0);
	SetVolume(sng3, 0);
	SetVolume(sng4, 0);
	SetVolume(sng5, 0);
}
IF (Lautstaerke == 1) {
	SetVolume(sng1, 5000);
	SetVolume(sng2, 5000);
	SetVolume(sng3, 5000);
	SetVolume(sng4, 5000);
	SetVolume(sng5, 5000);
}
IF (Lautstaerke == 2) {
	SetVolume(sng1, 7500);
	SetVolume(sng2, 7500);
	SetVolume(sng3, 7500);
	SetVolume(sng4, 7500);
	SetVolume(sng5, 7500);
}
IF (Lautstaerke == 3) {
	SetVolume(sng1, 10000);
	SetVolume(sng2, 10000);
	SetVolume(sng3, 10000);
	SetVolume(sng4, 10000);
	SetVolume(sng5, 10000);
}

Maeusli();

Wetter();
Menue.VISIBLE = ON;
}


/////////////////////////////////////////////////////////////////
// Startscreen
WINDOW WINSTART
{
	TITLE			"DragonQuest";
	SIZE			300, 600; # 135;
	MODE			IMAGE;	//STANDARD;
	BG_COLOR		RGB(240,240,240);
	FRAME			FTYP1,0,0,480,320;
	BUTTON		BUTTON_QUIT,SYS_DEFAULT,"Abort",400,288,72,24;
	TEXT_STDOUT	"Arial",RGB(0,0,0),10,10,460,280;
	PICTURE < logo.bmp > , OPAQUE, 0, 0;
}



function Fliegererschaffung()
{
var Timer;
var x1;
var x2;
var x3;
var x4;
var x5;
Formation = 250 + Random(250);
	WHILE (1) {
		Timer -= (0.3 + Schwierigkeitsgrad/3 + Data4/6) * TIME;
		Formation -= (0.5 + Schwierigkeitsgrad/6) * TIME;
		IF (Data4 >= 10) { Data4 += (10/4800) * TIME; }
		IF (Timer <= 0) {
			IF (Formation > 0) {
				IF (INT(Random(2)) == 0) {
					IF (Data4 < 10) { ENT_CREATE (fw, XVECTOR, Flieger_fw); Timer = 90 + Random(30);
						} ELSE {  ENT_CREATE (hu, XVECTOR, Huhn); Timer = 90 + Random(30); }
				} ELSE {
					IF (Data4 < 10) { ENT_CREATE (bf, XVECTOR, Flieger_bf); Timer = 90 + Random(30);
						} ELSE {  ENT_CREATE (hu, XVECTOR, Huhn); Timer = 90 + Random(30); }
				}
			} ELSE {
				IF (INT(Random(2)) == 0) {
					x1.X = -13000;
					x1.Y = Random(3000) - 1500;
					x1.Z = Random(1000) + 1000;
					VEC_SET (x2.X, x1.X);	x2.X -= 400; x2.Y +=  600;
					VEC_SET (x3.X, x1.X);	x3.X -= 400; x3.Y -=  600;
					VEC_SET (x4.X, x1.X);	x4.X -= 800; x4.Y += 1300;
					VEC_SET (x5.X, x1.X);	x5.X -= 800; x5.Y -= 1300;
					IF (Data4 < 10) {
						ENT_CREATE (fw, x1, Flieger_fw_Form);
						ENT_CREATE (fw, x2, Flieger_fw_Form);
						ENT_CREATE (fw, x3, Flieger_fw_Form);
						ENT_CREATE (bf, x4, Flieger_bf_Form);
						ENT_CREATE (bf, x5, Flieger_bf_Form); Timer = 220 + Random(30);
					} ELSE {
						ENT_CREATE (hu, x1, Huhn_Form);
						ENT_CREATE (hu, x2, Huhn_Form);
						ENT_CREATE (hu, x3, Huhn_Form);
						ENT_CREATE (hu, x4, Huhn_Form);
						ENT_CREATE (hu, x5, Huhn_Form); Timer = 220 + Random(30);
					}
						Formation = 1200 + Random(200);
				} ELSE {
					x1.X = -13000;
					x1.Y = Random(3000) - 1500;
					x1.Z = Random(1000) + 1000;
					VEC_SET (x2.X, x1.X);	x2.X -= 400; x2.Y +=  600;
					VEC_SET (x3.X, x1.X);	x3.X -= 400; x3.Y -=  600;
					VEC_SET (x4.X, x1.X);	x4.X -= 100; x4.Y += 1300;
					VEC_SET (x5.X, x1.X);	x5.X -= 100; x5.Y -= 1300;
					IF (Data4 < 10) {
						ENT_CREATE (fw, x1, Flieger_fw_Form);
						ENT_CREATE (bf, x2, Flieger_bf_Form);
						ENT_CREATE (bf, x3, Flieger_bf_Form);
						ENT_CREATE (fw, x4, Flieger_fw_Form);
						ENT_CREATE (fw, x5, Flieger_fw_Form); Timer = 220 + Random(30);
					} ELSE {
						ENT_CREATE (hu, x1, Huhn_Form);
						ENT_CREATE (hu, x2, Huhn_Form);
						ENT_CREATE (hu, x3, Huhn_Form);
						ENT_CREATE (hu, x4, Huhn_Form);
						ENT_CREATE (hu, x5, Huhn_Form); Timer = 220 + Random(30);
					}
					Formation = 1200 + Random(200);
				}
			}
		}
	WAIT (1);
	}
}

ACTION Bom()
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.UNLIT = ON;
MY.AMBIENT = 100;
MY.ALPHA = 55;
MY.BRIGHT = ON;
MY.FACING = ON;
MY.X += Random(40)-20;
MY.Y += Random(40)-20;
MY.Z += Random(40)-20;
MY.ROLL = Random(360);
MY.PASSABLE = ON;
	MY.SCALE_X = 0.2 + Random(4)/20;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	WHILE (MY.ALPHA > 4) {
		MY.ALPHA -= 3.125 * TIME;
		MY.FRAME += TIME;
		MY.SCALE_X += 0.2 * TIME;
		MY.SCALE_Y = MY.SCALE_X;
		MY.SCALE_Z = MY.SCALE_X;
	WAIT (1);
	}
ENT_REMOVE(MY);
}

ACTION Boom()
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.UNLIT = ON;
MY.AMBIENT = 100;
MY.ALPHA = 55;
MY.BRIGHT = ON;
MY.FACING = ON;
MY.X += Random(40)-20;
MY.Y += Random(40)-20;
MY.Z += Random(40)-20;
MY.ROLL = Random(360);
MY.PASSABLE = ON;
	MY.SCALE_X = 0.5 + Random(4)/20;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	WHILE (MY.ALPHA > 4) {
		MY.ALPHA -= 3.125 * TIME;
		MY.FRAME += TIME;
		MY.SCALE_X += 0.2 * TIME;
		MY.SCALE_Y = MY.SCALE_X;
		MY.SCALE_Z = MY.SCALE_X;
	WAIT (1);
	}
ENT_REMOVE(MY);
}

ACTION Booom()
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.UNLIT = ON;
MY.AMBIENT = 100;
MY.ALPHA = 55;
MY.BRIGHT = ON;
MY.FACING = ON;
MY.X += Random(80)-40;
MY.Y += Random(80)-40;
MY.Z += Random(80)-40;
MY.ROLL = Random(360);
MY.PASSABLE = ON;
	MY.SCALE_X = 1 + Random(4)/10;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	WHILE (MY.ALPHA > 4) {
		MY.ALPHA -= 3.125 * TIME;
		MY.FRAME += TIME;
		MY.SCALE_X += 0.4 * TIME;
		MY.SCALE_Y = MY.SCALE_X;
		MY.SCALE_Z = MY.SCALE_X;
	WAIT (1);
	}
ENT_REMOVE(MY);
}

ACTION Boooom()
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.UNLIT = ON;
MY.AMBIENT = 100;
MY.ALPHA = 55;
MY.BRIGHT = ON;
MY.FACING = ON;
MY.X += Random(280)-140;
MY.Y += Random(280)-140;
MY.Z += Random(280)-140;
MY.ROLL = Random(360);
MY.PASSABLE = ON;
	MY.SCALE_X = 1.75 + Random(6)/5;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	WHILE (MY.ALPHA > 4) {
		MY.ALPHA -= 3.125 * TIME;
		MY.FRAME += TIME;
		MY.SCALE_X += 0.6 * TIME;
		MY.SCALE_Y = MY.SCALE_X;
		MY.SCALE_Z = MY.SCALE_X;
	WAIT (1);
	}
ENT_REMOVE(MY);
}

function Runtersapper()
{
var TIMER;
var Vektor;

Eigesapper.VISIBLE = ON;
Eigesapper.ALPHA = 80;
Eigesapper.SCALE_X = 0.1;
Eigesapper.SCALE_Y = Eigesapper.SCALE_X;
Eigesapper.SCALE_Z = Eigesapper.SCALE_X;
Vektor.X = Random(10)+20;
Vektor.Y = Random(20)-10;
Vektor.Z = Random(20)-10;
	WHILE (TIMER < 75) {
		VEC_SET (Eigesapper.X, Vektor.X);
		Vektor.Z -= 0.1 * TIME;
		TIMER += 0.8 * TIME;
		Eigesapper.ALPHA -= 0.8 * TIME;
	WAIT (1);
	}
Eigesapper.VISIBLE = OFF;
}


function Kollision()
{
var abstand;
MY._Treffer = 20;
IF (EVENT_TYPE == EVENT_BLOCK) { CREATE ("Krater.mdl", MY.X, Krater2); }
	IF (PLAYER == NULL) { RETURN; } ELSE {
		IF (NODAMAGE == ON) { RETURN; }
		abstand = VEC_DIST (PLAYER.X, MY.X);
		IF (abstand < 600) { Zustand -= (800-abstand)/10; }
	}
}

function Kollision2()
{
var abstand;
var explos = 10;
var expos;
IF (EVENT_TYPE == EVENT_BLOCK) { CREATE ("Krater.mdl", MY.X, Krater); }
	IF (PLAYER == NULL) { RETURN; } ELSE {
		VEC_SET (expos.X, MY.X);
		MY._Treffer = 1;
		IF (NODAMAGE == OFF) {
			abstand = VEC_DIST (PLAYER.X, MY.X);
			IF (abstand < 600) { Zustand -= (800-abstand)/10;
				IF ((Data4 >= 10) && (Eigesapper.VISIBLE == OFF)) { Eisig = ON; }
			}
		}
	}
	PLAY_SOUND (explo1, Sound75);
	IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, expos.X, Miniteile); }
	IF (Int(Random(2)) == 0) { ENT_CREATE (kt2, expos.X, Miniteile); }
		WHILE (explos > 0) {
			MY.INVISIBLE = ON;
			ENT_CREATE (Explosion, expos, Boooom); explos -= 1;
		WAIT (1);
		}
ENT_REMOVE(MY); RETURN;
}


function Federflug()
{
var drift;
var speed_n_save;
var drehung;
	MY.SCALE_X = 1.75 + Random(6)/5;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;
VEC_ADD (MY.X, YOU.X);
speed_n_save.X = Random(20)+20;
speed_n_save.Y = Random(10)-5;
MY.PAN = Random(360);
drehung.TILT = -speed_n_save.X/5;
drehung.ROLL = -speed_n_save.Y/5;


MY.PASSABLE = ON;

	WHILE (MY.Z > 0) {
			IF (speed_n_save.Z > -20) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 0.92; }
			MY.PAN += drehung.PAN;
			MY.TILT += drehung.TILT;
			MY.ROLL += drehung.ROLL;

		drift.X = speed_n_save.X * TIME;
		drift.Y = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(NULLVECTOR, drift);
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

function Miniteile()
{
var drift;
var speed_n_save;
var drehung;
VEC_ADD (MY.X, YOU.X);
speed_n_save.X = Random(20)+10;
speed_n_save.Y = Random(20)-10;
speed_n_save.Z = Random(20)+20;
MY.PAN = Random(360);
drehung.TILT = -speed_n_save.X/10;
drehung.ROLL = -speed_n_save.Y/10;
MY.SCALE_Y = 0.5;
MY.SCALE_X = 0.5;
MY.SCALE_Z = 0.5;


MY.PASSABLE = ON;

	WHILE (MY.Z > 0) {
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
			MY.PAN += drehung.PAN;
			MY.TILT += drehung.TILT;
			MY.ROLL += drehung.ROLL;

		drift.X = speed_n_save.X * TIME;
		drift.Y = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(NULLVECTOR, drift);
		ENT_CREATE (Explosion, MY.X, Bom);
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

function Kleinteile()
{
var drift;
var speed_n_save;
var drehung;
VEC_ADD (MY.X, YOU.X);
speed_n_save.X = Random(80)+80;
speed_n_save.Y = Random(40)-20;
MY.PAN = Random(360);
drehung.TILT = -speed_n_save.X/10;
drehung.ROLL = -speed_n_save.Y/10;


MY.PASSABLE = ON;

	WHILE (MY.Z > 0) {
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
			MY.PAN += drehung.PAN;
			MY.TILT += drehung.TILT;
			MY.ROLL += drehung.ROLL;

		drift.X = speed_n_save.X * TIME;
		drift.Y = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(NULLVECTOR, drift);
		Effect (smoke2_effect, 3, MY.X, NULLVECTOR);
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

function Grossteile()
{
var drift;
var speed_n_save;
var drehung;
MY.SKIN = YOU.SKIN;
VEC_ADD (MY.X, YOU.X);
speed_n_save.X = Random(80)+80;
speed_n_save.Y = Random(40)-20;
speed_n_save.Z = Random(20)-5;
MY.PAN = Random(360);
drehung.TILT = -speed_n_save.X/10;
drehung.ROLL = -speed_n_save.Y/10;


MY.PASSABLE = ON;

	WHILE (MY.Z > 0) {
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
			MY.PAN += drehung.PAN;
			MY.TILT += drehung.TILT;
			MY.ROLL += drehung.ROLL;

		drift.X = speed_n_save.X * TIME;
		drift.Y = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(NULLVECTOR, drift);
		ENT_CREATE (Explosion, MY.X, Boom);
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

function Prop()
{
var du;
var winkel;
du = YOU;
MY.PAN = YOU.PAN;
MY.PASSABLE = ON;

MY.SKIN = YOU.SKIN;

MY.SCALE_Y = 1;
MY.SCALE_X = 1;
MY.SCALE_Z = 1;

	WHILE (YOU != NULL) {
		YOU = du;
		VEC_FOR_VERTEX (MY.X, YOU, 13);
		MY.X += 8 + YOU._Framespeed * TIME;
		MY.Z += YOU._Fallspeed * TIME;
		VEC_SET (MY.PAN, YOU.PAN);
		winkel.ROLL += 200 * TIME;
		IF (winkel.ROLL > 360) { winkel.ROLL -= 360; }
		ANG_ROTATE (MY.PAN, winkel.PAN);
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

function Bombah()
{
var du;
var abwurf;
var speed_n_save;
var force;
var drift;
du = YOU;
IF (Data4 < 10) { abwurf = (Random(2000) + 3000) * -1; } ELSE { abwurf = (Random(2000) + 1000) * -1; }
MY.PAN = YOU.PAN;
MY.PASSABLE = ON;
MY.SHADOW = ON;

MY._charakter = 50;

MY.SCALE_Y = 1;
MY.SCALE_X = 1;
MY.SCALE_Z = 1;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision2;

	WHILE (1) {
		YOU = du;
		IF (MY._Treffer == 1) { MY.PASSABLE = ON; speed_n_save.X = 0; speed_n_save.Z = 0; }
		IF (MY._bombenx == 0) {
			IF ((MY.X > abwurf) && (YOU._Treffer < 5)) { MY._Bombenx = 1; }
			IF ((MY.X < abwurf) && (YOU._Treffer >= 5)) { MY._Bombenx = 2; }
		}
		IF (MY._Bombenx == 2) { ENT_REMOVE(MY); RETURN; }
		IF (MY._Bombenx == 0) {
			speed_n_save.X = -YOU._Framespeed;
			IF (Data4 < 10) { VEC_FOR_VERTEX (MY.X, YOU, 177); } ELSE { VEC_FOR_VERTEX (MY.X, YOU, 22); }
			MY.X += 8 + YOU._Framespeed * TIME;
			MY.Z += YOU._Fallspeed * TIME;
			VEC_SET (MY.PAN, YOU.PAN);
		} ELSE {
			IF (MY.Z > 800) { MY.PASSABLE = ON; } ELSE { MY.PASSABLE = OFF; }
			IF (MY._Treffer == 1) { MY.PASSABLE = ON; speed_n_save.X = 0; speed_n_save.Z = 0; }
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
			force.X = speed_n_save.X * TIME;
			drift.Z = speed_n_save.Z * TIME;
			MY.TILT += 2 * TIME;

			MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
			RESULT = ENT_MOVE(force, drift);
			Effect (smoke2_effect, 3, MY.X, NULLVECTOR);
		}
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}


ACTION Flieger_fw
{
var force;
var drift;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
var s_pos_1;
var s_pos_2;
var s_pos_3;
var explos = 10;
var soundsave;
MY.METAL = ON;
MY.SHADOW = ON;

MY.SKIN = INT(Random(6));

MY.X = - 15000;
MY.Y = Random(6000) - 3000;
MY.Z = Random(1000) + 1000;

MY._charakter = 1;


MY.PAN = 180;
speed_n_save.X = -45-Random(10);
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;


ENT_CREATE (fwprop, MY.X, Prop);

	IF (Prop_handle_fw1 == NULL) { Prop_handle_fw1 = SND_PLAY (sfw190, Sound50, 0); soundsave = 1; GOTO Weiter; }
	IF (Prop_handle_fw2 == NULL) { Prop_handle_fw2 = SND_PLAY (sfw190, Sound50, 0); soundsave = 2; GOTO Weiter; }
	IF (Prop_handle_fw3 == NULL) { Prop_handle_fw3 = SND_PLAY (sfw190, Sound50, 0); soundsave = 3; GOTO Weiter; }
	IF (Prop_handle_fw4 == NULL) { Prop_handle_fw4 = SND_PLAY (sfw190, Sound50, 0); soundsave = 4; GOTO Weiter; }

Weiter:

	WHILE (MY._Treffer < 9) {


		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 5) {
			MY.ROLL += MY._SPEED_Y/120 * TIME;
			MY.TILT += MY._SPEED_X/120 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}
		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_1.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_1.X, Kleinteile); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_2.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_2.X, Kleinteile); } }
		IF ((MY._Treffer == 5) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_3.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_3.X, Kleinteile); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1000 + Schwierigkeitsgrad*2 + Data4/2; }
			IF (MY._Treffer > 0) { VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);
			}
			IF (MY._Treffer > 2) { VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);
			}
			IF (MY._Treffer > 4) { VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
			}
	WAIT (1);
	}
	IF (soundsave == 1) { SND_STOP (Prop_handle_fw1); Prop_handle_fw1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_fw2); Prop_handle_fw2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_fw3); Prop_handle_fw3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_fw4); Prop_handle_fw4 = NULL; soundsave = 0; }
	PLAY_SOUND (explo1, Sound75);
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt1, schaden_2.X, Grossteile); }
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt3, schaden_3.X, Grossteile); }
	WHILE (explos > 0) {
		MY.INVISIBLE = ON;
		ENT_CREATE (Explosion, MY.X, Boooom); explos -= 1;
			VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);

			VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);

			VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
	WAIT (1);
}
Ende:
IF (MY._Treffer < 5) { Data6 += 1; }
	IF (soundsave == 1) { SND_STOP (Prop_handle_fw1); Prop_handle_fw1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_fw2); Prop_handle_fw2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_fw3); Prop_handle_fw3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_fw4); Prop_handle_fw4 = NULL; soundsave = 0; }
ENT_REMOVE(MY); RETURN;
}

ACTION Flieger_bf
{
var force;
var drift;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
var s_pos_1;
var s_pos_2;
var s_pos_3;
var explos = 10;
var soundsave;
MY.METAL = ON;
MY.SHADOW = ON;

MY.SKIN = INT(Random(6));

MY.X = - 15000;
MY.Y = Random(6000) - 3000;
MY.Z = Random(1000) + 1000;

MY._charakter = 2;

MY.PAN = 180;
speed_n_save.X = -55-Random(10);
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;

ENT_CREATE (bfprop, MY.X, Prop);
ENT_CREATE (Bombe, MY.X, Bombah);

	IF (Prop_handle_bf1 == NULL) { Prop_handle_bf1 = SND_PLAY (sme109, Sound50, 0); soundsave = 1; GOTO Weiter; }
	IF (Prop_handle_bf2 == NULL) { Prop_handle_bf2 = SND_PLAY (sme109, Sound50, 0); soundsave = 2; GOTO Weiter; }
	IF (Prop_handle_bf3 == NULL) { Prop_handle_bf3 = SND_PLAY (sme109, Sound50, 0); soundsave = 3; GOTO Weiter; }
	IF (Prop_handle_bf4 == NULL) { Prop_handle_bf4 = SND_PLAY (sme109, Sound50, 0); soundsave = 4; GOTO Weiter; }

Weiter:

	WHILE (MY._Treffer < 11) {


		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 5) {
			MY.ROLL += MY._SPEED_Y/240 * TIME;
			MY.TILT += MY._SPEED_X/240 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}
		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_1.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_1.X, Kleinteile); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_2.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_2.X, Kleinteile); } }
		IF ((MY._Treffer == 5) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_3.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_3.X, Kleinteile); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1000 + Schwierigkeitsgrad*2 + Data4/2; }
			IF (MY._Treffer > 0) { VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);
			}
			IF (MY._Treffer > 2) { VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);
			}
			IF (MY._Treffer > 4) { VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
			}
	WAIT (1);
	}
	IF (soundsave == 1) { SND_STOP (Prop_handle_bf1); Prop_handle_bf1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_bf2); Prop_handle_bf2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_bf3); Prop_handle_bf3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_bf4); Prop_handle_bf4 = NULL; soundsave = 0; }
	PLAY_SOUND (explo1, Sound75);
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt2, schaden_2.X, Grossteile); }
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt4, schaden_3.X, Grossteile); }
	WHILE (explos > 0) {
		MY.INVISIBLE = ON;
		ENT_CREATE (Explosion, MY.X, Boooom); explos -= 1;
			VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);

			VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);

			VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
	WAIT (1);
}
Ende:
IF (MY._Treffer < 5) { Data6 += 1; }
	IF (soundsave == 1) { SND_STOP (Prop_handle_bf1); Prop_handle_bf1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_bf2); Prop_handle_bf2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_bf3); Prop_handle_bf3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_bf4); Prop_handle_bf4 = NULL; soundsave = 0; }
ENT_REMOVE(MY); RETURN;
}






ACTION Flieger_fw_Form
{
var force;
var drift;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
var s_pos_1;
var s_pos_2;
var s_pos_3;
var explos = 10;
var soundsave;
MY.METAL = ON;
MY.SHADOW = ON;

MY.SKIN = INT(Random(6));

MY._charakter = 3;

MY.PAN = 180;
speed_n_save.X = -30;
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;

ENT_CREATE (fwprop, MY.X, Prop);

	IF (Prop_handle_fw1 == NULL) { Prop_handle_fw1 = SND_PLAY (sfw190, Sound50, 0); soundsave = 1; GOTO Weiter; }
	IF (Prop_handle_fw2 == NULL) { Prop_handle_fw2 = SND_PLAY (sfw190, Sound50, 0); soundsave = 2; GOTO Weiter; }
	IF (Prop_handle_fw3 == NULL) { Prop_handle_fw3 = SND_PLAY (sfw190, Sound50, 0); soundsave = 3; GOTO Weiter; }
	IF (Prop_handle_fw4 == NULL) { Prop_handle_fw4 = SND_PLAY (sfw190, Sound50, 0); soundsave = 4; GOTO Weiter; }

Weiter:

	WHILE (MY._Treffer < 9) {


		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 5) {
			MY.ROLL += MY._SPEED_Y/240 * TIME;
			MY.TILT += MY._SPEED_X/240 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}
		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_1.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_1.X, Kleinteile); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_2.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_2.X, Kleinteile); } }
		IF ((MY._Treffer == 5) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_3.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_3.X, Kleinteile); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1000 + Schwierigkeitsgrad*2 + Data4/2; }
			IF (MY._Treffer > 0) { VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);
			}
			IF (MY._Treffer > 2) { VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);
			}
			IF (MY._Treffer > 4) { VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
			}
	WAIT (1);
	}
	IF (soundsave == 1) { SND_STOP (Prop_handle_fw1); Prop_handle_fw1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_fw2); Prop_handle_fw2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_fw3); Prop_handle_fw3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_fw4); Prop_handle_fw4 = NULL; soundsave = 0; }
	PLAY_SOUND (explo1, Sound75);
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt1, schaden_2.X, Grossteile); }
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt3, schaden_3.X, Grossteile); }
	WHILE (explos > 0) {
		MY.INVISIBLE = ON;
		ENT_CREATE (Explosion, MY.X, Boooom); explos -= 1;
			VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);

			VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);

			VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
	WAIT (1);
}
Ende:
IF (MY._Treffer < 5) { Data6 += 1; }
	IF (soundsave == 1) { SND_STOP (Prop_handle_fw1); Prop_handle_fw1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_fw2); Prop_handle_fw2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_fw3); Prop_handle_fw3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_fw4); Prop_handle_fw4 = NULL; soundsave = 0; }
ENT_REMOVE(MY); RETURN;
}

ACTION Flieger_bf_Form
{
var force;
var drift;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
var s_pos_1;
var s_pos_2;
var s_pos_3;
var explos = 10;
var soundsave;
MY.METAL = ON;
MY.SHADOW = ON;

MY.SKIN = INT(Random(6));

MY._charakter = 4;

MY.PAN = 180;
speed_n_save.X = -30;
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;

ENT_CREATE (bfprop, MY.X, Prop);
ENT_CREATE (Bombe, MY.X, Bombah);

	IF (Prop_handle_bf1 == NULL) { Prop_handle_bf1 = SND_PLAY (sme109, Sound50, 0); soundsave = 1; GOTO Weiter; }
	IF (Prop_handle_bf2 == NULL) { Prop_handle_bf2 = SND_PLAY (sme109, Sound50, 0); soundsave = 2; GOTO Weiter; }
	IF (Prop_handle_bf3 == NULL) { Prop_handle_bf3 = SND_PLAY (sme109, Sound50, 0); soundsave = 3; GOTO Weiter; }
	IF (Prop_handle_bf4 == NULL) { Prop_handle_bf4 = SND_PLAY (sme109, Sound50, 0); soundsave = 4; GOTO Weiter; }

Weiter:

	WHILE (MY._Treffer < 11) {


		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 5) {
			MY.ROLL += MY._SPEED_Y/480 * TIME;
			MY.TILT += MY._SPEED_X/480 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}
		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_1.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_1.X, Kleinteile); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_2.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_2.X, Kleinteile); } }
		IF ((MY._Treffer == 5) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (kt1, schaden_3.X, Kleinteile); } ELSE { ENT_CREATE (kt2, schaden_3.X, Kleinteile); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1000 + Schwierigkeitsgrad*2 + Data4/2; }
			IF (MY._Treffer > 0) { VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);
			}
			IF (MY._Treffer > 2) { VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);
			}
			IF (MY._Treffer > 4) { VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
			}
	WAIT (1);
	}
	IF (soundsave == 1) { SND_STOP (Prop_handle_bf1); Prop_handle_bf1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_bf2); Prop_handle_bf2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_bf3); Prop_handle_bf3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_bf4); Prop_handle_bf4 = NULL; soundsave = 0; }
	PLAY_SOUND (explo1, Sound75);
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt2, schaden_2.X, Grossteile); }
	IF (Int(Random(2)) == 0) { ENT_CREATE (gt4, schaden_3.X, Grossteile); }
	WHILE (explos > 0) {
		MY.INVISIBLE = ON;
		ENT_CREATE (Explosion, MY.X, Boooom); explos -= 1;
			VEC_SET (s_pos_1.X, schaden_1.X); VEC_ROTATE (s_pos_1.X, MY.PAN); VEC_ADD (s_pos_1.X, MY.X);
				Effect (fire2_effect, 2, s_pos_1, NULLVECTOR);
				Effect (smoke2_effect, 1, s_pos_1, NULLVECTOR);

			VEC_SET (s_pos_2.X, schaden_2.X); VEC_ROTATE (s_pos_2.X, MY.PAN); VEC_ADD (s_pos_2.X, MY.X);
				Effect (fire_effect, 2, s_pos_2, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_2, NULLVECTOR);

			VEC_SET (s_pos_3.X, schaden_3.X); VEC_ROTATE (s_pos_3.X, MY.PAN); VEC_ADD (s_pos_3.X, MY.X);
				Effect (fire_effect, 2, s_pos_3, NULLVECTOR);
				Effect (smoke_effect, 1, s_pos_3, NULLVECTOR);
				ENT_CREATE (Explosion, MY.X, Booom);
	WAIT (1);
}
Ende:
IF (MY._Treffer < 5) { Data6 += 1; }
	IF (soundsave == 1) { SND_STOP (Prop_handle_bf1); Prop_handle_bf1 = NULL; soundsave = 0; }
	IF (soundsave == 2) { SND_STOP (Prop_handle_bf2); Prop_handle_bf2 = NULL; soundsave = 0; }
	IF (soundsave == 3) { SND_STOP (Prop_handle_bf3); Prop_handle_bf3 = NULL; soundsave = 0; }
	IF (soundsave == 4) { SND_STOP (Prop_handle_bf4); Prop_handle_bf4 = NULL; soundsave = 0; }
ENT_REMOVE(MY); RETURN;
}

ACTION Huhn
{
var force;
var drift;
var anim;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
MY.SCALE_X = 3;
MY.SCALE_Y = MY.SCALE_X;
MY.SCALE_Z = MY.SCALE_X;

MY.SHADOW = ON;

MY.X = - 15000;
MY.Y = Random(6000) - 3000;
MY.Z = Random(1000) + 1000;

MY._charakter = 5;

MY.PAN = 180;
speed_n_save.X = -15-Random(10);
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;

ENT_CREATE (Ei, MY.X, Bombah);

Weiter:

IF (INT(Random(10)) == 5) { PLAY_SOUND (Huhns, Sound100); }

	WHILE (MY._Treffer < 14) {

		anim += 15 * TIME;
		anim %= 100;

		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 4) {
			MY.ROLL += MY._SPEED_Y/500 * TIME;
			MY.TILT += MY._SPEED_X/500 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}

		IF (MY._Treffer < 4) { ENT_ANIMATE (ME, "Fly", anim, ANM_CYCLE); MY.Z += SIN(anim*3.6)*5;
			} ELSE { anim = 50; ENT_ANIMATE (ME, "Die", anim, ANM_CYCLE); }

		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_2.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } }
		IF ((MY._Treffer == 4) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_3.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1500 + Schwierigkeitsgrad*1.5 + Data4/2; }
	WAIT (1);
	}
Ende:

IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }
IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_2.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }
IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_3.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }

IF (MY._Treffer < 5) { Data6 += 1; }
ENT_REMOVE(MY); RETURN;
}

ACTION Huhn_Form
{
var force;
var drift;
var anim;
var speed_n_save;
var schaden_1;
var schaden_2;
var schaden_3;
MY.SCALE_X = 3;
MY.SCALE_Y = MY.SCALE_X;
MY.SCALE_Z = MY.SCALE_X;

MY.SHADOW = ON;

MY._charakter = 5;

MY.PAN = 180;
speed_n_save.X = -15-Random(10);
speed_n_save.Y = speed_n_save.X * -3;

MY.ENABLE_BLOCK = ON;
MY.ENABLE_ENTITY = ON;
MY.EVENT = Kollision;

ENT_CREATE (Ei, MY.X, Bombah);

Weiter:

IF (INT(Random(20)) == 5) { PLAY_SOUND (Huhns, Sound100); }

	WHILE (MY._Treffer < 14) {

		anim += 15 * TIME;
		anim %= 100;

		force.X = speed_n_save.X * TIME;
		drift.X = speed_n_save.Y * TIME;
		drift.Z = speed_n_save.Z * TIME;

		MY._Framespeed = speed_n_save.Y - speed_n_save.X;
		MY._Fallspeed = speed_n_save.Z;

		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
		RESULT = ENT_MOVE(force, drift);

		IF (MY.X > 15000) { GOTO Ende; }
		IF (MY._Treffer >= 4) {
			MY.ROLL += MY._SPEED_Y/500 * TIME;
			MY.TILT += MY._SPEED_X/500 * TIME;
			IF (speed_n_save.Z > -40) { speed_n_save.Z -= (40 + speed_n_save.Z)/40 * 1.84; }
		}

		IF (MY._Treffer < 4) { ENT_ANIMATE (ME, "Fly", anim, ANM_CYCLE); MY.Z += SIN(anim*3.6)*5;
			} ELSE { anim = 50; ENT_ANIMATE (ME, "Die", anim, ANM_CYCLE); }

		IF ((MY._Treffer == 1) && (schaden_1 == 0)) { VEC_SET (schaden_1.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } }
		IF ((MY._Treffer == 3) && (schaden_2 == 0)) { VEC_SET (schaden_2.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_2.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } }
		IF ((MY._Treffer == 4) && (schaden_3 == 0)) { VEC_SET (schaden_3.X, MY._Schaden); VEC_SET (MY._Schaden, NULLVECTOR); IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_3.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); } Data5 += 1; Punkte += VEC_DIST (MY.X, PLAYER.X)/1500 + Schwierigkeitsgrad*1.5 + Data4/2; }
	WAIT (1);
	}
Ende:

IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }
IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_2.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }
IF (Int(Random(2)) == 0) { ENT_CREATE (Feder, schaden_3.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); } ELSE { ENT_CREATE (Feder, schaden_1.X, Federflug); ENT_CREATE (Feder, schaden_1.X, Federflug); }

IF (MY._Treffer < 5) { Data6 += 1; }
ENT_REMOVE(MY); RETURN;
}



ACTION Muendungsfeuer
{
MY.FLARE = ON;
MY.BRIGHT = ON;
MY.PASSABLE = ON;
MY.INVISIBLE = ON;
MY.RED = 50;
MY.GREEN = 50;
MY.LIGHTRANGE = 0;
	WHILE (PLAYER != NULL) {
		ENT_mf = ME;
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

ACTION Scheinwerfer
{
MY.FLARE = ON;
MY.BRIGHT = ON;
MY.PASSABLE = ON;
MY.INVISIBLE = ON;
MY.RED = 50;
MY.GREEN = 50;
MY.LIGHTRANGE = 0;
	WHILE (PLAYER != NULL) {
		ENT_sw = ME;
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}



ACTION Schuss
{
var force;
var drift;
var hit;
//MY.FLARE = ON;
//MY.TRANSPARENT = ON;
//MY.ALPHA = 100;
//MY.BRIGHT = ON;
MY.OVERLAY = ON;
MY.PASSABLE = ON;
MY.SHADOW = ON;
//MY.UNLIT = ON;
//MY.NOFOG = ON;
//MY.AMBIENT = 100;
MY.RED = 255;
MY.GREEN = 127;
MY.LIGHT = ON;
//MY.LIGHTRANGE = 200;
MY.PAN = PLAYER.PAN + (Random(4)-2)/5;
MY.TILT = Data1 + (Random(4)-2)/5;
//force.X = 800 * TIME;

	WHILE (PLAYER) {
		force.X = 1000 * TIME;
		MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS;
			ENT_MOVE(force, drift);
		IF (drift.Z > -20) { drift.Z -= (20 + drift.Z)/20 * 1.84 * TIME; }
		IF (VEC_DIST (MY.X, PLAYER.X) > 14000) { ENT_REMOVE (MY); RETURN; }
			VEC_FOR_VERTEX (TEMP.X,  MY, 6);

		YOU = PLAYER;
		TRACE_MODE = IGNORE_SPRITES + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_ME + IGNORE_YOU;
		RESULT = TRACE (MY.X, TEMP.X);
//		RESULT = C_TRACE (TEMP.X, MY.X, IGNORE_SPRITES + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_ME + IGNORE_YOU);

			IF (RESULT) {
				IF (YOU) {
					IF (YOU._charakter != 50) { YOU._Treffer += 1;
						Effect (smoke_effect, 1, target.X,NULLVECTOR);
						VEC_SET (hit.X, TARGET.X);
						VEC_SUB (hit.X, YOU.X);
						VEC_INVERSE (hit.X);
						hit.Z *= -1;
						YOU._Schaden_X = hit.X;
						YOU._Schaden_Y = hit.Y;
						YOU._Schaden_Z = hit.Z;
							YOU._SPEED_X += hit.X;
							YOU._SPEED_Y += hit.Y;
						VEC_SET (hit.X, drift);
					}
				}
				PLAY_SOUND (bh1, Sound50);
				ENT_REMOVE(MY); RETURN;
			}
	WAIT (1);
	}
ENT_REMOVE(MY); RETURN;
}

/*function Crossh_a()
{
MY.PASSABLE = ON;
MY.FLARE = ON;
MY.BRIGHT = ON;
MY.UNLIT = ON;
MY.NOFOG = ON;
MY.FACING = ON;
	MY.SCALE_X = 2;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;
	WHILE (1) {
		ENT_ca = ME;
	WAIT (1);
	}
}
function Crossh_b()
{
MY.PASSABLE = ON;
MY.FLARE = ON;
MY.BRIGHT = ON;
MY.UNLIT = ON;
MY.NOFOG = ON;
MY.FACING = ON;
	MY.SCALE_X = 2;
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;
	WHILE (1) {
		ENT_cb = ME;
	WAIT (1);
	}
}*/

ACTION ITEM_Zaun
{
MY.NARROW = ON;
MY.FAT = ON;
MY.SHADOW = ON;
MY.SKIN = MY.SKILL1;
}

ACTION ITEM_Grass
{
MY.PASSABLE = ON;
MY.OVERLAY = ON;
//MY.NOFILTER = ON; // Sieht beschissen aus ( zu pickslig )
//MY.TRANSPARENT = ON;
//MY.ALPHA = 100;
MY.ALBEDO = 10;
MY.PAN = Random (360);
//MY.MATERIAL = Pflanze;
	VEC_SET(TEMP, MY.POS);
	TEMP.Z -= 1000;
	TRACE_MODE = IGNORE_SPRITES + IGNORE_ME + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_MODELS;
	RESULT = TRACE(MY.POS,temp); MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;
//	create(SHADOWSPRITE,Target,Schatten_Pflanze);
}


ACTION ITEM_Kleiteile
{
WAIT (1);
IF (MY.SKILL1 == 1) { WAIT (1); }
MY.SHADOW = ON;
MY.NARROW = ON;
MY.FAT = ON;
MY.SCALE_X = 1 + (Random(5)/10);
MY.SCALE_Y = MY.SCALE_X;
MY.SCALE_Z = MY.SCALE_X;
MY.PAN = Random(360);
	VEC_SET (TEMP, MY.POS);
	TEMP.Z -= 1000;
		C_TRACE (MY.POS, TEMP, IGNORE_ME);
	MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;
}

ACTION NPC_Schaf
{
//MY.FAT = ON;
//MY.NARROW = ON;
MY.SHADOW = ON;
MY.SCALE_X = 0.8 + (Random(4)/10);
MY.SCALE_Y = MY.SCALE_X;
MY.SCALE_Z = MY.SCALE_X;
MY.PAN = Random(360);
MY._Kraft = Random(40);
	WHILE (1) {
		VEC_SET(TEMP, MY.POS);
		TEMP.Z -= 1000;
		TRACE_MODE = IGNORE_SPRITES + IGNORE_ME + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_MODELS;
		RESULT = TRACE(MY.POS,temp); MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;

		MY._Kraft += 1 * TIME;
		IF (MY._Kraft > 40) { MY._Aktion = INT(Random(10)); MY._Maus += (Random(10)-5)/5; MY._Framespeed += (Random(4)-2)/8; MY._Kraft = 0; }
		IF (MY._Maus > 2) { MY._Maus = 2; } IF (MY._Maus < -2) { MY._Maus = -2; }
		IF (MY._Framespeed > 2) { MY._Framespeed = 2; } IF (MY._Framespeed < 0.5) { MY._Framespeed = 0.5; }
		IF (MY._Aktion < 5) { MY.PAN += MY._Maus * (MY._Framespeed/2) * TIME; }
		IF (MY._Aktion < 7) {
			MY._Move_anim += 2 * MY._Framespeed * TIME;
			MY._Move_anim %= 100;
			ENT_ANIMATE (ME, "Walk", MY._Move_anim, ANM_CYCLE);
			MY._SPEED_X = MY._Framespeed * TIME;
			MOVE_MODE = IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE;
			RESULT = ENT_MOVE(MY._SPEED, NULLVECTOR);
//			C_MOVE (ME, MY._SPEED, NULLVECTOR, IGNORE_PASSABLE + IGNORE_PASSENTS + GLIDE);
		} ELSE {
			MY._Move_anim += 4 * TIME;
			MY._Move_anim %= 100;
			ENT_ANIMATE (ME, "Stand", MY._Move_anim, ANM_CYCLE);
		}
	WAIT (1);
	}
}

TEXT Show_weiter
{
	POS_X 460;
	POS_Y 270;
	FONT abra_font;
	STRING "  Spiel zuende\n\nWeiter mit Enter";
}
TEXT Show_Sieg
{
	POS_X 460;
	POS_Y 270;
	FONT abra_font;
	STRING "  Spiel gewonnen!\n\nWeiter mit Enter";
}

	
ACTION Flak
{
var cam_pos;
var mf_pos;
var neigung;
var neigungswinkel = 0;
var eigen_winkel = 20;
var cross_a;
var cross_b;
var explos = 10;
MY.METAL = ON;
MY.SHADOW = ON;
MY.PAN = 180;
PLAYER = ME;
 	CAMERA.DIAMETER = 0;		// Macht die Kamera Passierbar

XVECTOR.Z = - 500;

ENT_CREATE ("mf.mdl", MY.X, Muendungsfeuer);
ENT_CREATE ("mf.mdl", MY.X, Scheinwerfer);

//CREATE (<ca.bmp>, NULLVECTOR, Crossh_a);
//CREATE (<cb.bmp>, NULLVECTOR, Crossh_B);

Data.VISIBLE = ON;
Status.VISIBLE = ON;
Background.VISIBLE = ON;

WAIT (1);

Fliegererschaffung();

Loading.VISIBLE = OFF;

	IF ((Data4 == 2) && (Schwierigkeitsgrad < 3)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }

	WHILE (Zustand > 0) {
		IF (Data5 >= 100) {
			IF (Data4 == 4) { Farmlevel = 1; Show_Sieg.VISIBLE = ON; GOTO Winner; }
			IF (Data4 == 3) { Level4(); }
			IF (Data4 == 2) { Level3(); }
			IF (Data4 == 1) { Level2(); }
		}
		IF (Data6 >= 18+Schwierigkeitsgrad*2) { PLAYER = NULL; GOTO Ende; }
		Data2 = Zustand;
//		IF (Prop_handle_bf1 != NULL) { Data4 = 1; } ELSE { Data4 = 5; }
		IF (Hitze.Y == 0) {
			MY.PAN -= MOUSE_FORCE.X * Mausempfindlichkeit * TIME;
//			MY.TILT += MOUSE_FORCE.Y * 10 * TIME;
			neigungswinkel += MOUSE_FORCE.Y * Mausempfindlichkeit * TIME;
		}
		IF (neigungswinkel >= 60) { neigungswinkel = 60; }
		IF (neigungswinkel <=  0) { neigungswinkel =  0; }
		neigung = (neigungswinkel / 0.6)/2;
			ENT_ANIMATE (ME, "Basi", neigung, ANM_CYCLE);
		IF (cam_view == 0) { ENT_VERTEX (cam_pos, 207); } ELSE { ENT_VERTEX (cam_pos, 209); }
		VEC_FOR_VERTEX (mf_pos,  MY, 208);
		VEC_FOR_VERTEX (cross_a, MY, 210);
		VEC_FOR_VERTEX (cross_b, MY, 211);

		VEC_SET (CAMERA.X, cam_pos.X);
		VEC_SET (CAMERA.PAN, MY.PAN);
		IF (cam_view == 1) { CAMERA.PAN += eigen_winkel; }
		CAMERA.TILT = neigungswinkel;

		eigen_winkel -= KEY_FORCE.X * Mausempfindlichkeit/3 * TIME;
		IF (eigen_winkel >= 40) { eigen_winkel = 40; }
		IF (eigen_winkel <=  5) { eigen_winkel =  5; }

		Data1 = neigungswinkel;
//		Data2 = neigung;
//		Data3 = CAMERA.TILT;

		VEC_SET (ENT_mf.X, mf_pos.X);
		VEC_SET (ENT_mf.PAN, MY.PAN);
		ENT_mf.TILT = neigungswinkel;
		VEC_SET (ENT_sw.X, mf_pos.X);
		VEC_SET (ENT_sw.PAN, MY.PAN);
		ENT_sw.TILT = neigungswinkel;

/*		VEC_SET (ENT_ca.X, cross_a.X);
		ENT_cb.Z += 9;
		VEC_SET (ENT_cb.X, cross_b.X);
		ENT_cb.Z += 20;*/

		MY._TIMER -= TIME;

		ENT_mf.INVISIBLE = ON;
		ENT_mf.LIGHTRANGE = 0;
		IF ((MY._TIMER <= 0) && (Hitze < 200) && (Hitze.Y == 0)) {
			IF (MOUSE_LEFT) {
				MY._TIMER = 1;
				Effect (smoke_effect, 1, ENT_mf.X,NULLVECTOR);
				ENT_mf.INVISIBLE = OFF;
				PLAY_SOUND (wp1, Sound50);
				ENT_CREATE (pt, mf_pos.X, Schuss);
				ENT_mf.LIGHTRANGE = 500;
				IF (LOWHEAT == OFF) { Hitze += 4; } ELSE { Hitze += 2; }
				IF (Hitze >= 200) { Hitze += 50; Zustand -= 10; Hitze.Y = 1; }
//				ENT_ANIMATE (ME, "Bang", neigung, ANM_ADD);
//				PLAY_SOUND (wp1, 50);
			}
		}
	Hitze -= (80-(Temperaturhoehe + 30)) / 20 * TIME;
	IF (Wetterschalter != 0) { Hitze -= (80-(Temperaturhoehe + 30)) / 50 * TIME; }
	IF (Hitze < 1) { Hitze = 1; }
	IF ((Hitze.Y == 1) && (Hitze < 160)) { Hitze.Y = 0; }
//	Data2 = Hitze;
	IF (Eisig == ON) { Eisig = OFF; Runtersapper(); }
	WAIT (1);
	}
	IF (Zustand < 0) { Zustand = 0; } Data2 = Zustand;
	PLAY_SOUND (explo1, 75);
WHILE (explos > 0) {
		ENT_CREATE (Explosion, MY.X, Boooom); explos -= 1;
				Effect (fire2_effect, 4, MY.X, NULLVECTOR);
				Effect (smoke2_effect, 2, MY.X, NULLVECTOR);
	WAIT (1);
}
Ende:
Show_weiter.VISIBLE = ON;
Winner:
neigungswinkel = 0;
ENT_REMOVE(MY); RETURN;
}



function Namensxy()
{
	WHILE (Statta == 1) {
		IF (Punkte > Punktz[0]) { Platz = 1;  GOTO Ende; }
		IF (Punkte > Punktz[1]) { Platz = 2;  GOTO Ende; }
		IF (Punkte > Punktz[2]) { Platz = 3;  GOTO Ende; }
		IF (Punkte > Punktz[3]) { Platz = 4;  GOTO Ende; }
		IF (Punkte > Punktz[4]) { Platz = 5;  GOTO Ende; }
		IF (Punkte > Punktz[5]) { Platz = 6;  GOTO Ende; }
		IF (Punkte > Punktz[6]) { Platz = 7;  GOTO Ende; }
		IF (Punkte > Punktz[7]) { Platz = 8;  GOTO Ende; }
		IF (Punkte > Punktz[8]) { Platz = 9;  GOTO Ende; }
		IF (Punkte > Punktz[9]) { Platz = 10; GOTO Ende; }
		Platz = 0;
		Ende:
	WAIT (1);
	}
}

function weiter()
{
	IF ((PLAYER == NULL) && (Statta == 1)) {
		IF ((INKEY_ACTIVE == 0) && (Platz != 0)) { Tasta(); Show_weiter.VISIBLE = OFF; } ELSE { Scoridori(); Show_weiter.VISIBLE = OFF; }
	}
}
on_enter = weiter;


ACTION Krater
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.ALPHA = 80;
ENT_ALPHASET (0,-100); 
MY.UNLIT = ON;
MY.PASSABLE = ON;
MY.PAN = Random(360);

	MY.SCALE_X = 4 + Random(4);
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	VEC_SET(TEMP, MY.POS);
	TEMP.Z -= 1000;
	TRACE_MODE = IGNORE_SPRITES + IGNORE_ME + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_MODELS;
	RESULT = TRACE(MY.POS,temp); MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;
}

ACTION Krater2
{
MY.FLARE = ON;
MY.TRANSPARENT = ON;
MY.ALPHA = 80;
ENT_ALPHASET (0,-100); 
MY.UNLIT = ON;
MY.PASSABLE = ON;
MY.PAN = Random(360);

	MY.SCALE_X = 10 + Random(4);
	MY.SCALE_Y = MY.SCALE_X;
	MY.SCALE_Z = MY.SCALE_X;

	VEC_SET(TEMP, MY.POS);
	TEMP.Z -= 1000;
	TRACE_MODE = IGNORE_SPRITES + IGNORE_ME + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_MODELS;
	RESULT = TRACE(MY.POS,temp); MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;

IF (MY.Z > 130) { REMOVE(ME); RETURN; }
}


function Ansicht()
{
IF (cam_view == 1) { cam_view = 0; } ELSE { cam_view = 1; }
}
on_MOUSE_RIGHT = Ansicht;
on_PGDN = Ansicht;


ACTION Intoprop
{	WHILE (1) { MY.ROLL += 200 * TIME; WAIT (1); } }
ACTION Introflieger { RETURN; }
ACTION Introwolken
{ MY.Transparent = ON; MY.ALPHA = 20; MY.FLARE = ON;	WHILE (1) { MY.U -= MY.Z / 20 * TIME; WAIT (1); } }

function Screenshots()
{
IF (Statta == 1) {
	SCREENSHOT ("Flak",sceenie);
	sceenie += 1;
}
RETURN;
}
on_MOUSE_MIDDLE = Screenshots();

ACTION Baum
{
MY.SKIN = MY.SKILL1;
MY.OVERLAY = ON;
//MY.NOFILTER = ON; // Sieht beschissen aus ( zu pickslig )
//MY.TRANSPARENT = ON;
//MY.ALPHA = 100;
my.albedo = 10;
MY.PAN = Random (360);
	VEC_SET(TEMP, MY.POS);
	TEMP.Z -= 1000;
	TRACE_MODE = IGNORE_SPRITES + IGNORE_ME + IGNORE_PASSENTS + IGNORE_PASSABLE + IGNORE_MODELS;
	RESULT = TRACE(MY.POS,temp); MY.Z = TARGET.Z -MY.MIN_Z * MY.SCALE_Z;
}

ACTION Terra
{
//MY.AMBIENT = 30;
//MY.UNLIT = ON;
MY.LIGHT = ON;
MY.RED = 0;
MY.GREEN = 0;
MY.BLUE = 0;
}

STRING Namenzehns[11];

TEXT Tasta_info
{
	POS_X 470;
	POS_Y 300;
	FONT abra_font;
	STRING "Namen Eingeben";
}

TEXT Tasta_text
{
	POS_X 470;
	POS_Y 320;
	FONT abra_font;
	STRING Namenzehns;
}

function Tasta
{
Anfang:
	Tasta_text.VISIBLE = ON;
	Tasta_info.VISIBLE = ON;
	INKEY (Namenzehns);
	IF (RESULT == 13) {
		IF (Platz ==  1) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punktz[4];
			Punktz[4] = Punktz[3];
			Punktz[3] = Punktz[2];
			Punktz[2] = Punktz[1];
			Punktz[1] = Punktz[0];
			Punktz[0] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6, Platz5);
			STR_CPY (Platz5, Platz4);
			STR_CPY (Platz4, Platz3);
			STR_CPY (Platz3, Platz2);
			STR_CPY (Platz2, Platz1);
			STR_CPY (Platz1,  Namenzehns);
		}
		IF (Platz ==  2) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punktz[4];
			Punktz[4] = Punktz[3];
			Punktz[3] = Punktz[2];
			Punktz[2] = Punktz[1];
			Punktz[1] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6, Platz5);
			STR_CPY (Platz5, Platz4);
			STR_CPY (Platz4, Platz3);
			STR_CPY (Platz3, Platz2);
			STR_CPY (Platz2,  Namenzehns);
		}
		IF (Platz ==  3) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punktz[4];
			Punktz[4] = Punktz[3];
			Punktz[3] = Punktz[2];
			Punktz[2] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6, Platz5);
			STR_CPY (Platz5, Platz4);
			STR_CPY (Platz4, Platz3);
			STR_CPY (Platz3,  Namenzehns);
		}
		IF (Platz ==  4) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punktz[4];
			Punktz[4] = Punktz[3];
			Punktz[3] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6, Platz5);
			STR_CPY (Platz5, Platz4);
			STR_CPY (Platz4,  Namenzehns);
		}
		IF (Platz ==  5) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punktz[4];
			Punktz[4] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6, Platz5);
			STR_CPY (Platz5,  Namenzehns);
		}
		IF (Platz ==  6) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punktz[5];
			Punktz[5] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7, Platz6);
			STR_CPY (Platz6,  Namenzehns);
		}
		IF (Platz ==  7) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punktz[6];
			Punktz[6] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8, Platz7);
			STR_CPY (Platz7,  Namenzehns);
		}
		IF (Platz ==  8) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punktz[7];
			Punktz[7] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9, Platz8);
			STR_CPY (Platz8,  Namenzehns);
		}
		IF (Platz ==  9) {
			Punktz[9] = Punktz[8];
			Punktz[8] = Punkte;
			STR_CPY (Platz10, Platz9);
			STR_CPY (Platz9,  Namenzehns);
		}
		IF (Platz == 10) {
			Punktz[9] = Punkte;
			STR_CPY (Platz10, Namenzehns);
		}
		Ende();
	}
	Tasta_text.VISIBLE = OFF;
	Tasta_info.VISIBLE = OFF;
}



function Aufloesung()
{
IF (Video_Mode == 7) {
	Video_Switch (8, 0, 0);
	Menue.POS_X += 30;
	Menue.POS_Y += 40;
	Data.POS_X += 240;
	Highscore.POS_X += 120;
	Highscore.POS_Y += 160;
	Loading.POS_X += 120;
	Loading.POS_Y += 160;
	Mausa1.POS_X += 120;
	Mausa1.POS_Y += 160;
	Mausa2.POS_X += 120;
	Mausa2.POS_Y += 160;
	Mausa3.POS_X += 120;
	Mausa3.POS_Y += 160;
	Resol1.POS_X += 120;
	Resol1.POS_Y += 160;
	Resol2.POS_X += 120;
	Resol2.POS_Y += 160;
	Optionen.POS_X += 120;
	Optionen.POS_Y += 160;
	Schwere1.POS_X += 120;
	Schwere1.POS_Y += 160;
	Schwere2.POS_X += 120;
	Schwere2.POS_Y += 160;
	Schwere3.POS_X += 120;
	Schwere3.POS_Y += 160;
	Score_Data.POS_X += 120;
	Score_Data.POS_Y += 100;
	Status.POS_X += 120;
	Status.POS_Y += 160;
	Background.POS_X += 120;
	Background.POS_Y += 160;
	Vol1.POS_X += 120;
	Vol1.POS_Y += 160;
	Vol2.POS_X += 120;
	Vol2.POS_Y += 160;
	Vol3.POS_X += 120;
	Vol3.POS_Y += 160;
	Vol4.POS_X += 120;
	Vol4.POS_Y += 160;
	pl1.POS_X += 120;
	pl1.POS_Y += 100;
	pl2.POS_X += 120;
	pl2.POS_Y += 100;
	pl3.POS_X += 120;
	pl3.POS_Y += 100;
	pl4.POS_X += 120;
	pl4.POS_Y += 100;
	pl5.POS_X += 120;
	pl5.POS_Y += 100;
	pl6.POS_X += 120;
	pl6.POS_Y += 100;
	pl7.POS_X += 120;
	pl7.POS_Y += 100;
	pl8.POS_X += 120;
	pl8.POS_Y += 100;
	pl9.POS_X += 120;
	pl9.POS_Y += 100;
	pl10.POS_X += 120;
	pl10.POS_Y += 100;
	Punkteliste.POS_X += 120;
	Punkteliste.POS_Y += 100;
	show_all.POS_X += 240;
//	show_all.POS_Y += 160;
	Show_weiter.POS_X += 120;
	Show_weiter.POS_Y += 160;
	Show_Sieg.POS_X += 120;
	Show_Sieg.POS_Y += 160;
	Tasta_info.POS_X += 120;
	Tasta_info.POS_Y += 160;
	Tasta_text.POS_X += 120;
	Tasta_text.POS_Y += 160;
	RETURN;
}
IF (Video_Mode == 8) {
	Video_Switch (7, 0, 0);
	Menue.POS_X -= 30;
	Menue.POS_Y -= 40;
	Data.POS_X -= 240;
	Highscore.POS_X -= 120;
	Highscore.POS_Y -= 160;
	Loading.POS_X -= 120;
	Loading.POS_Y -= 160;
	Mausa1.POS_X -= 120;
	Mausa1.POS_Y -= 160;
	Mausa2.POS_X -= 120;
	Mausa2.POS_Y -= 160;
	Mausa3.POS_X -= 120;
	Mausa3.POS_Y -= 160;
	Resol1.POS_X -= 120;
	Resol1.POS_Y -= 160;
	Resol2.POS_X -= 120;
	Resol2.POS_Y -= 160;
	Optionen.POS_X -= 120;
	Optionen.POS_Y -= 160;
	Schwere1.POS_X -= 120;
	Schwere1.POS_Y -= 160;
	Schwere2.POS_X -= 120;
	Schwere2.POS_Y -= 160;
	Schwere3.POS_X -= 120;
	Schwere3.POS_Y -= 160;
	Score_Data.POS_X -= 120;
	Score_Data.POS_Y -= 100;
	Status.POS_X -= 120;
	Status.POS_Y -= 160;
	Background.POS_X -= 120;
	Background.POS_Y -= 160;
	Vol1.POS_X -= 120;
	Vol1.POS_Y -= 160;
	Vol2.POS_X -= 120;
	Vol2.POS_Y -= 160;
	Vol3.POS_X -= 120;
	Vol3.POS_Y -= 160;
	Vol4.POS_X -= 120;
	Vol4.POS_Y -= 160;
	pl1.POS_X -= 120;
	pl1.POS_Y -= 100;
	pl2.POS_X -= 120;
	pl2.POS_Y -= 100;
	pl3.POS_X -= 120;
	pl3.POS_Y -= 100;
	pl4.POS_X -= 120;
	pl4.POS_Y -= 100;
	pl5.POS_X -= 120;
	pl5.POS_Y -= 100;
	pl6.POS_X -= 120;
	pl6.POS_Y -= 100;
	pl7.POS_X -= 120;
	pl7.POS_Y -= 100;
	pl8.POS_X -= 120;
	pl8.POS_Y -= 100;
	pl9.POS_X -= 120;
	pl9.POS_Y -= 100;
	pl10.POS_X -= 120;
	pl10.POS_Y -= 100;
	Punkteliste.POS_X -= 120;
	Punkteliste.POS_Y -= 100;
	show_all.POS_X -= 240;
//	show_all.POS_Y -= 160;
	Show_weiter.POS_X -= 120;
	Show_weiter.POS_Y -= 160;
	Show_Sieg.POS_X -= 120;
	Show_Sieg.POS_Y -= 160;
	Tasta_info.POS_X -= 120;
	Tasta_info.POS_Y -= 160;
	Tasta_text.POS_X -= 120;
	Tasta_text.POS_Y -= 160;
	RETURN; }
//IF (Video_Mode == 9) { Video_Switch (7, 0, 0); RETURN; }
}
Function Arsch() { RETURN; }
on_F5 = Arsch;

function punktARC()
{ CAMERA.ARC = 60; }
on_home = punktARC;

function Leuchtpunkt()
{
	IF (ENT_sw != NULL) {
		IF ((Schwierigkeitsgrad < 3) && (ENT_sw.SPOTLIGHT == OFF)) { ENT_sw.SPOTLIGHT = ON; ENT_sw.LIGHTRANGE = 15000; } ELSE { ENT_sw.SPOTLIGHT = OFF; ENT_sw.LIGHTRANGE = 0; }
	}
}
on_pgup = Leuchtpunkt;

STRING Cheat[14];

TEXT Cheating_text
{
	POS_X 10;
	POS_Y 10;
	FONT abra_font;
	STRING Cheat;
}

ACTION Cheating
{
	Cheating_text.VISIBLE = ON;
	INKEY (Cheat);
	IF (RESULT == 13) {
		EXECUTE (Cheat); }
	Cheating_text.VISIBLE = OFF;
}
on_F12 = Cheating;


ACTION Krieg
{
var Timer;
Timer = Random(320) + 320;
MY.RED = 255;
MY.BLUE = 255;
MY.GREEN = 255;

MY.VISIBLE = ON;
MY.INVISIBLE = OFF;

	WHILE (1) {
		Timer -= 1 * TIME;
		IF (Timer <= 0) { MY.LIGHTRANGE = 2000; PLAY_SOUND (explo1, Sound75); WAITT (2); MY.LIGHTRANGE = 0; Timer = Random(320)+160; }
	WAIT (1);
	}
}

function Pause()
{
	IF (Statta == 1) {
		IF (FREEZE_MODE == 0) {
			FREEZE_MODE = 2;
		} ELSE {
			FREEZE_MODE = 0;
		}
	}
}
on_PAUSE = Pause;

/////////////////////////////////////////////////////////////////
//INCLUDE <debug.wdl>;