OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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

#define _snprintf   snprintf

Definition at line 839 of file C4ObjectScript.cpp.

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

Referenced by InitObjectFunctionMap().

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

Enumeration Type Documentation

Enumerator
VTX_X 
VTX_Y 
VTX_CNAT 
VTX_Friction 

Definition at line 619 of file C4ObjectScript.cpp.

620 {
621  VTX_X,
622  VTX_Y,
623  VTX_CNAT,
625 };
Enumerator
VTX_SetNonpermanent 
VTX_SetPermanent 
VTX_SetPermanentUpd 

Definition at line 626 of file C4ObjectScript.cpp.

Function Documentation

bool C4ValueToMatrix ( C4Value value,
StdMeshMatrix *  matrix 
)

Definition at line 42 of file C4ObjectScript.cpp.

References C4Value::getArray().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4ValueToMatrix ( const C4ValueArray array,
StdMeshMatrix *  matrix 
)

Definition at line 49 of file C4ObjectScript.cpp.

References C4ValueArray::GetSize().

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

Here is the call graph for this function:

void InitObjectFunctionMap ( C4AulScriptEngine pEngine)

Definition at line 2549 of file C4ObjectScript.cpp.

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

Referenced by C4Game::InitScriptEngine().

2550 {
2551  // add all def constants (all Int)
2552  for (C4ScriptConstDef *pCDef = &C4ScriptObjectConstMap[0]; pCDef->Identifier; pCDef++)
2553  {
2554  assert(pCDef->ValType == C4V_Int); // only int supported currently
2555  pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
2556  }
2557  C4PropListStatic * p = pEngine->GetPropList();
2558 #define F(f) ::AddFunc(p, #f, Fn##f)
2559 
2560  F(DoCon);
2561  F(GetCon);
2562  F(DoDamage);
2563  F(DoEnergy);
2564  F(DoBreath);
2565  F(GetEnergy);
2566  F(OnFire);
2567  F(Stuck);
2568  F(InLiquid);
2569  F(SetAction);
2570  F(SetActionData);
2571 
2572  F(SetBridgeActionData);
2573  F(GetAction);
2574  F(GetActTime);
2575  F(GetOwner);
2576  F(GetMass);
2577  F(GetBreath);
2578  F(GetMenu);
2579  F(GetVertexNum);
2580  F(GetVertex);
2581  F(SetVertex);
2582  F(AddVertex);
2583  F(InsertVertex);
2584  F(RemoveVertex);
2585  ::AddFunc(p, "SetContactDensity", FnSetContactDensity, false);
2586  F(GetController);
2587  F(SetController);
2588  F(SetName);
2589  F(GetKiller);
2590  F(SetKiller);
2591  F(GetPhase);
2592  F(SetPhase);
2593  F(GetCategory);
2594  F(GetOCF);
2595  F(SetAlive);
2596  F(GetAlive);
2597  F(GetDamage);
2598  F(SetComDir);
2599  F(GetComDir);
2600  F(SetDir);
2601  F(GetDir);
2602  F(SetEntrance);
2603  F(GetEntrance);
2604  F(SetCategory);
2605  F(FinishCommand);
2606  F(ActIdle);
2607  F(SetRDir);
2608  F(GetRDir);
2609  F(GetXDir);
2610  F(GetYDir);
2611  F(GetR);
2612  F(SetXDir);
2613  F(SetYDir);
2614  F(SetR);
2615  F(SetOwner);
2616  F(MakeCrewMember);
2617  F(GrabObjectInfo);
2618  F(CreateContents);
2619  F(ShiftContents);
2620  F(GetID);
2621  F(Contents);
2622  F(ScrollContents);
2623  F(Contained);
2624  F(ContentsCount);
2625  ::AddFunc(p, "FindContents", FnFindContents, false);
2626  ::AddFunc(p, "FindOtherContents", FnFindOtherContents, false);
2627  F(RemoveObject);
2628  F(GetActionTarget);
2629  F(SetActionTargets);
2630  ::AddFunc(p, "SetCrewStatus", FnSetCrewStatus, false);
2631  F(SetPosition);
2632  F(CreateMenu);
2633  F(AddMenuItem);
2634  F(SelectMenuItem);
2635  F(SetMenuDecoration);
2636  F(SetMenuTextProgress);
2637  F(ObjectDistance);
2638  F(GetValue);
2639  F(GetRank);
2640  F(SetTransferZone);
2641  F(SetMass);
2642  F(GetColor);
2643  F(SetColor);
2644  F(SetLightRange);
2645  F(GetLightColor);
2646  F(SetLightColor);
2647  F(SetPicture);
2648  F(GetProcedure);
2649  F(CanConcatPictureWith);
2650  F(SetGraphics);
2651  F(ObjectNumber);
2652  F(ShowInfo);
2653  F(CheckVisibility);
2654  F(SetClrModulation);
2656  F(CloseMenu);
2657  F(GetMenuSelection);
2658  F(GetDefBottom);
2659  F(SetMenuSize);
2660  F(GetCrewEnabled);
2661  F(SetCrewEnabled);
2662  F(DoCrewExp);
2663  F(ClearMenuItems);
2664  F(GetObjectLayer);
2665  F(SetObjectLayer);
2666  F(SetShape);
2667  F(SetObjDrawTransform);
2668  ::AddFunc(p, "SetObjDrawTransform2", FnSetObjDrawTransform2, false);
2669  ::AddFunc(p, "SetObjectStatus", FnSetObjectStatus, false);
2670  ::AddFunc(p, "GetObjectStatus", FnGetObjectStatus, false);
2671  ::AddFunc(p, "AdjustWalkRotation", FnAdjustWalkRotation, false);
2672  F(GetContact);
2673  F(SetObjectBlitMode);
2674  F(GetObjectBlitMode);
2675  ::AddFunc(p, "GetUnusedOverlayID", FnGetUnusedOverlayID, false);
2676  F(ExecuteCommand);
2677 
2678  F(PlayAnimation);
2679  F(TransformBone);
2680  F(StopAnimation);
2681  F(GetRootAnimation);
2682  F(GetAnimationList);
2683  F(GetAnimationLength);
2684  F(GetAnimationName);
2685  F(GetAnimationPosition);
2686  F(GetAnimationWeight);
2687  F(SetAnimationPosition);
2688  F(SetAnimationBoneTransform);
2689  F(SetAnimationWeight);
2690  F(AttachMesh);
2691  F(DetachMesh);
2692  F(SetAttachBones);
2693  F(SetAttachTransform);
2694  F(GetMeshMaterial);
2695  F(SetMeshMaterial);
2696  F(CreateParticleAtBone);
2697  F(ChangeDef);
2698  F(GrabContents);
2699  F(Punch);
2700  F(Kill);
2701  F(Fling);
2702  ::AddFunc(p, "Jump", FnJump, false);
2703  F(Enter);
2704  F(DeathAnnounce);
2705  F(SetSolidMask);
2706  F(SetHalfVehicleSolidMask);
2707  F(Exit);
2708  F(Collect);
2709 
2710  F(SetCommand);
2711  F(AddCommand);
2712  F(AppendCommand);
2713  F(GetCommand);
2714  F(SetCrewExtraData);
2715  F(GetCrewExtraData);
2716  F(GetDefWidth);
2717  F(GetDefHeight);
2718 #undef F
2719 }
void RegisterGlobalConstant(const char *szName, const C4Value &rValue)
DWORD GetClrModulation(DWORD dwSrcClr, DWORD dwDstClr, DWORD &dwBack)
Definition: StdColors.h:112
C4PropListStatic * GetPropList()
Definition: C4Aul.h:151
C4Value C4VInt(int32_t i)
Definition: C4Value.h:242
bool AddMenuItem(C4ConsoleGUI *console, HMENU hMenu, DWORD dwID, const char *szString, bool fEnabled)
#define F(f)
const char * Identifier
Definition: C4AulDefFunc.h:268
void AddFunc(C4PropListStatic *Parent, const char *Name, RType(*pFunc)(ThisType *, ParTypes...), bool Public=true)
Definition: C4AulDefFunc.h:260
C4ScriptConstDef C4ScriptObjectConstMap[]

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const int C4MN_Add_ForceCount = 256

Definition at line 835 of file C4ObjectScript.cpp.

const int C4MN_Add_ForceNoDesc = 512

Definition at line 836 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgColor = 6

Definition at line 831 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgIndexed = 2

Definition at line 827 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgObject = 4

Definition at line 829 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgObjRank = 3

Definition at line 828 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgPropListSpec = 7

Definition at line 832 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgRank = 1

Definition at line 826 of file C4ObjectScript.cpp.

const int C4MN_Add_ImgTextSpec = 5

Definition at line 830 of file C4ObjectScript.cpp.

const int C4MN_Add_MaxImage = 127

Definition at line 833 of file C4ObjectScript.cpp.

const int C4MN_Add_PassValue = 128

Definition at line 834 of file C4ObjectScript.cpp.

C4ScriptConstDef C4ScriptObjectConstMap[]

Definition at line 2366 of file C4ObjectScript.cpp.