unifdef C4ENGINE

stable-5.2
Günther Brammer 2009-06-17 21:22:10 +02:00
parent 6ff9c8c48a
commit 09a7f4cd07
49 changed files with 0 additions and 472 deletions

View File

@ -402,7 +402,6 @@ enum C4AulScriptState
ASS_PARSED // byte code generated
};
#ifdef C4ENGINE
// script profiler entry
class C4AulProfiler
@ -429,7 +428,6 @@ class C4AulProfiler
static void StopProfiling();
};
#endif
// script class
class C4AulScript

View File

@ -32,11 +32,9 @@
#include <C4Surface.h>
#include <C4ComponentHost.h>
#ifdef C4ENGINE
#include <C4ScriptHost.h>
#include <C4DefGraphics.h>
#include "C4LangStringTable.h"
#endif
const int32_t C4D_None = 0,
C4D_All = ~C4D_None,
@ -197,9 +195,6 @@ class C4DefCore
C4Rect Entrance;
C4Rect Collection;
C4Rect PictureRect;
#ifndef C4ENGINE
C4Rect PictureRectFE;
#endif
C4TargetRect SolidMask;
C4TargetRect TopFace;
C4IDList Component;
@ -307,7 +302,6 @@ class C4Def: public C4DefCore
C4AulScriptFunc *TimerCall;
C4ComponentHost Desc;
#ifdef C4ENGINE
// Currently cannot have script host in frontend because that
// would need C4Script, C4AulScript, and all that as well...
C4DefScriptHost Script;
@ -329,7 +323,6 @@ class C4Def: public C4DefCore
C4PhysicalInfo *pFairCrewPhysical;
C4Facet MainFace;
#endif
protected:
C4Def *Next;
@ -342,13 +335,11 @@ class C4Def: public C4DefCore
class C4SoundSystem *pSoundSystem = NULL);
void Draw(C4Facet &cgo, BOOL fSelected=FALSE, DWORD iColor=0, C4Object *pObj=NULL, int32_t iPhaseX=0, int32_t iPhaseY=0);
#ifdef C4ENGINE
inline C4Facet &GetMainFace(C4DefGraphics *pGraphics, DWORD dwClr=0) { MainFace.Surface=pGraphics->GetBitmap(dwClr); return MainFace; }
int32_t GetValue(C4Object *pInBase, int32_t iBuyPlayer); // get value of def; calling script functions if defined
C4PhysicalInfo *GetFairCrewPhysicals(); // get fair crew physicals at current fair crew strength
void ClearFairCrewPhysicals(); // remove cached fair crew physicals, will be created fresh on demand
void Synchronize();
#endif
const char *GetDesc() { return Desc.GetData(); }
protected:
bool LoadPortraits(C4Group &hGroup);
@ -368,9 +359,7 @@ class C4Def: public C4DefCore
};
class C4DefList
#ifdef C4ENGINE
: public CStdFont::CustomImages
#endif
{
public:
C4DefList();
@ -418,9 +407,7 @@ class C4DefList
BOOL Add(C4Def *ndef, BOOL fOverload);
void BuildTable(); // build quick access table
void ResetIncludeDependencies(); // resets all pointers into foreign definitions caused by include chains
#ifdef C4ENGINE
void Synchronize();
#endif
// callback from font renderer: get ID image
virtual bool GetFontImage(const char *szImageTag, CFacet &rOutImgFacet);

View File

@ -175,11 +175,9 @@ class C4GraphicsOverlay
C4TargetFacet fctBlit; // current blit data
uint32_t dwBlitMode; // extra parameters for additive blits, etc.
uint32_t dwClrModulation; // colormod for this overlay
#ifdef C4ENGINE
C4Object *pOverlayObj; // object to be drawn as overlay in MODE_Object
int32_t nOverlayObj; // compiled ptr
C4DrawTransform Transform; // drawing transformation: Rotation, zoom, etc.
#endif
int32_t iPhase; // action face for MODE_Action
bool fZoomToShape; // if true, overlay will be zoomed to match the target object shape
@ -192,9 +190,7 @@ class C4GraphicsOverlay
public:
C4GraphicsOverlay() : eMode(MODE_None), pSourceGfx(NULL), fctBlit(), dwBlitMode(0), dwClrModulation(0xffffff),
#ifdef C4ENGINE
pOverlayObj(NULL), nOverlayObj(0), Transform(+1),
#endif
iPhase(0), fZoomToShape(false), iID(0), pNext(NULL) { *Action=0; } // std ctor
~C4GraphicsOverlay(); // dtor
@ -221,10 +217,8 @@ class C4GraphicsOverlay
bool IsValid(const C4Object *pForObj) const;
#ifdef C4ENGINE
C4DrawTransform *GetTransform() { return &Transform; }
C4Object *GetOverlayObject() const { return pOverlayObj; }
#endif
int32_t GetID() const { return iID; }
void SetID(int32_t aID) { iID = aID; }
void SetPhase(int32_t iToPhase);

View File

@ -48,7 +48,6 @@ struct C4Vec2D
C4Vec2D(int32_t x=0, int32_t y=0) : x(x), y(y) {}
};
#ifdef C4ENGINE
class C4DrawTransform : public CBltTransform
{
public:
@ -117,7 +116,6 @@ class C4DrawTransform : public CBltTransform
int32_t GetYOffset() const { return static_cast<int32_t>(mat[5]); }
};
#endif // C4ENGINE
class C4Facet
{
@ -144,11 +142,9 @@ class C4Facet
void DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t iPhaseX=0, int32_t iPhaseY=0, int32_t iAlign=C4FCT_Center, int32_t *piUsedWidth=NULL);
void Draw(C4Facet &cgo, BOOL fAspect=TRUE, int32_t iPhaseX=0, int32_t iPhaseY=0, BOOL fTransparent=TRUE);
void DrawFullScreen(C4Facet &cgo);
#ifdef C4ENGINE
void DrawT(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform); // draw with transformation (if pTransform is assigned)
void DrawT(C4Facet &cgo, BOOL fAspect, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform);
void DrawXT(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform);
#endif // C4ENGINE
void DrawClr(C4Facet &cgo, BOOL fAspect=TRUE, DWORD dwClr=0); // set surface color and draw
void DrawXClr(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, DWORD dwClr); // set surface color and draw
void DrawValue2Clr(C4Facet &cgo, int32_t iValue1, int32_t iValue2, DWORD dwClr); // set surface color and draw

View File

@ -88,12 +88,10 @@ class C4FontLoader
int32_t GetClosestAvailableSize(const char *szFontName, int32_t iWantedSize); // return possible font size that mathces the desired value closest
void AddVectorFont(C4VectorFont *pAddFont); // adds a new font to the list
#ifdef C4ENGINE
bool InitFont(CStdFont &rFont, C4VectorFont * pFont, int32_t iSize, uint32_t dwWeight, bool fDoShadow);
// init a font class of the given type
// iSize is always the size of the normal font, which is adjusted for larger (title) and smaller (log) font types
bool InitFont(CStdFont &rFont, const char *szFontName, FontType eType, int32_t iSize, C4GroupSet *pGfxGroups, bool fDoShadow=true);
#endif
};

View File

@ -24,7 +24,6 @@
#ifndef INC_C4Game
#define INC_C4Game
#ifdef C4ENGINE
#include <C4GameParameters.h>
#include <C4PlayerInfo.h>
@ -328,6 +327,5 @@ inline StdStrBuf GetKeyboardInputName(const char *szKeyName, bool fShort = false
return Game.KeyboardInput.GetKeyCodeNameByKeyName(szKeyName, fShort, iIndex);
}
#endif // C4ENGINE
#endif

View File

@ -97,9 +97,7 @@ class C4GraphicsSystem
C4Viewport *FirstViewport;
BOOL fViewportClassRegistered;
C4Facet ViewportArea;
#ifdef C4ENGINE
C4RectList BackgroundAreas; // rectangles covering background without viewports in fullscreen
#endif
char FlashMessageText[C4MaxTitle+1];
int32_t FlashMessageTime,FlashMessageX,FlashMessageY;
void DrawHelp();

View File

@ -44,7 +44,6 @@
#define C4_OS "unknown";
#endif
#ifdef C4ENGINE
#ifndef HAVE_CONFIG_H
// different debugrec options
@ -83,7 +82,6 @@
#if defined(HAVE_MIDI_H) && !defined(USE_FMOD)
#define USE_WINDOWS_MIDI
#endif
#endif // C4ENGINE
#include <Standard.h>
#include <CStdFile.h>

View File

@ -103,16 +103,12 @@ class C4TempPhysicalInfo : public C4PhysicalInfo
{
private:
// changes done to the original physicals; used for backtracing
#ifdef C4ENGINE
std::vector<C4PhysicalChange> Changes;
#endif
public:
void Clear()
{
#ifdef C4ENGINE
Changes.clear();
#endif
}
void Default() { Clear(); C4PhysicalInfo::Default(); } // clears
void CompileFunc(StdCompiler *pComp);

View File

@ -336,9 +336,7 @@ class C4MapCreatorS2 : public C4MCNode
C4MCMap *GetMap(const char *szMapName); // get map by name
public:
#ifdef C4ENGINE
CSurface8 * Render(const char *szMapName); // create map surface
#endif
BYTE *RenderBuf(const char *szMapName, int32_t &sfcWdt, int32_t &sfcHgt); // create buffer and render it
void SetC4SLandscape(C4SLandscape *pLandscape) // update source for map size

View File

@ -51,9 +51,7 @@ struct C4MaterialReaction
bool fUserDefined; // false for internal reactions generated by material parameters
StdCopyStrBuf TargetSpec; // target material specification
StdCopyStrBuf ScriptFunc; // for reaction func 'script': Script func to be called for reaction evaluation
#ifdef C4ENGINE
C4AulFunc *pScriptFunc; // resolved script function
#endif
uint32_t iExecMask; // execution mask: Bit mask with indices into MaterialInteractionEvent
bool fReverse; // if set, spec will be handled as if specified in target mat def
bool fInverseSpec; // if set, all mats except the given are used
@ -63,16 +61,12 @@ struct C4MaterialReaction
int32_t iConvertMat; // in mat conversion material; evaluated in CrossMapMaterials
int32_t iCorrosionRate; // chance of doing a corrosion
#ifdef C4ENGINE
C4MaterialReaction(C4MaterialReactionFunc pFunc) : pFunc(pFunc), fUserDefined(false), pScriptFunc(NULL), iExecMask(~0u), fReverse(false), fInverseSpec(false), fInsertionCheck(true), iDepth(0), iConvertMat(-1), iCorrosionRate(100) {}
C4MaterialReaction() : pFunc(&NoReaction), fUserDefined(true), pScriptFunc(NULL), iExecMask(~0u), fReverse(false), fInverseSpec(false), fInsertionCheck(true), iDepth(0), iConvertMat(-1), iCorrosionRate(100) { }
#endif
void CompileFunc(StdCompiler *pComp);
#ifdef C4ENGINE
void ResolveScriptFuncs(const char *szMatName);
#endif
bool operator ==(const C4MaterialReaction &rCmp) const { return false; } // never actually called; only comparing with empty vector of C4MaterialReactions
};
@ -148,12 +142,10 @@ class C4Material: public C4MaterialCore
int32_t InMatConvertTo; // Mat
int32_t BelowTempConvertTo; // MatTex
int32_t AboveTempConvertTo; // MatTex
#ifdef C4ENGINE
int32_t DefaultMatTex; // texture used for single pixel values
C4Facet PXSFace; // loose pixel facet
void UpdateScriptPointers(); // set all material script pointers
#endif
};
class C4MaterialMap
@ -175,9 +167,7 @@ class C4MaterialMap
static bool mrfIncinerate(C4MaterialReaction *pReaction, int32_t &iX, int32_t &iY, int32_t iLSPosX, int32_t iLSPosY, FIXED &fXDir, FIXED &fYDir, int32_t &iPxsMat, int32_t iLsMat, MaterialInteractionEvent evEvent, bool *pfPosChanged);
static bool mrfInsert (C4MaterialReaction *pReaction, int32_t &iX, int32_t &iY, int32_t iLSPosX, int32_t iLSPosY, FIXED &fXDir, FIXED &fYDir, int32_t &iPxsMat, int32_t iLsMat, MaterialInteractionEvent evEvent, bool *pfPosChanged);
// user-defined actions
#ifdef C4ENGINE
static bool mrfScript(C4MaterialReaction *pReaction, int32_t &iX, int32_t &iY, int32_t iLSPosX, int32_t iLSPosY, FIXED &fXDir, FIXED &fYDir, int32_t &iPxsMat, int32_t iLsMat, MaterialInteractionEvent evEvent, bool *pfPosChanged);
#endif
public:
void Default();
void Clear();
@ -190,10 +180,8 @@ class C4MaterialMap
{ assert(ppReactionMap); assert(Inside<int32_t>(iPXSMat,-1,Num-1)); assert(Inside<int32_t>(iLandscapeMat,-1,Num-1));
return ppReactionMap[(iLandscapeMat+1)*(Num+1) + iPXSMat+1]; }
C4MaterialReaction *GetReaction(int32_t iPXSMat, int32_t iLandscapeMat);
#ifdef C4ENGINE
void UpdateScriptPointers(); // set all material script pointers
bool CrossMapMaterials();
#endif
protected:
void SetMatReaction(int32_t iPXSMat, int32_t iLSMat, C4MaterialReaction *pReact);
BOOL SortEnumeration(int32_t iMat, const char *szMatName);

View File

@ -19,12 +19,8 @@
#ifndef C4NETWORK2REFERENCE_H
#define C4NETWORK2REFERENCE_H
#ifdef C4ENGINE
#include "C4Network2.h"
#include "C4Network2Client.h"
#else
#include "C4NetIO.h"
#endif
#include "C4GameParameters.h"
#include "C4Version.h"
#include "C4GameVersion.h"

View File

@ -24,10 +24,8 @@
#include <C4Surface.h>
#include <C4InfoCore.h>
#ifdef C4ENGINE
#include <C4Object.h>
#include <C4FacetEx.h>
#endif
class C4ObjectInfo: public C4ObjectInfoCore
{
@ -41,11 +39,9 @@ class C4ObjectInfo: public C4ObjectInfoCore
BOOL HasDied;
int32_t ControlCount;
class C4Def *pDef; // definition to ID - only eresolved if defs were loaded at object info loading time
#ifdef C4ENGINE
C4Portrait Portrait; // portrait link (usually to def graphics)
C4Portrait *pNewPortrait; // new permanent portrait link (usually to def graphics)
C4Portrait *pCustomPortrait; // if assigned, the Clonk has a custom portrait to be set via SetPortrait("custom")
#endif
char Filename[_MAX_PATH+1];
C4ObjectInfo *Next;
public:
@ -59,12 +55,10 @@ class C4ObjectInfo: public C4ObjectInfoCore
BOOL Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs);
BOOL Load(C4Group &hGroup, bool fLoadPortrait);
BOOL Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait);
#ifdef C4ENGINE
bool SetRandomPortrait(C4ID idSourceDef, bool fAssignPermanently, bool fCopyFile);
bool SetPortrait(const char *szPortraitName, C4Def *pSourceDef, bool fAssignPermanently, bool fCopyFile);
bool SetPortrait(C4PortraitGraphics *pNewPortraitGfx, bool fAssignPermanently, bool fCopyFile);
bool ClearPortrait(bool fPermanently);
#endif
};
#endif

View File

@ -236,9 +236,7 @@ class C4Player: public C4PlayerInfoCore
void ClearGraphs();
void CountControl(ControlType eType, int32_t iID, int32_t iCntAdd=1);
#ifdef C4ENGINE
class C4PlayerInfo *GetInfo(); // search info by ID
#endif
private:
// messageboard-calls for this player

View File

@ -24,9 +24,6 @@
#ifndef INC_C4Random
#define INC_C4Random
#ifndef C4ENGINE
#include <StdRandom.h>
#endif
#ifdef DEBUGREC
#include <C4Record.h>
@ -34,7 +31,6 @@
extern int RandomCount;
extern unsigned int RandomHold;
#ifdef C4ENGINE
inline void FixedRandom(DWORD dwSeed)
{
@ -82,7 +78,6 @@ inline unsigned int SeededRandom(unsigned int iSeed, unsigned int iRange)
return (iSeed >> 16) % iRange;
}
#endif
inline int SafeRandom(int range)
{

View File

@ -50,9 +50,7 @@ class C4RankSystem
BOOL Check(int iRank, const char *szDefRankName);
int32_t GetExtendedRankNum() const { return iRankExtNum; }
//void Reset(const char *szDefRanks);
#ifdef C4ENGINE
static bool DrawRankSymbol(C4FacetSurface *fctSymbol, int32_t iRank, C4Facet *pfctRankSymbols, int32_t iRankSymbolCount, bool fOwnSurface, int32_t iXOff=0, C4Facet *cgoDrawDirect=NULL); // create facet from rank symbol for definition - use custom rank facets if present
#endif
};
extern C4RankSystem DefaultRanks;

View File

@ -265,9 +265,6 @@ class C4Record // demo recording
C4Record(const char *szPlaybackFile, const char *szRecordFile, const char *szTempRecFile); // start recording from replay into record
~C4Record(); // destructor; close file; create demo scen
int Index;
#ifndef C4ENGINE
int iLastFrame; // some hack for the ctrlrec-t00l
#endif
bool IsRecording() const { return fRecording; } // return whether Start() has been called
unsigned int GetStreamingPos() const { return iStreamingPos; }

View File

@ -320,7 +320,6 @@ class C4Scenario
class C4ScenarioSection;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
extern const char *C4ScenSect_Main;
@ -345,6 +344,5 @@ class C4ScenarioSection
bool EnsureTempStore(bool fExtractLandscape, bool fExtractObjects); // make sure that a temp file is created, and nothing is modified within the main scenario file
};
#endif // C4ENGINE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#endif // INC_C4Scenario

View File

@ -145,7 +145,6 @@ class C4Shape: public C4Rect
void CompileFunc(StdCompiler *pComp, bool fRuntime);
};
#ifdef C4ENGINE
// a bunch of rectangles
// rects NOT including pos+size-point
@ -163,6 +162,5 @@ class C4RectList : public std::vector<C4Rect>
void ClipByRect(const C4Rect &rClip); // split up rectangles
};
#endif
#endif // INC_C4Shape

View File

@ -35,11 +35,9 @@ C4AulError::C4AulError() {}
void C4AulError::show()
{
#ifdef C4ENGINE
// simply log error message
if(sMessage)
DebugLog(sMessage.getData());
#endif
}
C4AulFunc::C4AulFunc(C4AulScript *pOwner, const char *pName, bool bAtEnd):

View File

@ -38,7 +38,6 @@ C4AulExecError::C4AulExecError(C4Object *pObj, const char *szError) : cObj(pObj)
void C4AulExecError::show()
{
#ifdef C4ENGINE
// log
C4AulError::show();
// debug mode object message
@ -47,7 +46,6 @@ void C4AulExecError::show()
::Messages.New(C4GM_Target,sMessage,cObj,NO_OWNER);
else
::Messages.New(C4GM_Global,sMessage,NULL,ANY_OWNER);
#endif
}
const int MAX_CONTEXT_STACK = 512;
@ -1259,24 +1257,17 @@ C4Value C4AulFunc::Exec(C4Object *pObj, C4AulParSet* pPars, bool fPassErrors)
C4Value C4AulScriptFunc::Exec(C4AulContext *pCtx, C4Value pPars[], bool fPassErrors)
{
#ifdef C4ENGINE
// handle easiest case first
if (Owner->State != ASS_PARSED) return C4VNull;
// execute
return AulExec.Exec(this, pCtx->Obj, pPars, fPassErrors);
#else
return C4AulNull;
#endif
}
C4Value C4AulScriptFunc::Exec(C4Object *pObj, C4AulParSet *pPars, bool fPassErrors)
{
#ifdef C4ENGINE
// handle easiest case first
if (Owner->State != ASS_PARSED) return C4VNull;
@ -1284,11 +1275,6 @@ C4Value C4AulScriptFunc::Exec(C4Object *pObj, C4AulParSet *pPars, bool fPassErro
// execute
return AulExec.Exec(this, pObj, pPars ? pPars->Par : C4AulParSet().Par, fPassErrors);
#else
return C4AulNull;
#endif
}

View File

@ -228,7 +228,6 @@ BOOL C4AulScript::ReloadScript(const char *szPath)
void C4AulScriptEngine::Link(C4DefList *rDefs)
{
#ifdef C4ENGINE
try
{
@ -284,7 +283,6 @@ void C4AulScriptEngine::Link(C4DefList *rDefs)
delete err;
}
#endif
}

View File

@ -33,12 +33,10 @@
#ifndef BIG_C4INCLUDE
#include <C4Log.h>
#include <C4Components.h>
#ifdef C4ENGINE
#include <C4Application.h>
#include <C4Network2.h>
#include <C4Language.h>
#endif
#endif
#include <StdFile.h>
#include <StdWindow.h>
@ -93,9 +91,7 @@ void C4ConfigGeneral::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(SaveGameFolder, "SaveGameFolder", "Savegames.c4f", false, true));
pComp->Value(mkNamingAdapt(SaveDemoFolder, "SaveDemoFolder", "Records.c4f", false, true ));
#ifdef C4ENGINE
pComp->Value(mkNamingAdapt(s(MissionAccess), "MissionAccess", "", false, true));
#endif
pComp->Value(mkNamingAdapt(s(UpdateEngine), "UpdateEngine", "www.clonkx.de/" C4ENGINENICK "/cr_%d_%s.c4u"));
pComp->Value(mkNamingAdapt(s(UpdateObjects), "UpdateObjects", "www.clonkx.de/" C4ENGINENICK "/cr_%d%d%d%d_%d_%s.c4u"));
pComp->Value(mkNamingAdapt(s(UpdateMajor), "UpdateMajor", "www.clonkx.de/" C4ENGINENICK "/cr_%d%d%d%d_%s.c4u"));
@ -195,12 +191,10 @@ void C4ConfigNetwork::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(NoReferenceRequest, "NoReferenceRequest", 0 ));
pComp->Value(mkNamingAdapt(MaxResSearchRecursion, "MaxResSearchRecursion",1 ,false, true));
pComp->Value(mkNamingAdapt(Comment, "Comment", "" ,false, true));
#ifdef C4ENGINE
pComp->Value(mkNamingAdapt(PortTCP, "PortTCP", C4NetStdPortTCP ,false, true));
pComp->Value(mkNamingAdapt(PortUDP, "PortUDP", C4NetStdPortUDP ,false, true));
pComp->Value(mkNamingAdapt(PortDiscovery, "PortDiscovery", C4NetStdPortDiscovery ,false, true));
pComp->Value(mkNamingAdapt(PortRefServer, "PortRefServer", C4NetStdPortRefServer ,false, true));
#endif
pComp->Value(mkNamingAdapt(ControlMode, "ControlMode", 0 ));
pComp->Value(mkNamingAdapt(SendPortraits, "SendPortraits", 0 ,false, true));
pComp->Value(mkNamingAdapt(LocalName, "LocalName", "Unknown" ,false, true));
@ -483,9 +477,7 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
catch(StdCompiler::Exception *pExc)
{
// Configuration file syntax error?
#ifdef C4ENGINE
LogF("Error loading configuration: %s"/*LoadResStr("IDS_ERR_CONFREAD") - restbl not yet loaded*/, pExc->Msg.getData());
#endif
delete pExc;
return FALSE;
}
@ -493,7 +485,6 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
// Config postinit
General.DeterminePaths(forceWorkingDirectory);
General.AdoptOldSettings();
#ifdef C4ENGINE
#ifdef HAVE_WINSOCK
bool fWinSock = AcquireWinSock();
#endif
@ -506,7 +497,6 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
#ifdef HAVE_WINSOCK
if (fWinSock) ReleaseWinSock();
#endif
#endif
General.DefaultLanguage();
#if defined USE_GL && !defined USE_DIRECTX
if (Graphics.Engine == GFXENGN_DIRECTX || Graphics.Engine == GFXENGN_DIRECTXS)
@ -522,7 +512,6 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
// OpenGL
DDrawCfg.Set(Graphics.NewGfxCfgGL, (float) Graphics.BlitOffGL/100.0f);
// Warning against invalid ports
#ifdef C4ENGINE
if (Config.Network.PortTCP>0 && Config.Network.PortTCP == Config.Network.PortRefServer)
{
Log("Warning: Network TCP port and reference server port both set to same value - increasing reference server port!");
@ -535,7 +524,6 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
++Config.Network.PortDiscovery;
if (Config.Network.PortDiscovery>=65536) Config.Network.PortDiscovery = C4NetStdPortDiscovery;
}
#endif
// Empty nick already defaults to GetRegistrationData("Nick") or
// Network.LocalName at relevant places.
/*if (!Network.Nick.getLength())
@ -603,9 +591,7 @@ BOOL C4Config::Save()
}
catch(StdCompiler::Exception *pExc)
{
#ifdef C4ENGINE
LogF(LoadResStr("IDS_ERR_CONFSAVE"), pExc->Msg.getData());
#endif
delete pExc;
return FALSE;
}
@ -622,11 +608,7 @@ void C4ConfigGeneral::DeterminePaths(BOOL forceWorkingDirectory)
GetTempPath(CFG_MaxString,TempPath);
if (TempPath[0]) AppendBackslash(TempPath);
#elif defined(__linux__)
#ifdef C4ENGINE
GetParentPath(Application.Location, ExePath);
#else
ExePath[0] = '.'; ExePath[1] = 0;
#endif
AppendBackslash(ExePath);
const char * t = getenv("TMPDIR");
if (t)
@ -676,11 +658,9 @@ void C4ConfigGeneral::DeterminePaths(BOOL forceWorkingDirectory)
SAppend(ScreenshotFolder.getData(), ScreenshotPath);
AppendBackslash(ScreenshotPath);
}
#ifdef C4ENGINE
// Create user path if it doesn't already exist
if (!DirectoryExists(UserDataPath))
CreateDirectory(UserDataPath, NULL);
#endif
}
static bool GrabOldPlayerFile(const char *fn)
@ -785,7 +765,6 @@ const char *C4Config::AtScreenshotPath(const char *szFilename)
return AtPathFilename;
}
#ifdef C4ENGINE
BOOL C4ConfigGeneral::CreateSaveFolder(const char *strDirectory, const char *strLanguageTitle)
{
@ -805,7 +784,6 @@ BOOL C4ConfigGeneral::CreateSaveFolder(const char *strDirectory, const char *str
return TRUE;
}
#endif
const char* C4ConfigNetwork::GetLeagueServerAddress()
{

View File

@ -38,12 +38,10 @@
#include <C4RankSystem.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#ifdef C4ENGINE
#include <C4Object.h>
#include "C4Network2Res.h"
#include <C4Material.h>
#endif
#endif
#if defined(C4FRONTEND) || defined(C4GROUP)
#include "C4Group.h"
@ -254,7 +252,6 @@ BOOL C4DefCore::Load(C4Group &hGroup)
PictureRect.Set(0,0,Shape.Wdt,Shape.Hgt);
// Check category
#ifdef C4ENGINE
if (!(Category & C4D_SortLimit))
{
// special: Allow this for spells
@ -269,7 +266,6 @@ BOOL C4DefCore::Load(C4Group &hGroup)
DebugLogF("WARNING: Def %s (%s) at %s has invalid mass!", GetName(), C4IdText(id), hGroup.GetFullName().getData());
Mass = 0;
}
#endif
return TRUE;
}
@ -351,13 +347,8 @@ void C4DefCore::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(Component, "Components", C4IDList() ));
pComp->Value(mkNamingAdapt(SolidMask, "SolidMask", TargetRect0 ));
pComp->Value(mkNamingAdapt(TopFace, "TopFace", TargetRect0 ));
#ifdef C4ENGINE
pComp->Value(mkNamingAdapt(PictureRect, "Picture", Rect0 ));
pComp->Value(mkNamingAdapt(StdNullAdapt(), "PictureFE" ));
#else
pComp->Value(mkNamingAdapt(PictureRect, "Picture", Rect0 ));
pComp->Value(mkNamingAdapt(PictureRectFE, "PictureFE", Rect0 ));
#endif
pComp->Value(mkNamingAdapt(Entrance, "Entrance", Rect0 ));
pComp->Value(mkNamingAdapt(Collection, "Collection", Rect0 ));
pComp->Value(mkNamingAdapt(CollectionLimit, "CollectionLimit", 0 ));
@ -489,9 +480,7 @@ void C4DefCore::CompileFunc(StdCompiler *pComp)
C4Def::C4Def()
{
#ifdef C4ENGINE
Graphics.pDef = this;
#endif
Default();
}
@ -512,7 +501,6 @@ void C4Def::Default()
Creation=0;
Count=0;
TimerCall=NULL;
#ifdef C4ENGINE
MainFace.Set(NULL,0,0,0,0);
Script.Default();
StringTable.Default();
@ -524,7 +512,6 @@ void C4Def::Default()
PortraitCount = 0;
Portraits = NULL;
pFairCrewPhysical = NULL;
#endif
}
C4Def::~C4Def()
@ -539,7 +526,6 @@ void C4Def::Clear()
if (Image) DeleteObject(Image); Image=NULL;
#endif
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Graphics.Clear();
Script.Clear();
@ -553,7 +539,6 @@ void C4Def::Clear()
PortraitCount = 0;
Portraits = NULL;
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (ActMap) delete [] ActMap; ActMap=NULL;
Desc.Clear();
@ -567,18 +552,15 @@ BOOL C4Def::Load(C4Group &hGroup,
{
BOOL fSuccess=TRUE;
#ifdef C4ENGINE
bool AddFileMonitoring = false;
if (Game.pFileMonitor && !SEqual(hGroup.GetFullName().getData(),Filename) && !hGroup.IsPacked())
AddFileMonitoring = true;
#endif
// Store filename, maker, creation
SCopy(hGroup.GetFullName().getData(),Filename);
SCopy(hGroup.GetMaker(),Maker,C4MaxName);
Creation = hGroup.GetCreation();
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Verbose log filename
if (Config.Graphics.VerboseObjectLoading>=3)
Log(hGroup.GetFullName().getData());
@ -601,43 +583,35 @@ BOOL C4Def::Load(C4Group &hGroup,
// done
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Read DefCore
if (fSuccess) fSuccess=C4DefCore::Load(hGroup);
// check id
if (fSuccess) if (!LooksLikeID(id))
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// wie geth ID?????ßßßß
if (!Name[0]) Name = GetFilename(hGroup.GetName());
LogF(LoadResStr("IDS_ERR_INVALIDID"), Name.getData());
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fSuccess=FALSE;
}
#ifdef C4ENGINE
// skip def: don't even read sounds!
if (fSuccess && Game.C4S.Definitions.SkipDefs.GetIDCount(id, 1)) return FALSE;
// OldGfx is no longer supported
if (NeededGfxMode == C4DGFXMODE_OLDGFX) return FALSE;
#endif
if (!fSuccess)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Read sounds even if not a valid def (for pure c4d sound folders)
if (dwLoadWhat & C4D_Load_Sounds)
if (pSoundSystem)
pSoundSystem->LoadEffects(hGroup);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return FALSE;
}
#ifdef C4ENGINE
// Read surface bitmap
if (dwLoadWhat & C4D_Load_Bitmap)
if (!Graphics.LoadBitmaps(hGroup, !!ColorByOwner))
@ -654,7 +628,6 @@ BOOL C4Def::Load(C4Group &hGroup,
return FALSE;
}
#endif
#if !defined(C4ENGINE) && !defined(C4GROUP)
@ -691,7 +664,6 @@ BOOL C4Def::Load(C4Group &hGroup,
return FALSE;
#endif
#ifdef C4ENGINE
// Read ActMap
if (dwLoadWhat & C4D_Load_ActMap)
if (!LoadActMap(hGroup))
@ -699,9 +671,7 @@ BOOL C4Def::Load(C4Group &hGroup,
DebugLogF(" Error loading ActMap of %s (%s)", hGroup.GetFullName().getData(), C4IdText(id));
return FALSE;
}
#endif
#ifdef C4ENGINE
// Read script
if (dwLoadWhat & C4D_Load_Script)
{
@ -711,7 +681,6 @@ BOOL C4Def::Load(C4Group &hGroup,
// for downwards compatibility with packing order
Script.Load("Script", hGroup, C4CFN_Script, szLanguage, this, &StringTable, true);
}
#endif
// Read name
C4ComponentHost DefNames;
@ -719,7 +688,6 @@ BOOL C4Def::Load(C4Group &hGroup,
DefNames.GetLanguageString(szLanguage, Name);
DefNames.Close();
#ifdef C4ENGINE
// read clonknames
if (dwLoadWhat & C4D_Load_ClonkNames)
{
@ -791,7 +759,6 @@ BOOL C4Def::Load(C4Group &hGroup,
}
}
#endif
// Read desc
if (dwLoadWhat & C4D_Load_Desc)
@ -800,7 +767,6 @@ BOOL C4Def::Load(C4Group &hGroup,
Desc.TrimSpaces();
}
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Read sounds
if (dwLoadWhat & C4D_Load_Sounds)
@ -825,7 +791,6 @@ BOOL C4Def::Load(C4Group &hGroup,
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Temporary flag
if (dwLoadWhat & C4D_Load_Temporary) Temporary=TRUE;
@ -890,21 +855,18 @@ void C4Def::CrossMapActMap()
BOOL C4Def::ColorizeByMaterial(C4MaterialMap &rMats, BYTE bGBM)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (ColorByMaterial[0])
{
int32_t mat=rMats.Get(ColorByMaterial);
if (mat==MNone) { LogF("C4Def::ColorizeByMaterial: mat %s not defined", ColorByMaterial); return FALSE; }
if (!Graphics.ColorizeByMaterial(mat, rMats, bGBM)) return FALSE;
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - -
// success
return TRUE;
}
void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - -
// default: def picture rect
C4Rect fctPicRect = PictureRect;
@ -928,10 +890,8 @@ void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int
for (C4GraphicsOverlay *pGfxOvrl = pObj->pGfxOverlay; pGfxOvrl; pGfxOvrl = pGfxOvrl->GetNext())
if (pGfxOvrl->IsPicture())
pGfxOvrl->DrawPicture(cgo, pObj);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
#ifdef C4ENGINE
int32_t C4Def::GetValue(C4Object *pInBase, int32_t iBuyPlayer)
{
// CalcDefValue defined?
@ -984,7 +944,6 @@ void C4Def::Synchronize()
ClearFairCrewPhysicals();
}
#endif
//--------------------------------- C4DefList ----------------------------------------------
@ -1021,9 +980,7 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
fSearchMessage=FALSE;
}
#ifdef C4ENGINE // Message - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (fThisSearchMessage) { LogF("%s...",GetFilename(hGroup.GetName())); }
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Load primary definition
if (nDef=new C4Def)
@ -1047,7 +1004,6 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
}
// load additional system scripts for def groups only
#ifdef C4ENGINE
C4Group SysGroup;
char fn[_MAX_FNAME+1] = { 0 };
if (!fPrimaryDef && fLoadSysGroups) if (SysGroup.OpenAsChild(&hGroup, C4CFN_System))
@ -1068,14 +1024,11 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
Game.pFileMonitor->AddDirectory(SysGroup.GetFullName().getData());
SysGroup.Close();
}
#endif
#ifdef C4ENGINE // Message - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (fThisSearchMessage) { LogF(LoadResStr("IDS_PRC_DEFSLOADED"),iResult); }
// progress (could go down one level of recursion...)
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return iResult;
}
@ -1103,17 +1056,13 @@ int32_t C4DefList::LoadFolderLocal( const char *szPath,
}
}
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// progress (could go down one level of recursion...)
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return iResult;
}
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
extern BOOL C4EngineLoadProcess(const char *szMessage, int32_t iProcess);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int32_t C4DefList::Load(const char *szSearch,
DWORD dwLoadWhat, const char *szLanguage,
@ -1148,10 +1097,8 @@ int32_t C4DefList::Load(const char *szSearch,
}
while (_findnext(fdthnd,&fdt)==0);
_findclose(fdthnd);
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// progress
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#else
fputs("FIXME: C4DefList::Load\n", stderr);
#endif
@ -1177,19 +1124,15 @@ int32_t C4DefList::Load(const char *szSearch,
if (!hGroup.Open(Config.AtDataReadPath(szSearch)))
{
// Specified file not found (failure)
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LogFatal(FormatString(LoadResStr("IDS_PRC_DEFNOTFOUND"),szSearch).getData());
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LoadFailure=TRUE;
return iResult;
}
iResult += Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,TRUE,iMinProgress,iMaxProgress);
hGroup.Close();
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// progress (could go down one level of recursion...)
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return iResult;
}
@ -1202,7 +1145,6 @@ BOOL C4DefList::Add(C4Def *pDef, BOOL fOverload)
C4Def *pLastDef = ID2Def(pDef->id);
if (pLastDef && !fOverload) return FALSE;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Log overloaded def
if (Config.Graphics.VerboseObjectLoading>=1)
if (pLastDef)
@ -1214,7 +1156,6 @@ BOOL C4DefList::Add(C4Def *pDef, BOOL fOverload)
LogF(" Overload by %s",pDef->Filename);
}
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Remove old def
Remove(pDef->id);
@ -1327,7 +1268,6 @@ C4Def* C4DefList::GetDef(int32_t iIndex, DWORD dwCategory)
return NULL;
}
#ifdef C4ENGINE
C4Def *C4DefList::GetByPath(const char *szPath)
{
// search defs
@ -1345,7 +1285,6 @@ C4Def *C4DefList::GetByPath(const char *szPath)
// not found
return NULL;
}
#endif
int32_t C4DefList::RemoveTemporary()
{
@ -1462,15 +1401,11 @@ int32_t C4DefList::LoadForScenario(const char *szScenario,
// Load specified
iDefs += Load(sSpecified.getData(),dwLoadWhat,szLanguage,pSoundSystem,fOverload);
#ifdef C4ENGINE
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress+iMinProgress)/2);
#endif
// Load folder local
iDefs += LoadFolderLocal(szScenario,dwLoadWhat,szLanguage,pSoundSystem,fOverload);
#ifdef C4ENGINE
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress*3+iMinProgress)/4);
#endif
// Load local
iDefs += Load(hScenario,dwLoadWhat,szLanguage,pSoundSystem,fOverload);
@ -1478,10 +1413,8 @@ int32_t C4DefList::LoadForScenario(const char *szScenario,
// build quick access table
BuildTable();
#ifdef C4ENGINE
// progress
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
#endif
// Done
return iDefs;
@ -1491,13 +1424,11 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
{
// Safety
if (!pDef) return FALSE;
#ifdef C4ENGINE
// backup graphics names and pointers
// GfxBackup-dtor will ensure that upon loading-failure all graphics are reset to default
C4DefGraphicsPtrBackup GfxBackup(&pDef->Graphics);
// clear any pointers into def (name)
::Objects.ClearDefPointers(pDef);
#endif
// Clear def
pDef->Clear(); // Assume filename is being kept
// Reload def
@ -1507,16 +1438,12 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
hGroup.Close();
// rebuild quick access table
BuildTable();
#ifdef C4ENGINE
// update script engine - this will also do include callbacks
::ScriptEngine.ReLink(this);
#endif
#ifdef C4ENGINE
// update definition pointers
::Objects.UpdateDefPointers(pDef);
// restore graphics
GfxBackup.AssignUpdate(&pDef->Graphics);
#endif
// Success
return TRUE;
}
@ -1562,7 +1489,6 @@ void C4DefList::BuildTable()
bool C4Def::LoadPortraits(C4Group &hGroup)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset any previous portraits
Portraits = NULL; PortraitCount = 0;
// search for portraits within def graphics
@ -1574,21 +1500,18 @@ bool C4Def::LoadPortraits(C4Group &hGroup)
// count
++PortraitCount;
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return true;
}
C4ValueArray *C4Def::GetCustomComponents(C4Value *pvArrayHolder, C4Object *pBuilder, C4Object *pObjInstance)
{
// return custom components array if script function is defined and returns an array
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (Script.SFn_CustomComponents)
{
C4AulParSet pars(C4VObj(pBuilder));
*pvArrayHolder = Script.SFn_CustomComponents->Exec(pObjInstance, &pars);
return pvArrayHolder->getArray();
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return NULL;
}
@ -1664,34 +1587,28 @@ void C4Def::GetComponents(C4IDList *pOutList, C4Object *pObjInstance, C4Object *
}
else
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// no valid script overload: Assume object or definition components
if (pObjInstance)
*pOutList = pObjInstance->Component;
else
*pOutList = Component;
#endif
}
}
void C4Def::IncludeDefinition(C4Def *pIncludeDef)
{
#ifdef C4ENGINE
// inherited rank infos and clonk names, if this definition doesn't have its own
if (!fClonkNamesOwned) pClonkNames = pIncludeDef->pClonkNames;
if (!fRankNamesOwned) pRankNames = pIncludeDef->pRankNames;
if (!fRankSymbolsOwned) { pRankSymbols = pIncludeDef->pRankSymbols; iNumRankSymbols = pIncludeDef->iNumRankSymbols; }
#endif
}
void C4Def::ResetIncludeDependencies()
{
#ifdef C4ENGINE
// clear all pointers into foreign defs
if (!fClonkNamesOwned) pClonkNames = NULL;
if (!fRankNamesOwned) pRankNames = NULL;
if (!fRankSymbolsOwned) { pRankSymbols = NULL; iNumRankSymbols = 0; }
#endif
}
@ -1701,13 +1618,11 @@ void C4Def::ResetIncludeDependencies()
bool C4DefList::GetFontImage(const char *szImageTag, CFacet &rOutImgFacet)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// extended: images by game
C4FacetSurface fctOut;
if (!Game.DrawTextSpecImage(fctOut, szImageTag)) return false;
if (fctOut.Surface == &fctOut.GetFace()) return false; // cannot use facets that are drawn on the fly right now...
rOutImgFacet.Set(fctOut.Surface, fctOut.X, fctOut.Y, fctOut.Wdt, fctOut.Hgt);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// done, found
return true;
}
@ -1752,14 +1667,12 @@ void C4DefList::SortByID()
}
}
#ifdef C4ENGINE
void C4DefList::Synchronize()
{
C4Def *pDef;
for (pDef=FirstDef; pDef; pDef=pDef->Next)
pDef->Synchronize();
}
#endif
void C4DefList::ResetIncludeDependencies()
{

View File

@ -69,17 +69,14 @@ C4Facet C4Facet::GetPhase(int iPhaseX, int iPhaseY)
void C4Facet::Draw(SURFACE sfcTarget, float iX, float iY, int32_t iPhaseX, int32_t iPhaseY)
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
sfcTarget,
iX,iY,Wdt,Hgt,TRUE);
#endif
}
#ifdef C4ENGINE
void C4Facet::DrawT(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
{
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
@ -118,11 +115,9 @@ void C4Facet::DrawT(C4Facet &cgo, BOOL fAspect, int32_t iPhaseX, int32_t iPhaseY
ccgo.Surface,ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt,
TRUE,pTransform);
}
#endif // C4ENGINE
void C4Facet::Draw(C4Facet &cgo, BOOL fAspect, int32_t iPhaseX, int32_t iPhaseY, BOOL fTransparent)
{
#ifdef C4ENGINE
// Valid parameter check
if (!lpDDraw || !Surface || !cgo.Surface || !Wdt || !Hgt) return;
// Drawing area
@ -149,12 +144,10 @@ void C4Facet::Draw(C4Facet &cgo, BOOL fAspect, int32_t iPhaseX, int32_t iPhaseY,
ccgo.Surface,
ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt,
fTransparent);
#endif
}
void C4Facet::DrawFullScreen(C4Facet &cgo)
{
#ifdef C4ENGINE
// stretched fullscreen blit: make sure right and lower side are cleared, because this may be missed due to stretching
if (cgo.Wdt > Wdt+2 || cgo.Hgt > Wdt+2)
{
@ -163,7 +156,6 @@ void C4Facet::DrawFullScreen(C4Facet &cgo)
}
// normal blit OK
Draw(cgo, FALSE);
#endif
}
void C4Facet::DrawClr(C4Facet &cgo, BOOL fAspect, DWORD dwClr)
@ -193,7 +185,6 @@ void C4Facet::DrawValue2Clr(C4Facet &cgo, int32_t iValue1, int32_t iValue2, DWOR
void C4Facet::DrawXR(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iSectionX, int32_t iSectionY, int32_t r)
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
CBltTransform rot;
rot.SetRotate(r, (float) (iX+iX+iWdt)/2, (float) (iY+iY+iHgt)/2);
@ -202,7 +193,6 @@ void C4Facet::DrawXR(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, in
sfcTarget,
iX,iY,iWdt,iHgt,
TRUE,&rot);
#endif
}
C4Facet C4Facet::TruncateSection(int32_t iAlign)
@ -265,7 +255,6 @@ C4Facet C4Facet::Truncate(int32_t iAlign, int32_t iSize)
void C4Facet::DrawSectionSelect(C4Facet &cgo, int32_t iSelection, int32_t iMaxSelect)
{
#ifdef C4ENGINE
int32_t sections = cgo.GetSectionCount();
int32_t idnum = iMaxSelect;
int32_t firstid = BoundBy<int32_t>(iSelection-sections/2,0,Max<int32_t>(idnum-sections,0));
@ -277,12 +266,10 @@ void C4Facet::DrawSectionSelect(C4Facet &cgo, int32_t iSelection, int32_t iMaxSe
lpDDraw->DrawBox(cgo2.Surface,cgo2.X,cgo2.Y,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1,CRed);
Draw(cgo2,TRUE,firstid+cnt,0);
}
#endif
}
void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t iSectionY, int32_t iAlign)
{
#ifdef C4ENGINE
if (!lpDDraw) return;
char ostr[25]; sprintf(ostr,"%i",iValue);
switch (iAlign)
@ -303,12 +290,10 @@ void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t
break;
}
}
#endif
}
void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t iSectionX, int32_t iSectionY, int32_t iAlign, int32_t *piUsedWidth)
{
#ifdef C4ENGINE
if (!lpDDraw) return;
char ostr[25]; sprintf(ostr,"%i/%i",iValue1,iValue2);
switch (iAlign)
@ -331,24 +316,20 @@ void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t
}
break;
}
#endif
}
void C4Facet::DrawX(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iSectionX, int32_t iSectionY) const
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface,
float(X+Wdt*iSectionX),float(Y+Hgt*iSectionY),float(Wdt),float(Hgt),
sfcTarget,
iX,iY,iWdt,iHgt,
TRUE);
#endif
}
void C4Facet::DrawXFloat(SURFACE sfcTarget, float fX, float fY, float fWdt, float fHgt) const
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt || fWdt<=0 || fHgt<=0) return;
// Since only source coordinates are available as floats for blitting, go inwards into this facet to match blit
// for closest integer target coordinates
@ -369,10 +350,8 @@ void C4Facet::DrawXFloat(SURFACE sfcTarget, float fX, float fY, float fWdt, floa
sfcTarget,
iX,iY,iX2-iX+1,iY2-iY+1,
TRUE);*/
#endif
}
#ifdef C4ENGINE
void C4Facet::DrawXT(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
{
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
@ -382,11 +361,9 @@ void C4Facet::DrawXT(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, in
iX,iY,iWdt,iHgt,
TRUE, pTransform);
}
#endif // C4ENGINE
void C4Facet::DrawEnergyLevel(int32_t iLevel, int32_t iRange, int32_t iColor)
{
#ifdef C4ENGINE
if (!lpDDraw) return;
iLevel = BoundBy<int32_t>(iLevel,0,iRange);
lpDDraw->DrawBox(Surface,
@ -397,12 +374,10 @@ void C4Facet::DrawEnergyLevel(int32_t iLevel, int32_t iRange, int32_t iColor)
X+1,Y+1+(Hgt-2)-(Hgt-2)*iLevel/Max<int32_t>(iRange,1),
X+Wdt-2,Y+Hgt-2,
iColor);
#endif
}
void C4Facet::DrawEnergyLevelEx(int32_t iLevel, int32_t iRange, const C4Facet &gfx, int32_t bar_idx)
{
#ifdef C4ENGINE
// draw energy level using graphics
if (!lpDDraw || !gfx.Surface) return;
int32_t h=gfx.Hgt;
@ -456,7 +431,6 @@ void C4Facet::DrawEnergyLevelEx(int32_t iLevel, int32_t iRange, const C4Facet &g
gfx_draw.Draw(Surface, X, Y+iY, bar_idx+bar_idx+!filled);
iY += dh;
}
#endif
}
void C4Facet::Set(CSurface &rSfc)
@ -508,11 +482,9 @@ void C4Facet::Draw(HWND hWnd, int32_t iTx, int32_t iTy, int32_t iTWdt, int32_t i
void C4Facet::DrawTile(SURFACE sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !Wdt || !Hgt) return;
// Blits whole source surface, not surface facet area
lpDDraw->BlitSurfaceTile(Surface,sfcTarget,iX,iY,iWdt,iHgt,0,0,TRUE);
#endif
}
void C4Facet::Expand(int32_t iLeft, int32_t iRight, int32_t iTop, int32_t iBottom)
@ -525,28 +497,20 @@ void C4Facet::Expand(int32_t iLeft, int32_t iRight, int32_t iTop, int32_t iBotto
void C4Facet::Wipe()
{
#ifdef C4ENGINE
if (!lpDDraw || !Surface || !Wdt || !Hgt) return;
lpDDraw->WipeSurface(Surface);
#endif
}
bool C4Facet::GetPhaseNum(int32_t &rX, int32_t &rY)
{
#ifdef C4ENGINE
// safety
if (!Surface) return false;
// newgfx: use locally stored size
rX=Surface->Wdt/Wdt; rY=Surface->Hgt/Hgt;
// success
return true;
#else
// no surface sizes in frontend...sorry
return false;
#endif
}
#ifdef C4ENGINE
void C4DrawTransform::CompileFunc(StdCompiler *pComp)
{
bool fCompiler = pComp->isCompiler();
@ -619,7 +583,6 @@ void C4DrawTransform::SetTransformAt(C4DrawTransform &r, float iOffX, float iOff
r.mat[6], r.mat[7], r.mat[8] - r.mat[6]*iOffX - r.mat[7]*iOffY);
}
#endif
C4Facet C4Facet::GetFraction(int32_t percentWdt, int32_t percentHgt, int32_t alignX, int32_t alignY)
{

View File

@ -29,7 +29,6 @@
#include <C4Group.h>
#endif
#ifdef C4ENGINE
void C4TargetFacet::Set(SURFACE nsfc, int nx, int ny, int nwdt, int nhgt, float ntx, float nty)
{
@ -73,13 +72,8 @@ void C4TargetFacet::DrawBolt(int iX1, int iY1, int iX2, int iY2, BYTE bCol, BYTE
// Draw bolt
float pvtx[2*4];
pvtx[0]=iX1; pvtx[1]=iY1; pvtx[2]=iX2; pvtx[3]=iY2;
#ifdef C4ENGINE
pvtx[4]=iX2+SafeRandom(DrawBoltR1)-DrawBoltR2; pvtx[5]=iY2+SafeRandom(DrawBoltR1)-DrawBoltR2;
pvtx[6]=iX1+SafeRandom(DrawBoltR1)-DrawBoltR2; pvtx[7]=iY1+SafeRandom(DrawBoltR1)-DrawBoltR2;
#else
pvtx[4]=iX2+X%3-1; pvtx[5]=iY2+X%3-1;
pvtx[6]=iX1+Y%3-1; pvtx[7]=iY1+Y%3-1;
#endif
// Draw in surface
DWORD dwClr1=lpDDraw->Pal.GetClr(bCol),dwClr2;
DWORD dwClr3=lpDDraw->Pal.GetClr(bCol2),dwClr4;
@ -262,4 +256,3 @@ bool C4FacetSurface::EnsureOwnSurface()
return true;
}
#endif // C4ENGINE

View File

@ -26,8 +26,6 @@
#include <C4Group.h>
#include <C4Components.h>
#include <C4Game.h>
#ifdef C4ENGINE
#endif
#endif
#if defined(C4FRONTEND) || defined (C4GROUP)

View File

@ -277,7 +277,6 @@ int32_t C4FontLoader::GetClosestAvailableSize(const char *szFontName, int32_t iW
return iRVal;
}
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - -
bool C4FontLoader::InitFont(CStdFont &rFont, C4VectorFont * pFont, int32_t iSize, uint32_t dwWeight, bool fDoShadow)
{
@ -484,5 +483,4 @@ bool C4FontLoader::InitFont(CStdFont &rFont, const char *szFontName, FontType eT
}
#endif // C4ENGINE - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -73,11 +73,9 @@ char *szCurrAccessedEntry=NULL;
int iC4GroupRewindFilePtrNoWarn=0;
#endif
#ifdef C4ENGINE
#ifdef _DEBUG
//#define C4GROUP_DUMP_ACCESS
#endif
#endif
//---------------------------- Global C4Group_Functions -------------------------------------------
@ -1359,13 +1357,11 @@ bool C4Group::RewindFilePtr()
{
#ifdef _DEBUG
#ifdef C4ENGINE
if (szCurrAccessedEntry && !iC4GroupRewindFilePtrNoWarn)
{
LogF ("C4Group::RewindFilePtr() for %s (%s)", szCurrAccessedEntry ? szCurrAccessedEntry : "???", FileName);
szCurrAccessedEntry=NULL;
}
#endif
#endif
// Child group file: pass command to mother

View File

@ -23,13 +23,8 @@
#include <C4Include.h>
#include <C4GroupSet.h>
#ifdef C4ENGINE
#include <C4Game.h>
#include <C4Log.h>
#else
#include <C4Group.h>
#include <C4Components.h>
#endif
C4GroupSetNode::C4GroupSetNode(C4GroupSet &rParent, C4GroupSetNode *pPrev, C4Group &rGroup, bool fGrpOwned, int32_t id)
{
@ -281,7 +276,6 @@ bool C4GroupSet::UnregisterGroup(int32_t iIndex)
}
#ifdef C4ENGINE
C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
{
// the scenario filename may be a scenario or directly a group folder
@ -363,4 +357,3 @@ C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
}
return pParentGroup;
}
#endif

View File

@ -265,7 +265,6 @@ bool C4IDList::IncreaseIDCount(C4ID c_id, bool fAddNewID, int32_t IncreaseBy, bo
// Access by category-sorted index
#ifdef C4ENGINE
C4ID C4IDList::GetID(C4DefList &rDefs, int32_t dwCategory, int32_t index, int32_t *ipCount) const
{
int32_t cindex=-1;
@ -352,7 +351,6 @@ int32_t C4IDList::GetNumberOfIDs(C4DefList &rDefs, int32_t dwCategory) const
}
return idnum;
}
#endif
// IDList merge
bool C4IDList::Add(C4IDList &rList)
@ -525,7 +523,6 @@ void C4IDList::Draw(C4Facet &cgo, int32_t iSelection,
C4DefList &rDefs, DWORD dwCategory,
bool fCounts, int32_t iAlign) const
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int32_t sections = cgo.GetSectionCount();
int32_t idnum = GetNumberOfIDs(rDefs,dwCategory);
@ -542,7 +539,6 @@ void C4IDList::Draw(C4Facet &cgo, int32_t iSelection,
if (fCounts) Application.DDraw->TextOut(buf, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - ::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
void C4IDList::Default()

View File

@ -97,9 +97,7 @@ BOOL C4PlayerInfoCore::Load(C4Group &hGroup)
PrefColorDw &= 0xffffff;
PrefColor2Dw &= 0xffffff;
// Validate name
#ifdef C4ENGINE
CMarkup::StripMarkup(PrefName);
#endif
// Success
return TRUE;
}
@ -196,7 +194,6 @@ struct C4PhysInfoNameMap_t { const char *szName; C4PhysicalInfo::Offset off; } C
void C4PhysicalInfo::PromotionUpdate(int32_t iRank, bool fUpdateTrainablePhysicals, C4Def *pTrainDef)
{
#ifdef C4ENGINE
if (iRank>=0) { CanDig=1; CanChop=1; CanConstruct=1; }
if (iRank>=0) { CanScale=1; }
if (iRank>=0) { CanHangle=1; }
@ -221,7 +218,6 @@ void C4PhysicalInfo::PromotionUpdate(int32_t iRank, bool fUpdateTrainablePhysica
}
}
}
#endif
}
C4PhysicalInfo::C4PhysicalInfo()
@ -295,9 +291,7 @@ bool C4PhysicalInfo::operator ==(const C4PhysicalInfo &cmp) const
void C4TempPhysicalInfo::CompileFunc(StdCompiler *pComp)
{
C4PhysicalInfo::CompileFunc(pComp);
#ifdef C4ENGINE
pComp->Value(mkNamingAdapt( mkSTLContainerAdapt(Changes), "Changes", std::vector<C4PhysicalChange>()));
#endif
}
void C4TempPhysicalInfo::Train(Offset mpiOffset, int32_t iTrainBy, int32_t iMaxTrain)
@ -305,16 +299,13 @@ void C4TempPhysicalInfo::Train(Offset mpiOffset, int32_t iTrainBy, int32_t iMaxT
// train own value
C4PhysicalInfo::Train(mpiOffset, iTrainBy, iMaxTrain);
// train all temp values
#ifdef C4ENGINE
for (std::vector<C4PhysicalChange>::iterator i = Changes.begin(); i != Changes.end(); ++i)
if (i->mpiOffset == mpiOffset)
TrainValue(&(i->PrevVal), iTrainBy, iMaxTrain);
#endif
}
bool C4TempPhysicalInfo::HasChanges(C4PhysicalInfo *pRefPhysical)
{
#ifdef C4ENGINE
// always return true if there are temp changes
if (!Changes.empty()) return true;
// also return true if any value deviates from the reference
@ -322,7 +313,6 @@ bool C4TempPhysicalInfo::HasChanges(C4PhysicalInfo *pRefPhysical)
{
if (!(*pRefPhysical == *this)) return true;
}
#endif
// no change known
return false;
}
@ -330,14 +320,11 @@ bool C4TempPhysicalInfo::HasChanges(C4PhysicalInfo *pRefPhysical)
void C4TempPhysicalInfo::RegisterChange(C4PhysicalInfo::Offset mpiOffset)
{
// append physical change to list
#ifdef C4ENGINE
Changes.push_back(C4PhysicalChange(this->*mpiOffset, mpiOffset));
#endif
}
bool C4TempPhysicalInfo::ResetPhysical(C4PhysicalInfo::Offset mpiOffset)
{
#ifdef C4ENGINE
// search last matching physical check (should always be last if well scripted)
for (std::vector<C4PhysicalChange>::reverse_iterator i = Changes.rbegin(); i != Changes.rend(); ++i)
if ((*i).mpiOffset == mpiOffset)
@ -346,7 +333,6 @@ bool C4TempPhysicalInfo::ResetPhysical(C4PhysicalInfo::Offset mpiOffset)
Changes.erase((i+1).base());
return true;
}
#endif
return false;
}
@ -409,9 +395,7 @@ void C4ObjectInfoCore::Default(C4ID n_id,
if (!Name[0]) SCopy("Clonk",Name,C4MaxName);
}
#ifdef C4ENGINE
if (pDefs) UpdateCustomRanks(pDefs);
#endif
// Physical
Physical.Default();
@ -431,7 +415,6 @@ void C4ObjectInfoCore::Promote(int32_t iRank, C4RankSystem &rRanks, bool fForceR
if (sNewRank) sRankName.Copy(sNewRank);
}
#ifdef C4ENGINE
void C4ObjectInfoCore::UpdateCustomRanks(C4DefList *pDefs)
{
assert(pDefs);
@ -462,7 +445,6 @@ void C4ObjectInfoCore::UpdateCustomRanks(C4DefList *pDefs)
NextRankExp = 0;
}
}
#endif
bool C4ObjectInfoCore::GetNextRankInfo(C4RankSystem &rDefaultRanks, int32_t *piNextRankExp, StdStrBuf *psNextRankName)
{
@ -501,10 +483,8 @@ BOOL C4ObjectInfoCore::Load(C4Group &hGroup)
BOOL C4ObjectInfoCore::Save(C4Group &hGroup, C4DefList *pDefs)
{
#ifdef C4ENGINE
// rank overload by def: Update any NextRank-stuff
if (pDefs) UpdateCustomRanks(pDefs);
#endif
char *Buffer; size_t BufferSize;
if (!Decompile(&Buffer,&BufferSize))
return FALSE;

View File

@ -33,10 +33,8 @@
#include <C4Components.h>
#include <C4Log.h>
#include <C4Config.h>
#ifdef C4ENGINE
#include <C4Game.h>
#endif
#endif
#ifdef HAVE_ICONV
#ifdef HAVE_LANGINFO_H
@ -265,7 +263,6 @@ C4GroupSet& C4Language::GetPackGroups(const char *strRelativePath)
// Store wanted target location
SCopy(strRelativePath, strTargetLocation, _MAX_PATH);
#ifdef C4ENGINE
// Adjust location by scenario origin
if (Game.C4S.Head.Origin.getLength() && SEqualNoCase(GetExtension(Game.C4S.Head.Origin.getData()), "c4s"))
{
@ -285,7 +282,6 @@ C4GroupSet& C4Language::GetPackGroups(const char *strRelativePath)
}
}
}
#endif
// Target location has not changed: return last list of pack groups
if (SEqualNoCase(strTargetLocation, PackGroupLocation))

View File

@ -378,12 +378,10 @@ bool C4MCOverlay::SetField(C4MCParser *pParser, const char *szField, const char
case C4MCV_ScriptFunc:
{
// get script func of main script
#ifdef C4ENGINE
C4AulFunc *pSFunc = Game.Script.GetSFunc(StrPar, AA_PROTECTED);
if (!pSFunc) throw C4MCParserErr(pParser, C4MCErr_SFuncNotFound, StrPar);
// add to main
*((C4MCCallbackArray **) pTarget) = new C4MCCallbackArray(pSFunc, MapCreator);
#endif
}
}
// done
@ -794,7 +792,6 @@ C4MCMap *C4MapCreatorS2::GetMap(const char *szMapName)
return pMap;
}
#ifdef C4ENGINE // - - - - - -- -- - -- - -- - -- - -
CSurface8 * C4MapCreatorS2::Render(const char *szMapName)
{
// get map
@ -815,7 +812,6 @@ CSurface8 * C4MapCreatorS2::Render(const char *szMapName)
// success
return sfc;
}
#endif // ----- -- - - - - - -- - - - - -
BYTE *C4MapCreatorS2::RenderBuf(const char *szMapName, int32_t &sfcWdt, int32_t &sfcHgt)
{
@ -854,12 +850,8 @@ C4MCParserErr::C4MCParserErr(C4MCParser *pParser, const char *szMsg, const char
void C4MCParserErr::show()
{
#ifdef C4ENGINE
// log error
Log(Msg);
#else
MessageBox(NULL, Msg, "Landscape Generator", MB_OK);
#endif
}
@ -1559,7 +1551,6 @@ bool AlgoGradient(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
bool AlgoScript(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
{
#ifdef C4ENGINE
// get script function
C4AulFunc *pFunc = Game.Script.GetSFunc(FormatString("ScriptAlgo%s", pOvrl->Name).getData());
// failsafe
@ -1576,7 +1567,6 @@ bool AlgoScript(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
// do nothing
delete err;
}
#endif
return false;
}

View File

@ -37,10 +37,8 @@
#include <C4SoundSystem.h>
#include <C4Effects.h>
#include <C4Game.h>
#ifdef C4ENGINE
#include <C4Log.h>
#include <C4Physics.h> // For GravAccel
#endif
#endif
@ -53,7 +51,6 @@ BYTE MCVehic=0;
// -------------------------------------- C4MaterialReaction
#ifdef C4ENGINE
struct ReactionFuncMapEntry { const char *szRFName; C4MaterialReactionFunc pFunc; };
@ -65,11 +62,9 @@ const ReactionFuncMapEntry ReactionFuncMap[] = {
{ "Insert", &C4MaterialMap::mrfInsert },
{ NULL, &C4MaterialReaction::NoReaction } };
#endif
void C4MaterialReaction::CompileFunc(StdCompiler *pComp)
{
#ifdef C4ENGINE
if (pComp->isCompiler()) pScriptFunc = NULL;
// compile reaction func ptr
StdStrBuf sReactionFuncName;
@ -78,7 +73,6 @@ void C4MaterialReaction::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(sReactionFuncName, "Type", StdStrBuf() ));
i=0; while (ReactionFuncMap[i].szRFName && !SEqual(ReactionFuncMap[i].szRFName, sReactionFuncName.getData())) ++i;
pFunc = ReactionFuncMap[i].pFunc;
#endif
// compile the rest
pComp->Value(mkNamingAdapt(TargetSpec, "TargetSpec", StdCopyStrBuf() ));
pComp->Value(mkNamingAdapt(ScriptFunc, "ScriptFunc", StdCopyStrBuf() ));
@ -91,7 +85,6 @@ void C4MaterialReaction::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(iCorrosionRate, "CorrosionRate", 100 ));
}
#ifdef C4ENGINE
void C4MaterialReaction::ResolveScriptFuncs(const char *szMatName)
{
@ -101,7 +94,6 @@ void C4MaterialReaction::ResolveScriptFuncs(const char *szMatName)
else
pScriptFunc = NULL;
}
#endif
// -------------------------------------- C4MaterialCore
@ -175,7 +167,6 @@ BOOL C4MaterialCore::Load(C4Group &hGroup,
if(!CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, Source, Name.getData()))
return FALSE;
// adjust placement, if not specified
#ifdef C4ENGINE
if (!Placement)
{
if (DensitySolid(Density))
@ -189,7 +180,6 @@ BOOL C4MaterialCore::Load(C4Group &hGroup,
Placement=10;
else Placement=5;
}
#endif
return TRUE;
}
@ -268,32 +258,21 @@ C4Material::C4Material()
AboveTempConvertTo=0;
}
#ifdef C4ENGINE
void C4Material::UpdateScriptPointers()
{
for (uint32_t i = 0; i < CustomReactionList.size(); ++i)
CustomReactionList[i].ResolveScriptFuncs(Name);
}
#endif
// -------------------------------------- C4MaterialMap
#ifdef C4ENGINE
C4MaterialMap::C4MaterialMap() : DefReactConvert(&mrfConvert), DefReactPoof(&mrfPoof), DefReactCorrode(&mrfCorrode), DefReactIncinerate(&mrfIncinerate), DefReactInsert(&mrfInsert)
{
Default();
}
#else
C4MaterialMap::C4MaterialMap()
{
Default();
}
#endif
C4MaterialMap::~C4MaterialMap()
{
@ -357,7 +336,6 @@ int32_t C4MaterialMap::Get(const char *szMaterial)
return MNone;
}
#ifdef C4ENGINE
bool C4MaterialMap::CrossMapMaterials() // Called after load
{
@ -540,7 +518,6 @@ bool C4MaterialMap::CrossMapMaterials() // Called after load
return true;
}
#endif
void C4MaterialMap::SetMatReaction(int32_t iPXSMat, int32_t iLSMat, C4MaterialReaction *pReact)
{
@ -635,7 +612,6 @@ C4MaterialReaction *C4MaterialMap::GetReaction(int32_t iPXSMat, int32_t iLandsca
return GetReactionUnsafe(iPXSMat, iLandscapeMat);
}
#ifdef C4ENGINE
bool mrfInsertCheck(int32_t &iX, int32_t &iY, FIXED &fXDir, FIXED &fYDir, int32_t &iPxsMat, int32_t iLsMat, bool *pfPosChanged)
{
@ -906,7 +882,6 @@ void C4MaterialMap::UpdateScriptPointers()
for (int32_t i=0; i<Num; ++i) Map[i].UpdateScriptPointers();
}
#endif
int32_t PixCol2MatOld(BYTE pixc)
{

View File

@ -47,7 +47,6 @@ void C4Network2Reference::SetSourceIP(in_addr ip)
Addrs[i].SetIP(ip);
}
#ifdef C4ENGINE
void C4Network2Reference::InitLocal()
{
// Copy all game parameters
@ -82,7 +81,6 @@ void C4Network2Reference::InitLocal()
Addrs[i] = pLocalNetClient->getAddr(i);
}
#endif
void C4Network2Reference::SortNullIPsBack()
{

View File

@ -62,11 +62,9 @@ void C4ObjectInfo::Default()
Filename[0]=0;
Next=NULL;
pDef = NULL;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portrait.Default();
pNewPortrait = NULL;
pCustomPortrait = NULL;
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
BOOL C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait)
@ -82,9 +80,7 @@ BOOL C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname, bool fLoadPor
{ hChild.Close(); return FALSE; }
// resolve definition, if possible
// only works in game, but is not needed in frontend or startup editing anyway
#ifdef C4ENGINE
pDef = C4Id2Def(id);
#endif
hChild.Close();
return TRUE;
}
@ -99,7 +95,6 @@ BOOL C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
SCopy(GetFilename(hGroup.GetName()),Filename,_MAX_FNAME);
// Load core
if (!C4ObjectInfoCore::Load(hGroup)) return FALSE;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Load portrait - always try linking, even if fLoadPortrait is false (doesn't cost mem anyway)
// evaluate portrait string in info
bool fPortraitFileChecked=false;
@ -165,7 +160,6 @@ BOOL C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
else if (Config.Graphics.AddNewCrewPortraits)
// assign a new random crew portrait
SetRandomPortrait(0, true, false);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return TRUE;
}
@ -210,7 +204,6 @@ BOOL C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
C4Group hTemp;
if (!hTemp.OpenAsChild(&hGroup, Filename, FALSE, TRUE))
return FALSE;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// New portrait present, or old portrait not saved yet (old player begin updated)?
if (!fStoreTiny && Config.Graphics.SaveDefaultPortraits) if (pNewPortrait || (Config.Graphics.AddNewCrewPortraits && Portrait.GetGfx() && !hTemp.FindEntry(C4CFN_Portrait)))
{
@ -282,7 +275,6 @@ BOOL C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
}
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Save info to temp group
if (!C4ObjectInfoCore::Save(hTemp, pDefs))
{ hTemp.Close(); return FALSE; }
@ -300,17 +292,14 @@ void C4ObjectInfo::Evaluate()
void C4ObjectInfo::Clear()
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Portrait.Clear();
if (pNewPortrait) { delete pNewPortrait; pNewPortrait=NULL; }
if (pCustomPortrait) { delete pCustomPortrait; pCustomPortrait=NULL; }
pDef=NULL;
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Object *pOfObj)
{
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int iX=0;
@ -362,7 +351,6 @@ void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Objec
else name.Format("%s",pOfObj->GetName ());
Application.DDraw->TextOut(name.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+iX,cgo.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
void C4ObjectInfo::Recruit()
@ -371,7 +359,6 @@ void C4ObjectInfo::Recruit()
if (InAction) return;
WasInAction=TRUE;
InAction=TRUE;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InActionTime=Game.Time;
// rank name overload by def?
C4Def *pDef=::Definitions.ID2Def(id);
@ -380,7 +367,6 @@ void C4ObjectInfo::Recruit()
StdStrBuf sRank(pDef->pRankNames->GetRankName(Rank, true));
if (sRank) sRankName.Copy(sRank);
}
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
void C4ObjectInfo::Retire()
@ -389,9 +375,7 @@ void C4ObjectInfo::Retire()
if (!InAction) return;
// retire
InAction=FALSE;
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TotalPlayingTime+=(Game.Time-InActionTime);
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
void C4ObjectInfo::SetBirthday()
@ -400,7 +384,6 @@ void C4ObjectInfo::SetBirthday()
}
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool C4ObjectInfo::SetRandomPortrait(C4ID idSourceDef, bool fAssignPermanently, bool fCopyFile)
{
@ -471,4 +454,3 @@ bool C4ObjectInfo::ClearPortrait(bool fPermanently)
return true;
}
#endif

View File

@ -464,11 +464,7 @@ BOOL C4Player::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny)
if (!C4PlayerInfoCore::Save(hGroup))
return FALSE;
// Save crew
#ifndef C4ENGINE
C4DefList *pDefs = NULL;
#else
C4DefList *pDefs = &::Definitions;
#endif
if (!CrewInfoList.Save(hGroup, fSavegame, fStoreTiny, pDefs))
{ hGroup.Close(); return FALSE; }
// Sort
@ -2071,7 +2067,6 @@ void C4Player::EvaluateLeague(bool fDisconnected, bool fWon)
BOOL C4Player::LocalSync()
{
#ifdef C4ENGINE
// local sync not necessary for script players
if (GetType() == C4PT_Script) return TRUE;
// evaluate total playing time
@ -2087,17 +2082,14 @@ BOOL C4Player::LocalSync()
// save player
if (!Save())
return FALSE;
#endif
// done, success
return TRUE;
}
#ifdef C4ENGINE
C4PlayerInfo *C4Player::GetInfo()
{
return Game.PlayerInfos.GetPlayerInfoByID(ID);
}
#endif
BOOL C4Player::SetObjectCrewStatus(C4Object *pCrew, BOOL fNewStatus)
{

View File

@ -280,7 +280,6 @@ void C4RankSystem::Default()
iRankExtNum=0;
}
#ifdef C4ENGINE
bool C4RankSystem::DrawRankSymbol(C4FacetSurface *fctSymbol, int32_t iRank, C4Facet *pfctRankSymbols, int32_t iRankSymbolCount, bool fOwnSurface, int32_t iXOff, C4Facet *cgoDrawDirect)
{
// safety
@ -342,6 +341,5 @@ bool C4RankSystem::DrawRankSymbol(C4FacetSurface *fctSymbol, int32_t iRank, C4Fa
}
return false;
}
#endif
C4RankSystem DefaultRanks;

View File

@ -30,8 +30,6 @@
#include <C4Group.h>
#include <C4Components.h>
#include <C4Game.h>
#ifdef C4ENGINE
#endif
#endif
#if defined(C4FRONTEND) || defined (C4GROUP)
@ -652,7 +650,6 @@ BOOL C4SGame::IsMelee()
#ifdef C4ENGINE
// scenario sections
@ -767,4 +764,3 @@ bool C4ScenarioSection::EnsureTempStore(bool fExtractLandscape, bool fExtractObj
return true;
}
#endif // C4ENGINE

View File

@ -67,9 +67,7 @@ BOOL C4ScriptHost::Load(const char *szName, C4Group &hGroup, const char *szFilen
// set name
ScriptName.Format("%s" DirSep "%s", hGroup.GetFullName().getData(), Filename);
// preparse script
#ifdef C4ENGINE
MakeScript();
#endif
// Success
return fSuccess;
}
@ -101,9 +99,7 @@ void C4ScriptHost::Close()
// Make executable script
MakeScript();
// Update console
#if defined(C4ENGINE)
Console.UpdateInputCtrl();
#endif
}
int32_t C4ScriptHost::GetControlMethod(int32_t com, int32_t first, int32_t second)
@ -119,7 +115,6 @@ void C4ScriptHost::GetControlMethodMask(const char *szFunctionFormat, int32_t& f
if (!Script) return;
// Scan for com defined control functions
#ifdef C4ENGINE
int32_t iCom;
char szFunction[256+1];
for (iCom=0; iCom<ComOrderNum; iCom++)
@ -133,21 +128,16 @@ void C4ScriptHost::GetControlMethodMask(const char *szFunctionFormat, int32_t& f
second |= ((func->ControlMethod >> 1) & 0x01) << iCom;
}
}
#endif
}
C4Value C4ScriptHost::Call(const char *szFunction, C4Object *pObj, C4AulParSet *Pars, bool fPrivateCall, bool fPassError)
{
#ifdef C4ENGINE
// get function
C4AulScriptFunc *pFn;
if (!(pFn = GetSFunc(szFunction, AA_PRIVATE))) return C4VNull;
// Call code
return pFn->Exec(pObj,Pars, fPassError);
#else
return 0;
#endif
}
BOOL C4ScriptHost::ReloadScript(const char *szPath)
@ -173,7 +163,6 @@ void C4ScriptHost::SetError(const char *szMessage)
const char *C4ScriptHost::GetControlDesc(const char *szFunctionFormat, int32_t iCom, C4ID *pidImage, int32_t* piImagePhase)
{
#ifdef C4ENGINE
// Compose script function
char szFunction[256+1];
sprintf(szFunction,szFunctionFormat,ComName(iCom));
@ -187,7 +176,6 @@ const char *C4ScriptHost::GetControlDesc(const char *szFunctionFormat, int32_t i
if(piImagePhase) { *piImagePhase = 0; if(pFn) *piImagePhase = pFn->iImagePhase; }
// Return function desc
if (pFn && pFn->Desc.getLength()) return pFn->DescText.getData();
#endif
// No function
return NULL;
}
@ -248,14 +236,12 @@ void C4GameScriptHost::Default()
BOOL C4GameScriptHost::Execute()
{
if (!Script) return FALSE;
#ifdef C4ENGINE
char buffer[500];
if (Go && !::Game.iTick10)
{
sprintf(buffer,PSF_Script,Counter++);
return !! Call(buffer);
}
#endif
return FALSE;
}

View File

@ -332,7 +332,6 @@ BOOL C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
BOOL fAttached=FALSE;
#ifdef C4ENGINE
int32_t vtx,xcnt,ycnt,xcrng,ycrng,xcd,ycd;
BYTE cpix;
@ -429,7 +428,6 @@ BOOL C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
}
}
}
#endif
return fAttached;
}
@ -437,7 +435,6 @@ BOOL C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
BOOL C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy)
{
#ifdef C4ENGINE
if (VtxNum<2) return FALSE;
@ -493,7 +490,6 @@ BOOL C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int3
VtxX[cvtx]=tx; VtxY[cvtx]=ty;
return TRUE;
}
#endif
return FALSE;
}
@ -523,14 +519,12 @@ BOOL C4Shape::CheckContact(int32_t cx, int32_t cy)
// Check all vertices at given object position.
// Return TRUE on any contact.
#ifdef C4ENGINE
for (int32_t cvtx=0; cvtx<VtxNum; cvtx++)
if (!(VtxCNAT[cvtx] & CNAT_NoCollision))
if (GBackDensity(cx+VtxX[cvtx],cy+VtxY[cvtx]) >= ContactDensity)
return TRUE;
#endif
return FALSE;
}
@ -542,7 +536,6 @@ BOOL C4Shape::ContactCheck(int32_t cx, int32_t cy)
// Set VtxContactCNAT and VtxContactMat.
// Return TRUE on any contact.
#ifdef C4ENGINE
ContactCNAT=CNAT_None;
ContactCount=0;
@ -574,7 +567,6 @@ BOOL C4Shape::ContactCheck(int32_t cx, int32_t cy)
}
}
#endif
return ContactCount;
}
@ -630,12 +622,8 @@ C4DensityProvider DefaultDensityProvider;
int32_t C4DensityProvider::GetDensity(int32_t x, int32_t y) const
{
#ifdef C4ENGINE
// default density provider checks the landscape
return GBackDensity(x,y);
#else
return 0;
#endif
}
int32_t C4Shape::GetVertexContact(int32_t iVtx, DWORD dwCheckMask, int32_t tx, int32_t ty, const C4DensityProvider &rDensityProvider)
@ -645,7 +633,6 @@ int32_t C4Shape::GetVertexContact(int32_t iVtx, DWORD dwCheckMask, int32_t tx, i
// check vertex positions (vtx num not range-checked!)
tx += VtxX[iVtx]; ty += VtxY[iVtx];
int32_t iContact = 0;
#ifdef C4ENGINE
// check all directions for solid mat
if (~VtxCNAT[iVtx] & CNAT_NoCollision)
{
@ -655,7 +642,6 @@ int32_t C4Shape::GetVertexContact(int32_t iVtx, DWORD dwCheckMask, int32_t tx, i
if (dwCheckMask & CNAT_Top) if (rDensityProvider.GetDensity(tx, ty-1) >= ContactDensity) iContact |= CNAT_Top;
if (dwCheckMask & CNAT_Bottom) if (rDensityProvider.GetDensity(tx, ty+1) >= ContactDensity) iContact |= CNAT_Bottom;
}
#endif
// return resulting bitmask
return iContact;
}
@ -698,7 +684,6 @@ void C4Shape::CompileFunc(StdCompiler *pComp, bool fRuntime)
// ---- C4RectList ----
#ifdef C4ENGINE
void C4RectList::ClipByRect(const C4Rect &rClip)
{
@ -786,4 +771,3 @@ void C4RectList::ClipByRect(const C4Rect &rClip)
}
}
#endif

View File

@ -46,9 +46,7 @@ C4Texture::C4Texture()
C4Texture::~C4Texture()
{
#ifdef C4ENGINE
delete Surface32;
#endif
}
C4TexMapEntry::C4TexMapEntry()
@ -75,7 +73,6 @@ bool C4TexMapEntry::Create(const char *szMaterial, const char *szTexture)
bool C4TexMapEntry::Init()
{
#ifdef C4ENGINE
// Find material
iMaterialIndex = ::MaterialMap.Get(Material.getData());
if(!MatValid(iMaterialIndex))
@ -101,7 +98,6 @@ bool C4TexMapEntry::Init()
// Create pattern
MatPattern.Set(sfcTexture->Surface32, iZoom, fMono);
MatPattern.SetColors(pMaterial->Color, pMaterial->Alpha);
#endif
return true;
}
@ -130,10 +126,8 @@ BOOL C4TextureMap::AddEntry(BYTE byIndex, const char *szMaterial, const char *sz
Entry[byIndex].Clear();
return FALSE;
}
#ifdef C4ENGINE
// Landscape must be notified (new valid pixel clr)
::Landscape.HandleTexMapUpdate();
#endif
}
return TRUE;
}
@ -228,9 +222,7 @@ int32_t C4TextureMap::Init()
if (!Entry[i].isNull())
if (!Entry[i].Init())
{
#ifdef C4ENGINE
LogF("Error in TextureMap initialization at entry %d", (int) i);
#endif
Entry[i].Clear();
iRemoved++;
}
@ -240,7 +232,6 @@ int32_t C4TextureMap::Init()
bool C4TextureMap::SaveMap(C4Group &hGroup, const char *szEntryName)
{
#ifdef C4ENGINE
// build file in memory
StdStrBuf sTexMapFile;
// add desc
@ -266,15 +257,11 @@ bool C4TextureMap::SaveMap(C4Group &hGroup, const char *szEntryName)
if (!fSuccess) delete [] pBuf;
// done
return fSuccess;
#else
return FALSE;
#endif
}
int32_t C4TextureMap::LoadTextures(C4Group &hGroup, C4Group* OverloadFile)
{
int32_t texnum=0;
#ifdef C4ENGINE
// overload: load from other file
if (OverloadFile) texnum+=LoadTextures(*OverloadFile);
@ -300,7 +287,6 @@ int32_t C4TextureMap::LoadTextures(C4Group &hGroup, C4Group* OverloadFile)
delete ctex;
}
}
#endif
return texnum;
}
@ -334,15 +320,11 @@ int32_t C4TextureMap::GetIndex(const char *szMaterial, const char *szTexture, BO
fEntriesAdded=true;
return byIndex;
}
#ifdef C4ENGINE
if (szErrorIfFailed) DebugLogF("Error getting MatTex %s-%s for %s from TextureMap: Init failed.", szMaterial, szTexture, szErrorIfFailed);
#endif
return 0;
}
// Else, fail
#ifdef C4ENGINE
if (szErrorIfFailed) DebugLogF("Error getting MatTex %s-%s for %s from TextureMap: %s.", szMaterial, szTexture, szErrorIfFailed, fAddIfNotExist ? "Map is full!" : "Entry not found.");
#endif
return 0;
}
@ -360,7 +342,6 @@ int32_t C4TextureMap::GetIndexMatTex(const char *szMaterialTexture, const char *
if(szDefaultTexture)
if(iMatTex = GetIndex(Material.getData(), szDefaultTexture, fAddIfNotExist))
return iMatTex;
#ifdef C4ENGINE
// search material
long iMaterial = ::MaterialMap.Get(szMaterialTexture);
if (!MatValid(iMaterial))
@ -370,9 +351,6 @@ int32_t C4TextureMap::GetIndexMatTex(const char *szMaterialTexture, const char *
}
// return default map entry
return ::MaterialMap.Map[iMaterial].DefaultMatTex;
#else
return 0;
#endif
}
C4Texture * C4TextureMap::GetTexture(const char *szTexture)
@ -386,15 +364,11 @@ C4Texture * C4TextureMap::GetTexture(const char *szTexture)
bool C4TextureMap::CheckTexture(const char *szTexture)
{
#ifdef C4ENGINE
C4Texture *pTexture;
for (pTexture=FirstTexture; pTexture; pTexture=pTexture->Next)
if (SEqualNoCase(pTexture->Name,szTexture))
return true;
return false;
#else
return true;
#endif
}
const char* C4TextureMap::GetTexture(int32_t iIndex)

View File

@ -27,11 +27,9 @@
#ifndef BIG_C4INCLUDE
#include <C4Game.h>
#include <C4GameObjects.h>
#ifdef C4ENGINE
#include <C4Object.h>
#include <C4Log.h>
#endif
#endif
const C4Value C4VNull = C4Value();
const C4Value C4VTrue = C4VBool(true);
@ -64,7 +62,6 @@ void C4Value::AddDataRef()
{
case C4V_pC4Value: Data.Ref->AddRef(this); break;
case C4V_Any: if (Data) { GuessType(); } break;
#ifdef C4ENGINE
case C4V_Array: Data.Array = Data.Array->IncRef(); break;
case C4V_String: Data.Str->IncRef(); break;
case C4V_C4Object:
@ -77,7 +74,6 @@ void C4Value::AddDataRef()
{ LogF("Warning: using ptr on deleted object %p (%s)!", Data.Obj, Data.Obj->GetName()); }
#endif
break;
#endif
default: break;
}
}
@ -92,11 +88,9 @@ void C4Value::DelDataRef(C4V_Data Data, C4V_Type Type, C4Value * pNextRef, C4Val
HasBaseArray = false;
Data.Ref->DelRef(this, pNextRef, pBaseArray);
break;
#ifdef C4ENGINE
case C4V_C4Object: Data.Obj->DelRef(this, pNextRef); break;
case C4V_Array: Data.Array->DecRef(); break;
case C4V_String: Data.Str->DecRef(); break;
#endif
default: break;
}
}
@ -153,7 +147,6 @@ void C4Value::Move(C4Value *nValue)
Set(0);
}
#ifdef C4ENGINE
void C4Value::GetArrayElement(int32_t Index, C4Value & target, C4AulContext *pctx, bool noref)
{
C4Value & Ref = GetRefVal();
@ -198,7 +191,6 @@ void C4Value::SetArrayLength(int32_t size, C4AulContext *cthr)
throw new C4AulExecError(cthr->Obj, "SetLength: array expected");
Ref.Data.Array = Ref.Data.Array->SetLength(size);
}
#endif
const C4Value & C4Value::GetRefVal() const
{
@ -243,12 +235,10 @@ void C4Value::DelRef(const C4Value *pRef, C4Value * pNextRef, C4ValueArray * pBa
}
}
// Was pRef the last ref to an array element?
#ifdef C4ENGINE
if (pBaseArray && !FirstRef)
{
pBaseArray->DecElementRef();
}
#endif
}
C4V_Type C4Value::GuessType()
@ -262,7 +252,6 @@ C4V_Type C4Value::GuessType()
if (LooksLikeID(Data.Int) && Data.Int >= 10000)
return Type = C4V_C4ID;
#ifdef C4ENGINE
// object?
if (::Objects.ObjectNumber(Data.Obj))
{
@ -281,7 +270,6 @@ C4V_Type C4Value::GuessType()
AddDataRef();
return Type;
}
#endif
// must be int now
return Type = C4V_Int;
@ -532,7 +520,6 @@ StdStrBuf C4Value::GetDataString()
return StdStrBuf(Data ? "true" : "false");
case C4V_C4ID:
return StdCopyStrBuf(C4IdText(Data.Int));
#ifdef C4ENGINE
case C4V_C4Object:
{
// obj exists?
@ -561,7 +548,6 @@ StdStrBuf C4Value::GetDataString()
DataString.AppendChar(']');
return DataString;
}
#endif // C4ENGINE
default:
return StdStrBuf("-unknown type- ");
}
@ -569,29 +555,20 @@ StdStrBuf C4Value::GetDataString()
C4Value C4VString(const char *strString)
{
#ifdef C4ENGINE
// safety
if(!strString) return C4Value();
return C4Value(::ScriptEngine.Strings.RegString(strString));
#else
return C4Value();
#endif
}
C4Value C4VString(StdStrBuf Str)
{
#ifdef C4ENGINE
// safety
if(Str.isNull()) return C4Value();
return C4Value(::ScriptEngine.Strings.RegString(Str));
#else
return C4Value();
#endif
}
void C4Value::DenumeratePointer()
{
#ifdef C4ENGINE
// array?
if (Type == C4V_Array)
{
@ -621,7 +598,6 @@ void C4Value::DenumeratePointer()
else
Set(0);
}
#endif
}
void C4Value::CompileFunc(StdCompiler *pComp)
@ -692,12 +668,8 @@ void C4Value::CompileFunc(StdCompiler *pComp)
// object: save object number instead
case C4V_C4Object:
#ifdef C4ENGINE
if(!fCompiler)
iTmp = ::Objects.ObjectNumber(getObj());
#else
if(!fCompiler) iTmp = 0;
#endif
case C4V_C4ObjectEnum:
if(!fCompiler) if (Type == C4V_C4ObjectEnum)
iTmp = Data.Int;
@ -710,7 +682,6 @@ void C4Value::CompileFunc(StdCompiler *pComp)
break;
// string: save string number
#ifdef C4ENGINE
case C4V_String:
{
// search
@ -741,7 +712,6 @@ void C4Value::CompileFunc(StdCompiler *pComp)
// shouldn't happen
case C4V_pC4Value:
#endif //C4ENGINE
default:
assert(false);

View File

@ -110,11 +110,7 @@ C4Value &C4ValueList::GetItem(int32_t iElem)
if(iElem >= iSize && iElem < MaxSize) this->SetSize(iElem + 1);
// out-of-memory? This might not be catched, but it's better than a segfault
if(iElem >= iSize)
#ifdef C4ENGINE
throw new C4AulExecError(NULL,"out of memory");
#else
return pData[0]; // must return something here...
#endif
// return
return pData[iElem];
}
@ -126,11 +122,7 @@ void C4ValueList::SetItem(int32_t iElemNr, C4Value iValue)
if(iElemNr >= iSize && iElemNr < MaxSize) this->SetSize(iElemNr + 1);
// out-of-memory? This might not be catched, but it's better than a segfault
if(iElemNr >= iSize)
#ifdef C4ENGINE
throw new C4AulExecError(NULL,"out of memory");
#else
return;
#endif
// set
pData[iElemNr]=iValue;
}

View File

@ -377,9 +377,7 @@ class CStdDDraw
void DebugLog(const char *szMsg)
{
#ifdef _DEBUG
#ifdef C4ENGINE
Log(szMsg);
#endif
#endif
}

View File

@ -17,7 +17,6 @@
*/
#include <Standard.h>
#ifdef C4ENGINE
#ifdef WITH_GLIB
#include <glib.h>
#endif
@ -63,4 +62,3 @@ bool OpenURL(const char *szURL)
// operating system not supported, or all opening method(s) failed
return false;
}
#endif

View File

@ -1189,7 +1189,6 @@ BOOL CStdDDraw::BlitRotate(SURFACE sfcSource, int fx, int fy, int fwdt, int fhgt
return TRUE;
}
#ifdef C4ENGINE
bool CStdDDraw::Error(const char *szMsg)
{
@ -1197,15 +1196,6 @@ bool CStdDDraw::Error(const char *szMsg)
Log(szMsg); return false;
}
#else
bool CStdDDraw::Error(const char *szMsg)
{
sLastError.Copy(szMsg);
return false;
}
#endif
bool CStdDDraw::CreatePrimaryClipper(unsigned int iXRes, unsigned int iYRes)
{
@ -1344,9 +1334,7 @@ bool CStdDDraw::StringOut(const char *szText, SURFACE sfcDest, float iTx, float
}
if (!fDoMarkup) iFlags|=STDFONT_NOMARKUP;
// draw text
#ifdef C4ENGINE
pFont->DrawText(sfcDest, iTx , iTy , dwFCol, szText, iFlags, Markup, fZoom);
#endif
// done, success
return true;
}

View File

@ -255,7 +255,6 @@ bool CStdAVIFile::GetFrameByTime(time_t iTime, int32_t *piFrame)
return iFrame < iFinalFrame;
}
#ifdef C4ENGINE
bool CStdAVIFile::GrabFrame(int32_t iFrame, CSurface *sfc) const
{
@ -274,7 +273,6 @@ bool CStdAVIFile::GrabFrame(int32_t iFrame, CSurface *sfc) const
return !!sfc->Unlock();
}
#endif
bool CStdAVIFile::OpenAudioStream()
{