22 #ifndef ULTIMA8_WORLD_CURRENTMAP_H 23 #define ULTIMA8_WORLD_CURRENTMAP_H 25 #include "ultima/shared/std/containers.h" 26 #include "ultima/ultima8/usecode/intrinsics.h" 27 #include "ultima/ultima8/world/position_info.h" 28 #include "ultima/ultima8/misc/direction.h" 29 #include "ultima/ultima8/misc/point3.h" 39 class EggHatcherProcess;
41 #define MAP_NUM_CHUNKS 64 42 #define MAP_NUM_TARGET_ITEMS 200 52 void loadMap(
Map *map);
63 unsigned int getChunkSize()
const {
73 void removeItemFromList(
Item *item, int32 oldx, int32 oldy);
74 void removeItem(
Item *item);
97 uint32 scriptsize,
const Item *item, uint16 range,
98 bool recurse, int32 x = 0, int32 y = 0)
const;
101 void surfaceSearch(
UCList *itemlist,
const uint8 *loopscript,
102 uint32 scriptsize,
const Item *item,
bool above,
103 bool below,
bool recurse =
false)
const;
108 PositionInfo getPositionInfo(
const Box &target,
const Box &start, uint32 shapeflags, ObjId
id)
const;
111 PositionInfo getPositionInfo(int32 x, int32 y, int32 z, uint32 shape, ObjId
id)
const;
115 Direction movedir,
bool wantsupport,
116 int32 &tx, int32 &ty, int32 &tz);
119 SweepItem(ObjId it, int32 ht, int32 et,
bool touch,
120 bool touchfloor,
bool block, uint8 dir)
121 : _item(it), _hitTime(ht), _endTime(et), _touching(touch),
122 _touchingFloor(touchfloor), _blocking(block), _dirs(dir) { }
149 pt.x = start.x + ((end.x - start.x) * (_hitTime >= 0 ? _hitTime : 0) + (end.x > start.x ? 0x2000 : -0x2000)) / 0x4000;
150 pt.y = start.y + ((end.y - start.y) * (_hitTime >= 0 ? _hitTime : 0) + (end.y > start.y ? 0x2000 : -0x2000)) / 0x4000;
151 pt.z = start.z + ((end.z - start.z) * (_hitTime >= 0 ? _hitTime : 0) + (end.z > start.z ? 0x2000 : -0x2000)) / 0x4000;
169 const int32 dims[3], uint32 shapeflags,
177 bool isChunkFast(int32 cx, int32 cy)
const {
179 if (cx < 0 || cy < 0 || cx >= MAP_NUM_CHUNKS || cy >= MAP_NUM_CHUNKS)
181 return (_fast[cy][cx / 32] & (1 << (cx & 31))) != 0;
184 void setFastAtPoint(
const Point3 &pt);
187 void setWholeMapFast();
192 INTRINSIC(I_canExistAt);
193 INTRINSIC(I_canExistAtPoint);
197 void createEggHatcher();
200 static void clipMapChunks(
int &minx,
int &maxx,
int &miny,
int &maxy);
211 uint32 _fast[MAP_NUM_CHUNKS][MAP_NUM_CHUNKS / 32];
212 int32 _fastXMin, _fastYMin, _fastXMax, _fastYMax;
218 ObjId _targets[MAP_NUM_TARGET_ITEMS];
220 void setChunkFast(int32 cx, int32 cy);
221 void unsetChunkFast(int32 cx, int32 cy);
void addTargetItem(const Item *item)
Add an item to the list of possible targets (in Crusader)
void removeTargetItem(const Item *item)
Remove an item from the list of possible targets (in Crusader)
bool sweepTest(const Point3 &start, const Point3 &end, const int32 dims[3], uint32 shapeflags, ObjId item, bool solid_only, Std::list< SweepItem > *hit) const
void addItem(Item *item)
Add an item to the beginning of the item list.
Definition: detection.h:27
Definition: position_info.h:44
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
Definition: current_map.h:118
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.
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.
Definition: containers.h:200
void addItemToEnd(Item *item)
Add an item to the end of the item list.
void updateFastArea(const Point3 &from, const Point3 &to)
Update the fast area for the cameras position.
Definition: current_map.h:44
Definition: teleport_egg.h:30
void setMap(Map *map)
Definition: current_map.h:56