2009-05-08 13:28:41 +00:00
/*
* OpenClonk , http : //www.openclonk.org
*
2013-12-17 20:01:09 +00:00
* Copyright ( c ) 1998 - 2000 , Matthes Bender
* Copyright ( c ) 2001 - 2009 , RedWolf Design GmbH , http : //www.clonk.de/
* Copyright ( c ) 2010 - 2013 , The OpenClonk Team and contributors
2009-05-08 13:28:41 +00:00
*
2013-12-17 20:01:09 +00:00
* Distributed under the terms of the ISC license ; see accompanying file
* " COPYING " for details .
2009-05-08 13:28:41 +00:00
*
2013-12-17 20:01:09 +00:00
* " Clonk " is a registered trademark of Matthes Bender , used with permission .
* See accompanying file " TRADEMARK " for details .
2009-05-08 13:28:41 +00:00
*
2013-12-17 20:01:09 +00:00
* To redistribute this file separately , substitute the full license texts
* for the above references .
2009-05-08 13:28:41 +00:00
*/
/* Functions mapped by C4Script */
# ifndef INC_C4Script
# define INC_C4Script
# include <C4Value.h>
2010-03-28 17:58:21 +00:00
const int C4SCR_Access_Public = 0 ,
2010-04-08 00:47:45 +00:00
C4SCR_Access_Protected = 1 ,
C4SCR_Access_Private = 2 ;
2009-05-08 13:28:41 +00:00
# define C4SCR_Public "public"
# define C4SCR_Protected "protected"
# define C4SCR_Private "private"
// ** a definition of a script constant
struct C4ScriptConstDef
2010-03-28 17:58:21 +00:00
{
2009-05-08 13:28:41 +00:00
const char * Identifier ; // constant name
C4V_Type ValType ; // type value
long Data ; // raw data
2010-03-28 17:58:21 +00:00
} ;
2009-05-08 13:28:41 +00:00
2011-03-04 12:49:41 +00:00
// add functions to engine
void InitGameFunctionMap ( C4AulScriptEngine * pEngine ) ;
void InitObjectFunctionMap ( C4AulScriptEngine * pEngine ) ;
void InitCoreFunctionMap ( C4AulScriptEngine * pEngine ) ;
2009-05-08 13:28:41 +00:00
2010-03-15 21:50:11 +00:00
bool C4ValueToMatrix ( C4Value & value , StdMeshMatrix * matrix ) ;
bool C4ValueToMatrix ( const C4ValueArray & array , StdMeshMatrix * matrix ) ;
2009-05-08 13:28:41 +00:00
/* Engine-Calls */
2010-03-28 17:58:21 +00:00
# define PSF_Initialize "~Initialize"
2015-09-29 00:20:31 +00:00
# define PSF_InitializeAmbience "~InitializeAmbience"
2010-03-28 17:58:21 +00:00
# define PSF_Construction "~Construction"
# define PSF_Destruction "~Destruction"
2009-05-08 13:28:41 +00:00
# define PSF_ContentsDestruction "~ContentsDestruction" // C4Object *pContents
2010-03-28 17:58:21 +00:00
# define PSF_InitializePlayer "~InitializePlayer" // iPlayer, iX, iY, pBase, iTeam, idExtra
# define PSF_InitializeScriptPlayer "~InitializeScriptPlayer" // iPlayer, idTeam
# define PSF_PreInitializePlayer "~PreInitializePlayer" // iPlayer
2010-03-22 15:49:51 +00:00
# define PSF_InitializePlayerControl "~InitializePlayerControl" // iPlayer, szControlSet, hasKeyboard, hasMouse, hasGamepad
2013-03-18 23:35:00 +00:00
# define PSF_InitializeMap "~InitializeMap" // map
2013-12-22 22:47:40 +00:00
# define PSF_InitializeObjects "~InitializeObjects"
2010-03-28 17:58:21 +00:00
# define PSF_RemovePlayer "~RemovePlayer" // iPlayer
2011-08-02 13:46:24 +00:00
# define PSF_RelaunchPlayer "~RelaunchPlayer" // iPlayer, iKilledBy
2010-03-28 17:58:21 +00:00
# define PSF_Time1 "~Time1"
# define PSF_Hit "~Hit"
# define PSF_Hit2 "~Hit2"
# define PSF_Hit3 "~Hit3"
2010-07-29 19:11:04 +00:00
# define PSF_Grab "~Grab" // pObject, fGrab
2010-03-28 17:58:21 +00:00
# define PSF_Grabbed "~Grabbed"
# define PSF_Get "~Get"
# define PSF_Put "~Put"
# define PSF_Collection "~Collection" // pObject, fPut
# define PSF_Collection2 "~Collection2" // pObject
# define PSF_Ejection "~Ejection" // pObject
# define PSF_Entrance "~Entrance" // pContainer
# define PSF_Departure "~Departure" // pContainer
# define PSF_Purchase "~Purchase" // iPlayer, pBuyObj
# define PSF_Sale "~Sale" // iPlayer
# define PSF_Damage "~Damage" // iChange, iCausedBy
# define PSF_Incineration "~Incineration" // iCausedBy
# define PSF_IncinerationEx "~IncinerationEx" // iCausedBy
# define PSF_Death "~Death" // iCausedBy
# define PSF_ActivateEntrance "~ActivateEntrance" // pByObject
# define PSF_LiftTop "~LiftTop"
# define PSF_Contact "~Contact%s"
# define PSF_ControlCommand "~ControlCommand" // szCommand, pTarget, iTx, iTy
2009-05-08 13:28:41 +00:00
# define PSF_ControlCommandFinished "~ControlCommandFinished" // szCommand, pTarget, iTx, iTy, pTarget2, iData
2010-03-28 17:58:21 +00:00
# define PSF_CatchBlow "~CatchBlow" // iLevel, pByObject
# define PSF_QueryCatchBlow "~QueryCatchBlow" // pByObject
# define PSF_Stuck "~Stuck"
# define PSF_GrabLost "~GrabLost"
# define PSF_LineBreak "~LineBreak" // iCause
# define PSF_BuildNeedsMaterial "~BuildNeedsMaterial" // idMat1, iAmount1, idMat2, iAmount2...
# define PSF_ControlTransfer "~ControlTransfer" // C4Object* pObj, int iTx, int iTy
2013-12-17 16:16:11 +00:00
# define PSF_OnSynchronized "~OnSynchronized"
2010-03-28 17:58:21 +00:00
# define PSF_CalcValue "~CalcValue" // C4Object *pInBase, int iForPlayer
# define PSF_CalcDefValue "~CalcDefValue" // C4Object *pInBase, int iForPlayer
# define PSF_InputCallback "InputCallback" // const char *szText
2011-01-06 21:34:23 +00:00
# define PSF_IsFulfilled "~IsFulfilled" // int for_plr
2009-05-08 13:28:41 +00:00
# define PSF_AttachTargetLost "~AttachTargetLost"
2010-07-31 16:36:09 +00:00
# define PSF_CrewSelection "~CrewSelection" // bool fDeselect
2009-05-08 13:28:41 +00:00
# define PSF_GetObject2Drop "~GetObject2Drop" // C4Object *pForCollectionOfObj
# define PSF_LeagueGetResult "~LeagueGetResult" // int iForPlr
2010-03-17 14:51:21 +00:00
# define PSF_FireMode "~FireMode"
# define PSF_FrameDecoration "~FrameDecoration%s"
2009-05-08 13:28:41 +00:00
# define PSF_CalcBuyValue "~CalcBuyValue" // C4ID idItem, int iDefValue
# define PSF_CalcSellValue "~CalcSellValue" // C4Object *pObj, int iObjValue
# define PSF_OnJoinCrew "~Recruitment" // int Player
2009-12-14 21:44:55 +00:00
# define PSF_OnRemoveCrew "~DeRecruitment" // int Player
2011-03-12 17:38:47 +00:00
# define PSF_OnInIncendiaryMaterial "OnInIncendiaryMaterial"
2013-01-15 22:09:43 +00:00
# define PSF_EditCursorSelection "~EditCursorSelection"
2015-01-17 19:53:45 +00:00
# define PSF_EditCursorDeselection "~EditCursorDeselection" // new_selection
# define PSF_EditCursorMoved "~EditCursorMoved" // int old_x, int old_y
2013-02-20 20:12:31 +00:00
# define PSF_DigOutObject "~DigOutObject" // C4Object *obj
2014-04-30 23:04:41 +00:00
# define PSF_OnDugOut "~DugOut" //C4Object *by_obj
2013-12-22 22:47:40 +00:00
# define PSF_SaveScenarioObjects "~SaveScenarioObjects" // int file_handle
2016-01-11 01:53:20 +00:00
# define PSF_CommandFailure "~CommandFailure" // string command, pTarget, iTx, iTy, pTarget2, iData
2010-03-17 14:51:21 +00:00
// Effect callbacks
2009-05-08 13:28:41 +00:00
# define PSF_FxStart "Fx%sStart" // C4Object *pTarget, int iEffectNumber, int iTemp, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4
2009-08-15 18:50:32 +00:00
# define PSF_FxStop "Fx%sStop" // C4Object *pTarget, int iEffectNumber, int iReason, bool fTemp
2009-05-08 13:28:41 +00:00
# define PSF_FxTimer "Fx%sTimer" // C4Object *pTarget, int iEffectNumber, int iEffectTime
# define PSF_FxEffect "Fx%sEffect" // C4String *szNewEffect, C4Object *pTarget, int iEffectNumber, int iNewEffectNumber, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4
# define PSF_FxDamage "Fx%sDamage" // C4Object *pTarget, int iEffectNumber, int iDamage, int iCause, int iCausePlayer
# define PSF_FxCustom "Fx%s%s" // C4Object *pTarget, int iEffectNumber, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4, C4Value vVar5, C4Value vVar6, C4Value vVar7
2010-03-17 14:51:21 +00:00
// Controls
# define PSF_PlayerControl "PlayerControl" // int iPlr, int iControl, C4ID idControlExtraData, int x, int y, int iStrength, bool fRepeated, bool fReleased
# define PSF_MouseSelection "~MouseSelection" // int iByPlr
# define PSF_MouseSelectionAlt "~MouseSelectionAlt" // int iByPlr
# define PSF_MouseDragDrop "~MouseDragDrop" // int iPlr, C4Object *source, C4Object *target
2012-02-25 20:56:11 +00:00
# define PSF_MouseHover "~MouseHover" // int iPlr, C4Object* old, C4Object* new, C4Object* drag
2010-03-17 14:51:21 +00:00
// Proplist
# define PSF_Definition "~Definition" // proplist definition
// Reject* Callbacks
# define PSF_RejectHostilityChange "~RejectHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility
# define PSF_RejectTeamSwitch "~RejectTeamSwitch" // int iPlr, int idNewTeam
# define PSF_RejectEntrance "~RejectEntrance" // C4Object *pIntoObj
# define PSF_RejectCollection "~RejectCollect" // idObject, pObject
# define PSF_RejectContents "~RejectContents" // blocks opening of activate/get/contents menus; no parameters
// On* Callbacks
# define PSF_OnGameOver "~OnGameOver"
# define PSF_OnActionJump "~OnActionJump" // int iXDir100, iYDir100
# define PSF_OnOwnerChanged "~OnOwnerChanged" // iNewOwner, iOldOwner
2009-10-13 00:36:11 +00:00
# define PSF_EnergyChange "~OnEnergyChange" // int iChange, int iCause, int iCausedByPlayer
# define PSF_BreathChange "~OnBreathChange" // int iChange
2010-03-17 14:51:21 +00:00
# define PSF_OnHostilityChange "~OnHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility, bool fOldHostility
# define PSF_OnTeamSwitch "~OnTeamSwitch" // int iPlr1, int idNewTeam, int idOldTeam
# define PSF_OnOwnerRemoved "~OnOwnerRemoved"
2009-10-13 00:36:11 +00:00
# define PSF_Promotion "~OnPromotion"
2009-11-30 23:41:37 +00:00
# define PSF_CrewEnabled "~OnCrewEnabled"
# define PSF_CrewDisabled "~OnCrewDisabled"
2010-03-17 14:51:21 +00:00
# define PSF_NameChange "~OnNameChanged" // bool inInfoSection
2009-12-15 19:30:00 +00:00
# define PSF_OnWealthChanged "~OnWealthChanged" // int iPlr
2010-08-17 21:56:15 +00:00
# define PSF_OnActionChanged "~OnActionChanged" // string oldaction
2010-09-12 13:04:16 +00:00
# define PSF_OnMaterialChanged "~OnMaterialChanged" // int newmat, int oldmat
2009-10-13 00:36:11 +00:00
2009-05-08 13:28:41 +00:00
// Fx%s is automatically prefixed
# define PSFS_FxAdd "Add" // C4Object *pTarget, int iEffectNumber, C4String *szNewEffect, int iNewTimer, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4
# define PSFS_FxInfo "Info" // C4Object *pTarget, int iEffectNumber
// Construction is used instead of Construct intentionally, because this callback
// is not performed in the beginning of the command; some checks are skipped.
// If there will ever be more generic ControlCommand*-callbacks, there should be
// an additional callback for Construct.
# define PSF_ControlCommandAcquire "~ControlCommandAcquire" // C4Object *pTarget (unused), int iRangeX, int iRangeY, C4Object *pExcludeContainer, C4ID idAcquireDef
# define PSF_ControlCommandConstruction "~ControlCommandConstruction" // C4Object *pTarget (unused), int iRangeX, int iRangeY, C4Object *pTarget2 (unused), C4ID idConstructDef
# endif