mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Fix crash when loading mc_underground map
it was because in Window.cpp/h a lot of pointers were castet to ints.. if such abomination is done at least use intptr_t...
This commit is contained in:
parent
63f9d4000f
commit
ddaa0c8f70
2 changed files with 33 additions and 21 deletions
|
@ -2026,10 +2026,11 @@ void idWindow::PostParse()
|
|||
idWindow::GetWinVarOffset
|
||||
================
|
||||
*/
|
||||
int idWindow::GetWinVarOffset( idWinVar* wv, drawWin_t* owner )
|
||||
intptr_t idWindow::GetWinVarOffset( idWinVar* wv, drawWin_t* owner )
|
||||
{
|
||||
// RB: 64 bit fixes, changed oldschool offsets using ptrdiff_t
|
||||
int ret = -1;
|
||||
// DG: => also return intptr_t..
|
||||
intptr_t ret = -1;
|
||||
|
||||
if( wv == &rect )
|
||||
{
|
||||
|
@ -3124,9 +3125,9 @@ wexpOp_t* idWindow::ExpressionOp()
|
|||
idWindow::EmitOp
|
||||
================
|
||||
*/
|
||||
|
||||
int idWindow::EmitOp( int a, int b, wexpOpType_t opType, wexpOp_t** opp )
|
||||
{
|
||||
// DG: a, b and the return value are really pointers, so use intptr_t
|
||||
intptr_t idWindow::EmitOp( intptr_t a, intptr_t b, wexpOpType_t opType, wexpOp_t** opp )
|
||||
{ // DG end
|
||||
wexpOp_t* op;
|
||||
/*
|
||||
// optimize away identity operations
|
||||
|
@ -3178,9 +3179,11 @@ int idWindow::EmitOp( int a, int b, wexpOpType_t opType, wexpOp_t** opp )
|
|||
idWindow::ParseEmitOp
|
||||
================
|
||||
*/
|
||||
int idWindow::ParseEmitOp( idTokenParser* src, int a, wexpOpType_t opType, int priority, wexpOp_t** opp )
|
||||
// DG: a, b and the return value are really pointers, so use intptr_t
|
||||
intptr_t idWindow::ParseEmitOp( idTokenParser* src, intptr_t a, wexpOpType_t opType, int priority, wexpOp_t** opp )
|
||||
{
|
||||
int b = ParseExpressionPriority( src, priority );
|
||||
intptr_t b = ParseExpressionPriority( src, priority );
|
||||
// DG end
|
||||
return EmitOp( a, b, opType, opp );
|
||||
}
|
||||
|
||||
|
@ -3192,8 +3195,9 @@ idWindow::ParseTerm
|
|||
Returns a register index
|
||||
=================
|
||||
*/
|
||||
int idWindow::ParseTerm( idTokenParser* src, idWinVar* var, int component )
|
||||
{
|
||||
// DG: component and the return value are really pointers, so use intptr_t
|
||||
intptr_t idWindow::ParseTerm( idTokenParser* src, idWinVar* var, intptr_t component )
|
||||
{ // DG end
|
||||
idToken token;
|
||||
// RB: 64 bit fixes, changed int to intptr_t
|
||||
intptr_t a, b;
|
||||
|
@ -3315,10 +3319,11 @@ Returns a register index
|
|||
=================
|
||||
*/
|
||||
#define TOP_PRIORITY 4
|
||||
int idWindow::ParseExpressionPriority( idTokenParser* src, int priority, idWinVar* var, int component )
|
||||
// DG: a, component and the return value are really pointers, so use intptr_t
|
||||
intptr_t idWindow::ParseExpressionPriority( idTokenParser* src, int priority, idWinVar* var, intptr_t component )
|
||||
{
|
||||
idToken token;
|
||||
int a;
|
||||
intptr_t a;
|
||||
|
||||
if( priority == 0 )
|
||||
{
|
||||
|
@ -3389,7 +3394,8 @@ int idWindow::ParseExpressionPriority( idTokenParser* src, int priority, idWinVa
|
|||
if( priority == 4 && token == "?" )
|
||||
{
|
||||
wexpOp_t* oop = NULL;
|
||||
int o = ParseEmitOp( src, a, WOP_TYPE_COND, priority, &oop );
|
||||
intptr_t o = ParseEmitOp( src, a, WOP_TYPE_COND, priority, &oop );
|
||||
// DG end
|
||||
if( !src->ReadToken( &token ) )
|
||||
{
|
||||
return o;
|
||||
|
@ -3417,8 +3423,9 @@ idWindow::ParseExpression
|
|||
Returns a register index
|
||||
================
|
||||
*/
|
||||
int idWindow::ParseExpression( idTokenParser* src, idWinVar* var, int component )
|
||||
{
|
||||
// DG: component and the return value are really pointers, so use intptr_t
|
||||
intptr_t idWindow::ParseExpression( idTokenParser* src, idWinVar* var, intptr_t component )
|
||||
{ // DG end
|
||||
return ParseExpressionPriority( src, TOP_PRIORITY, var );
|
||||
}
|
||||
|
||||
|
|
|
@ -248,8 +248,9 @@ public:
|
|||
idStr* GetStrPtrByName( const char* _name );
|
||||
|
||||
virtual idWinVar* GetWinVarByName( const char* _name, bool winLookup = false, drawWin_t** owner = NULL );
|
||||
|
||||
int GetWinVarOffset( idWinVar* wv, drawWin_t* dw );
|
||||
// DG: the return value is a pointer, so use intptr_t
|
||||
intptr_t GetWinVarOffset( idWinVar* wv, drawWin_t* dw );
|
||||
// DG end
|
||||
float GetMaxCharHeight();
|
||||
float GetMaxCharWidth();
|
||||
void SetFont();
|
||||
|
@ -326,7 +327,9 @@ public:
|
|||
bool RunScript( int n );
|
||||
bool RunScriptList( idGuiScriptList* src );
|
||||
void SetRegs( const char* key, const char* val );
|
||||
int ParseExpression( idTokenParser* src, idWinVar* var = NULL, int component = 0 );
|
||||
// DG: component and the return value are really pointers, so use intptr_t
|
||||
intptr_t ParseExpression( idTokenParser* src, idWinVar* var = NULL, intptr_t component = 0 );
|
||||
// DG end
|
||||
int ExpressionConstant( float f );
|
||||
idRegisterList* RegList()
|
||||
{
|
||||
|
@ -385,10 +388,12 @@ protected:
|
|||
|
||||
int ExpressionTemporary();
|
||||
wexpOp_t* ExpressionOp();
|
||||
int EmitOp( int a, int b, wexpOpType_t opType, wexpOp_t** opp = NULL );
|
||||
int ParseEmitOp( idTokenParser* src, int a, wexpOpType_t opType, int priority, wexpOp_t** opp = NULL );
|
||||
int ParseTerm( idTokenParser* src, idWinVar* var = NULL, int component = 0 );
|
||||
int ParseExpressionPriority( idTokenParser* src, int priority, idWinVar* var = NULL, int component = 0 );
|
||||
// DG: a, b, component and the return values are really pointers, so use intptr_t
|
||||
intptr_t EmitOp( intptr_t a, intptr_t b, wexpOpType_t opType, wexpOp_t** opp = NULL );
|
||||
intptr_t ParseEmitOp( idTokenParser* src, intptr_t a, wexpOpType_t opType, int priority, wexpOp_t** opp = NULL );
|
||||
intptr_t ParseTerm( idTokenParser* src, idWinVar* var = NULL, intptr_t component = 0 );
|
||||
intptr_t ParseExpressionPriority( idTokenParser* src, int priority, idWinVar* var = NULL, intptr_t component = 0 );
|
||||
// DG end
|
||||
void EvaluateRegisters( float* registers );
|
||||
void SaveExpressionParseState();
|
||||
void RestoreExpressionParseState();
|
||||
|
|
Loading…
Reference in a new issue