V-Gears 0
Free Final Fantasy VII engine.
FieldEngine::Entity Class Reference

Represents an entity. More...

#include <FieldEngine.h>

Public Member Functions

 Entity ()=default
 Entity constructor. More...
 
 Entity (const std::string &name, size_t index)
 Entity constructor. More...
 
std::string GetName () const
 Retrieves the entity name. More...
 
size_t GetIndex () const
 Retrieves the entity index. More...
 
std::string FunctionByIndex (size_t index) const
 Retrieves a function. More...
 
void AddFunction (const std::string &name, size_t index)
 Adds a function to the engine. More...
 
void MarkAsLine (bool line, std::vector< float > point_a, std::vector< float > point_b)
 Marks the entity as a line. More...
 
bool IsLine ()
 Checks if the entity is a line. More...
 
std::vector< float > GetLinePointA ()
 Retrieves the first point of the line entity. More...
 
std::vector< float > GetLinePointB ()
 Retrieves the second point of the line entity. More...
 

Private Attributes

std::string name_
 Entity name. More...
 
size_t index_
 Entity index. More...
 
std::map< size_t, std::string > functions_
 Entity function (script) list. More...
 
bool is_line_
 Indicates if the entity is a line. More...
 
std::vector< float > point_a_
 The first point of a line entity. More...
 
std::vector< float > point_b_
 The second point of a line entity. More...
 

Detailed Description

Represents an entity.

An entity can be almost anything in a field map: the playable character, an NPC, an item, a line...

Constructor & Destructor Documentation

◆ Entity() [1/2]

FieldEngine::Entity::Entity ( )
default

Entity constructor.

It doesn't initialize any of the fields.

◆ Entity() [2/2]

FieldEngine::Entity::Entity ( const std::string &  name,
size_t  index 
)

Entity constructor.

Instantiates an entity with a name.

Parameters
[in]nameEntity name.
[in]indexEntity index.

Member Function Documentation

◆ AddFunction()

void FieldEngine::Entity::AddFunction ( const std::string &  name,
size_t  index 
)

Adds a function to the engine.

Must be added by name and index.

Parameters
[in]nameFunction name. If the entity is a line, the name will be overridden.
[in]indexFunction index.

◆ FunctionByIndex()

std::string FieldEngine::Entity::FunctionByIndex ( size_t  index) const

Retrieves a function.

Retrieves the name of a function from it's index.

Parameters
[in]indexFunction index.
Returns
Function name.
Exceptions
DecompilerExceptionif there is no function with the specified index.

◆ GetIndex()

size_t FieldEngine::Entity::GetIndex ( ) const

Retrieves the entity index.

The index is the one at which appears in the original game script.

Returns
The entity index.

◆ GetLinePointA()

std::vector< float > FieldEngine::Entity::GetLinePointA ( )

Retrieves the first point of the line entity.

If the entity is not a line, the behavior is undefined.

Returns
The first point of the line entity.

◆ GetLinePointB()

std::vector< float > FieldEngine::Entity::GetLinePointB ( )

Retrieves the second point of the line entity.

If the entity is not a line, the behavior is undefined.

Returns
The second point of the line entity.

◆ GetName()

std::string FieldEngine::Entity::GetName ( ) const

Retrieves the entity name.

Returns
The entity name.

◆ IsLine()

bool FieldEngine::Entity::IsLine ( )

Checks if the entity is a line.

Note that an entity is not considered to be a line until a function has been found containing the opcode LINE and {

See also
MarkAsLine} has been called.
Returns
true if the entity is a line.

◆ MarkAsLine()

void FieldEngine::Entity::MarkAsLine ( bool  line,
std::vector< float >  point_a,
std::vector< float >  point_b 
)

Marks the entity as a line.

Parameters
[in]lineTrue to mark the entity as a line, false to unmark it.
[in]point_aFirst point of the line. Can be null if line is false.
[in]point_bSecond point of the line. Can be null if line is false.

Member Data Documentation

◆ functions_

std::map<size_t, std::string> FieldEngine::Entity::functions_
private

Entity function (script) list.

◆ index_

size_t FieldEngine::Entity::index_
private

Entity index.

◆ is_line_

bool FieldEngine::Entity::is_line_
private

Indicates if the entity is a line.

◆ name_

std::string FieldEngine::Entity::name_
private

Entity name.

◆ point_a_

std::vector<float> FieldEngine::Entity::point_a_
private

The first point of a line entity.

If the entity is not a line, it may not be initializer.

◆ point_b_

std::vector<float> FieldEngine::Entity::point_b_
private

The second point of a line entity.

If the entity is not a line, it may not be initializer.


The documentation for this class was generated from the following files: