OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
simpleentity.h
1/*
2===========================================================================
3Copyright (C) 2015 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23// simpleentity.h: Simple entity.
24
25#pragma once
26
27#include "listener.h"
28
29extern Event EV_SetAngles;
30extern Event EV_SetAngle;
31extern Event EV_SetOrigin;
32extern Event EV_SetTarget;
33extern Event EV_SetTarget2;
34extern Event EV_GetTarget;
35
36typedef int entflags_t;
37
38class SimpleEntity;
39typedef SafePtr<SimpleEntity> SimpleEntityPtr;
40
41class SimpleEntity : public Listener
42{
43public:
44 // Base coord variable
45 Vector origin;
46 Vector angles;
47
48 // Flag (used to set a class flag)
49 entflags_t entflags;
50
51 // Used by scripts
52 str target;
53 str targetname;
54
55 // Centered origin based on mins/maxs
56 Vector centroid;
57
58public:
59 CLASS_PROTOTYPE(SimpleEntity);
60
61 SimpleEntity();
62 virtual ~SimpleEntity();
63
64 virtual void setOrigin(Vector origin);
65 virtual void setOriginEvent(Vector origin);
66 virtual void setAngles(Vector angles);
67 const str & Target();
68 qboolean Targeted(void);
69 str & TargetName();
70 virtual void SetTargetName(str targetname);
71 void Archive(Archiver &arc) override;
72
73 int IsSubclassOfEntity(void) const;
74 int IsSubclassOfAnimate(void) const;
75 int IsSubclassOfSentient(void) const;
76 int IsSubclassOfPlayer(void) const;
77 int IsSubclassOfActor(void) const;
78 int IsSubclassOfItem(void) const;
79 int IsSubclassOfInventoryItem(void) const;
80 int IsSubclassOfWeapon(void) const;
81 int IsSubclassOfProjectile(void) const;
82 int IsSubclassOfDoor(void) const;
83 int IsSubclassOfCamera(void) const;
84 int IsSubclassOfVehicle(void) const;
85 int IsSubclassOfVehicleTank(void) const;
86 int IsSubclassOfVehicleTurretGun(void) const;
87 int IsSubclassOfTurretGun(void) const;
88 int IsSubclassOfPathNode(void) const;
89 int IsSubclassOfWaypoint(void) const;
90 int IsSubclassOfTempWaypoint(void) const;
91 int IsSubclassOfVehiclePoint(void) const;
92 int IsSubclassOfSplinePath(void) const;
93 int IsSubclassOfCrateObject(void) const;
94
95 void GetOrigin(Event *ev);
96 void SetOrigin(Event *ev);
97 void GetCentroid(Event *ev);
98 void SetTargetname(Event *ev);
99 void GetTargetname(Event *ev);
100 void SetTarget(Event *ev);
101 void GetTarget(Event *ev);
102 void SetAngles(Event *ev);
103 void GetAngles(Event *ev);
104 void SetAngleEvent(Event *ev);
105 void GetAngleEvent(Event *ev);
106
107 void GetForwardVector(Event *ev);
108 void GetLeftVector(Event *ev);
109 void GetRightVector(Event *ev);
110 void GetUpVector(Event *ev);
111
112 SimpleEntity *Next(void);
113 void MPrintf(const char *msg, ...);
114
115 void SimpleArchive(Archiver& arc);
116};
117
118class SimpleArchivedEntity : public SimpleEntity
119{
120public:
121 CLASS_PROTOTYPE(SimpleArchivedEntity);
122
123 SimpleArchivedEntity();
124 virtual ~SimpleArchivedEntity();
125};
Definition archive.h:86
Definition listener.h:246
Definition safeptr.h:160
Definition simpleentity.h:42
Definition vector.h:61
Definition str.h:77