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/C4PathFinder.cpp
engine/src/C4Player.cpp
engine/src/C4PlayerControl.cpp
engine/src/C4PlayerInfo.cpp
engine/src/C4PlayerInfoConflicts.cpp
engine/src/C4PlayerInfoListBox.cpp

View File

@ -9760,67 +9760,6 @@
/>
</FileConfiguration>
</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
Name="Header Files"

View File

@ -287,7 +287,7 @@ class C4Object: public C4PropList
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);
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(const char * szActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
void SetDir(int32_t tdir);

View File

@ -174,7 +174,7 @@ class C4PlayerControlAssignment
const char *GetControlName() const { return sControlName.getData(); }
int32_t GetControl() const { return iControl; }
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; }
const C4KeyCodeEx &GetTriggerKey() const { return TriggerKey; }
bool HasCombo() const { return KeyCombo.size()>1; }

View File

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

View File

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

View File

@ -766,7 +766,7 @@ C4GameControlPacket *C4GameControlNetwork::PackCompleteCtrl(int32_t iTick)
{
// async mode: wait n extra frames for slow clients
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;
}

View File

@ -2772,7 +2772,7 @@ bool C4Landscape::Mat2Pal()
for (rgb=0; rgb<3; rgb++)
Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb]
= Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb]
= dwPix >> ((2-rgb) * 8);
= uint8_t(dwPix >> ((2-rgb) * 8));
// alpha
Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 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
}
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;
int32_t iLastPhase=Action.Phase;
@ -3534,7 +3534,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
if (LastAction)
if (LastAction->GetPropertyInt(P_NoOtherAction) && !fForce)
if (Act != LastAction)
return FALSE;
return false;
// Stop previous act sound
if (LastAction)
if (Act != LastAction)
@ -3581,7 +3581,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def;
Call(Action.pActionDef->GetPropertyStr(P_StartCall)->GetCStr());
// abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE;
if (Def != pOldDef || !Status) return true;
}
}
// Execute EndCall
@ -3593,7 +3593,7 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def;
Call(LastAction->GetPropertyStr(P_EndCall)->GetCStr());
// abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE;
if (Def != pOldDef || !Status) return true;
}
}
// Execute AbortCall
@ -3605,10 +3605,10 @@ BOOL C4Object::SetAction(C4PropList * Act, C4Object *pTarget, C4Object *pTarget2
C4Def *pOldDef = Def;
Call(LastAction->GetPropertyStr(P_AbortCall)->GetCStr(), &C4AulParSet(C4VInt(iLastPhase)));
// abort exeution if def changed
if (Def != pOldDef || !Status) return TRUE;
if (Def != pOldDef || !Status) return true;
}
}
return TRUE;
return true;
}
void C4Object::UpdateActionFace()

View File

@ -453,7 +453,7 @@ void C4ObjectMenu::OnUserEnter(int32_t Player, int32_t iIndex, bool fRight)
void C4ObjectMenu::OnUserClose()
{
// 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()

View File

@ -22,9 +22,10 @@
#ifndef BIG_C4INCLUDE
#include <C4LangStringTable.h>
#include <C4Player.h>
#include <C4PlayerList.h>
#include <C4Control.h>
#include <C4Game.h>
#include <C4Wrappers.h>
#include <C4Log.h>
#endif
/* C4PlayerControlDef */
@ -117,7 +118,7 @@ void C4PlayerControlDefs::MergeFrom(const C4PlayerControlDefs &Src)
const C4PlayerControlDef *C4PlayerControlDefs::GetControlByIndex(int32_t idx) const
{
// safe index
if (idx<0 || idx>=Defs.size()) return NULL;
if (idx<0 || idx>=int32_t(Defs.size())) return NULL;
return &(Defs[idx]);
}
@ -138,7 +139,7 @@ void C4PlayerControlDefs::FinalInit()
const char *szIdtf = (*i).GetIdentifier();
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
{
// safe access
if (iControl < 0 || iControl >= ControlDownStates.size()) return NULL;
if (iControl < 0 || iControl >= int32_t(ControlDownStates.size())) return NULL;
return &ControlDownStates[iControl];
}
int32_t C4PlayerControl::CSync::GetControlDisabled(int32_t iControl) const
{
// safe access
if (iControl < 0 || iControl >= ControlDisableStates.size()) return 0;
if (iControl < 0 || iControl >= int32_t(ControlDisableStates.size())) return 0;
return ControlDisableStates[iControl];
}
@ -543,7 +544,7 @@ void C4PlayerControl::CSync::SetControlDownState(int32_t iControl, const C4KeyEv
{
// update state
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];
rState.DownState = rDownState;
rState.iDownFrame = iDownFrame;
@ -554,7 +555,7 @@ void C4PlayerControl::CSync::SetControlDisabled(int32_t iControl, int32_t iVal)
{
// disable control
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;
// if a control is disabled, its down-state is reset silently
const ControlDownState *pDownState = GetControlDownState(iControl);
@ -749,7 +750,7 @@ bool C4PlayerControl::ExecuteControlAction(int32_t iControl, C4PlayerControlDef:
C4Player *pPlr = NULL;
if (iPlr > -1)
{
pPlr = Game.Players.Get(iPlr);
pPlr = ::Players.Get(iPlr);
if (!pPlr) return false;
}
// 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)
{
C4Player *pPlr = Game.Players.Get(iPlr);
C4Player *pPlr = ::Players.Get(iPlr);
if (pPlr)
{
// 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;
}
// control down
C4AulFunc *pFunc = Game.ScriptEngine.GetFirstFunc(PSF_PlayerControl);
C4AulFunc *pFunc = ::ScriptEngine.GetFirstFunc(PSF_PlayerControl);
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));
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)
{
// filler chunks (this should never be necessary, though)
while(iFrame > iLastFrame + 0xff)
while(iFrame > int(iLastFrame + 0xff))
Rec(iLastFrame + 0xff, StdBuf(), RCT_Frame);
// get frame difference
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);
break;
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]);
break;
}

View File

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

View File

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