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

Go to the source code of this file.

Classes

class  C4ValueCompiler
 
class  C4ValueGetCompiler
 
struct  PathInfo
 
struct  SumPathLength
 

Macros

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

Functions

void MakeAbsCoordinates (C4PropList *_this, int32_t &x, int32_t &y)
 
void MakeAbsCoordinates (C4PropList *_this, long &x, long &y)
 
C4Effect ** FnGetEffectsFor (C4PropList *target)
 
long GetValidOwner (C4PropList *_this, Nillable< long > owner)
 
void AssignController (C4PropList *_this, C4Object *obj)
 
C4FindObjectCreateCriterionsFromPars (C4Value *parameters, C4FindObject **pFOs, C4SortObject **pSOs, const C4Object *context)
 
C4StringGetTextureName (int32_t texture_nr)
 
C4ObjectFnPlaceVegetation (C4PropList *_this, C4PropList *Def, long x, long y, long wdt, long hgt, long growth, C4PropList *shape)
 
C4ObjectFnPlaceAnimal (C4PropList *_this, C4PropList *Def)
 
C4ObjectFnObject (C4PropList *_this, long iNumber)
 
template<class T >
C4Value GetValByStdCompiler (const char *strEntry, const char *strSection, int iEntryNr, const T &rFrom)
 
bool SimFlight (C4Real &x, C4Real &y, C4Real &xdir, C4Real &ydir, int32_t iDensityMin, int32_t iDensityMax, int32_t &iIter)
 
void InitGameFunctionMap (C4AulScriptEngine *pEngine)
 

Variables

C4ScriptConstDef C4ScriptGameConstMap []
 
C4ScriptFnDef C4ScriptGameFnMap []
 

Class Documentation

◆ PathInfo

struct PathInfo

Definition at line 2438 of file C4GameScript.cpp.

Class Members
long ilen
long ilx
long ily

Macro Definition Documentation

◆ F

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

Function Documentation

◆ AssignController()

void AssignController ( C4PropList _this,
C4Object obj 
)

Definition at line 190 of file C4GameScript.cpp.

191 {
192  // Set initial controller to creating controller, so more complicated cause-effect-chains can be traced back to the causing player
193  if (obj && Object(_this) && Object(_this)->Controller > NO_OWNER)
194  {
195  obj->Controller = Object(_this)->Controller;
196  }
197 }
C4Object * Object(C4PropList *_this)
Definition: C4AulDefFunc.h:34
const int NO_OWNER
Definition: C4Constants.h:137
int32_t Controller
Definition: C4Object.h:109

References C4Object::Controller, NO_OWNER, and Object().

Here is the call graph for this function:

◆ CreateCriterionsFromPars()

C4FindObject* CreateCriterionsFromPars ( C4Value parameters,
C4FindObject **  pFOs,
C4SortObject **  pSOs,
const C4Object context 
)

Definition at line 296 of file C4GameScript.cpp.

297 {
298  int count = 0;
299  int sort_count = 0;
300  bool has_layer_check = false;
301  // Read all parameters
302  for (int i = 0; i < C4AUL_MAX_Par; i++)
303  {
304  C4Value Data = *(parameters++);
305  // No data given?
306  if (!Data)
307  {
308  break;
309  }
310  // Construct
311  C4SortObject *pSO = nullptr;
312  C4FindObject *pFO = C4FindObject::CreateByValue(Data, pSOs ? &pSO : nullptr, context, &has_layer_check);
313  // Add FindObject
314  if (pFO)
315  {
316  pFOs[count++] = pFO;
317  }
318  // Add SortObject
319  if (pSO)
320  {
321  pSOs[sort_count++] = pSO;
322  }
323  }
324  // No criterions?
325  if (!count)
326  {
327  for (int i = 0; i < sort_count; ++i)
328  {
329  delete pSOs[i];
330  }
331  return nullptr;
332  }
333  // Implicit layer check
334  if (context && !has_layer_check)
335  {
336  pFOs[count++] = new C4FindObjectLayer(context->Layer);
337  }
338  // create sort criterion
339  C4SortObject *pSO = nullptr;
340  if (sort_count)
341  {
342  if (sort_count == 1)
343  {
344  pSO = pSOs[0];
345  }
346  else
347  {
348  pSO = new C4SortObjectMultiple(sort_count, pSOs, false);
349  }
350  }
351  // Create search object
352  C4FindObject *pFO;
353  if (count == 1)
354  {
355  pFO = pFOs[0];
356  }
357  else
358  {
359  pFO = new C4FindObjectAnd(count, pFOs, false);
360  }
361  if (pSO)
362  {
363  pFO->SetSort(pSO);
364  }
365  return pFO;
366 }
#define C4AUL_MAX_Par
Definition: C4AulFunc.h:26
static C4FindObject * CreateByValue(const C4Value &Data, C4SortObject **ppSortObj=nullptr, const C4Object *context=nullptr, bool *has_layer_check=nullptr)
void SetSort(C4SortObject *pToSort)
C4ObjectPtr Layer
Definition: C4Object.h:134

References C4AUL_MAX_Par, C4FindObject::CreateByValue(), C4Object::Layer, and C4FindObject::SetSort().

Here is the call graph for this function:

◆ FnGetEffectsFor()

C4Effect** FnGetEffectsFor ( C4PropList target)

Definition at line 72 of file C4GameScript.cpp.

73 {
74  if (target)
75  {
76  if (target == ScriptEngine.GetPropList())
77  {
79  }
80  if (target == GameScript.ScenPropList.getPropList())
81  {
83  }
84  C4Object * obj = target->GetObject();
85  if (!obj)
86  {
87  throw C4AulExecError("Effect target has to be an object");
88  }
89  return &obj->pEffects;
90  }
92 }
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4GameScriptHost GameScript
C4PropListStatic * GetPropList()
Definition: C4Aul.h:151
C4Effect * pGlobalEffects
Definition: C4Aul.h:144
C4Effect * pScenarioEffects
Definition: C4ScriptHost.h:166
C4Value ScenPropList
Definition: C4ScriptHost.h:164
C4Effect * pEffects
Definition: C4Object.h:155
virtual C4Object * GetObject()
Definition: C4PropList.cpp:636
C4PropList * getPropList() const
Definition: C4Value.h:116

References GameScript, C4PropList::GetObject(), C4AulScriptEngine::GetPropList(), C4Value::getPropList(), C4Object::pEffects, C4AulScriptEngine::pGlobalEffects, C4GameScriptHost::pScenarioEffects, C4GameScriptHost::ScenPropList, and ScriptEngine.

Here is the call graph for this function:

◆ FnObject()

C4Object* FnObject ( C4PropList _this,
long  iNumber 
)

Definition at line 1646 of file C4GameScript.cpp.

1647 {
1649  // See FnObjectNumber
1650 }
C4GameObjects Objects
Definition: C4Globals.cpp:48
C4Object * SafeObjectPointer(int32_t object_number)

References Objects, and C4GameObjects::SafeObjectPointer().

Here is the call graph for this function:

◆ FnPlaceAnimal()

C4Object* FnPlaceAnimal ( C4PropList _this,
C4PropList Def 
)

Definition at line 964 of file C4GameScript.cpp.

965 {
966  return Game.PlaceAnimal(Def? Def : _this);
967 }
C4Game Game
Definition: C4Globals.cpp:52
C4Object * PlaceAnimal(C4PropList *def)
Definition: C4Game.cpp:3446

References Game, and C4Game::PlaceAnimal().

Here is the call graph for this function:

◆ FnPlaceVegetation()

C4Object* FnPlaceVegetation ( C4PropList _this,
C4PropList Def,
long  x,
long  y,
long  wdt,
long  hgt,
long  growth,
C4PropList shape 
)

Definition at line 945 of file C4GameScript.cpp.

946 {
947  if (shape)
948  {
949  // New-style call with scripted shape
950  C4PropList *out_pos = C4PropList::New(nullptr);
951  C4Value vout_pos = C4VPropList(out_pos);
952  return Game.PlaceVegetation(Def, x, y, wdt, hgt, growth, shape, out_pos);
953  }
954  else
955  {
956  // Call in old-style shape
957  // Local call: relative coordinates
958  MakeAbsCoordinates(_this, x, y);
959  // Place vegetation
960  return Game.PlaceVegetation(Def, x, y, wdt, hgt, growth, nullptr, nullptr);
961  }
962 }
void MakeAbsCoordinates(C4PropList *_this, int32_t &x, int32_t &y)
C4Value C4VPropList(C4PropList *p)
Definition: C4Value.h:242
C4Object * PlaceVegetation(C4PropList *def, int32_t x, int32_t y, int32_t wdt, int32_t hgt, int32_t growth, C4PropList *shape_proplist, C4PropList *out_pos_proplist)
Definition: C4Game.cpp:3323
static C4PropList * New(C4PropList *prototype=nullptr)
Definition: C4PropList.cpp:40

References C4VPropList(), Game, MakeAbsCoordinates(), C4PropList::New(), and C4Game::PlaceVegetation().

Here is the call graph for this function:

◆ GetTextureName()

C4String* GetTextureName ( int32_t  texture_nr)

Definition at line 503 of file C4GameScript.cpp.

504 {
505  if (!texture_nr)
506  {
507  return nullptr;
508  }
509  // Get material-texture mapping
510  const C4TexMapEntry *texture = ::TextureMap.GetEntry(texture_nr);
511  if (!texture)
512  {
513  return nullptr;
514  }
515  // Return tex name
516  return String(texture->GetTextureName());
517 }
C4String * String(const char *str)
Definition: C4AulDefFunc.h:30
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
Definition: C4Texture.h:49
const char * GetTextureName() const
Definition: C4Texture.h:61
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85

References C4TextureMap::GetEntry(), C4TexMapEntry::GetTextureName(), String(), and TextureMap.

Referenced by C4TextureMap::GetIndex(), C4TextureMap::SaveMap(), and C4TextureMap::StoreMapPalette().

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

◆ GetValByStdCompiler()

template<class T >
C4Value GetValByStdCompiler ( const char *  strEntry,
const char *  strSection,
int  iEntryNr,
const T &  rFrom 
)

Definition at line 1966 of file C4GameScript.cpp.

1967 {
1968  // Set up name array, create compiler
1969  const char *szNames[2] = { strSection ? strSection : strEntry, strSection ? strEntry : nullptr };
1970  C4ValueGetCompiler Comp(szNames, strSection ? 2 : 1, iEntryNr);
1971 
1972  // Compile
1973  try
1974  {
1975  Comp.Decompile(rFrom);
1976  return Comp.getResult();
1977  }
1978  // Should not happen, catch it anyway.
1979  catch (StdCompiler::Exception *)
1980  {
1981  return C4VNull;
1982  }
1983 }
const C4Value C4VNull
Definition: C4Value.cpp:30

References C4VNull, StdCompiler::Decompile(), and C4ValueGetCompiler::getResult().

Here is the call graph for this function:

◆ GetValidOwner()

long GetValidOwner ( C4PropList _this,
Nillable< long >  owner 
)

Definition at line 174 of file C4GameScript.cpp.

175 {
176  if (owner.IsNil())
177  {
178  if (Object(_this))
179  {
180  return Object(_this)->Controller;
181  }
182  else
183  {
184  return NO_OWNER;
185  }
186  }
187  return owner;
188 }
bool IsNil() const
Definition: C4AulDefFunc.h:58

References C4Object::Controller, Nillable< T >::IsNil(), NO_OWNER, and Object().

Here is the call graph for this function:

◆ InitGameFunctionMap()

void InitGameFunctionMap ( C4AulScriptEngine pEngine)

Definition at line 3135 of file C4GameScript.cpp.

3136 {
3137  // add all def constants (all Int)
3138  for (C4ScriptConstDef *pCDef = &C4ScriptGameConstMap[0]; pCDef->Identifier; pCDef++)
3139  {
3140  assert(pCDef->ValType == C4V_Int); // only int supported currently
3141  pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
3142  }
3143  C4PropListStatic * p = pEngine->GetPropList();
3144  // add all def script funcs
3145  for (C4ScriptFnDef *pDef = &C4ScriptGameFnMap[0]; pDef->Identifier; pDef++)
3146  new C4AulDefFunc(p, pDef);
3147 #define F(f) ::AddFunc(p, #f, Fn##f)
3148  F(GetX);
3149  F(GetY);
3150  F(GetDefinition);
3151  F(GetDefinitionGroupPath);
3152  F(GetPlayerName);
3153  F(GetPlayerType);
3154  F(GetPlayerColor);
3155  F(GetPlrClonkSkin);
3156  F(CreateObject);
3157  F(CreateObjectAbove);
3158  F(CreateConstruction);
3159  F(FindConstructionSite);
3160  F(CheckConstructionSite);
3161  F(Sound);
3162  F(SoundAt);
3163  F(ChangeSoundModifier);
3164  F(SetGlobalSoundModifier);
3165  F(Music);
3166  F(MusicLevel);
3167  F(SetPlayList);
3168  F(SetPlrView);
3169  F(SetPlrKnowledge);
3170  F(GetPlrViewMode);
3171  F(ResetCursorView);
3172  F(GetPlrView);
3173  F(GetWealth);
3174  F(SetWealth);
3175  F(DoPlayerScore);
3176  F(GetPlayerScore);
3177  F(GetPlayerScoreGain);
3178  F(GetWind);
3179  F(SetWind);
3180  F(GetTemperature);
3181  F(SetTemperature);
3182  F(ShakeFree);
3183  F(DigFree);
3184  F(DigFreeRect);
3185  F(ClearFreeRect);
3186  F(Hostile);
3187  F(SetHostility);
3188  F(PlaceVegetation);
3189  F(PlaceAnimal);
3190  F(GameOver);
3191  F(GetHiRank);
3192  F(GetCrew);
3193  F(GetCrewCount);
3194  F(GetPlayerCount);
3195  F(GetPlayerByIndex);
3196  F(EliminatePlayer);
3197  F(SurrenderPlayer);
3198  F(GetLeagueScore);
3199  F(SetLeaguePerformance);
3200  F(SetLeagueProgressData);
3201  F(GetLeagueProgressData);
3202  F(CreateScriptPlayer);
3203  F(GetCursor);
3204  F(GetViewCursor);
3205  F(SetCursor);
3206  F(SetViewCursor);
3207  F(GetMaterial);
3208  F(GetBackMaterial);
3209  F(GetTexture);
3210  F(GetBackTexture);
3211  F(GetAverageTextureColor);
3212  F(GetMaterialCount);
3213  F(GBackSolid);
3214  F(GBackSemiSolid);
3215  F(GBackLiquid);
3216  F(GBackSky);
3217  F(Material);
3218  F(BlastFree);
3219  F(InsertMaterial);
3220  F(CanInsertMaterial);
3221  F(ExecutePXS);
3222  F(LandscapeWidth);
3223  F(LandscapeHeight);
3224  F(SetAmbientBrightness);
3225  F(GetAmbientBrightness);
3226  F(SetSeason);
3227  F(GetSeason);
3228  F(SetClimate);
3229  F(GetClimate);
3230  F(SetPlayerZoomByViewRange);
3231  F(GetPlayerZoomLimits);
3232  F(SetPlayerZoom);
3233  F(SetPlayerViewLock);
3234  F(DoBaseMaterial);
3235  F(DoBaseProduction);
3236  F(GainScenarioAccess);
3237  F(IsNetwork);
3238  F(IsEditor);
3239  F(GetLeague);
3240  ::AddFunc(p, "TestMessageBoard", FnTestMessageBoard, false);
3241  ::AddFunc(p, "CallMessageBoard", FnCallMessageBoard, false);
3242  ::AddFunc(p, "AbortMessageBoard", FnAbortMessageBoard, false);
3243  F(SetFoW);
3244  F(SetMaxPlayer);
3245  F(Object);
3246  F(GetTime);
3247  F(GetScenarioAccess);
3248  F(MaterialName);
3249  F(DrawMap);
3250  F(DrawDefMap);
3251  F(CreateParticle);
3252  F(ClearParticles);
3253  F(SetSky);
3254  F(SetSkyAdjust);
3255  F(SetMatAdjust);
3256  F(GetSkyAdjust);
3257  F(GetMatAdjust);
3258  F(SetSkyParallax);
3259  F(ReloadDef);
3260  F(ReloadParticle);
3261  F(SetGamma);
3262  F(ResetGamma);
3263  F(AddFragmentShader);
3264  F(RemoveShader);
3265  F(FrameCounter);
3266  F(DrawMaterialQuad);
3267  F(SetFilmView);
3268  F(AddMsgBoardCmd);
3269  ::AddFunc(p, "SetGameSpeed", FnSetGameSpeed, false);
3270  ::AddFunc(p, "DrawMatChunks", FnDrawMatChunks, false);
3271  F(GetPathLength);
3272  F(SetTextureIndex);
3273  F(RemoveUnusedTexMapEntries);
3274  F(SimFlight);
3275  F(LoadScenarioSection);
3276  F(SetViewOffset);
3277  ::AddFunc(p, "SetPreSend", FnSetPreSend, false);
3278  F(GetPlayerID);
3279  F(GetPlayerTeam);
3280  F(SetPlayerTeam);
3281  F(GetScriptPlayerExtraID);
3282  F(GetTeamConfig);
3283  F(GetTeamName);
3284  F(GetTeamColor);
3285  F(GetTeamByIndex);
3286  F(GetTeamCount);
3287  ::AddFunc(p, "InitScenarioPlayer", FnInitScenarioPlayer, false);
3288  F(SetScoreboardData);
3289  ::AddFunc(p, "GetScoreboardString", FnGetScoreboardString, false);
3290  ::AddFunc(p, "GetScoreboardData", FnGetScoreboardData, false);
3291  F(DoScoreboardShow);
3292  F(SortScoreboard);
3293  F(AddEvaluationData);
3294  F(HideSettlementScoreInEvaluation);
3295  F(ExtractMaterialAmount);
3296  F(CustomMessage);
3297  F(GuiOpen);
3298  F(GuiUpdateTag);
3299  F(GuiClose);
3300  F(GuiUpdate);
3301  ::AddFunc(p, "PauseGame", FnPauseGame, false);
3302  F(PathFree);
3303  F(PathFree2);
3304  F(SetNextScenario);
3305  F(GetPlayerControlState);
3306  F(SetPlayerControlEnabled);
3307  F(GetPlayerControlEnabled);
3308  F(GetPlayerControlAssignment);
3309  F(PlayRumble);
3310  F(StopRumble);
3311  F(GetStartupPlayerCount);
3312  F(GetStartupTeamCount);
3313  F(EditCursor);
3314  F(GainScenarioAchievement);
3315  F(GetPXSCount);
3316  F(GetPlrKnowledge);
3317  F(GetBaseMaterial);
3318  F(GetBaseProduction);
3319  F(GetDefCoreVal);
3320  F(GetObjectVal);
3321  F(GetObjectInfoCoreVal);
3322  F(GetScenarioVal);
3323  F(GetPlayerVal);
3324  F(GetPlayerInfoCoreVal);
3325  F(GetMaterialVal);
3326  F(SetPlrExtraData);
3327  F(GetPlrExtraData);
3328  F(PV_Linear);
3329  F(PV_Random);
3330  F(PV_Direction);
3331  F(PV_Step);
3332  F(PV_Speed);
3333  F(PV_Wind);
3334  F(PV_Gravity);
3335  // F(PV_KeyFrames); added below
3336  F(PV_Sin);
3337  F(PV_Cos);
3338  F(PC_Die);
3339  F(PC_Bounce);
3340  F(PC_Stop);
3341  F(IncinerateLandscape);
3342  F(GetGravity);
3343  F(SetGravity);
3344  F(GetTranslatedString);
3345 #undef F
3346 }
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 SimFlight(C4Real &x, C4Real &y, C4Real &xdir, C4Real &ydir, int32_t iDensityMin, int32_t iDensityMax, int32_t &iIter)
Definition: C4Movement.cpp:810
C4ScriptConstDef C4ScriptGameConstMap[]
#define F(f)
C4ScriptFnDef C4ScriptGameFnMap[]
bool PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
bool GBackLiquid(int32_t x, int32_t y)
Definition: C4Landscape.h:239
bool GBackSemiSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:234
bool GBackSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:229
int32_t Hostile(int32_t plr1, int32_t plr2)
@ C4V_Int
Definition: C4Value.h:26
C4Value C4VInt(int32_t i)
Definition: C4Value.h:239
void RegisterGlobalConstant(const char *szName, const C4Value &rValue)
Definition: C4Aul.cpp:123
const char * Identifier
Definition: C4AulDefFunc.h:277

References AddFunc(), C4ScriptGameConstMap, C4ScriptGameFnMap, C4V_Int, C4VInt(), F, GBackLiquid(), GBackSemiSolid(), GBackSolid(), C4AulScriptEngine::GetPropList(), Hostile(), 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:

◆ MakeAbsCoordinates() [1/2]

void MakeAbsCoordinates ( C4PropList _this,
int32_t &  x,
int32_t &  y 
)

Definition at line 52 of file C4GameScript.cpp.

53 {
54  C4Object *obj = Object(_this);
55  if (obj)
56  {
57  x += obj->GetX();
58  y += obj->GetY();
59  }
60 }
int32_t GetX() const
Definition: C4Object.h:285
int32_t GetY() const
Definition: C4Object.h:286

References C4Object::GetX(), C4Object::GetY(), and Object().

Referenced by FnPlaceVegetation().

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

◆ MakeAbsCoordinates() [2/2]

void MakeAbsCoordinates ( C4PropList _this,
long &  x,
long &  y 
)

Definition at line 62 of file C4GameScript.cpp.

63 {
64  C4Object *obj = Object(_this);
65  if (obj)
66  {
67  x += obj->GetX();
68  y += obj->GetY();
69  }
70 }

References C4Object::GetX(), C4Object::GetY(), and Object().

Here is the call graph for this function:

◆ SimFlight()

bool SimFlight ( C4Real x,
C4Real y,
C4Real xdir,
C4Real ydir,
int32_t  iDensityMin,
int32_t  iDensityMax,
int32_t &  iIter 
)

Definition at line 810 of file C4Movement.cpp.

811 {
812  bool hit_on_time = true;
813  bool break_main_loop = false;
814  int32_t target_x, target_y;
815  int32_t current_x = fixtoi(x);
816  int32_t current_y = fixtoi(y);
817  int32_t index = iterations;
818  do
819  {
820  if (!--index)
821  {
822  hit_on_time = false;
823  break;
824  }
825  // If the object isn't moving and there is no gravity either, abort
826  if (xdir == 0 && ydir == 0 && GravAccel == 0)
827  {
828  return false;
829  }
830  // If the object is above the landscape flying upwards in no/negative gravity, abort
831  if (ydir <= 0 && GravAccel <= 0 && current_y < 0)
832  {
833  return false;
834  }
835  // Set target position by momentum
836  x += xdir;
837  y += ydir;
838  // Set target position, then iterate towards this position, checking for contact
839  target_x = fixtoi(x);
840  target_y = fixtoi(y);
841  // Is the target position outside of the landscape?
842  if (!Inside<int32_t>(target_x, 0, ::Landscape.GetWidth()) || (target_y >= ::Landscape.GetHeight()))
843  {
844  return false;
845  }
846  // Check the way towards the target position, by doing minimal movement steps
847  do
848  {
849  // Set next step target
850  current_x += Sign(target_x - current_x);
851  current_y += Sign(target_y - current_y);
852  // Contact check
853  if (Inside(GBackDensity(current_x, current_y), min_density, max_density))
854  {
855  break_main_loop = true;
856  break;
857  }
858  }
859  while ((current_x != target_x) || (current_y != target_y));
860  // Adjust GravAccel once per frame
861  ydir += GravAccel;
862  }
863  while (!break_main_loop);
864  // Write position back
865  x = itofix(current_x);
866  y = itofix(current_y);
867 
868  // How many steps did it take to get here?
869  iterations -= index;
870 
871  return hit_on_time;
872 }
C4Landscape Landscape
int32_t GBackDensity(int32_t x, int32_t y)
Definition: C4Landscape.h:224
#define GravAccel
Definition: C4Physics.h:27
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
int Sign(T val)
Definition: Standard.h:45
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:43
int32_t GetWidth() const
int32_t GetHeight() const

References fixtoi(), GBackDensity(), C4Landscape::GetHeight(), C4Landscape::GetWidth(), GravAccel, Inside(), itofix(), Landscape, and Sign().

Referenced by SimFlightHitsLiquid().

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

Variable Documentation

◆ C4ScriptGameConstMap

C4ScriptConstDef C4ScriptGameConstMap

Definition at line 3348 of file C4GameScript.cpp.

Referenced by InitGameFunctionMap().

◆ C4ScriptGameFnMap

C4ScriptFnDef C4ScriptGameFnMap
Initial value:
=
{
{ "FindObject", true, C4V_Object, { C4V_Array ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnFindObject },
{ "FindObjects", true, C4V_Array, { C4V_Array ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnFindObjects },
{ "ObjectCount", true, C4V_Int, { C4V_Array ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnObjectCount },
{ "GameCallEx", true, C4V_Any, { C4V_String ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnGameCallEx },
{ "PlayerMessage", true, C4V_Int, { C4V_Int ,C4V_String ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnPlayerMessage },
{ "Message", true, C4V_Bool, { C4V_String ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnMessage },
{ "AddMessage", true, C4V_Bool, { C4V_String ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnAddMessage },
{ "PV_KeyFrames", true, C4V_Array, { C4V_Int ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any ,C4V_Any}, FnPV_KeyFrames },
{ nullptr, false, C4V_Nil, { C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil ,C4V_Nil}, nullptr }
}
@ C4V_Object
Definition: C4Value.h:38
@ C4V_Any
Definition: C4Value.h:37
@ C4V_Bool
Definition: C4Value.h:27
@ C4V_Array
Definition: C4Value.h:30
@ C4V_Nil
Definition: C4Value.h:25
@ C4V_String
Definition: C4Value.h:29

Definition at line 3486 of file C4GameScript.cpp.

Referenced by InitGameFunctionMap().