- fixed bricktile
authorIngo Ruhnke <grumbel@gmx.de>
Thu, 25 Mar 2004 02:27:45 +0000 (02:27 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Thu, 25 Mar 2004 02:27:45 +0000 (02:27 +0000)
SVN-Revision: 353

src/gameloop.cpp
src/gameloop.h
src/level.cpp
src/player.cpp
src/tile.cpp

index 5addbe7..66e392e 100644 (file)
@@ -1318,17 +1318,19 @@ void unloadshared(void)
 
 void drawshape(float x, float y, unsigned int c)
 {
-  Tile* ptile = TileManager::instance()->get
-                (c);
-  if(ptile)
+  if (c != 0)
     {
-      if(ptile->images.size() > 1)
+      Tile* ptile = TileManager::instance()->get(c);
+      if(ptile)
         {
-          texture_draw(&ptile->images[( ((global_frame_counter*25) / ptile->anim_speed) % (ptile->images.size()))],x,y);
-        }
-      else
-        {
-          texture_draw(&ptile->images[0],x,y);
+          if(ptile->images.size() > 1)
+            {
+              texture_draw(&ptile->images[( ((global_frame_counter*25) / ptile->anim_speed) % (ptile->images.size()))],x,y);
+            }
+          else
+            {
+              texture_draw(&ptile->images[0],x,y);
+            }
         }
     }
 
index a92f85f..31230a5 100644 (file)
@@ -28,7 +28,9 @@ extern int game_started;
 extern st_level current_level;
 
 /* Function prototypes: */
+class Tile;
 
+Tile* gettile(float x, float y);
 int gameloop(const char * subset, int levelnb, int mode);
 void savegame(int slot);
 void loadgame(int slot);
index c6fe377..eebecdf 100644 (file)
@@ -290,7 +290,10 @@ int level_load(st_level* plevel, const char* filename)
       reader.read_string("background",  &plevel->bkgd_image);
       reader.read_string("particle_system", &plevel->particle_system);
       reader.read_int_vector("background-tm",  &bg_tm);
-      reader.read_int_vector("interactive-tm", &ia_tm);
+
+      if (!reader.read_int_vector("interactive-tm", &ia_tm))
+        reader.read_int_vector("tilemap", &ia_tm);
+
       reader.read_int_vector("dynamic-tm",     &dn_tm);
       reader.read_int_vector("foreground-tm",  &fg_tm);
 
@@ -614,8 +617,6 @@ void tilemap_change_size(unsigned int** tilemap[15], int w, int old_w)
 /* Change the size of a level (width) */
 void level_change_size (st_level* plevel, int new_width)
 {
-  int y;
-
   if(new_width < 21)
     new_width = 21;
   tilemap_change_size((unsigned int***)&plevel->ia_tiles,new_width,plevel->width);
index c6daeae..b40e093 100644 (file)
@@ -15,6 +15,7 @@
 #include "player.h"
 #include "defines.h"
 #include "scene.h"
+#include "tile.h"
 #include "screen.h"
 
 texture_type tux_life;
@@ -243,8 +244,8 @@ Player::action()
           if(size == SMALL)
             {
               /* Get a distro from a brick? */
-              if (shape(base.x, base.y) == 'x' ||
-                  shape(base.x, base.y) == 'y')
+              if (gettile(base.x, base.y)->brick ||
+                  gettile(base.x, base.y)->brick)
                 {
                   add_bouncy_distro((((int)base.x)
                                      / 32) * 32,
@@ -262,8 +263,8 @@ Player::action()
                   score = score + SCORE_DISTRO;
                   distros++;
                 }
-              else if (shape(base.x+ 31, base.y) == 'x' ||
-                       shape(base.x+ 31, base.y) == 'y')
+              else if (gettile(base.x+ 31, base.y)->brick ||
+                       gettile(base.x+ 31, base.y)->brick)
                 {
                   add_bouncy_distro((((int)base.x + 31)
                                      / 32) * 32,
index 09a6f88..80f6364 100644 (file)
@@ -42,13 +42,13 @@ void TileManager::load_tileset(std::string filename)
               std::vector<std::string> filenames;
 
               Tile* tile = new Tile;             
-              tile->solid = false;
-             tile->brick = false;
-             tile->ice = false;          
+              tile->solid   = false;
+             tile->brick   = false;
+             tile->ice     = false;      
              tile->fullbox = false;          
-              tile->alpha = 0;
-              tile->distro = 0;
-              tile->data  = 0;
+              tile->distro  = false;
+              tile->data    = 0;
+              tile->alpha   = 0;
               tile->anim_speed = 25;
   
               LispReader reader(lisp_cdr(element));