forked from Mirrors/openclonk
Remove C4Wrappers and put most functions in relevant headers
This also removes the TickXXX #defines and moves the lookup of predefined materials to C4Material.stable-5.2
parent
46d0d93dfc
commit
009cfc9e7b
|
@ -157,7 +157,6 @@ add_executable(clonk WIN32 MACOSX_BUNDLE
|
|||
engine/src/C4Viewport.cpp
|
||||
engine/src/C4Weather.cpp
|
||||
engine/src/C4WinMain.cpp
|
||||
engine/src/C4Wrappers.cpp
|
||||
engine/sec/C4ConfigShareware.cpp
|
||||
engine/sec/C4ConfigShareware.h
|
||||
engine/sec/C4SecurityCertificates.cpp
|
||||
|
@ -304,7 +303,6 @@ add_executable(clonk WIN32 MACOSX_BUNDLE
|
|||
engine/inc/C4VideoPlayback.h
|
||||
engine/inc/C4Viewport.h
|
||||
engine/inc/C4Weather.h
|
||||
engine/inc/C4Wrappers.h
|
||||
engine/inc/C4RoundResults.h
|
||||
engine/src/C4RoundResults.cpp
|
||||
engine/res/Brush.h
|
||||
|
|
|
@ -226,7 +226,6 @@ clonk_SOURCES = \
|
|||
engine/src/C4Viewport.cpp \
|
||||
engine/src/C4Weather.cpp \
|
||||
engine/src/C4WinMain.cpp \
|
||||
engine/src/C4Wrappers.cpp \
|
||||
engine/sec/C4ConfigShareware.cpp \
|
||||
engine/sec/C4ConfigShareware.h \
|
||||
engine/sec/C4SecurityCertificates.cpp \
|
||||
|
@ -373,7 +372,6 @@ clonk_SOURCES = \
|
|||
engine/inc/C4VideoPlayback.h \
|
||||
engine/inc/C4Viewport.h \
|
||||
engine/inc/C4Weather.h \
|
||||
engine/inc/C4Wrappers.h \
|
||||
engine/inc/C4RoundResults.h \
|
||||
engine/src/C4RoundResults.cpp \
|
||||
engine/res/Brush.h \
|
||||
|
|
|
@ -431,6 +431,11 @@ class C4DefList
|
|||
|
||||
extern C4DefList Definitions;
|
||||
|
||||
inline C4Def *C4Id2Def(C4ID id)
|
||||
{
|
||||
return ::Definitions.ID2Def(id);
|
||||
}
|
||||
|
||||
// Default Action Procedures
|
||||
|
||||
#define DFA_NONE -1
|
||||
|
|
|
@ -133,7 +133,7 @@ class C4Game
|
|||
bool TempScenarioFile;
|
||||
bool fPreinited; // set after PreInit has been called; unset by Clear and Default
|
||||
int32_t FrameCounter;
|
||||
int32_t iTick2,iTick3,iTick5,iTick10,iTick35,iTick255,iTick500,iTick1000;
|
||||
int32_t iTick2,iTick3,iTick5,iTick10,iTick35,iTick255,iTick1000;
|
||||
bool TimeGo;
|
||||
int32_t Time;
|
||||
int32_t StartTime;
|
||||
|
@ -292,7 +292,6 @@ class C4Game
|
|||
BOOL OpenScenario();
|
||||
BOOL InitDefs();
|
||||
BOOL InitMaterialTexture();
|
||||
BOOL EnumerateMaterials();
|
||||
BOOL GameOverCheck();
|
||||
BOOL PlaceInEarth(C4ID id);
|
||||
BOOL Compile(const char *szSource);
|
||||
|
|
|
@ -120,4 +120,5 @@ class C4GraphicsResource
|
|||
};
|
||||
|
||||
extern C4GraphicsResource GraphicsResource;
|
||||
#define GfxR (&(::GraphicsResource))
|
||||
#endif
|
||||
|
|
|
@ -250,7 +250,6 @@
|
|||
#include "C4Video.h"
|
||||
#include "C4Viewport.h"
|
||||
#include "C4Weather.h"
|
||||
#include "C4Wrappers.h"
|
||||
#endif
|
||||
|
||||
#endif // INC_C4Include
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "C4Shape.h"
|
||||
|
||||
#include <StdSurface8.h>
|
||||
#include <C4Material.h>
|
||||
|
||||
const uint8_t GBM = 128,
|
||||
GBM_ColNum = 64,
|
||||
|
@ -253,5 +254,81 @@ BOOL PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL,
|
|||
BOOL PathFreeIgnoreVehicle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL, int32_t *iy=NULL);
|
||||
BOOL FindClosestFree(int32_t &rX, int32_t &rY, int32_t iAngle1, int32_t iAngle2, int32_t iExcludeAngle1, int32_t iExcludeAngle2);
|
||||
BOOL ConstructionCheck(C4ID id, int32_t iX, int32_t iY, C4Object *pByObj=NULL);
|
||||
int32_t PixCol2Mat(BYTE pixc);
|
||||
|
||||
#define GBackWdt ::Landscape.Width
|
||||
#define GBackHgt ::Landscape.Height
|
||||
#define GBackPix ::Landscape.GetPix
|
||||
#define SBackPix ::Landscape.SetPix
|
||||
#define ClearBackPix ::Landscape.ClearPix
|
||||
#define _GBackPix ::Landscape._GetPix
|
||||
#define _SBackPix ::Landscape._SetPix
|
||||
#define _SBackPixIfMask ::Landscape._SetPixIfMask
|
||||
|
||||
inline bool DensitySolid(int32_t dens)
|
||||
{
|
||||
return (dens>=C4M_Solid);
|
||||
}
|
||||
|
||||
inline bool DensitySemiSolid(int32_t dens)
|
||||
{
|
||||
return (dens>=C4M_SemiSolid);
|
||||
}
|
||||
|
||||
inline bool DensityLiquid(int32_t dens)
|
||||
{
|
||||
return ((dens>=C4M_Liquid) && (dens<C4M_Solid));
|
||||
}
|
||||
|
||||
inline BYTE PixColIFT(BYTE pixc)
|
||||
{
|
||||
return pixc & IFT;
|
||||
}
|
||||
|
||||
// always use OldGfx-version (used for convert)
|
||||
inline BYTE PixColIFTOld(BYTE pixc)
|
||||
{
|
||||
if (pixc>=GBM+IFTOld) return IFTOld;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int32_t PixCol2Tex(BYTE pixc)
|
||||
{
|
||||
// Remove IFT
|
||||
int32_t iTex = int32_t(pixc & (IFT - 1));
|
||||
// Validate
|
||||
if(iTex >= C4M_MaxTexIndex) return 0;
|
||||
// Done
|
||||
return iTex;
|
||||
}
|
||||
|
||||
inline BYTE GBackIFT(int32_t x, int32_t y)
|
||||
{
|
||||
return PixColIFT(GBackPix(x,y));
|
||||
}
|
||||
|
||||
inline int32_t GBackMat(int32_t x, int32_t y)
|
||||
{
|
||||
return ::Landscape.GetMat(x, y);
|
||||
}
|
||||
|
||||
inline int32_t GBackDensity(int32_t x, int32_t y)
|
||||
{
|
||||
return ::Landscape.GetDensity(x, y);
|
||||
}
|
||||
|
||||
inline bool GBackSolid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensitySolid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
inline bool GBackSemiSolid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensitySemiSolid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
inline bool GBackLiquid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensityLiquid(GBackDensity(x,y));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -192,7 +192,7 @@ class C4MaterialMap
|
|||
C4MaterialReaction *GetReaction(int32_t iPXSMat, int32_t iLandscapeMat);
|
||||
#ifdef C4ENGINE
|
||||
void UpdateScriptPointers(); // set all material script pointers
|
||||
void CrossMapMaterials();
|
||||
bool CrossMapMaterials();
|
||||
#endif
|
||||
protected:
|
||||
void SetMatReaction(int32_t iPXSMat, int32_t iLSMat, C4MaterialReaction *pReact);
|
||||
|
@ -216,4 +216,48 @@ const int32_t C4M_Flat = 0,
|
|||
|
||||
const int32_t MNone = -1;
|
||||
|
||||
extern int32_t MVehic,MTunnel,MWater,MSnow,MEarth,MGranite,MFlyAshes; // presearched materials
|
||||
extern BYTE MCVehic; // precalculated material color
|
||||
|
||||
inline bool MatValid(int32_t mat)
|
||||
{
|
||||
return Inside<int32_t>(mat,0,::MaterialMap.Num-1);
|
||||
}
|
||||
|
||||
inline bool MatVehicle(int32_t iMat)
|
||||
{
|
||||
return iMat == MVehic;
|
||||
}
|
||||
|
||||
inline BYTE MatTex2PixCol(int32_t tex)
|
||||
{
|
||||
return BYTE(tex);
|
||||
}
|
||||
|
||||
inline BYTE Mat2PixColDefault(int32_t mat)
|
||||
{
|
||||
return ::MaterialMap.Map[mat].DefaultMatTex;
|
||||
}
|
||||
|
||||
inline int32_t MatDensity(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return ::MaterialMap.Map[mat].Density;
|
||||
}
|
||||
|
||||
inline int32_t MatPlacement(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return ::MaterialMap.Map[mat].Placement;
|
||||
}
|
||||
|
||||
inline int32_t MatDigFree(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 1;
|
||||
return ::MaterialMap.Map[mat].DigFree;
|
||||
}
|
||||
|
||||
int32_t PixCol2MatOld(BYTE pixc);
|
||||
int32_t PixCol2MatOld2(BYTE pixc);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -92,4 +92,6 @@ class C4PlayerList
|
|||
friend class C4Player;
|
||||
};
|
||||
|
||||
int32_t ValidPlr(int32_t plr);
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2);
|
||||
#endif
|
||||
|
|
|
@ -134,4 +134,12 @@ class C4SoundSystem
|
|||
int32_t EffectInBank(const char *szSound);
|
||||
};
|
||||
|
||||
class C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop = false, int32_t iVolume = 100, C4Object *pObj=NULL, int32_t iCustomFalloffDistance=0);
|
||||
class C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t iY, bool fLoop = false, int32_t iVolume = 100);
|
||||
class C4SoundInstance *GetSoundInstance(const char *szSndName, C4Object *pObj);
|
||||
void StopSoundEffect(const char *szSndName, C4Object *pObj);
|
||||
void SoundLevel(const char *szSndName, C4Object *pObj, int32_t iLevel);
|
||||
void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef INC_C4Weather
|
||||
#define INC_C4Weather
|
||||
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
class C4Weather
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 1998-2000, 2007 Matthes Bender
|
||||
* Copyright (c) 2001-2002 Sven Eberhardt
|
||||
* Copyright (c) 2005, 2007 Peter Wortmann
|
||||
* Copyright (c) 2006-2007 Günther Brammer
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Some useful wrappers to globals */
|
||||
|
||||
#ifndef INC_C4Wrappers
|
||||
#define INC_C4Wrappers
|
||||
|
||||
#ifdef C4ENGINE
|
||||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Id.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Log.h>
|
||||
#include "C4Texture.h"
|
||||
#include "C4GraphicsSystem.h"
|
||||
#include "C4GraphicsResource.h"
|
||||
#include <C4Material.h>
|
||||
#endif
|
||||
|
||||
//=================================== ID2Def ==============================================
|
||||
|
||||
inline C4Def *C4Id2Def(C4ID id)
|
||||
{
|
||||
return ::Definitions.ID2Def(id);
|
||||
}
|
||||
|
||||
//=============================== Sound ==================================================
|
||||
|
||||
class C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop = false, int32_t iVolume = 100, C4Object *pObj=NULL, int32_t iCustomFalloffDistance=0);
|
||||
class C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t iY, bool fLoop = false, int32_t iVolume = 100);
|
||||
class C4SoundInstance *GetSoundInstance(const char *szSndName, C4Object *pObj);
|
||||
void StopSoundEffect(const char *szSndName, C4Object *pObj);
|
||||
void SoundLevel(const char *szSndName, C4Object *pObj, int32_t iLevel);
|
||||
void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan);
|
||||
|
||||
//=========================== Graphics Resource =========================================
|
||||
|
||||
#define GfxR (&(::GraphicsResource))
|
||||
|
||||
|
||||
//===================================== Ticks ==========================================
|
||||
|
||||
#define Tick2 Game.iTick2
|
||||
#define Tick3 Game.iTick3
|
||||
#define Tick5 Game.iTick5
|
||||
#define Tick10 Game.iTick10
|
||||
#define Tick35 Game.iTick35
|
||||
#define Tick255 Game.iTick255
|
||||
#define Tick500 Game.iTick500
|
||||
#define Tick1000 Game.iTick1000
|
||||
|
||||
//================================== Players ============================================
|
||||
|
||||
int32_t ValidPlr(int32_t plr);
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2);
|
||||
|
||||
//==================================== IFT ===============================================
|
||||
|
||||
inline BYTE PixColIFT(BYTE pixc)
|
||||
{
|
||||
return pixc & IFT;
|
||||
}
|
||||
|
||||
// always use OldGfx-version (used for convert)
|
||||
inline BYTE PixColIFTOld(BYTE pixc)
|
||||
{
|
||||
if (pixc>=GBM+IFTOld) return IFTOld;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==================================== Density ===========================================
|
||||
|
||||
inline bool DensitySolid(int32_t dens)
|
||||
{
|
||||
return (dens>=C4M_Solid);
|
||||
}
|
||||
|
||||
inline bool DensitySemiSolid(int32_t dens)
|
||||
{
|
||||
return (dens>=C4M_SemiSolid);
|
||||
}
|
||||
|
||||
inline bool DensityLiquid(int32_t dens)
|
||||
{
|
||||
return ((dens>=C4M_Liquid) && (dens<C4M_Solid));
|
||||
}
|
||||
|
||||
//==================================== Materials =========================================
|
||||
|
||||
extern int32_t MVehic,MTunnel,MWater,MSnow,MEarth,MGranite,MFlyAshes; // presearched materials
|
||||
extern BYTE MCVehic; // precalculated material color
|
||||
|
||||
#define GBackWdt ::Landscape.Width
|
||||
#define GBackHgt ::Landscape.Height
|
||||
#define GBackPix ::Landscape.GetPix
|
||||
#define SBackPix ::Landscape.SetPix
|
||||
#define ClearBackPix ::Landscape.ClearPix
|
||||
#define _GBackPix ::Landscape._GetPix
|
||||
#define _SBackPix ::Landscape._SetPix
|
||||
#define _SBackPixIfMask ::Landscape._SetPixIfMask
|
||||
|
||||
int32_t PixCol2MatOld(BYTE pixc);
|
||||
int32_t PixCol2MatOld2(BYTE pixc);
|
||||
|
||||
inline bool MatValid(int32_t mat)
|
||||
{
|
||||
return Inside<int32_t>(mat,0,::MaterialMap.Num-1);
|
||||
}
|
||||
|
||||
inline bool MatVehicle(int32_t iMat)
|
||||
{
|
||||
return iMat == MVehic;
|
||||
}
|
||||
|
||||
inline int32_t PixCol2Tex(BYTE pixc)
|
||||
{
|
||||
// Remove IFT
|
||||
int32_t iTex = int32_t(pixc & (IFT - 1));
|
||||
// Validate
|
||||
if(iTex >= C4M_MaxTexIndex) return 0;
|
||||
// Done
|
||||
return iTex;
|
||||
}
|
||||
|
||||
inline int32_t PixCol2Mat(BYTE pixc)
|
||||
{
|
||||
// Get texture
|
||||
int32_t iTex = PixCol2Tex(pixc);
|
||||
if(!iTex) return MNone;
|
||||
// Get material-texture mapping
|
||||
const C4TexMapEntry *pTex = ::TextureMap.GetEntry(iTex);
|
||||
// Return material
|
||||
return pTex ? pTex->GetMaterialIndex() : MNone;
|
||||
}
|
||||
|
||||
inline BYTE MatTex2PixCol(int32_t tex)
|
||||
{
|
||||
return BYTE(tex);
|
||||
}
|
||||
|
||||
inline BYTE Mat2PixColDefault(int32_t mat)
|
||||
{
|
||||
return ::MaterialMap.Map[mat].DefaultMatTex;
|
||||
}
|
||||
|
||||
inline int32_t MatDensity(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return ::MaterialMap.Map[mat].Density;
|
||||
}
|
||||
|
||||
inline int32_t MatPlacement(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return ::MaterialMap.Map[mat].Placement;
|
||||
}
|
||||
|
||||
inline int32_t MatDigFree(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 1;
|
||||
return ::MaterialMap.Map[mat].DigFree;
|
||||
}
|
||||
|
||||
inline BYTE GBackIFT(int32_t x, int32_t y)
|
||||
{
|
||||
return PixColIFT(GBackPix(x,y));
|
||||
}
|
||||
|
||||
inline int32_t GBackMat(int32_t x, int32_t y)
|
||||
{
|
||||
return ::Landscape.GetMat(x, y);
|
||||
}
|
||||
|
||||
inline int32_t GBackDensity(int32_t x, int32_t y)
|
||||
{
|
||||
return ::Landscape.GetDensity(x, y);
|
||||
}
|
||||
|
||||
inline bool GBackSolid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensitySolid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
inline bool GBackSemiSolid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensitySemiSolid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
inline bool GBackLiquid(int32_t x, int32_t y)
|
||||
{
|
||||
return DensityLiquid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
//==================================== StdCompiler =========================================
|
||||
|
||||
void StdCompilerWarnCallback(void *pData, const char *szPosition, const char *szError);
|
||||
|
||||
template <class CompT, class StructT>
|
||||
bool CompileFromBuf_Log(StructT &TargetStruct, const typename CompT::InT &SrcBuf, const char *szName)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompileFromBuf<CompT>(TargetStruct, SrcBuf);
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
template <class CompT, class StructT>
|
||||
bool CompileFromBuf_LogWarn(StructT RREF TargetStruct, const typename CompT::InT &SrcBuf, const char *szName)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompT Compiler;
|
||||
Compiler.setInput(SrcBuf.getRef());
|
||||
Compiler.setWarnCallback(StdCompilerWarnCallback, reinterpret_cast<void *>(const_cast<char *>(szName)));
|
||||
Compiler.Compile(TargetStruct);
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
if(!pExc->Pos.getLength())
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
else
|
||||
LogF("ERROR: %s (in %s, %s)", pExc->Msg.getData(), pExc->Pos.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
template <class CompT, class StructT>
|
||||
bool DecompileToBuf_Log(StructT RREF TargetStruct, typename CompT::OutT *pOut, const char *szName)
|
||||
{
|
||||
if(!pOut) return false;
|
||||
try
|
||||
{
|
||||
pOut->Take(DecompileToBuf<CompT>(TargetStruct));
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // C4ENGINE
|
||||
|
||||
#endif
|
|
@ -26,7 +26,8 @@
|
|||
#include <C4Object.h>
|
||||
#include <C4Config.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Log.h>
|
||||
#endif
|
||||
|
||||
C4AulExecError::C4AulExecError(C4Object *pObj, const char *szError) : cObj(pObj)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Def.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG_BYTECODE_DUMP 0
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
#include <C4GameMessage.h>
|
||||
#include <C4ObjectMenu.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
const int32_t MoveToRange=5,LetGoRange1=7,LetGoRange2=30,DigRange=1;
|
||||
|
@ -255,7 +256,7 @@ void C4Command::MoveTo()
|
|||
PathChecked=TRUE;
|
||||
}
|
||||
// Path recheck
|
||||
if (!Tick35) PathChecked=FALSE;
|
||||
if (!::Game.iTick35) PathChecked=FALSE;
|
||||
|
||||
// Pushing grab only or not desired: let go (pulling, too?)
|
||||
if (cObj->GetProcedure()==DFA_PUSH)
|
||||
|
@ -359,7 +360,7 @@ void C4Command::MoveTo()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case DFA_SWIM:
|
||||
// Head to target
|
||||
if (Tick2)
|
||||
if (::Game.iTick2)
|
||||
{ if (cx<Tx._getInt()-iTargetRange) cObj->Action.ComDir=COMD_Right;
|
||||
if (cx>Tx._getInt()+iTargetRange) cObj->Action.ComDir=COMD_Left; }
|
||||
else
|
||||
|
@ -1820,7 +1821,7 @@ void C4Command::Transfer()
|
|||
}
|
||||
|
||||
// Call target transfer script
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
{
|
||||
|
||||
C4AulScriptFunc *f;
|
||||
|
|
|
@ -34,12 +34,14 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Console.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4MassMover.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
// *** C4ControlPacket
|
||||
|
|
|
@ -36,10 +36,11 @@
|
|||
#include <C4Config.h>
|
||||
#include <C4ValueList.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4Game.h>
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Object.h>
|
||||
#include "C4Network2Res.h"
|
||||
#include <C4Material.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,8 +31,11 @@
|
|||
#include <C4Object.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4PXS.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Object.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Random.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <C4Components.h>
|
||||
#include <C4Game.h>
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <C4Components.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Surface.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include <C4Console.h>
|
||||
#include <C4Network2Stats.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4GameOverDlg.h>
|
||||
#include <C4ObjectMenu.h>
|
||||
|
@ -66,6 +65,10 @@
|
|||
#include <C4GameMessage.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4Landscape.h>
|
||||
#endif
|
||||
|
||||
#include <StdFile.h>
|
||||
|
@ -621,7 +624,7 @@ BOOL C4Game::GameOverCheck()
|
|||
#endif
|
||||
|
||||
// Only every 35 ticks
|
||||
if (Tick35) return FALSE;
|
||||
if (::Game.iTick35) return FALSE;
|
||||
|
||||
// do not GameOver in replay
|
||||
if (Control.isReplay()) return FALSE;
|
||||
|
@ -916,10 +919,11 @@ BOOL C4Game::InitMaterialTexture()
|
|||
TextureMap.Init();
|
||||
|
||||
// Cross map mats (after texture init, because Material-Texture-combinations are used)
|
||||
::MaterialMap.CrossMapMaterials();
|
||||
if (!::MaterialMap.CrossMapMaterials()) return false;
|
||||
|
||||
// Enumerate materials
|
||||
if (!EnumerateMaterials()) return FALSE;
|
||||
// mapping to landscape palette will occur when landscape has been created
|
||||
// set the pal
|
||||
::GraphicsSystem.SetPalette();
|
||||
|
||||
// get material script funcs
|
||||
::MaterialMap.UpdateScriptPointers();
|
||||
|
@ -1484,7 +1488,7 @@ int32_t C4Game::ObjectCount(C4ID id,
|
|||
// Deletes removal-assigned data from list.
|
||||
// Pointer clearance is done by AssignRemoval.
|
||||
|
||||
void C4Game::ObjectRemovalCheck() // Every Tick255 by ExecObjects
|
||||
void C4Game::ObjectRemovalCheck() // Every ::Game.iTick255 by ExecObjects
|
||||
{
|
||||
C4Object *cObj; C4ObjectLink *clnk,*next;
|
||||
for (clnk=Objects.First; clnk && (cObj=clnk->Obj); clnk=next)
|
||||
|
@ -1541,7 +1545,7 @@ void C4Game::ExecObjects() // Every Tick1 by Execute
|
|||
#endif
|
||||
|
||||
// Removal
|
||||
if (!Tick255) ObjectRemovalCheck();
|
||||
if (!::Game.iTick255) ObjectRemovalCheck();
|
||||
}
|
||||
|
||||
BOOL C4Game::CreateViewport(int32_t iPlayer, bool fSilent)
|
||||
|
@ -1602,30 +1606,6 @@ BOOL C4Game::DropDef(C4ID id, float X, float Y)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL C4Game::EnumerateMaterials()
|
||||
{
|
||||
|
||||
// Check material number
|
||||
if (::MaterialMap.Num>C4MaxMaterial)
|
||||
{ LogFatal(LoadResStr("IDS_PRC_TOOMANYMATS")); return FALSE; }
|
||||
|
||||
// Get hardcoded system material indices
|
||||
MVehic = ::MaterialMap.Get("Vehicle"); MCVehic = Mat2PixColDefault(MVehic);
|
||||
MTunnel = ::MaterialMap.Get("Tunnel");
|
||||
MWater = ::MaterialMap.Get("Water");
|
||||
MSnow = ::MaterialMap.Get("Snow");
|
||||
MGranite = ::MaterialMap.Get("Granite");
|
||||
MFlyAshes= ::MaterialMap.Get("FlyAshes");
|
||||
MEarth = ::MaterialMap.Get(C4S.Landscape.Material);
|
||||
if ((MVehic==MNone) || (MTunnel==MNone))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_NOSYSMATS")); return FALSE; }
|
||||
// mapping to landscape palette will occur when landscape has been created
|
||||
// set the pal
|
||||
::GraphicsSystem.SetPalette();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void C4Game::CastObjects(C4ID id, C4Object *pCreator, int32_t num, int32_t level, int32_t tx, int32_t ty, int32_t iOwner, int32_t iController) {
|
||||
int32_t cnt;
|
||||
for (cnt=0; cnt<num; cnt++) {
|
||||
|
@ -1679,7 +1659,7 @@ void C4Game::Default()
|
|||
fScriptCreatedObjects=FALSE;
|
||||
fLobby=fObserve=FALSE;
|
||||
iLobbyTimeout=0;
|
||||
iTick2=iTick3=iTick5=iTick10=iTick35=iTick255=iTick500=iTick1000=0;
|
||||
iTick2=iTick3=iTick5=iTick10=iTick35=iTick255=iTick1000=0;
|
||||
ObjectEnumerationIndex=0;
|
||||
FullSpeed=FALSE;
|
||||
FrameSkip=1; DoSkipFrame=false;
|
||||
|
@ -1804,7 +1784,6 @@ void C4Game::Ticks()
|
|||
if (++iTick10==10) iTick10=0;
|
||||
if (++iTick35==35) iTick35=0;
|
||||
if (++iTick255==255) iTick255=0;
|
||||
if (++iTick500==500) iTick500=0;
|
||||
if (++iTick1000==1000) iTick1000=0;
|
||||
// FPS / time
|
||||
cFPS++; TimeGo = true;
|
||||
|
@ -1849,7 +1828,6 @@ void C4Game::CompileFunc(StdCompiler *pComp, CompileSettings comp)
|
|||
pComp->Value(mkNamingAdapt(iTick10, "Tick10", 0));
|
||||
pComp->Value(mkNamingAdapt(iTick35, "Tick35", 0));
|
||||
pComp->Value(mkNamingAdapt(iTick255, "Tick255", 0));
|
||||
pComp->Value(mkNamingAdapt(iTick500, "Tick500", 0));
|
||||
pComp->Value(mkNamingAdapt(iTick1000, "Tick1000", 0));
|
||||
pComp->Value(mkNamingAdapt(StartupPlayerCount, "StartupPlayerCount", 0));
|
||||
pComp->Value(mkNamingAdapt(ObjectEnumerationIndex,"ObjectEnumerationIndex",0));
|
||||
|
@ -3757,7 +3735,7 @@ void C4Game::InitGoals()
|
|||
|
||||
void C4Game::UpdateRules()
|
||||
{
|
||||
if (Tick255) return;
|
||||
if (::Game.iTick255) return;
|
||||
Rules=0;
|
||||
if (ObjectCount(C4ID_Energy)) Rules|=C4RULE_StructuresNeedEnergy;
|
||||
if (ObjectCount(C4ID_CnMaterial)) Rules|=C4RULE_ConstructionNeedsMaterial;
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#include "C4Network2Dialogs.h"
|
||||
#include "C4GameOptions.h"
|
||||
#include "C4GameDialogs.h"
|
||||
#include "C4Wrappers.h"
|
||||
#include "C4RTF.H"
|
||||
#include "C4ChatDlg.h"
|
||||
#include "C4PlayerInfoListBox.h"
|
||||
#include <C4MessageInput.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
namespace C4GameLobby {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <C4SolidMask.h>
|
||||
#include <C4Network2Stats.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#endif
|
||||
|
||||
C4GameObjects::C4GameObjects()
|
||||
|
@ -105,10 +105,10 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
// Checks for this frame
|
||||
focf=tocf=OCF_None;
|
||||
// Medium level: Fight
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
{ focf|=OCF_FightReady; tocf|=OCF_FightReady; }
|
||||
// Very low level: Incineration
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
{ focf|=OCF_OnFire; tocf|=OCF_Inflammable; }
|
||||
|
||||
if (focf && tocf)
|
||||
|
@ -143,7 +143,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
|
||||
focf=tocf=OCF_None;
|
||||
// High level: Collection, Hit
|
||||
if (!Tick3)
|
||||
if (!::Game.iTick3)
|
||||
{ focf|=OCF_Collection; tocf|=OCF_Carryable; }
|
||||
focf|=OCF_Alive; tocf|=OCF_HitSpeed2;
|
||||
|
||||
|
@ -174,7 +174,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
iHitEnergy = Max<int32_t>(iHitEnergy/3, !!iHitEnergy); // hit energy reduced to 1/3rd, but do not drop to zero because of this division
|
||||
obj1->DoEnergy(-iHitEnergy/5, false, C4FxCall_EngObjHit, obj2->Controller);
|
||||
int tmass=Max<int32_t>(obj1->Mass,50);
|
||||
if (!Tick3 || (obj1->Action.Act>=0 && obj1->Def->ActMap[obj1->Action.Act].Procedure != DFA_FLIGHT))
|
||||
if (!::Game.iTick3 || (obj1->Action.Act>=0 && obj1->Def->ActMap[obj1->Action.Act].Procedure != DFA_FLIGHT))
|
||||
obj1->Fling(obj2->xdir*50/tmass,-Abs(obj2->ydir/2)*50/tmass, false);
|
||||
obj1->Call(PSF_CatchBlow,&C4AulParSet(C4VInt(-iHitEnergy/5),
|
||||
C4VObj(obj2)));
|
||||
|
@ -214,7 +214,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
// Checks for this frame
|
||||
focf=tocf=OCF_None;
|
||||
// Low level: Fight
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
{ focf|=OCF_FightReady; tocf|=OCF_FightReady; }
|
||||
|
||||
if (focf && tocf)
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include "C4Log.h"
|
||||
#include "C4Components.h"
|
||||
|
||||
#include "C4Wrappers.h"
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
// *** C4GameRes
|
||||
|
|
|
@ -33,10 +33,13 @@
|
|||
#include <C4FullScreen.h>
|
||||
#include <C4Gui.h>
|
||||
#include <C4LoaderScreen.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4SoundSystem.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Network2.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#include <StdPNG.h>
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
#include <C4LoaderScreen.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4GamePadCon.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#endif
|
||||
|
||||
namespace C4GUI {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4Gui.h>
|
||||
#include <C4FacetEx.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4MouseControl.h>
|
||||
|
||||
#include <StdWindow.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4Gui.h>
|
||||
#include <C4FacetEx.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4MouseControl.h>
|
||||
|
||||
#include <StdWindow.h>
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
#include <C4Viewport.h>
|
||||
#include <C4Console.h>
|
||||
#include <C4Def.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#include <StdGL.h>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4Gui.h>
|
||||
#include <C4FacetEx.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4MouseControl.h>
|
||||
|
||||
#include <StdWindow.h>
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include <C4RankSystem.h>
|
||||
#include <C4Group.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Game.h>
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4SolidMask.h>
|
||||
#include <C4Game.h>
|
||||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Map.h>
|
||||
|
@ -40,18 +41,18 @@
|
|||
#include <C4Material.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Stat.h>
|
||||
#include <C4MassMover.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Texture.h>
|
||||
#endif
|
||||
|
||||
#include <StdPNG.h>
|
||||
|
||||
int32_t MVehic=MNone,MTunnel=MNone,MWater=MNone,MSnow=MNone,MEarth=MNone,MGranite=MNone,MFlyAshes=MNone;
|
||||
BYTE MCVehic=0;
|
||||
|
||||
const int C4LS_MaxLightDistY = 8;
|
||||
const int C4LS_MaxLightDistX = 1;
|
||||
|
||||
|
@ -86,13 +87,13 @@ void C4Landscape::Execute()
|
|||
// move sky
|
||||
Sky.Execute();
|
||||
// Side open scan
|
||||
/*if (!Tick255)
|
||||
/*if (!::Game.iTick255)
|
||||
if (Game.C4S.LScape.AutoScanSideOpen)
|
||||
ScanSideOpen(); */
|
||||
#ifdef _DEBUG
|
||||
/*if(!Tick255)
|
||||
/*if(!::Game.iTick255)
|
||||
UpdatePixCnt(C4Rect(0, 0, Width, Height), true);
|
||||
if(!Tick255)
|
||||
if(!::Game.iTick255)
|
||||
{
|
||||
DWORD MatCountCheck[C4MaxMaterial], EffectiveMatCountCheck[C4MaxMaterial];
|
||||
int32_t iMat;
|
||||
|
@ -111,7 +112,7 @@ void C4Landscape::Execute()
|
|||
}*/
|
||||
#endif
|
||||
// Relights
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
DoRelights();
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1021,7 @@ void C4Landscape::DigFree(int32_t tx, int32_t ty, int32_t rad, BOOL fRequest, C4
|
|||
for (xcnt=-iLineWidth; xcnt<iLineWidth+(iLineWidth==0); xcnt++)
|
||||
DigFreeSinglePix(tx + xcnt, ty + rad, 0, +1);
|
||||
// Dig out material cast
|
||||
if (!Tick5) if (pByObj) pByObj->DigOutMaterialCast(fRequest);
|
||||
if (!::Game.iTick5) if (pByObj) pByObj->DigOutMaterialCast(fRequest);
|
||||
}
|
||||
|
||||
void C4Landscape::DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, BOOL fRequest, C4Object *pByObj)
|
||||
|
@ -1034,7 +1035,7 @@ void C4Landscape::DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt,
|
|||
// Clear single pixels
|
||||
|
||||
// Dig out material cast
|
||||
if (!Tick5) if (pByObj) pByObj->DigOutMaterialCast(fRequest);
|
||||
if (!::Game.iTick5) if (pByObj) pByObj->DigOutMaterialCast(fRequest);
|
||||
}
|
||||
|
||||
void C4Landscape::ShakeFree(int32_t tx, int32_t ty, int32_t rad)
|
||||
|
@ -2117,6 +2118,17 @@ BOOL ConstructionCheck(C4ID id, int32_t iX, int32_t iY, C4Object *pByObj)
|
|||
}
|
||||
|
||||
|
||||
int32_t PixCol2Mat(BYTE pixc)
|
||||
{
|
||||
// Get texture
|
||||
int32_t iTex = PixCol2Tex(pixc);
|
||||
if(!iTex) return MNone;
|
||||
// Get material-texture mapping
|
||||
const C4TexMapEntry *pTex = ::TextureMap.GetEntry(iTex);
|
||||
// Return material
|
||||
return pTex ? pTex->GetMaterialIndex() : MNone;
|
||||
}
|
||||
|
||||
void C4Landscape::ClearRect(int32_t iTx, int32_t iTy, int32_t iWdt, int32_t iHgt)
|
||||
{
|
||||
for (int32_t y=iTy; y<iTy+iHgt; y++)
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Game.h>
|
||||
#include <C4RoundResults.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
// *** C4LeagueRequestHead
|
||||
|
|
|
@ -25,10 +25,12 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4FullScreen.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4GameOverDlg.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
|
|
@ -23,16 +23,10 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4MapCreatorS2.h>
|
||||
#include <C4Random.h>
|
||||
|
||||
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#else
|
||||
#include <C4Aul.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Texture.h>
|
||||
#endif
|
||||
|
||||
/* --- C4MCCallbackArray --- */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#endif
|
||||
|
||||
// Note: creation optimized using advancing CreatePtr, so sequential
|
||||
|
|
|
@ -31,8 +31,14 @@
|
|||
#include <C4PXS.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4ToolsDlg.h> // For C4TLS_MatSky...
|
||||
#include <C4Texture.h>
|
||||
#include <C4Aul.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4SoundSystem.h>
|
||||
#include <C4Effects.h>
|
||||
#include <C4Game.h>
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Physics.h> // For GravAccel
|
||||
#endif
|
||||
|
||||
|
@ -42,6 +48,9 @@
|
|||
#include "C4CompilerWrapper.h"
|
||||
#endif
|
||||
|
||||
int32_t MVehic=MNone,MTunnel=MNone,MWater=MNone,MSnow=MNone,MEarth=MNone,MGranite=MNone,MFlyAshes=MNone;
|
||||
BYTE MCVehic=0;
|
||||
|
||||
// -------------------------------------- C4MaterialReaction
|
||||
|
||||
#ifdef C4ENGINE
|
||||
|
@ -350,8 +359,11 @@ int32_t C4MaterialMap::Get(const char *szMaterial)
|
|||
|
||||
#ifdef C4ENGINE
|
||||
|
||||
void C4MaterialMap::CrossMapMaterials() // Called after load
|
||||
{
|
||||
bool C4MaterialMap::CrossMapMaterials() // Called after load
|
||||
{
|
||||
// Check material number
|
||||
if (::MaterialMap.Num>C4MaxMaterial)
|
||||
{ LogFatal(LoadResStr("IDS_PRC_TOOMANYMATS")); return false; }
|
||||
// build reaction function map
|
||||
delete [] ppReactionMap;
|
||||
typedef C4MaterialReaction * C4MaterialReactionPtr;
|
||||
|
@ -515,6 +527,17 @@ void C4MaterialMap::CrossMapMaterials() // Called after load
|
|||
if (ppReactionMap[(cnt2+1)*(Num+1) + cnt+1])
|
||||
printf("%s -> %s: %p\n", Map[cnt].Name, Map[cnt2].Name, ppReactionMap[(cnt2+1)*(Num+1) + cnt+1]->pFunc);
|
||||
#endif
|
||||
// Get hardcoded system material indices
|
||||
MVehic = Get("Vehicle"); MCVehic = Mat2PixColDefault(MVehic);
|
||||
MTunnel = Get("Tunnel");
|
||||
MWater = Get("Water");
|
||||
MSnow = Get("Snow");
|
||||
MGranite = Get("Granite");
|
||||
MFlyAshes= Get("FlyAshes");
|
||||
MEarth = Get(Game.C4S.Landscape.Material);
|
||||
if ((MVehic==MNone) || (MTunnel==MNone))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_NOSYSMATS")); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -885,4 +908,24 @@ void C4MaterialMap::UpdateScriptPointers()
|
|||
|
||||
#endif
|
||||
|
||||
int32_t PixCol2MatOld(BYTE pixc)
|
||||
{
|
||||
if (pixc < GBM) return MNone;
|
||||
pixc &= 63; // Substract GBM, ignore IFT
|
||||
if (pixc > ::MaterialMap.Num*C4M_ColsPerMat-1) return MNone;
|
||||
return pixc / C4M_ColsPerMat;
|
||||
}
|
||||
|
||||
int32_t PixCol2MatOld2(BYTE pixc)
|
||||
{
|
||||
int32_t iMat = ((int32_t) (pixc&0x7f)) -1;
|
||||
// if above MVehic, don't forget additional vehicle-colors
|
||||
if (iMat<=MVehic) return iMat;
|
||||
// equals middle vehicle-color
|
||||
if (iMat==MVehic+1) return MVehic;
|
||||
// above: range check
|
||||
iMat-=2; if (iMat >= ::MaterialMap.Num) return MNone;
|
||||
return iMat;
|
||||
}
|
||||
|
||||
C4MaterialMap MaterialMap;
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
#include <C4FullScreen.h>
|
||||
#include <C4ObjectCom.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
const int32_t C4MN_DefInfoWdt = 270, // default width of info windows
|
||||
|
|
|
@ -32,9 +32,12 @@
|
|||
#include <C4Application.h>
|
||||
#include <C4FullScreen.h>
|
||||
#include <C4Gui.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Player.h>
|
||||
#include "C4ChatDlg.h"
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#endif
|
||||
|
||||
const int32_t C4MC_Drag_None = 0,
|
||||
|
@ -149,7 +152,7 @@ void C4MouseControl::Execute()
|
|||
if (!Active || !fMouseOwned) return;
|
||||
|
||||
// Scrolling/continuous update
|
||||
if (Scrolling || !Tick5)
|
||||
if (Scrolling || !::Game.iTick5)
|
||||
{
|
||||
WORD wKeyState=0;
|
||||
if (Application.IsControlDown()) wKeyState|=MK_CONTROL;
|
||||
|
@ -916,7 +919,7 @@ void C4MouseControl::DragNone()
|
|||
{
|
||||
// Hold down on region
|
||||
case C4MC_Cursor_Region:
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
if (DownRegion.HoldCom)
|
||||
SendControl(DownRegion.HoldCom);
|
||||
break;
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Physics.h>
|
||||
#include <C4SolidMask.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
/* Some physical constants */
|
||||
|
@ -528,7 +529,7 @@ BOOL C4Object::ExecMovement() // Every Tick1 by Execute
|
|||
// Check for stabilization
|
||||
Stabilize();
|
||||
// Check for mobilization
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
{
|
||||
// Gravity mobilization
|
||||
xdir=ydir=rdir=0;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#endif
|
||||
|
||||
#include <Midi.h>
|
||||
|
@ -370,7 +370,7 @@ void C4MusicSystem::Clear()
|
|||
void C4MusicSystem::Execute()
|
||||
{
|
||||
#ifndef HAVE_LIBSDL_MIXER
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
#endif
|
||||
if (Game.IsRunning ? Config.Sound.RXMusic : Config.Sound.FEMusic)
|
||||
if (!PlayMusicFile)
|
||||
|
|
|
@ -42,12 +42,15 @@
|
|||
#endif
|
||||
#include <C4SolidMask.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4ObjectMenu.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4GameVersion.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_t contact)
|
||||
|
@ -842,7 +845,7 @@ BOOL C4Object::ExecFire(int32_t iFireNumber, int32_t iCausedByPlr)
|
|||
// Fire Phase
|
||||
FirePhase++; if (FirePhase>=MaxFirePhase) FirePhase=0;
|
||||
// Extinguish in base
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
if (Category & C4D_Living)
|
||||
if (Contained && ValidPlr(Contained->Base))
|
||||
if (Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Extinguish)
|
||||
|
@ -851,9 +854,9 @@ BOOL C4Object::ExecFire(int32_t iFireNumber, int32_t iCausedByPlr)
|
|||
if (!Def->NoBurnDecay)
|
||||
DoCon(-100);
|
||||
// Damage
|
||||
if (!Tick10) if (!Def->NoBurnDamage) DoDamage(+2,iCausedByPlr,C4FxCall_DmgFire);
|
||||
if (!::Game.iTick10) if (!Def->NoBurnDamage) DoDamage(+2,iCausedByPlr,C4FxCall_DmgFire);
|
||||
// Energy
|
||||
if (!Tick5) DoEnergy(-1,false,C4FxCall_EngFire, iCausedByPlr);
|
||||
if (!::Game.iTick5) DoEnergy(-1,false,C4FxCall_EngFire, iCausedByPlr);
|
||||
// Effects
|
||||
int32_t smoke_level=2*Shape.Wdt/3;
|
||||
int32_t smoke_rate=Def->SmokeRate;
|
||||
|
@ -864,7 +867,7 @@ BOOL C4Object::ExecFire(int32_t iFireNumber, int32_t iCausedByPlr)
|
|||
Smoke(GetX(), GetY(),smoke_level);
|
||||
}
|
||||
// Background Effects
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
{
|
||||
int32_t mat;
|
||||
if (MatValid(mat=GBackMat(GetX(), GetY())))
|
||||
|
@ -896,7 +899,7 @@ BOOL C4Object::ExecLife()
|
|||
{
|
||||
|
||||
// Growth
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
// Growth specified by definition
|
||||
if (Def->Growth)
|
||||
// Alive livings && trees only
|
||||
|
@ -911,7 +914,7 @@ BOOL C4Object::ExecLife()
|
|||
|
||||
// Energy reload in base
|
||||
int32_t transfer;
|
||||
if (!Tick3) if (Alive)
|
||||
if (!::Game.iTick3) if (Alive)
|
||||
if (Contained && ValidPlr(Contained->Base))
|
||||
if (!Hostile(Owner,Contained->Base))
|
||||
if (Energy<GetPhysical()->Energy)
|
||||
|
@ -927,7 +930,7 @@ BOOL C4Object::ExecLife()
|
|||
}
|
||||
|
||||
// Magic reload
|
||||
if (!Tick3) if (Alive)
|
||||
if (!::Game.iTick3) if (Alive)
|
||||
if (Contained)
|
||||
if (!Hostile(Owner,Contained->Owner))
|
||||
if (MagicEnergy<GetPhysical()->Magic)
|
||||
|
@ -951,7 +954,7 @@ BOOL C4Object::ExecLife()
|
|||
}
|
||||
|
||||
// Breathing
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
if (Alive && !Def->NoBreath)
|
||||
{
|
||||
// Supply check
|
||||
|
@ -987,7 +990,7 @@ BOOL C4Object::ExecLife()
|
|||
}
|
||||
|
||||
// Corrosion energy loss
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
if (Alive)
|
||||
if (InMat!=MNone)
|
||||
if (::MaterialMap.Map[InMat].Corrosive)
|
||||
|
@ -995,14 +998,14 @@ BOOL C4Object::ExecLife()
|
|||
DoEnergy(-::MaterialMap.Map[InMat].Corrosive/15,false,C4FxCall_EngCorrosion, NO_OWNER);
|
||||
|
||||
// InMat incineration
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
if (InMat!=MNone)
|
||||
if (::MaterialMap.Map[InMat].Incindiary)
|
||||
if (Def->ContactIncinerate)
|
||||
Incinerate(NO_OWNER);
|
||||
|
||||
// Nonlife normal energy loss
|
||||
if (!Tick10) if (Energy)
|
||||
if (!::Game.iTick10) if (Energy)
|
||||
if (!(Category & C4D_Living))
|
||||
if (!ValidPlr(Base) || (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_RegenerateEnergy))
|
||||
// don't loose if assigned as Energy-holder
|
||||
|
@ -1010,7 +1013,7 @@ BOOL C4Object::ExecLife()
|
|||
DoEnergy(-1,false,C4FxCall_EngStruct, NO_OWNER);
|
||||
|
||||
// birthday
|
||||
if (!Tick255)
|
||||
if (!::Game.iTick255)
|
||||
if (Alive)
|
||||
if(Info)
|
||||
{
|
||||
|
@ -1055,7 +1058,7 @@ void C4Object::ExecBase()
|
|||
C4Object *flag;;
|
||||
|
||||
// New base assignment by flag (no old base removal)
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
if (Def->CanBeBase) if (!ValidPlr(Base))
|
||||
if (flag=Contents.Find(C4ID_Flag))
|
||||
if (ValidPlr(flag->Owner) && (flag->Owner!=Base))
|
||||
|
@ -1071,7 +1074,7 @@ void C4Object::ExecBase()
|
|||
}
|
||||
|
||||
// Base execution
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
if (ValidPlr(Base))
|
||||
{
|
||||
// Auto sell contents
|
||||
|
@ -1085,7 +1088,7 @@ void C4Object::ExecBase()
|
|||
}
|
||||
|
||||
// Environmental action
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
{
|
||||
// Structures dig free snow
|
||||
if ((Category & C4D_Structure) && !(Game.Rules & C4RULE_StructuresSnowIn))
|
||||
|
@ -1752,7 +1755,7 @@ BOOL C4Object::Chop(C4Object *pByObject)
|
|||
if (!Status || !Def || Contained || !(OCF & OCF_Chop))
|
||||
return FALSE;
|
||||
// Chop
|
||||
if (!Tick10) DoDamage( +10, pByObject ? pByObject->Owner : NO_OWNER, C4FxCall_DmgChop);
|
||||
if (!::Game.iTick10) DoDamage( +10, pByObject ? pByObject->Owner : NO_OWNER, C4FxCall_DmgChop);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1794,7 +1797,7 @@ BOOL C4Object::Push(FIXED txdir, FIXED dforce, BOOL fStraighten)
|
|||
if (!!xdir || !!ydir || !!rdir) Mobile=1;
|
||||
|
||||
// Stuck check
|
||||
if (!Tick35) if (txdir) if (!Def->NoHorizontalMove)
|
||||
if (!::Game.iTick35) if (txdir) if (!Def->NoHorizontalMove)
|
||||
if (ContactCheck(GetX(), GetY())) // Resets t_contact
|
||||
{
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_STUCK"),GetName()).getData(),this);
|
||||
|
@ -2435,7 +2438,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode)
|
|||
DrawSelectMark(cgo, 1);
|
||||
|
||||
// Energy shortage
|
||||
if (NeedEnergy) if (Tick35>12) if (eDrawMode!=ODM_BaseOnly)
|
||||
if (NeedEnergy) if (::Game.iTick35>12) if (eDrawMode!=ODM_BaseOnly)
|
||||
{
|
||||
C4Facet &fctEnergy = ::GraphicsResource.fctEnergy;
|
||||
int32_t tx=cox+Shape.Wdt/2-fctEnergy.Wdt/2, ty=coy-fctEnergy.Hgt-5;
|
||||
|
@ -4020,7 +4023,7 @@ void C4Object::DrawCommand(C4Facet &cgoBar, int32_t iAlign, const char *szFuncti
|
|||
DrawPicture(cgoRight);
|
||||
|
||||
// Command
|
||||
if (!fFlash || Tick35>15)
|
||||
if (!fFlash || ::Game.iTick35>15)
|
||||
DrawCommandKey(cgoLeft,iCom,FALSE,
|
||||
Config.Graphics.ShowCommandKeys ? PlrControlKeyName(iPlayer,Com2Control(iCom), true).getData() : NULL );
|
||||
|
||||
|
@ -4732,7 +4735,7 @@ void C4Object::ExecAction()
|
|||
lLimit=ValByPhysical(200, pPhysical->Scale);
|
||||
|
||||
// Physical training
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
if (Abs(ydir)==lLimit)
|
||||
TrainPhysical(&C4PhysicalInfo::Scale, 1, C4MaxPhysical);
|
||||
int ComDir = Action.ComDir;
|
||||
|
@ -4767,7 +4770,7 @@ void C4Object::ExecAction()
|
|||
lLimit=ValByPhysical(160, pPhysical->Hangle);
|
||||
|
||||
// Physical training
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
if (Abs(xdir)==lLimit)
|
||||
TrainPhysical(&C4PhysicalInfo::Hangle, 1, C4MaxPhysical);
|
||||
|
||||
|
@ -4800,7 +4803,7 @@ void C4Object::ExecAction()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case DFA_FLIGHT:
|
||||
// Contained: fall out (one try only)
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
if (Contained)
|
||||
{
|
||||
StopActionDelayCommand(this);
|
||||
|
@ -4845,7 +4848,7 @@ void C4Object::ExecAction()
|
|||
lLimit=ValByPhysical(160, pPhysical->Swim);
|
||||
|
||||
// Physical training
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
if (Abs(xdir)==lLimit)
|
||||
TrainPhysical(&C4PhysicalInfo::Swim, 1, C4MaxPhysical);
|
||||
|
||||
|
@ -5098,7 +5101,7 @@ void C4Object::ExecAction()
|
|||
// Valid check
|
||||
if (!Action.Target) { ObjectActionStand(this); return; }
|
||||
// Chop
|
||||
if (!Tick3)
|
||||
if (!::Game.iTick3)
|
||||
if (!Action.Target->Chop(this))
|
||||
{ ObjectActionStand(this); return; }
|
||||
// Valid check (again, target might have been destroyed)
|
||||
|
@ -5124,7 +5127,7 @@ void C4Object::ExecAction()
|
|||
{ ObjectActionStand(this); return; }
|
||||
|
||||
// Physical training
|
||||
if (!Tick5)
|
||||
if (!::Game.iTick5)
|
||||
TrainPhysical(&C4PhysicalInfo::Fight, 1, C4MaxPhysical);
|
||||
|
||||
// Direction
|
||||
|
@ -5147,7 +5150,7 @@ void C4Object::ExecAction()
|
|||
ydir=0;
|
||||
Mobile=1;
|
||||
// Experience
|
||||
if (!Tick35) DoExperience(+2);
|
||||
if (!::Game.iTick35) DoExperience(+2);
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case DFA_LIFT:
|
||||
|
@ -5302,8 +5305,8 @@ void C4Object::ExecAction()
|
|||
}
|
||||
|
||||
// Reduce line segments
|
||||
if (!Tick35)
|
||||
ReduceLineSegments(Shape, !Tick2);
|
||||
if (!::Game.iTick35)
|
||||
ReduceLineSegments(Shape, !::Game.iTick2);
|
||||
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -33,9 +33,11 @@
|
|||
#include <C4Command.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4ObjectMenu.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
BOOL SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <C4ObjectInfo.h>
|
||||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Game.h>
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include <C4RankSystem.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4Config.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
C4ObjectInfoList::C4ObjectInfoList()
|
||||
|
|
|
@ -27,9 +27,10 @@
|
|||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Object.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Region.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
C4ObjectList::C4ObjectList(): FirstIter(0)
|
||||
|
|
|
@ -24,10 +24,11 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Object.h>
|
||||
#include <C4ObjectCom.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Physics.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
static const FIXED WindDrift_Factor = itofix(1, 800);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <C4Network2Stats.h>
|
||||
#include <C4MessageInput.h>
|
||||
#include <C4GamePadCon.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4FullScreen.h>
|
||||
|
@ -43,6 +42,10 @@
|
|||
#include <C4ObjectMenu.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#define C4FOW_Def_View_RangeX 500
|
||||
|
@ -236,8 +239,8 @@ void C4Player::Execute()
|
|||
}
|
||||
}
|
||||
|
||||
// Tick35
|
||||
if (!Tick35 && Status==PS_Normal)
|
||||
// ::Game.iTick35
|
||||
if (!::Game.iTick35 && Status==PS_Normal)
|
||||
{
|
||||
ExecHomeBaseProduction();
|
||||
UpdateValue();
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4Config.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4FullScreen.h>
|
||||
#endif
|
||||
|
|
|
@ -721,3 +721,13 @@ void C4PlayerList::RecheckPlayerSort(C4Player *pForPlayer)
|
|||
pPrev->Next = pForPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ValidPlr(int32_t plr)
|
||||
{
|
||||
return Game.Players.Valid(plr);
|
||||
}
|
||||
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2)
|
||||
{
|
||||
return Game.Players.Hostile(plr1,plr2);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include <C4Console.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#include <StdRegistry.h>
|
||||
|
@ -404,7 +404,7 @@ void C4PropertyDlg::UpdateInputCtrl(C4Object *pObj)
|
|||
|
||||
void C4PropertyDlg::Execute()
|
||||
{
|
||||
if (!Tick35) Update();
|
||||
if (!::Game.iTick35) Update();
|
||||
}
|
||||
|
||||
void C4PropertyDlg::ClearPointers(C4Object *pObj)
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#include <C4PlayerInfo.h>
|
||||
#include <C4GameSave.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#include <StdFile.h>
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
// *** C4RoundResultsPlayer
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <C4Components.h>
|
||||
#include <C4Game.h>
|
||||
#ifdef C4ENGINE
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <C4Command.h>
|
||||
#include <C4Console.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4ObjectInfoList.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4ObjectMenu.h>
|
||||
|
@ -46,6 +46,11 @@
|
|||
#include <C4MessageInput.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
//========================== Some Support Functions =======================================
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <C4Console.h>
|
||||
#include <C4ObjectCom.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
/*--- C4ScriptHost ---*/
|
||||
|
@ -249,7 +249,7 @@ BOOL C4GameScriptHost::Execute()
|
|||
if (!Script) return FALSE;
|
||||
#ifdef C4ENGINE
|
||||
char buffer[500];
|
||||
if (Go && !Tick10)
|
||||
if (Go && !::Game.iTick10)
|
||||
{
|
||||
sprintf(buffer,PSF_Script,Counter++);
|
||||
return !! Call(buffer);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Physics.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#endif
|
||||
|
||||
BOOL C4Shape::AddVertex(int32_t iX, int32_t iY)
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4SurfaceFile.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#endif
|
||||
|
||||
static BOOL SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Object.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -617,3 +617,58 @@ void C4SoundSystem::ClearPointers(C4Object *pObj)
|
|||
for (C4SoundEffect *pEff=FirstSound; pEff; pEff=pEff->Next)
|
||||
pEff->ClearPointers(pObj);
|
||||
}
|
||||
|
||||
C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance)
|
||||
{
|
||||
// Sound check
|
||||
if (!Config.Sound.RXSound) return FALSE;
|
||||
// Start new
|
||||
return Application.SoundSystem.NewEffect(szSndName, fLoop, iVolume, pObj, iCustomFalloffDistance);
|
||||
}
|
||||
|
||||
C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t iY, bool fLoop, int32_t iVolume)
|
||||
{
|
||||
// Sound check
|
||||
if (!Config.Sound.RXSound) return FALSE;
|
||||
// Create
|
||||
C4SoundInstance *pInst = StartSoundEffect(szSndName, fLoop, iVolume);
|
||||
// Set volume by position
|
||||
if(pInst) pInst->SetVolumeByPos(iX, iY);
|
||||
// Return
|
||||
return pInst;
|
||||
}
|
||||
|
||||
C4SoundInstance *GetSoundInstance(const char *szSndName, C4Object *pObj)
|
||||
{
|
||||
return Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
}
|
||||
|
||||
void StopSoundEffect(const char *szSndName, C4Object *pObj)
|
||||
{
|
||||
// Find instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) return;
|
||||
// Stop
|
||||
pInst->Stop();
|
||||
}
|
||||
void SoundLevel(const char *szSndName, C4Object *pObj, int32_t iLevel)
|
||||
{
|
||||
// Sound level zero? Stop
|
||||
if(!iLevel) { StopSoundEffect(szSndName, pObj); return; }
|
||||
// Find or create instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) pInst = StartSoundEffect(szSndName, true, iLevel, pObj);
|
||||
if(!pInst) return;
|
||||
// Set volume
|
||||
pInst->SetVolume(iLevel);
|
||||
pInst->Execute();
|
||||
}
|
||||
void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan)
|
||||
{
|
||||
// Find instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) return;
|
||||
// Set pan
|
||||
pInst->SetPan(iPan);
|
||||
pInst->Execute();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4StartupMainDlg.h>
|
||||
#include <C4Wrappers.h>
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <C4GamePadCon.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#endif
|
||||
|
||||
#include <StdGL.h>
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <C4ComponentHost.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4RTF.H>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4GameDialogs.h>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Player.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <C4Application.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Log.h>
|
||||
#endif
|
||||
|
||||
C4Texture::C4Texture()
|
||||
|
|
|
@ -27,16 +27,15 @@
|
|||
#include <C4ToolsDlg.h>
|
||||
#include <C4Console.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <StdRegistry.h>
|
||||
#include <StdD3D.h>
|
||||
#ifdef USE_GL
|
||||
#include <StdGL.h>
|
||||
#endif
|
||||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include "C4Wrappers.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
# include <C4Language.h>
|
||||
# include <C4DevmodeDlg.h>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Game.h>
|
||||
#include <C4FacetEx.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Landscape.h>
|
||||
#endif
|
||||
|
||||
C4TransferZone::C4TransferZone()
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <C4UserMessages.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4ObjectInfo.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4FullScreen.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4ObjectCom.h>
|
||||
|
@ -44,6 +43,10 @@
|
|||
#include <C4MouseControl.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
#include <StdGL.h>
|
||||
|
@ -1481,7 +1484,7 @@ void C4Viewport::DrawPlayerControls(C4TargetFacet &cgo)
|
|||
{
|
||||
showtext= iShowCtrl & (1<<(iCtrl+C4MaxShowControl)) ;
|
||||
if (iShowCtrl & (1<<(iCtrl+2*C4MaxShowControl)))
|
||||
if (Tick35>18) showtext=FALSE;
|
||||
if (::Game.iTick35>18) showtext=FALSE;
|
||||
C4Facet ccgo;
|
||||
ccgo.Set(cgo.Surface,tx+scwdt*(iCtrl%3),ty+schgt*(iCtrl/3),scwdt,schgt);
|
||||
DrawControlKey(ccgo,iCtrl,(iLastCtrl==iCtrl) ? 1 : 0,
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Object.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
C4Weather::C4Weather()
|
||||
|
@ -79,7 +80,7 @@ void C4Weather::Init(BOOL fScenario)
|
|||
void C4Weather::Execute()
|
||||
{
|
||||
// Season
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
{
|
||||
SeasonDelay+=YearSpeed;
|
||||
if (SeasonDelay>=200)
|
||||
|
@ -92,23 +93,23 @@ void C4Weather::Execute()
|
|||
}
|
||||
}
|
||||
// Temperature
|
||||
if (!Tick35)
|
||||
if (!::Game.iTick35)
|
||||
{
|
||||
int32_t iTemperature=Climate-(int32_t)(TemperatureRange*cos(6.28*(float)Season/100.0));
|
||||
if (Temperature<iTemperature) Temperature++;
|
||||
else if (Temperature>iTemperature) Temperature--;
|
||||
}
|
||||
// Wind
|
||||
if (!Tick1000)
|
||||
if (!::Game.iTick1000)
|
||||
TargetWind=Game.C4S.Weather.Wind.Evaluate();
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
Wind=BoundBy<int32_t>(Wind+Sign(TargetWind-Wind),
|
||||
Game.C4S.Weather.Wind.Min,
|
||||
Game.C4S.Weather.Wind.Max);
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
SoundLevel("Wind",NULL,Max(Abs(Wind)-30,0)*2);
|
||||
// Disaster launch
|
||||
if (!Tick10)
|
||||
if (!::Game.iTick10)
|
||||
{
|
||||
// Meteorite
|
||||
if (!Random(60))
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 2001, 2005, 2007 Sven Eberhardt
|
||||
* Copyright (c) 2004-2005, 2007 Peter Wortmann
|
||||
* Copyright (c) 2006 Günther Brammer
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Some useful wrappers to globals */
|
||||
|
||||
#include <C4Include.h>
|
||||
#include <C4Wrappers.h>
|
||||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Random.h>
|
||||
#include <C4Object.h>
|
||||
#endif
|
||||
|
||||
//==================================== Materials =========================================
|
||||
|
||||
int32_t PixCol2MatOld(BYTE pixc)
|
||||
{
|
||||
if (pixc < GBM) return MNone;
|
||||
pixc &= 63; // Substract GBM, ignore IFT
|
||||
if (pixc > ::MaterialMap.Num*C4M_ColsPerMat-1) return MNone;
|
||||
return pixc / C4M_ColsPerMat;
|
||||
}
|
||||
|
||||
int32_t PixCol2MatOld2(BYTE pixc)
|
||||
{
|
||||
int32_t iMat = ((int32_t) (pixc&0x7f)) -1;
|
||||
// if above MVehic, don't forget additional vehicle-colors
|
||||
if (iMat<=MVehic) return iMat;
|
||||
// equals middle vehicle-color
|
||||
if (iMat==MVehic+1) return MVehic;
|
||||
// above: range check
|
||||
iMat-=2; if (iMat >= ::MaterialMap.Num) return MNone;
|
||||
return iMat;
|
||||
}
|
||||
|
||||
//=============================== Sound ==================================================
|
||||
|
||||
C4SoundInstance *StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance)
|
||||
{
|
||||
// Sound check
|
||||
if (!Config.Sound.RXSound) return FALSE;
|
||||
// Start new
|
||||
return Application.SoundSystem.NewEffect(szSndName, fLoop, iVolume, pObj, iCustomFalloffDistance);
|
||||
}
|
||||
|
||||
C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t iY, bool fLoop, int32_t iVolume)
|
||||
{
|
||||
// Sound check
|
||||
if (!Config.Sound.RXSound) return FALSE;
|
||||
// Create
|
||||
C4SoundInstance *pInst = StartSoundEffect(szSndName, fLoop, iVolume);
|
||||
// Set volume by position
|
||||
if(pInst) pInst->SetVolumeByPos(iX, iY);
|
||||
// Return
|
||||
return pInst;
|
||||
}
|
||||
|
||||
C4SoundInstance *GetSoundInstance(const char *szSndName, C4Object *pObj)
|
||||
{
|
||||
return Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
}
|
||||
|
||||
void StopSoundEffect(const char *szSndName, C4Object *pObj)
|
||||
{
|
||||
// Find instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) return;
|
||||
// Stop
|
||||
pInst->Stop();
|
||||
}
|
||||
void SoundLevel(const char *szSndName, C4Object *pObj, int32_t iLevel)
|
||||
{
|
||||
// Sound level zero? Stop
|
||||
if(!iLevel) { StopSoundEffect(szSndName, pObj); return; }
|
||||
// Find or create instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) pInst = StartSoundEffect(szSndName, true, iLevel, pObj);
|
||||
if(!pInst) return;
|
||||
// Set volume
|
||||
pInst->SetVolume(iLevel);
|
||||
pInst->Execute();
|
||||
}
|
||||
void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan)
|
||||
{
|
||||
// Find instance
|
||||
C4SoundInstance *pInst = Application.SoundSystem.FindInstance(szSndName, pObj);
|
||||
if(!pInst) return;
|
||||
// Set pan
|
||||
pInst->SetPan(iPan);
|
||||
pInst->Execute();
|
||||
}
|
||||
|
||||
//=========================== Graphics Resource =========================================
|
||||
|
||||
#define GfxR (&(::GraphicsResource))
|
||||
|
||||
//================================== Players ============================================
|
||||
|
||||
int32_t ValidPlr(int32_t plr)
|
||||
{
|
||||
return Game.Players.Valid(plr);
|
||||
}
|
||||
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2)
|
||||
{
|
||||
return Game.Players.Hostile(plr1,plr2);
|
||||
}
|
||||
|
||||
//================================== StdCompiler ============================================
|
||||
|
||||
void StdCompilerWarnCallback(void *pData, const char *szPosition, const char *szError)
|
||||
{
|
||||
const char *szName = reinterpret_cast<const char *>(pData);
|
||||
if(!szPosition || !*szPosition)
|
||||
DebugLogF("WARNING: %s (in %s)", szError, szName);
|
||||
else
|
||||
DebugLogF("WARNING: %s (in %s, %s)", szError, szPosition, szName);
|
||||
}
|
|
@ -686,5 +686,59 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
void StdCompilerWarnCallback(void *pData, const char *szPosition, const char *szError);
|
||||
|
||||
template <class CompT, class StructT>
|
||||
bool CompileFromBuf_Log(StructT &TargetStruct, const typename CompT::InT &SrcBuf, const char *szName)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompileFromBuf<CompT>(TargetStruct, SrcBuf);
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
template <class CompT, class StructT>
|
||||
bool CompileFromBuf_LogWarn(StructT RREF TargetStruct, const typename CompT::InT &SrcBuf, const char *szName)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompT Compiler;
|
||||
Compiler.setInput(SrcBuf.getRef());
|
||||
Compiler.setWarnCallback(StdCompilerWarnCallback, reinterpret_cast<void *>(const_cast<char *>(szName)));
|
||||
Compiler.Compile(TargetStruct);
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
if(!pExc->Pos.getLength())
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
else
|
||||
LogF("ERROR: %s (in %s, %s)", pExc->Msg.getData(), pExc->Pos.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
template <class CompT, class StructT>
|
||||
bool DecompileToBuf_Log(StructT RREF TargetStruct, typename CompT::OutT *pOut, const char *szName)
|
||||
{
|
||||
if(!pOut) return false;
|
||||
try
|
||||
{
|
||||
pOut->Take(DecompileToBuf<CompT>(TargetStruct));
|
||||
return TRUE;
|
||||
}
|
||||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
LogF("ERROR: %s (in %s)", pExc->Msg.getData(), szName);
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // STDCOMPILER_H
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <C4Log.h>
|
||||
|
||||
// *** StdCompiler
|
||||
|
||||
|
@ -960,3 +961,12 @@ void StdCompilerINIRead::notFound(const char *szWhat)
|
|||
{
|
||||
excNotFound("%s expected", szWhat);
|
||||
}
|
||||
|
||||
void StdCompilerWarnCallback(void *pData, const char *szPosition, const char *szError)
|
||||
{
|
||||
const char *szName = reinterpret_cast<const char *>(pData);
|
||||
if(!szPosition || !*szPosition)
|
||||
DebugLogF("WARNING: %s (in %s)", szError, szName);
|
||||
else
|
||||
DebugLogF("WARNING: %s (in %s, %s)", szError, szPosition, szName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue