Browse Source

Apply some valve's fixes

foolsday
mittorn 9 years ago
parent
commit
ac857199cf
  1. 4
      cl_dll/util_vector.h
  2. 4
      common/const.h
  3. 3
      dlls/animation.cpp
  4. 10
      dlls/bmodels.cpp
  5. 11
      dlls/client.cpp
  6. 5
      dlls/combat.cpp
  7. 12
      dlls/doors.cpp
  8. 2
      dlls/effects.cpp
  9. 4
      dlls/extdll.h
  10. 9
      dlls/func_break.cpp
  11. 2
      dlls/saverestore.h
  12. 2
      dlls/sound.cpp
  13. 5114
      dlls/util.cpp
  14. 2
      pm_shared/pm_shared.c

4
cl_dll/util_vector.h

@ -22,8 +22,8 @@ @@ -22,8 +22,8 @@
#include "math.h"
// Header file containing definition of globalvars_t and entvars_t
typedef int func_t; //
typedef int string_t; // from engine's pr_comp.h;
typedef unsigned int func_t; //
typedef unsigned int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
//=========================================================

4
common/const.h

@ -727,8 +727,8 @@ enum @@ -727,8 +727,8 @@ enum
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
};
typedef int func_t;
typedef int string_t;
typedef unsigned int func_t;
typedef unsigned int string_t;
typedef unsigned char byte;
typedef unsigned short word;

3
dlls/animation.cpp

@ -319,6 +319,7 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve @@ -319,6 +319,7 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve
float SetController( void *pmodel, entvars_t *pev, int iController, float flValue )
{
studiohdr_t *pstudiohdr;
int i;
pstudiohdr = (studiohdr_t *)pmodel;
if (! pstudiohdr)
@ -327,7 +328,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu @@ -327,7 +328,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex);
// find first controller that matches the index
for (int i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++)
for (i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++)
{
if (pbonecontroller->index == iController)
break;

10
dlls/bmodels.cpp

@ -550,13 +550,13 @@ void CFuncRotating :: RampPitchVol (int fUp) @@ -550,13 +550,13 @@ void CFuncRotating :: RampPitchVol (int fUp)
// get current angular velocity
vecCur = abs(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z));
vecCur = fabs(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z));
// get target angular velocity
vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
vecFinal *= pev->speed;
vecFinal = abs(vecFinal);
vecFinal = fabs(vecFinal);
// calc volume and pitch as % of final vol and pitch
@ -592,9 +592,9 @@ void CFuncRotating :: SpinUp( void ) @@ -592,9 +592,9 @@ void CFuncRotating :: SpinUp( void )
vecAVel = pev->avelocity;// cache entity's rotational velocity
// if we've met or exceeded target speed, set target speed and stop thinking
if ( abs(vecAVel.x) >= abs(pev->movedir.x * pev->speed) &&
abs(vecAVel.y) >= abs(pev->movedir.y * pev->speed) &&
abs(vecAVel.z) >= abs(pev->movedir.z * pev->speed) )
if ( fabs(vecAVel.x) >= fabs(pev->movedir.x * pev->speed) &&
fabs(vecAVel.y) >= fabs(pev->movedir.y * pev->speed) &&
fabs(vecAVel.z) >= fabs(pev->movedir.z * pev->speed) )
{
pev->avelocity = pev->movedir * pev->speed;// set speed in case we overshot
EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning),

11
dlls/client.cpp

@ -101,8 +101,9 @@ void ClientDisconnect( edict_t *pEntity ) @@ -101,8 +101,9 @@ void ClientDisconnect( edict_t *pEntity )
if (g_fGameOver)
return;
char text[256];
sprintf( text, "- %s has left the game\n", STRING(pEntity->v.netname) );
char text[256] = "";
if ( pEntity->v.netname )
snprintf( text, sizeof(text), "- %s has left the game\n", STRING(pEntity->v.netname) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
@ -197,6 +198,10 @@ void ClientPutInServer( edict_t *pEntity ) @@ -197,6 +198,10 @@ void ClientPutInServer( edict_t *pEntity )
// Reset interpolation during first frame
pPlayer->pev->effects |= EF_NOINTERP;
pPlayer->pev->iuser1 = 0;
pPlayer->pev->iuser2 = 0;
}
#include "voice_gamemgr.h"
@ -527,7 +532,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) @@ -527,7 +532,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
g_engfuncs.pfnSetClientKeyValue( ENTINDEX(pEntity), infobuffer, "name", sName );
char text[256];
sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
snprintf( text, 256, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );

5
dlls/combat.cpp

@ -1225,6 +1225,11 @@ BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) @@ -1225,6 +1225,11 @@ BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity )
Vector vecLookerOrigin;
Vector vecTargetOrigin;
if(!pEntity)
return FALSE;
if(!pEntity->pev)
return FALSE;
if (FBitSet( pEntity->pev->flags, FL_NOTARGET ))
return FALSE;

12
dlls/doors.cpp

@ -571,7 +571,8 @@ void CBaseDoor::DoorGoUp( void ) @@ -571,7 +571,8 @@ void CBaseDoor::DoorGoUp( void )
// emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't
// filter them out and leave a client stuck with looping door sounds!
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
m_toggle_state = TS_GOING_UP;
@ -652,7 +653,8 @@ void CBaseDoor::DoorHitTop( void ) @@ -652,7 +653,8 @@ void CBaseDoor::DoorHitTop( void )
void CBaseDoor::DoorGoDown( void )
{
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
#ifdef DOOR_ASSERT
ASSERT(m_toggle_state == TS_AT_TOP);
@ -753,6 +755,9 @@ void CBaseDoor::Blocked( CBaseEntity *pOther ) @@ -753,6 +755,9 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
pDoor->pev->avelocity = g_vecZero;
}
}
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) );
if ( pDoor->m_toggle_state == TS_GOING_DOWN)
pDoor->DoorGoUp();
@ -1054,6 +1059,9 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP @@ -1054,6 +1059,9 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
if ( value > 1.0 )
value = 1.0;
if ( value < 0.0 )
value = 0.0;
Vector move = m_vecPosition1 + (value * (m_vecPosition2 - m_vecPosition1));
Vector delta = move - pev->origin;

2
dlls/effects.cpp

@ -1003,7 +1003,7 @@ void CLaser::KeyValue( KeyValueData *pkvd ) @@ -1003,7 +1003,7 @@ void CLaser::KeyValue( KeyValueData *pkvd )
}
else if (FStrEq(pkvd->szKeyName, "width"))
{
SetWidth( atof(pkvd->szValue) );
SetWidth( (int)atof(pkvd->szValue) );
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "NoiseAmplitude"))

4
dlls/extdll.h

@ -64,8 +64,8 @@ typedef int BOOL; @@ -64,8 +64,8 @@ typedef int BOOL;
#include "math.h"
// Header file containing definition of globalvars_t and entvars_t
typedef int func_t; //
typedef int string_t; // from engine's pr_comp.h;
typedef unsigned int func_t; //
typedef unsigned int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
// Vector class

9
dlls/func_break.cpp

@ -596,7 +596,7 @@ void CBreakable::Die( void ) @@ -596,7 +596,7 @@ void CBreakable::Die( void )
// The more negative pev->health, the louder
// the sound should be.
fvol = RANDOM_FLOAT(0.85, 1.0) + (abs(pev->health) / 100.0);
fvol = RANDOM_FLOAT(0.85, 1.0) + (fabs(pev->health) / 100.0);
if (fvol > 1.0)
fvol = 1.0;
@ -931,14 +931,13 @@ void CPushable :: Move( CBaseEntity *pOther, int push ) @@ -931,14 +931,13 @@ void CPushable :: Move( CBaseEntity *pOther, int push )
return;
}
// g-cont. fix pushable acceleration bug
// g-cont. fix pushable acceleration bug (reverted as it used in mods)
if ( pOther->IsPlayer() )
{
// Don't push unless the player is pushing forward and NOT use (pull)
if ( push && !(pevToucher->button & (IN_FORWARD|IN_MOVERIGHT|IN_MOVELEFT|IN_BACK)) )
if ( push && !(pevToucher->button & (IN_FORWARD|IN_USE)) )
return;
if ( !push && !(pevToucher->button & (IN_BACK)) ) return;
playerTouch = 1;
playerTouch = 1;
}
float factor;

2
dlls/saverestore.h

@ -60,7 +60,7 @@ public: @@ -60,7 +60,7 @@ public:
void WriteVector( const char *pname, const float *value, int count ); // Save a vector
void WritePositionVector( const char *pname, const Vector &value ); // Offset for landmark if necessary
void WritePositionVector( const char *pname, const float *value, int count ); // array of pos vectors
void WriteFunction( const char *pname, const int *value, int count ); // Save a function pointer
void WriteFunction( const char *pname, void **value, int count ); // Save a function pointer
int WriteEntVars( const char *pname, entvars_t *pev ); // Save entvars_t (entvars_t)
int WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );

2
dlls/sound.cpp

@ -1537,7 +1537,7 @@ void TEXTURETYPE_Init() @@ -1537,7 +1537,7 @@ void TEXTURETYPE_Init()
char buffer[512];
int i, j;
byte *pMemFile;
int fileSize, filePos;
int fileSize, filePos = 0;
if (fTextureTypeInit)
return;

5114
dlls/util.cpp

File diff suppressed because it is too large Load Diff

2
pm_shared/pm_shared.c

@ -186,7 +186,7 @@ void PM_InitTextureTypes() @@ -186,7 +186,7 @@ void PM_InitTextureTypes()
char buffer[512];
int i, j;
byte *pMemFile;
int fileSize, filePos;
int fileSize, filePos = 0;
static qboolean bTextureTypeInit = false;
if ( bTextureTypeInit )

Loading…
Cancel
Save