2 #include "TileObject.h" 22 virtual CBaseObject::_SceneObjectType GetType(){
return CBaseObject::GameObject;};
50 virtual bool InvokeEditor(
int nFieldID,
const string& sParameters);
53 ATTRIBUTE_METHOD1(
IGameObject, IsModified_s,
bool*) {*p1 = cls->IsModified();
return S_OK;}
54 ATTRIBUTE_METHOD1(
IGameObject, SetModified_s,
bool) {cls->SetModified(p1);
return S_OK;}
55 ATTRIBUTE_METHOD(
IGameObject, SaveToDB_s) {
return cls->SaveToDB()?S_OK:E_FAIL;}
57 ATTRIBUTE_METHOD1(
IGameObject, GetOnLoadScript_s,
const char**) {*p1 = cls->GetOnLoadScript().c_str();
return S_OK;}
58 ATTRIBUTE_METHOD1(
IGameObject, SetOnLoadScript_s,
const char*) {cls->SetOnLoadScript(p1);
return S_OK;}
60 ATTRIBUTE_METHOD1(
IGameObject, IsLoaded_s,
bool*) {*p1 = cls->IsLoaded();
return S_OK;}
61 ATTRIBUTE_METHOD1(
IGameObject, SetLoaded_s,
bool) {cls->SetLoaded(p1);
return S_OK;}
63 DEFINE_SCRIPT_EVENT(
IGameObject, EnterSentientArea);
64 DEFINE_SCRIPT_EVENT(
IGameObject, LeaveSentientArea);
73 ATTRIBUTE_METHOD1(
IGameObject, IsGlobal_s,
bool*) {*p1 = cls->IsGlobal();
return S_OK;}
74 ATTRIBUTE_METHOD1(
IGameObject, MakeGlobal_s,
bool) {cls->MakeGlobal(p1);
return S_OK;}
76 ATTRIBUTE_METHOD1(
IGameObject, IsSentient_s,
bool*) {*p1 = cls->IsSentient();
return S_OK;}
77 ATTRIBUTE_METHOD1(
IGameObject, MakeSentient_s,
bool) {cls->MakeSentient(p1);
return S_OK;}
79 ATTRIBUTE_METHOD1(
IGameObject, IsAlwaysSentient_s,
bool*) {*p1 = cls->IsAlwaysSentient();
return S_OK;}
80 ATTRIBUTE_METHOD1(
IGameObject, SetAlwaysSentient_s,
bool) {cls->SetAlwaysSentient(p1);
return S_OK;}
82 ATTRIBUTE_METHOD1(
IGameObject, GetSentientRadius_s,
float*) {*p1 = cls->GetSentientRadius();
return S_OK;}
83 ATTRIBUTE_METHOD1(
IGameObject, SetSentientRadius_s,
float) {cls->SetSentientRadius(p1);
return S_OK;}
85 ATTRIBUTE_METHOD1(
IGameObject, GetPerceptiveRadius_s,
float*) {*p1 = cls->GetPerceptiveRadius();
return S_OK;}
86 ATTRIBUTE_METHOD1(
IGameObject, SetPerceptiveRadius_s,
float) {cls->SetPerceptiveRadius(p1);
return S_OK;}
88 ATTRIBUTE_METHOD1(
IGameObject, GetGroupID_s,
int*) {*p1 = cls->GetGroupID();
return S_OK;}
89 ATTRIBUTE_METHOD1(
IGameObject, SetGroupID_s,
int) {cls->SetGroupID(p1);
return S_OK;}
91 ATTRIBUTE_METHOD1(
IGameObject, GetSentientField_s,
int*) {*p1 = cls->GetSentientField();
return S_OK;}
92 ATTRIBUTE_METHOD1(
IGameObject, SetSentientField_s,
int) {cls->SetSentientField(p1,
false);
return S_OK;}
94 ATTRIBUTE_METHOD1(
IGameObject, GetFrameMoveInterval_s,
int*) {*p1 = cls->GetFrameMoveInterval();
return S_OK;}
95 ATTRIBUTE_METHOD1(
IGameObject, SetFrameMoveInterval_s,
int) {cls->SetFrameMoveInterval(p1);
return S_OK;}
108 virtual void AnimateBiped(
double dTimeDelta,
bool bSharpTurning =
false );
139 virtual int On_Click(DWORD nMouseKey, DWORD dwParam1, DWORD dwParam2);
142 virtual int On_Event(DWORD nEventType, DWORD dwParam1, DWORD dwParam2);
153 virtual int On_Net_Send(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2);
157 virtual int On_Net_Receive(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2);
289 virtual void SetModified(
bool bModified){m_bModified = bModified;};
311 inline void SetSentientObjCount(
int nCount){m_nSentientObjCount = nCount;};
316 int GetFrameMoveInterval() {
return m_nFrameMoveInterval; };
332 bool m_bIsPersistent;
334 bool m_bAlwaysSentient;
337 string m_sOnLoadScript;
340 std::vector <std::string> m_PerceivedList;
344 int m_nSentientObjCount;
347 float m_fSentientRadius;
350 float m_fPeceptiveRadius;
357 DWORD m_dwSentientField;
362 unsigned int m_nFrameMoveInterval;
float GetDistanceSq2D(IGameObject *pObj)
get the distance square between this object and another game object
Definition: IGameObject.cpp:256
float GetPerceptiveRadius()
get the perceptive radius.
Definition: IGameObject.cpp:222
void SetGroupID(int nGroup)
set the group ID to which this object belongs to.
Definition: IGameObject.cpp:359
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: IGameObject.h:33
int GetNumOfPerceivedObject()
return the total number of perceived objects.
Definition: IGameObject.cpp:236
void ForceSentient(bool bSentient=true)
Force the object to be sentient or not.
Definition: IGameObject.cpp:284
virtual void MakeGlobal(bool bGlobal)
make the biped global if it is not and vice versa.
Definition: IGameObject.cpp:342
float GetSentientRadius()
get the sentient radius.
Definition: IGameObject.cpp:214
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual bool IsModified()
whether some of the fields are modified.It is up to the implementation class to provide this function...
Definition: IGameObject.h:287
virtual void UpdateTileContainer()
update the tile container according to the current position of the game object.
Definition: IGameObject.cpp:334
void SetLoaded(bool bLoaded)
see IsLoaded()
Definition: IGameObject.h:196
void LoadOnLoadScriptIfNot()
load the on load script if it is not loaded.
Definition: IGameObject.cpp:57
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void SetSpeedScale(float dScale)
set the animation instance's speed to dScale times of its original speed
Definition: IGameObject.h:292
virtual bool SaveToDB()
save the current character to database according to the persistent property.
Definition: IGameObject.cpp:480
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: IGameObject.h:31
virtual void AnimateBiped(double dTimeDelta, bool bSharpTurning=false)
animate biped according to its current way point lists and speed.
Definition: IGameObject.cpp:324
bool IsAlwaysSentient() const
whether the object is always sentient.
Definition: IGameObject.cpp:273
virtual void SetModified(bool bModified)
set whether any field has been modified.
Definition: IGameObject.h:289
bool IsSentientWith(const IGameObject *pObj)
return true if the current object is sentient to the specified object.
Definition: IGameObject.cpp:381
virtual int On_FrameMove()
called every frame move when this character is sentient.
Definition: IGameObject.cpp:165
void SetSentientField(DWORD dwFieldOrGroup, bool bIsGroup=false)
set the sentient field.
Definition: IGameObject.cpp:369
virtual bool ResetField(int nFieldID)
Reset the field to its initial or default value.
Definition: IGameObject.cpp:391
int GetSentientObjCount()
the number of objects in its sentient area.
Definition: IGameObject.h:310
virtual float GetSpeedScale()
Definition: IGameObject.h:294
virtual float GetSizeScale()
Definition: IGameObject.h:298
void SetAlwaysSentient(bool bAlways)
set whether sentient.
Definition: IGameObject.cpp:278
DWORD GetSentientField()
Definition: IGameObject.cpp:376
virtual void MakeSentient(bool bSentient=true)
set the object to sentient according to whether the object is currently sentient. ...
Definition: IGameObject.cpp:299
virtual int On_Click(DWORD nMouseKey, DWORD dwParam1, DWORD dwParam2)
when the player clicked on this object.
Definition: IGameObject.cpp:112
weak reference ptr use in a class like this: weak_ptr<CRefCounted> p; e.g.
Definition: PERef.h:105
void SetSentientRadius(float fR)
set the sentient radius.
Definition: IGameObject.cpp:218
AABB-related code.
Definition: ShapeAABB.h:11
virtual int On_Detached()
called when this object is detached from the scene
Definition: IGameObject.cpp:82
virtual void SetPersistent(bool bPersistent)
whenever a persistent object is made non-persistent, the SaveToDB() function will actually removed it...
Definition: IGameObject.cpp:453
virtual bool InvokeEditor(int nFieldID, const string &sParameters)
Invoke an (external) editor for a given field.
Definition: IGameObject.cpp:492
this is an interface class for game objects, such as NPC, OPC and players.
Definition: IGameObject.h:15
a tile in the latticed terrain class
Definition: TerrainTile.h:21
virtual void PathFinding(double dTimeDelta)
automatically generate way points according to its perceptions
Definition: IGameObject.cpp:319
bool IsLoaded()
On Load script logic: the onload script is moved from the biped object to the IGameObject.
Definition: IGameObject.h:191
int GetSimTag()
return the tag served for simulation.
Definition: IGameObject.h:301
virtual const CShapeAABB * GetMovableRegion()
get the region within which the object can move.
Definition: IGameObject.cpp:538
virtual bool IsPersistent()
whether the object is persistent in the world.
Definition: IGameObject.cpp:458
The top level scene management class.
Definition: SceneObject.h:58
virtual int On_Attached()
called when this object is attached to the scene.
Definition: IGameObject.cpp:75
void SetOnLoadScript(const string &str)
set the on load script.
Definition: IGameObject.cpp:543
virtual int On_Perception()
when other game objects of a different type entered the perceptive area of this object.
Definition: IGameObject.cpp:146
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: IGameObject.h:29
base class for all AI objects
Definition: AIBase.h:9
Tile Object have position and bounding rect and can usually be attached to quad-tree terrain tile...
Definition: TileObject.h:10
a general event
Definition: EventClasses.h:8
virtual CAIBase * GetAIModule()
Get the AI module that is dynamically associated with this object.
Definition: IGameObject.cpp:329
virtual bool IsGlobal()
is global object
Definition: IGameObject.h:245
virtual int On_Net_Receive(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
when the network module receives packages from the network and it is about a certain game object...
Definition: IGameObject.cpp:197
virtual bool IsSentient()
whether the biped is sentient or not
Definition: IGameObject.cpp:209
virtual int On_LeaveSentientArea()
when no other game objects of different type is in the sentient area of this object.
Definition: IGameObject.cpp:100
void SetPerceptiveRadius(float fNewRaduis)
Set the perceptive radius.
Definition: IGameObject.cpp:227
virtual int On_Net_Send(DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
during the execution of this object, it may send various network commands to the server or client...
Definition: IGameObject.cpp:185
std::vector< std::string > & GetPerceiveList()
get the names of the game objects in the object's perceptive radius.
Definition: IGameObject.h:305
void SetSimTag(int nTag)
set the tag served for simulation.
Definition: IGameObject.h:303
virtual void SetMovableRegion(const CShapeAABB *aabb)
Set the region within which the object can move.
Definition: IGameObject.cpp:528
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: IGameObject.cpp:557
IGameObject * GetPerceivedObject(int nIndex)
get the perceived object by index.
Definition: IGameObject.cpp:241
virtual void SetSizeScale(float dScale)
set the size of the object to dScale times of its original size.
Definition: IGameObject.h:296
int GetGroupID()
Get the group ID to which this object belongs to.
Definition: IGameObject.cpp:364
void SetFrameMoveInterval(int nFrameMoveInterval)
milliseconds interval, that the on frame move method should be called on a sentient object...
Definition: IGameObject.h:315
virtual int On_EnterSentientArea()
when other game objects of a different type entered the sentient area of this object.
Definition: IGameObject.cpp:87
virtual int On_Event(DWORD nEventType, DWORD dwParam1, DWORD dwParam2)
TODO: Some game defined events, such as user attack, etc.
Definition: IGameObject.cpp:133
const string & GetOnLoadScript()
get the on load script.
Definition: IGameObject.h:179