#include <map_objects.h>
Inheritance diagram for hoa_map::private_map::MapObject:


Public Member Functions | |
| virtual void | Draw ()=0 |
| Draws the object to the frame buffer. Objects are drawn differently depending on what type of object they are and what their current state is. This function is only called for objects that will be visible on the screen when drawn and have their VISIBLE bit in the MapObject::_status member set. | |
| bool | DrawHelper () |
| Assists with the drawing of map objects. | |
| MapObject () | |
| virtual void | Update ()=0 |
| Updates the state of an object. Many map objects may not actually have a use for this function. For example, animated objects like a tree automatically have their frames updated by the video engine, so there is no need to call this function for it. The function is only called for objects which have the UPDATEABLE bit in the MapObject::_status member set. | |
| virtual | ~MapObject () |
| float | ComputeXLocation () const |
| Computes the full floating-point location coordinates of the object. | |
| float | ComputeYLocation () const |
Lua Access Functions | |
These functions are specifically written for Lua binding, to enable Lua to access the members of this class. | |
| float | GetCollHalfWidth () const |
| float | GetCollHeight () const |
| uint32 | GetContext () const |
| float | GetImgHalfWidth () const |
| float | GetImgHeight () const |
| int16 | GetObjectID () const |
| uint8 | GetType () const |
| void | GetXPosition (uint16 &x, float &offset) const |
| void | GetYPosition (uint16 &y, float &offset) const |
| bool | IsDrawOnSecondPass () const |
| bool | IsNoCollision () const |
| bool | IsUpdatable () const |
| bool | IsVisible () const |
| void | SetCollHalfWidth (float collision) |
| void | SetCollHeight (float collision) |
| void | SetContext (uint32 ctxt) |
| void | SetDrawOnSecondPass (bool pass) |
| void | SetImgHalfWidth (float width) |
| void | SetImgHeight (float height) |
| void | SetNoCollision (bool coll) |
| void | SetObjectID (int16 id=0) |
| void | SetUpdatable (bool update) |
| void | SetVisible (bool vis) |
| void | SetXPosition (uint16 x, float offset) |
| void | SetYPosition (uint16 y, float offset) |
Public Attributes | |
| float | coll_half_width |
| Determines the collision rectangle for the object. The collision area determines what portion of the map object may not be overlapped by other objects or unwalkable regions of the map. The x and y coordinates are relative to the origin, so an x value of 0.5f means that the collision rectangle extends the length of 1/2 of a tile from the origin on both sides, and a y value of 1.0f means that the collision area exists from the origin to 1 tile's length above. | |
| float | coll_height |
| uint32 | context |
| The map context that the object currently resides in. Context helps to determine where an object "resides". For example, inside of a house or outside of a house. The context member determines if the object should be drawn or not, since objects are only drawn if they are in the same context as the map's camera. Objects can only interact with one another if they both reside in the same context. | |
| bool | draw_on_second_pass |
| When set to true, objects in the ground object layer will be drawn after the pass objects. | |
| std::string | filename |
| float | img_half_width |
| The half-width and height of the image, in map grid coordinates. The half_width member is indeed just that: half the width of the object's image. We keep the half width rather than the full width because the origin of the object is its bottom center, and it is more convenient to store only half the sprite's width as a result. | |
| float | img_height |
| bool | no_collision |
| When set to true, the object will not be examined for collision detection (default = false). Setting this member to true really has two effects. First, the object may exist anywhere on the map, including where the collision rectangles of other objects are located. Second, the object is ignored when other objects are performing their collision detection. This property is useful for virtual objects or objects with an image but no "physical form" (i.e. ghosts that other sprites may walk through). Note that while this member is set to true, the object's collision rectangle members are ignored. | |
| int16 | object_id |
| An identification number for the object as it is represented in the map file. Player sprites are assigned object ids from 5000 and above. Technically this means that a map can have no more than 5000 objects that are not player sprites, but no map should need to contain that many objects in the first place. Objects with an ID less than zero are invalid. | |
| bool | updatable |
| When set to false, the Update() function will do nothing (default = true). | |
| bool | visible |
| When set to false, the Draw() function will do nothing (default = true). | |
| float | x_offset |
| uint16 | x_position |
| Coordinates for the object's origin/position. The origin of every map object is the bottom center point of the object. These origin coordinates are used to determine where the object is on the map as well as where the objects collision rectangle lies. | |
| float | y_offset |
| uint16 | y_position |
Protected Attributes | |
| uint8 | _object_type |
| This holds the the type of sprite this is. | |
****************************************************************************
A map object can be anything from a sprite to a tree to a house. To state it simply, a map object is a map image that is not tiled and may not be fixed in place. Map objects are drawn in one of three layers: ground, pass, and sky object layers. Every map object has a collision rectangle associated with it. The collision rectangle indicates what parts of the object may not overlap with other collision rectangles.
Definition at line 53 of file map_objects.h.
| hoa_map::private_map::MapObject::MapObject | ( | ) |
Definition at line 45 of file map_objects.cpp.
| virtual hoa_map::private_map::MapObject::~MapObject | ( | ) | [inline, virtual] |
Definition at line 147 of file map_objects.h.
| float hoa_map::private_map::MapObject::ComputeXLocation | ( | ) | const [inline] |
Computes the full floating-point location coordinates of the object.
Definition at line 183 of file map_objects.h.
References x_offset, and x_position.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), hoa_map::MapMode::_DetectCollision(), hoa_map::MapMode::_FindNearestObject(), hoa_map::private_map::EnemySprite::Update(), and hoa_map::private_map::VirtualSprite::Update().
| float hoa_map::private_map::MapObject::ComputeYLocation | ( | ) | const [inline] |
Definition at line 186 of file map_objects.h.
References y_offset, and y_position.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), hoa_map::MapMode::_DetectCollision(), hoa_map::MapMode::_FindNearestObject(), hoa_map::private_map::EnemySprite::Update(), and hoa_map::private_map::VirtualSprite::Update().
| virtual void hoa_map::private_map::MapObject::Draw | ( | ) | [pure virtual] |
Draws the object to the frame buffer. Objects are drawn differently depending on what type of object they are and what their current state is. This function is only called for objects that will be visible on the screen when drawn and have their VISIBLE bit in the MapObject::_status member set.
Implemented in hoa_map::private_map::PhysicalObject, hoa_map::private_map::VirtualSprite, hoa_map::private_map::MapSprite, and hoa_map::private_map::EnemySprite.
| bool hoa_map::private_map::MapObject::DrawHelper | ( | ) |
Assists with the drawing of map objects.
Definition at line 64 of file map_objects.cpp.
References hoa_map::MapMode::_current_map, hoa_map::MapMode::_draw_info, hoa_map::private_map::MapFrame::bottom_edge, img_half_width, img_height, hoa_video::GameVideo::Move(), hoa_map::private_map::MapFrame::right_edge, hoa_map::private_map::MapFrame::top_edge, hoa_video::VideoManager, visible, x_offset, x_position, y_offset, and y_position.
Referenced by hoa_map::private_map::EnemySprite::Draw(), hoa_map::private_map::MapSprite::Draw(), and hoa_map::private_map::PhysicalObject::Draw().
Here is the call graph for this function:

| float hoa_map::private_map::MapObject::GetCollHalfWidth | ( | ) | const [inline] |
| float hoa_map::private_map::MapObject::GetCollHeight | ( | ) | const [inline] |
| uint32 hoa_map::private_map::MapObject::GetContext | ( | ) | const [inline] |
| float hoa_map::private_map::MapObject::GetImgHalfWidth | ( | ) | const [inline] |
| float hoa_map::private_map::MapObject::GetImgHeight | ( | ) | const [inline] |
Definition at line 246 of file map_objects.h.
References img_height.
Referenced by hoa_map::private_map::VirtualSprite::Draw().
| int16 hoa_map::private_map::MapObject::GetObjectID | ( | ) | const [inline] |
| uint8 hoa_map::private_map::MapObject::GetType | ( | ) | const [inline] |
| void hoa_map::private_map::MapObject::GetXPosition | ( | uint16 & | x, | |
| float & | offset | |||
| ) | const [inline] |
| void hoa_map::private_map::MapObject::GetYPosition | ( | uint16 & | y, | |
| float & | offset | |||
| ) | const [inline] |
| bool hoa_map::private_map::MapObject::IsDrawOnSecondPass | ( | ) | const [inline] |
| bool hoa_map::private_map::MapObject::IsNoCollision | ( | ) | const [inline] |
| bool hoa_map::private_map::MapObject::IsUpdatable | ( | ) | const [inline] |
| bool hoa_map::private_map::MapObject::IsVisible | ( | ) | const [inline] |
| void hoa_map::private_map::MapObject::SetCollHalfWidth | ( | float | collision | ) | [inline] |
| void hoa_map::private_map::MapObject::SetCollHeight | ( | float | collision | ) | [inline] |
| void hoa_map::private_map::MapObject::SetContext | ( | uint32 | ctxt | ) | [inline] |
| void hoa_map::private_map::MapObject::SetDrawOnSecondPass | ( | bool | pass | ) | [inline] |
| void hoa_map::private_map::MapObject::SetImgHalfWidth | ( | float | width | ) | [inline] |
| void hoa_map::private_map::MapObject::SetImgHeight | ( | float | height | ) | [inline] |
| void hoa_map::private_map::MapObject::SetNoCollision | ( | bool | coll | ) | [inline] |
| void hoa_map::private_map::MapObject::SetObjectID | ( | int16 | id = 0 |
) | [inline] |
Definition at line 195 of file map_objects.h.
References object_id.
Referenced by hoa_map::private_map::EnemyZone::AddEnemy().
| void hoa_map::private_map::MapObject::SetUpdatable | ( | bool | update | ) | [inline] |
| void hoa_map::private_map::MapObject::SetVisible | ( | bool | vis | ) | [inline] |
| void hoa_map::private_map::MapObject::SetXPosition | ( | uint16 | x, | |
| float | offset | |||
| ) | [inline] |
| void hoa_map::private_map::MapObject::SetYPosition | ( | uint16 | y, | |
| float | offset | |||
| ) | [inline] |
| virtual void hoa_map::private_map::MapObject::Update | ( | ) | [pure virtual] |
Updates the state of an object. Many map objects may not actually have a use for this function. For example, animated objects like a tree automatically have their frames updated by the video engine, so there is no need to call this function for it. The function is only called for objects which have the UPDATEABLE bit in the MapObject::_status member set.
Implemented in hoa_map::private_map::PhysicalObject, hoa_map::private_map::VirtualSprite, hoa_map::private_map::MapSprite, and hoa_map::private_map::EnemySprite.
uint8 hoa_map::private_map::MapObject::_object_type [protected] |
This holds the the type of sprite this is.
Definition at line 273 of file map_objects.h.
Referenced by hoa_map::private_map::EnemySprite::EnemySprite(), GetType(), hoa_map::private_map::MapSprite::MapSprite(), hoa_map::private_map::PhysicalObject::PhysicalObject(), and hoa_map::private_map::VirtualSprite::VirtualSprite().
Determines the collision rectangle for the object. The collision area determines what portion of the map object may not be overlapped by other objects or unwalkable regions of the map. The x and y coordinates are relative to the origin, so an x value of 0.5f means that the collision rectangle extends the length of 1/2 of a tile from the origin on both sides, and a y value of 1.0f means that the collision area exists from the origin to 1 tile's length above.
Definition at line 117 of file map_objects.h.
Referenced by hoa_map::MapMode::_DetectCollision(), hoa_map::MapMode::_FindNearestObject(), GetCollHalfWidth(), and SetCollHalfWidth().
Definition at line 117 of file map_objects.h.
Referenced by hoa_map::MapMode::_DetectCollision(), hoa_map::MapMode::_FindNearestObject(), GetCollHeight(), and SetCollHeight().
The map context that the object currently resides in. Context helps to determine where an object "resides". For example, inside of a house or outside of a house. The context member determines if the object should be drawn or not, since objects are only drawn if they are in the same context as the map's camera. Objects can only interact with one another if they both reside in the same context.
Definition at line 76 of file map_objects.h.
Referenced by hoa_map::MapMode::_DetectCollision(), hoa_map::MapMode::_FindNearestObject(), GetContext(), and SetContext().
When set to true, objects in the ground object layer will be drawn after the pass objects.
Definition at line 139 of file map_objects.h.
Referenced by IsDrawOnSecondPass(), and SetDrawOnSecondPass().
| std::string hoa_map::private_map::MapObject::filename |
Definition at line 141 of file map_objects.h.
Referenced by hoa_map::private_map::EnemySprite::EnemySprite(), and hoa_map::private_map::EnemySprite::Load().
The half-width and height of the image, in map grid coordinates. The half_width member is indeed just that: half the width of the object's image. We keep the half width rather than the full width because the origin of the object is its bottom center, and it is more convenient to store only half the sprite's width as a result.
Definition at line 103 of file map_objects.h.
Referenced by DrawHelper(), GetImgHalfWidth(), hoa_map::private_map::MapSprite::LoadStandardAnimations(), and SetImgHalfWidth().
Definition at line 103 of file map_objects.h.
Referenced by DrawHelper(), GetImgHeight(), hoa_map::private_map::MapSprite::LoadStandardAnimations(), and SetImgHeight().
When set to true, the object will not be examined for collision detection (default = false). Setting this member to true really has two effects. First, the object may exist anywhere on the map, including where the collision rectangles of other objects are located. Second, the object is ignored when other objects are performing their collision detection. This property is useful for virtual objects or objects with an image but no "physical form" (i.e. ghosts that other sprites may walk through). Note that while this member is set to true, the object's collision rectangle members are ignored.
Definition at line 133 of file map_objects.h.
Referenced by hoa_map::MapMode::_DetectCollision(), hoa_map::private_map::EnemySprite::ChangeStateHostile(), hoa_map::private_map::EnemySprite::ChangeStateSpawning(), IsNoCollision(), hoa_map::private_map::EnemySprite::Reset(), and SetNoCollision().
An identification number for the object as it is represented in the map file. Player sprites are assigned object ids from 5000 and above. Technically this means that a map can have no more than 5000 objects that are not player sprites, but no map should need to contain that many objects in the first place. Objects with an ID less than zero are invalid.
Definition at line 61 of file map_objects.h.
Referenced by hoa_map::MapMode::_AddGroundObject(), hoa_map::MapMode::_AddPassObject(), hoa_map::MapMode::_AddSkyObject(), GetObjectID(), and SetObjectID().
When set to false, the Update() function will do nothing (default = true).
Definition at line 120 of file map_objects.h.
Referenced by hoa_map::private_map::EnemySprite::ChangeStateHostile(), hoa_map::private_map::EnemySprite::ChangeStateSpawning(), IsUpdatable(), hoa_map::private_map::EnemySprite::Reset(), SetUpdatable(), hoa_map::private_map::VirtualSprite::Update(), and hoa_map::private_map::PhysicalObject::Update().
When set to false, the Draw() function will do nothing (default = true).
Definition at line 123 of file map_objects.h.
Referenced by DrawHelper(), IsVisible(), and SetVisible().
Definition at line 91 of file map_objects.h.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), ComputeXLocation(), DrawHelper(), GetXPosition(), SetXPosition(), and hoa_map::private_map::VirtualSprite::Update().
Coordinates for the object's origin/position. The origin of every map object is the bottom center point of the object. These origin coordinates are used to determine where the object is on the map as well as where the objects collision rectangle lies.
The position coordinates are described by an integer (position) and a float (offset). The position coordinates point to the map grid tile that the object currently occupies and may range from 0 to the number of columns or rows of grid tiles on the map. The offset member will always range from 0.0f and 1.0f to indicate the exact position of the object within that tile.
Definition at line 90 of file map_objects.h.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), ComputeXLocation(), DrawHelper(), hoa_map::private_map::ActionPathMove::Execute(), GetXPosition(), SetXPosition(), hoa_map::private_map::EnemySprite::Update(), and hoa_map::private_map::VirtualSprite::Update().
Definition at line 91 of file map_objects.h.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), ComputeYLocation(), DrawHelper(), GetYPosition(), hoa_map::private_map::MapObject_Ptr_Less::operator()(), SetYPosition(), and hoa_map::private_map::VirtualSprite::Update().
Definition at line 90 of file map_objects.h.
Referenced by hoa_map::MapMode::_CalculateDrawInfo(), ComputeYLocation(), DrawHelper(), hoa_map::private_map::ActionPathMove::Execute(), GetYPosition(), hoa_map::private_map::MapObject_Ptr_Less::operator()(), SetYPosition(), hoa_map::private_map::EnemySprite::Update(), and hoa_map::private_map::VirtualSprite::Update().
1.5.1