Planeshift
|
Ensures all regions that need to be loaded are. More...
#include <zonehandler.h>
Public Member Functions | |
void | HandleDelayAndAnim (int32_t loadDelay, csVector2 start, csVector2 dest, csString background, csString widgetName) |
Handles delay and dot animation. | |
void | HandleMessage (MsgEntry *me) |
Handles messages from the server. | |
bool | IsLoading () const |
Returns if this is loading a zone. | |
bool | IsValid () const |
Returns whether the zone handler is valid. | |
void | LoadZone (csVector3 pos, float yrot, const char *sector, csVector3 vel, bool force=false) |
Loads a zone and places the user into it. | |
void | MovePlayerTo (const csVector3 &Pos, float yRot, const csString &newSector, const csVector3 &Vel) |
Moves player to given location. | |
void | OnDrawingFinished () |
Called after drawing on screen has finished. | |
ZoneHandler (MsgHandler *mh, psCelClient *cc) | |
Basic constructor. | |
virtual | ~ZoneHandler () |
Basic deconstructor. | |
Protected Member Functions | |
bool | FindLoadWindow (bool force=false, const char *widgetName="LoadWindow") |
Finds the loading window. | |
ZoneLoadInfo * | FindZone (const char *sector) const |
Finds load info for a specific sector. | |
bool | LoadZoneInfo () |
Extracts zone information out of a XML. | |
Protected Attributes | |
psCelClient * | celclient |
Pointer to cel client instance. | |
csString | forcedBackgroundImg |
String which holds the background of the loading screen. | |
csTicks | forcedLoadingEndTime |
Holds how long the loading shall be delayed. | |
csTicks | forcedLoadingStartTime |
Holds how long the loading shall be delayed. | |
csString | forcedWidgetName |
Holds the widget name used to replace the load window. | |
size_t | loadCount |
The number of items that are being loaded. | |
bool | loading |
Whether a new zone is currently being loaded. | |
pawsProgressBar * | loadProgressBar |
Used for showing users load progress. | |
pawsLoadWindow * | loadWindow |
A load window that can be shown to users while loading. | |
psMoveState | moveState |
csRef< MsgHandler > | msghandler |
Message Handler to subscribe to. | |
csVector3 | newPos |
The target location the player will move to after loading. | |
csVector3 | newVel |
The velocity the player will have after loading. | |
float | newyrot |
The rotation the player will have after loading. | |
csString | sectorToLoad |
The sector that needs to be loaded. | |
bool | valid |
Whether the loading was successful. | |
csHash< ZoneLoadInfo *, const char * > | zonelist |
Mapping of names of zones to their load info. |
Ensures all regions that need to be loaded are.
Listens for crossing sector boundaries and makes sure that we have all the right stuff loaded in each zone.
Definition at line 105 of file zonehandler.h.
ZoneHandler::ZoneHandler | ( | MsgHandler * | mh, |
psCelClient * | cc | ||
) |
Basic constructor.
Sets initial values and calls LoadZoneInfo(). Sets valid to true if everything checked out good
mh | The message handler to subscribe messages to |
cc | Used to get player information out of |
virtual ZoneHandler::~ZoneHandler | ( | ) | [virtual] |
Basic deconstructor.
bool ZoneHandler::FindLoadWindow | ( | bool | force = false , |
const char * | widgetName = "LoadWindow" |
||
) | [protected] |
Finds the loading window.
Checks if there is a loading window. If there is not a loading window or the loading window does not have a progress bar, false is returned.
force | If true it will force the window to be searched even if we have it already |
widgetName | if defined it will hook the loading windows to the defined name |
ZoneLoadInfo* ZoneHandler::FindZone | ( | const char * | sector | ) | const [protected] |
Finds load info for a specific sector.
Searches zonelist for the key specified in sector. If it is not found null is returned and an error is printed
sector | The sector to look for |
void ZoneHandler::HandleDelayAndAnim | ( | int32_t | loadDelay, |
csVector2 | start, | ||
csVector2 | dest, | ||
csString | background, | ||
csString | widgetName | ||
) |
Handles delay and dot animation.
loadDelay | Delay of loading screen |
start | Start of dot animation |
dest | Destination of dot animation |
background | The loading background |
widgetName | The name of the widget to use for this loading. |
void ZoneHandler::HandleMessage | ( | MsgEntry * | me | ) | [virtual] |
Handles messages from the server.
Handles psNewSectorMessage by loading the target zone and will call ForceLoadScreen if there is no load delay
me | The message to create the psNewSectorMessage out of |
Implements psClientNetSubscriber.
bool ZoneHandler::IsLoading | ( | ) | const [inline] |
bool ZoneHandler::IsValid | ( | ) | const [inline] |
Returns whether the zone handler is valid.
Definition at line 184 of file zonehandler.h.
void ZoneHandler::LoadZone | ( | csVector3 | pos, |
float | yrot, | ||
const char * | sector, | ||
csVector3 | vel, | ||
bool | force = false |
||
) |
Loads a zone and places the user into it.
After the zone is found (from the sector parameter), the player is moved to a temporary off screen location. While there the loading screen is displayed and the zone is loaded. After the zone has finished loading, the player is moved to the target position.
pos | The target position in the new zone |
yrot | The target rotation angle in the new zone |
sector | The name of the target zone |
vel | Target velocity |
force | Whether to force the loading of the target zone |
bool ZoneHandler::LoadZoneInfo | ( | ) | [protected] |
Extracts zone information out of a XML.
Checks "/planeshift/data/zoneinfo.xml" for a valid XML. Each element named "zone" under "zonelist" has a ZoneLoadInfo created out of it. All ZoneLoadInfo are then added to zonelist based on their sector
void ZoneHandler::MovePlayerTo | ( | const csVector3 & | Pos, |
float | yRot, | ||
const csString & | newSector, | ||
const csVector3 & | Vel | ||
) |
Moves player to given location.
Pos | Target position to move to |
newSector | Target sector to move to |
Vel | Target velocity |
void ZoneHandler::OnDrawingFinished | ( | ) |
Called after drawing on screen has finished.
Checks if player just crossed boundary between sectors and loads/unloads needed maps
psCelClient* ZoneHandler::celclient [protected] |
Pointer to cel client instance.
Definition at line 192 of file zonehandler.h.
csString ZoneHandler::forcedBackgroundImg [protected] |
String which holds the background of the loading screen.
Definition at line 201 of file zonehandler.h.
csTicks ZoneHandler::forcedLoadingEndTime [protected] |
Holds how long the loading shall be delayed.
Definition at line 202 of file zonehandler.h.
csTicks ZoneHandler::forcedLoadingStartTime [protected] |
Holds how long the loading shall be delayed.
Definition at line 203 of file zonehandler.h.
csString ZoneHandler::forcedWidgetName [protected] |
Holds the widget name used to replace the load window.
Definition at line 204 of file zonehandler.h.
size_t ZoneHandler::loadCount [protected] |
The number of items that are being loaded.
Definition at line 205 of file zonehandler.h.
bool ZoneHandler::loading [protected] |
Whether a new zone is currently being loaded.
Definition at line 200 of file zonehandler.h.
pawsProgressBar* ZoneHandler::loadProgressBar [protected] |
Used for showing users load progress.
Definition at line 208 of file zonehandler.h.
pawsLoadWindow* ZoneHandler::loadWindow [protected] |
A load window that can be shown to users while loading.
Definition at line 207 of file zonehandler.h.
psMoveState ZoneHandler::moveState [protected] |
Definition at line 199 of file zonehandler.h.
csRef<MsgHandler> ZoneHandler::msghandler [protected] |
Message Handler to subscribe to.
Definition at line 191 of file zonehandler.h.
csVector3 ZoneHandler::newPos [protected] |
The target location the player will move to after loading.
Definition at line 196 of file zonehandler.h.
csVector3 ZoneHandler::newVel [protected] |
The velocity the player will have after loading.
Definition at line 197 of file zonehandler.h.
float ZoneHandler::newyrot [protected] |
The rotation the player will have after loading.
Definition at line 198 of file zonehandler.h.
csString ZoneHandler::sectorToLoad [protected] |
The sector that needs to be loaded.
Definition at line 195 of file zonehandler.h.
bool ZoneHandler::valid [protected] |
Whether the loading was successful.
Definition at line 194 of file zonehandler.h.
csHash<ZoneLoadInfo*, const char*> ZoneHandler::zonelist [protected] |
Mapping of names of zones to their load info.
Definition at line 190 of file zonehandler.h.