| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design) |
| 5 | * Copyright (c) 2017-2022, The LegacyClonk Team and contributors |
| 6 | * |
| 7 | * Distributed under the terms of the ISC license; see accompanying file |
| 8 | * "COPYING" for details. |
| 9 | * |
| 10 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 11 | * See accompanying file "TRADEMARK" for details. |
| 12 | * |
| 13 | * To redistribute this file separately, substitute the full license texts |
| 14 | * for the above references. |
| 15 | */ |
| 16 | |
| 17 | /* Functions mapped by C4Script */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "C4Value.h" |
| 22 | |
| 23 | class C4AulScriptEngine; |
| 24 | |
| 25 | // ** a definition of a script constant |
| 26 | struct C4ScriptConstDef |
| 27 | { |
| 28 | const char *Identifier; // constant name |
| 29 | C4V_Type ValType; // type value |
| 30 | C4ValueInt Data; // raw data |
| 31 | }; |
| 32 | |
| 33 | void InitFunctionMap(C4AulScriptEngine *pEngine); // add functions to engine |
| 34 | |
| 35 | /* Engine-Calls */ |
| 36 | |
| 37 | #define PSF_Script "~Script{}" |
| 38 | #define PSF_Initialize "~Initialize" |
| 39 | #define PSF_InitializeDef "~InitializeDef" |
| 40 | #define PSF_Construction "~Construction" |
| 41 | #define PSF_Destruction "~Destruction" |
| 42 | #define PSF_ContentsDestruction "~ContentsDestruction" // C4Object *pContents |
| 43 | #define PSF_InitializePlayer "~InitializePlayer" // iPlayer, iX, iY, pBase, iTeam, idExtra |
| 44 | #define PSF_InitializeScriptPlayer "~InitializeScriptPlayer" // iPlayer, idTeam |
| 45 | #define PSF_PreInitializePlayer "~PreInitializePlayer" // iPlayer |
| 46 | #define PSF_RemovePlayer "~RemovePlayer" // iPlayer |
| 47 | #define PSF_OnGameOver "~OnGameOver" |
| 48 | #define PSF_Hit "~Hit" |
| 49 | #define PSF_Hit2 "~Hit2" |
| 50 | #define PSF_Hit3 "~Hit3" |
| 51 | #define PSF_Grab "~Grab" |
| 52 | #define PSF_Grabbed "~Grabbed" |
| 53 | #define PSF_RejectGrabbed "~RejectGrabbed" //pByObject |
| 54 | #define PSF_Get "~Get" |
| 55 | #define PSF_Put "~Put" |
| 56 | #define PSF_Collection "~Collection" // pObject, fPut |
| 57 | #define PSF_Collection2 "~Collection2" // pObject |
| 58 | #define PSF_Ejection "~Ejection" // pObject |
| 59 | #define PSF_Entrance "~Entrance" // pContainer |
| 60 | #define PSF_Departure "~Departure" // pContainer |
| 61 | #define PSF_Completion "~Completion" |
| 62 | #define PSF_Purchase "~Purchase" // iPlayer, pBuyObj |
| 63 | #define PSF_Sale "~Sale" // iPlayer |
| 64 | #define PSF_Damage "~Damage" // iChange, iCausedBy |
| 65 | #define PSF_Incineration "~Incineration" // iCausedBy |
| 66 | #define PSF_IncinerationEx "~IncinerationEx" // iCausedBy |
| 67 | #define PSF_Death "~Death" // iCausedBy |
| 68 | #define PSF_ActivateEntrance "~ActivateEntrance" // pByObject |
| 69 | #define PSF_Activate "~Activate" // pByObject |
| 70 | #define PSF_LiftTop "~LiftTop" |
| 71 | #define PSF_Control "~Control{}" // pByObject |
| 72 | #define PSF_ContainedControl "~Contained{}" // pByObject |
| 73 | #define PSF_ControlUpdate "~ControlUpdate" // pByObject, iComs |
| 74 | #define PSF_ContainedControlUpdate "~ContainedUpdate" // pByObject, iComs |
| 75 | #define PSF_Contact "~Contact{}" |
| 76 | #define PSF_ControlCommand "~ControlCommand" // szCommand, pTarget, iTx, iTy |
| 77 | #define PSF_ControlCommandFinished "~ControlCommandFinished" // szCommand, pTarget, iTx, iTy, pTarget2, iData |
| 78 | #define PSF_DeepBreath "~DeepBreath" |
| 79 | #define PSF_CatchBlow "~CatchBlow" // iLevel, pByObject |
| 80 | #define PSF_QueryCatchBlow "~QueryCatchBlow" // pByObject |
| 81 | #define PSF_Stuck "~Stuck" |
| 82 | #define PSF_RejectCollection "~RejectCollect" // idObject, pObject |
| 83 | #define PSF_RejectContents "~RejectContents" // blocks opening of activate/get/contents menus; no parameters |
| 84 | #define PSF_GrabLost "~GrabLost" |
| 85 | #define PSF_LineBreak "~LineBreak" // iCause |
| 86 | #define PSF_BuildNeedsMaterial "~BuildNeedsMaterial" // idMat1, iAmount1, idMat2, iAmount2... |
| 87 | #define PSF_ControlTransfer "~ControlTransfer" // C4Object* pObj, int iTx, int iTy |
| 88 | #define PSF_UpdateTransferZone "~UpdateTransferZone" |
| 89 | #define PSF_CalcValue "~CalcValue" // C4Object *pInBase, int iForPlayer |
| 90 | #define PSF_CalcDefValue "~CalcDefValue" // C4Object *pInBase, int iForPlayer |
| 91 | #define PSF_SellTo "~SellTo" // int iByPlr |
| 92 | #define PSF_InputCallback "InputCallback" // const char *szText |
| 93 | #define "~MenuQueryCancel" // int iSelection |
| 94 | #define PSF_IsFulfilled "~IsFulfilled" |
| 95 | #define PSF_IsFulfilledforPlr "~IsFulfilledforPlr" // int iCallPlayer |
| 96 | #define PSF_RejectEntrance "~RejectEntrance" // C4Object *pIntoObj |
| 97 | #define PSF_RejectFight "~RejectFight" // C4Object* pEnemy |
| 98 | #define PSF_AttachTargetLost "~AttachTargetLost" |
| 99 | #define PSF_CrewSelection "~CrewSelection" // bool fDeselect, bool fCursorOnly |
| 100 | #define PSF_GetObject2Drop "~GetObject2Drop" // C4Object *pForCollectionOfObj |
| 101 | #define "~OnMenuSelection" // int iItemIndex, C4Object *pMenuObject |
| 102 | #define PSF_OnActionJump "~OnActionJump" // int iXDir100, iYDir100 |
| 103 | #define PSF_CalcBuyValue "~CalcBuyValue" // C4ID idItem, int iDefValue |
| 104 | #define PSF_CalcSellValue "~CalcSellValue" // C4Object *pObj, int iObjValue |
| 105 | #define PSF_MouseSelection "~MouseSelection" // int iByPlr |
| 106 | #define PSF_OnOwnerChanged "~OnOwnerChanged" // iNewOwner, iOldOwner |
| 107 | #define PSF_OnJoinCrew "~Recruitment" // int Player |
| 108 | #define PSF_FxStart "Fx{}Start" // C4Object *pTarget, int iEffectNumber, int iTemp, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4 |
| 109 | #define PSF_FxStop "Fx{}Stop" // C4Object *pTarget, int iEffectNumber, int iReason, bool fTemp |
| 110 | #define PSF_FxTimer "Fx{}Timer" // C4Object *pTarget, int iEffectNumber, int iEffectTime |
| 111 | #define PSF_FxEffect "Fx{}Effect" // C4String *szNewEffect, C4Object *pTarget, int iEffectNumber, int iNewEffectNumber, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4 |
| 112 | #define PSF_FxDamage "Fx{}Damage" // C4Object *pTarget, int iEffectNumber, int iDamage, int iCause, int iCausePlayer |
| 113 | #define PSF_FxCustom "Fx{}{}" // C4Object *pTarget, int iEffectNumber, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4, C4Value vVar5, C4Value vVar6, C4Value vVar7 |
| 114 | #define PSF_FireMode "~FireMode" |
| 115 | #define PSF_FrameDecoration "~FrameDecoration{}" |
| 116 | #define PSF_GetFairCrewPhysical "~GetFairCrewPhysical" // C4String *szPhysicalName, int iRank, int iPrevPhysical |
| 117 | #define PSF_DoMagicEnergy "DoMagicEnergy" // int iChange, C4Object *pObj, bool fAllowPartial |
| 118 | #define PSF_GetCustomComponents "~GetCustomComponents" // C4Object *pBuilder |
| 119 | #define PSF_RejectHostilityChange "~RejectHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility |
| 120 | #define PSF_RejectTeamSwitch "~RejectTeamSwitch" // int iPlr, int idNewTeam |
| 121 | #define PSF_OnHostilityChange "~OnHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility, bool fOldHostility |
| 122 | #define PSF_OnTeamSwitch "~OnTeamSwitch" // int iPlr1, int idNewTeam, int idOldTeam |
| 123 | #define PSF_OnOwnerRemoved "~OnOwnerRemoved" |
| 124 | |
| 125 | // Fx{} is automatically prefixed |
| 126 | #define PSFS_FxAdd "Add" // C4Object *pTarget, int iEffectNumber, C4String *szNewEffect, int iNewTimer, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4 |
| 127 | #define PSFS_FxInfo "Info" // C4Object *pTarget, int iEffectNumber |
| 128 | |
| 129 | // Construction is used instead of Construct intentionally, because this callback |
| 130 | // is not performed in the beginning of the command; some checks are skipped. |
| 131 | // If there will ever be more generic ControlCommand*-callbacks, there should be |
| 132 | // an additional callback for Construct. |
| 133 | #define PSF_ControlCommandAcquire "~ControlCommandAcquire" // C4Object *pTarget (unused), int iRangeX, int iRangeY, C4Object *pExcludeContainer, C4ID idAcquireDef |
| 134 | #define PSF_ControlCommandConstruction "~ControlCommandConstruction" // C4Object *pTarget (unused), int iRangeX, int iRangeY, C4Object *pTarget2 (unused), C4ID idConstructDef |
| 135 | |