merge main branch into PlrCtrl branch (currently crashing)

stable-5.2
Sven Eberhardt 2009-08-10 16:48:25 +02:00
parent 81e9b612b1
commit 63311823c6
14 changed files with 30 additions and 89 deletions

View File

@ -119,6 +119,7 @@ add_executable(clonk WIN32 MACOSX_BUNDLE
engine/src/C4Particles.cpp engine/src/C4Particles.cpp
engine/src/C4PathFinder.cpp engine/src/C4PathFinder.cpp
engine/src/C4Player.cpp engine/src/C4Player.cpp
engine/src/C4PlayerControl.cpp
engine/src/C4PlayerInfo.cpp engine/src/C4PlayerInfo.cpp
engine/src/C4PlayerInfoConflicts.cpp engine/src/C4PlayerInfoConflicts.cpp
engine/src/C4PlayerInfoListBox.cpp engine/src/C4PlayerInfoListBox.cpp

View File

@ -9760,67 +9760,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="src\C4Wrappers.cpp"
>
<FileConfiguration
Name="Engine Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Engine Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Engine Release (Debug)|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Engine Release Console|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Engine Debug Console|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"
/>
</FileConfiguration>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Header Files" Name="Header Files"

View File

@ -287,7 +287,7 @@ class C4Object: public C4PropList
BOOL Contact(int32_t cnat); BOOL Contact(int32_t cnat);
void TargetBounds(int32_t &ctco, int32_t limit_low, int32_t limit_hi, int32_t cnat_low, int32_t cnat_hi); void TargetBounds(int32_t &ctco, int32_t limit_low, int32_t limit_hi, int32_t cnat_low, int32_t cnat_hi);
enum { SAC_StartCall = 1, SAC_EndCall = 2, SAC_AbortCall = 4, }; enum { SAC_StartCall = 1, SAC_EndCall = 2, SAC_AbortCall = 4, };
BOOL SetAction(C4PropList * Act, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false); bool SetAction(C4PropList * Act, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
bool SetActionByName(C4String * ActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false); bool SetActionByName(C4String * ActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
bool SetActionByName(const char * szActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false); bool SetActionByName(const char * szActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
void SetDir(int32_t tdir); void SetDir(int32_t tdir);

View File

@ -174,7 +174,7 @@ class C4PlayerControlAssignment
const char *GetControlName() const { return sControlName.getData(); } const char *GetControlName() const { return sControlName.getData(); }
int32_t GetControl() const { return iControl; } int32_t GetControl() const { return iControl; }
bool IsRefsResolved() const { return fRefsResolved; } bool IsRefsResolved() const { return fRefsResolved; }
bool IsAlwaysUnhandled() const { return iTriggerMode & CTM_AlwaysUnhandled; } bool IsAlwaysUnhandled() const { return !!(iTriggerMode & CTM_AlwaysUnhandled); }
int32_t GetTriggerMode() const { return iTriggerMode; } int32_t GetTriggerMode() const { return iTriggerMode; }
const C4KeyCodeEx &GetTriggerKey() const { return TriggerKey; } const C4KeyCodeEx &GetTriggerKey() const { return TriggerKey; }
bool HasCombo() const { return KeyCombo.size()>1; } bool HasCombo() const { return KeyCombo.size()>1; }

View File

@ -561,7 +561,7 @@ C4ApplicationGameTimer::C4ApplicationGameTimer()
void C4ApplicationGameTimer::SetGameTickDelay(uint32_t iDelay) void C4ApplicationGameTimer::SetGameTickDelay(uint32_t iDelay)
{ {
// Smaller than minimum refresh delay? // Smaller than minimum refresh delay?
if (iDelay < Config.Graphics.MaxRefreshDelay) if (iDelay < uint32_t(Config.Graphics.MaxRefreshDelay))
{ {
// Set critical timer // Set critical timer
SetDelay(iDelay); SetDelay(iDelay);
@ -584,7 +584,7 @@ bool C4ApplicationGameTimer::Execute(int iTimeout, pollfd *)
{ {
// Check timer and reset // Check timer and reset
if (!CheckAndReset()) return true; if (!CheckAndReset()) return true;
int Now = timeGetTime(); unsigned int Now = timeGetTime();
// Execute // Execute
if(Now >= iLastGameTick + iGameTickDelay || Game.GameGo) if(Now >= iLastGameTick + iGameTickDelay || Game.GameGo)
{ {

View File

@ -384,7 +384,7 @@ void C4ControlPlayerControl::Execute() const
else else
{ {
// player-based control: Execute on control owned by player // player-based control: Execute on control owned by player
C4Player *pPlr=Game.Players.Get(iPlr); C4Player *pPlr=::Players.Get(iPlr);
if (pPlr) if (pPlr)
{ {
pTargetCtrl = &(pPlr->Control); pTargetCtrl = &(pPlr->Control);

View File

@ -766,7 +766,7 @@ C4GameControlPacket *C4GameControlNetwork::PackCompleteCtrl(int32_t iTick)
{ {
// async mode: wait n extra frames for slow clients // async mode: wait n extra frames for slow clients
const int iMaxWait = (Config.Network.AsyncMaxWait * 1000) / iTargetFPS; const int iMaxWait = (Config.Network.AsyncMaxWait * 1000) / iTargetFPS;
if(eMode != CNM_Async || iWaitStart == -1 || timeGetTime() <= iWaitStart + iMaxWait) if(eMode != CNM_Async || iWaitStart == -1 || timeGetTime() <= uint32_t(iWaitStart + iMaxWait))
return false; return false;
} }

View File

@ -2772,7 +2772,7 @@ bool C4Landscape::Mat2Pal()
for (rgb=0; rgb<3; rgb++) for (rgb=0; rgb<3; rgb++)
Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb] Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb]
= Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb] = Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb]
= dwPix >> ((2-rgb) * 8); = uint8_t(dwPix >> ((2-rgb) * 8));
// alpha // alpha
Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0; Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0;
Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0; Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0;

View File

@ -3526,7 +3526,7 @@ void C4Object::Resort()
// Must not immediately resort - link change/removal would crash Game::ExecObjects // Must not immediately resort - link change/removal would crash Game::ExecObjects
} }
BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2, int32_t iCalls, bool fForce) bool C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2, int32_t iCalls, bool fForce)
{ {
C4PropList * LastAction = Action.pActionDef; C4PropList * LastAction = Action.pActionDef;
int32_t iLastPhase=Action.Phase; int32_t iLastPhase=Action.Phase;
@ -3534,7 +3534,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
if (LastAction) if (LastAction)
if (LastAction->GetPropertyInt(P_NoOtherAction) && !fForce) if (LastAction->GetPropertyInt(P_NoOtherAction) && !fForce)
if (Act != LastAction) if (Act != LastAction)
return FALSE; return false;
// Stop previous act sound // Stop previous act sound
if (LastAction) if (LastAction)
if (Act != LastAction) if (Act != LastAction)
@ -3581,7 +3581,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def; C4Def *pOldDef = Def;
Call(Action.pActionDef->GetPropertyStr(P_StartCall)->GetCStr()); Call(Action.pActionDef->GetPropertyStr(P_StartCall)->GetCStr());
// abort exeution if def changed // abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE; if (Def != pOldDef || !Status) return true;
} }
} }
// Execute EndCall // Execute EndCall
@ -3593,7 +3593,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def; C4Def *pOldDef = Def;
Call(LastAction->GetPropertyStr(P_EndCall)->GetCStr()); Call(LastAction->GetPropertyStr(P_EndCall)->GetCStr());
// abort exeution if def changed // abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE; if (Def != pOldDef || !Status) return true;
} }
} }
// Execute AbortCall // Execute AbortCall
@ -3605,10 +3605,10 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def; C4Def *pOldDef = Def;
Call(LastAction->GetPropertyStr(P_AbortCall)->GetCStr(), &C4AulParSet(C4VInt(iLastPhase))); Call(LastAction->GetPropertyStr(P_AbortCall)->GetCStr(), &C4AulParSet(C4VInt(iLastPhase)));
// abort exeution if def changed // abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE; if (Def != pOldDef || !Status) return true;
} }
} }
return TRUE; return true;
} }
void C4Object::UpdateActionFace() void C4Object::UpdateActionFace()

View File

@ -453,7 +453,7 @@ void C4ObjectMenu::OnUserEnter(int32_t Player, int32_t iIndex, bool fRight)
void C4ObjectMenu::OnUserClose() void C4ObjectMenu::OnUserClose()
{ {
// Queue 2do // Queue 2do
Game.Input.Add(CID_PlrControl, new C4ControlPlayerControl(Game.MouseControl.GetPlayer(),Game.PlayerControlDefs.InternalCons.CON_MenuClose,0)); Game.Input.Add(CID_PlrControl, new C4ControlPlayerControl(::MouseControl.GetPlayer(),Game.PlayerControlDefs.InternalCons.CON_MenuClose,0));
} }
bool C4ObjectMenu::IsReadOnly() bool C4ObjectMenu::IsReadOnly()

View File

@ -22,9 +22,10 @@
#ifndef BIG_C4INCLUDE #ifndef BIG_C4INCLUDE
#include <C4LangStringTable.h> #include <C4LangStringTable.h>
#include <C4Player.h> #include <C4Player.h>
#include <C4PlayerList.h>
#include <C4Control.h> #include <C4Control.h>
#include <C4Game.h> #include <C4Game.h>
#include <C4Wrappers.h> #include <C4Log.h>
#endif #endif
/* C4PlayerControlDef */ /* C4PlayerControlDef */
@ -117,7 +118,7 @@ void C4PlayerControlDefs::MergeFrom(const C4PlayerControlDefs &Src)
const C4PlayerControlDef *C4PlayerControlDefs::GetControlByIndex(int32_t idx) const const C4PlayerControlDef *C4PlayerControlDefs::GetControlByIndex(int32_t idx) const
{ {
// safe index // safe index
if (idx<0 || idx>=Defs.size()) return NULL; if (idx<0 || idx>=int32_t(Defs.size())) return NULL;
return &(Defs[idx]); return &(Defs[idx]);
} }
@ -138,7 +139,7 @@ void C4PlayerControlDefs::FinalInit()
const char *szIdtf = (*i).GetIdentifier(); const char *szIdtf = (*i).GetIdentifier();
if (szIdtf && *szIdtf && !SEqual(szIdtf, "None")) if (szIdtf && *szIdtf && !SEqual(szIdtf, "None"))
{ {
Game.ScriptEngine.RegisterGlobalConstant(FormatString("CON_%s", szIdtf).getData(), C4VInt(i-Defs.begin())); ::ScriptEngine.RegisterGlobalConstant(FormatString("CON_%s", szIdtf).getData(), C4VInt(i-Defs.begin()));
} }
} }
} }
@ -528,14 +529,14 @@ bool C4PlayerControl::CSync::ControlDownState::operator ==(const ControlDownStat
const C4PlayerControl::CSync::ControlDownState *C4PlayerControl::CSync::GetControlDownState(int32_t iControl) const const C4PlayerControl::CSync::ControlDownState *C4PlayerControl::CSync::GetControlDownState(int32_t iControl) const
{ {
// safe access // safe access
if (iControl < 0 || iControl >= ControlDownStates.size()) return NULL; if (iControl < 0 || iControl >= int32_t(ControlDownStates.size())) return NULL;
return &ControlDownStates[iControl]; return &ControlDownStates[iControl];
} }
int32_t C4PlayerControl::CSync::GetControlDisabled(int32_t iControl) const int32_t C4PlayerControl::CSync::GetControlDisabled(int32_t iControl) const
{ {
// safe access // safe access
if (iControl < 0 || iControl >= ControlDisableStates.size()) return 0; if (iControl < 0 || iControl >= int32_t(ControlDisableStates.size())) return 0;
return ControlDisableStates[iControl]; return ControlDisableStates[iControl];
} }
@ -543,7 +544,7 @@ void C4PlayerControl::CSync::SetControlDownState(int32_t iControl, const C4KeyEv
{ {
// update state // update state
if (iControl < 0) return; if (iControl < 0) return;
if (iControl >= ControlDownStates.size()) ControlDownStates.resize(iControl+1); if (iControl >= int32_t(ControlDownStates.size())) ControlDownStates.resize(iControl+1);
ControlDownState &rState = ControlDownStates[iControl]; ControlDownState &rState = ControlDownStates[iControl];
rState.DownState = rDownState; rState.DownState = rDownState;
rState.iDownFrame = iDownFrame; rState.iDownFrame = iDownFrame;
@ -554,7 +555,7 @@ void C4PlayerControl::CSync::SetControlDisabled(int32_t iControl, int32_t iVal)
{ {
// disable control // disable control
if (iControl < 0) return; if (iControl < 0) return;
if (iControl >= ControlDisableStates.size()) ControlDisableStates.resize(iControl+1); if (iControl >= int32_t(ControlDisableStates.size())) ControlDisableStates.resize(iControl+1);
ControlDisableStates[iControl] = iVal; ControlDisableStates[iControl] = iVal;
// if a control is disabled, its down-state is reset silently // if a control is disabled, its down-state is reset silently
const ControlDownState *pDownState = GetControlDownState(iControl); const ControlDownState *pDownState = GetControlDownState(iControl);
@ -749,7 +750,7 @@ bool C4PlayerControl::ExecuteControlAction(int32_t iControl, C4PlayerControlDef:
C4Player *pPlr = NULL; C4Player *pPlr = NULL;
if (iPlr > -1) if (iPlr > -1)
{ {
pPlr = Game.Players.Get(iPlr); pPlr = ::Players.Get(iPlr);
if (!pPlr) return false; if (!pPlr) return false;
} }
// exec action (on player) // exec action (on player)
@ -775,7 +776,7 @@ bool C4PlayerControl::ExecuteControlAction(int32_t iControl, C4PlayerControlDef:
bool C4PlayerControl::ExecuteControlScript(int32_t iControl, C4ID idControlExtraData, bool fUp, const C4KeyEventData &rKeyExtraData, bool fRepeated) bool C4PlayerControl::ExecuteControlScript(int32_t iControl, C4ID idControlExtraData, bool fUp, const C4KeyEventData &rKeyExtraData, bool fRepeated)
{ {
C4Player *pPlr = Game.Players.Get(iPlr); C4Player *pPlr = ::Players.Get(iPlr);
if (pPlr) if (pPlr)
{ {
// Not for eliminated (checked again in DirectCom, but make sure no control is generated for eliminated players!) // Not for eliminated (checked again in DirectCom, but make sure no control is generated for eliminated players!)
@ -789,7 +790,7 @@ bool C4PlayerControl::ExecuteControlScript(int32_t iControl, C4ID idControlExtra
return false; return false;
} }
// control down // control down
C4AulFunc *pFunc = Game.ScriptEngine.GetFirstFunc(PSF_PlayerControl); C4AulFunc *pFunc = ::ScriptEngine.GetFirstFunc(PSF_PlayerControl);
if (!pFunc) return false; if (!pFunc) return false;
C4AulParSet Pars(C4VInt(iPlr), C4VInt(iControl), C4VID(idControlExtraData), C4VInt(rKeyExtraData.x), C4VInt(rKeyExtraData.y), C4VInt(rKeyExtraData.iStrength), C4VBool(fRepeated), C4VBool(fUp)); C4AulParSet Pars(C4VInt(iPlr), C4VInt(iControl), C4VID(idControlExtraData), C4VInt(rKeyExtraData.x), C4VInt(rKeyExtraData.y), C4VInt(rKeyExtraData.iStrength), C4VBool(fRepeated), C4VBool(fUp));
return !!pFunc->Exec(NULL, &Pars); return !!pFunc->Exec(NULL, &Pars);

View File

@ -255,7 +255,7 @@ bool C4Record::Rec(C4PacketType eCtrlType, C4ControlPacket *pCtrl, int iFrame)
bool C4Record::Rec(int iFrame, const StdBuf &sBuf, C4RecordChunkType eType) bool C4Record::Rec(int iFrame, const StdBuf &sBuf, C4RecordChunkType eType)
{ {
// filler chunks (this should never be necessary, though) // filler chunks (this should never be necessary, though)
while(iFrame > iLastFrame + 0xff) while(iFrame > int(iLastFrame + 0xff))
Rec(iLastFrame + 0xff, StdBuf(), RCT_Frame); Rec(iLastFrame + 0xff, StdBuf(), RCT_Frame);
// get frame difference // get frame difference
uint8_t iFrameDiff = Max<uint8_t>(0, iFrame - iLastFrame); uint8_t iFrameDiff = Max<uint8_t>(0, iFrame - iLastFrame);
@ -990,7 +990,7 @@ StdStrBuf GetDbgRecPktData(C4RecordChunkType eType, const StdBuf & RawData)
case RCT_AulFunc: r.Ref(reinterpret_cast<const char*>(RawData.getData()), RawData.getSize()-1); case RCT_AulFunc: r.Ref(reinterpret_cast<const char*>(RawData.getData()), RawData.getSize()-1);
break; break;
default: default:
for (int i=0; i<RawData.getSize(); ++i) for (unsigned int i=0; i<RawData.getSize(); ++i)
r.AppendFormat("%02x ", (uint32_t) ((uint8_t *)RawData.getData())[i]); r.AppendFormat("%02x ", (uint32_t) ((uint8_t *)RawData.getData())[i]);
break; break;
} }

View File

@ -5688,7 +5688,7 @@ static long FnGetPlayerControlState(C4AulContext *ctx, long iPlr, long iControl)
} }
else else
{ {
C4Player *pPlr = Game.Players.Get(iPlr); C4Player *pPlr = ::Players.Get(iPlr);
if (pPlr) if (pPlr)
{ {
pCheckCtrl = &(pPlr->Control); pCheckCtrl = &(pPlr->Control);

View File

@ -385,7 +385,7 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, float fx, float fy,
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
} }
DWORD dwModMask = 0; DWORD dwModMask = 0;
SetupTextureEnv(false, mattextures); SetupTextureEnv(false, !!mattextures);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);