OpenClonk
C4Object.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* That which fills the world with life */
19 
20 #ifndef INC_C4Object
21 #define INC_C4Object
22 
23 #include "game/C4GameScript.h"
24 #include "graphics/C4Facet.h"
25 #include "object/C4Id.h"
26 #include "object/C4ObjectPtr.h"
27 #include "object/C4Sector.h"
28 #include "object/C4Shape.h"
29 #include "script/C4PropList.h"
30 #include "script/C4Value.h"
31 
32 /* Object status */
33 
34 #define C4OS_DELETED 0
35 #define C4OS_NORMAL 1
36 #define C4OS_INACTIVE 2
37 
38 /* Action.Dir is the direction the object is actually facing. */
39 
40 #define DIR_None 0
41 #define DIR_Left 0
42 #define DIR_Right 1
43 
44 /* Action.ComDir tells an active object which way it ought to be going.
45  If you set the ComDir to COMD_Stop, the object won't sit still immediately
46  but will try to slow down according to it's current Action. ComDir values
47  circle clockwise from COMD_Up 1 through COMD_UpLeft 8. */
48 
49 #define COMD_None -1
50 #define COMD_Stop 0
51 #define COMD_Up 1
52 #define COMD_UpRight 2
53 #define COMD_Right 3
54 #define COMD_DownRight 4
55 #define COMD_Down 5
56 #define COMD_DownLeft 6
57 #define COMD_Left 7
58 #define COMD_UpLeft 8
59 
60 /* Visibility values tell conditions for an object's visibility */
61 
62 #define VIS_All 0
63 #define VIS_None 1
64 #define VIS_Owner 2
65 #define VIS_Allies 4
66 #define VIS_Enemies 8
67 #define VIS_Select 16
68 #define VIS_God 32
69 #define VIS_LayerToggle 64
70 #define VIS_OverlayOnly 128
71 #define VIS_Editor 256
72 
73 
74 class C4Action
75 {
76 public:
77  C4Action();
79 public:
80  int32_t Dir;
81  int32_t DrawDir; // NoSave // - needs to be calculated for old-style objects.txt anyway
82  int32_t ComDir;
83  int32_t Time;
84  int32_t Data;
85  int32_t Phase,PhaseDelay;
86  int32_t t_attach; // SyncClearance-NoSave //
88  C4Facet Facet; // NoSave //
89  int32_t FacetX,FacetY; // NoSave //
91 public:
92  void Default();
93  void CompileFunc(StdCompiler *pComp);
94 };
95 
97 {
98 private:
99  void UpdateInMat();
100  void Splash();
101  void RemoveSolidMask(bool fBackupAttachment); // Remove solid mask data, if existing
102  void MovementDigFreeTargetArea(); // Dig the area free, according to action data
103 public:
104  C4Object();
105  ~C4Object() override;
107  int32_t RemovalDelay; // NoSave //
108  int32_t Owner;
109  int32_t Controller;
110  int32_t LastEnergyLossCausePlayer; // last player that caused an energy loss to this Clonk (used to trace kills when player tumbles off a cliff, etc.)
111  int32_t Category;
112  int32_t old_x, old_y; C4LArea Area; // position as currently seen by Game.Objecets.Sectors. UpdatePos to sync.
113  int32_t Mass, OwnMass;
114  int32_t Damage;
115  int32_t Energy;
116  int32_t Breath;
117  int32_t InMat; // SyncClearance-NoSave //
118  uint32_t Color;
119  int32_t Audible, AudiblePan, AudiblePlayer; // NoSave //
120  int32_t lightRange;
122  uint32_t lightColor;
123  C4Real fix_x,fix_y,fix_r; // SyncClearance-Fix //
125  int32_t iLastAttachMovementFrame; // last frame in which Attach-movement by a SolidMask was done
126  bool Mobile;
127  bool Unsorted; // NoSave //
128  bool Initializing; // NoSave //
129  bool InLiquid;
131  uint32_t t_contact; // SyncClearance-NoSave //
132  uint32_t OCF;
133  uint32_t Marker; // state var used by Objects::CrossCheck and C4FindObject - NoSave
135  C4DrawTransform *pDrawTransform; // assigned drawing transformation
136 
137  // Menu
138  class C4ObjectMenu *Menu; // SyncClearance-NoSave //
139 
140  C4Facet TopFace; // NoSave //
144 
147  bool fOwnVertices; // if set, vertices aren't restored from def but from end of own vtx list
152  C4MaterialList *MaterialContents; // SyncClearance-NoSave //
153  C4DefGraphics *pGraphics; // currently set object graphics
154  StdMeshInstance* pMeshInstance; // Instance for mesh-type objects
155  C4Effect *pEffects; // linked list of effects
156  // particle lists that are bound to this object (either in front of behind it)
158  void ClearParticleLists();
159 
160  uint32_t ColorMod; // color by which the object-drawing is modulated
161  uint32_t BlitMode; // extra blitting flags (like additive, ClrMod2, etc.)
162  bool CrewDisabled; // CrewMember-functionality currently disabled
163 
164  // Commands
166 
168 
169  class C4GraphicsOverlay *pGfxOverlay; // singly linked list of overlay graphics
170 protected:
171  bool OnFire;
172  int32_t Con;
173  int32_t Plane;
174  bool Alive;
176 public:
177  void Resort();
178  void SetPlane(int32_t z) { if (z) Plane = z; Resort(); }
179  int32_t GetPlane() const { return Plane; }
180  int32_t GetSolidMaskPlane() const;
181  void SetCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, C4Object *pTarget2=nullptr, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=nullptr);
182  void SetCommand(int32_t iCommand, C4Object *pTarget=nullptr, int32_t iTx=0, int32_t iTy=0, C4Object *pTarget2=nullptr, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=nullptr)
183  { SetCommand(iCommand, pTarget, C4VInt(iTx), iTy, pTarget2, fControl, iData, iRetries, szText); }
184  bool AddCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0);
185  bool AddCommand(int32_t iCommand, C4Object *pTarget=nullptr, int32_t iTx=0, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0)
186  { return AddCommand(iCommand, pTarget, C4VInt(iTx), iTy, iUpdateInterval, pTarget2, fInitEvaluation, iData, fAppend, iRetries, szText, iBaseMode); }
187  C4Command *FindCommand(int32_t iCommandType) const; // find a command of the given type
188  void ClearCommand(C4Command *pUntil);
189  void ClearCommands();
190  void DrawSelectMark(C4TargetFacet &cgo) const;
191  void UpdateActionFace();
192  void SyncClearance();
193  void SetSolidMask(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iTX, int32_t iTY);
194  void SetHalfVehicleSolidMask(bool set);
195  bool CheckSolidMaskRect(); // clip bounds of SolidMask in graphics - return whether the solidmask still exists
196  bool MenuCommand(const char *szCommand);
197 
198  void Clear();
199  void ClearInfo(C4ObjectInfo *pInfo);
200  bool AssignInfo();
201  bool ValidateOwner();
202  bool AssignLightRange();
203  void DrawPicture(C4Facet &cgo, bool fSelected=false, C4DrawTransform* transform=nullptr);
204  void Picture2Facet(C4FacetSurface &cgo); // set picture to facet, or create facet in current size and draw if specific states are being needed
205  void Default();
206  bool Init(C4PropList *ndef, C4Object *pCreator,
207  int32_t owner, C4ObjectInfo *info,
208  int32_t nx, int32_t ny, int32_t nr,
209  C4Real nxdir, C4Real nydir, C4Real nrdir, int32_t iController);
210  void CompileFunc(StdCompiler *pComp, C4ValueNumbers *);
211  void Denumerate(C4ValueNumbers *) override;
212  void DrawLine(C4TargetFacet &cgo, int32_t at_player);
213  bool SetPhase(int32_t iPhase);
214  void AssignRemoval(bool exit_contents = false);
216  void Draw(C4TargetFacet &cgo, int32_t iByPlayer = -1, DrawMode eDrawMode=ODM_Normal, float offX=0, float offY=0);
217  void DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer = -1, DrawMode eDrawMode=ODM_Normal, float offX=0, float offY=0);
218  void DrawActionFace(C4TargetFacet &cgo, float offX, float offY) const;
219  void DrawFace(C4TargetFacet &cgo, float offX, float offY, int32_t iPhaseX=0, int32_t iPhaseY=0) const;
220  void DrawFaceImpl(C4TargetFacet &cgo, bool action, float fx, float fy, float fwdt, float fhgt, float tx, float ty, float twdt, float thgt, C4DrawTransform* transform) const;
221  void Execute();
222  void ClearPointers(C4Object *ptr);
223  bool ExecMovement();
224  void ExecAction();
225  bool ExecLife();
226  bool ExecuteCommand();
227  void AssignDeath(bool fForced); // assigns death - if forced, it's killed even if an effect stopped this
228  void ContactAction();
229  void NoAttachAction();
230  void DoMovement();
231  void Stabilize();
232  void SetOCF();
233  void UpdateOCF(); // Update fluctuant OCF
234  void UpdateShape(bool bUpdateVertices=true);
235  void UpdatePos(); // pos/shape changed
236  void UpdateSolidMask(bool fRestoreAttachedObjects);
237  void UpdateMass();
238  bool ChangeDef(C4ID idNew);
239  void UpdateFace(bool bUpdateShape, bool fTemp=false);
240  void UpdateGraphics(bool fGraphicsChanged, bool fTemp=false); // recreates solidmasks (if fGraphicsChanged), validates Color
241  void UpdateFlipDir(); // applies new flipdir to draw transform matrix; creates/deletes it if necessary
242  bool At(int32_t ctx, int32_t cty) const;
243  bool At(int32_t ctx, int32_t cty, DWORD &ocf) const;
244  void GetOCFForPos(int32_t ctx, int32_t cty, DWORD &ocf) const;
245  bool CloseMenu(bool fForce);
246  bool ActivateMenu(int32_t iMenu, int32_t iMenuSelect=0, int32_t iMenuData=0, int32_t iMenuPosition=0, C4Object *pTarget=nullptr);
247  int32_t ContactCheck(int32_t at_x, int32_t at_y, uint32_t *border_hack_contacts = nullptr, bool collide_halfvehic = false);
248  bool Contact(int32_t cnat);
249  void StopAndContact(C4Real & ctco, C4Real limit, C4Real & speed, int32_t cnat);
250  enum { SAC_StartCall = 1, SAC_EndCall = 2, SAC_AbortCall = 4 };
251  C4PropList* GetAction() const;
252  bool SetAction(C4PropList * Act, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
253  bool SetActionByName(C4String * ActName, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
254  bool SetActionByName(const char * szActName, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
255  void SetDir(int32_t tdir);
256  void SetCategory(int32_t Category) { this->Category = Category; Resort(); SetOCF(); }
257  int32_t GetProcedure() const;
258  bool Enter(C4Object *pTarget, bool fCalls=true, bool fCopyMotion=true, bool *pfRejectCollect=nullptr);
259  bool Exit(int32_t iX=0, int32_t iY=0, int32_t iR=0, C4Real iXDir=Fix0, C4Real iYDir=Fix0, C4Real iRDir=Fix0, bool fCalls=true);
260  void CopyMotion(C4Object *from);
261  void ForcePosition(C4Real target_x, C4Real target_y);
262  void MovePosition(int32_t dx, int32_t dy);
263  void MovePosition(C4Real dx, C4Real dy);
264  void DoMotion(int32_t mx, int32_t my);
265  bool ActivateEntrance(int32_t by_plr, C4Object *by_obj);
266  void DoDamage(int32_t iLevel, int32_t iCausedByPlr, int32_t iCause);
267  void DoEnergy(int32_t iChange, bool fExact, int32_t iCause, int32_t iCausedByPlr);
268  void UpdatLastEnergyLossCause(int32_t iNewCausePlr);
269  void DoBreath(int32_t iChange);
270  void DoCon(int32_t iChange, bool grow_from_center);
271  int32_t GetCon() const { return Con; }
272  void DoExperience(int32_t change);
273  bool Promote(int32_t torank, bool exception, bool fForceRankName);
274  bool Push(C4Real txdir, C4Real dforce, bool fStraighten);
275  bool Lift(C4Real tydir, C4Real dforce);
276  void Fling(C4Real txdir, C4Real tydir, bool fAddSpeed); // set/add given speed to current, setting jump/tumble-actions
278  bool CreateContentsByList(C4IDList &idlist);
279  BYTE GetArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt) const;
280  inline int32_t addtop() const { return std::max<int32_t>(18-Shape.Hgt,0); } // Minimum top action size for build check
281  inline int32_t Left() const { return GetX()+Shape.x; } // left border of shape
282  inline int32_t Top() const { return GetY()+Shape.y-addtop(); } // top border of shape (+build-top)
283  inline int32_t Width() const { return Shape.Wdt; } // width of shape
284  inline int32_t Height() const { return Shape.Hgt+addtop(); } // height of shape (+build-top)
285  inline int32_t GetX() const { return fixtoi(fix_x); }
286  inline int32_t GetY() const { return fixtoi(fix_y); }
287  inline int32_t GetR() const { return fixtoi(fix_r); }
288  inline C4Real GetFixedX() const { return fix_x; }
289  inline C4Real GetFixedY() const { return fix_y; }
290  inline C4Real GetFixedR() const { return fix_r; }
291  BYTE GetEntranceArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt) const;
292  BYTE GetMomentum(C4Real &rxdir, C4Real &rydir) const;
293  C4Real GetSpeed() const;
295  void SetName (const char *NewName = nullptr) override;
296  int32_t GetValue(C4Object *pInBase, int32_t iForPlayer);
297  bool SetOwner(int32_t iOwner);
298  bool SetLightRange(int32_t iToRange, int32_t iToFadeoutRange);
299  uint32_t GetLightColor() const { return lightColor; }
300  bool SetLightColor(uint32_t iValue);
301  void SetOnFire(bool OnFire) override { this->OnFire = OnFire; SetOCF(); }
302  bool GetOnFire() const { return OnFire; }
303  void SetAlive(bool Alive) { this->Alive = Alive; SetOCF(); }
304  bool GetAlive() const { return Alive; }
305  void UpdateLight();
306  void SetAudibilityAt(C4TargetFacet &cgo, int32_t iX, int32_t iY, int32_t player);
307  bool IsVisible(int32_t iForPlr, bool fAsOverlay) const; // return whether an object is visible for the given player
308  void SetRotation(int32_t nr);
309  void PrepareDrawing() const; // set blit modulation and/or additive blitting
310  void FinishedDrawing() const; // reset any modulation
311  void DrawSolidMask(C4TargetFacet &cgo) const; // draw topface image only
312  bool Collect(C4Object *pObj); // add object to contents if it can be carried - no OCF and range checks are done!
313  bool GrabInfo(C4Object *pFrom); // grab info object from other object
314  bool ShiftContents(bool fShiftBack, bool fDoCalls); // rotate through contents
315  void DirectComContents(C4Object *pTarget, bool fDoCalls); // direct com: scroll contents to given ID
316  void GetParallaxity(int32_t *parX, int32_t *parY) const;
317  bool GetDrawPosition(const C4TargetFacet & cgo, float & resultx, float & resulty, float & resultzoom) const; // converts the object's position into screen coordinates
318  bool GetDrawPosition(const C4TargetFacet & cgo, float x, float y, float zoom, float & resultx, float & resulty, float & resultzoom) const; // converts object coordinates into screen coordinates
319  bool IsInLiquidCheck() const; // returns whether the Clonk is within liquid material
320  void UpdateInLiquid(); // makes splash when a liquid is entered
321  void GrabContents(C4Object *pFrom); // grab all contents that don't reject it
322  bool GetDragImage(C4Object **drag_object, C4Def **drag_id) const; // return true if object is draggable; assign drag_object/drag_id to gfx to be used for dragging
323  int32_t AddObjectAndContentsToArray(C4ValueArray *target_array, int32_t index=0); // add self, contents and child contents count recursively to value array. Return index after last added item.
324 
325 protected:
326  void SideBounds(C4Real &target_x); // apply bounds at side; regarding bourder bound and pLayer
327  void VerticalBounds(C4Real &target_y); // apply bounds at top and bottom; regarding border bound and pLayer
328 
329 public:
330  void BoundsCheck(C4Real &target_x, C4Real &target_y) // do bound checks, correcting target positions as necessary and doing contact-calls
331  { SideBounds(target_x); VerticalBounds(target_y); }
332 
333  bool DoSelect(); // cursor callback if not disabled
334  void UnSelect(); // unselect callback
335  void GetViewPos(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport) const;
336  void GetViewPosPar(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport) const; // get position this object is seen at, calculating parallaxity
337  bool PutAwayUnusedObject(C4Object *pToMakeRoomForObject); // either directly put the least-needed object away, or add a command to do it - return whether successful
338 
339  C4DefGraphics *GetGraphics() const { return pGraphics; } // return current object graphics
340  bool SetGraphics(const char *szGraphicsName=nullptr, C4Def *pSourceDef=nullptr); // set used graphics for object; if szGraphicsName or *szGraphicsName are nullptr, the default graphics of the given def are used; pSourceDef defaults to own def
341  bool SetGraphics(C4DefGraphics *pNewGfx, bool fUpdateData); // set used graphics for object
342 
343  class C4GraphicsOverlay *GetGraphicsOverlay(int32_t iForID) const; // get specified gfx overlay
344  class C4GraphicsOverlay *GetGraphicsOverlay(int32_t iForID, bool fCreate); // get specified gfx overlay; create if not existant and specified
345  bool RemoveGraphicsOverlay(int32_t iOverlayID); // remove specified overlay from the overlay list; return if found
346  bool HasGraphicsOverlayRecursion(const C4Object *pCheckObj) const; // returns whether, at any overlay recursion depth, the given object appears as an MODE_Object-overlay
347  void UpdateScriptPointers(); // update ptrs to C4AulScript *
348 
349  bool StatusActivate(); // put into active list
350  bool StatusDeactivate(bool fClearPointers); // put into inactive list
351 
352  void ClearContentsAndContained(bool fDoCalls=true); // exit from container and eject contents (doing calbacks)
353 
354  bool AdjustWalkRotation(int32_t iRangeX, int32_t iRangeY, int32_t iSpeed);
355 
356  StdStrBuf GetInfoString(); // return def desc plus effects
357 
358  bool CanConcatPictureWith(C4Object *pOtherObject) const; // return whether this object should be grouped with the other in activation lists, contents list, etc.
359 
360  bool IsMoveableBySolidMask(int ComparisonPlane) const;
361 
362  // This function is used for:
363  // -Objects to be removed when a player is removed
364  // -Objects that are not to be saved in "SaveScenario"-mode
365  bool IsPlayerObject(int32_t iPlayerNumber=NO_OWNER) const;// true for any object that belongs to any player (NO_OWNER) or a specified player
366 
367  // This function is used for:
368  // -Objects that are not to be saved in "SaveScenario"-mode
369  bool IsUserPlayerObject();// true for any object that belongs to any player (NO_OWNER) or a specified player
370 
371  // overloaded from C4PropList
372  C4Object * GetObject() override { return this; }
373  C4Object const * GetObject() const override { return this; }
374  void SetPropertyByS(C4String * k, const C4Value & to) override;
375  void ResetProperty(C4String * k) override;
376  bool GetPropertyByS(const C4String *k, C4Value *pResult) const override;
377  C4ValueArray * GetProperties() const override;
378 };
379 
380 #endif
const int NO_OWNER
Definition: C4Constants.h:137
#define z
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
const C4Real Fix0
Definition: C4Real.h:312
const C4Value C4VNull
Definition: C4Value.cpp:30
C4Value C4VInt(int32_t i)
Definition: C4Value.h:239
uint8_t BYTE
uint32_t DWORD
C4Action()
Definition: C4Action.cpp:23
C4Facet Facet
Definition: C4Object.h:88
int32_t Data
Definition: C4Object.h:84
int32_t t_attach
Definition: C4Object.h:86
void CompileFunc(StdCompiler *pComp)
Definition: C4Action.cpp:48
int32_t Time
Definition: C4Object.h:83
int32_t PhaseDelay
Definition: C4Object.h:85
int32_t Phase
Definition: C4Object.h:85
void Default()
Definition: C4Action.cpp:30
C4ObjectPtr Target2
Definition: C4Object.h:87
int32_t ComDir
Definition: C4Object.h:82
int32_t Dir
Definition: C4Object.h:80
int32_t FacetY
Definition: C4Object.h:89
int32_t DrawDir
Definition: C4Object.h:81
int32_t FacetX
Definition: C4Object.h:89
StdMeshInstanceAnimationNode * Animation
Definition: C4Object.h:90
C4ObjectPtr Target
Definition: C4Object.h:87
Definition: C4Def.h:99
Definition: C4Real.h:59
Definition: C4Id.h:26
void UpdateSolidMask(bool fRestoreAttachedObjects)
int32_t OwnMass
Definition: C4Object.h:113
int32_t Left() const
Definition: C4Object.h:281
bool Enter(C4Object *pTarget, bool fCalls=true, bool fCopyMotion=true, bool *pfRejectCollect=nullptr)
C4Real GetFixedX() const
Definition: C4Object.h:288
bool OnFire
Definition: C4Object.h:171
bool EntranceStatus
Definition: C4Object.h:130
C4ValueArray * GetProperties() const override
Definition: C4Object.cpp:1354
void ClearCommand(C4Command *pUntil)
C4ObjectInfo * Info
Definition: C4Object.h:143
BYTE GetArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt) const
Definition: C4Object.cpp:700
bool GetDrawPosition(const C4TargetFacet &cgo, float &resultx, float &resulty, float &resultzoom) const
bool At(int32_t ctx, int32_t cty) const
void GetOCFForPos(int32_t ctx, int32_t cty, DWORD &ocf) const
void Resort()
Definition: C4Object.cpp:1121
bool SetGraphics(const char *szGraphicsName=nullptr, C4Def *pSourceDef=nullptr)
C4Real ydir
Definition: C4Object.h:124
bool PutAwayUnusedObject(C4Object *pToMakeRoomForObject)
int32_t lightRange
Definition: C4Object.h:120
int32_t ContactCheck(int32_t at_x, int32_t at_y, uint32_t *border_hack_contacts=nullptr, bool collide_halfvehic=false)
Definition: C4Movement.cpp:158
C4Real fix_y
Definition: C4Object.h:123
void ContactAction()
bool ShiftContents(bool fShiftBack, bool fDoCalls)
void GetViewPos(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport) const
void SetHalfVehicleSolidMask(bool set)
uint32_t Marker
Definition: C4Object.h:133
C4PropList * GetAction() const
void UpdatLastEnergyLossCause(int32_t iNewCausePlr)
Definition: C4Object.cpp:611
bool AddCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0)
bool HalfVehicleSolidMask
Definition: C4Object.h:149
bool AssignLightRange()
void UpdateMass()
C4Real xdir
Definition: C4Object.h:124
void CopyMotion(C4Object *from)
Definition: C4Movement.cpp:653
void DoExperience(int32_t change)
void UpdateScriptPointers()
Definition: C4Object.cpp:1272
void NoAttachAction()
bool CreateContentsByList(C4IDList &idlist)
void UpdateFace(bool bUpdateShape, bool fTemp=false)
int32_t Height() const
Definition: C4Object.h:284
class C4GraphicsOverlay * pGfxOverlay
Definition: C4Object.h:169
void DrawLine(C4TargetFacet &cgo, int32_t at_player)
C4Rect PictureRect
Definition: C4Object.h:150
bool GrabInfo(C4Object *pFrom)
Definition: C4Object.cpp:1153
bool ActivateEntrance(int32_t by_plr, C4Object *by_obj)
Definition: C4Object.cpp:689
int32_t GetValue(C4Object *pInBase, int32_t iForPlayer)
Definition: C4Object.cpp:791
void SetCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, C4Object *pTarget2=nullptr, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=nullptr)
bool ExecLife()
Definition: C4Object.cpp:354
void ClearCommands()
bool AdjustWalkRotation(int32_t iRangeX, int32_t iRangeY, int32_t iSpeed)
C4TargetRect SolidMask
Definition: C4Object.h:148
bool ExecMovement()
Definition: C4Movement.cpp:691
C4Real GetSpeed() const
C4Real fix_x
Definition: C4Object.h:123
uint32_t t_contact
Definition: C4Object.h:131
bool GetPropertyByS(const C4String *k, C4Value *pResult) const override
Definition: C4Object.cpp:1342
bool DoSelect()
Definition: C4Object.cpp:1186
bool SetActionByName(C4String *ActName, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls=SAC_StartCall|SAC_AbortCall, bool fForce=false)
void DrawPicture(C4Facet &cgo, bool fSelected=false, C4DrawTransform *transform=nullptr)
int32_t Audible
Definition: C4Object.h:119
bool AddCommand(int32_t iCommand, C4Object *pTarget=nullptr, int32_t iTx=0, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0)
Definition: C4Object.h:185
C4Effect * pEffects
Definition: C4Object.h:155
int32_t GetProcedure() const
int32_t lightFadeoutRange
Definition: C4Object.h:121
void SetPlane(int32_t z)
Definition: C4Object.h:178
C4Object * CreateContents(C4PropList *)
void SetAudibilityAt(C4TargetFacet &cgo, int32_t iX, int32_t iY, int32_t player)
C4DrawTransform * pDrawTransform
Definition: C4Object.h:135
bool Initializing
Definition: C4Object.h:128
void DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer=-1, DrawMode eDrawMode=ODM_Normal, float offX=0, float offY=0)
C4Command * Command
Definition: C4Object.h:165
bool StatusActivate()
Definition: C4Object.cpp:1202
bool Init(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t nx, int32_t ny, int32_t nr, C4Real nxdir, C4Real nydir, C4Real nrdir, int32_t iController)
Definition: C4Object.cpp:112
int32_t Owner
Definition: C4Object.h:108
int32_t AddObjectAndContentsToArray(C4ValueArray *target_array, int32_t index=0)
bool CrewDisabled
Definition: C4Object.h:162
void SetName(const char *NewName=nullptr) override
Definition: C4Object.cpp:783
int32_t Top() const
Definition: C4Object.h:282
bool IsPlayerObject(int32_t iPlayerNumber=NO_OWNER) const
Definition: C4Object.cpp:1278
void PrepareDrawing() const
StdStrBuf GetDataString()
Definition: C4Object.cpp:729
bool IsMoveableBySolidMask(int ComparisonPlane) const
int32_t GetX() const
Definition: C4Object.h:285
void Picture2Facet(C4FacetSurface &cgo)
int32_t Category
Definition: C4Object.h:111
void GetParallaxity(int32_t *parX, int32_t *parY) const
bool ActivateMenu(int32_t iMenu, int32_t iMenuSelect=0, int32_t iMenuData=0, int32_t iMenuPosition=0, C4Object *pTarget=nullptr)
void SetAlive(bool Alive)
Definition: C4Object.h:303
bool GetDragImage(C4Object **drag_object, C4Def **drag_id) const
bool MenuCommand(const char *szCommand)
void ClearPointers(C4Object *ptr)
Definition: C4Object.cpp:816
bool Contact(int32_t cnat)
Definition: C4Movement.cpp:135
bool IsVisible(int32_t iForPlr, bool fAsOverlay) const
class C4ObjectMenu * Menu
Definition: C4Object.h:138
C4Object * GetObject() override
Definition: C4Object.h:372
void SetCategory(int32_t Category)
Definition: C4Object.h:256
int32_t GetSolidMaskPlane() const
int32_t Controller
Definition: C4Object.h:109
bool IsInLiquidCheck() const
void UpdateInLiquid()
void SetDir(int32_t tdir)
int32_t AudiblePan
Definition: C4Object.h:119
uint32_t OCF
Definition: C4Object.h:132
uint32_t lightColor
Definition: C4Object.h:122
bool HasGraphicsOverlayRecursion(const C4Object *pCheckObj) const
bool ValidateOwner()
Definition: C4Object.cpp:1035
bool GetAlive() const
Definition: C4Object.h:304
void Fling(C4Real txdir, C4Real tydir, bool fAddSpeed)
void StopAndContact(C4Real &ctco, C4Real limit, C4Real &speed, int32_t cnat)
Definition: C4Movement.cpp:151
bool Push(C4Real txdir, C4Real dforce, bool fStraighten)
C4Real fix_r
Definition: C4Object.h:123
void ForcePosition(C4Real target_x, C4Real target_y)
Definition: C4Movement.cpp:667
bool GetOnFire() const
Definition: C4Object.h:302
void SyncClearance()
Definition: C4Object.cpp:1102
bool Mobile
Definition: C4Object.h:126
int32_t Con
Definition: C4Object.h:172
bool SetLightRange(int32_t iToRange, int32_t iToFadeoutRange)
bool ExecuteCommand()
C4ID id
Definition: C4Object.h:106
void DirectComContents(C4Object *pTarget, bool fDoCalls)
int32_t Damage
Definition: C4Object.h:114
void UpdateOCF()
bool SetLightColor(uint32_t iValue)
C4MaterialList * MaterialContents
Definition: C4Object.h:152
void Clear()
Definition: C4Object.cpp:1083
bool CloseMenu(bool fForce)
int32_t InMat
Definition: C4Object.h:117
void DrawActionFace(C4TargetFacet &cgo, float offX, float offY) const
void ClearParticleLists()
Definition: C4Object.cpp:205
int32_t Breath
Definition: C4Object.h:116
void DoMovement()
Definition: C4Movement.cpp:250
bool RemoveGraphicsOverlay(int32_t iOverlayID)
C4SolidMask * pSolidMaskData
Definition: C4Object.h:175
C4ObjectPtr Layer
Definition: C4Object.h:134
void ExecAction()
bool fOwnVertices
Definition: C4Object.h:147
void Execute()
Definition: C4Object.cpp:427
int32_t GetY() const
Definition: C4Object.h:286
int32_t iLastAttachMovementFrame
Definition: C4Object.h:125
C4Object const * GetObject() const override
Definition: C4Object.h:373
StdMeshInstance * pMeshInstance
Definition: C4Object.h:154
void AssignDeath(bool fForced)
Definition: C4Object.cpp:467
void UpdateFlipDir()
bool Lift(C4Real tydir, C4Real dforce)
void DoCon(int32_t iChange, bool grow_from_center)
Definition: C4Object.cpp:631
void BoundsCheck(C4Real &target_x, C4Real &target_y)
Definition: C4Object.h:330
bool Alive
Definition: C4Object.h:174
int32_t LastEnergyLossCausePlayer
Definition: C4Object.h:110
int32_t old_y
Definition: C4Object.h:112
bool Unsorted
Definition: C4Object.h:127
void AssignRemoval(bool exit_contents=false)
Definition: C4Object.cpp:215
C4Command * FindCommand(int32_t iCommandType) const
C4Object()
Definition: C4Object.cpp:44
void ClearInfo(C4ObjectInfo *pInfo)
Definition: C4Object.cpp:1075
void DrawSolidMask(C4TargetFacet &cgo) const
void ClearContentsAndContained(bool fDoCalls=true)
bool Collect(C4Object *pObj)
void MovePosition(int32_t dx, int32_t dy)
Definition: C4Movement.cpp:675
C4NotifyingObjectList Contents
Definition: C4Object.h:151
void Stabilize()
Definition: C4Movement.cpp:616
int32_t GetR() const
Definition: C4Object.h:287
class C4ParticleList * BackParticles
Definition: C4Object.h:157
int32_t AudiblePlayer
Definition: C4Object.h:119
int32_t GetCon() const
Definition: C4Object.h:271
void Draw(C4TargetFacet &cgo, int32_t iByPlayer=-1, DrawMode eDrawMode=ODM_Normal, float offX=0, float offY=0)
void DrawSelectMark(C4TargetFacet &cgo) const
void Denumerate(C4ValueNumbers *) override
Definition: C4Object.cpp:1007
int32_t GetPlane() const
Definition: C4Object.h:179
C4ObjectPtr Contained
Definition: C4Object.h:142
void UpdateActionFace()
StdCopyStrBuf nInfo
Definition: C4Object.h:167
~C4Object() override
Definition: C4Object.cpp:195
bool CheckSolidMaskRect()
C4Real rdir
Definition: C4Object.h:124
bool Exit(int32_t iX=0, int32_t iY=0, int32_t iR=0, C4Real iXDir=Fix0, C4Real iYDir=Fix0, C4Real iRDir=Fix0, bool fCalls=true)
bool StatusDeactivate(bool fClearPointers)
Definition: C4Object.cpp:1218
C4Action Action
Definition: C4Object.h:145
int32_t Energy
Definition: C4Object.h:115
void SetOCF()
Definition: C4ObjectOCF.cpp:30
int32_t Mass
Definition: C4Object.h:113
@ ODM_Overlay
Definition: C4Object.h:215
@ ODM_Normal
Definition: C4Object.h:215
@ ODM_BaseOnly
Definition: C4Object.h:215
int32_t Plane
Definition: C4Object.h:173
void GetViewPosPar(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport) const
void SetOnFire(bool OnFire) override
Definition: C4Object.h:301
bool IsUserPlayerObject()
Definition: C4Object.cpp:1302
int32_t old_x
Definition: C4Object.h:112
BYTE GetEntranceArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt) const
Definition: C4Object.cpp:708
bool InLiquid
Definition: C4Object.h:129
void GrabContents(C4Object *pFrom)
void CompileFunc(StdCompiler *pComp, C4ValueNumbers *)
Definition: C4Object.cpp:856
int32_t Width() const
Definition: C4Object.h:283
bool ChangeDef(C4ID idNew)
Definition: C4Object.cpp:518
bool Promote(int32_t torank, bool exception, bool fForceRankName)
void VerticalBounds(C4Real &target_y)
Definition: C4Movement.cpp:217
uint32_t BlitMode
Definition: C4Object.h:161
void Default()
Definition: C4Object.cpp:50
void FinishedDrawing() const
void UnSelect()
Definition: C4Object.cpp:1196
uint32_t GetLightColor() const
Definition: C4Object.h:299
uint32_t ColorMod
Definition: C4Object.h:160
int32_t RemovalDelay
Definition: C4Object.h:107
void DoDamage(int32_t iLevel, int32_t iCausedByPlr, int32_t iCause)
Definition: C4Object.cpp:571
@ SAC_StartCall
Definition: C4Object.h:250
@ SAC_EndCall
Definition: C4Object.h:250
@ SAC_AbortCall
Definition: C4Object.h:250
bool CanConcatPictureWith(C4Object *pOtherObject) const
C4Def * Def
Definition: C4Object.h:141
void UpdatePos()
uint32_t Color
Definition: C4Object.h:118
StdStrBuf GetInfoString()
Definition: C4Object.cpp:1244
void SetSolidMask(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iTX, int32_t iTY)
C4Real GetFixedY() const
Definition: C4Object.h:289
void UpdateShape(bool bUpdateVertices=true)
Definition: C4Object.cpp:327
int32_t addtop() const
Definition: C4Object.h:280
bool SetPhase(int32_t iPhase)
void DrawFaceImpl(C4TargetFacet &cgo, bool action, float fx, float fy, float fwdt, float fhgt, float tx, float ty, float twdt, float thgt, C4DrawTransform *transform) const
C4Facet TopFace
Definition: C4Object.h:140
bool SetAction(C4PropList *Act, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls=SAC_StartCall|SAC_AbortCall, bool fForce=false)
void SideBounds(C4Real &target_x)
Definition: C4Movement.cpp:184
void SetPropertyByS(C4String *k, const C4Value &to) override
Definition: C4Object.cpp:1313
void SetRotation(int32_t nr)
bool SetOwner(int32_t iOwner)
Definition: C4Object.cpp:1129
C4LArea Area
Definition: C4Object.h:112
void DoMotion(int32_t mx, int32_t my)
Definition: C4Movement.cpp:144
C4Shape Shape
Definition: C4Object.h:146
void DrawFace(C4TargetFacet &cgo, float offX, float offY, int32_t iPhaseX=0, int32_t iPhaseY=0) const
class C4GraphicsOverlay * GetGraphicsOverlay(int32_t iForID) const
C4DefGraphics * pGraphics
Definition: C4Object.h:153
C4Real GetFixedR() const
Definition: C4Object.h:290
C4DefGraphics * GetGraphics() const
Definition: C4Object.h:339
void SetCommand(int32_t iCommand, C4Object *pTarget=nullptr, int32_t iTx=0, int32_t iTy=0, C4Object *pTarget2=nullptr, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=nullptr)
Definition: C4Object.h:182
bool AssignInfo()
Definition: C4Object.cpp:1045
void UpdateGraphics(bool fGraphicsChanged, bool fTemp=false)
void ResetProperty(C4String *k) override
Definition: C4Object.cpp:1328
BYTE GetMomentum(C4Real &rxdir, C4Real &rydir) const
void DoBreath(int32_t iChange)
Definition: C4Object.cpp:622
class C4ParticleList * FrontParticles
Definition: C4Object.h:157
void DoEnergy(int32_t iChange, bool fExact, int32_t iCause, int32_t iCausedByPlr)
Definition: C4Object.cpp:585
Definition: C4Rect.h:28
int32_t y
Definition: C4Rect.h:30
int32_t Hgt
Definition: C4Rect.h:30
int32_t Wdt
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30