Pyrogenesis
HEAD
Pyrogenesis, a RTS Engine
ICmpFootprint.h
Go to the documentation of this file.
1
/* Copyright (C) 2017 Wildfire Games.
2
* This file is part of 0 A.D.
3
*
4
* 0 A.D. is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* 0 A.D. is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef INCLUDED_ICMPFOOTPRINT
19
#define INCLUDED_ICMPFOOTPRINT
20
21
#include "
simulation2/system/Interface.h
"
22
23
#include "
simulation2/helpers/Position.h
"
24
25
class
CFixedVector3D
;
26
27
/**
28
* Footprints - an approximation of the entity's shape, used for collision detection and for
29
* rendering selection outlines.
30
* A footprint is either a circle (of some radius) or square (of some width and depth (actually
31
* it's a rectangle)), horizontally aligned, extruded to a given height.
32
*/
33
class
ICmpFootprint
:
public
IComponent
34
{
35
public
:
36
enum
EShape
37
{
38
CIRCLE
,
39
SQUARE
40
};
41
42
/**
43
* Return the shape of this footprint.
44
* Shapes are horizontal circles or squares, extended vertically upwards to make cylinders or boxes.
45
* @param[out] shape either CIRCLE or SQUARE
46
* @param[out] size0 if CIRCLE then radius, else width (size in X axis)
47
* @param[out] size1 if CIRCLE then radius, else depth (size in Z axis)
48
* @param[out] height size in Y axis
49
*/
50
virtual
void
GetShape
(
EShape
& shape,
entity_pos_t
& size0,
entity_pos_t
& size1,
entity_pos_t
& height)
const
= 0;
51
52
/**
53
* GetShape wrapper for script calls.
54
* Returns { "type": "circle", "radius": 5.0, "height": 1.0 }
55
* or { "type": "square", "width": 5.0, "depth": 5.0, "height": 1.0 }
56
*/
57
JS::Value
GetShape_wrapper
()
const
;
58
59
/**
60
* Pick a sensible position to place a newly-spawned entity near this footprint,
61
* such that it won't be in an invalid (obstructed) location regardless of the spawned unit's
62
* orientation.
63
* @return the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space
64
*/
65
virtual
CFixedVector3D
PickSpawnPoint
(
entity_id_t
spawned)
const
= 0;
66
67
/**
68
* Pick a sensible position to place a newly-spawned entity near this footprint,
69
* at the intersection between the footprint passability and the entity one.
70
* @return the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space
71
*/
72
virtual
CFixedVector3D
PickSpawnPointBothPass
(
entity_id_t
spawned)
const
= 0;
73
74
DECLARE_INTERFACE_TYPE
(Footprint)
75
};
76
77
#endif
// INCLUDED_ICMPFOOTPRINT
Interface.h
DECLARE_INTERFACE_TYPE
#define DECLARE_INTERFACE_TYPE(iname)
Definition:
Interface.h:23
Position.h
Entity coordinate types.
CFixedVector3D
Definition:
FixedVector3D.h:25
CFixed
A simple fixed-point number class.
Definition:
Fixed.h:120
ICmpFootprint
Footprints - an approximation of the entity's shape, used for collision detection and for rendering s...
Definition:
ICmpFootprint.h:34
ICmpFootprint::GetShape_wrapper
JS::Value GetShape_wrapper() const
GetShape wrapper for script calls.
Definition:
ICmpFootprint.cpp:27
ICmpFootprint::GetShape
virtual void GetShape(EShape &shape, entity_pos_t &size0, entity_pos_t &size1, entity_pos_t &height) const =0
Return the shape of this footprint.
ICmpFootprint::PickSpawnPointBothPass
virtual CFixedVector3D PickSpawnPointBothPass(entity_id_t spawned) const =0
Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection bet...
ICmpFootprint::PickSpawnPoint
virtual CFixedVector3D PickSpawnPoint(entity_id_t spawned) const =0
Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be i...
ICmpFootprint::EShape
EShape
Definition:
ICmpFootprint.h:37
ICmpFootprint::CIRCLE
@ CIRCLE
Definition:
ICmpFootprint.h:38
ICmpFootprint::SQUARE
@ SQUARE
Definition:
ICmpFootprint.h:39
IComponent
Definition:
IComponent.h:33
entity_id_t
u32 entity_id_t
Entity ID type.
Definition:
Entity.h:29
source
simulation2
components
ICmpFootprint.h
Generated by
1.9.4