… | |
… | |
61 | TILE_UP, |
61 | TILE_UP, |
62 | TILE_DOWN, |
62 | TILE_DOWN, |
63 | TILE_NUM, |
63 | TILE_NUM, |
64 | }; |
64 | }; |
65 | |
65 | |
66 | /* Values for in_memory below */ |
66 | /* Values for state below */ |
67 | enum { |
67 | enum { |
68 | MAP_SWAPPED, // header loaded, nothing else |
68 | MAP_SWAPPED, // header loaded, nothing else |
69 | MAP_INACTIVE, // in memory, linkable, but not active |
69 | MAP_INACTIVE, // in memory, linkable, but not active |
70 | MAP_ACTIVE, // running! |
70 | MAP_ACTIVE, // running! |
71 | }; |
71 | }; |
… | |
… | |
214 | int x0, y0; |
214 | int x0, y0; |
215 | int x1, y1; |
215 | int x1, y1; |
216 | int dx, dy; // offset to go from local coordinates to original tile */ |
216 | int dx, dy; // offset to go from local coordinates to original tile */ |
217 | }; |
217 | }; |
218 | |
218 | |
|
|
219 | // (refcounted) list of objects on this map that need physics processing |
|
|
220 | struct physics_queue |
|
|
221 | : unordered_vector<object *> |
|
|
222 | { |
|
|
223 | int i; // already processed |
|
|
224 | physics_queue (); |
|
|
225 | object *pop (); |
|
|
226 | }; |
|
|
227 | |
|
|
228 | #define PHYSICS_QUEUES 16 // "activity" at least every 16 ticks |
|
|
229 | |
219 | //+GPL |
230 | //+GPL |
220 | |
231 | |
221 | struct shopitems : zero_initialised |
232 | struct shopitems : zero_initialised |
222 | { |
233 | { |
223 | const char *name; /* name of the item in question, null if it is the default item */ |
234 | const char *name; /* name of the item in question, null if it is the default item */ |
… | |
… | |
264 | bool ACC (RW, dirty); /* if true, something was inserted or removed */ |
275 | bool ACC (RW, dirty); /* if true, something was inserted or removed */ |
265 | bool ACC (RW, no_reset); // must not reset this map |
276 | bool ACC (RW, no_reset); // must not reset this map |
266 | bool ACC (RW, fixed_resettime); /* if true, reset time is not affected by |
277 | bool ACC (RW, fixed_resettime); /* if true, reset time is not affected by |
267 | * players entering/exiting map |
278 | * players entering/exiting map |
268 | */ |
279 | */ |
|
|
280 | uint8 ACC (RW, state); /* If not true, the map has been freed and must |
|
|
281 | * be loaded before used. The map,omap and map_ob |
|
|
282 | * arrays will be allocated when the map is loaded */ |
269 | sint32 ACC (RW, timeout); /* swapout is set to this */ |
283 | sint32 ACC (RW, timeout); /* swapout is set to this */ |
270 | sint32 ACC (RW, swap_time); /* When it reaches 0, the map will be swapped out */ |
284 | sint32 ACC (RW, swap_time); /* When it reaches 0, the map will be swapped out */ |
271 | uint32 ACC (RW, in_memory); /* If not true, the map has been freed and must |
|
|
272 | * be loaded before used. The map,omap and map_ob |
|
|
273 | * arrays will be allocated when the map is loaded */ |
|
|
274 | sint16 players; /* How many players are on this map right now */ |
285 | sint16 players; /* How many players are on this map right now */ |
275 | uint16 ACC (RW, difficulty); /* What level the player should be to play here */ |
286 | uint16 ACC (RW, difficulty); /* What level the player should be to play here */ |
276 | |
287 | |
277 | bool ACC (RW, per_player); |
288 | bool ACC (RW, per_player); |
278 | bool ACC (RW, per_party); |
289 | bool ACC (RW, per_party); |
… | |
… | |
297 | uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace |
308 | uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace |
298 | int ACC (RW, max_items); // maximum number of items on a mapspace |
309 | int ACC (RW, max_items); // maximum number of items on a mapspace |
299 | |
310 | |
300 | //-GPL |
311 | //-GPL |
301 | |
312 | |
|
|
313 | physics_queue pq[PHYSICS_QUEUES]; |
|
|
314 | MTH void queue_physics (object *ob, int after = 0); |
|
|
315 | MTH void queue_physics_at (int x, int y); |
|
|
316 | MTH void post_load_physics (); |
|
|
317 | MTH int run_physics (tick_t tick, int max_objects); |
|
|
318 | |
302 | // the maptile:: is neccessary here for the perl interface to work |
319 | // the maptile:: is neccessary here for the perl interface to work |
303 | MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const |
320 | MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const |
304 | { |
321 | { |
305 | return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS); |
322 | return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS); |
306 | } |
323 | } |
… | |
… | |
363 | ~maptile (); |
380 | ~maptile (); |
364 | |
381 | |
365 | void do_destroy (); |
382 | void do_destroy (); |
366 | void gather_callbacks (AV *&callbacks, event_type event) const; |
383 | void gather_callbacks (AV *&callbacks, event_type event) const; |
367 | |
384 | |
368 | MTH bool linkable () { return in_memory >= MAP_INACTIVE; } |
385 | MTH bool linkable () { return state >= MAP_INACTIVE; } |
369 | |
386 | |
370 | MTH int size () const { return width * height; } |
387 | MTH int size () const { return width * height; } |
371 | |
388 | |
372 | MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0); |
389 | MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0); |
373 | |
390 | |