Browse Source

Merge pull request #100 from SanyaSho/ent-create-crash-fix

small fixes
pull/110/merge
nillerusr 2 years ago committed by GitHub
parent
commit
e852953d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      game/client/c_baseflex.cpp
  2. 2
      game/client/glow_overlay.cpp
  3. 19
      game/client/view.cpp
  4. 6
      game/server/ai_basenpc.cpp
  5. 10
      game/server/hl2/grenade_frag.cpp
  6. 17
      game/server/hl2/npc_combine.cpp
  7. 2
      game/server/hl2/npc_combine.h
  8. 22
      game/server/hl2/npc_combinedropship.cpp
  9. 2
      game/server/hl2/npc_houndeye.cpp
  10. 62
      game/server/hl2/weapon_smg1.cpp
  11. 3
      game/shared/gamemovement.cpp
  12. 2
      game/shared/hl2/hl2_gamerules.cpp
  13. 6
      game/shared/hl2mp/weapon_357.cpp
  14. 31
      game/shared/hl2mp/weapon_hl2mpbase.cpp
  15. 5
      game/shared/hl2mp/weapon_hl2mpbase.h
  16. 2
      game/shared/hl2mp/weapon_rpg.cpp
  17. 2
      game/shared/shareddefs.h
  18. 6
      gameui/OptionsSubVideo.cpp
  19. 2
      public/bone_setup.cpp

2
game/client/c_baseflex.cpp

@ -1149,7 +1149,7 @@ void C_BaseFlex::SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightC @@ -1149,7 +1149,7 @@ void C_BaseFlex::SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightC
{
// hack in an initialization
LinkToGlobalFlexControllers( GetModelPtr() );
m_iBlink = AddGlobalFlexController( "UH" );
m_iBlink = AddGlobalFlexController( "blink" );
if ( SetupGlobalWeights( pBoneToWorld, nFlexWeightCount, pFlexWeights, pFlexDelayedWeights ) )
{

2
game/client/glow_overlay.cpp

@ -159,7 +159,7 @@ void CGlowOverlay::UpdateSkyGlowObstruction( float zFar, bool bCacheFullSceneSta @@ -159,7 +159,7 @@ void CGlowOverlay::UpdateSkyGlowObstruction( float zFar, bool bCacheFullSceneSta
if ( PixelVisibility_IsAvailable() )
{
// Trace a ray at the object.
Vector pos = CurrentViewOrigin() + m_vDirection * zFar * 0.999f;
Vector pos = CurrentViewOrigin() + m_vDirection * zFar * 0.99f; //9f;
// UNDONE: Can probably do only the pixelvis query in this case if you can figure out where
// to put it - or save the position of this trace

19
game/client/view.cpp

@ -642,16 +642,17 @@ void CViewRender::SetUpViews() @@ -642,16 +642,17 @@ void CViewRender::SetUpViews()
// Initialize view structure with default values
float farZ = GetZFar();
// Set up the mono/middle view.
CViewSetup &view = m_View;
// Set up the mono/middle view.
CViewSetup &view = m_View;
view.zFar = farZ;
view.zFarViewmodel = farZ;
// UNDONE: Make this farther out?
view.zFar = farZ;
view.zFarViewmodel = farZ;
// UNDONE: Make this farther out?
// closest point of approach seems to be view center to top of crouched box
view.zNear = GetZNear();
view.zNearViewmodel = 1;
view.fov = default_fov.GetFloat();
view.zNear = GetZNear();
view.zNearViewmodel = 1;
view.fov = default_fov.GetFloat();
view.m_bOrtho = false;
view.m_bViewToProjectionOverride = false;
@ -736,7 +737,7 @@ void CViewRender::SetUpViews() @@ -736,7 +737,7 @@ void CViewRender::SetUpViews()
float flFOVOffset = fDefaultFov - view.fov;
//Adjust the viewmodel's FOV to move with any FOV offsets on the viewer's end
view.fovViewmodel = g_pClientMode->GetViewModelFOV() - flFOVOffset;
view.fovViewmodel = fabs( g_pClientMode->GetViewModelFOV() - flFOVOffset );
if ( UseVR() )
{

6
game/server/ai_basenpc.cpp

@ -6560,6 +6560,12 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart, @@ -6560,6 +6560,12 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart,
//-----------------------------------------------------------------------------
void CAI_BaseNPC::SetupVPhysicsHull()
{
if( GetModelPtr() == NULL )
{
UTIL_Remove( this );
return;
}
if ( GetMoveType() == MOVETYPE_VPHYSICS || GetMoveType() == MOVETYPE_NONE )
return;

10
game/server/hl2/grenade_frag.cpp

@ -155,9 +155,10 @@ void CGrenadeFrag::OnRestore( void ) @@ -155,9 +155,10 @@ void CGrenadeFrag::OnRestore( void )
void CGrenadeFrag::CreateEffects( void )
{
// Start up the eye glow
m_pMainGlow = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false );
if( !m_pMainGlow )
m_pMainGlow = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false );
int nAttachment = LookupAttachment( "fuse" );
int nAttachment = LookupAttachment( "fuse" );
if ( m_pMainGlow != NULL )
{
@ -169,7 +170,8 @@ void CGrenadeFrag::CreateEffects( void ) @@ -169,7 +170,8 @@ void CGrenadeFrag::CreateEffects( void )
}
// Start up the eye trail
m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false );
if( !m_pGlowTrail )
m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false );
if ( m_pGlowTrail != NULL )
{
@ -450,4 +452,4 @@ bool Fraggrenade_WasCreatedByCombine( const CBaseEntity *pEntity ) @@ -450,4 +452,4 @@ bool Fraggrenade_WasCreatedByCombine( const CBaseEntity *pEntity )
}
return false;
}
}

17
game/server/hl2/npc_combine.cpp

@ -378,7 +378,7 @@ void CNPC_Combine::PostNPCInit() @@ -378,7 +378,7 @@ void CNPC_Combine::PostNPCInit()
// an AR2.
if( !GetActiveWeapon() || !FClassnameIs( GetActiveWeapon(), "weapon_ar2" ) )
{
DevWarning("**Combine Elite Soldier MUST be equipped with AR2\n");
// DevWarning("**Combine Elite Soldier MUST be equipped with AR2\n");
}
}
@ -2320,7 +2320,18 @@ void CNPC_Combine::HandleAnimEvent( animevent_t *pEvent ) @@ -2320,7 +2320,18 @@ void CNPC_Combine::HandleAnimEvent( animevent_t *pEvent )
{
if ( pEvent->event == COMBINE_AE_BEGIN_ALTFIRE )
{
EmitSound( "Weapon_CombineGuard.Special1" );
if( FClassnameIs( GetActiveWeapon(), "weapon_ar2" ) )
{
EmitSound( "Weapon_CombineGuard.Special1" );
}
else if( FClassnameIs( GetActiveWeapon(), "weapon_smg1" ) )
{
EmitSound( "Weapon_SMG1.Double" );
}
else
{
EmitSound( "Weapon_CombineGuard.Special1" );
}
handledEvent = true;
}
else if ( pEvent->event == COMBINE_AE_ALTFIRE )
@ -2565,7 +2576,7 @@ void CNPC_Combine::SpeakSentence( int sentenceType ) @@ -2565,7 +2576,7 @@ void CNPC_Combine::SpeakSentence( int sentenceType )
//=========================================================
// PainSound
//=========================================================
void CNPC_Combine::PainSound ( void )
void CNPC_Combine::PainSound ( const CTakeDamageInfo &damageinfo )
{
// NOTE: The response system deals with this at the moment
if ( GetFlags() & FL_DISSOLVING )

2
game/server/hl2/npc_combine.h

@ -126,7 +126,7 @@ public: @@ -126,7 +126,7 @@ public:
// Sounds
// -------------
void DeathSound( void );
void PainSound( void );
void PainSound( const CTakeDamageInfo &damageinfo );
void IdleSound( void );
void AlertSound( void );
void LostEnemySound( void );

22
game/server/hl2/npc_combinedropship.cpp

@ -343,6 +343,8 @@ private: @@ -343,6 +343,8 @@ private:
int m_iMachineGunRefAttachment;
int m_iAttachmentTroopDeploy;
int m_iAttachmentDeployStart;
int m_poseWeapon_Pitch;
int m_poseWeapon_Yaw;
// Sounds
CSoundPatch *m_pCannonSound;
@ -363,8 +365,7 @@ protected: @@ -363,8 +365,7 @@ protected:
// Should the dropship end up having inheritors, their activate may
// stomp these numbers, in which case you should make these ordinary members
// again.
static int m_poseBody_Accel, m_poseBody_Sway, m_poseCargo_Body_Accel, m_poseCargo_Body_Sway,
m_poseWeapon_Pitch, m_poseWeapon_Yaw;
static int m_poseBody_Accel, m_poseBody_Sway, m_poseCargo_Body_Accel, m_poseCargo_Body_Sway;
static bool m_sbStaticPoseParamsLoaded;
virtual void PopulatePoseParameters( void );
};
@ -375,13 +376,11 @@ int CNPC_CombineDropship::m_poseBody_Accel = 0; @@ -375,13 +376,11 @@ int CNPC_CombineDropship::m_poseBody_Accel = 0;
int CNPC_CombineDropship::m_poseBody_Sway = 0;
int CNPC_CombineDropship::m_poseCargo_Body_Accel = 0;
int CNPC_CombineDropship::m_poseCargo_Body_Sway = 0;
int CNPC_CombineDropship::m_poseWeapon_Pitch = 0;
int CNPC_CombineDropship::m_poseWeapon_Yaw = 0;
//-----------------------------------------------------------------------------
// Purpose: Cache whatever pose parameters we intend to use
//-----------------------------------------------------------------------------
void CNPC_CombineDropship::PopulatePoseParameters( void )
void CNPC_CombineDropship::PopulatePoseParameters( void )
{
if (!m_sbStaticPoseParamsLoaded)
{
@ -389,12 +388,16 @@ void CNPC_CombineDropship::PopulatePoseParameters( void ) @@ -389,12 +388,16 @@ void CNPC_CombineDropship::PopulatePoseParameters( void )
m_poseBody_Sway = LookupPoseParameter( "body_sway" );
m_poseCargo_Body_Accel = LookupPoseParameter( "cargo_body_accel" );
m_poseCargo_Body_Sway = LookupPoseParameter( "cargo_body_sway" );
m_poseWeapon_Pitch = LookupPoseParameter( "weapon_pitch" );
m_poseWeapon_Yaw = LookupPoseParameter( "weapon_yaw" );
m_sbStaticPoseParamsLoaded = true;
}
if( m_hContainer )
{
m_poseWeapon_Pitch = m_hContainer->LookupPoseParameter( "weapon_pitch" );
m_poseWeapon_Yaw = m_hContainer->LookupPoseParameter( "weapon_yaw" );
}
BaseClass::PopulatePoseParameters();
}
@ -861,6 +864,8 @@ void CNPC_CombineDropship::Spawn( void ) @@ -861,6 +864,8 @@ void CNPC_CombineDropship::Spawn( void )
m_iMachineGunRefAttachment = -1;
m_iAttachmentTroopDeploy = -1;
m_iAttachmentDeployStart = -1;
m_poseWeapon_Pitch = -1;
m_poseWeapon_Yaw = -1;
// create the correct bin for the ship to carry
switch ( m_iCrateType )
@ -896,6 +901,9 @@ void CNPC_CombineDropship::Spawn( void ) @@ -896,6 +901,9 @@ void CNPC_CombineDropship::Spawn( void )
m_iMachineGunBaseAttachment = m_hContainer->LookupAttachment( "gun_base" );
// NOTE: gun_ref must have the same position as gun_base, but rotates with the gun
m_iMachineGunRefAttachment = m_hContainer->LookupAttachment( "gun_ref" );
m_poseWeapon_Pitch = m_hContainer->LookupPoseParameter( "weapon_pitch" );
m_poseWeapon_Yaw = m_hContainer->LookupPoseParameter( "weapon_yaw" );
}
break;

2
game/server/hl2/npc_houndeye.cpp

@ -529,7 +529,7 @@ void CNPC_Houndeye::DeathSound ( void ) @@ -529,7 +529,7 @@ void CNPC_Houndeye::DeathSound ( void )
//=========================================================
// PainSound
//=========================================================
void CNPC_Houndeye::PainSound ( void )
void CNPC_Houndeye::PainSound ( const CTakeDamageInfo &info )
{
EmitSound( "NPC_Houndeye.Pain" );
}

62
game/server/hl2/weapon_smg1.cpp

@ -45,7 +45,7 @@ public: @@ -45,7 +45,7 @@ public:
float GetFireRate( void ) { return 0.075f; } // 13.3hz
int CapabilitiesGet( void ) { return bits_CAP_WEAPON_RANGE_ATTACK1; }
int WeaponRangeAttack2Condition( float flDot, float flDist );
int WeaponRangeAttack2Condition(/* float flDot, float flDist */);
Activity GetPrimaryAttackActivity( void );
virtual const Vector& GetBulletSpread( void )
@ -228,32 +228,50 @@ void CWeaponSMG1::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatChar @@ -228,32 +228,50 @@ void CWeaponSMG1::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatChar
}
break;
/*//FIXME: Re-enable
case EVENT_WEAPON_AR2_GRENADE:
case EVENT_WEAPON_AR2_ALTFIRE:
{
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
//vecShootDir = npc->GetShootEnemyDir( vecShootOrigin );
//Checks if it can fire the grenade
WeaponRangeAttack2Condition();
Vector vecThrow = m_vecTossVelocity;
//If on the rare case the vector is 0 0 0, cancel for avoid launching the grenade without speed
//This should be on WeaponRangeAttack2Condition(), but for some unknown reason return CASE_NONE
//doesn't stop the launch
if( vecThrow == Vector(0, 0, 0) )
{
break;
}
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetShootEnemyDir( vecShootOrigin );
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create("grenade_ar2", vecShootOrigin, vec3_angle, npc);
pGrenade->SetAbsVelocity( vecThrow );
pGrenade->SetLocalAngularVelocity(RandomAngle(-400, 400)); //tumble in air
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
Vector vecThrow = m_vecTossVelocity;
pGrenade->SetThrower(GetOwner());
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create( "grenade_ar2", vecShootOrigin, vec3_angle, npc );
pGrenade->SetAbsVelocity( vecThrow );
pGrenade->SetLocalAngularVelocity( QAngle( 0, 400, 0 ) );
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY );
pGrenade->m_hOwner = npc;
pGrenade->m_pMyWeaponAR2 = this;
pGrenade->SetDamage(sk_npc_dmg_ar2_grenade.GetFloat());
pGrenade->SetGravity(0.5); // lower gravity since grenade is aerodynamic and engine doesn't know it.
// FIXME: arrgg ,this is hard coded into the weapon???
m_flNextGrenadeCheck = gpGlobals->curtime + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
pGrenade->SetDamage( sk_plr_dmg_smg1_grenade.GetFloat() );
m_iClip2--;
if( g_pGameRules->IsSkillLevel( SKILL_HARD ) )
{
m_flNextGrenadeCheck = gpGlobals->curtime + RandomFloat(2, 3);
}
else
{
m_flNextGrenadeCheck = gpGlobals->curtime + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
}
m_iClip2--;
}
break;
*/
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
@ -272,7 +290,7 @@ Activity CWeaponSMG1::GetPrimaryAttackActivity( void ) @@ -272,7 +290,7 @@ Activity CWeaponSMG1::GetPrimaryAttackActivity( void )
if ( m_nShotsFired < 3 )
return ACT_VM_RECOIL1;
if ( m_nShotsFired < 4 )
return ACT_VM_RECOIL2;
@ -394,11 +412,11 @@ void CWeaponSMG1::SecondaryAttack( void ) @@ -394,11 +412,11 @@ void CWeaponSMG1::SecondaryAttack( void )
// flDist -
// Output : int
//-----------------------------------------------------------------------------
int CWeaponSMG1::WeaponRangeAttack2Condition( float flDot, float flDist )
int CWeaponSMG1::WeaponRangeAttack2Condition(/* float flDot, float flDist */)
{
CAI_BaseNPC *npcOwner = GetOwner()->MyNPCPointer();
return COND_NONE;
// return COND_NONE;
/*
// --------------------------------------------------------

3
game/shared/gamemovement.cpp

@ -4191,8 +4191,7 @@ void CGameMovement::FinishUnDuckJump( trace_t &trace ) @@ -4191,8 +4191,7 @@ void CGameMovement::FinishUnDuckJump( trace_t &trace )
//-----------------------------------------------------------------------------
void CGameMovement::FinishDuck( void )
{
if ( player->GetFlags() & FL_DUCKING )
return;
// if ( player->GetFlags() & FL_DUCKING ) return;
player->AddFlag( FL_DUCKING );
player->m_Local.m_bDucked = true;

2
game/shared/hl2/hl2_gamerules.cpp

@ -206,7 +206,7 @@ bool CHalfLife2::Damage_IsTimeBased( int iDmgType ) @@ -206,7 +206,7 @@ bool CHalfLife2::Damage_IsTimeBased( int iDmgType )
// Damage types that are time-based.
#ifdef HL2_EPISODIC
// This makes me think EP2 should have its own rules, but they are #ifdef all over in here.
return ( ( iDmgType & ( DMG_PARALYZE | DMG_NERVEGAS | DMG_POISON | DMG_RADIATION | DMG_DROWNRECOVER | DMG_SLOWBURN ) ) != 0 );
return ( ( iDmgType & ( DMG_PARALYZE | DMG_NERVEGAS | DMG_POISON | DMG_RADIATION | DMG_DROWNRECOVER | DMG_ACID | DMG_SLOWBURN ) ) != 0 );
#else
return BaseClass::Damage_IsTimeBased( iDmgType );
#endif

6
game/shared/hl2mp/weapon_357.cpp

@ -140,9 +140,9 @@ void CWeapon357::PrimaryAttack( void ) @@ -140,9 +140,9 @@ void CWeapon357::PrimaryAttack( void )
angles.y += random->RandomInt( -1, 1 );
angles.z = 0;
#ifndef CLIENT_DLL
pPlayer->SnapEyeAngles( angles );
#endif
//#ifndef CLIENT_DLL
// pPlayer->SnapEyeAngles( angles );
//#endif
pPlayer->ViewPunch( QAngle( -8, random->RandomFloat( -2, 2 ), 0 ) );

31
game/shared/hl2mp/weapon_hl2mpbase.cpp

@ -261,14 +261,41 @@ void CWeaponHL2MPBase::FallInit( void ) @@ -261,14 +261,41 @@ void CWeaponHL2MPBase::FallInit( void )
}
SetPickupTouch();
SetThink( &CBaseCombatWeapon::FallThink );
SetThink( &CWeaponHL2MPBase::FallThink );
SetNextThink( gpGlobals->curtime + 0.1f );
#endif
}
#ifdef GAME_DLL
void CWeaponHL2MPBase::FallThink( void )
{
// Prevent the common HL2DM weapon respawn bug from happening
// When a weapon is spawned, the following chain of events occurs:
// - Spawn() is called (duh), which then calls FallInit()
// - FallInit() is called, and prepares the weapon's 'Think' function (CBaseCombatWeapon::FallThink())
// - FallThink() is called, and performs several checks before deciding whether the weapon should Materialize()
// - Materialize() is called (the HL2DM version above), which sets the weapon's respawn location.
// The problem occurs when a weapon isn't placed properly by a level designer.
// If the weapon is unable to move from its location (e.g. if its bounding box is halfway inside a wall), Materialize() never gets called.
// Since Materialize() never gets called, the weapon's respawn location is never set, so if a person picks it up, it respawns forever at
// 0 0 0 on the map (infinite loop of fall, wait, respawn, not nice at all for performance and bandwidth!)
if( HasSpawnFlags( SF_NORESPAWN ) == false )
{
if( GetOriginalSpawnOrigin() == vec3_origin )
{
m_vOriginalSpawnOrigin = GetAbsOrigin();
m_vOriginalSpawnAngles = GetAbsAngles();
}
}
return BaseClass::FallThink();
}
#endif
const CHL2MPSWeaponInfo &CWeaponHL2MPBase::GetHL2MPWpnData() const
{
const FileWeaponInfo_t *pWeaponInfo = &GetWpnData();

5
game/shared/hl2mp/weapon_hl2mpbase.h

@ -40,11 +40,12 @@ public: @@ -40,11 +40,12 @@ public:
#ifdef GAME_DLL
DECLARE_DATADESC();
void SendReloadSoundEvent( void );
void Materialize( void );
virtual int ObjectCaps( void );
virtual int ObjectCaps( void );
virtual void FallThink( void );
#endif
// All predicted weapons need to implement and return true

2
game/shared/hl2mp/weapon_rpg.cpp

@ -1248,7 +1248,7 @@ void CAPCMissile::ComputeActualDotPosition( CLaserDot *pLaserDot, Vector *pActua @@ -1248,7 +1248,7 @@ void CAPCMissile::ComputeActualDotPosition( CLaserDot *pLaserDot, Vector *pActua
#define RPG_BEAM_SPRITE "effects/laser1.vmt"
#define RPG_BEAM_SPRITE_NOZ "effects/laser1_noz.vmt"
#define RPG_LASER_SPRITE "sprites/redglow1"
#define RPG_LASER_SPRITE "sprites/redglow1.vmt"
//=============================================================================
// RPG

2
game/shared/shareddefs.h

@ -232,7 +232,7 @@ enum CastVote @@ -232,7 +232,7 @@ enum CastVote
#define MAX_PLACE_NAME_LENGTH 18
#define MAX_FOV 90
#define MAX_FOV 110
//===================================================================================================================
// Team Defines

6
gameui/OptionsSubVideo.cpp

@ -448,6 +448,12 @@ public: @@ -448,6 +448,12 @@ public:
{
pFOV->SetVisible( false );
}
pFOV = FindChildByName( "FovValueLabel" );
if ( pFOV )
{
pFOV->SetVisible( false );
}
}
MarkDefaultSettingsAsRecommended();

2
public/bone_setup.cpp

@ -5943,6 +5943,8 @@ const char *Studio_GetDefaultSurfaceProps( CStudioHdr *pstudiohdr ) @@ -5943,6 +5943,8 @@ const char *Studio_GetDefaultSurfaceProps( CStudioHdr *pstudiohdr )
float Studio_GetMass( CStudioHdr *pstudiohdr )
{
if( pstudiohdr == NULL ) return 0.f;
return pstudiohdr->mass();
}

Loading…
Cancel
Save