André Schnabel avatar André Schnabel committed 318fe7d Draft

Initial commit.

Comments (0)

Files changed (37)

Binary file added.

Binary file added.

Binary file added.

Binary file added.

Binary file added.

Binary file added.

Binary file added.

Binary file added.

Added
New image
Added
New image
Add a comment to this file

Images/corpse_middle.bmp

Added
New image
Added
New image
Added
New image
Added
New image
Add a comment to this file

Images/enemy_middle.bmp

Added
New image
Added
New image
Added
New image
Added
New image
Add a comment to this file

Images/spawn_middle.bmp

Added
New image
Added
New image
Added
New image
+
+Please distribute this file with the SDL runtime environment:
+
+The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
+designed to make it easy to write multi-media software, such as games and
+emulators.
+
+The Simple DirectMedia Layer library source code is available from:
+http://www.libsdl.org/
+
+This library is distributed under the terms of the GNU LGPL license:
+http://www.gnu.org/copyleft/lesser.html
+

Source/FKill_Main.cpp

+// FKill_Main.cpp
+
+//#define NO_SOUND
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_image.h>
+#include <SDL/SDL_ttf.h>
+#include <SDL/SDL_mixer.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Gallus_Functions.h"
+#include "Gallus_Sprite.h"
+#include "Gallus_Engine.h"
+#include "FKill_Main.h"
+
+/*
+    ================================================================
+                                                            FURBYKILL
+                                      an open source "moorhuhn"-clone
+                                                    by Andr� Schnabel
+    ================================================================
+*/
+
+/*
+	================================================================
+	FUNCTIONS
+	================================================================
+*/
+
+//
+// main
+// Here it all begins
+//
+int main (int argc, char * argv[])
+{
+    Gallus_Engine * engine;
+    
+    engine = new FKill_Engine ();
+    engine->MainLoop ();
+    delete engine;
+    
+    return 0;
+}
+
+/*
+	================================================================
+	FKill_ENGINE
+	================================================================
+*/
+//
+// Constructor
+//
+FKill_Engine::FKill_Engine (void)
+{
+	Init ();
+}
+
+//
+// Deconstructor
+//
+FKill_Engine::~FKill_Engine (void)
+{
+	Quit ();
+}
+
+/*
+	INITING
+*/
+//
+// Init
+//
+void FKill_Engine::Init (void)
+{
+	srand (SDL_GetTicks ());
+    state = STATE_SPLASH;
+    InitSplash ();
+}
+
+
+//
+// InitSplash
+//
+void FKill_Engine::InitSplash (void)
+{
+    splash = LoadImage (IMG_SPLASH_FILENAME);
+	SetCaption (CAPTION_SPLASH);
+	splash_text.direction = DIR_RIGHT;
+	splash_text.posx = 0;
+	splash_text.speed = 2;
+
+	switch (rand()%6 + 1)
+	{
+		case 1:
+			splash_string =
+				"Now it's time for revenge!";
+			break;
+		case 2:
+			splash_string =
+				"Give them what they deserve!";
+			break;
+		case 3:
+			splash_string =
+				"Let's start the Furby autopsy!";
+			break;
+		case 4:
+			splash_string =
+				"Until there's noone left";
+			break;
+		case 5:
+			splash_string =
+				"Put them right where they belong!";
+			break;
+		case 6:
+			splash_string =
+				"Aim at the head!";
+			break;
+
+	}
+#ifndef NO_SOUND
+    splash_music = Mix_LoadMUS (SOUND_INTRO_FILENAME);	
+	Mix_PlayMusic (splash_music, -1);
+#endif
+}
+
+
+//
+// InitGame
+//
+void FKill_Engine::InitGame (void)
+{	
+	int i;
+
+	gameover = false;
+	left_mouse_up_between = true;
+	right_mouse_up_between = true;
+
+	respawntime		= 10;
+
+	reloadtime		= RELOAD_TIME;
+	last_shot		= SDL_GetTicks ();
+	
+	scroll_x		= 200;
+
+    // background
+	background		= LoadImage (IMG_LANDSCAPE_FILENAME);
+	
+	bg_srcrect.x	= scroll_x;
+	bg_srcrect.y	= 0;
+	bg_srcrect.w	= screen->w;
+	bg_srcrect.h	= screen->h;
+
+	SetCaption (CAPTION_INGAME);
+
+	//crosshair
+	crosshair = new Gallus_Sprite (IMG_CROSSHAIR_FILENAME, NULL);
+	crosshair->SetPos (screen->w/2 - crosshair->GetSurf()->w/2,
+		screen->h/2 - crosshair->GetSurf()->h/2);
+
+	// size of shot
+	temprect.w = 10;
+	temprect.w = 10;
+
+	// bullets
+	magenta = SDL_MapRGB (screen->format, 255, 0, 255);
+	bullet = LoadImage (IMG_BULLET_FILENAME);
+	bullet_rect.w = bullet->w;
+	bullet_rect.h = bullet->h;
+	SDL_SetColorKey (bullet, SDL_SRCCOLORKEY | SDL_RLEACCEL, magenta);
+	bulletsleft = NUM_BULLETS;
+	bullet_rect.y = 450;
+
+	// sound
+#ifndef NO_SOUND
+    start_round = Mix_LoadWAV (SOUND_STARTR_FILENAME);
+	
+	shoot_sound = Mix_LoadWAV (SOUND_SHOT_FILENAME);
+	scream		= Mix_LoadWAV (SOUND_SCREAM_FILENAME);
+	reload		= Mix_LoadWAV (SOUND_RELOAD_FILENAME);
+	
+	score_music	= Mix_LoadMUS (SOUND_ENDSOUND_FILENAME);
+
+	music		= Mix_LoadMUS (MUSIC_FILENAME);
+
+	Mix_PlayChannel (-1, start_round, 0);
+	Mix_PlayMusic (music, -1);
+#endif
+
+	score = 0;
+
+	crosshair->SetColorKey (magenta);
+
+	// Init enemies and corpses
+	for (i=0; i<NUM_ENEMIES; i++)
+	{
+		rand_distance = rand () % 3;
+		//rand_distance = DISTANCE_MIDDLE;
+		switch (rand_distance)
+		{
+		case DISTANCE_NEAR:
+			enemies[i] = new Gallus_Sprite (ENEMY_NEAR_FILENAME, &scroll_x);
+			break;
+		case DISTANCE_MIDDLE:
+			enemies[i] = new Gallus_Sprite (ENEMY_MIDDLE_FILENAME, &scroll_x);
+			break;
+		case DISTANCE_FAR:
+			enemies[i] = new Gallus_Sprite (ENEMY_FAR_FILENAME, &scroll_x);
+			break;
+		}
+
+		corpses[i] = new Gallus_Sprite (NULL, &scroll_x);
+		spawns[i] = new Gallus_Sprite (NULL, &scroll_x);
+		
+		enemies[i]->SetColorKey (magenta);
+		enemies[i]->SetVisible (false);
+		enemies[i]->SetDistance (rand_distance);
+
+		corpses[i]->SetVisible (false);
+		spawns[i]->SetVisible (false);
+	}	
+
+	//  Init extra score texts
+	for (i=0; i<NUM_ENEMIES; i++)
+	{
+		extrascore[i].visible = false;
+		extrascore[i].color = COLOR_RED;
+		extrascore[i].duration = FLYING_TEXT_DEF_DURATION;
+		extrascore[i].speed = FLYING_TEXT_DEF_SPEED;
+	}
+
+	// Init reload minus
+	reload_minus.color = COLOR_BLACK;
+	reload_minus.duration = FLYING_TEXT_DEF_DURATION;
+	reload_minus.pos_x = 700;
+	reload_minus.pos_y = 400;
+	reload_minus.speed = FLYING_TEXT_DEF_SPEED;
+	reload_minus.value = "-5";
+	reload_minus.visible = false;
+
+	step = 0;
+	roundtime = 90000; // = 1.30min = 90sec = 90000ms
+	minutes_left = 1;
+	seconds_left = 30;
+
+	starttime = SDL_GetTicks ();
+}
+
+/*
+	CLEANUP
+*/
+
+//
+// Quit
+//
+void FKill_Engine::Quit (void)
+{
+	int i;
+	if (state == STATE_SPLASH)
+	{
+#ifndef NO_SOUND
+		Mix_FreeMusic (splash_music);
+#endif
+		SDL_FreeSurface (splash);
+	}
+	else
+	{
+		// cleanup sound chunks
+#ifndef NO_SOUND
+		Mix_HaltMusic ();
+		Mix_FreeChunk (start_round);
+		Mix_FreeChunk (shoot_sound);
+		Mix_FreeChunk (scream);
+		Mix_FreeChunk (reload);
+		Mix_FreeMusic (score_music);
+		Mix_FreeMusic (music);
+#endif
+
+		// cleanup surfaces
+		SDL_FreeSurface (background);
+		SDL_FreeSurface (bullet);
+		
+		// cleanup sprites
+		delete crosshair;
+		for (i=0; i<NUM_ENEMIES; i++)
+		{
+			delete corpses[i];
+			delete enemies[i];
+		}
+	}
+}
+
+/*	
+	INPUT HANDLING
+*/
+
+//
+// ProcessInput
+//
+void FKill_Engine::ProcessInput (void)
+{
+    SDL_PumpEvents ();
+    keys = SDL_GetKeyState (NULL);
+    switch (state)
+    {
+        case STATE_SPLASH:
+            if (keys[SDLK_RETURN])
+            {
+                state = STATE_INGAME;
+                SDL_FreeSurface (splash);
+#ifndef NO_SOUND
+				Mix_FreeMusic (splash_music);
+				// TODO: this seems to be redundant...
+#endif
+				InitGame ();
+            }
+            break;
+        case STATE_INGAME:
+			if (!gameover)
+				GameInput ();
+            break;
+    }
+}
+
+//
+// GameInput
+//
+void FKill_Engine::GameInput (void)
+{
+	// mouse control
+	if (SDL_GetRelativeMouseState (&mousex, &mousey)&SDL_BUTTON(1)
+		&& SDL_GetTicks () - last_shot > reloadtime)
+	{
+		if (bulletsleft > 0 && left_mouse_up_between)
+		{
+			for (count=0; count<NUM_ENEMIES; count++)
+			{
+				temprect.x = crosshair->GetRect()->x + crosshair->GetSurf()->w / 2;
+				temprect.y = crosshair->GetRect()->y + crosshair->GetSurf()->h / 2;
+				if (enemies[count]->GetVisible() && Collision (&temprect, enemies[count]->GetRealRect ()))
+				{
+#ifndef NO_SOUND
+					Mix_PlayChannel (-1, scream, 0);
+#endif
+
+					enemies[count]->SetVisible (false);
+					for (count2=0; count2<NUM_ENEMIES; count2++)
+					{
+						if (!corpses[count2]->GetVisible())
+						{
+							corpses[count2]->SetVisible (true);
+							corpses[count2]->SetPos (enemies[count]->GetRect()->x, enemies[count]->GetRect()->y);
+							corpses[count2]->SetDistance (enemies[count]->GetDistance());
+							corpse_start_show[count2] = SDL_GetTicks ();
+
+							switch (corpses[count2]->GetDistance())
+							{
+							case DISTANCE_NEAR:
+								corpses[count2]->ChangeImage (CORPSE_NEAR_FILENAME);
+								break;
+							case DISTANCE_MIDDLE:
+								corpses[count2]->ChangeImage (CORPSE_MIDDLE_FILENAME);
+								break;
+							case DISTANCE_FAR:
+								corpses[count2]->ChangeImage (CORPSE_FAR_FILENAME);
+								break;
+							}
+
+							corpses[count2]->SetColorKey (magenta);
+							
+							break;
+						}
+					}
+					
+					last_shot = SDL_GetTicks ();
+					for (count2=0; count2<NUM_ENEMIES; count2++)
+					{
+						if (!extrascore[count2].visible)
+						{
+							switch (enemies[count]->GetDistance())
+							{
+							case DISTANCE_NEAR:
+								extrascore[count2].value = ENEMY_NEAR_POINTS;
+								score += ENEMY_NEAR_POINTS_I;
+								break;
+							case DISTANCE_MIDDLE:
+								extrascore[count2].value = ENEMY_MIDDLE_POINTS;
+								score += ENEMY_MIDDLE_POINTS_I;
+								break;
+							case DISTANCE_FAR:
+								extrascore[count2].value = ENEMY_FAR_POINTS;
+								score += ENEMY_FAR_POINTS_I;
+								break;
+							}
+							
+							extrascore[count2].pos_x = enemies[count]->GetRealRect()->x;
+							extrascore[count2].visible = true;
+							extrascore[count2].pos_y =
+								enemies[count]->GetRealRect()->y + enemies[count]->GetRect()->h/2;
+							extrascore[count2].starttime = SDL_GetTicks ();
+							break;
+						}
+					} 
+					break;
+				}
+			}
+#ifndef NO_SOUND
+			Mix_PlayChannel (-1, shoot_sound, 0);
+#endif
+			bulletsleft--;
+			left_mouse_up_between = false;
+		} // bulletsleft > 0
+	}
+	else
+		left_mouse_up_between = true;
+	
+	if (SDL_GetRelativeMouseState (NULL, NULL)&SDL_BUTTON(3) && right_mouse_up_between)
+	{
+		if (bulletsleft < NUM_BULLETS)
+		{
+			if (bulletsleft > 0)
+			{
+				score -= 5;
+				reload_minus.visible = true;
+				reload_minus.starttime = SDL_GetTicks ();
+			}
+#ifndef NO_SOUND
+			Mix_PlayChannel (-1, reload, 0);
+#endif
+			bulletsleft = NUM_BULLETS;
+		}
+		right_mouse_up_between = false;
+	}
+	else
+		right_mouse_up_between = true;
+
+	// crosshair moving
+	if ( (mousex > 0 && crosshair->GetRect()->x + crosshair->GetRect()->w + mousex < 800)
+		 || (mousex < 0 && crosshair->GetRect()->x - mousex > 0) )
+	{
+		 crosshair->IncrementPos (HORIZONTAL, mousex);
+	}
+	
+	if ( (mousey > 0 && crosshair->GetRect()->y + crosshair->GetRect()->h + mousey < 600)
+		 || (mousey < 0 && crosshair->GetRect()->y - mousey > 0) )
+	{
+		crosshair->IncrementPos (VERTICAL, mousey);
+	}
+
+	// keyboard scrolling
+	/*right_key_down = keys[SDLK_RIGHT];
+	left_key_down = keys[SDLK_LEFT];*/
+
+	if (keys[SDLK_LEFT])
+		left_key_down = true;
+	else 
+		left_key_down = false;
+
+	if (keys[SDLK_RIGHT])
+		right_key_down = true;
+	else
+		right_key_down = false;
+}
+
+/*
+	THINKING
+*/
+
+//
+// UpdateGame
+//
+void FKill_Engine::UpdateGame (void)
+{
+    if (state == STATE_INGAME)
+    {
+		// scrolling
+		if (crosshair->GetRect()->x > SCROLL_RIGHT && scroll_x < 2048 - SCREEN_WIDTH - SCROLL_SPEED)
+		{
+			scroll_x+=SCROLL_SPEED;
+		}
+		else if (crosshair->GetRect()->x < SCROLL_LEFT && scroll_x > 0 + SCROLL_SPEED)
+		{
+			scroll_x-=SCROLL_SPEED;			
+		}
+		else if (scroll_x - SCROLL_SPEED > 0 && left_key_down)
+		{
+			scroll_x-=SCROLL_SPEED;
+		}
+		else if (scroll_x < 2048 - SCREEN_WIDTH - SCROLL_SPEED && right_key_down)
+		{
+			scroll_x+=SCROLL_SPEED;
+		}
+		bg_srcrect.x = scroll_x;
+
+		// update enemies
+
+		// update corpses
+		for (count=0; count<NUM_ENEMIES; count++)
+		{
+			if (corpses[count]->GetVisible())
+			{
+				if (SDL_GetTicks () - corpse_start_show[count] > CORPSE_DURATION
+					|| corpses[count]->GetRect()->y > SCREEN_HEIGHT)
+					corpses[count]->SetVisible (false);
+				else
+				{
+					corpses[count]->IncrementPos (VERTICAL, 20);
+				}
+			}
+		}
+
+		// respawn
+		step++;
+		coll_with_other = false;
+		if (step == respawntime)
+		{
+			step = 0;
+
+			for (count=0; count<NUM_ENEMIES; count++)
+			{
+				if (!enemies[count]->GetVisible ())
+				{
+					enemies[count]->SetVisible (true);
+
+						/* RESPAWN ANYWHERE / EXCEPT WHERE SOMEONE ELSE IS */
+					do
+					{
+						enemies[count]->SetPos(rand() % 2048 - enemies[count]->GetRect()->w + 1,
+						rand() % (SCREEN_HEIGHT - enemies[count]->GetRect()->h) + 1);
+						for (count2=0; count2<NUM_ENEMIES; count2++)
+						{
+							if (count2 != count
+								&& enemies[count2]->GetDistance() == enemies[count]->GetDistance()
+								&& Collision (enemies[count2]->GetRect(), enemies[count]->GetRect()) )
+							{
+								coll_with_other = true;
+								break;
+							}
+							else
+								coll_with_other = false;
+						}
+					}
+					while (coll_with_other);
+
+					for (count2=0; count2<NUM_ENEMIES; count2++)
+					{
+						if (!spawns[count]->GetVisible())
+						{
+							switch (enemies[count]->GetDistance())
+							{
+							case DISTANCE_NEAR:
+								spawns[count2]->ChangeImage (SPAWN_NEAR_FILENAME);
+								break;
+							case DISTANCE_MIDDLE:
+								spawns[count2]->ChangeImage (SPAWN_MIDDLE_FILENAME);
+								break;
+							case DISTANCE_FAR:
+								spawns[count2]->ChangeImage (SPAWN_FAR_FILENAME);
+								break;
+							}
+
+							spawns[count2]->SetPos (enemies[count]->GetRect()->x, enemies[count]->GetRect()->y);
+							spawns[count2]->SetColorKey (magenta);
+							spawns[count2]->SetDistance (enemies[count]->GetDistance ());
+							spawn_start_show[count2] = SDL_GetTicks ();
+							spawns[count2]->SetVisible (true);
+
+							break;
+						}
+					}
+
+					break;
+				}
+			}
+		}
+
+		// update spawns
+		for (count=0; count<NUM_ENEMIES; count++)
+		{
+			if (spawns[count]->GetVisible ()
+				&& SDL_GetTicks() - spawn_start_show[count] > SPAWN_DURATION)
+			{
+				spawns[count]->SetVisible (false);
+			}
+		}
+
+		// movement
+		for (count=0; count<NUM_ENEMIES; count++)
+		{
+			if (enemies[count]->GetVisible ())
+			{
+				// random part
+				enemies[count]->IncrementPos (HORIZONTAL, (2-enemies[count]->GetDistance()+1) * ENEMY_SPEED);
+
+				// kill those unseen
+				if ( (enemies[count]->GetRect()->x > 2048)
+					|| (enemies[count]->GetRect()->x - enemies[count]->GetRect()->w < 0)
+					|| (enemies[count]->GetRect()->y > SCREEN_HEIGHT - enemies[count]->GetRect()->h)
+					|| (enemies[count]->GetRect()->y < 0) )
+				{
+					enemies[count]->SetVisible(false);
+				}
+			}
+		}
+
+		// update extrascore txts
+		for (count=0; count<NUM_ENEMIES; count++)
+		{
+			if (extrascore[count].visible)
+			{
+				if (SDL_GetTicks () - extrascore[count].starttime < extrascore[count].duration
+					&& extrascore[count].pos_y > 0)
+					extrascore[count].pos_y -= extrascore[count].speed;
+				else
+					extrascore[count].visible = false;
+			}
+		}
+
+		// update reload minus
+		if (SDL_GetTicks () - reload_minus.starttime < reload_minus.duration && reload_minus.pos_y > 0)
+			reload_minus.pos_y -= reload_minus.speed;
+		else
+		{
+			reload_minus.pos_y = 400;
+			reload_minus.visible = false;
+		}
+
+		// time
+		if (minutes_left == 0 && seconds_left == 0)
+		{
+			gameover = true;
+#ifndef NO_SOUND
+			Mix_HaltMusic ();
+            Mix_PlayMusic (score_music, -1);
+#endif
+			SetCaption("Gameover!");
+			minutes_left = 1;
+		}
+    }
+}
+
+/*
+	DISPLAY/VIDEO
+*/
+
+//
+// DrawScene
+//
+void FKill_Engine::DrawScene (void)
+{
+    switch (state)
+    {
+        case STATE_SPLASH:
+            DrawSplash ();            
+            break;
+        case STATE_INGAME:
+			DrawGame ();
+            break;
+    }
+    SDL_Flip (screen);
+}
+
+
+//
+// DrawSplash
+//
+void FKill_Engine::DrawSplash (void)
+{
+     DrawOnScreen (splash, NULL, NULL);
+	 UpdateMarquee (&splash_text, 0, 300);
+	 DrawText (splash_string, splash_text.posx, 520, COLOR_WHITE);
+
+	 if (VERSION != "final")
+		DrawText (VERSION, 10, 10, COLOR_WHITE);
+}
+
+
+//
+// DrawGame
+//
+void FKill_Engine::DrawGame (void)
+{
+	// Background
+	DrawOnScreen(background, &bg_srcrect, NULL);
+
+	// Enemies
+	for(enemy_draw_step=0; enemy_draw_step < 3; enemy_draw_step++)
+	{
+		for(count=0; count<NUM_ENEMIES; count++)
+		{
+			switch (enemy_draw_step)
+			{
+			case 0:
+				if(enemies[count]->GetDistance() == DISTANCE_FAR)
+					enemies[count]->Draw (screen);
+				break;
+			case 1:
+				if(enemies[count]->GetDistance() == DISTANCE_MIDDLE)
+					enemies[count]->Draw (screen);
+				break;
+			case 2:
+				if(enemies[count]->GetDistance() == DISTANCE_NEAR)
+					enemies[count]->Draw (screen);
+				break;
+			}
+		}
+	}
+
+	// Corpses
+	for(enemy_draw_step=0; enemy_draw_step < 3; enemy_draw_step++)
+	{
+		for(count=0; count<NUM_ENEMIES; count++)
+		{
+			switch (enemy_draw_step)
+			{
+			case 0:
+				if(corpses[count]->GetDistance() == DISTANCE_FAR)
+					corpses[count]->Draw (screen);
+				break;
+			case 1:
+				if(corpses[count]->GetDistance() == DISTANCE_MIDDLE)
+					corpses[count]->Draw (screen);
+				break;
+			case 2:
+				if(corpses[count]->GetDistance() == DISTANCE_NEAR)
+					corpses[count]->Draw (screen);
+				break;
+			}
+		}
+	}
+
+	// Spawns
+	for(enemy_draw_step=0; enemy_draw_step < 3; enemy_draw_step++)
+	{
+		for(count=0; count<NUM_ENEMIES; count++)
+		{
+			switch (enemy_draw_step)
+			{
+			case 0:
+				if(spawns[count]->GetDistance() == DISTANCE_FAR)
+					spawns[count]->Draw (screen);
+				break;
+			case 1:
+				if(spawns[count]->GetDistance() == DISTANCE_MIDDLE)
+					spawns[count]->Draw (screen);
+				break;
+			case 2:
+				if(spawns[count]->GetDistance() == DISTANCE_NEAR)
+					spawns[count]->Draw (screen);
+				break;
+			}
+		}
+	}
+
+	// Extrascore txts
+	for (count=0; count<NUM_ENEMIES; count++)
+	{
+		if (extrascore[count].visible)
+		{
+			DrawText(extrascore[count].value, extrascore[count].pos_x,
+				extrascore[count].pos_y, extrascore[count].color);
+		}
+	}
+
+	// Reload minus
+	if (reload_minus.visible)
+		DrawText (reload_minus.value, reload_minus.pos_x, reload_minus.pos_y, reload_minus.color);
+
+	// Crosshair
+	crosshair->Draw(screen);
+
+	// Bullets
+	for (count=0; count<bulletsleft; count++)
+	{
+		bullet_rect.x = 600 + count * 35;		
+		DrawOnScreen(bullet, NULL, &bullet_rect);
+	}
+
+	if (!gameover)
+	{
+		// Score
+		DrawText ("Score: ", 110, 10, 0);
+		sprintf (output, "%d", score);
+		DrawText (output, 300, 10, 0);
+		
+		// Time
+		minutes_left =
+			(roundtime - (SDL_GetTicks () - starttime)) / 1000 / 60;
+		seconds_left =
+			(roundtime - (SDL_GetTicks () - starttime)) / 1000 - minutes_left * 60;
+		
+		DrawText ("Time left: ", 400, 10, 0);
+		sprintf (output, "%d", minutes_left);
+		DrawText (output, 640, 10, 0);
+		DrawText (":", 660, 10, 0);
+		sprintf (output, "%d", seconds_left);
+
+		// add zero for less than 10 seconds
+		if (seconds_left < 10)
+		{
+			DrawText("0", 670, 10, 0);
+			DrawText (output, 690, 10, 0);
+		}
+		else
+			DrawText (output, 670, 10, 0);		
+	}
+
+	if (gameover)
+	{
+		DrawText ("Gameover!", 300, 100, 0);
+		DrawText ("Score: ", 10, 200, 0);
+		sprintf(output, "%d", score);
+		DrawText (output, 200, 200, 0);
+		DrawText ("Visit http://www.funkystuff.org for more games...", 10, 425, 0);
+		DrawText ("Thank you for playing FurbyKill, press escape!", 10, 500, 0);
+	}
+}
+
+//
+// UpdateMarquee
+//
+void FKill_Engine::UpdateMarquee (Marquee * marq, int min, int max)
+{
+	if (marq->direction == DIR_RIGHT)
+	{
+		if (marq->posx + marq->speed < max)
+			marq->posx += marq->speed;
+		else
+			marq->direction = DIR_LEFT;
+	}
+	else
+	{
+		if (marq->posx - marq->speed > min)
+			marq->posx -= marq->speed;
+		else
+			marq->direction = DIR_RIGHT;
+	}
+}

Source/FKill_Main.h

+// FKill_Main.h
+
+#ifndef FKILL_MAIN_H
+#define FKILL_MAIN_H
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_ttf.h>
+#include <SDL/SDL_mixer.h>
+#include "Gallus_Engine.h"
+#include "Gallus_Functions.h"
+
+/*
+	================================================================
+	DEFINES
+	================================================================
+*/
+
+#define VERSION			"Version 1.0"
+
+// scrolling
+#define SCROLL_SPEED	20
+
+// gamestates
+#define STATE_SPLASH    0
+#define STATE_INGAME    1
+
+// number of:
+#define NUM_ENEMIES     20
+#define NUM_BULLETS		5
+
+// directions
+#define DIR_RIGHT		0
+#define DIR_LEFT		1
+
+#define RELOAD_TIME		300 // in msec
+
+// captions
+#define CAPTION_SPLASH			"FurbyKill : Splashscreen"
+#define CAPTION_INGAME			"FurbyKill : Ingame"
+
+// filenames
+#define IMG_SPLASH_FILENAME		"Images/splash.jpg"
+
+#define IMG_LANDSCAPE_FILENAME	"Images/landscape.jpg"
+#define IMG_CROSSHAIR_FILENAME	"Images/crosshair.bmp"
+#define IMG_BULLET_FILENAME		"Images/bullet.bmp"
+
+#define SOUND_INTRO_FILENAME	"Audio/intro_sound.ogg"
+
+#define SOUND_STARTR_FILENAME	"Audio/start_round.ogg"
+
+#define SOUND_SHOT_FILENAME		"Audio/shot.ogg"
+#define SOUND_SCREAM_FILENAME	"Audio/scream.ogg"
+#define SOUND_RELOAD_FILENAME	"Audio/reload.ogg"
+
+#define SOUND_ENDSOUND_FILENAME	"Audio/end_sound.ogg"
+
+#define MUSIC_FILENAME			"Audio/music.ogg"
+
+// enemy stuff
+
+// enemy filenames
+#define ENEMY_FAR_FILENAME		"Images/enemy_far.bmp"
+#define ENEMY_MIDDLE_FILENAME	"Images/enemy_middle.bmp"
+#define ENEMY_NEAR_FILENAME		"Images/enemy_near.bmp"
+
+// corpse filenames
+#define CORPSE_FAR_FILENAME		"Images/corpse_far.bmp"
+#define CORPSE_MIDDLE_FILENAME	"Images/corpse_middle.bmp"
+#define CORPSE_NEAR_FILENAME	"Images/corpse_near.bmp"
+
+#define CORPSE_DURATION			1000
+
+// spawn filenames
+#define SPAWN_FAR_FILENAME		"Images/spawn_far.bmp"
+#define SPAWN_MIDDLE_FILENAME	"Images/spawn_middle.bmp"
+#define SPAWN_NEAR_FILENAME		"Images/spawn_near.bmp"
+
+#define SPAWN_DURATION			500
+
+// enemy states
+//#define ENEMY_NUM_STATES		4
+// distances
+#define ENEMY_DIST_NEAR			0
+#define ENEMY_DIST_MIDDLE		4
+#define ENEMY_DIST_FAR			8
+
+#define ENEMY_SPEED				1
+// points per hit
+#define ENEMY_NEAR_POINTS		"+5"
+#define ENEMY_MIDDLE_POINTS		"+15"
+#define ENEMY_FAR_POINTS		"+25"
+#define ENEMY_NEAR_POINTS_I		5
+#define ENEMY_MIDDLE_POINTS_I	15
+#define ENEMY_FAR_POINTS_I		25
+
+// flying text
+#define FLYING_TEXT_DEF_SPEED		4
+#define FLYING_TEXT_DEF_COLOR		COLOR_BLACK
+#define FLYING_TEXT_DEF_DURATION	1000
+
+// scrolling
+    // borders
+#define SCROLL_LEFT                 50
+#define SCROLL_RIGHT                670
+
+/*
+	================================================================
+	STRUCTURES
+	================================================================
+*/
+
+// for moving text msgs
+struct Marquee
+{
+	int posx;
+	int direction;
+	int speed;
+};
+
+// mostly for the additional score system
+struct FlyingText
+{
+	Uint32 starttime;
+	int pos_x, pos_y;
+	unsigned int speed, duration;
+	bool visible;
+	const char * value;
+	int color;
+};
+
+/*
+	================================================================
+	CLASSES
+	================================================================
+*/
+
+// main-class of Frontal21 - The Game
+class FKill_Engine : public Gallus_Engine
+{
+    public:
+		FKill_Engine (void);
+		~FKill_Engine (void);
+
+		// Inits
+        virtual void Init (void);		
+		void InitSplash (void);
+		void InitGame (void);
+
+		// Cleanup
+        virtual void Quit (void);
+        
+		// Input handling
+        virtual void ProcessInput (void);
+		void GameInput (void);
+
+		// Thinking
+        virtual void UpdateGame (void);
+
+		// Video
+        virtual void DrawScene (void);
+		void DrawSplash (void);	
+		void DrawGame (void);			
+
+		void UpdateMarquee (Marquee *, int, int);
+    private:
+		bool gameover, left_mouse_up_between, right_mouse_up_between;
+		bool coll_with_other;
+		bool right_key_down, left_key_down;
+        unsigned int state;
+
+		SDL_Surface * splash, * background;
+		SDL_Surface * bullet;
+#ifndef NO_SOUND
+		Mix_Music * music, * splash_music, * score_music;
+		Mix_Chunk * shoot_sound, * scream;
+		Mix_Chunk * start_round, * reload;
+#endif
+		
+		SDL_Rect bg_srcrect, temprect;
+		SDL_Rect bullet_rect;
+
+		Uint32 magenta;	
+		
+		Uint32 reloadtime, last_shot;		
+		Uint32 roundtime, starttime;
+		int minutes_left, seconds_left;
+
+		int mousex, mousey;
+		int scroll_x, cross_x;
+		int score, count, count2;
+		int step, respawntime;
+		int bulletsleft;
+	
+		char output[256];
+		const char * splash_string;
+
+		Gallus_Sprite * crosshair;
+
+        // TODO: all this shit should be replaced using linked lists!
+		Gallus_Sprite * enemies [NUM_ENEMIES];
+		Gallus_Sprite * corpses [NUM_ENEMIES];
+		Gallus_Sprite * spawns [NUM_ENEMIES];
+
+		int corpse_start_show [NUM_ENEMIES];
+		int spawn_start_show [NUM_ENEMIES];
+		int rand_distance, enemy_draw_step;
+
+		Marquee splash_text;		
+		FlyingText extrascore [NUM_ENEMIES];
+		FlyingText reload_minus;
+};
+
+#endif // FKILL_MAIN_H

Source/FurbyKill.dev

+[Project]
+FileName=FurbyKill.dev
+Name=FurbyKill
+UnitCount=8
+Type=0
+Ver=1
+ObjFiles=
+Includes=
+Libs=
+PrivateResource=FurbyKill_private.rc
+ResourceIncludes=
+MakeIncludes=
+Compiler=-I"<INCLUDE>\SDL" -Dmain=SDL_main_@@_
+CppCompiler=
+Linker=-lmingw32 -lSDLmain -lSDL -liberty -lSDL_image -lSDL_mixer -lSDL_ttf_@@_
+IsCpp=1
+Icon=FurbyKill.ico
+ExeOutput=..\..\FurbyKill
+ObjectOutput=obj
+OverrideOutput=0
+OverrideOutputName=FurbyKill.exe
+HostApplication=
+Folders=
+CommandLine=
+UseCustomMakefile=0
+CustomMakefile=
+IncludeVersionInfo=0
+SupportXPThemes=0
+CompilerSet=0
+CompilerSettings=0000000000000000000000
+
+[Unit1]
+FileName=FKill_Main.cpp
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit2]
+FileName=FKill_Main.h
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit3]
+FileName=Gallus_Engine.cpp
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit4]
+FileName=Gallus_Engine.h
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit5]
+FileName=Gallus_Functions.cpp
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit6]
+FileName=Gallus_Functions.h
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit7]
+FileName=Gallus_Sprite.cpp
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit8]
+FileName=Gallus_Sprite.h
+CompileCpp=1
+Folder=FurbyKill
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[VersionInfo]
+Major=0
+Minor=1
+Release=1
+Build=1
+LanguageID=1033
+CharsetID=1252
+CompanyName=
+FileVersion=
+FileDescription=Developed using the Dev-C++ IDE
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=
+AutoIncBuildNr=0
+
Added
New image

Source/FurbyKill.layout

+[Editor_0]
+CursorCol=16
+CursorRow=185
+TopLine=88
+LeftChar=1
+Open=1
+Top=0
+[Editor_1]
+CursorCol=52
+CursorRow=48
+TopLine=28
+LeftChar=1
+Open=1
+Top=1
+[Editor_2]
+CursorCol=42
+CursorRow=124
+TopLine=103
+LeftChar=1
+Open=0
+Top=0
+[Editor_3]
+CursorCol=51
+CursorRow=27
+TopLine=12
+LeftChar=1
+Open=0
+Top=0
+[Editor_4]
+CursorCol=10
+CursorRow=15
+TopLine=1
+LeftChar=1
+Open=0
+Top=0
+[Editor_6]
+CursorCol=1
+CursorRow=1
+TopLine=1
+LeftChar=1
+Open=0
+Top=0
+[Editor_5]
+CursorCol=1
+CursorRow=1
+TopLine=1
+LeftChar=1
+Open=0
+Top=0
+[Editors]
+Order=0,1
+Focused=1
+[Editor_7]
+Open=0
+Top=0
+CursorCol=1
+CursorRow=1
+TopLine=1
+LeftChar=1

Source/FurbyKill_private.h

+/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
+/* DO NOT EDIT ! */
+
+#ifndef FURBYKILL_PRIVATE_H
+#define FURBYKILL_PRIVATE_H
+
+/* VERSION DEFINITIONS */
+#define VER_STRING	"0.1.1.1"
+#define VER_MAJOR	0
+#define VER_MINOR	1
+#define VER_RELEASE	1
+#define VER_BUILD	1
+#define COMPANY_NAME	""
+#define FILE_VERSION	""
+#define FILE_DESCRIPTION	"Developed using the Dev-C++ IDE"
+#define INTERNAL_NAME	""
+#define LEGAL_COPYRIGHT	""
+#define LEGAL_TRADEMARKS	""
+#define ORIGINAL_FILENAME	""
+#define PRODUCT_NAME	""
+#define PRODUCT_VERSION	""
+
+#endif /*FURBYKILL_PRIVATE_H*/

Source/FurbyKill_private.rc

+/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
+/* DO NOT EDIT! */
+
+
+A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "FurbyKill.ico"
+

Source/Gallus_Engine.cpp

+// Gallus_Engine.cpp
+
+#include "Gallus_Engine.h"
+
+/*
+	================================================================
+	GALLUS_ENGINE
+	================================================================
+*/
+
+//
+// Gallus_Engine
+// Constructor
+//
+Gallus_Engine::Gallus_Engine (void)
+{
+    // for SetVideoMode
+    scr_width	= SCREEN_WIDTH;
+    scr_height	= SCREEN_HEIGHT;
+    scr_bpp		= SCREEN_BPP;
+    scr_flags	= SCREEN_FLAGS;
+    
+    // setup SDL
+    SDL_Init (INIT_FLAGS);
+    // setup video
+    SetVideoMode (scr_width, scr_height, scr_bpp, scr_flags);    
+	SDL_SetClipRect (screen, NULL);
+	
+    // setup WM	
+    SDL_WM_SetCaption ("FurbyKill", NULL);    
+    SDL_ShowCursor (SDL_DISABLE);
+
+    // so the game won't start before the video system is initialized
+	SDL_Delay (LENGTH_PREDELAY);
+
+    // some colors for drawing fonts
+	black.r = 0; black.g = 0; black.b = 0;
+	red.r = 255; red.g = 0; red.b = 0;
+	yellow.r = 255; yellow.g = 255; yellow.b = 0;
+	white.r = 255; white.g = 255; white.b = 255;
+
+    // setup fonts
+	TTF_Init ();
+	font = TTF_OpenFont (FONT_FILENAME, FONT_SIZE);
+
+    // init sound
+#ifndef NO_SOUND
+	Mix_OpenAudio (44100, AUDIO_S16SYS, 2, 2048);
+#endif
+}
+
+//
+// ~Gallus_Engine
+// Deconstructor
+//
+Gallus_Engine::~Gallus_Engine (void)
+{
+#ifndef NO_SOUND
+	Mix_CloseAudio ();
+#endif
+	TTF_CloseFont (font);
+	TTF_Quit ();
+    SDL_Quit ();
+}
+
+//
+// SetVideoMode
+//
+void Gallus_Engine::SetVideoMode (int width, int height,
+                                  int bitsperpixel, Uint32 flags)
+{
+    scr_width = width;
+    scr_height = height;
+    scr_bpp = bitsperpixel;
+    scr_flags = flags;
+    
+    screen = SDL_SetVideoMode (scr_width, scr_height, scr_bpp, scr_flags);
+}
+
+//
+// DrawOnScreen
+//
+void Gallus_Engine::DrawOnScreen (SDL_Surface * srcsurf, SDL_Rect * srcrect,
+                                  SDL_Rect * dstrect)
+{
+    SDL_BlitSurface (srcsurf, srcrect, screen, dstrect);
+}
+
+//
+// MainLoop
+//
+void Gallus_Engine::MainLoop (void)
+{
+    done = false;
+    SDL_Event event;
+	Uint32 ltime;
+    
+    while (!done)
+    {
+		ltime = SDL_GetTicks ();
+        ProcessEvents (&event);
+        UpdateGame ();
+        DrawScene ();
+		while (SDL_GetTicks ()-ltime < 1000/DESIRED_FPS);
+    }
+}
+
+//
+// ProcessEvents
+//
+void Gallus_Engine::ProcessEvents (SDL_Event * event)
+{
+    while (SDL_PollEvent (event))
+    {
+        switch (event->type)
+        {
+            case SDL_QUIT:
+                done = true;
+                break;
+            case SDL_KEYDOWN:
+                if (event->key.keysym.sym == SDLK_ESCAPE)
+                    done = true;
+				if (event->key.keysym.sym == SDLK_F5)
+                    SDL_SaveBMP(screen, "Screenshots/screen.bmp");
+
+                break;
+        }
+    }
+    ProcessInput ();
+}
+
+//
+// Collision
+//
+bool Gallus_Engine::Collision (SDL_Rect * rect1, SDL_Rect * rect2)
+{
+    return !((rect1->y + rect1->h < rect2->y) ||
+		(rect1->y > rect2->y + rect2->h) ||
+		(rect1->x + rect1->w < rect2->x) ||
+		(rect1->x > rect2->x + rect2->w));
+}
+
+//
+// SetCaption
+//
+void Gallus_Engine::SetCaption (const char * text)
+{
+	SDL_WM_SetCaption(text, NULL);
+}
+
+//
+// DrawText
+//
+void Gallus_Engine::DrawText (const char * text, int x, int y, int color)
+{
+	SDL_Surface * temp;
+	SDL_Rect rect;
+
+    // TODO: replace with switch (color)
+	if (color == COLOR_BLACK)
+		temp = TTF_RenderText_Solid (font, text, black);
+	else if (color == COLOR_RED)
+		temp = TTF_RenderText_Solid (font, text, red);
+	else if (color == COLOR_YELLOW)
+		temp = TTF_RenderText_Solid (font, text, yellow);
+	else if (color == COLOR_WHITE)
+	    temp = TTF_RenderText_Solid (font, text, white);
+
+	rect.w = temp->w;
+	rect.h = temp->h;
+	rect.x = x;
+	rect.y = y;
+
+	DrawOnScreen (temp, NULL, &rect);
+	SDL_FreeSurface (temp);
+}

Source/Gallus_Engine.h

+// Gallus_Engine.h
+
+#ifndef GALLUS_ENGINE_H
+#define GALLUS_ENGINE_H
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_ttf.h>
+#include <SDL/SDL_mixer.h>
+#include "Gallus_Functions.h"
+#include "Gallus_Sprite.h"
+
+/*
+	================================================================
+	DEFINES
+	================================================================
+*/
+
+#ifdef NO_SOUND
+    #define INIT_FLAGS		SDL_INIT_VIDEO
+#else
+    #define INIT_FLAGS		SDL_INIT_VIDEO | SDL_INIT_AUDIO
+#endif
+
+#define SCREEN_WIDTH	800
+#define	SCREEN_HEIGHT	600
+#define	SCREEN_BPP		16
+#define SCREEN_FLAGS	SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN
+
+#define FONT_FILENAME	"Fonts/font.ttf"
+#define FONT_SIZE		26
+
+#define LENGTH_PREDELAY	1000 // in msec
+
+#define COLOR_BLACK		0
+#define COLOR_RED		1
+#define COLOR_YELLOW	2
+#define COLOR_WHITE     3
+
+#define DESIRED_FPS		30
+
+/*
+	================================================================
+	CLASSES
+	================================================================
+*/
+
+class Gallus_Engine
+{
+    public:
+        Gallus_Engine (void);
+        ~Gallus_Engine (void);
+        
+        void DrawOnScreen (SDL_Surface *, SDL_Rect *, SDL_Rect *);
+        
+        virtual void Init (void) {}
+        virtual void Quit (void) {}
+        
+        void MainLoop (void);
+        void ProcessEvents (SDL_Event *);
+        virtual void ProcessInput (void) {}
+        virtual void UpdateGame (void) {}
+        virtual void DrawScene (void) {}
+
+		bool Collision (SDL_Rect *, SDL_Rect *);
+        
+		void SetCaption (const char *);
+
+		void DrawText (const char *, int, int, int);
+    protected:
+        SDL_Surface * screen;
+        void SetVideoMode (int, int, int, Uint32);
+        Uint8 * keys;        
+    private:        
+        bool done;
+        int scr_width, scr_height, scr_bpp;
+        Uint32 scr_flags;
+		SDL_Color black, red, yellow, white;
+		TTF_Font * font;
+};
+
+#endif // GALLUS_ENGINE_H

Source/Gallus_Functions.cpp

+/*
+  Name: Gallus_Functions.cpp
+  Copyright: GPL
+  Author: Der Rebell
+  Date: 04.05.05 15:44
+  Description: this is a tiny attemp of an engine for making clones of the
+  stupid game "Moorhuhn"...
+*/
+
+/*
+	================================================================
+	INCLUDES
+	================================================================
+*/
+#include "Gallus_Functions.h"
+
+/*
+	================================================================
+	FUNCTIONS
+	================================================================
+*/
+//
+// LoadImage
+// Load and convert
+//
+SDL_Surface * LoadImage (const char * filename)
+{
+    SDL_Surface * image, * temp;
+    
+    temp = IMG_Load (filename);
+    image = SDL_DisplayFormat (temp);
+    SDL_FreeSurface (temp);
+    
+    return image;
+}

Source/Gallus_Functions.h

+// Gallus_Functions.h
+
+#ifndef GALLUS_FUNCTIONS_H
+#define GALLUS_FUNCTIONS_H
+
+#include <SDL/SDL.h>
+#include <SDL/SDL_image.h>
+
+SDL_Surface * LoadImage (const char *);
+
+#endif // GALLUS_FUNCTIONS_H

Source/Gallus_Sprite.cpp

+/*
+  Name: Gallus_Sprite.cpp
+  Copyright: GPL
+  Author: Der Rebell
+  Date: 04.05.05 15:44
+  Description: this is a tiny attemp of an engine for making clones of the
+  stupid game "Moorhuhn"...
+*/
+
+/*
+	================================================================
+	INCLUDES
+	================================================================
+*/
+
+#include "Gallus_Sprite.h"
+
+/*
+	================================================================
+	GALLUS_SPRITE
+	================================================================
+*/
+//
+// Gallus_Sprite
+// Constructor
+//
+Gallus_Sprite::Gallus_Sprite (const char * filename, int * pscroll)
+{
+	if (pscroll == NULL)
+		independent = true;
+	else
+	{
+		scroll = pscroll;
+		independent = false;
+	}
+
+	if (filename != NULL)
+	{
+		image = LoadImage (filename);
+		rect.w = image->w;
+		rect.h = image->h;
+	}
+
+    rect.x = 0;
+    rect.y = 0;
+
+	visible = true;
+}
+
+//
+// ~Gallus_Sprite
+// Deconstructor
+//
+Gallus_Sprite::~Gallus_Sprite (void)
+{
+    SDL_FreeSurface (image);
+}
+
+//
+// ChangeImage
+//
+void Gallus_Sprite::ChangeImage (const char * newfilename)
+{
+	image = LoadImage (newfilename);
+	rect.w = image->w;
+	rect.h = image->h;
+}
+
+//
+// SetPos
+//
+void Gallus_Sprite::SetPos (int posx, int posy)
+{
+    rect.x = posx;
+    rect.y = posy;
+}
+
+//
+// IncrementPos
+//
+void Gallus_Sprite::IncrementPos (int dir, int size)
+{
+	if (dir == HORIZONTAL)
+		rect.x += size;
+	else
+		rect.y += size;
+}
+
+//
+// GetPos
+//
+void Gallus_Sprite::GetPos (int * posx, int * posy)
+{
+    *posx = rect.x;
+    *posy = rect.y;
+}
+
+//
+// GetSurface
+//
+SDL_Surface * Gallus_Sprite::GetSurf (void)
+{
+    return image;
+}
+
+//
+// GetRect
+//
+SDL_Rect * Gallus_Sprite::GetRect (void)
+{
+    return &rect;
+}
+
+
+//
+// GetRealRect
+//
+SDL_Rect * Gallus_Sprite::GetRealRect (void)
+{
+	if (!independent)
+	{
+		UpdateRealRect ();
+			
+		return &real_rect;
+	}
+	else
+		return NULL;
+}
+
+// 
+// UpdateRealRect
+//
+void Gallus_Sprite::UpdateRealRect (void)
+{
+	real_rect = rect;
+	real_rect.x = rect.x - *scroll;
+}
+
+//
+// SetColorKey
+//
+void Gallus_Sprite::SetColorKey (Uint32 color)
+{
+	SDL_SetColorKey (image, SDL_SRCCOLORKEY | SDL_RLEACCEL, color);
+}
+
+//
+// Set Visible
+//
+void Gallus_Sprite::SetVisible (bool nvis)
+{
+	visible = nvis;
+}
+
+//
+// GetVisible
+//
+bool Gallus_Sprite::GetVisible (void)
+{
+	return visible;
+}
+
+//
+// SetDistance
+//
+void Gallus_Sprite::SetDistance (int ndist)
+{
+	if (!independent)
+		distance = ndist;
+}
+
+//
+// GetDistance
+//
+int Gallus_Sprite::GetDistance (void)
+{
+	return distance;
+}
+
+//
+// Draw
+//
+void Gallus_Sprite::Draw (SDL_Surface * target)
+{
+	if (visible)
+	{
+		if (!independent)
+		{
+			UpdateRealRect ();
+			SDL_BlitSurface (image, NULL, target, &real_rect);
+		}
+		else
+			SDL_BlitSurface (image, NULL, target, &rect);
+	}
+}

Source/Gallus_Sprite.h

+/*
+  Name: Gallus_Sprite.h
+  Copyright: GPL
+  Author: Der Rebell
+  Date: 04.05.05 15:44
+  Description: this is a tiny attemp of an engine for making clones of the
+  stupid game "Moorhuhn"...
+*/
+
+#ifndef GALLUS_SPRITE_H
+#define GALLUS_SPRITE_H
+
+#include <SDL/SDL.h>
+#include "Gallus_Functions.h"
+
+#define HORIZONTAL	0
+#define VERTICAL	1
+
+#define DISTANCE_NEAR		0
+#define DISTANCE_MIDDLE		1
+#define DISTANCE_FAR		2
+
+#define SPEED_NEAR			1
+#define SPEED_MIDDLE		2
+#define SPEED_FAR			3
+
+class Gallus_Sprite
+{
+    public:
+        Gallus_Sprite (const char *, int *);
+        ~Gallus_Sprite (void);
+
+		void ChangeImage (const char *);
+        
+        void SetPos (int, int);
+		void IncrementPos (int, int);
+        void GetPos (int *, int *);
+        
+        SDL_Surface * GetSurf (void);
+		SDL_Rect * GetRect (void);
+		SDL_Rect * GetRealRect (void);
+		void UpdateRealRect (void);
+
+		void SetColorKey (Uint32);
+        
+		void SetVisible (bool);
+		bool GetVisible (void);
+
+		void SetDistance (int);
+		int GetDistance (void);
+
+        void Draw (SDL_Surface *);
+    private:  
+        SDL_Surface * image;
+        SDL_Rect rect, real_rect;
+		bool visible;
+		int * scroll;
+		bool independent;
+		int distance;
+};
+
+#endif // GALLUS_SPRITE_H

Source/Makefile.win

+# Project: FurbyKill
+# Makefile created by Dev-C++ 4.9.9.2
+
+CPP  = g++.exe
+CC   = gcc.exe
+WINDRES = windres.exe
+RES  = obj/FurbyKill_private.res
+OBJ  = obj/FKill_Main.o obj/Gallus_Engine.o obj/Gallus_Functions.o obj/Gallus_Sprite.o $(RES)
+LINKOBJ  = obj/FKill_Main.o obj/Gallus_Engine.o obj/Gallus_Functions.o obj/Gallus_Sprite.o $(RES)
+LIBS =  -L"C:/Dev-Cpp/lib" -mwindows -lmingw32 -lSDLmain -lSDL -liberty -lSDL_image -lSDL_mixer -lSDL_ttf  
+INCS =  -I"C:/Dev-Cpp/include" 
+CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include" 
+BIN  = ../FurbyKill.exe
+CXXFLAGS = $(CXXINCS)  
+CFLAGS = $(INCS) -I"C:\Dev-Cpp\\include\SDL" -Dmain=SDL_main  
+RM = rm -f
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before ../FurbyKill.exe all-after
+
+
+clean: clean-custom
+	${RM} $(OBJ) $(BIN)
+
+$(BIN): $(OBJ)
+	$(CPP) $(LINKOBJ) -o "..\FurbyKill.exe" $(LIBS)
+
+obj/FKill_Main.o: FKill_Main.cpp
+	$(CPP) -c FKill_Main.cpp -o obj/FKill_Main.o $(CXXFLAGS)
+
+obj/Gallus_Engine.o: Gallus_Engine.cpp
+	$(CPP) -c Gallus_Engine.cpp -o obj/Gallus_Engine.o $(CXXFLAGS)
+
+obj/Gallus_Functions.o: Gallus_Functions.cpp
+	$(CPP) -c Gallus_Functions.cpp -o obj/Gallus_Functions.o $(CXXFLAGS)
+
+obj/Gallus_Sprite.o: Gallus_Sprite.cpp
+	$(CPP) -c Gallus_Sprite.cpp -o obj/Gallus_Sprite.o $(CXXFLAGS)
+
+obj/FurbyKill_private.res: FurbyKill_private.rc 
+	$(WINDRES) -i FurbyKill_private.rc --input-format=rc -o obj/FurbyKill_private.res -O coff 
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>