Fixed some breakable sounds being played "wrongly"

Cleaned up some of the codebase
Commented some more stuff and brought in some structure
Probably fixed a few things in the process
This commit is contained in:
Marco Cawthorne 2017-01-10 19:24:45 +01:00
parent ce7a2243cc
commit 712b2cebbc
22 changed files with 480 additions and 91 deletions

View file

@ -47,6 +47,18 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
precache_sound( "common/wpn_moveselect.wav" );
precache_sound( "common/wpn_select.wav" );
precache_sound( "debris/bustglass1.wav" );
precache_sound( "debris/bustglass2.wav" );
precache_sound( "debris/bustcrate1.wav" );
precache_sound( "debris/bustcrate2.wav" );
precache_sound( "debris/bustmetal1.wav" );
precache_sound( "debris/bustmetal2.wav" );
precache_sound( "debris/bustflesh1.wav" );
precache_sound( "debris/bustflesh2.wav" );
precache_sound( "debris/bustconcrete1.wav" );
precache_sound( "debris/bustconcrete2.wav" );
precache_sound( "debris/bustceiling1.wav" );
for( int i = 0; i < CS_WEAPON_COUNT; i++ ) {
precache_model( sViewModels[ i ] );
}

View file

@ -32,6 +32,13 @@ ammoinfo_t ammoTable[11] = {
{ 50, 100, 50 } //CALIBER_57MM
};
/*
=================
Ammo_BuyPrimary
Buy ammo for the primary weapon you're equipped with
=================
*/
void Ammo_BuyPrimary( float fFree ) {
if ( !self.fSlotPrimary ) {
return;
@ -51,6 +58,13 @@ void Ammo_BuyPrimary( float fFree ) {
}
}
/*
=================
Ammo_BuySecondary
Buy ammo for the secondary weapon you're equipped with
=================
*/
void Ammo_BuySecondary( float fFree ) {
if ( !self.fSlotSecondary ) {
return;
@ -76,6 +90,13 @@ void Ammo_BuySecondary( float fFree ) {
}
}
/*
=================
CSEv_GamePlayerBuyAmmo_f
Called from the client, checks if he can buy ammo and does if yes
=================
*/
void CSEv_GamePlayerBuyAmmo_f( float fType ) {
if ( Rules_BuyingPossible() == FALSE ) {
return;

View file

@ -118,6 +118,14 @@ enum {
ANIM_CROUCH_DIE
};
/*
=================
Animation_PlayerUpdate
Called every frame to update the animation sequences
depending on what the player is doing
=================
*/
void Animation_PlayerUpdate( void ) {
self.basebone = 40;
@ -150,6 +158,13 @@ void Animation_PlayerUpdate( void ) {
}
}
/*
=================
Animation_PlayerTop
Changes the animation sequence for the upper body part
=================
*/
void Animation_PlayerTop( float fFrame, float fTime ) {
self.baseframe = fFrame;
self.baseframe_time = time + fTime;

View file

@ -18,25 +18,65 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Called when a spectator joins the game. */
/*
=================
SpectatorConnect
Called when a spectator joins the game
=================
*/
void SpectatorConnect( void ) {
Spawn_MakeSpectator();
Spawn_ObserverCam();
}
/*
=================
SpectatorDisconnect
Called when a spectator leaves the game
=================
*/
void SpectatorDisconnect( void ) {
}
/*
=================
SpectatorThink
Run every frame on every spectator
=================
*/
void SpectatorThink( void ) {
}
/*
=================
ClientKill
Suicide command 'kill' executes this function.
=================
*/
void ClientKill( void ) {}
/*
=================
ClientConnect
Run whenever a new client joins
=================
*/
void ClientConnect( void ) {}
/*
=================
ClientDisconnect
Run whenever a client quits
=================
*/
void ClientDisconnect( void ) {
// We were part of the session
if( self.iInGame == TRUE ) {
@ -52,6 +92,13 @@ void ClientDisconnect( void ) {
}
}
/*
=================
PutClientInServer
Puts a client into the world.
=================
*/
void PutClientInServer( void ) {
entity eTarget = world;
@ -66,6 +113,13 @@ void PutClientInServer( void ) {
forceinfokey( self, "*team", "0" );
}
/*
=================
SV_RunClientCommand
Funtion that can interrupt client commands before physics are run
=================
*/
void SV_RunClientCommand( void ) {
// The individual zones will just override this behavior
@ -90,6 +144,13 @@ void SV_RunClientCommand( void ) {
runstandardplayerphysics( self );
}
/*
=================
Client_SendEvent
Send a game event
=================
*/
void Client_SendEvent( entity eClient, float fEVType ) {
Weapon_UpdateCurrents();
@ -100,6 +161,13 @@ void Client_SendEvent( entity eClient, float fEVType ) {
multicast( '0 0 0', MULTICAST_ONE );
}
/*
=================
Client_TriggerCamera
Switches the player camera to a different position for a specific time
=================
*/
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime ) {
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );

View file

@ -18,6 +18,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
=================
Damage_CastOrbituary
Sends a message to the clients to display a death message
=================
*/
void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon, float fHeadShot ) {
WriteByte( MSG_BROADCAST, SVC_CGAMEPACKET );
WriteByte( MSG_BROADCAST, EV_ORBITUARY );
@ -31,6 +38,13 @@ void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon, floa
multicast( '0 0 0', MULTICAST_ALL );
}
/*
=================
Damage_GetHitLocation
Debug function
=================
*/
string Damage_GetHitLocation( int iSurface ) {
switch ( iSurface ) {
case BODY_HEAD:
@ -59,16 +73,15 @@ string Damage_GetHitLocation( int iSurface ) {
}
}
/*
=================
Damage_Apply
Generic function that applies damage, pain and suffering
=================
*/
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos ) {
// Special monetary punishment for hostage murderers
if ( eTarget.classname == "hostage_entity" ) {
if ( eTarget.health > 0 ) {
Money_AddMoney( eAttacker, -150 ); // Pain
} else {
Money_AddMoney( eAttacker, -1500 ); // Death
}
}
// Modify the damage based on the location
if ( trace_surface_id == BODY_HEAD ) {
if ( eTarget.iEquipment & EQUIPMENT_HELMET ) {
@ -85,10 +98,19 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
iDamage *= 0.4;
}
dprint( sprintf( "[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation( trace_surface_id ) ) );
// Apply the damage finally
eTarget.health = eTarget.health - iDamage;
dprint( sprintf( "[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation( trace_surface_id ) ) );
// Special monetary punishment for hostage murderers
if ( eTarget.classname == "hostage_entity" ) {
if ( eTarget.health > 0 ) {
Money_AddMoney( eAttacker, -150 ); // Pain
} else {
Money_AddMoney( eAttacker, -1500 ); // Death
}
}
// Target is dead and a client....
if ( eTarget.health <= 0 ) {
@ -117,6 +139,13 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
self = eOld;
}
/*
=================
Damage_Radius
Even more pain and suffering, mostly used for explosives
=================
*/
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius ) {
entity eDChain = findradius( vOrigin, fRadius );

View file

@ -28,7 +28,13 @@ enum {
HOSTAGE_RUN
};
// To make sure they are following us right
/*
=================
hostage_waypoint
Spawns a new waypoint for the hostage
=================
*/
entity hostage_waypoint( void ) {
entity ePoint = spawn();
setorigin( ePoint, self.eUser.origin );
@ -36,12 +42,24 @@ entity hostage_waypoint( void ) {
return ePoint;
}
// Called whenver a hostage is shot
/*
=================
hostage_pain
Called whenever a hostage is shot
=================
*/
void hostage_pain( int iHitBody ) {
self.frame = 13 - floor( random( 1, 6 ) );
}
// hosdown.wav
/*
=================
hostage_die
hosdown.wav
=================
*/
void hostage_die( int iHitBody ) {
Radio_BroadcastMessage( RADIO_HOSDOWN );
self.frame = 30 + floor( random( 1, 6 ) );
@ -55,7 +73,13 @@ void hostage_die( int iHitBody ) {
}
}
// Happens upon calling 'use'
/*
=================
hostage_use
Whenever a hostage is 'used'
=================
*/
void hostage_use( void ) {
if ( eActivator.team == TEAM_CT ) {
if ( ( self.eUser == world ) ) {
@ -74,7 +98,13 @@ void hostage_use( void ) {
}
}
// Run every frame
/*
=================
hostage_physics
Run every frame
=================
*/
void hostage_physics( void ) {
input_movevalues = '0 0 0';
input_impulse = 0;

View file

@ -244,6 +244,8 @@ void Entities_RotateToDestination_End( void ) {
/*
====================
Entities_RotateToDestination
Rotate to a given destination at a given pace
====================
*/
void Entities_RotateToDestination( vector vDestinationAngle, float fTravelSpeed, void() func ) {

View file

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=================
Footsteps_Update
TODO: Read sound/materials.txt and use that somehow
Run every frame for each player, plays material based footsteps
=================
*/
void Footsteps_Update( void ) {

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/*
=================
func_bomb_target_touch
Only for Ts, will give feedback whenever they are able to plant a bomb
=================
*/
void func_bomb_target_touch( void ) {

View file

@ -32,10 +32,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SF_TOUCH 2
#define SF_PRESSURE 4
// These are the material types apparently
.float material;
// Whenever it gets damaged
/*
=================
func_breakable_pain
=================
*/
void func_breakable_pain( int iNull ) {
string sTypeSample = "";
int iTypeCount = 0;
@ -67,58 +70,35 @@ void func_breakable_pain( int iNull ) {
}
if ( iTypeCount >= 1 ) {
sound( self, CHAN_VOICE, sprintf( "%s%d.wav", sTypeSample, random( 1, (float)iTypeCount + 1 ) ), 1.0, ATTN_NORM );
sound( self, CHAN_VOICE, sprintf( "%s%d.wav", sTypeSample, floor( random( 1, (float)iTypeCount ) + 1 ) ), 1.0, ATTN_NORM );
}
}
// Whenever it.. dies
void func_breakable_die( int iNull ) {
string sTypeSample = "";
int iTypeCount = 0;
switch ( self.material ) {
case MATERIAL_GLASS:
case MATERIAL_GLASS_UNBREAKABLE:
sTypeSample = "debris/bustglass";
iTypeCount = 2;
break;
case MATERIAL_WOOD:
sTypeSample = "debris/bustwood";
iTypeCount = 2;
break;
case MATERIAL_METAL:
case MATERIAL_COMPUTER:
sTypeSample = "debris/bustmetal";
iTypeCount = 2;
break;
case MATERIAL_FLESH:
sTypeSample = "debris/bustflesh";
iTypeCount = 2;
break;
case MATERIAL_CINDER:
case MATERIAL_ROCK:
sTypeSample = "debris/bustconcrete";
iTypeCount = 3;
break;
case MATERIAL_TILE:
sTypeSample = "debris/bustceiling";
iTypeCount = 3;
break;
}
if ( iTypeCount >= 1 ) {
sound( self, CHAN_VOICE, sprintf( "%s%d.wav", sTypeSample, random( 1, (float)iTypeCount + 1 ) ), 1.0, ATTN_NORM );
}
/*
=================
func_breakable_die
=================
*/
void func_breakable_die( int iNull ) {
Effect_BreakModel( self.absmin, self.absmax, self.velocity, self.material );
Entities_UseTargets();
Entities_Remove();
}
/*
=================
func_breakable_use
=================
*/
void func_breakable_use( void ) {
func_breakable_die( 0 );
}
/*
=================
func_breakable_touch
=================
*/
void func_breakable_touch( void ) {
static void func_breakable_touch_NULL( void ) { }
@ -150,6 +130,13 @@ void func_breakable_touch( void ) {
}
}
/*
=================
func_breakable_respawn
Respawns the breakable entity
=================
*/
void func_breakable_respawn( void ) {
if ( self.spawnflags & SF_TRIGGER ) {
self.takedamage = DAMAGE_NO;

View file

@ -56,13 +56,15 @@ void func_pushable( void ) {
runstandardplayerphysics( self );
}
static void func_pushable_respawn( void ) {
func_breakable_respawn();
self.takedamage = DAMAGE_YES;
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_WALK;
self.customphysics = func_pushable_physics;
self.touch = func_pushable_touch;
self.vUse = func_pushable_use;
self.vPain = func_breakable_pain;
self.vDeath = func_breakable_die;
self.iBleeds = FALSE;
self.iUsable = TRUE;
}

View file

@ -18,6 +18,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
=================
Input_Handle
Handles impulse and whatnot
=================
*/
void Input_Handle( void ) {
// TODO: Make this fast switch only
if ( self.impulse == 3 ) {

View file

@ -26,7 +26,13 @@ void SV_PausedTic( float fDuration ) {
}
// Run every frame... by world?
/*
=================
StartFrame
Runs every frame... by worldspawn?
=================
*/
void StartFrame( void ) {
// We've got hostages, but no rescue zones, create some
if ( !iRescueZones && iHostagesMax > 0 ) {
@ -57,7 +63,13 @@ void StartFrame( void ) {
}
}
// The map... entity.
/*
=================
worldspawn
It's the map entity, literally
=================
*/
void worldspawn( void ) {
// Let's load materials.txt because someone thought this was the best idea
string sTemp;
@ -288,20 +300,6 @@ void worldspawn( void ) {
precache_sound( "debris/concrete1.wav" );
precache_sound( "debris/concrete2.wav" );
precache_sound( "debris/concrete3.wav" );
precache_sound( "debris/bustglass1.wav" );
precache_sound( "debris/bustglass2.wav" );
precache_sound( "debris/bustwood1.wav" );
precache_sound( "debris/bustwood2.wav" );
precache_sound( "debris/bustmetal1.wav" );
precache_sound( "debris/bustmetal2.wav" );
precache_sound( "debris/bustflesh1.wav" );
precache_sound( "debris/bustflesh2.wav" );
precache_sound( "debris/bustconcrete1.wav" );
precache_sound( "debris/bustconcrete2.wav" );
precache_sound( "debris/bustconcrete3.wav" );
precache_sound( "debris/bustceiling1.wav" );
precache_sound( "debris/bustceiling2.wav" );
precache_sound( "debris/bustceiling3.wav" );
precache_sound( "player/pl_metal1.wav" );
precache_sound( "player/pl_metal2.wav" );

View file

@ -23,6 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int iMoneyReward_CT;
int iMoneyReward_T;
/*
=================
Money_AddMoney
Gives a player money and caps it
=================
*/
void Money_AddMoney( entity ePlayer, int iMoneyValue ) {
dprint( sprintf( "[DEBUG]: Giving %s %i in cash\n", ePlayer.netname, iMoneyValue ) );
@ -38,6 +45,13 @@ void Money_AddMoney( entity ePlayer, int iMoneyValue ) {
}
}
/*
=================
Money_QueTeamReward
Rewards are adding up throughout the match...
=================
*/
void Money_QueTeamReward( float fTeam, int iMoneyValue ) {
if ( fTeam == TEAM_T ) {
iMoneyReward_T += iMoneyValue;
@ -46,6 +60,13 @@ void Money_QueTeamReward( float fTeam, int iMoneyValue ) {
}
}
/*
=================
Money_GiveTeamReward
...and eventually given when this is called
=================
*/
void Money_GiveTeamReward( void ) {
if ( self.team == TEAM_T ) {
Money_AddMoney( self, iMoneyReward_T );
@ -54,6 +75,11 @@ void Money_GiveTeamReward( void ) {
}
}
/*
=================
Money_ResetTeamReward
=================
*/
void Money_ResetTeamReward( void ) {
iMoneyReward_T = 0;
iMoneyReward_CT = 0;

View file

@ -46,6 +46,11 @@ string sPainSounds[5] = {
"player/pl_pain7.wav"
};
/*
=================
Player_Pain
=================
*/
void Player_Pain( int iHitBody ) {
if ( iHitBody == BODY_HEAD ) {
Animation_PlayerTop( ANIM_HEAD_FLINCH, 0.1f );
@ -57,6 +62,11 @@ void Player_Pain( int iHitBody ) {
self.velocity = '0 0 0';
}
/*
=================
Player_Death
=================
*/
void Player_Death( int iHitBody ) {
if ( iHitBody == BODY_HEAD ) {
sound( self, CHAN_VOICE, sprintf( "player/headshot%d.wav", floor( ( random() * 3 ) + 1 ) ), 1, ATTN_NORM );
@ -126,6 +136,11 @@ void Player_Death( int iHitBody ) {
}
}
/*
=================
Player_GetMaxSpeed
=================
*/
float Player_GetMaxSpeed( float fWeapon ) {
if ( self.flags & FL_CROUCHING ) {
return ( cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM ) * 0.5;
@ -248,6 +263,13 @@ void Player_UseUp( void ) {
}
}
/*
=================
PlayerPreThink
Run before physics
=================
*/
void PlayerPreThink( void ) {
Input_Handle();
OpenCSGunBase_ShotMultiplierUpdate();
@ -257,6 +279,13 @@ void PlayerPreThink( void ) {
}
}
/*
=================
PlayerPreThink
Run after physics
=================
*/
void PlayerPostThink( void ) {
Animation_PlayerUpdate();

View file

@ -25,7 +25,13 @@ enum {
BUY_NEITHER
};
// Checks if it is possible for players to buy anything
/*
=================
Rules_BuyingPossible
Checks if it is possible for players to buy anything
=================
*/
float Rules_BuyingPossible( void ) {
if ( self.health <= 0 ) {
return FALSE;
@ -66,7 +72,13 @@ float Rules_BuyingPossible( void ) {
return TRUE;
}
// Loop through all players and respawn them
/*
=================
Rules_Restart
Loop through all ents and handle them
=================
*/
void Rules_Restart( void ) {
iHostagesRescued = 0;
@ -140,7 +152,13 @@ void Rules_Restart( void ) {
Money_ResetTeamReward();
}
// This can happen whenever an objective is complete or time is up
/*
=================
Rules_RoundOver
This happens whenever an objective is complete or time is up
=================
*/
void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
if ( fGameState != GAME_ACTIVE ) {
@ -166,7 +184,13 @@ void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
Timer_Begin( 5, GAME_END); // Round is over, 5 seconds til a new round starts
}
// Whenever mp_roundtime was being counted down to 0
/*
=================
Rules_TimeOver
Whenever mp_roundtime was being counted down to 0
=================
*/
void Rules_TimeOver( void ) {
if ( iVIPZones > 0 ) {
Rules_RoundOver( TEAM_T, 3250, FALSE );

View file

@ -20,6 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
entity eLastTSpawn;
entity eLastCTSpawn;
/*
=================
Spawn_FindSpawnPoint
Recursive function that gets the next spawnpoint
=================
*/
entity Spawn_FindSpawnPoint( float fTeam ) {
entity eSpot, eLastSpawn;
entity eThing;
@ -36,7 +44,7 @@ entity Spawn_FindSpawnPoint( float fTeam ) {
return find( world, classname, "info_vip_start" );
}
while (1) {
while ( 1 ) {
eSpot = find(eSpot, classname, sClassname);
if (eSpot != world) {
@ -59,6 +67,13 @@ entity Spawn_FindSpawnPoint( float fTeam ) {
return eSpot;
}
/*
=================
Spawn_ObserverCam
Look for the next spawnpoint
=================
*/
void Spawn_ObserverCam( void ) {
// Go find a camera if we aren't dead
entity eCamera = find ( world, classname, "trigger_camera" );
@ -73,11 +88,21 @@ void Spawn_ObserverCam( void ) {
self.angles_x *= -1;
}
}
} else {
// Can't find a camera? Just do this lazy thing, CS seems to do the same
eCamera = find ( world, classname, "info_player_start" );
}
self.fixangle = TRUE;
}
/*
=================
Spawn_RespawnClient
Called whenever a player just needs his basic properties to be reset
=================
*/
void Spawn_RespawnClient( float fTeam ) {
entity eSpawn;
forceinfokey( self, "*spectator", "0" ); // Make sure we are known as a spectator
@ -114,6 +139,13 @@ void Spawn_RespawnClient( float fTeam ) {
self.fBombProgress = 0;
}
/*
=================
Spawn_CreateClient
Called whenever a player becomes a completely new type of player
=================
*/
void Spawn_CreateClient( float fCharModel ) {
// What team are we on - 0= Spectator, < 5 Terrorists, CT rest
if( fCharModel == 0 ) {
@ -148,7 +180,13 @@ void Spawn_CreateClient( float fCharModel ) {
self.fAttackFinished = time + 1;
}
// This is called on connect and whenever a player dies
/*
=================
Spawn_MakeSpectator
Called on connect and whenever a player dies
=================
*/
void Spawn_MakeSpectator( void ) {
self.classname = "spectator";
@ -175,7 +213,13 @@ void Spawn_MakeSpectator( void ) {
self.fSlotMelee = self.fSlotPrimary = self.fSlotSecondary = self.fSlotGrenade = 0;
}
// Event Handling, called by the Client codebase via 'sendevent'
/*
=================
CSEv_GamePlayerSpawn_f
Event Handling, called by the Client codebase via 'sendevent'
=================
*/
void CSEv_GamePlayerSpawn_f( float fChar ) {
if ( self.team == TEAM_VIP ) {
@ -228,18 +272,41 @@ void CSEv_GamePlayerSpawn_f( float fChar ) {
forceinfokey( self, "*deaths", "0" );
}
// Counter-Terrorist Spawnpoints
/*
=================
info_player_start
Counter-Terrorist Spawnpoints
=================
*/
void info_player_start( void ) {
}
// Terrorist Spawnpoints
/*
=================
info_player_deathmatch
Terrorist Spawnpoints
=================
*/
void info_player_deathmatch( void ) {
}
// VIP Spawnpoints
void info_vip_start( void ) {
}
/*
=================
info_target
Cameras use this thing
=================
*/
void info_target( void ) {
setorigin( self, self.origin );
}
/*
=================
info_vip_start
=================
*/
void info_vip_start( void ) {
}

View file

@ -18,6 +18,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
=================
Timer_Begin
Initiates a new state timer
=================
*/
void Timer_Begin( float fTime, float fMode) {
if ( fMode == GAME_FREEZE ) {
fGameState = GAME_FREEZE;
@ -32,6 +39,13 @@ void Timer_Begin( float fTime, float fMode) {
fGameTime = fTime;
}
/*
=================
Timer_Update
Called once every frame to check the status of things
=================
*/
void Timer_Update( void ) {
if ( fGameState == GAME_INACTIVE ) {
return;

View file

@ -20,6 +20,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int iTotalPenetrations;
/*
=================
TraceAttack_FireSingle
Fires a single shot that can penetrate some materials
=================
*/
void TraceAttack_FireSingle( vector vPos, vector vAngle ) {
static void TraceAttack_Penetrate( vector vPos, vector vAngle ) {
if ( iTotalPenetrations > 0 ) {
@ -71,6 +78,14 @@ void TraceAttack_FireSingle( vector vPos, vector vAngle ) {
}
}
}
/*
=================
TraceAttack_FireBullets
Fire a given amount of shots
=================
*/
void TraceAttack_FireBullets( int iShots, vector vPos ) {
vector vDir;
makevectors(self.v_angle);

View file

@ -168,6 +168,47 @@ void Effect_BreakModel( vector vMins, vector vMaxs, vector vVel, float fStyle )
break;
}
string sTypeSample = "";
int iTypeCount;
switch ( fStyle ) {
case MATERIAL_GLASS:
case MATERIAL_GLASS_UNBREAKABLE:
sTypeSample = "debris/bustglass";
iTypeCount = 2;
break;
case MATERIAL_WOOD:
sTypeSample = "debris/bustcrate";
iTypeCount = 2;
break;
case MATERIAL_METAL:
case MATERIAL_COMPUTER:
sTypeSample = "debris/bustmetal";
iTypeCount = 2;
break;
case MATERIAL_FLESH:
sTypeSample = "debris/bustflesh";
iTypeCount = 2;
break;
case MATERIAL_CINDER:
case MATERIAL_ROCK:
sTypeSample = "debris/bustconcrete";
iTypeCount = 2;
break;
case MATERIAL_TILE:
sTypeSample = "debris/bustceiling";
iTypeCount = 1;
break;
}
if ( iTypeCount > 0 ) {
vector vWorldPos;
vWorldPos_x = vMins_x + ( 0.5 * ( vMaxs_x - vMins_x ) );
vWorldPos_y = vMins_y + ( 0.5 * ( vMaxs_y - vMins_y ) );
vWorldPos_z = vMins_z + ( 0.5 * ( vMaxs_z - vMins_z ) );
pointsound( vWorldPos, sprintf( "%s%d.wav", sTypeSample, floor( random( 1, (float)iTypeCount ) + 1 ) ), 1.0f, ATTN_NORM );
}
while ( fCount > 0 ) {
entity eGib = spawn();

Binary file not shown.

Binary file not shown.