CurrentMap Class Reference

#include <CurrentMap.h>

List of all members.

Public Member Functions

 CurrentMap ()
 ~CurrentMap ()
void clear ()
void writeback ()
void loadMap (Map *map)
void setMap (Map *map)
uint32 getNum () const
unsigned int getChunkSize () const
void addItem (Item *item)
void addItemToEnd (Item *item)
void removeItemFromList (Item *item, sint32 oldx, sint32 oldy)
void removeItem (Item *item)
void updateFastArea (sint32 from_x, sint32 from_y, sint32 from_z, sint32 to_x, sint32 to_y, sint32 to_z)
void areaSearch (UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, Item *item, uint16 range, bool recurse, sint32 x=0, sint32 y=0)
void surfaceSearch (UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, Item *item, bool above, bool below, bool recurse=false)
void surfaceSearch (UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, ObjId id, sint32 origin[3], sint32 dims[2], bool above, bool below, bool recurse=false)
bool isValidPosition (sint32 x, sint32 y, sint32 z, sint32 startx, sint32 starty, sint32 startz, int xd, int yd, int zd, uint32 shapeflags, ObjId item, Item **support=0, ObjId *roof=0)
bool isValidPosition (sint32 x, sint32 y, sint32 z, int xd, int yd, int zd, uint32 shapeflags, ObjId item, Item **support=0, ObjId *roof=0)
bool isValidPosition (sint32 x, sint32 y, sint32 z, uint32 shape, ObjId item, Item **support=0, ObjId *roof=0)
bool scanForValidPosition (sint32 x, sint32 y, sint32 z, Item *item, int movedir, bool wantsupport, sint32 &tx, sint32 &ty, sint32 &tz)
bool sweepTest (const sint32 start[3], const sint32 end[3], const sint32 dims[3], uint32 shapeflags, ObjId item, bool solid_only, std::list< SweepItem > *hit)
TeleportEggfindDestination (uint16 id)
const std::list< Item * > * getItemList (sint32 gx, sint32 gy)
bool isChunkFast (sint32 cx, sint32 cy)
ItemtraceTopItem (sint32 x, sint32 y, sint32 ztop, sint32 zbot, ObjId ignore, uint32 shflags)
void setWholeMapFast ()
void save (ODataSource *ods)
bool load (IDataSource *ids, uint32 version)
 INTRINSIC (I_canExistAt)

Private Member Functions

void loadItems (std::list< Item * > itemlist, bool callCacheIn)
void createEggHatcher ()
void setChunkFast (sint32 cx, sint32 cy)
void unsetChunkFast (sint32 cx, sint32 cy)

Private Attributes

Mapcurrent_map
std::list< Item * > ** items
ProcId egghatcher
uint32 ** fast
sint32 fast_x_min
sint32 fast_y_min
sint32 fast_x_max
sint32 fast_y_max
int mapChunkSize

Friends

class World

Classes

struct  SweepItem


Detailed Description

Definition at line 35 of file CurrentMap.h.


Constructor & Destructor Documentation

CurrentMap::CurrentMap (  ) 

Definition at line 49 of file CurrentMap.cpp.

References fast, items, and mapChunkSize.

CurrentMap::~CurrentMap (  ) 

Definition at line 72 of file CurrentMap.cpp.

References fast, and items.


Member Function Documentation

void CurrentMap::addItem ( Item item  ) 

Add an item to the beginning of the item list.

Definition at line 244 of file CurrentMap.cpp.

References egghatcher, Item::EXT_INCURMAP, Kernel::get_instance(), Item::getLocation(), Object::getObjId(), Kernel::getProcess(), items, mapChunkSize, perr, and Item::setExtFlag().

Referenced by Item::loadData(), and Item::move().

void CurrentMap::addItemToEnd ( Item item  ) 

Add an item to the end of the item list.

Definition at line 271 of file CurrentMap.cpp.

References egghatcher, Item::EXT_INCURMAP, Kernel::get_instance(), Item::getLocation(), Object::getObjId(), Kernel::getProcess(), items, mapChunkSize, perr, and Item::setExtFlag().

Referenced by loadMap(), and Item::move().

void CurrentMap::areaSearch ( UCList itemlist,
const uint8 loopscript,
uint32  scriptsize,
Item item,
uint16  range,
bool  recurse,
sint32  x = 0,
sint32  y = 0 
)

search an area for items matching a loopscript

Parameters:
itemlist the list to return objids in
loopscript the script to check items against
scriptsize the size (in bytes) of the loopscript
item the item around which you want to search, or 0. if item is 0, search around (x,y)
range the (square) range to search
recurse if true, search in containers too
x x coordinate of search center if item is 0.
y y coordinate of search center if item is 0.

! constants

Definition at line 471 of file CurrentMap.cpp.

References UCList::append(), Container::containerSearch(), Item::EXT_SPRITE, Item::FLG_FLIPPED, Item::getFootpadWorld(), Item::getLocationAbsolute(), items, mapChunkSize, Pentagram::Rect::Overlaps(), ShapeInfo::x, and ShapeInfo::y.

Referenced by Actor::areEnemiesNear(), AnimationTracker::checkWeaponHit(), Item::countNearby(), UCMachine::execProcess(), Item::explode(), Item::movedByPlayer(), StartU8Process::run(), and CombatProcess::seekTarget().

void CurrentMap::clear (  ) 

Definition at line 84 of file CurrentMap.cpp.

References current_map, egghatcher, fast, fast_x_max, fast_x_min, fast_y_max, fast_y_min, Kernel::get_instance(), Kernel::getProcess(), items, and Process::terminate().

void CurrentMap::createEggHatcher (  )  [private]

Definition at line 113 of file CurrentMap.cpp.

References Kernel::addProcess(), egghatcher, Kernel::get_instance(), Kernel::getProcess(), and Process::terminate().

Referenced by loadMap().

TeleportEgg * CurrentMap::findDestination ( uint16  id  ) 

Definition at line 634 of file CurrentMap.cpp.

References items.

Referenced by MainActor::teleport().

unsigned int CurrentMap::getChunkSize (  )  const [inline]

Definition at line 53 of file CurrentMap.h.

References mapChunkSize.

Referenced by Item::move(), and MiniMapGump::PaintThis().

const std::list<Item*>* CurrentMap::getItemList ( sint32  gx,
sint32  gy 
) [inline]

Definition at line 175 of file CurrentMap.h.

References items.

Referenced by GameMapGump::PaintThis().

uint32 CurrentMap::getNum (  )  const

Get the map number of the CurrentMap.

Definition at line 105 of file CurrentMap.cpp.

References current_map, and Map::mapnum.

Referenced by CameraProcess::GetCameraLocation(), Actor::giveTreasure(), loadMap(), MiniMapGump::PaintThis(), World::save(), and World::switchMap().

CurrentMap::INTRINSIC ( I_canExistAt   ) 

bool CurrentMap::isChunkFast ( sint32  cx,
sint32  cy 
) [inline]

Definition at line 183 of file CurrentMap.h.

References fast.

Referenced by Item::move(), MiniMapGump::PaintThis(), GameMapGump::PaintThis(), FastAreaVisGump::PaintThis(), setWholeMapFast(), and updateFastArea().

bool CurrentMap::isValidPosition ( sint32  x,
sint32  y,
sint32  z,
uint32  shape,
ObjId  item,
Item **  support = 0,
ObjId roof = 0 
)

bool CurrentMap::isValidPosition ( sint32  x,
sint32  y,
sint32  z,
int  xd,
int  yd,
int  zd,
uint32  shapeflags,
ObjId  item,
Item **  support = 0,
ObjId roof = 0 
)

bool CurrentMap::isValidPosition ( sint32  x,
sint32  y,
sint32  z,
sint32  startx,
sint32  starty,
sint32  startz,
int  xd,
int  yd,
int  zd,
uint32  shapeflags,
ObjId  item,
Item **  support = 0,
ObjId roof = 0 
)

Referenced by Item::canExistAt(), CameraProcess::FindRoof(), GameMapGump::PaintThis(), QuickAvatarMoverProcess::run(), GravityProcess::run(), and AnimationTracker::step().

bool CurrentMap::load ( IDataSource ids,
uint32  version 
)

Definition at line 1256 of file CurrentMap.cpp.

References fast, fast_x_max, fast_x_min, fast_y_max, fast_y_min, and IDataSource::read4().

Referenced by GUIApp::loadGame().

void CurrentMap::loadItems ( std::list< Item * >  itemlist,
bool  callCacheIn 
) [private]

Referenced by loadMap().

void CurrentMap::loadMap ( Map map  ) 

Definition at line 196 of file CurrentMap.cpp.

References addItemToEnd(), createEggHatcher(), current_map, Map::dynamicitems, fast, fast_x_max, fast_x_min, fast_y_max, fast_y_min, Map::fixeditems, GUIApp::get_instance(), getActor(), GUIApp::getGameTimeInSeconds(), getNum(), loadItems(), and Actor::schedule().

Referenced by World::switchMap().

void CurrentMap::removeItem ( Item item  ) 

Definition at line 298 of file CurrentMap.cpp.

References Item::getLocation(), and removeItemFromList().

Referenced by Item::move(), Item::moveToContainer(), and Item::moveToEtherealVoid().

void CurrentMap::removeItemFromList ( Item item,
sint32  oldx,
sint32  oldy 
)

Definition at line 308 of file CurrentMap.cpp.

References Item::clearExtFlag(), Item::EXT_INCURMAP, Object::getObjId(), items, mapChunkSize, and perr.

Referenced by Item::destroy(), and removeItem().

void CurrentMap::save ( ODataSource ods  ) 

Definition at line 1247 of file CurrentMap.cpp.

References fast, and ODataSource::write4().

Referenced by GUIApp::saveGame().

bool CurrentMap::scanForValidPosition ( sint32  x,
sint32  y,
sint32  z,
Item item,
int  movedir,
bool  wantsupport,
sint32 tx,
sint32 ty,
sint32 tz 
)

Scan for a valid position for item in directions orthogonal to movedir.

! need to check is_sea() and is_land() maybe?

Definition at line 784 of file CurrentMap.cpp.

References Item::EXT_SPRITE, ShapeInfo::flags, Item::getFootpadWorld(), Object::getObjId(), Item::getShapeInfo(), ShapeInfo::is_solid(), items, mapChunkSize, pout, ShapeInfo::SI_DAMAGING, ShapeInfo::SI_SOLID, x_fact, and y_fact.

Referenced by AnimationTracker::step().

void CurrentMap::setChunkFast ( sint32  cx,
sint32  cy 
) [private]

Definition at line 447 of file CurrentMap.cpp.

References fast, and items.

Referenced by setWholeMapFast(), and updateFastArea().

void CurrentMap::setMap ( Map map  )  [inline]

sets the currently loaded map, without any processing. (Should only be used for loading.)

Definition at line 48 of file CurrentMap.h.

References current_map.

Referenced by World::load().

void CurrentMap::setWholeMapFast (  ) 

Definition at line 1238 of file CurrentMap.cpp.

References isChunkFast(), and setChunkFast().

Referenced by GameMapGump::ConCmd_dumpMap(), and MiniMapGump::ConCmd_generateWholeMap().

void CurrentMap::surfaceSearch ( UCList itemlist,
const uint8 loopscript,
uint32  scriptsize,
ObjId  id,
sint32  origin[3],
sint32  dims[2],
bool  above,
bool  below,
bool  recurse = false 
)

void CurrentMap::surfaceSearch ( UCList itemlist,
const uint8 loopscript,
uint32  scriptsize,
Item item,
bool  above,
bool  below,
bool  recurse = false 
)

Definition at line 549 of file CurrentMap.cpp.

References Item::getFootpadWorld(), Item::getLocationAbsolute(), and Object::getObjId().

Referenced by Item::ascend(), ActorAnimProcess::doSpecial(), UCMachine::execProcess(), Item::grab(), GameMapGump::OnMouseClick(), and Actor::tryAnim().

bool CurrentMap::sweepTest ( const sint32  start[3],
const sint32  end[3],
const sint32  dims[3],
uint32  shapeflags,
ObjId  item,
bool  solid_only,
std::list< SweepItem > *  hit 
)

Perform a sweepTest for an item move

Parameters:
start Start point to sweep from.
end End point to sweep to.
dims Bounding size of item to check.
shapeflags shapeflags of item to check.
item ObjId of the item being checked. This will allow item to be skipped from being tested against. Use 0 for no item.
solid_only If true, only test solid items.
hit Pointer to a list to fill with items hit. Items are sorted by SweepItem::hit_time
Returns:
false if no items were hit. true if any items were hit.

Definition at line 957 of file CurrentMap.cpp.

References Item::EXT_SPRITE, items, mapChunkSize, ShapeInfo::SI_DAMAGING, and ShapeInfo::SI_SOLID.

Referenced by Item::canReach(), Item::collideMove(), and MissileTracker::isPathClear().

Item * CurrentMap::traceTopItem ( sint32  x,
sint32  y,
sint32  ztop,
sint32  zbot,
ObjId  ignore,
uint32  shflags 
)

Definition at line 1182 of file CurrentMap.cpp.

References Item::EXT_SPRITE, ShapeInfo::flags, Item::getFootpadWorld(), Item::getLocation(), ShapeInfo::is_editor(), ShapeInfo::is_translucent(), items, and mapChunkSize.

Referenced by MiniMapGump::sampleAtPoint().

void CurrentMap::unsetChunkFast ( sint32  cx,
sint32  cy 
) [private]

Definition at line 458 of file CurrentMap.cpp.

References fast, items, and Item::leaveFastArea().

Referenced by updateFastArea().

void CurrentMap::updateFastArea ( sint32  from_x,
sint32  from_y,
sint32  from_z,
sint32  to_x,
sint32  to_y,
sint32  to_z 
)

Update the fast area for the cameras position.

Definition at line 367 of file CurrentMap.cpp.

References CalcFastAreaLimits(), ChunkOnScreen(), fast_x_max, fast_x_min, fast_y_max, fast_y_min, GUIApp::get_instance(), Gump::GetDims(), GUIApp::getGameMapGump(), Pentagram::Rect::h, isChunkFast(), mapChunkSize, setChunkFast(), unsetChunkFast(), and Pentagram::Rect::w.

Referenced by CameraProcess::GetLerped(), and CameraProcess::ItemMoved().

void CurrentMap::writeback (  ) 

Definition at line 124 of file CurrentMap.cpp.

References current_map, Map::dynamicitems, egghatcher, Item::EXT_FIXED, Item::EXT_INCURMAP, Map::fixeditems, Item::FLG_DISPOSABLE, Item::FLG_FAST_ONLY, Item::FLG_IN_NPC_LIST, Kernel::get_instance(), Kernel::getProcess(), items, Egg::reset(), and Process::terminate().

Referenced by World::switchMap().


Friends And Related Function Documentation

friend class World [friend]

Definition at line 37 of file CurrentMap.h.


Member Data Documentation

Map* CurrentMap::current_map [private]

Definition at line 206 of file CurrentMap.h.

Referenced by clear(), getNum(), loadMap(), setMap(), and writeback().

ProcId CurrentMap::egghatcher [private]

Definition at line 212 of file CurrentMap.h.

Referenced by addItem(), addItemToEnd(), clear(), createEggHatcher(), World::load(), World::save(), and writeback().

uint32** CurrentMap::fast [private]

Definition at line 215 of file CurrentMap.h.

Referenced by clear(), CurrentMap(), isChunkFast(), load(), loadMap(), save(), setChunkFast(), unsetChunkFast(), and ~CurrentMap().

sint32 CurrentMap::fast_x_max [private]

Definition at line 216 of file CurrentMap.h.

Referenced by clear(), load(), loadMap(), and updateFastArea().

sint32 CurrentMap::fast_x_min [private]

Definition at line 216 of file CurrentMap.h.

Referenced by clear(), load(), loadMap(), and updateFastArea().

sint32 CurrentMap::fast_y_max [private]

Definition at line 216 of file CurrentMap.h.

Referenced by clear(), load(), loadMap(), and updateFastArea().

sint32 CurrentMap::fast_y_min [private]

Definition at line 216 of file CurrentMap.h.

Referenced by clear(), load(), loadMap(), and updateFastArea().

std::list<Item*>** CurrentMap::items [private]

Definition at line 210 of file CurrentMap.h.

Referenced by addItem(), addItemToEnd(), areaSearch(), clear(), CurrentMap(), findDestination(), getItemList(), removeItemFromList(), scanForValidPosition(), setChunkFast(), sweepTest(), traceTopItem(), unsetChunkFast(), writeback(), and ~CurrentMap().

int CurrentMap::mapChunkSize [private]

Definition at line 218 of file CurrentMap.h.

Referenced by addItem(), addItemToEnd(), areaSearch(), CurrentMap(), getChunkSize(), removeItemFromList(), scanForValidPosition(), sweepTest(), traceTopItem(), and updateFastArea().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:05 2007 for pentagram by  doxygen 1.4.7