Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef MAPVIEW_H_
00028 #define MAPVIEW_H_
00029
00030 #include "landmap.h"
00031 #include "python_class.h"
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 class mapview : public drawable
00045 {
00046
00047 public:
00048
00049
00050
00051
00052
00053 mapview ();
00054
00055
00056
00057
00058
00059 ~mapview ();
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 void attach_map (landmap * m);
00075
00076
00077
00078
00079
00080 void detach_map ();
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 s_int8 set_pos (u_int16 sm, u_int16 x, u_int16 y, s_int16 ox = 0, s_int16 oy = 0);
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 s_int8 center_on (u_int16 sm, u_int16 x, u_int16 y, s_int16 ox = 0, s_int16 oy = 0);
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 u_int16 currentsubmap ()
00138 {
00139 return currentsubmap_;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148 u_int16 posx () const
00149 {
00150 return posx_;
00151 }
00152
00153
00154
00155
00156
00157
00158
00159 u_int16 posy () const
00160 {
00161 return posy_;
00162 }
00163
00164
00165
00166
00167
00168
00169
00170 u_int16 offx () const
00171 {
00172 return offx_;
00173 }
00174
00175
00176
00177
00178
00179
00180
00181 u_int16 offy () const
00182 {
00183 return offy_;
00184 }
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 bool can_scroll_right ()
00203 {
00204 s_int32 tpx = posx () * MAPSQUARE_SIZE + offx () + length ();
00205 return (tpx < m_map->submap[currentsubmap_]->area_length () * MAPSQUARE_SIZE);
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215 bool can_scroll_left ()
00216 {
00217 return (posx_ || offx_);
00218 }
00219
00220
00221
00222
00223
00224
00225
00226
00227 bool can_scroll_up ()
00228 {
00229 return (posy_ || offy_);
00230 }
00231
00232
00233
00234
00235
00236
00237
00238
00239 bool can_scroll_down ()
00240 {
00241 s_int32 tpy = posy () * MAPSQUARE_SIZE + offy () + height ();
00242 return (tpy < m_map->submap[currentsubmap_]->area_height () * MAPSQUARE_SIZE);
00243 }
00244
00245
00246
00247
00248
00249 void scroll_right ();
00250
00251
00252
00253
00254
00255 void scroll_left ();
00256
00257
00258
00259
00260
00261 void scroll_down ();
00262
00263
00264
00265
00266
00267 void scroll_up ();
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286 s_int8 get_state (igzstream& file);
00287
00288
00289
00290
00291
00292
00293
00294
00295 s_int8 put_state (ogzstream& file);
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305 void resize (u_int16 l, u_int16 h);
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 void set_schedule (string file, PyObject * args = NULL);
00320
00321
00322
00323
00324
00325
00326
00327 string schedule_file ()
00328 {
00329 return schedule_file_;
00330 }
00331
00332
00333
00334
00335
00336 bool update ();
00337
00338 void draw (s_int16 x, s_int16 y, const drawing_area * da_opt = NULL,
00339 surface *target = NULL) const;
00340
00341 private:
00342
00343
00344
00345 mapview (const mapview& src);
00346
00347 #ifndef SWIG
00348 void draw_tile (s_int16 x, s_int16 y, const drawing_area * da_opt, surface * target,
00349 list<mapsquare_tile>::iterator it) const;
00350
00351 void draw_mapchar (s_int16 x, s_int16 y, const drawing_area * da_opt,
00352 surface * target, list<mapsquare_char>::iterator itc) const;
00353 void draw_bubble (s_int16 x, s_int16 y, const drawing_area * da_opt,
00354 surface * target, list<mapcharacter *>::iterator itc) const;
00355 #endif
00356
00357 landmap *m_map;
00358
00359 u_int16 d_length, d_height;
00360
00361 u_int16 currentsubmap_;
00362 u_int16 posx_, posy_;
00363 u_int16 offx_, offy_;
00364
00365
00366 mutable drawing_area da;
00367
00368 py_object schedule;
00369
00370 PyObject * schedule_args;
00371
00372 string schedule_file_;
00373 };
00374
00375 #endif