/[projectaxis]/projectaxis/projectAxis/src/visual/mapwindow.cpp
ViewVC logotype

Diff of /projectaxis/projectAxis/src/visual/mapwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by leiavoia, Fri Jul 25 21:16:31 2003 UTC revision 1.2 by leiavoia, Fri Aug 8 01:49:15 2003 UTC
# Line 8  Line 8 
8  //#include "pgapplication.h"  //#include "pgapplication.h"
9  #include "pgwindow.h"  #include "pgwindow.h"
10  #include "mapwindow.h"  #include "mapwindow.h"
11  #include "pgwindow.h"  #include "pgminimap.h"
12  //#include "pgeventobject.h"  //#include "pgeventobject.h"
13  #include "pgscrollbar.h"  #include "pgscrollbar.h"
14    
15  #include "renderman.h"  #include "renderman.h"
16  //#include "screens.h"  //#include "screens.h"
17    
18  #include "../map/map.h"  #include "../map/map.h"
19  #include "../pods/pod.h"  #include "../pods/pod.h"
20    #include "uiscreen_main.h"
21  #include "../core/pointerhub.h"  #include "../core/pointerhub.h"
22    
23  // FIXME KILL ME AFTER 0.0.5 DEMO  // FIXME KILL ME AFTER 0.0.5 DEMO
# Line 29  Line 29 
29    
30    
31    
 // DEFINED ELSEWHERE:  
 // FIXME KILL ME AFTER 0.0.5 DEMO  
 extern Blotchmaker* blotchmaker;  
32    
33    
34    
# Line 67  void DrawIMG(SDL_Surface *from, SDL_Surf Line 64  void DrawIMG(SDL_Surface *from, SDL_Surf
64  PG_MapWindow::PG_MapWindow(PG_Widget *parent, const PG_Rect &r):  PG_MapWindow::PG_MapWindow(PG_Widget *parent, const PG_Rect &r):
65          PG_Widget(parent, r, 1) // yes we do want an object drawing surface          PG_Widget(parent, r, 1) // yes we do want an object drawing surface
66          {          {
   
67          bg_y = 0;          bg_y = 0;
68          bg_x = 0;          bg_x = 0;
69    
70          window_h = r.h;          window_h = r.h;
71          window_w = r.w;          window_w = r.w;
72    
         Uint32 rmask, gmask, bmask, amask;  
         rmask = 0x00000000;  
         gmask = 0x00000000;  
         bmask = 0x00000000;  
         amask = 0x00000000;  
   
73          InitImages(); //load in images we need          InitImages(); //load in images we need
74          DrawMap(); // blit the map to the local surface          DrawMap(); // blit the map to the local surface
   
         //  
75          }          }
76    
77    
78  PG_MapWindow::~PG_MapWindow() {  PG_MapWindow::~PG_MapWindow() {
   
79          SDL_FreeSurface(pod_0);          SDL_FreeSurface(pod_0);
80          SDL_FreeSurface(pod_1);          SDL_FreeSurface(pod_1);
81          SDL_FreeSurface(tile_empty);          SDL_FreeSurface(tile_empty_0);
82            SDL_FreeSurface(tile_empty_1);
83            SDL_FreeSurface(tile_empty_2);
84            SDL_FreeSurface(tile_empty_3);
85            SDL_FreeSurface(tile_empty_4);
86            SDL_FreeSurface(tile_empty_5);
87            SDL_FreeSurface(tile_empty_6);
88            SDL_FreeSurface(tile_empty_7);
89            SDL_FreeSurface(tile_empty_8);
90            SDL_FreeSurface(tile_empty_9);
91          SDL_FreeSurface(tile_block);          SDL_FreeSurface(tile_block);
92          SDL_FreeSurface(hb_r);          SDL_FreeSurface(hb_r);
93          SDL_FreeSurface(hb_o);          SDL_FreeSurface(hb_o);
# Line 102  PG_MapWindow::~PG_MapWindow() { Line 98  PG_MapWindow::~PG_MapWindow() {
98          SDL_FreeSurface(hb_w);          SDL_FreeSurface(hb_w);
99          SDL_FreeSurface(hb_bk);          SDL_FreeSurface(hb_bk);
100          SDL_FreeSurface(blank);          SDL_FreeSurface(blank);
   
         // trying to delete these pointers throws the program into infinite loop (?)  
   
         }  
   
   
   
   
   
   
 void PG_MapWindow::eventBlit(SDL_Surface* srf, const PG_Rect& src, const PG_Rect& dst) {  
         PG_Rect my_src;  
         PG_Rect my_dst;  
   
         GetClipRects(my_src, my_dst, *this);  
         PG_Widget::eventBlit(srf, my_src, my_dst);  
101          }          }
102    
103    
104    
105    
   
106  // ---> FIXME <---  // ---> FIXME <---
107  /** graphically moves a pod a square on the map */  /** graphically moves a pod a square on the map */
108    
# Line 138  void PG_MapWindow::MovePod(int x1, int y Line 117  void PG_MapWindow::MovePod(int x1, int y
117          int o = 4; // screen border offset for conditional map recentering (don't go all the way to the edge before recentering)          int o = 4; // screen border offset for conditional map recentering (don't go all the way to the edge before recentering)
118    
119          // is the pod go-to tile already in the optimum screen area?          // is the pod go-to tile already in the optimum screen area?
   
120          if (  (x2 > bg_x+o) && (x2 < bg_x + h_dist - o) && (y2 > bg_y+o) && (y2 < bg_y + v_dist - o)  ) {          if (  (x2 > bg_x+o) && (x2 < bg_x + h_dist - o) && (y2 > bg_y+o) && (y2 < bg_y + v_dist - o)  ) {
121    
122                  // replace "from" tile with bg                  // replace "from" tile with bg
123                  switch (themap->GetObst(x1,y1)) {                  switch (themap->GetObst(x1,y1)) {
124                          case 1:                          case OBST_RED: DrawIMG(hb_r, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
125                                  DrawIMG(tile_block, my_srfObject, x1*tile_size, (y1+bg_y)*tile_size);                          case OBST_ORANGE: DrawIMG(hb_o, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
126                                  break;                          case OBST_YELLOW: DrawIMG(hb_y, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
127                          case 5:                          case OBST_GREEN: DrawIMG(hb_g, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
128                                  DrawIMG(hb_r, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                          case OBST_BLUE: DrawIMG(hb_bl, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
129                                  break;                          case OBST_VIOLET: DrawIMG(hb_v, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
130                          case 6:                          case OBST_WHITE: DrawIMG(hb_w, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
131                                  DrawIMG(hb_o, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                          case OBST_BLACK: DrawIMG(hb_bk, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
132                                  break;                          default: DrawIMG(tile_empty_4, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);
133                          case 7:  
134                                  DrawIMG(hb_y, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                  switch( themap->GetRoadQ(x1,y1) ) {
135                                  break;                                          case 0: DrawIMG(tile_empty_0, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
136                          case 8:                                          case 1: DrawIMG(tile_empty_1, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
137                                  DrawIMG(hb_g, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                          case 2: DrawIMG(tile_empty_2, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
138                                  break;                                          case 3: DrawIMG(tile_empty_3, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
139                          case 9:                                          case 4: DrawIMG(tile_empty_4, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
140                                  DrawIMG(hb_bl, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                          case 5: DrawIMG(tile_empty_5, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
141                                  break;                                          case 6: DrawIMG(tile_empty_6, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
142                          case 10:                                          case 7: DrawIMG(tile_empty_7, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
143                                  DrawIMG(hb_v, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                          case 8: DrawIMG(tile_empty_8, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
144                                  break;                                          case 9: DrawIMG(tile_empty_9, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
145                          case 11:                                          default: // for bug testing only
146                                  DrawIMG(hb_w, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                                  DrawIMG(blank, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size); break;
147                                  break;  
148                          case 12:                                          // no default
149                                  DrawIMG(hb_bk, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);                                          }
                                 break;  
                         default:  
                                 DrawIMG(tile_empty, my_srfObject, (x1+bg_x)*tile_size, (y1+bg_y)*tile_size);  
150                          }                          }
151    
152    
153                  // put pod graphic on new square                  // put pod graphic on new square
154                  Pod* temp = themap->GetOccu(x2, y2); // pod has already moved in memory, just update graphics                  Pod* temp = themap->GetOccu(x2, y2); // pod has already moved in memory, just update graphics
155                  switch (temp->GetAlign()) {                  switch (temp->GetAlign()) {
# Line 188  void PG_MapWindow::MovePod(int x1, int y Line 164  void PG_MapWindow::MovePod(int x1, int y
164                          }                          }
165    
166                  DrawMap();                  DrawMap();
167    
168    
169                  }                  }
170    
171          else { CenterMap(x2,y2); }          else { CenterMap(x2,y2); }
172    
173            // update the minimap too
174            // FIXME: move this up to UISCreen _Main
175            PG_Widget* parent = GetParent();
176            UIScreen_Main* main = dynamic_cast<UIScreen_Main*>(parent);
177            main->GetMiniMap()->DrawMapWithBounds(bg_x, bg_y, bg_x+int(window_w/rm->GetTileSize()), bg_y+int(window_h/rm->GetTileSize()));
178    
179          }          }
180    
181    
# Line 229  void PG_MapWindow::CenterMap(int x, int Line 213  void PG_MapWindow::CenterMap(int x, int
213  // TODO - dynamic tilesize adjustments needed  // TODO - dynamic tilesize adjustments needed
214  /** Loads needed images */  /** Loads needed images */
215  int PG_MapWindow::InitImages() {  int PG_MapWindow::InitImages() {
         tile_empty = IMG_Load("graphics/map_tiles/maptile_empty(border)_32px.png");  
         tile_block = IMG_Load("graphics/map_tiles/maptile_block_32px.png");  
216    
217          pod_0 = IMG_Load("graphics/pods/pod_blue_32px.png");          if (rm->GetTileSize() == 32) {
218          pod_1 = IMG_Load("graphics/pods/pod_green_32px.png");                  tile_empty_0 = IMG_Load("graphics/map_tiles/maptile_empty_0_32px.png");
219                    tile_empty_1 = IMG_Load("graphics/map_tiles/maptile_empty_1_32px.png");
220                    tile_empty_2 = IMG_Load("graphics/map_tiles/maptile_empty_2_32px.png");
221                    tile_empty_3 = IMG_Load("graphics/map_tiles/maptile_empty_3_32px.png");
222                    tile_empty_4 = IMG_Load("graphics/map_tiles/maptile_empty_4_32px.png");
223                    tile_empty_5 = IMG_Load("graphics/map_tiles/maptile_empty_5_32px.png");
224                    tile_empty_6 = IMG_Load("graphics/map_tiles/maptile_empty_6_32px.png");
225                    tile_empty_7 = IMG_Load("graphics/map_tiles/maptile_empty_7_32px.png");
226                    tile_empty_8 = IMG_Load("graphics/map_tiles/maptile_empty_8_32px.png");
227                    tile_empty_9 = IMG_Load("graphics/map_tiles/maptile_empty_9_32px.png");
228    
229                    tile_block = IMG_Load("graphics/map_tiles/maptile_block_32px.png");
230    
231                    pod_0 = IMG_Load("graphics/pods/pod_blue_32px.png");
232                    pod_1 = IMG_Load("graphics/pods/pod_green_32px.png");
233    
234                    hb_r = IMG_Load("graphics/map_tiles/maptile_hb_red_32px.png");
235                    hb_o = IMG_Load("graphics/map_tiles/maptile_hb_orange_32px.png");
236                    hb_y = IMG_Load("graphics/map_tiles/maptile_hb_yellow_32px.png");
237                    hb_g = IMG_Load("graphics/map_tiles/maptile_hb_green_32px.png");
238                    hb_bl = IMG_Load("graphics/map_tiles/maptile_hb_blue_32px.png");
239                    hb_v = IMG_Load("graphics/map_tiles/maptile_hb_violet_32px.png");
240                    hb_w = IMG_Load("graphics/map_tiles/maptile_white_32px.png");
241                    hb_bk = IMG_Load("graphics/map_tiles/maptile_black_32px.png");
242    
243                    blank = IMG_Load("graphics/map_tiles/maptile_blackspacer_32px.png");
244    
245                    if (tile_empty_4 == NULL) { std::cout<< "NO EMPTY #4"; }
246                    if (tile_empty_3 == NULL) { std::cout<< "NO EMPTY #3"; }
247                    if (tile_empty_2 == NULL) { std::cout<< "NO EMPTY #2"; }
248                    if (tile_empty_1 == NULL) { std::cout<< "NO EMPTY #1"; }
249                    if (tile_empty_0 == NULL) { std::cout<< "NO EMPTY #0"; }
250                    }
251    
252          hb_r = IMG_Load("graphics/map_tiles/maptile_hb_red_32px.png");          if (rm->GetTileSize() == 64) {
253          hb_o = IMG_Load("graphics/map_tiles/maptile_hb_orange_32px.png");                  tile_empty_0 = IMG_Load("graphics/map_tiles/maptile_empty_0_64px.png");
254          hb_y = IMG_Load("graphics/map_tiles/maptile_hb_yellow_32px.png");                  tile_empty_1 = IMG_Load("graphics/map_tiles/maptile_empty_1_64px.png");
255          hb_g = IMG_Load("graphics/map_tiles/maptile_hb_green_32px.png");                  tile_empty_2 = IMG_Load("graphics/map_tiles/maptile_empty_2_64px.png");
256          hb_bl = IMG_Load("graphics/map_tiles/maptile_hb_blue_32px.png");                  tile_empty_3 = IMG_Load("graphics/map_tiles/maptile_empty_3_64px.png");
257          hb_v = IMG_Load("graphics/map_tiles/maptile_hb_violet_32px.png");                  tile_empty_4 = IMG_Load("graphics/map_tiles/maptile_empty_4_64px.png");
258          hb_w = IMG_Load("graphics/map_tiles/maptile_white_32px.png");                  tile_empty_5 = IMG_Load("graphics/map_tiles/maptile_empty_5_64px.png");
259          hb_bk = IMG_Load("graphics/map_tiles/maptile_black_32px.png");                  tile_empty_6 = IMG_Load("graphics/map_tiles/maptile_empty_6_64px.png");
260                    tile_empty_7 = IMG_Load("graphics/map_tiles/maptile_empty_7_64px.png");
261                    tile_empty_8 = IMG_Load("graphics/map_tiles/maptile_empty_8_64px.png");
262                    tile_empty_9 = IMG_Load("graphics/map_tiles/maptile_empty_9_64px.png");
263    
264                    tile_block = IMG_Load("graphics/map_tiles/maptile_block_64px.png");
265    
266                    pod_0 = IMG_Load("graphics/pods/pod_blue_64px.png");
267                    pod_1 = IMG_Load("graphics/pods/pod_green_64px.png");
268    
269                    hb_r = IMG_Load("graphics/map_tiles/maptile_hb_red_64px.png");
270                    hb_o = IMG_Load("graphics/map_tiles/maptile_hb_orange_64px.png");
271                    hb_y = IMG_Load("graphics/map_tiles/maptile_hb_yellow_64px.png");
272                    hb_g = IMG_Load("graphics/map_tiles/maptile_hb_green_64px.png");
273                    hb_bl = IMG_Load("graphics/map_tiles/maptile_hb_blue_64px.png");
274                    hb_v = IMG_Load("graphics/map_tiles/maptile_hb_violet_64px.png");
275                    hb_w = IMG_Load("graphics/map_tiles/maptile_white_64px.png");
276                    hb_bk = IMG_Load("graphics/map_tiles/maptile_black_64px.png");
277    
278          blank = IMG_Load("graphics/map_tiles/maptile_blackspacer_32px.png");                  blank = IMG_Load("graphics/map_tiles/maptile_blackspacer_64px.png");
279                    }
280            return 0;
281    
282          /*          }
         tile_empty = IMG_Load("../../graphics/map_tiles/maptile_empty(border)_32px.png");  
         tile_block = IMG_Load("../../graphics/map_tiles/maptile_block_32px.png");  
283    
         pod_0 = IMG_Load("../../graphics/pods/pod_blue_32px.png");  
         pod_1 = IMG_Load("../../graphics/pods/pod_green_32px.png");  
284    
         hb_r = IMG_Load("../../graphics/map_tiles/maptile_hb_red_32px.png");  
         hb_o = IMG_Load("../../graphics/map_tiles/maptile_hb_orange_32px.png");  
         hb_y = IMG_Load("../../graphics/map_tiles/maptile_hb_yellow_32px.png");  
         hb_g = IMG_Load("../../graphics/map_tiles/maptile_hb_green_32px.png");  
         hb_bl = IMG_Load("../../graphics/map_tiles/maptile_hb_blue_32px.png");  
         hb_v = IMG_Load("../../graphics/map_tiles/maptile_hb_violet_32px.png");  
         hb_w = IMG_Load("../../graphics/map_tiles/maptile_white_32px.png");  
         hb_bk = IMG_Load("../../graphics/map_tiles/maptile_black_32px.png");  
285    
286          blank = IMG_Load("../../graphics/map_tiles/maptile_blackspacer_32px.png");  void PG_MapWindow::ReInitImages() {
287          */          //delete tile_empty;
288          return 0;          delete tile_block;
289    
290            delete pod_0;
291            delete pod_1;
292    
293            delete hb_r;
294            delete hb_o;
295            delete hb_y;
296            delete hb_g;
297            delete hb_bl;
298            delete hb_v;
299            delete hb_w;
300            delete hb_bk;
301    
302            delete blank;
303    
304    
305            if (rm->GetTileSize() == 32) {
306                    //tile_empty = IMG_Load("graphics/map_tiles/maptile_empty(border)_32px.png");
307                    tile_block = IMG_Load("graphics/map_tiles/maptile_block_32px.png");
308    
309                    pod_0 = IMG_Load("graphics/pods/pod_blue_32px.png");
310                    pod_1 = IMG_Load("graphics/pods/pod_green_32px.png");
311    
312                    hb_r = IMG_Load("graphics/map_tiles/maptile_hb_red_32px.png");
313                    hb_o = IMG_Load("graphics/map_tiles/maptile_hb_orange_32px.png");
314                    hb_y = IMG_Load("graphics/map_tiles/maptile_hb_yellow_32px.png");
315                    hb_g = IMG_Load("graphics/map_tiles/maptile_hb_green_32px.png");
316                    hb_bl = IMG_Load("graphics/map_tiles/maptile_hb_blue_32px.png");
317                    hb_v = IMG_Load("graphics/map_tiles/maptile_hb_violet_32px.png");
318                    hb_w = IMG_Load("graphics/map_tiles/maptile_white_32px.png");
319                    hb_bk = IMG_Load("graphics/map_tiles/maptile_black_32px.png");
320    
321          }                  blank = IMG_Load("graphics/map_tiles/maptile_blackspacer_32px.png");
322                    }
323    
324            if (rm->GetTileSize() == 64) {
325                    //tile_empty = IMG_Load("graphics/map_tiles/maptile_empty(border)_64px.png");
326                    tile_block = IMG_Load("graphics/map_tiles/maptile_block_64px.png");
327    
328                    pod_0 = IMG_Load("graphics/pods/pod_blue_64px.png");
329                    pod_1 = IMG_Load("graphics/pods/pod_green_64px.png");
330    
331                    hb_r = IMG_Load("graphics/map_tiles/maptile_hb_red_64px.png");
332                    hb_o = IMG_Load("graphics/map_tiles/maptile_hb_orange_64px.png");
333                    hb_y = IMG_Load("graphics/map_tiles/maptile_hb_yellow_64px.png");
334                    hb_g = IMG_Load("graphics/map_tiles/maptile_hb_green_64px.png");
335                    hb_bl = IMG_Load("graphics/map_tiles/maptile_hb_blue_64px.png");
336                    hb_v = IMG_Load("graphics/map_tiles/maptile_hb_violet_64px.png");
337                    hb_w = IMG_Load("graphics/map_tiles/maptile_white_64px.png");
338                    hb_bk = IMG_Load("graphics/map_tiles/maptile_black_64px.png");
339    
340                    blank = IMG_Load("graphics/map_tiles/maptile_blackspacer_64px.png");
341                    }
342    
343            DrawMap();
344            }
345    
346    
347    
# Line 277  int PG_MapWindow::InitImages() { Line 351  int PG_MapWindow::InitImages() {
351  /** Creates the main map surface from which to blit from later*/  /** Creates the main map surface from which to blit from later*/
352  void PG_MapWindow::DrawMap(){  void PG_MapWindow::DrawMap(){
353    
354            int tile_size = rm->GetTileSize();
355            int v_dist = bg_y + int(window_h/tile_size) + 2;
356            int h_dist = bg_x + int(window_w/tile_size) + 2;
357            int rows = themap->GetRows();
358            int cols = themap->GetCols();
359            int stop_y = ((v_dist > rows) ? rows : v_dist);
360            int stop_x = ((h_dist > cols) ? cols : h_dist);
361    
362    
363            for (int a=bg_y; a <= stop_y; a++) {
364                    int screenloc_y = ((a-bg_y)*tile_size); // pixel coords for the screen
365    
366                    for (int b=bg_x; b <= stop_x; b++) {
367                            int screenloc_x = ((b-bg_x)*tile_size); // pixel coords for the screen
368    
369                            if (!themap->IsValid(b,a)) {  DrawIMG(blank, my_srfObject, screenloc_x, screenloc_y);  continue;  }
370    
371    
372                    switch (themap->GetObst(b,a)) {
373                            case OBST_BLOCK: DrawIMG(tile_block, my_srfObject, screenloc_x, screenloc_y); break;
374                            case OBST_RED: DrawIMG(hb_r, my_srfObject, screenloc_x, screenloc_y); break;
375                            case OBST_ORANGE: DrawIMG(hb_o, my_srfObject, screenloc_x, screenloc_y); break;
376                            case OBST_YELLOW: DrawIMG(hb_y, my_srfObject, screenloc_x, screenloc_y); break;
377                            case OBST_GREEN: DrawIMG(hb_g, my_srfObject, screenloc_x, screenloc_y); break;
378                            case OBST_BLUE: DrawIMG(hb_bl, my_srfObject, screenloc_x, screenloc_y); break;
379                            case OBST_VIOLET: DrawIMG(hb_v, my_srfObject, screenloc_x, screenloc_y); break;
380                            case OBST_WHITE: DrawIMG(hb_w, my_srfObject, screenloc_x, screenloc_y); break;
381                            case OBST_BLACK: DrawIMG(hb_bk, my_srfObject, screenloc_x, screenloc_y); break;
382                            default: ;;
383                                    switch( themap->GetRoadQ(b,a) ) {
384                                            case 0: DrawIMG(tile_empty_0, my_srfObject, screenloc_x, screenloc_y); break;
385                                            case 1: DrawIMG(tile_empty_1, my_srfObject, screenloc_x, screenloc_y); break;
386                                            case 2: DrawIMG(tile_empty_2, my_srfObject, screenloc_x, screenloc_y); break;
387                                            case 3: DrawIMG(tile_empty_3, my_srfObject, screenloc_x, screenloc_y); break;
388                                            case 4: DrawIMG(tile_empty_4, my_srfObject, screenloc_x, screenloc_y); break;
389                                            case 5: DrawIMG(tile_empty_5, my_srfObject, screenloc_x, screenloc_y); break;
390                                            case 6: DrawIMG(tile_empty_6, my_srfObject, screenloc_x, screenloc_y); break;
391                                            case 7: DrawIMG(tile_empty_7, my_srfObject, screenloc_x, screenloc_y); break;
392                                            case 8: DrawIMG(tile_empty_8, my_srfObject, screenloc_x, screenloc_y); break;
393                                            case 9: DrawIMG(tile_empty_9, my_srfObject, screenloc_x, screenloc_y); break;
394    
395                                            /* no default */
396                                            }
397                            }
398    
399    
400    /*
401                            if (themap->GetObst(b,a) == OBST_BLOCK) { DrawIMG(tile_block, my_srfObject, screenloc_x, screenloc_y); }
402                            else if ( themap->GetObst(b,a) == OBST_RED ) { DrawIMG(hb_r, my_srfObject, screenloc_x, screenloc_y); }
403                            else if ( themap->GetObst(b,a) == OBST_ORANGE ) { DrawIMG(hb_o, my_srfObject, screenloc_x, screenloc_y); }
404                            else if ( themap->GetObst(b,a) == OBST_YELLOW ) { DrawIMG(hb_y, my_srfObject, screenloc_x, screenloc_y); }
405                            else if ( themap->GetObst(b,a) == OBST_GREEN ) { DrawIMG(hb_g, my_srfObject, screenloc_x, screenloc_y); }
406                            else if ( themap->GetObst(b,a) == OBST_BLUE ) { DrawIMG(hb_bl, my_srfObject, screenloc_x, screenloc_y); }
407                            else if ( themap->GetObst(b,a) == OBST_VIOLET) { DrawIMG(hb_v, my_srfObject, screenloc_x, screenloc_y); }
408                            else if ( themap->GetObst(b,a) == OBST_WHITE) { DrawIMG(hb_w, my_srfObject, screenloc_x, screenloc_y); }
409                            else if ( themap->GetObst(b,a) == OBST_BLACK) { DrawIMG(hb_bk, my_srfObject, screenloc_x, screenloc_y); }
410                            else { DrawIMG(  tile_empty, my_srfObject, screenloc_x, screenloc_y); }
411    */
412                            Pod* oc = themap->GetOccu(b,a);
413                            if (oc != NULL) {
414                                    if (oc->GetAlign() == 0) { DrawIMG(  pod_0, my_srfObject, screenloc_x, screenloc_y  ); }
415                                    else { DrawIMG(  pod_1, my_srfObject, screenloc_x, screenloc_y  ); }
416                                    }
417                            }
418                    }
419    
420    
421            /*
422          // FIXME: change the initial vars here and get rid of blank_tiles          // FIXME: change the initial vars here and get rid of blank_tiles
423          //      if we officially do not want to support non 32/64px tiles          //      if we officially do not want to support non 32/64px tiles
424          //load background + startup pods:          //load background + startup pods:
# Line 314  void PG_MapWindow::DrawMap(){ Line 456  void PG_MapWindow::DrawMap(){
456                                  }                                  }
457                          }                          }
458                  }                  }
459            */
460    
461          Update();          Update();
462    
463          }          }
# Line 322  void PG_MapWindow::DrawMap(){ Line 466  void PG_MapWindow::DrawMap(){
466    
467    
468    
469    int PG_MapWindow::GetBgX() { return bg_x; }
470    int PG_MapWindow::GetBgY() { return bg_y; }
471    void PG_MapWindow::SetBgX(int x) { bg_x = x; }
472    void PG_MapWindow::SetBgY(int x) { bg_y = y; }
473    
474    
475    
476    
477  bool PG_MapWindow::RegenMap() {  bool PG_MapWindow::RegenMap() {
478    
479            Blotchmaker* blotchmaker = new Blotchmaker;
480    
481            // Group vars:
482            blotchmaker->SetHBSize(1);
483            blotchmaker->SetMaxBlotches(20);
484            blotchmaker->SetTypeChances(7,3);
485            blotchmaker->SetAxisPalette(OBST_GREEN, OBST_BLUE, OBST_YELLOW, OBST_RED);
486            blotchmaker->SetMapInit(OBST_BLOCK);
487    
488            // SLOT 0
489            blotchmaker->SetBlotchType(0, OBST_EMPTY);
490            blotchmaker->SetTilesPerBlotch(0, 25);
491            blotchmaker->SetModeChances(0, 0, 1, 0, 0);
492            blotchmaker->SetTurnChances(0, 8, 1, 0, 0);
493            blotchmaker->SetBlankShotChance(0, 0);
494            blotchmaker->SetEdgeGrav(0, 0);
495            blotchmaker->SetEdgeDet(0, 0);
496            blotchmaker->SetBrush(0, RE);
497            blotchmaker->SetStep(0, 1);
498    
499            // SLOT 1
500            blotchmaker->SetBlotchType(1, OBST_EMPTY);
501            blotchmaker->SetTilesPerBlotch(1, 1);
502            blotchmaker->SetModeChances(1, 0, 1, 0, 0);
503            blotchmaker->SetTurnChances(1, 1, 1, 0, 0);
504            blotchmaker->SetBlankShotChance(1, 0);
505            blotchmaker->SetEdgeGrav(1, 0);
506            blotchmaker->SetEdgeDet(1, 0);
507            blotchmaker->SetBrush(1, MC);
508            blotchmaker->SetStep(1, 1);
509    
510          if ( blotchmaker->StartBlotching() ) {          if ( blotchmaker->StartBlotching() ) {
511                  DrawMap();                  DrawMap();
512                    delete blotchmaker;
513                  return 1;                  return 1;
514                  }                  }
515          else { DrawMap(); return 0; }          else {
516                    DrawMap();
517                    delete blotchmaker;
518                    return 0;
519                    }
520    
521          }          }
522    
523    
524    
525    
526    
527    
528  void PG_MapWindow::PlayFootball() {  void PG_MapWindow::PlayFootball() {
529    
530          }          }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26