22#ifndef ULTIMA8_WORLD_CURRENTMAP_H
23#define ULTIMA8_WORLD_CURRENTMAP_H
25#include "common/list.h"
26#include "ultima/ultima8/misc/common_types.h"
27#include "ultima/ultima8/misc/direction.h"
28#include "ultima/ultima8/misc/point3.h"
29#include "ultima/ultima8/usecode/intrinsics.h"
30#include "ultima/ultima8/world/position_info.h"
40class EggHatcherProcess;
42#define MAP_NUM_CHUNKS 64
43#define MAP_NUM_TARGET_ITEMS 200
53 void loadMap(
Map *map);
64 unsigned int getChunkSize()
const {
74 void removeItemFromList(
Item *item, int32 oldx, int32 oldy);
75 void removeItem(
Item *item);
98 uint32 scriptsize,
const Item *item, uint16 range,
99 bool recurse, int32 x = 0, int32 y = 0)
const;
102 void surfaceSearch(
UCList *itemlist,
const uint8 *loopscript,
103 uint32 scriptsize,
const Item *item,
bool above,
104 bool below,
bool recurse =
false)
const;
109 PositionInfo getPositionInfo(
const Box &target,
const Box &start, uint32 shapeflags, ObjId
id)
const;
112 PositionInfo getPositionInfo(int32 x, int32 y, int32 z, uint32 shape, ObjId
id)
const;
116 Direction movedir,
bool wantsupport,
117 int32 &tx, int32 &ty, int32 &tz);
120 SweepItem(ObjId it, int32 ht, int32 et,
bool touch,
121 bool touchfloor,
bool block, uint8 dir)
122 : _item(it), _hitTime(ht), _endTime(et), _touching(touch),
123 _touchingFloor(touchfloor), _blocking(block), _dirs(dir) { }
150 pt.x = start.x + ((end.x - start.x) * (_hitTime >= 0 ? _hitTime : 0) + (end.x > start.x ? 0x2000 : -0x2000)) / 0x4000;
151 pt.y = start.y + ((end.y - start.y) * (_hitTime >= 0 ? _hitTime : 0) + (end.y > start.y ? 0x2000 : -0x2000)) / 0x4000;
152 pt.z = start.z + ((end.z - start.z) * (_hitTime >= 0 ? _hitTime : 0) + (end.z > start.z ? 0x2000 : -0x2000)) / 0x4000;
170 const int32 dims[3], uint32 shapeflags,
178 bool isChunkFast(int32 cx, int32 cy)
const {
180 if (cx < 0 || cy < 0 || cx >= MAP_NUM_CHUNKS || cy >= MAP_NUM_CHUNKS)
182 return (_fast[cy][cx / 32] & (1 << (cx & 31))) != 0;
185 void setFastAtPoint(
const Point3 &pt);
188 void setWholeMapFast();
193 INTRINSIC(I_canExistAt);
194 INTRINSIC(I_canExistAtPoint);
198 void createEggHatcher();
201 static void clipMapChunks(
int &minx,
int &maxx,
int &miny,
int &maxy);
212 uint32 _fast[MAP_NUM_CHUNKS][MAP_NUM_CHUNKS / 32];
213 int32 _fastXMin, _fastYMin, _fastXMax, _fastYMax;
219 ObjId _targets[MAP_NUM_TARGET_ITEMS];
221 void setChunkFast(int32 cx, int32 cy);
222 void unsetChunkFast(int32 cx, int32 cy);
Definition: current_map.h:45
void addItem(Item *item)
Add an item to the beginning of the item list.
void addItemToEnd(Item *item)
Add an item to the end of the item list.
void removeTargetItem(const Item *item)
Remove an item from the list of possible targets (in Crusader)
void updateFastArea(const Point3 &from, const Point3 &to)
Update the fast area for the cameras position.
uint32 getNum() const
Get the map number of the CurrentMap.
void areaSearch(UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, const Item *item, uint16 range, bool recurse, int32 x=0, int32 y=0) const
bool scanForValidPosition(int32 x, int32 y, int32 z, const Item *item, Direction movedir, bool wantsupport, int32 &tx, int32 &ty, int32 &tz)
Scan for a valid position for item in directions orthogonal to movedir.
bool sweepTest(const Point3 &start, const Point3 &end, const int32 dims[3], uint32 shapeflags, ObjId item, bool solid_only, Common::List< SweepItem > *hit) const
void setMap(Map *map)
Definition: current_map.h:57
void addTargetItem(const Item *item)
Add an item to the list of possible targets (in Crusader)
Item * findBestTargetItem(int32 x, int32 y, int32 z, Direction dir, DirectionMode dirmode)
Find the best target item in the given direction from the given start point.
Definition: teleport_egg.h:30
Definition: current_map.h:119
Definition: position_info.h:44