Browse Source

Merge pull request #21 from FreeSlave/crossbow_fix

Remove usage of MOVETYPE_COMPOUND to prevent crash
clcampaign
Alibek Omarov 8 years ago committed by GitHub
parent
commit
b047eefead
  1. 10
      dlls/crossbow.cpp
  2. 4
      dlls/world.cpp

10
dlls/crossbow.cpp

@ -27,6 +27,8 @@
#define BOLT_AIR_VELOCITY 2000 #define BOLT_AIR_VELOCITY 2000
#define BOLT_WATER_VELOCITY 1000 #define BOLT_WATER_VELOCITY 1000
extern BOOL gPhysicsInterfaceInitialized;
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
// //
// OVERLOADS SOME ENTVARS: // OVERLOADS SOME ENTVARS:
@ -167,9 +169,11 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
pev->angles.z = RANDOM_LONG( 0, 360 ); pev->angles.z = RANDOM_LONG( 0, 360 );
pev->nextthink = gpGlobals->time + 10.0; pev->nextthink = gpGlobals->time + 10.0;
// g-cont. Setup movewith feature if (gPhysicsInterfaceInitialized) {
pev->movetype = MOVETYPE_COMPOUND; // set movewith type // g-cont. Setup movewith feature
pev->aiment = ENT( pOther->pev ); // set parent pev->movetype = MOVETYPE_COMPOUND; // set movewith type
pev->aiment = ENT( pOther->pev ); // set parent
}
} }
if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER ) if( UTIL_PointContents( pev->origin ) != CONTENTS_WATER )

4
dlls/world.cpp

@ -822,6 +822,8 @@ static physics_interface_t gPhysicsInterface =
DispatchPhysicsEntity, DispatchPhysicsEntity,
}; };
BOOL gPhysicsInterfaceInitialized = FALSE;
int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEngine, physics_interface_t *pFunctionTable ) int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEngine, physics_interface_t *pFunctionTable )
{ {
if( !pFunctionTable || !pfuncsFromEngine || iVersion != SV_PHYSICS_INTERFACE_VERSION ) if( !pFunctionTable || !pfuncsFromEngine || iVersion != SV_PHYSICS_INTERFACE_VERSION )
@ -834,6 +836,6 @@ int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEn
// fill engine callbacks // fill engine callbacks
memcpy( pFunctionTable, &gPhysicsInterface, sizeof(physics_interface_t) ); memcpy( pFunctionTable, &gPhysicsInterface, sizeof(physics_interface_t) );
gPhysicsInterfaceInitialized = TRUE;
return TRUE; return TRUE;
} }

Loading…
Cancel
Save