1 /**
2  * @file tilesmap_scrolling.h
3  * @brief Vertical scrolling tiles map in the main menu
4  *        and the guardians levels
5  * @date 2007-04-04
6  * @copyright 1991-2014 TLK Games
7  * @author Bruno Ethvignot
8  * @version $Revision: 24 $
9  */
10 /*
11  * copyright (c) 1991-2014 TLK Games all rights reserved
12  * $Id: tilesmap_scrolling.h 24 2014-09-28 15:30:04Z bruno.ethvignot@gmail.com $
13  *
14  * TecnoballZ is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * TecnoballZ is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27  * MA  02110-1301, USA.
28  */
29 #ifndef __TILESMAP_SCROLLING__
30 #define __TILESMAP_SCROLLING__
31 
32 class tilesmap_scrolling;
33 
34 #include "../include/handler_display.h"
35 #include "../include/bitmap_data.h"
36 #include "../include/tecnoballz.h"
37 #include "../include/supervisor_map_editor.h"
38 
39 class tilesmap_scrolling:public virtual tecnoballz
40 {
41   friend class supervisor_map_editor;
42 
43 public:
44   typedef enum
45     {
46       MAP_GUARDIANS,
47       MAP_MENU,
48       MAP_CONGRATULATIONS
49     }
50   MAPS_ENUM;
51   /** Number of tiles per row in the map */
52   static const Uint32 MAP_WIDTH = 20;
53   /** Number of tiles per column in the map */
54   static const Uint32 MAP_HEIGHT = 273;
55   typedef enum
56     {
57       TILES_COLOR_GUARDIANS,
58       TILES_COLOR_MENU,
59       TILES_COLOR_CONGRATULATIONS
60     }
61     TILES_COLOR;
62 
63 private:
64   bool is_40_columns;
65   Uint32 tileset_width;
66   Uint32 tile_width;
67   Uint32 tile_height;
68   /** Number of tiles per row in the map */
69   Uint32 map_width;
70   /** Number of tiles per row at screen */
71   Uint32 tiles_per_row;
72   /** The map of tiles */
73   Uint16 *map_tiles;
74   /** Fist line visible of the  map of tiles */
75   Uint16 *map_top_screen;
76   Sint32 y_coord;
77   /** Tileset bimap */
78   bitmap_data *tiles_bitmap;
79   /** Number of differents tiles in the bitmap */
80   Uint32 number_of_different_tiles;
81   static const unsigned char colors_map[48];
82 
83 public:
84     tilesmap_scrolling ();
85    ~tilesmap_scrolling ();
86   bitmap_data *get_bitmap ();
87   void initialize (Uint32 color_id = TILES_COLOR_GUARDIANS, Uint32 map_id = 0);
88   Uint32 get_tiles_width ();
89   Sint32 get_y_coord ();
90   Uint32 get_map_width();
91   void enable_palette (Uint32 color_id = 0);
92   void switch_map (Uint32 color_id, Uint32 map_id);
93   void scroll (Sint32 index = 0);
94   bitmap_data* alloc_brush(Uint16 *map, Uint32 num_of_cols, Uint32 num_of_lines);
95 
96 private:
97   void draw ();
98   void load_map (Uint32 edmap = 0);
99 };
100 #endif
101