OpenClonk
C4Action Class Reference

#include <C4Object.h>

Collaboration diagram for C4Action:
[legend]

Public Member Functions

 C4Action ()
 
 ~C4Action ()
 
void Default ()
 
void CompileFunc (StdCompiler *pComp)
 
void SetBridgeData (int32_t iBridgeTime, bool fMoveClonk, bool fWall, int32_t iBridgeMaterial)
 
void GetBridgeData (int32_t &riBridgeTime, bool &rfMoveClonk, bool &rfWall, int32_t &riBridgeMaterial)
 

Public Attributes

int32_t Dir
 
int32_t DrawDir
 
int32_t ComDir
 
int32_t Time
 
int32_t Data
 
int32_t Phase
 
int32_t PhaseDelay
 
int32_t t_attach
 
C4ObjectPtr Target
 
C4ObjectPtr Target2
 
C4Facet Facet
 
int32_t FacetX
 
int32_t FacetY
 
StdMeshInstanceAnimationNodeAnimation
 

Detailed Description

Definition at line 74 of file C4Object.h.

Constructor & Destructor Documentation

◆ C4Action()

C4Action::C4Action ( )

Definition at line 23 of file C4Action.cpp.

References Default(), and ~C4Action().

24 {
25  Default();
26 }
void Default()
Definition: C4Action.cpp:30
Here is the call graph for this function:

◆ ~C4Action()

C4Action::~C4Action ( )
default

Referenced by C4Action().

Here is the caller graph for this function:

Member Function Documentation

◆ CompileFunc()

void C4Action::CompileFunc ( StdCompiler pComp)

Definition at line 45 of file C4Action.cpp.

References COMD_Stop, ComDir, Data, Dir, DIR_None, mkNamingAdapt(), Phase, PhaseDelay, Time, and StdCompiler::Value().

Referenced by C4Object::AddCommand().

46 {
47  // Note: Compiled directly into "Object"-categories, so beware of name clashes (see C4Object::CompileFunc)
48  pComp->Value(mkNamingAdapt( Dir, "Dir", DIR_None ));
49  pComp->Value(mkNamingAdapt( ComDir, "ComDir", COMD_Stop ));
50  pComp->Value(mkNamingAdapt( Time, "ActionTime", 0 ));
51  pComp->Value(mkNamingAdapt( Data, "ActionData", 0 ));
52  pComp->Value(mkNamingAdapt( Phase, "Phase", 0 ));
53  pComp->Value(mkNamingAdapt( PhaseDelay, "PhaseDelay", 0 ));
54 }
int32_t Time
Definition: C4Object.h:83
#define DIR_None
Definition: C4Object.h:40
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
int32_t PhaseDelay
Definition: C4Object.h:85
void Value(const T &rStruct)
Definition: StdCompiler.h:161
#define COMD_Stop
Definition: C4Object.h:50
int32_t Data
Definition: C4Object.h:84
int32_t Phase
Definition: C4Object.h:85
int32_t Dir
Definition: C4Object.h:80
int32_t ComDir
Definition: C4Object.h:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Default()

void C4Action::Default ( )

Definition at line 30 of file C4Action.cpp.

References Animation, CNAT_None, COMD_Stop, ComDir, Data, C4Facet::Default(), Dir, DIR_None, DrawDir, Facet, FacetX, FacetY, Phase, PhaseDelay, t_attach, Target, Target2, and Time.

Referenced by C4Object::AddCommand(), C4Action(), and C4Object::C4Object().

31 {
32  Dir=DIR_None;
33  DrawDir=Dir;
35  Time=0;
36  Data=0;
37  Target=Target2=nullptr;
38  Phase=PhaseDelay=0;
39  Facet.Default();
40  FacetX=FacetY=0;
42  Animation = nullptr;
43 }
int32_t Time
Definition: C4Object.h:83
#define DIR_None
Definition: C4Object.h:40
C4ObjectPtr Target2
Definition: C4Object.h:87
StdMeshInstanceAnimationNode * Animation
Definition: C4Object.h:90
int32_t t_attach
Definition: C4Object.h:86
void Default()
Definition: C4Facet.cpp:31
int32_t PhaseDelay
Definition: C4Object.h:85
#define COMD_Stop
Definition: C4Object.h:50
C4ObjectPtr Target
Definition: C4Object.h:87
const BYTE CNAT_None
Definition: C4Constants.h:108
int32_t Data
Definition: C4Object.h:84
int32_t Phase
Definition: C4Object.h:85
C4Facet Facet
Definition: C4Object.h:88
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
int32_t ComDir
Definition: C4Object.h:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBridgeData()

void C4Action::GetBridgeData ( int32_t &  riBridgeTime,
bool &  rfMoveClonk,
bool &  rfWall,
int32_t &  riBridgeMaterial 
)

Definition at line 74 of file C4Object.cpp.

References Data.

Referenced by DoBridge().

75 {
76  // mask from this->Data
77  uint32_t uiData = Data;
78  riBridgeTime = (uint32_t(uiData) >> 16);
79  rfMoveClonk = !!(uiData & 0x100);
80  rfWall = !!(uiData & 0x200);
81  riBridgeMaterial = (uiData & 0xff);
82  if (riBridgeMaterial == 0xff) riBridgeMaterial = -1;
83 }
int32_t Data
Definition: C4Object.h:84
Here is the caller graph for this function:

◆ SetBridgeData()

void C4Action::SetBridgeData ( int32_t  iBridgeTime,
bool  fMoveClonk,
bool  fWall,
int32_t  iBridgeMaterial 
)

Definition at line 64 of file C4Object.cpp.

References Data, MaterialMap, and C4MaterialMap::Num.

Referenced by DoBridge().

65 {
66  // validity
67  iBridgeMaterial = std::min(iBridgeMaterial, ::MaterialMap.Num-1);
68  if (iBridgeMaterial < 0) iBridgeMaterial = 0xff;
69  iBridgeTime = Clamp<int32_t>(iBridgeTime, 0, 0xffff);
70  // mask in this->Data
71  Data = (uint32_t(iBridgeTime) << 16) + (uint32_t(fMoveClonk) << 8) + (uint32_t(fWall) << 9) + iBridgeMaterial;
72 }
int32_t Num
Definition: C4Material.h:168
int32_t Data
Definition: C4Object.h:84
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
Here is the caller graph for this function:

Member Data Documentation

◆ Animation

StdMeshInstanceAnimationNode* C4Action::Animation

Definition at line 90 of file C4Object.h.

Referenced by Default(), C4ValueProviderAction::Execute(), and C4Object::SetAction().

◆ ComDir

◆ Data

int32_t C4Action::Data

◆ Dir

◆ DrawDir

int32_t C4Action::DrawDir

Definition at line 81 of file C4Object.h.

Referenced by Default().

◆ Facet

C4Facet C4Action::Facet

Definition at line 88 of file C4Object.h.

Referenced by Default().

◆ FacetX

int32_t C4Action::FacetX

Definition at line 89 of file C4Object.h.

Referenced by Default().

◆ FacetY

int32_t C4Action::FacetY

Definition at line 89 of file C4Object.h.

Referenced by Default().

◆ Phase

int32_t C4Action::Phase

Definition at line 85 of file C4Object.h.

Referenced by CompileFunc(), Default(), and C4ValueProviderAction::Execute().

◆ PhaseDelay

int32_t C4Action::PhaseDelay

Definition at line 85 of file C4Object.h.

Referenced by CompileFunc(), Default(), and C4ValueProviderAction::Execute().

◆ t_attach

int32_t C4Action::t_attach

Definition at line 86 of file C4Object.h.

Referenced by Default(), C4Object::DoMovement(), ObjectActionDive(), and ObjectActionJump().

◆ Target

◆ Target2

C4ObjectPtr C4Action::Target2

Definition at line 87 of file C4Object.h.

Referenced by C4FindObjectActionTarget::Check(), and Default().

◆ Time

int32_t C4Action::Time

Definition at line 83 of file C4Object.h.

Referenced by CompileFunc(), Default(), DoBridge(), and C4Command::MoveTo().


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