diff --git a/.gitignore b/.gitignore index d85f4323..0df4fb9b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ configure libtool stamp-* *-stamp -deushax-*.tar.* +lolengine-*.tar.* # Debugging cruft core core.* diff --git a/configure.ac b/configure.ac index 5f948af9..5791c8cb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # $Id$ -AC_INIT(deushax, 0.0) +AC_INIT(lolengine, 0.0) AC_PREREQ(2.50) AC_CONFIG_AUX_DIR(.auto) AC_CANONICAL_SYSTEM diff --git a/src/Makefile.am b/src/Makefile.am index 48e814db..ce38adeb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,7 @@ noinst_LIBRARIES = liblol.a liblol_a_SOURCES = \ - core.h matrix.h game.cpp game.h tiler.cpp tiler.h dict.cpp dict.h \ + core.h matrix.h tiler.cpp tiler.h dict.cpp dict.h \ scene.cpp scene.h font.cpp font.h layer.cpp layer.h map.cpp map.h \ entity.cpp entity.h ticker.cpp ticker.h tileset.cpp tileset.h \ forge.cpp forge.h video.cpp video.h timer.cpp timer.h bitfield.h \ @@ -10,8 +10,7 @@ liblol_a_SOURCES = \ \ sdlinput.cpp sdlinput.h \ \ - debugfps.cpp debugfps.h debugsprite.cpp debugsprite.h \ - debugrecord.cpp debugrecord.h debugstats.cpp debugstats.h \ - debugsphere.cpp debugsphere.h debugboard.cpp debugboard.h + debugfps.cpp debugfps.h debugsphere.cpp debugsphere.h \ + debugrecord.cpp debugrecord.h debugstats.cpp debugstats.h liblol_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` diff --git a/src/bitfield.h b/src/bitfield.h index 8be27c1b..cad2153b 100644 --- a/src/bitfield.h +++ b/src/bitfield.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/core.h b/src/core.h index dc088d23..a46a7e4a 100644 --- a/src/core.h +++ b/src/core.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // @@ -24,7 +29,6 @@ // Entities #include "entity.h" #include "font.h" -#include "game.h" #include "tileset.h" #include "world.h" diff --git a/src/debugboard.cpp b/src/debugboard.cpp deleted file mode 100644 index 3f6d0799..00000000 --- a/src/debugboard.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010-2011 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "core.h" -#include "debugboard.h" - -/* - * DebugBoard implementation class - */ - -class DebugBoardData -{ - friend class DebugBoard; - -private: - Game *game; - int tiler; - float x, y, z; -}; - -/* - * Public DebugBoard class - */ - -DebugBoard::DebugBoard(Game *game) -{ - data = new DebugBoardData(); - data->game = game; - Ticker::Ref(game); - data->tiler = Tiler::Register("monsterz/tiles.png", 48); - data->x = 32; - data->y = 0; - data->z = 112; -} - -void DebugBoard::TickGame(float deltams) -{ - Entity::TickGame(deltams); -} - -void DebugBoard::TickDraw(float deltams) -{ - Entity::TickDraw(deltams); - - int x = data->x; - int y = data->y; - int z = data->z; - - for (int j = 0; j < 8; j++) - for (int i = 0; i < 8; i++) - { - int id = 28 + ((i + 3) * (j + 1) % 10) * 3 + ((i ^ (j + 2)) % 5); - id += (id % 5) / 4; - data->game->GetScene()->AddTile((data->tiler << 16) | id, - x + i * 48 - 16, y + j * 48, z, 1); - } -} - -DebugBoard::~DebugBoard() -{ - Ticker::Unref(data->game); - Tiler::Deregister(data->tiler); - delete data; -} - diff --git a/src/debugboard.h b/src/debugboard.h deleted file mode 100644 index fd18d177..00000000 --- a/src/debugboard.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010-2011 Sam Hocevar -// - -// -// The DebugBoard class -// -------------------- -// - -#if !defined __DH_DEBUGBOARD_H__ -#define __DH_DEBUGBOARD_H__ - -#include "entity.h" -#include "game.h" - -class DebugBoardData; - -class DebugBoard : public Entity -{ -public: - DebugBoard(Game *game); - virtual ~DebugBoard(); - -protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); - -private: - DebugBoardData *data; -}; - -#endif // __DH_DEBUGBOARD_H__ - diff --git a/src/debugfps.cpp b/src/debugfps.cpp index 66a1ae51..6b6b8856 100644 --- a/src/debugfps.cpp +++ b/src/debugfps.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/debugfps.h b/src/debugfps.h index e5bcd5b3..63cff7c9 100644 --- a/src/debugfps.h +++ b/src/debugfps.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/debugrecord.cpp b/src/debugrecord.cpp index 62de9983..0892ef8d 100644 --- a/src/debugrecord.cpp +++ b/src/debugrecord.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/debugrecord.h b/src/debugrecord.h index 0958de50..57632780 100644 --- a/src/debugrecord.h +++ b/src/debugrecord.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/debugsphere.cpp b/src/debugsphere.cpp index 9bb22420..8173f980 100644 --- a/src/debugsphere.cpp +++ b/src/debugsphere.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/debugsphere.h b/src/debugsphere.h index f7d00afd..3d19d6c0 100644 --- a/src/debugsphere.h +++ b/src/debugsphere.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/debugsprite.cpp b/src/debugsprite.cpp deleted file mode 100644 index 66222a7d..00000000 --- a/src/debugsprite.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "core.h" -#include "debugsprite.h" - -/* - * DebugSprite implementation class - */ - -class DebugSpriteData -{ - friend class DebugSprite; - -private: - Game *game; - int tiler; - float x, y, z; -}; - -/* - * Public DebugSprite class - */ - -DebugSprite::DebugSprite(Game *game) -{ - data = new DebugSpriteData(); - data->game = game; - Ticker::Ref(game); - data->tiler = Tiler::Register("art/test/character-dress.png", 32); - data->x = 320; - data->y = 206; - data->z = 0; -} - -void DebugSprite::TickGame(float deltams) -{ - Entity::TickGame(deltams); - - Float2 axis = Input::GetAxis(0); - data->x += 0.1f * sqrtf(2.0f) * deltams * axis.x; - data->y += 0.1f * deltams * axis.y; -} - -void DebugSprite::TickDraw(float deltams) -{ - Entity::TickDraw(deltams); - - int x = data->x; - int y = data->y; - int z = data->z; - - data->game->GetScene()->AddTile((data->tiler << 16) | 31, - x - 16, y, z, 1); - data->game->GetScene()->AddTile((data->tiler << 16) | 15, - x - 16, y, z + 32, 1); -} - -DebugSprite::~DebugSprite() -{ - Ticker::Unref(data->game); - Tiler::Deregister(data->tiler); - delete data; -} - diff --git a/src/debugsprite.h b/src/debugsprite.h deleted file mode 100644 index e752a337..00000000 --- a/src/debugsprite.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -// -// The DebugSprite class -// --------------------- -// - -#if !defined __DH_DEBUGSPRITE_H__ -#define __DH_DEBUGSPRITE_H__ - -#include "entity.h" -#include "game.h" - -class DebugSpriteData; - -class DebugSprite : public Entity -{ -public: - DebugSprite(Game *game); - virtual ~DebugSprite(); - -protected: - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); - -private: - DebugSpriteData *data; -}; - -#endif // __DH_DEBUGSPRITE_H__ - diff --git a/src/debugstats.cpp b/src/debugstats.cpp index 55b283cb..7e5dd173 100644 --- a/src/debugstats.cpp +++ b/src/debugstats.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/debugstats.h b/src/debugstats.h index d52efa0b..99a793ea 100644 --- a/src/debugstats.h +++ b/src/debugstats.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/dict.cpp b/src/dict.cpp index 0102ff5d..950e37fa 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/dict.h b/src/dict.h index d704757a..3fb1b655 100644 --- a/src/dict.h +++ b/src/dict.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/entity.cpp b/src/entity.cpp index f6e0364e..135c3147 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/entity.h b/src/entity.h index 50e28664..bf3110f0 100644 --- a/src/entity.h +++ b/src/entity.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/font.cpp b/src/font.cpp index f762ddf9..d8e20900 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/font.h b/src/font.h index 9ae86117..7994bf66 100644 --- a/src/font.h +++ b/src/font.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/forge.cpp b/src/forge.cpp index b6d61cf8..476ac2d5 100644 --- a/src/forge.cpp +++ b/src/forge.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/forge.h b/src/forge.h index d7330d0f..a4e0aece 100644 --- a/src/forge.h +++ b/src/forge.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/game.cpp b/src/game.cpp deleted file mode 100644 index 332a3f62..00000000 --- a/src/game.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "core.h" - -/* - * Game implementation class - */ - -class GameData -{ - friend class Game; - -private: - Map *map; - int x, y; - int mousex, mousey; - int done; - - Scene *scene; -}; - -/* - * Public Game class - */ - -Game::Game(char const *mapname) -{ - data = new GameData(); - data->map = new Map(mapname); - data->x = data->y = 0; - data->done = 0; - data->scene = NULL; -} - -Game::~Game() -{ - delete data->map; - delete data; -} - -void Game::TickGame(float deltams) -{ - Entity::TickGame(deltams); -} - -void Game::TickDraw(float deltams) -{ - Entity::TickDraw(deltams); - - GetScene(); - - data->map->Render(data->scene, -data->mousex, -data->mousey, 0); - data->scene->Render(); - - delete data->scene; - data->scene = NULL; -} - -Scene *Game::GetScene() -{ - if (!data->scene) - data->scene = new Scene(); - return data->scene; -} - -void Game::SetMouse(int x, int y) -{ - data->mousex = x; - data->mousey = y; -} - -void Game::Quit() -{ - data->done = 1; -} - -int Game::Finished() -{ - return data->done; -} - diff --git a/src/game.h b/src/game.h deleted file mode 100644 index 0d64c6ee..00000000 --- a/src/game.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar -// - -// -// The Game class -// -------------- -// - -#if !defined __DH_GAME_H__ -#define __DH_GAME_H__ - -#include "entity.h" -#include "scene.h" - -class GameData; - -class Game : public Entity -{ -public: - Game(char const *mapname); - ~Game(); - -protected: - /* Inherited from Entity */ - virtual void TickGame(float deltams); - virtual void TickDraw(float deltams); - -public: - /* New methods */ - Scene *GetScene(); - void SetMouse(int x, int y); - void Quit(); - int Finished(); - -private: - GameData *data; -}; - -#endif // __DH_GAME_H__ - diff --git a/src/input.cpp b/src/input.cpp index 590c2068..db3c90b5 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/input.h b/src/input.h index d61bf961..d5e7155d 100644 --- a/src/input.h +++ b/src/input.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/layer.cpp b/src/layer.cpp index 3aee24ab..a663f6a0 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/layer.h b/src/layer.h index 3a33660e..1be0a428 100644 --- a/src/layer.h +++ b/src/layer.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/map.cpp b/src/map.cpp index 8f21d6af..432e9fd5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H @@ -121,7 +126,7 @@ Map::Map(char const *path) else if (sscanf(tmp, " tilers[data->ntilers] = Tiler::Register(str, 32); + data->tilers[data->ntilers] = Tiler::Register(str, 32, 32); data->ntilers++; //fprintf(stderr, "new tiler %s\n", str); } diff --git a/src/map.h b/src/map.h index 4a074d48..f13f8844 100644 --- a/src/map.h +++ b/src/map.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/matrix.h b/src/matrix.h index 36c5e74a..d8d96508 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/profiler.cpp b/src/profiler.cpp index 80dc33b3..5d9a9001 100644 --- a/src/profiler.cpp +++ b/src/profiler.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/profiler.h b/src/profiler.h index abdc3547..d2348e7c 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/scene.cpp b/src/scene.cpp index ba21dd84..15e90dac 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/scene.h b/src/scene.h index e749be20..0226143a 100644 --- a/src/scene.h +++ b/src/scene.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/sdlinput.cpp b/src/sdlinput.cpp index 571e018c..8d5d2673 100644 --- a/src/sdlinput.cpp +++ b/src/sdlinput.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/sdlinput.h b/src/sdlinput.h index c32061f9..3c85abd6 100644 --- a/src/sdlinput.h +++ b/src/sdlinput.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // @@ -12,7 +17,6 @@ #define __DH_SDLINPUT_H__ #include "entity.h" -#include "game.h" class SdlInputData; diff --git a/src/ticker.cpp b/src/ticker.cpp index ed5ebfdc..43905b6c 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/ticker.h b/src/ticker.h index 7720640c..e6fe9079 100644 --- a/src/ticker.h +++ b/src/ticker.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/tiler.cpp b/src/tiler.cpp index 3b730cf6..877745fd 100644 --- a/src/tiler.cpp +++ b/src/tiler.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H @@ -28,13 +33,13 @@ static TilerData * const data = &tilerdata; * Public Tiler class */ -int Tiler::Register(char const *path, int size) +int Tiler::Register(char const *path, int w, int h) { int id = data->tilesets.MakeSlot(path); if (!data->tilesets.GetEntity(id)) { - TileSet *tileset = new TileSet(path, size); + TileSet *tileset = new TileSet(path, w, h); data->tilesets.SetEntity(id, tileset); } diff --git a/src/tiler.h b/src/tiler.h index a638a566..a4e061ef 100644 --- a/src/tiler.h +++ b/src/tiler.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // @@ -17,7 +22,7 @@ class Tiler { public: - static int Register(char const *path, int size); + static int Register(char const *path, int w, int h); static void Deregister(int id); static void BlitTile(uint32_t code, int x, int y, int z, int o); diff --git a/src/tileset.cpp b/src/tileset.cpp index a296aea0..be9a2f3e 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H @@ -37,7 +42,7 @@ class TileSetData private: char *name; int *tiles; - int size, nw, nh, ntiles; + int w, h, nw, nh, ntiles; float tx, ty; SDL_Surface *img; @@ -48,7 +53,7 @@ private: * Public TileSet class */ -TileSet::TileSet(char const *path, int size) +TileSet::TileSet(char const *path, int w, int h) { data = new TileSetData(); data->name = strdup(path); @@ -66,15 +71,19 @@ TileSet::TileSet(char const *path, int size) exit(1); } - if (size <= 0) - size = 32; + if (w <= 0) + w = 32; + if (h <= 0) + h = 32; - data->size = size; - data->nw = data->img->w / size; - data->nh = data->img->h / size; + data->w = w; + data->h = h; + /* FIXME: check for non-zero here */ + data->nw = data->img->w / w; + data->nh = data->img->h / h; data->ntiles = data->nw * data->nh; - data->tx = (float)size / data->img->w; - data->ty = (float)size / data->img->h; + data->tx = (float)w / data->img->w; + data->ty = (float)h / data->img->h; drawgroup = DRAWGROUP_BEFORE; } @@ -99,11 +108,14 @@ void TileSet::TickDraw(float deltams) } else if (data->img) { + GLuint format = data->img->format->Amask ? GL_RGBA : GL_RGB; + int planes = data->img->format->Amask ? 4 : 3; + glGenTextures(1, &data->texture); glBindTexture(GL_TEXTURE_2D, data->texture); - glTexImage2D(GL_TEXTURE_2D, 0, 4, data->img->w, data->img->h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, data->img->pixels); + glTexImage2D(GL_TEXTURE_2D, 0, planes, data->img->w, data->img->h, 0, + format, GL_UNSIGNED_BYTE, data->img->pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -124,10 +136,10 @@ void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o) float ty = data->ty * ((id & 0xffff) / data->nw); float sqrt2 = sqrtf(2.0f); - int off = o ? data->size : 0; - int dx = data->size; - int dy = data->size * 38 / 32; /* Magic... fix this one day */ - int dy2 = data->size * 70 / 32; + int off = o ? data->h : 0; + int dx = data->w; + int dy = data->h * 38 / 32; /* Magic... fix this one day */ + int dy2 = data->h * 70 / 32; if (!data->img) { diff --git a/src/tileset.h b/src/tileset.h index 84f96406..a050da38 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // @@ -23,7 +28,7 @@ class TileSetData; class TileSet : public Entity { public: - TileSet(char const *path, int size); + TileSet(char const *path, int w, int h); virtual ~TileSet(); protected: diff --git a/src/timer.cpp b/src/timer.cpp index e19e7e8d..954e496b 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/timer.h b/src/timer.h index 6fa730ef..aa5c5fda 100644 --- a/src/timer.h +++ b/src/timer.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/video.cpp b/src/video.cpp index 4630c0cd..c3a31173 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/video.h b/src/video.h index ce676b8e..d573d4bb 100644 --- a/src/video.h +++ b/src/video.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // // diff --git a/src/world.cpp b/src/world.cpp index 95c9863d..c0becb5d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // #if defined HAVE_CONFIG_H diff --git a/src/world.h b/src/world.h index 3e90406b..7a0403b2 100644 --- a/src/world.h +++ b/src/world.h @@ -1,6 +1,11 @@ // -// Deus Hax (working title) -// Copyright (c) 2010 Sam Hocevar +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://sam.zoy.org/projects/COPYING.WTFPL for more details. // //