forked from Mirrors/openclonk
Merge branch 'master' into pumpfix
commit
b403bb6357
|
@ -70,7 +70,6 @@ else()
|
|||
SET(INITIAL_USE_OPEN_AL OFF)
|
||||
endif()
|
||||
option(USE_OPEN_AL "Use OpenAL to play sounds" ${INITIAL_USE_OPEN_AL})
|
||||
option(DEBUGREC "Debug records" OFF)
|
||||
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
|
||||
option(WITH_AUTOMATIC_UPDATE "Automatic updates are downloaded from the project website." OFF)
|
||||
|
||||
|
|
|
@ -36,16 +36,13 @@ don't need to include this file or any of the files it includes. */
|
|||
#include <boost/function.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#ifdef DEBUGREC
|
||||
#define DEBUGREC_SCRIPT
|
||||
#define DEBUGREC_START_FRAME 0
|
||||
#define DEBUGREC_PXS
|
||||
#define DEBUGREC_OBJCOM
|
||||
#define DEBUGREC_MATSCAN
|
||||
//#define DEBUGREC_RECRUITMENT
|
||||
#define DEBUGREC_MENU
|
||||
#define DEBUGREC_OCF
|
||||
#endif
|
||||
|
||||
// solidmask debugging
|
||||
//#define SOLIDMASK_DEBUG
|
||||
|
|
|
@ -62,6 +62,11 @@ public:
|
|||
char ScreenshotPath[CFG_MaxString+1];
|
||||
bool GamepadEnabled;
|
||||
bool FirstStart;
|
||||
int32_t DebugRec;
|
||||
// if defined, the external file is used for debugrec writing. Otherwise read/check
|
||||
int32_t DebugRecWrite;
|
||||
// if defined, an external file is used for debugrec writing (replays only)
|
||||
char DebugRecExternalFile[_MAX_PATH+1];
|
||||
|
||||
public:
|
||||
static int GetLanguageSequence(const char *strSource, char *strTarget);
|
||||
|
|
|
@ -184,9 +184,8 @@ void C4GameControl::RequestRuntimeRecord()
|
|||
fRecordNeeded = true;
|
||||
// request through a synchronize-call
|
||||
// currnetly do not request, but start record with next gamesync, so network runtime join can be debugged
|
||||
#ifndef DEBUGREC
|
||||
::Control.DoInput(CID_Synchronize, new C4ControlSynchronize(false, true), CDT_Queue);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
::Control.DoInput(CID_Synchronize, new C4ControlSynchronize(false, true), CDT_Queue);
|
||||
}
|
||||
|
||||
bool C4GameControl::IsRuntimeRecordPossible() const
|
||||
|
@ -422,18 +421,19 @@ void C4GameControl::DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4Con
|
|||
|
||||
void C4GameControl::DbgRec(C4RecordChunkType eType, const uint8_t *pData, size_t iSize)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
if (DoNoDebugRec>0) return;
|
||||
// record data
|
||||
if (pRecord)
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4PktDebugRec dr(eType, StdBuf(pData, iSize));
|
||||
pRecord->Rec(Game.FrameCounter, DecompileToBuf<StdCompilerBinWrite>(dr), eType);
|
||||
if (DoNoDebugRec>0) return;
|
||||
// record data
|
||||
if (pRecord)
|
||||
{
|
||||
C4PktDebugRec dr(eType, StdBuf(pData, iSize));
|
||||
pRecord->Rec(Game.FrameCounter, DecompileToBuf<StdCompilerBinWrite>(dr), eType);
|
||||
}
|
||||
// check against playback
|
||||
if (pPlayback)
|
||||
pPlayback->Check(eType, pData, iSize);
|
||||
}
|
||||
// check against playback
|
||||
if (pPlayback)
|
||||
pPlayback->Check(eType, pData, iSize);
|
||||
#endif // DEBUGREC
|
||||
}
|
||||
|
||||
C4ControlDeliveryType C4GameControl::DecideControlDelivery()
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef DEBUGREC
|
||||
#include "C4Record.h"
|
||||
#endif
|
||||
|
||||
/* C4PlayerControlDef */
|
||||
|
||||
|
@ -1073,12 +1071,13 @@ void C4PlayerControl::ExecuteControlPacket(const class C4ControlPlayerControl *p
|
|||
const C4PlayerControlDef *pCtrlDef = ControlDefs.GetControlByIndex(rItem.iControl);
|
||||
if (pCtrlDef)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
if (pCtrlDef->IsSync())
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_PlrCom, &rItem.iControl, sizeof(rItem.iControl));
|
||||
if (pCtrlDef->IsSync())
|
||||
{
|
||||
AddDbgRec(RCT_PlrCom, &rItem.iControl, sizeof(rItem.iControl));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ExecuteControl(rItem.iControl, pCtrl->IsReleaseControl(), pCtrl->GetExtraData(), rItem.iTriggerMode, false, fHandleDownStateOnly))
|
||||
if (pCtrlDef->IsSync())
|
||||
{
|
||||
|
|
|
@ -37,20 +37,13 @@
|
|||
|
||||
#define IMMEDIATEREC
|
||||
|
||||
//#define DEBUGREC_EXTFILE "DbgRec.ocb" // if defined, an external file is used for debugrec writing (replays only)
|
||||
//#define DEBUGREC_EXTFILE_WRITE // if defined, the external file is used for debugrec writing. Otherwise read/check
|
||||
|
||||
#ifdef DEBUGREC
|
||||
#ifdef DEBUGREC_EXTFILE
|
||||
CStdFile DbgRecFile;
|
||||
#endif
|
||||
int DoNoDebugRec=0; // debugrec disable counter
|
||||
|
||||
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
|
||||
{
|
||||
::Control.DbgRec(eType, (const uint8_t *) pData, iSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
C4DebugRecOff::C4DebugRecOff() : fDoOff(true)
|
||||
{
|
||||
|
@ -216,9 +209,8 @@ bool C4Record::Stop(StdStrBuf *pRecordName, BYTE *pRecordSHA1)
|
|||
LogRec.Close();
|
||||
|
||||
// pack group
|
||||
#ifndef DEBUGREC
|
||||
if (!C4Group_PackDirectory(sFilename.getData())) return false;
|
||||
#endif
|
||||
if (!Config.General.DebugRec)
|
||||
if (!C4Group_PackDirectory(sFilename.getData())) return false;
|
||||
|
||||
// return record data
|
||||
if (pRecordName)
|
||||
|
@ -501,23 +493,27 @@ bool C4Playback::Open(C4Group &rGrp)
|
|||
currChunk = chunks.begin();
|
||||
Finished = false;
|
||||
// external debugrec file
|
||||
#if defined(DEBUGREC_EXTFILE) && defined(DEBUGREC)
|
||||
#ifdef DEBUGREC_EXTFILE_WRITE
|
||||
if (!DbgRecFile.Create(DEBUGREC_EXTFILE))
|
||||
if (Config.General.DebugRecExternalFile[0] && Config.General.DebugRec)
|
||||
{
|
||||
LogFatal("DbgRec: Creation of external file \"" DEBUGREC_EXTFILE "\" failed!");
|
||||
return false;
|
||||
if (Config.General.DebugRecWrite)
|
||||
{
|
||||
if (!DbgRecFile.Create(Config.General.DebugRecExternalFile))
|
||||
{
|
||||
LogFatal(FormatString("DbgRec: Creation of external file \"%s\" failed!", Config.General.DebugRecExternalFile).getData());
|
||||
return false;
|
||||
}
|
||||
else LogF("DbgRec: Writing to \"%s\"...", Config.General.DebugRecExternalFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DbgRecFile.Open(Config.General.DebugRecExternalFile))
|
||||
{
|
||||
LogFatal(FormatString("DbgRec: Opening of external file \"%s\" failed!", Config.General.DebugRecExternalFile).getData());
|
||||
return false;
|
||||
}
|
||||
else LogF("DbgRec: Checking against \"%s\"...", Config.General.DebugRecExternalFile);
|
||||
}
|
||||
}
|
||||
else Log("DbgRec: Writing to \"" DEBUGREC_EXTFILE "\"...");
|
||||
#else
|
||||
if (!DbgRecFile.Open(DEBUGREC_EXTFILE))
|
||||
{
|
||||
LogFatal("DbgRec: Opening of external file \"" DEBUGREC_EXTFILE "\" failed!");
|
||||
return false;
|
||||
}
|
||||
else Log("DbgRec: Checking against \"" DEBUGREC_EXTFILE "\"...");
|
||||
#endif
|
||||
#endif
|
||||
// ok
|
||||
return true;
|
||||
}
|
||||
|
@ -860,11 +856,12 @@ bool C4Playback::ExecuteControl(C4Control *pCtrl, int iFrame)
|
|||
// still playbacking?
|
||||
if (currChunk == chunks.end()) return false;
|
||||
if (Finished) { Finish(); return false; }
|
||||
#ifdef DEBUGREC
|
||||
if (DebugRec.firstPkt())
|
||||
DebugRecError("Debug rec overflow!");
|
||||
DebugRec.Clear();
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
if (DebugRec.firstPkt())
|
||||
DebugRecError("Debug rec overflow!");
|
||||
DebugRec.Clear();
|
||||
}
|
||||
// return all control until this frame
|
||||
while (currChunk != chunks.end() && currChunk->Frame <= iFrame)
|
||||
{
|
||||
|
@ -887,28 +884,22 @@ bool C4Playback::ExecuteControl(C4Control *pCtrl, int iFrame)
|
|||
Finished=true;
|
||||
break;
|
||||
|
||||
#ifdef DEBUGREC
|
||||
default: // expect it to be debug rec
|
||||
// append to debug rec buffer
|
||||
if (currChunk->pDbg)
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
DebugRec.Add(CID_DebugRec, currChunk->pDbg);
|
||||
// the debugrec buffer is now responsible for deleting the packet
|
||||
currChunk->pDbg = NULL;
|
||||
// append to debug rec buffer
|
||||
if (currChunk->pDbg)
|
||||
{
|
||||
DebugRec.Add(CID_DebugRec, currChunk->pDbg);
|
||||
// the debugrec buffer is now responsible for deleting the packet
|
||||
currChunk->pDbg = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
// next chunk
|
||||
NextChunk();
|
||||
}
|
||||
// Debug log
|
||||
#ifdef DEBUGREC
|
||||
//sprintf(OSTR, "-- Frame %d:", Game.FrameCounter); Log(OSTR);
|
||||
//char Indent[256+1]; strcpy(Indent, "");
|
||||
//pCtrl->deb_print(Indent);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -937,13 +928,13 @@ void C4Playback::Clear()
|
|||
playbackFile.Close();
|
||||
sequentialBuffer.Clear();
|
||||
fLoadSequential = false;
|
||||
#ifdef DEBUGREC
|
||||
C4IDPacket *pkt;
|
||||
while (pkt = DebugRec.firstPkt()) DebugRec.Delete(pkt);
|
||||
#ifdef DEBUGREC_EXTFILE
|
||||
DbgRecFile.Close();
|
||||
#endif
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4IDPacket *pkt;
|
||||
while (pkt = DebugRec.firstPkt()) DebugRec.Delete(pkt);
|
||||
if (Config.General.DebugRecExternalFile[0])
|
||||
DbgRecFile.Close();
|
||||
}
|
||||
// done
|
||||
Finished = true;
|
||||
}
|
||||
|
@ -1012,7 +1003,6 @@ StdStrBuf GetDbgRecPktData(C4RecordChunkType eType, const StdBuf & RawData)
|
|||
return r;
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
void C4Playback::Check(C4RecordChunkType eType, const uint8_t *pData, int iSize)
|
||||
{
|
||||
// only if enabled
|
||||
|
@ -1021,66 +1011,72 @@ void C4Playback::Check(C4RecordChunkType eType, const uint8_t *pData, int iSize)
|
|||
|
||||
C4PktDebugRec PktInReplay;
|
||||
bool fHasPacketFromHead = false;
|
||||
#ifdef DEBUGREC_EXTFILE
|
||||
#ifdef DEBUGREC_EXTFILE_WRITE
|
||||
// writing of external debugrec file
|
||||
DbgRecFile.Write(&eType, sizeof eType);
|
||||
int32_t iSize32 = iSize;
|
||||
DbgRecFile.Write(&iSize32, sizeof iSize32);
|
||||
DbgRecFile.Write(pData, iSize);
|
||||
return;
|
||||
#else
|
||||
int32_t iSize32 = 0;
|
||||
C4RecordChunkType eTypeRec = RCT_Undefined;
|
||||
DbgRecFile.Read(&eTypeRec, sizeof eTypeRec);
|
||||
DbgRecFile.Read(&iSize32, sizeof iSize32);
|
||||
if (iSize32)
|
||||
if (Config.General.DebugRecExternalFile[0])
|
||||
{
|
||||
StdBuf buf;
|
||||
buf.SetSize(iSize32);
|
||||
DbgRecFile.Read(buf.getMData(), iSize32);
|
||||
PktInReplay = C4PktDebugRec(eTypeRec, buf);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// check debug rec in list
|
||||
C4IDPacket *pkt;
|
||||
if (pkt = DebugRec.firstPkt())
|
||||
{
|
||||
// copy from list
|
||||
PktInReplay = *static_cast<C4PktDebugRec *>(pkt->getPkt());
|
||||
DebugRec.Delete(pkt);
|
||||
if (Config.General.DebugRecWrite)
|
||||
{
|
||||
// writing of external debugrec file
|
||||
DbgRecFile.Write(&eType, sizeof eType);
|
||||
int32_t iSize32 = iSize;
|
||||
DbgRecFile.Write(&iSize32, sizeof iSize32);
|
||||
DbgRecFile.Write(pData, iSize);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t iSize32 = 0;
|
||||
C4RecordChunkType eTypeRec = RCT_Undefined;
|
||||
DbgRecFile.Read(&eTypeRec, sizeof eTypeRec);
|
||||
DbgRecFile.Read(&iSize32, sizeof iSize32);
|
||||
if (iSize32)
|
||||
{
|
||||
StdBuf buf;
|
||||
buf.SetSize(iSize32);
|
||||
DbgRecFile.Read(buf.getMData(), iSize32);
|
||||
PktInReplay = C4PktDebugRec(eTypeRec, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// special sync check skip...
|
||||
while (currChunk != chunks.end() && currChunk->Type == RCT_CtrlPkt)
|
||||
// check debug rec in list
|
||||
C4IDPacket *pkt;
|
||||
if (pkt = DebugRec.firstPkt())
|
||||
{
|
||||
C4IDPacket Packet(*currChunk->pPkt);
|
||||
C4ControlPacket *pCtrlPck = static_cast<C4ControlPacket *>(Packet.getPkt());
|
||||
assert(!pCtrlPck->Sync());
|
||||
::Control.ExecControlPacket(Packet.getPktType(), pCtrlPck);
|
||||
NextChunk();
|
||||
// copy from list
|
||||
PktInReplay = *static_cast<C4PktDebugRec *>(pkt->getPkt());
|
||||
DebugRec.Delete(pkt);
|
||||
}
|
||||
// record end?
|
||||
if (currChunk == chunks.end() || currChunk->Type == RCT_End || Finished)
|
||||
else
|
||||
{
|
||||
Log("DebugRec end: All in sync!");
|
||||
++DoNoDebugRec;
|
||||
return;
|
||||
}
|
||||
// unpack directly from head
|
||||
if (currChunk->Type != eType)
|
||||
{
|
||||
DebugRecError(FormatString("Playback type %x, this type %x", currChunk->Type, eType).getData());
|
||||
return;
|
||||
}
|
||||
if (currChunk->pDbg)
|
||||
PktInReplay = *currChunk->pDbg;
|
||||
// special sync check skip...
|
||||
while (currChunk != chunks.end() && currChunk->Type == RCT_CtrlPkt)
|
||||
{
|
||||
C4IDPacket Packet(*currChunk->pPkt);
|
||||
C4ControlPacket *pCtrlPck = static_cast<C4ControlPacket *>(Packet.getPkt());
|
||||
assert(!pCtrlPck->Sync());
|
||||
::Control.ExecControlPacket(Packet.getPktType(), pCtrlPck);
|
||||
NextChunk();
|
||||
}
|
||||
// record end?
|
||||
if (currChunk == chunks.end() || currChunk->Type == RCT_End || Finished)
|
||||
{
|
||||
Log("DebugRec end: All in sync!");
|
||||
++DoNoDebugRec;
|
||||
return;
|
||||
}
|
||||
// unpack directly from head
|
||||
if (currChunk->Type != eType)
|
||||
{
|
||||
DebugRecError(FormatString("Playback type %x, this type %x", currChunk->Type, eType).getData());
|
||||
return;
|
||||
}
|
||||
if (currChunk->pDbg)
|
||||
PktInReplay = *currChunk->pDbg;
|
||||
|
||||
fHasPacketFromHead = true;
|
||||
fHasPacketFromHead = true;
|
||||
}
|
||||
}
|
||||
#endif // DEBUGREC_EXTFILE
|
||||
// record end?
|
||||
if (PktInReplay.getType() == RCT_End)
|
||||
{
|
||||
|
@ -1121,7 +1117,6 @@ void C4Playback::DebugRecError(const char *szError)
|
|||
LogF("Playback error: %s", szError);
|
||||
BREAKPOINT_HERE;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool C4Playback::StreamToRecord(const char *szStream, StdStrBuf *pRecordFile)
|
||||
{
|
||||
|
|
|
@ -27,17 +27,11 @@ class C4Record;
|
|||
#include "C4Group.h"
|
||||
#include "C4Control.h"
|
||||
|
||||
#ifdef DEBUGREC
|
||||
extern int DoNoDebugRec; // debugrec disable counter in C4Record.cpp
|
||||
|
||||
#define DEBUGREC_OFF ++DoNoDebugRec;
|
||||
#define DEBUGREC_ON --DoNoDebugRec;
|
||||
|
||||
#else
|
||||
#define DEBUGREC_OFF
|
||||
#define DEBUGREC_ON
|
||||
#endif
|
||||
|
||||
// turn off debugrecs in current block
|
||||
class C4DebugRecOff
|
||||
{
|
||||
|
@ -100,9 +94,7 @@ enum C4RecordChunkType // record file chunk type
|
|||
RCT_Undefined = 0xff
|
||||
};
|
||||
|
||||
#ifdef DEBUGREC
|
||||
void AddDbgRec(C4RecordChunkType eType, const void *pData=NULL, int iSize=0); // record debug stuff
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
|
@ -306,9 +298,7 @@ private:
|
|||
StdBuf sequentialBuffer; // buffer to manage sequential reads
|
||||
uint32_t iLastSequentialFrame; // frame number of last chunk read
|
||||
void Finish(); // end playback
|
||||
#ifdef DEBUGREC
|
||||
C4PacketList DebugRec;
|
||||
#endif
|
||||
public:
|
||||
C4Playback(); // constructor; init playback
|
||||
~C4Playback(); // destructor; deinit playback
|
||||
|
@ -324,11 +314,9 @@ public:
|
|||
bool ExecuteControl(C4Control *pCtrl, int iFrame); // assign control
|
||||
bool IsFinished() { return Finished; }
|
||||
void Clear();
|
||||
#ifdef DEBUGREC
|
||||
void Check(C4RecordChunkType eType, const uint8_t *pData, int iSize); // compare with debugrec
|
||||
void DebugRecError(const char *szError);
|
||||
#endif
|
||||
static bool StreamToRecord(const char *szStream, StdStrBuf *pRecord);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -227,6 +227,9 @@ void C4Application::ParseCommandLine(int argc, char * argv[])
|
|||
{"league", no_argument, &Config.Network.LeagueServerSignUp, 1},
|
||||
{"nosignup", no_argument, &Config.Network.MasterServerSignUp, 0},
|
||||
{"signup", no_argument, &Config.Network.MasterServerSignUp, 1},
|
||||
|
||||
{"debugrecread", required_argument, 0, 'K'},
|
||||
{"debugrecwrite", required_argument, 0, 'w'},
|
||||
|
||||
{"client", required_argument, 0, 'c'},
|
||||
{"host", no_argument, 0, 'h'},
|
||||
|
@ -289,6 +292,28 @@ void C4Application::ParseCommandLine(int argc, char * argv[])
|
|||
Game.NetworkActive = true;
|
||||
SCopy(optarg, Game.DirectJoinAddress, _MAX_PATH);
|
||||
break;
|
||||
case 'K':
|
||||
if (optarg && optarg[0])
|
||||
{
|
||||
LogF("Reading from DebugRec file '%s'", optarg);
|
||||
SCopy(optarg, Config.General.DebugRecExternalFile, _MAX_PATH);
|
||||
}
|
||||
else
|
||||
Log("Reading DebugRec from CtrlRec file in scenario record");
|
||||
Config.General.DebugRec = 1;
|
||||
Config.General.DebugRecWrite = 0;
|
||||
break;
|
||||
case 'w':
|
||||
if (optarg && optarg[0])
|
||||
{
|
||||
LogF("Writing to DebugRec file '%s'", optarg);
|
||||
SCopy(optarg, Config.General.DebugRecExternalFile, _MAX_PATH);
|
||||
}
|
||||
else
|
||||
Log("Writing DebugRec to CtrlRec file in scenario record");
|
||||
Config.General.DebugRec = 1;
|
||||
Config.General.DebugRecWrite = 1;
|
||||
break;
|
||||
case 'r': Game.Record = true; break;
|
||||
case 'n': Game.NetworkActive = true; break;
|
||||
case 'N': Game.NetworkActive = false; break;
|
||||
|
|
|
@ -698,13 +698,8 @@ C4ST_NEW(MessagesStat, "C4Game::Execute Messages.Execute")
|
|||
#define EXEC_S(Expressions, Stat) \
|
||||
{ C4ST_START(Stat) Expressions C4ST_STOP(Stat) }
|
||||
|
||||
#ifdef DEBUGREC
|
||||
#define EXEC_S_DR(Expressions, Stat, DebugRecName) { AddDbgRec(RCT_Block, DebugRecName, 6); EXEC_S(Expressions, Stat) }
|
||||
#define EXEC_DR(Expressions, DebugRecName) { AddDbgRec(RCT_Block, DebugRecName, 6); Expressions }
|
||||
#else
|
||||
#define EXEC_S_DR(Expressions, Stat, DebugRecName) EXEC_S(Expressions, Stat)
|
||||
#define EXEC_DR(Expressions, DebugRecName) Expressions
|
||||
#endif
|
||||
#define EXEC_S_DR(Expressions, Stat, DebugRecName) { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); EXEC_S(Expressions, Stat) }
|
||||
#define EXEC_DR(Expressions, DebugRecName) { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); Expressions }
|
||||
|
||||
bool C4Game::Execute() // Returns true if the game is over
|
||||
{
|
||||
|
@ -723,9 +718,8 @@ bool C4Game::Execute() // Returns true if the game is over
|
|||
// Halt
|
||||
if (HaltCount) return false;
|
||||
|
||||
#ifdef DEBUGREC
|
||||
Landscape.DoRelights();
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
Landscape.DoRelights();
|
||||
|
||||
// Execute the control
|
||||
Control.Execute();
|
||||
|
@ -734,10 +728,9 @@ bool C4Game::Execute() // Returns true if the game is over
|
|||
// Ticks
|
||||
EXEC_DR( Ticks(); , "Ticks")
|
||||
|
||||
#ifdef DEBUGREC
|
||||
// debugrec
|
||||
AddDbgRec(RCT_DbgFrame, &FrameCounter, sizeof(int32_t));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
// debugrec
|
||||
AddDbgRec(RCT_DbgFrame, &FrameCounter, sizeof(int32_t));
|
||||
|
||||
// Game
|
||||
|
||||
|
@ -775,11 +768,11 @@ bool C4Game::Execute() // Returns true if the game is over
|
|||
C4ST_RESETPART
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "eGame", 6);
|
||||
|
||||
Landscape.DoRelights();
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_Block, "eGame", 6);
|
||||
Landscape.DoRelights();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1001,14 +994,15 @@ C4Object* C4Game::NewObject( C4PropList *pDef, C4Object *pCreator,
|
|||
{
|
||||
// Safety
|
||||
if (!pDef) return NULL;
|
||||
#ifdef DEBUGREC
|
||||
C4RCCreateObj rc;
|
||||
memset(&rc, '\0', sizeof(rc));
|
||||
strncpy(rc.id, pDef->GetName(), 32+1);
|
||||
rc.oei=C4PropListNumbered::GetEnumerationIndex()+1;
|
||||
rc.x=iX; rc.y=iY; rc.ownr=iOwner;
|
||||
AddDbgRec(RCT_CrObj, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCCreateObj rc;
|
||||
memset(&rc, '\0', sizeof(rc));
|
||||
strncpy(rc.id, pDef->GetName(), 32+1);
|
||||
rc.oei=C4PropListNumbered::GetEnumerationIndex()+1;
|
||||
rc.x=iX; rc.y=iY; rc.ownr=iOwner;
|
||||
AddDbgRec(RCT_CrObj, &rc, sizeof(rc));
|
||||
}
|
||||
// Create object
|
||||
C4Object *pObj;
|
||||
if (!(pObj=new C4Object)) return NULL;
|
||||
|
@ -1316,9 +1310,8 @@ void C4Game::ObjectRemovalCheck() // Every ::Game.iTick255 by ExecObjects
|
|||
|
||||
void C4Game::ExecObjects() // Every Tick1 by Execute
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "ObjEx", 6);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
AddDbgRec(RCT_Block, "ObjEx", 6);
|
||||
|
||||
// Execute objects - reverse order to ensure
|
||||
C4Object *cObj; C4ObjectLink *clnk;
|
||||
|
@ -1330,9 +1323,8 @@ void C4Game::ExecObjects() // Every Tick1 by Execute
|
|||
// Status reset: process removal delay
|
||||
if (cObj->RemovalDelay>0) cObj->RemovalDelay--;
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "ObjCC", 6);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
AddDbgRec(RCT_Block, "ObjCC", 6);
|
||||
|
||||
// Can savely reset object marker here
|
||||
Objects.LastUsedMarker = 0;
|
||||
|
@ -1340,9 +1332,8 @@ void C4Game::ExecObjects() // Every Tick1 by Execute
|
|||
// Cross check objects
|
||||
Objects.CrossCheck();
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "ObjRs", 6);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
AddDbgRec(RCT_Block, "ObjRs", 6);
|
||||
|
||||
// Resort
|
||||
if (fResortAnyObject)
|
||||
|
@ -1351,9 +1342,8 @@ void C4Game::ExecObjects() // Every Tick1 by Execute
|
|||
Objects.ResortUnsorted();
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "ObjRm", 6);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
AddDbgRec(RCT_Block, "ObjRm", 6);
|
||||
|
||||
// Removal
|
||||
if (!::Game.iTick255) ObjectRemovalCheck();
|
||||
|
|
|
@ -404,13 +404,14 @@ bool C4Menu::AddItem(C4MenuItem *pNew, const char *szCaption, const char *szComm
|
|||
C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable)
|
||||
{
|
||||
#ifdef DEBUGREC_MENU
|
||||
if (pObject)
|
||||
{
|
||||
C4RCMenuAdd rc = { pObject ? pObject->Number : -1, iCount, idID, fOwnValue, iValue, fIsSelectable };
|
||||
AddDbgRec(RCT_MenuAdd, &rc, sizeof(C4RCMenuAdd));
|
||||
if (szCommand) AddDbgRec(RCT_MenuAddC, szCommand, strlen(szCommand)+1);
|
||||
if (szCommand2) AddDbgRec(RCT_MenuAddC, szCommand2, strlen(szCommand2)+1);
|
||||
}
|
||||
if (Config.General.DebugRec)
|
||||
if (pObject)
|
||||
{
|
||||
C4RCMenuAdd rc = { pObject ? pObject->Number : -1, iCount, idID, fOwnValue, iValue, fIsSelectable };
|
||||
AddDbgRec(RCT_MenuAdd, &rc, sizeof(C4RCMenuAdd));
|
||||
if (szCommand) AddDbgRec(RCT_MenuAddC, szCommand, strlen(szCommand)+1);
|
||||
if (szCommand2) AddDbgRec(RCT_MenuAddC, szCommand2, strlen(szCommand2)+1);
|
||||
}
|
||||
#endif
|
||||
// Add it to the list
|
||||
pClientWindow->AddElement(pNew);
|
||||
|
|
|
@ -135,7 +135,8 @@ void C4Landscape::ExecuteScan()
|
|||
return;
|
||||
|
||||
#ifdef DEBUGREC_MATSCAN
|
||||
AddDbgRec(RCT_MatScan, &ScanX, sizeof(ScanX));
|
||||
if (Config.General.DebugRec)
|
||||
AddDbgRec(RCT_MatScan, &ScanX, sizeof(ScanX));
|
||||
#endif
|
||||
|
||||
for (int32_t cnt=0; cnt<ScanSpeed; cnt++)
|
||||
|
@ -192,8 +193,11 @@ int32_t C4Landscape::DoScan(int32_t cx, int32_t cy, int32_t mat, int32_t dir)
|
|||
int32_t mconv = ::MaterialMap.Map[mat].TempConvStrength,
|
||||
mconvs = mconv;
|
||||
#ifdef DEBUGREC_MATSCAN
|
||||
C4RCMatScan rc = { cx, cy, mat, conv_to, dir, mconvs };
|
||||
AddDbgRec(RCT_MatScanDo, &rc, sizeof(C4RCMatScan));
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCMatScan rc = { cx, cy, mat, conv_to, dir, mconvs };
|
||||
AddDbgRec(RCT_MatScanDo, &rc, sizeof(C4RCMatScan));
|
||||
}
|
||||
#endif
|
||||
int32_t ydir = (dir == 0 ? +1 : -1), cy2;
|
||||
#ifdef PRETTY_TEMP_CONV
|
||||
|
@ -634,11 +638,12 @@ bool C4Landscape::ClearPix(int32_t tx, int32_t ty)
|
|||
}
|
||||
bool C4Landscape::SetPix(int32_t x, int32_t y, BYTE npix)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
C4RCSetPix rc;
|
||||
rc.x=x; rc.y=y; rc.clr=npix;
|
||||
AddDbgRec(RCT_SetPix, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCSetPix rc;
|
||||
rc.x=x; rc.y=y; rc.clr=npix;
|
||||
AddDbgRec(RCT_SetPix, &rc, sizeof(rc));
|
||||
}
|
||||
// check bounds
|
||||
if (x < 0 || y < 0 || x >= Width || y >= Height)
|
||||
return false;
|
||||
|
@ -662,11 +667,12 @@ bool C4Landscape::SetPix(int32_t x, int32_t y, BYTE npix)
|
|||
|
||||
bool C4Landscape::_SetPix(int32_t x, int32_t y, BYTE npix)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
C4RCSetPix rc;
|
||||
rc.x=x; rc.y=y; rc.clr=npix;
|
||||
AddDbgRec(RCT_SetPix, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCSetPix rc;
|
||||
rc.x=x; rc.y=y; rc.clr=npix;
|
||||
AddDbgRec(RCT_SetPix, &rc, sizeof(rc));
|
||||
}
|
||||
assert(x >= 0 && y >= 0 && x < Width && y < Height);
|
||||
// get and check pixel
|
||||
BYTE opix = _GetPix(x, y);
|
||||
|
@ -843,8 +849,13 @@ bool C4Landscape::InsertMaterial(int32_t mat, int32_t *tx, int32_t *ty, int32_t
|
|||
if (GetDensity(*tx,*ty+1)<mdens)
|
||||
{ if (!query_only) ::PXS.Create(mat,itofix(*tx),itofix(*ty),C4REAL10(vx),C4REAL10(vy)); return true; }
|
||||
|
||||
// Insertion OK here
|
||||
if (query_only) return true;
|
||||
if (query_only)
|
||||
{
|
||||
// since tx and ty changed, we need to re-check the bounds here
|
||||
// if we really inserted it, the check is made again in InsertDeadMaterial
|
||||
if (!Inside<int32_t>(*tx,0,Width-1) || !Inside<int32_t>(*ty,0,Height)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Try reaction with material below and at insertion position
|
||||
C4MaterialReaction *pReact; int32_t tmat;
|
||||
|
@ -1223,10 +1234,11 @@ bool C4Landscape::Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bo
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "|---MAP---|", 12);
|
||||
AddDbgRec(RCT_Map, sfcMap->Bits, sfcMap->Pitch*sfcMap->Hgt);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_Block, "|---MAP---|", 12);
|
||||
AddDbgRec(RCT_Map, sfcMap->Bits, sfcMap->Pitch*sfcMap->Hgt);
|
||||
}
|
||||
|
||||
// Store map size and calculate map zoom
|
||||
int iWdt, iHgt;
|
||||
|
@ -1301,10 +1313,11 @@ bool C4Landscape::Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bo
|
|||
|
||||
Game.SetInitProgress(84);
|
||||
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "|---LANDSCAPE---|", 18);
|
||||
AddDbgRec(RCT_Map, Surface8->Bits, Surface8->Pitch*Surface8->Hgt);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_Block, "|---LANDSCAPE---|", 18);
|
||||
AddDbgRec(RCT_Map, Surface8->Bits, Surface8->Pitch*Surface8->Hgt);
|
||||
}
|
||||
|
||||
// Create renderer
|
||||
pLandscapeRender = NULL;
|
||||
|
@ -1327,10 +1340,11 @@ bool C4Landscape::Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bo
|
|||
pLandscapeRender->Update(C4Rect(0, 0, Width, Height), this);
|
||||
Game.SetInitProgress(87);
|
||||
}
|
||||
#ifdef DEBUGREC
|
||||
AddDbgRec(RCT_Block, "|---LS---|", 11);
|
||||
AddDbgRec(RCT_Ls, Surface8->Bits, Surface8->Pitch*Surface8->Hgt);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_Block, "|---LS---|", 11);
|
||||
AddDbgRec(RCT_Ls, Surface8->Bits, Surface8->Pitch*Surface8->Hgt);
|
||||
}
|
||||
|
||||
|
||||
// Create pixel count array
|
||||
|
|
|
@ -516,11 +516,12 @@ bool C4MCOverlay::CheckMask(int32_t iX, int32_t iY)
|
|||
{
|
||||
// bounds match?
|
||||
if (!LooseBounds) if (iX<X || iY<Y || iX>=X+Wdt || iY>=Y+Hgt) return false;
|
||||
#ifdef DEBUGREC
|
||||
C4RCTrf rc;
|
||||
rc.x=iX; rc.y=iY; rc.Rotate=Rotate; rc.Turbulence=Turbulence;
|
||||
AddDbgRec(RCT_MCT1, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCTrf rc;
|
||||
rc.x=iX; rc.y=iY; rc.Rotate=Rotate; rc.Turbulence=Turbulence;
|
||||
AddDbgRec(RCT_MCT1, &rc, sizeof(rc));
|
||||
}
|
||||
C4Real dX=itofix(iX); C4Real dY=itofix(iY);
|
||||
// apply turbulence
|
||||
if (Turbulence)
|
||||
|
@ -558,11 +559,12 @@ bool C4MCOverlay::CheckMask(int32_t iX, int32_t iY)
|
|||
{ iX=fixtoi(dX, ZoomX); iY=fixtoi(dY, ZoomY); }
|
||||
else
|
||||
{ iX*=ZoomX; iY*=ZoomY; }
|
||||
#ifdef DEBUGREC
|
||||
C4RCPos rc2;
|
||||
rc2.x=iX; rc2.y=iY;
|
||||
AddDbgRec(RCT_MCT2, &rc2, sizeof(rc2));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCPos rc2;
|
||||
rc2.x=iX; rc2.y=iY;
|
||||
AddDbgRec(RCT_MCT2, &rc2, sizeof(rc2));
|
||||
}
|
||||
// apply offset
|
||||
iX-=OffX*ZoomX; iY-=OffY*ZoomY;
|
||||
// check bounds, if loose
|
||||
|
|
|
@ -75,11 +75,12 @@ void C4MassMoverSet::Execute()
|
|||
bool C4MassMoverSet::Create(int32_t x, int32_t y, bool fExecute)
|
||||
{
|
||||
if (Count == C4MassMoverChunk) return false;
|
||||
#ifdef DEBUGREC
|
||||
C4RCMassMover rc;
|
||||
rc.x=x; rc.y=y;
|
||||
AddDbgRec(RCT_MMC, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCMassMover rc;
|
||||
rc.x=x; rc.y=y;
|
||||
AddDbgRec(RCT_MMC, &rc, sizeof(rc));
|
||||
}
|
||||
int32_t cptr=CreatePtr;
|
||||
do
|
||||
{
|
||||
|
@ -118,11 +119,12 @@ bool C4MassMover::Init(int32_t tx, int32_t ty)
|
|||
|
||||
void C4MassMover::Cease()
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
C4RCMassMover rc;
|
||||
rc.x=x; rc.y=y;
|
||||
AddDbgRec(RCT_MMD, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCMassMover rc;
|
||||
rc.x=x; rc.y=y;
|
||||
AddDbgRec(RCT_MMD, &rc, sizeof(rc));
|
||||
}
|
||||
::MassMover.Count--;
|
||||
Mat=MNone;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ static const C4Real WindDrift_Factor = itofix(1, 800);
|
|||
void C4PXS::Execute()
|
||||
{
|
||||
#ifdef DEBUGREC_PXS
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCExecPXS rc;
|
||||
rc.x=x; rc.y=y; rc.iMat=Mat;
|
||||
|
@ -127,6 +128,7 @@ void C4PXS::Execute()
|
|||
// No contact? Free movement
|
||||
x=ctcox; y=ctcoy;
|
||||
#ifdef DEBUGREC_PXS
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCExecPXS rc;
|
||||
rc.x=x; rc.y=y; rc.iMat=Mat;
|
||||
|
@ -140,10 +142,13 @@ void C4PXS::Execute()
|
|||
void C4PXS::Deactivate()
|
||||
{
|
||||
#ifdef DEBUGREC_PXS
|
||||
C4RCExecPXS rc;
|
||||
rc.x=x; rc.y=y; rc.iMat=Mat;
|
||||
rc.pos = 2;
|
||||
AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCExecPXS rc;
|
||||
rc.x=x; rc.y=y; rc.iMat=Mat;
|
||||
rc.pos = 2;
|
||||
AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
|
||||
}
|
||||
#endif
|
||||
Mat=MNone;
|
||||
::PXS.Delete(this);
|
||||
|
|
|
@ -26,23 +26,30 @@
|
|||
int RandomCount = 0;
|
||||
unsigned int RandomHold = 0;
|
||||
|
||||
#ifdef DEBUGREC
|
||||
int Random(int iRange)
|
||||
{
|
||||
// next pseudorandom value
|
||||
RandomCount++;
|
||||
C4RCRandom rc;
|
||||
rc.Cnt=RandomCount;
|
||||
rc.Range=iRange;
|
||||
if (iRange==0)
|
||||
rc.Val=0;
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
// next pseudorandom value
|
||||
RandomCount++;
|
||||
C4RCRandom rc;
|
||||
rc.Cnt=RandomCount;
|
||||
rc.Range=iRange;
|
||||
if (iRange==0)
|
||||
rc.Val=0;
|
||||
else
|
||||
{
|
||||
RandomHold = ((uint64_t)RandomHold * 16807) % 2147483647;
|
||||
rc.Val = RandomHold % iRange;
|
||||
}
|
||||
AddDbgRec(RCT_Random, &rc, sizeof(rc));
|
||||
return rc.Val;
|
||||
}
|
||||
else
|
||||
{
|
||||
RandomCount++;
|
||||
if (iRange==0) return 0;
|
||||
RandomHold = ((uint64_t)RandomHold * 16807) % 2147483647;
|
||||
rc.Val = RandomHold % iRange;
|
||||
return RandomHold % iRange;
|
||||
}
|
||||
AddDbgRec(RCT_Random, &rc, sizeof(rc));
|
||||
return rc.Val;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,17 +37,7 @@ inline void FixedRandom(DWORD dwSeed)
|
|||
RandomCount=0;
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
int Random(int iRange);
|
||||
#else
|
||||
inline int Random(int iRange)
|
||||
{
|
||||
RandomCount++;
|
||||
if (iRange==0) return 0;
|
||||
RandomHold = ((uint64_t)RandomHold * 16807) % 2147483647;
|
||||
return RandomHold % iRange;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline unsigned int SeededRandom(unsigned int iSeed, unsigned int iRange)
|
||||
{
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include <C4GameVersion.h>
|
||||
#include <C4Language.h>
|
||||
|
||||
#ifdef DEBUGREC
|
||||
#include <C4Record.h>
|
||||
#endif
|
||||
|
||||
C4DefList::C4DefList()
|
||||
{
|
||||
|
@ -396,13 +394,14 @@ void C4DefList::CallEveryDefinition()
|
|||
{
|
||||
for (Table::iterator it = table.begin(); it != table.end(); ++it)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
// TODO: Might not be synchronous on runtime join since is run by joining
|
||||
// client but not by host. Might need to go to Synchronize().
|
||||
char sz[32+1];
|
||||
strncpy(sz, it->first.ToString(), 32+1);
|
||||
AddDbgRec(RCT_Definition, sz, 32);
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
// TODO: Might not be synchronous on runtime join since is run by joining
|
||||
// client but not by host. Might need to go to Synchronize().
|
||||
char sz[32+1];
|
||||
strncpy(sz, it->first.ToString(), 32+1);
|
||||
AddDbgRec(RCT_Definition, sz, 32);
|
||||
}
|
||||
C4AulParSet Pars(C4VPropList(it->second));
|
||||
it->second->Call(PSF_Definition, &Pars);
|
||||
}
|
||||
|
|
|
@ -40,9 +40,7 @@
|
|||
#include <C4Command.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4MaterialList.h>
|
||||
#ifdef DEBUGREC
|
||||
#include <C4Record.h>
|
||||
#endif
|
||||
#include <C4SolidMask.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Log.h>
|
||||
|
@ -334,14 +332,15 @@ void C4Object::AssignRemoval(bool fExitContents)
|
|||
{
|
||||
// check status
|
||||
if (!Status) return;
|
||||
#ifdef DEBUGREC
|
||||
C4RCCreateObj rc;
|
||||
memset(&rc, '\0', sizeof(rc));
|
||||
rc.oei=Number;
|
||||
if (Def && Def->GetName()) strncpy(rc.id, Def->GetName(), 32+1);
|
||||
rc.x=GetX(); rc.y=GetY(); rc.ownr=Owner;
|
||||
AddDbgRec(RCT_DsObj, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCCreateObj rc;
|
||||
memset(&rc, '\0', sizeof(rc));
|
||||
rc.oei=Number;
|
||||
if (Def && Def->GetName()) strncpy(rc.id, Def->GetName(), 32+1);
|
||||
rc.x=GetX(); rc.y=GetY(); rc.ownr=Owner;
|
||||
AddDbgRec(RCT_DsObj, &rc, sizeof(rc));
|
||||
}
|
||||
// Destruction call in container
|
||||
if (Contained)
|
||||
{
|
||||
|
@ -861,8 +860,11 @@ void C4Object::SetOCF()
|
|||
if ((Def->GrabPutGet & C4D_Grab_Put) || (Def->GrabPutGet & C4D_Grab_Get) || (OCF & OCF_Entrance))
|
||||
OCF|=OCF_Container;
|
||||
#ifdef DEBUGREC_OCF
|
||||
C4RCOCF rc = { dwOCFOld, OCF, false };
|
||||
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCOCF rc = { dwOCFOld, OCF, false };
|
||||
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -929,8 +931,11 @@ void C4Object::UpdateOCF()
|
|||
if ((Def->GrabPutGet & C4D_Grab_Put) || (Def->GrabPutGet & C4D_Grab_Get) || (OCF & OCF_Entrance))
|
||||
OCF|=OCF_Container;
|
||||
#ifdef DEBUGREC_OCF
|
||||
C4RCOCF rc = { dwOCFOld, OCF, true };
|
||||
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
C4RCOCF rc = { dwOCFOld, OCF, true };
|
||||
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
|
||||
}
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
DEBUGREC_OFF
|
||||
|
@ -1021,15 +1026,16 @@ bool C4Object::ExecLife()
|
|||
|
||||
void C4Object::Execute()
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
// record debug
|
||||
C4RCExecObj rc;
|
||||
rc.Number=Number;
|
||||
rc.fx=fix_x;
|
||||
rc.fy=fix_y;
|
||||
rc.fr=fix_r;
|
||||
AddDbgRec(RCT_ExecObj, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
// record debug
|
||||
C4RCExecObj rc;
|
||||
rc.Number=Number;
|
||||
rc.fx=fix_x;
|
||||
rc.fy=fix_y;
|
||||
rc.fr=fix_r;
|
||||
AddDbgRec(RCT_ExecObj, &rc, sizeof(rc));
|
||||
}
|
||||
// reset temporary marker
|
||||
Marker = 0;
|
||||
// OCF
|
||||
|
|
|
@ -109,9 +109,8 @@ void C4LSectors::Add(C4Object *pObj, C4ObjectList *pMainList)
|
|||
{
|
||||
pSct->ObjectShapes.Add(pObj, C4ObjectList::stMain, pMainList);
|
||||
}
|
||||
#ifdef DEBUGREC
|
||||
pObj->Area.DebugRec(pObj, 'A');
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
pObj->Area.DebugRec(pObj, 'A');
|
||||
}
|
||||
|
||||
void C4LSectors::Update(C4Object *pObj, C4ObjectList *pMainList)
|
||||
|
@ -152,9 +151,8 @@ void C4LSectors::Update(C4Object *pObj, C4ObjectList *pMainList)
|
|||
}
|
||||
// Update area
|
||||
pObj->Area = NewArea;
|
||||
#ifdef DEBUGREC
|
||||
pObj->Area.DebugRec(pObj, 'U');
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
pObj->Area.DebugRec(pObj, 'U');
|
||||
}
|
||||
|
||||
void C4LSectors::Remove(C4Object *pObj)
|
||||
|
@ -187,9 +185,8 @@ void C4LSectors::Remove(C4Object *pObj)
|
|||
// Remove from all sectors in shape area
|
||||
for (pSct = pObj->Area.First(); pSct; pSct = pObj->Area.Next(pSct))
|
||||
pSct->ObjectShapes.Remove(pObj);
|
||||
#ifdef DEBUGREC
|
||||
pObj->Area.DebugRec(pObj, 'R');
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
pObj->Area.DebugRec(pObj, 'R');
|
||||
}
|
||||
|
||||
void C4LSectors::AssertObjectNotInList(C4Object *pObj)
|
||||
|
@ -338,7 +335,6 @@ C4ObjectList *C4LArea::NextObjectShapes(C4ObjectList *pPrev, C4LSector **ppSct)
|
|||
return &(*ppSct)->ObjectShapes;
|
||||
}
|
||||
|
||||
#ifdef DEBUGREC
|
||||
void C4LArea::DebugRec(class C4Object *pObj, char cMarker)
|
||||
{
|
||||
C4RCArea rc;
|
||||
|
@ -352,4 +348,3 @@ void C4LArea::DebugRec(class C4Object *pObj, char cMarker)
|
|||
rc.out = !!pOut;
|
||||
AddDbgRec(RCT_Area, &rc, sizeof(C4RCArea));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -126,9 +126,7 @@ public:
|
|||
{ *ppSct=NULL; return NextObjectShapes(NULL, ppSct); }
|
||||
C4ObjectList *NextObjectShapes(C4ObjectList *pPrev, C4LSector **ppSct); // get next object shapes list of this area
|
||||
|
||||
#ifdef DEBUGREC
|
||||
void DebugRec(class C4Object *pObj, char cMarker);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -57,14 +57,15 @@ void C4Shape::Clear()
|
|||
|
||||
void C4Shape::Rotate(C4Real Angle, bool bUpdateVertices)
|
||||
{
|
||||
#ifdef DEBUGREC
|
||||
C4RCRotVtx rc;
|
||||
rc.x=x; rc.y=y; rc.wdt=Wdt; rc.hgt=Hgt; rc.r=Angle;
|
||||
int32_t i = 0;
|
||||
for (; i<4; ++i)
|
||||
{ rc.VtxX[i]=VtxX[i]; rc.VtxY[i]=VtxY[i]; }
|
||||
AddDbgRec(RCT_RotVtx1, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
rc.x=x; rc.y=y; rc.wdt=Wdt; rc.hgt=Hgt; rc.r=Angle;
|
||||
for (; i<4; ++i)
|
||||
{ rc.VtxX[i]=VtxX[i]; rc.VtxY[i]=VtxY[i]; }
|
||||
AddDbgRec(RCT_RotVtx1, &rc, sizeof(rc));
|
||||
}
|
||||
int32_t cnt,nvtx,nvty,nwdt,nhgt;
|
||||
|
||||
C4Real mtx[4];
|
||||
|
@ -123,12 +124,13 @@ void C4Shape::Rotate(C4Real Angle, bool bUpdateVertices)
|
|||
}
|
||||
Wdt = nwdt;
|
||||
Hgt = nhgt;
|
||||
#ifdef DEBUGREC
|
||||
rc.x=x; rc.y=y; rc.wdt=Wdt; rc.hgt=Hgt;
|
||||
for (i=0; i<4; ++i)
|
||||
{ rc.VtxX[i]=VtxX[i]; rc.VtxY[i]=VtxY[i]; }
|
||||
AddDbgRec(RCT_RotVtx2, &rc, sizeof(rc));
|
||||
#endif
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
rc.x=x; rc.y=y; rc.wdt=Wdt; rc.hgt=Hgt;
|
||||
for (i=0; i<4; ++i)
|
||||
{ rc.VtxX[i]=VtxX[i]; rc.VtxY[i]=VtxY[i]; }
|
||||
AddDbgRec(RCT_RotVtx2, &rc, sizeof(rc));
|
||||
}
|
||||
}
|
||||
|
||||
void C4Shape::Stretch(int32_t iCon, bool bUpdateVertices)
|
||||
|
|
|
@ -887,33 +887,36 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
|
|||
throw new C4AulExecError("using removed object");
|
||||
|
||||
#ifdef DEBUGREC_SCRIPT
|
||||
StdStrBuf sCallText;
|
||||
if (pContext && pContext->GetObject())
|
||||
sCallText.AppendFormat("Object(%d): ", pContext->GetObject()->Number);
|
||||
sCallText.Append(pFunc->GetName());
|
||||
sCallText.AppendChar('(');
|
||||
for (int i=0; i<C4AUL_MAX_Par; ++i)
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
if (i) sCallText.AppendChar(',');
|
||||
C4Value &rV = pPars[i];
|
||||
if (rV.GetType() == C4V_String)
|
||||
StdStrBuf sCallText;
|
||||
if (pContext && pContext->GetObject())
|
||||
sCallText.AppendFormat("Object(%d): ", pContext->GetObject()->Number);
|
||||
sCallText.Append(pFunc->GetName());
|
||||
sCallText.AppendChar('(');
|
||||
for (int i=0; i<C4AUL_MAX_Par; ++i)
|
||||
{
|
||||
C4String *s = rV.getStr();
|
||||
if (!s)
|
||||
sCallText.Append("(Snull)");
|
||||
else
|
||||
if (i) sCallText.AppendChar(',');
|
||||
C4Value &rV = pPars[i];
|
||||
if (rV.GetType() == C4V_String)
|
||||
{
|
||||
sCallText.Append("\"");
|
||||
sCallText.Append(s->GetData());
|
||||
sCallText.Append("\"");
|
||||
C4String *s = rV.getStr();
|
||||
if (!s)
|
||||
sCallText.Append("(Snull)");
|
||||
else
|
||||
{
|
||||
sCallText.Append("\"");
|
||||
sCallText.Append(s->GetData());
|
||||
sCallText.Append("\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
sCallText.Append(rV.GetDataString());
|
||||
}
|
||||
else
|
||||
sCallText.Append(rV.GetDataString());
|
||||
sCallText.AppendChar(')');
|
||||
sCallText.AppendChar(';');
|
||||
AddDbgRec(RCT_AulFunc, sCallText.getData(), sCallText.getLength()+1);
|
||||
}
|
||||
sCallText.AppendChar(')');
|
||||
sCallText.AppendChar(';');
|
||||
AddDbgRec(RCT_AulFunc, sCallText.getData(), sCallText.getLength()+1);
|
||||
#endif
|
||||
|
||||
// Execute
|
||||
|
@ -1076,9 +1079,12 @@ C4Value C4AulScriptFunc::Exec(C4PropList * p, C4Value pPars[], bool fPassErrors)
|
|||
C4Value C4AulScript::DirectExec(C4Object *pObj, const char *szScript, const char *szContext, bool fPassErrors, C4AulScriptContext* context)
|
||||
{
|
||||
#ifdef DEBUGREC_SCRIPT
|
||||
AddDbgRec(RCT_DirectExec, szScript, strlen(szScript)+1);
|
||||
int32_t iObjNumber = pObj ? pObj->Number : -1;
|
||||
AddDbgRec(RCT_DirectExec, &iObjNumber, sizeof(int32_t));
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
AddDbgRec(RCT_DirectExec, szScript, strlen(szScript)+1);
|
||||
int32_t iObjNumber = pObj ? pObj->Number : -1;
|
||||
AddDbgRec(RCT_DirectExec, &iObjNumber, sizeof(int32_t));
|
||||
}
|
||||
#endif
|
||||
// profiler
|
||||
AulExec.StartDirectExec();
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
#include <C4GameObjects.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Object.h>
|
||||
#ifdef DEBUGREC
|
||||
#include <C4Record.h>
|
||||
#endif
|
||||
|
||||
void C4PropList::AddRef(C4Value *pRef)
|
||||
{
|
||||
|
@ -609,9 +607,12 @@ void C4PropList::SetPropertyByS(C4String * k, const C4Value & to)
|
|||
//C4Property p(k, to);
|
||||
//Properties.Add(p);
|
||||
#ifdef DEBUGREC_SCRIPT
|
||||
// deactivate this debugrec for now, because property orders seem to be out of sync
|
||||
// after loading at the moment. might need to invastigate the cause later...
|
||||
//if (k->GetCStr()) AddDbgRec(RCT_SetProperty, k->GetCStr(), strlen(k->GetCStr())+1);
|
||||
if (Config.General.DebugRec)
|
||||
{
|
||||
// deactivate this debugrec for now, because property orders seem to be out of sync
|
||||
// after loading at the moment. might need to invastigate the cause later...
|
||||
//if (k->GetCStr()) AddDbgRec(RCT_SetProperty, k->GetCStr(), strlen(k->GetCStr())+1);
|
||||
}
|
||||
#endif
|
||||
Properties.Add(C4Property(k, to));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue