OpenClonk
C4ObjectScript.cpp File Reference
Include dependency graph for C4ObjectScript.cpp:

Go to the source code of this file.

Macros

#define _snprintf   snprintf
 
#define L2F(l)   ((float)l/1000)
 
#define F(f)   ::AddFunc(p, #f, Fn##f)
 

Enumerations

enum  VertexDataIndex { VTX_X , VTX_Y , VTX_CNAT , VTX_Friction }
 
enum  VertexUpdateMode { VTX_SetNonpermanent , VTX_SetPermanent , VTX_SetPermanentUpd }
 

Functions

bool C4ValueToMatrix (C4Value &value, StdMeshMatrix *matrix)
 
bool C4ValueToMatrix (const C4ValueArray &array, StdMeshMatrix *matrix)
 
void InitObjectFunctionMap (C4AulScriptEngine *pEngine)
 

Variables

const int C4MN_Add_ImgRank = 1
 
const int C4MN_Add_ImgIndexed = 2
 
const int C4MN_Add_ImgObjRank = 3
 
const int C4MN_Add_ImgObject = 4
 
const int C4MN_Add_ImgTextSpec = 5
 
const int C4MN_Add_ImgColor = 6
 
const int C4MN_Add_ImgPropListSpec = 7
 
const int C4MN_Add_MaxImage = 127
 
const int C4MN_Add_PassValue = 128
 
const int C4MN_Add_ForceCount = 256
 
const int C4MN_Add_ForceNoDesc = 512
 
C4ScriptConstDef C4ScriptObjectConstMap []
 

Macro Definition Documentation

◆ _snprintf

#define _snprintf   snprintf

Definition at line 1081 of file C4ObjectScript.cpp.

◆ F

#define F (   f)    ::AddFunc(p, #f, Fn##f)

◆ L2F

#define L2F (   l)    ((float)l/1000)

Enumeration Type Documentation

◆ VertexDataIndex

Enumerator
VTX_X 
VTX_Y 
VTX_CNAT 
VTX_Friction 

Definition at line 800 of file C4ObjectScript.cpp.

801 {
802  VTX_X,
803  VTX_Y,
804  VTX_CNAT,
806 };
@ VTX_X
@ VTX_CNAT
@ VTX_Friction
@ VTX_Y

◆ VertexUpdateMode

Enumerator
VTX_SetNonpermanent 
VTX_SetPermanent 
VTX_SetPermanentUpd 

Definition at line 807 of file C4ObjectScript.cpp.

808 {
812 };
@ VTX_SetNonpermanent
@ VTX_SetPermanent
@ VTX_SetPermanentUpd

Function Documentation

◆ C4ValueToMatrix() [1/2]

bool C4ValueToMatrix ( C4Value value,
StdMeshMatrix matrix 
)

Definition at line 42 of file C4ObjectScript.cpp.

43 {
44  const C4ValueArray* array = value.getArray();
45  if (!array)
46  {
47  return false;
48  }
49  return C4ValueToMatrix(*array, matrix);
50 }
bool C4ValueToMatrix(C4Value &value, StdMeshMatrix *matrix)
C4ValueArray * getArray() const
Definition: C4Value.h:118

References C4ValueToMatrix(), and C4Value::getArray().

Referenced by C4ValueToMatrix(), C4DefGraphics::Draw(), C4GraphicsOverlay::Draw(), and C4Object::DrawFaceImpl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ C4ValueToMatrix() [2/2]

bool C4ValueToMatrix ( const C4ValueArray array,
StdMeshMatrix matrix 
)

Definition at line 52 of file C4ObjectScript.cpp.

53 {
54  if (array.GetSize() != 12)
55  {
56  return false;
57  }
58 
59  StdMeshMatrix& trans = *matrix;
60  trans(0, 0) = array[0].getInt() / 1000.0f;
61  trans(0, 1) = array[1].getInt() / 1000.0f;
62  trans(0, 2) = array[2].getInt() / 1000.0f;
63  trans(0, 3) = array[3].getInt() / 1000.0f;
64  trans(1, 0) = array[4].getInt() / 1000.0f;
65  trans(1, 1) = array[5].getInt() / 1000.0f;
66  trans(1, 2) = array[6].getInt() / 1000.0f;
67  trans(1, 3) = array[7].getInt() / 1000.0f;
68  trans(2, 0) = array[8].getInt() / 1000.0f;
69  trans(2, 1) = array[9].getInt() / 1000.0f;
70  trans(2, 2) = array[10].getInt() / 1000.0f;
71  trans(2, 3) = array[11].getInt() / 1000.0f;
72 
73  return true;
74 }
int32_t GetSize() const
Definition: C4ValueArray.h:36

References C4ValueArray::GetSize().

Here is the call graph for this function:

◆ InitObjectFunctionMap()

void InitObjectFunctionMap ( C4AulScriptEngine pEngine)

Definition at line 3342 of file C4ObjectScript.cpp.

3343 {
3344  // add all def constants (all Int)
3345  for (C4ScriptConstDef *pCDef = &C4ScriptObjectConstMap[0]; pCDef->Identifier; pCDef++)
3346  {
3347  assert(pCDef->ValType == C4V_Int); // only int supported currently
3348  pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
3349  }
3350  C4PropListStatic * p = pEngine->GetPropList();
3351 #define F(f) ::AddFunc(p, #f, Fn##f)
3352 
3353  F(DoCon);
3354  F(GetCon);
3355  F(DoDamage);
3356  F(DoEnergy);
3357  F(DoBreath);
3358  F(GetEnergy);
3359  F(OnFire);
3360  F(Stuck);
3361  F(InLiquid);
3362  F(SetAction);
3363  F(SetActionData);
3364 
3365  F(GetAction);
3366  F(GetActTime);
3367  F(GetOwner);
3368  F(GetMass);
3369  F(GetBreath);
3370  F(GetMenu);
3371  F(GetVertexNum);
3372  F(GetVertex);
3373  F(SetVertex);
3374  F(AddVertex);
3375  F(InsertVertex);
3376  F(RemoveVertex);
3377  ::AddFunc(p, "SetContactDensity", FnSetContactDensity, false);
3378  F(GetController);
3379  F(SetController);
3380  F(SetName);
3381  F(GetKiller);
3382  F(SetKiller);
3383  F(GetPhase);
3384  F(SetPhase);
3385  F(GetCategory);
3386  F(GetOCF);
3387  F(SetAlive);
3388  F(GetAlive);
3389  F(GetDamage);
3390  F(SetComDir);
3391  F(GetComDir);
3392  F(SetDir);
3393  F(GetDir);
3394  F(SetEntrance);
3395  F(GetEntrance);
3396  F(SetCategory);
3397  F(FinishCommand);
3398  F(ActIdle);
3399  F(SetRDir);
3400  F(GetRDir);
3401  F(GetXDir);
3402  F(GetYDir);
3403  F(GetR);
3404  F(SetXDir);
3405  F(SetYDir);
3406  F(SetR);
3407  F(SetOwner);
3408  F(MakeCrewMember);
3409  F(GrabObjectInfo);
3410  F(CreateContents);
3411  F(ShiftContents);
3412  F(GetID);
3413  F(Contents);
3414  F(ScrollContents);
3415  F(Contained);
3416  F(ContentsCount);
3417  ::AddFunc(p, "FindContents", FnFindContents, false);
3418  ::AddFunc(p, "FindOtherContents", FnFindOtherContents, false);
3419  F(RemoveObject);
3420  F(GetActionTarget);
3421  F(SetActionTargets);
3422  ::AddFunc(p, "SetCrewStatus", FnSetCrewStatus, false);
3423  F(SetPosition);
3424  F(CreateMenu);
3425  F(AddMenuItem);
3426  F(SelectMenuItem);
3427  F(SetMenuDecoration);
3428  F(SetMenuTextProgress);
3429  F(ObjectDistance);
3430  F(GetValue);
3431  F(GetRank);
3432  F(SetTransferZone);
3433  F(SetMass);
3434  F(GetColor);
3435  F(SetColor);
3436  F(SetLightRange);
3437  F(GetLightColor);
3438  F(SetLightColor);
3439  F(SetPicture);
3440  F(GetProcedure);
3441  F(CanConcatPictureWith);
3442  F(SetGraphics);
3443  F(ObjectNumber);
3444  F(ShowInfo);
3445  F(CheckVisibility);
3446  F(SetClrModulation);
3448  F(CloseMenu);
3449  F(GetMenuSelection);
3450  F(GetDefBottom);
3451  F(SetMenuSize);
3452  F(GetCrewEnabled);
3453  F(SetCrewEnabled);
3454  F(DoCrewExp);
3455  F(ClearMenuItems);
3456  F(GetObjectLayer);
3457  F(SetObjectLayer);
3458  F(SetShape);
3459  F(SetObjDrawTransform);
3460  ::AddFunc(p, "SetObjDrawTransform2", FnSetObjDrawTransform2, false);
3461  ::AddFunc(p, "SetObjectStatus", FnSetObjectStatus, false);
3462  ::AddFunc(p, "GetObjectStatus", FnGetObjectStatus, false);
3463  ::AddFunc(p, "AdjustWalkRotation", FnAdjustWalkRotation, false);
3464  F(GetContact);
3465  F(SetObjectBlitMode);
3466  F(GetObjectBlitMode);
3467  ::AddFunc(p, "GetUnusedOverlayID", FnGetUnusedOverlayID, false);
3468  F(ExecuteCommand);
3469 
3470  F(PlayAnimation);
3471  F(TransformBone);
3472  F(StopAnimation);
3473  F(GetRootAnimation);
3474  F(GetAnimationList);
3475  F(GetAnimationLength);
3476  F(GetAnimationName);
3477  F(GetAnimationPosition);
3478  F(GetAnimationWeight);
3479  F(SetAnimationPosition);
3480  F(SetAnimationBoneTransform);
3481  F(SetAnimationWeight);
3482  F(AttachMesh);
3483  F(DetachMesh);
3484  F(SetAttachBones);
3485  F(SetAttachTransform);
3486  F(GetBoneNames);
3487  F(GetMeshMaterial);
3488  F(SetMeshMaterial);
3489  F(CreateParticleAtBone);
3490  F(ChangeDef);
3491  F(GrabContents);
3492  F(Punch);
3493  F(Kill);
3494  F(Fling);
3495  ::AddFunc(p, "Jump", FnJump, false);
3496  F(Enter);
3497  F(DeathAnnounce);
3498  F(SetSolidMask);
3499  F(SetHalfVehicleSolidMask);
3500  F(Exit);
3501  F(Collect);
3502 
3503  F(SetCommand);
3504  F(AddCommand);
3505  F(AppendCommand);
3506  F(GetCommand);
3507  F(SetCrewExtraData);
3508  F(GetCrewExtraData);
3509  F(GetDefWidth);
3510  F(GetDefHeight);
3511 #undef F
3512 }
void AddFunc(C4PropListStatic *Parent, const char *Name, RType(*pFunc)(ThisType *, ParTypes...), bool Public=true)
Definition: C4AulDefFunc.h:261
const char * Identifier
Definition: C4AulDefFunc.h:269
bool AddMenuItem(C4ConsoleGUI *console, HMENU hMenu, DWORD dwID, const char *szString, bool fEnabled)
#define F(f)
C4ScriptConstDef C4ScriptObjectConstMap[]
@ C4V_Int
Definition: C4Value.h:26
C4Value C4VInt(int32_t i)
Definition: C4Value.h:239
DWORD GetClrModulation(DWORD dwSrcClr, DWORD dwDstClr, DWORD &dwBack)
Definition: StdColors.h:112
C4PropListStatic * GetPropList()
Definition: C4Aul.h:151
void RegisterGlobalConstant(const char *szName, const C4Value &rValue)
Definition: C4Aul.cpp:123

References AddFunc(), C4ScriptObjectConstMap, C4V_Int, C4VInt(), F, C4AulScriptEngine::GetPropList(), C4ScriptConstDef::Identifier, and C4AulScriptEngine::RegisterGlobalConstant().

Referenced by C4Game::InitScriptEngine().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ C4MN_Add_ForceCount

const int C4MN_Add_ForceCount = 256

Definition at line 1077 of file C4ObjectScript.cpp.

◆ C4MN_Add_ForceNoDesc

const int C4MN_Add_ForceNoDesc = 512

Definition at line 1078 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgColor

const int C4MN_Add_ImgColor = 6

Definition at line 1073 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgIndexed

const int C4MN_Add_ImgIndexed = 2

Definition at line 1069 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgObject

const int C4MN_Add_ImgObject = 4

Definition at line 1071 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgObjRank

const int C4MN_Add_ImgObjRank = 3

Definition at line 1070 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgPropListSpec

const int C4MN_Add_ImgPropListSpec = 7

Definition at line 1074 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgRank

const int C4MN_Add_ImgRank = 1

Definition at line 1068 of file C4ObjectScript.cpp.

◆ C4MN_Add_ImgTextSpec

const int C4MN_Add_ImgTextSpec = 5

Definition at line 1072 of file C4ObjectScript.cpp.

◆ C4MN_Add_MaxImage

const int C4MN_Add_MaxImage = 127

Definition at line 1075 of file C4ObjectScript.cpp.

◆ C4MN_Add_PassValue

const int C4MN_Add_PassValue = 128

Definition at line 1076 of file C4ObjectScript.cpp.

◆ C4ScriptObjectConstMap

C4ScriptConstDef C4ScriptObjectConstMap[]

Definition at line 3159 of file C4ObjectScript.cpp.

Referenced by InitObjectFunctionMap().