mirror of https://github.com/FWGS/hlsdk-xash3d
Merge original "Half-Screwed Death and Rebirth" source code.
This commit is contained in:
parent
8163bced2c
commit
303703384d
|
@ -190,6 +190,18 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
}
|
||||
else
|
||||
pWeapon->hAmmo2 = 0;
|
||||
|
||||
p = GetSpriteList( pList, "duckhunt", iRes, i );
|
||||
if( p )
|
||||
{
|
||||
sprintf( sz, "sprites/%s.spr", p->szSprite );
|
||||
pWeapon->hDuckHunt = SPR_Load( sz );
|
||||
pWeapon->rcDuckHunt = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hDuckHunt = 0;
|
||||
}
|
||||
|
||||
// Returns the first weapon for a given slot.
|
||||
|
@ -317,6 +329,8 @@ int CHudAmmo::VidInit( void )
|
|||
giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left;
|
||||
giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top;
|
||||
|
||||
m_HUD_duckhunt2 = gHUD.GetSpriteIndex( "duckhunt2" );
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
|
||||
// If we've already loaded weapons, let's get new sprites
|
||||
|
@ -929,6 +943,27 @@ int CHudAmmo::Draw( float flTime )
|
|||
SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2 );
|
||||
}
|
||||
}
|
||||
|
||||
//Does this weapon need the duckhunt UI?
|
||||
if( pw->hDuckHunt != 0 )
|
||||
{
|
||||
int dhx = ScreenWidth - 80;//the name looks like dicks, doesn't it?
|
||||
int dhy = ScreenHeight - 60; //Why not?
|
||||
int i;
|
||||
|
||||
//Draw the BG first
|
||||
SPR_Set( m_pWeapon->hDuckHunt, 255, 255, 255 );
|
||||
SPR_DrawHoles( 0, dhx, dhy, &m_pWeapon->rcDuckHunt );
|
||||
|
||||
ammo = pw->iClip;
|
||||
if( ammo > 3 )
|
||||
ammo = 3;
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_duckhunt2 ), 255, 255, 255 );
|
||||
for( i = 0; i < ammo; i++ )
|
||||
{
|
||||
SPR_Draw( 0, dhx + 10 + ( i * 15 ), dhy + 5, &gHUD.GetSpriteRect( m_HUD_duckhunt2 ) );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ struct WEAPON
|
|||
wrect_t rcZoomedCrosshair;
|
||||
HSPRITE hZoomedAutoaim;
|
||||
wrect_t rcZoomedAutoaim;
|
||||
HSPRITE hDuckHunt;
|
||||
wrect_t rcDuckHunt;
|
||||
HSPRITE hDuckHunt2;
|
||||
wrect_t rcDuckHunt2;
|
||||
};
|
||||
|
||||
typedef int AMMO;
|
||||
|
|
|
@ -45,6 +45,13 @@ int CHudBattery::VidInit( void )
|
|||
int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" );
|
||||
int HUD_suit_full = gHUD.GetSpriteIndex( "suit_full" );
|
||||
|
||||
m_HUD_mgs3suitbar = gHUD.GetSpriteIndex( "mgs3suitbar" );
|
||||
m_HUD_mgs3suitdiv = gHUD.GetSpriteIndex( "mgs3suitdiv" );
|
||||
|
||||
m_prc3 = &gHUD.GetSpriteRect( m_HUD_mgs3suitbar ); //Full
|
||||
|
||||
m_iWidth = m_prc3->right - m_prc3->left; //32 - 160 = -128
|
||||
|
||||
m_hSprite1 = m_hSprite2 = 0; // delaying get sprite handles until we know the sprites are loaded
|
||||
m_prc1 = &gHUD.GetSpriteRect( HUD_suit_empty );
|
||||
m_prc2 = &gHUD.GetSpriteRect( HUD_suit_full );
|
||||
|
@ -64,6 +71,7 @@ int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
|
|||
{
|
||||
m_fFade = FADE_TIME;
|
||||
m_iBat = x;
|
||||
m_flBat = ( (float) x ) / 100.0; // 100.0 divided by 100.0 = 1
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -74,60 +82,34 @@ int CHudBattery::Draw( float flTime )
|
|||
if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
|
||||
return 1;
|
||||
|
||||
int r, g, b, x, y, a;
|
||||
wrect_t rc;
|
||||
|
||||
rc = *m_prc2;
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
return 1;
|
||||
|
||||
// Has health changed? Flash the health #
|
||||
if( m_fFade )
|
||||
{
|
||||
if( m_fFade > FADE_TIME )
|
||||
m_fFade = FADE_TIME;
|
||||
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = 128;
|
||||
m_fFade = 0;
|
||||
}
|
||||
|
||||
// Fade the health number back to dim
|
||||
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
|
||||
}
|
||||
else
|
||||
a = MIN_ALPHA;
|
||||
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
int iOffset = ( m_prc1->bottom - m_prc1->top ) / 6;
|
||||
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
x = ScreenWidth / 5;
|
||||
int MGSX = ( gHUD.GetSpriteRect( m_HUD_mgs3suitbar ).right - gHUD.GetSpriteRect( m_HUD_mgs3suitbar ).left ) / 10; //Needs 20. It's 104
|
||||
int MGSY = ScreenHeight - 45;
|
||||
int iOffset2 = m_iWidth * ( 1.0 - m_flBat ); //32 * ( 1 - 1 ) = 0
|
||||
|
||||
// make sure we have the right sprite handles
|
||||
if( !m_hSprite1 )
|
||||
m_hSprite1 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_empty" ) );
|
||||
if( !m_hSprite2 )
|
||||
m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) );
|
||||
|
||||
SPR_Set( m_hSprite1, r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1 );
|
||||
|
||||
if( rc.bottom > rc.top )
|
||||
if( iOffset2 < m_iWidth )
|
||||
{
|
||||
SPR_Set( m_hSprite2, r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y - iOffset + ( rc.top - m_prc2->top ), &rc );
|
||||
rc = *m_prc3;
|
||||
rc.left += iOffset2;
|
||||
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_mgs3suitbar ), 255, 255, 255 );
|
||||
SPR_Draw( 0, MGSX + 5, MGSY + 28, &rc );
|
||||
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_mgs3suitdiv ), 255, 255, 255 );
|
||||
SPR_DrawHoles( 0, MGSX + 5, MGSY + 28, &gHUD.GetSpriteRect( m_HUD_mgs3suitdiv ) );
|
||||
}
|
||||
|
||||
x += ( m_prc1->right - m_prc1->left );
|
||||
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
|
||||
//x += ( m_prc1->right - m_prc1->left );
|
||||
//x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "netadr.h"
|
||||
#include "mp3.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -31,6 +32,7 @@ extern "C"
|
|||
|
||||
cl_enginefunc_t gEngfuncs;
|
||||
CHud gHUD;
|
||||
CMP3 gMP3;
|
||||
mobile_engfuncs_t *gMobileEngfuncs = NULL;
|
||||
void InitInput( void );
|
||||
void EV_HookEvents( void );
|
||||
|
|
|
@ -167,11 +167,20 @@ extern vec3_t vec3_origin;
|
|||
// disable 'truncation from 'const double' to 'float' warning message
|
||||
#pragma warning( disable: 4305 )
|
||||
|
||||
inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\
|
||||
{\
|
||||
r = ( ulRGB & 0xFF0000 ) >> 16;\
|
||||
g = ( ulRGB & 0xFF00 ) >> 8;\
|
||||
b = ulRGB & 0xFF;\
|
||||
inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )
|
||||
{
|
||||
if( ulRGB == RGB_YELLOWISH )
|
||||
{
|
||||
r = CVAR_GET_FLOAT( "hud_red" );
|
||||
g = CVAR_GET_FLOAT( "hud_green" );
|
||||
b = CVAR_GET_FLOAT( "hud_blue" );
|
||||
}
|
||||
else
|
||||
{
|
||||
r = ( ulRGB & 0xFF0000 ) >> 16;
|
||||
g = ( ulRGB & 0xFF00 ) >> 8;
|
||||
b = ulRGB & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
HSPRITE LoadSprite( const char *pszName );
|
||||
|
|
|
@ -186,8 +186,12 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
// gViewPort->GetAllPlayersInfo();
|
||||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||
|
||||
char *killer_name = NULL;
|
||||
|
||||
// Get the Killer's name
|
||||
char *killer_name = g_PlayerInfoList[killer].name;
|
||||
if( (char)killer != -1 )
|
||||
killer_name = g_PlayerInfoList[killer].name;
|
||||
//Borrowing from victim == -1 below. If the killer is -1, it's an NPC.
|
||||
if( !killer_name )
|
||||
{
|
||||
killer_name = "";
|
||||
|
@ -200,6 +204,15 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH - 1] = 0;
|
||||
}
|
||||
|
||||
// Is it a non-player object kill?
|
||||
if( ( (char)killer ) == -1 )
|
||||
{
|
||||
//rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||
|
||||
// Store the object's name in the Victim slot (skip the d_ bit)
|
||||
strcpy( rgDeathNoticeList[i].szKiller, killedwith + 2 );
|
||||
}
|
||||
|
||||
// Get the Victim's name
|
||||
char *victim_name = NULL;
|
||||
// If victim is -1, the killer killed a specific, non-player object (like a sentrygun)
|
||||
|
@ -220,7 +233,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
// Is it a non-player object kill?
|
||||
if ( ( (char)victim ) == -1 )
|
||||
{
|
||||
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||
//rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||
|
||||
// Store the object's name in the Victim slot (skip the d_ bit)
|
||||
strcpy( rgDeathNoticeList[i].szVictim, killedwith + 2 );
|
||||
|
@ -258,34 +271,37 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
|
||||
if( !strcmp( killedwith, "d_world" ) )
|
||||
{
|
||||
ConsolePrint( " died" );
|
||||
ConsolePrint( " was killed by Za World" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsolePrint( " killed self" );
|
||||
ConsolePrint( " said 'Fuck it' and done himself in" );
|
||||
}
|
||||
}
|
||||
else if( rgDeathNoticeList[i].iTeamKill )
|
||||
{
|
||||
ConsolePrint( rgDeathNoticeList[i].szKiller );
|
||||
ConsolePrint( " killed his teammate " );
|
||||
ConsolePrint( " fucking took out his mate " );
|
||||
ConsolePrint( rgDeathNoticeList[i].szVictim );
|
||||
}
|
||||
else if( (char)victim == -1 ) //Don't display kills done by the player on NPCs. Show only deaths on the player caused by NPCs.
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
ConsolePrint( rgDeathNoticeList[i].szKiller );
|
||||
ConsolePrint( " killed " );
|
||||
ConsolePrint( "One man. " );
|
||||
ConsolePrint( rgDeathNoticeList[i].szVictim );
|
||||
ConsolePrint( " FUCKING DESTROYED " );
|
||||
ConsolePrint( rgDeathNoticeList[i].szKiller );
|
||||
}
|
||||
|
||||
if( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
|
||||
{
|
||||
ConsolePrint( " with " );
|
||||
ConsolePrint( " he was shot with a " );
|
||||
|
||||
// replace the code names with the 'real' names
|
||||
if( !strcmp( killedwith + 2, "egon" ) )
|
||||
strcpy( killedwith, "d_gluon gun" );
|
||||
if ( !strcmp( killedwith + 2, "gauss" ) )
|
||||
if ( !strcmp( killedwith + 2, "psycho hands" ) )
|
||||
strcpy( killedwith, "d_tau cannon" );
|
||||
|
||||
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "pmtrace.h"
|
||||
#include "pm_shared.h"
|
||||
|
||||
void Game_AddObjects( void );
|
||||
//void Game_AddObjects( void );
|
||||
|
||||
extern vec3_t v_origin;
|
||||
|
||||
|
@ -527,7 +527,7 @@ void DLLEXPORT HUD_CreateEntities( void )
|
|||
Beams();
|
||||
#endif
|
||||
// Add in any game specific objects
|
||||
Game_AddObjects();
|
||||
//Game_AddObjects();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
1398
cl_dll/ev_hldm.cpp
1398
cl_dll/ev_hldm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -18,6 +18,9 @@ typedef enum
|
|||
BULLET_PLAYER_BUCKSHOT, // shotgun
|
||||
BULLET_PLAYER_CROWBAR, // crowbar swipe
|
||||
|
||||
BULLET_PLAYER_GOLDENGUN,
|
||||
BULLET_PLAYER_JACKAL,
|
||||
BULLET_PLAYER_ZAPPER,
|
||||
BULLET_MONSTER_9MM,
|
||||
BULLET_MONSTER_MP5,
|
||||
BULLET_MONSTER_12MM
|
||||
|
@ -63,32 +66,41 @@ enum mp5_e
|
|||
MP5_FIRE3
|
||||
};
|
||||
|
||||
enum python_e
|
||||
enum ak47_e
|
||||
{
|
||||
PYTHON_IDLE1 = 0,
|
||||
PYTHON_FIDGET,
|
||||
PYTHON_FIRE1,
|
||||
PYTHON_RELOAD,
|
||||
PYTHON_HOLSTER,
|
||||
PYTHON_DRAW,
|
||||
PYTHON_IDLE2,
|
||||
PYTHON_IDLE3
|
||||
AK47_IDLE1 = 0,
|
||||
AK47_RELOAD,
|
||||
AK47_DRAW,
|
||||
AK47_SHOOT1,
|
||||
AK47_SHOOT2,
|
||||
AK47_SHOOT3
|
||||
};
|
||||
|
||||
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
|
||||
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
|
||||
|
||||
enum gauss_e
|
||||
enum GOLDENGUN_e
|
||||
{
|
||||
GAUSS_IDLE = 0,
|
||||
GAUSS_IDLE2,
|
||||
GAUSS_FIDGET,
|
||||
GAUSS_SPINUP,
|
||||
GAUSS_SPIN,
|
||||
GAUSS_FIRE,
|
||||
GAUSS_FIRE2,
|
||||
GAUSS_HOLSTER,
|
||||
GAUSS_DRAW
|
||||
GOLDENGUN_LONGIDLE = 0,
|
||||
GOLDENGUN_IDLE1,
|
||||
GOLDENGUN_IDLE2,
|
||||
GOLDENGUN_FIRE1,
|
||||
GOLDENGUN_FIRE2,
|
||||
GOLDENGUN_RELOAD,
|
||||
GOLDENGUN_RELOAD2,
|
||||
GOLDENGUN_DEPLOY,
|
||||
GOLDENGUN_LAUNCH
|
||||
};
|
||||
|
||||
enum ZAPPER_e
|
||||
{
|
||||
ZAPPER_IDLE1 = 0,
|
||||
ZAPPER_IDLE2,
|
||||
ZAPPER_IDLE3,
|
||||
ZAPPER_SHOOT,
|
||||
ZAPPER_SHOOT_EMPTY,
|
||||
ZAPPER_RELOAD,
|
||||
ZAPPER_RELOAD_NOT_EMPTY,
|
||||
ZAPPER_DRAW,
|
||||
ZAPPER_HOLSTER,
|
||||
ZAPPER_ADD_SILENCER
|
||||
};
|
||||
|
||||
void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName );
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
DECLARE_MESSAGE( m_Health, Health )
|
||||
DECLARE_MESSAGE( m_Health, Damage )
|
||||
DECLARE_MESSAGE( m_Health, Items )
|
||||
|
||||
#define PAIN_NAME "sprites/%d_pain.spr"
|
||||
#define DAMAGE_NAME "sprites/%d_dmg.spr"
|
||||
|
@ -47,7 +48,7 @@ int giDmgFlags[NUM_DMG_TYPES] =
|
|||
DMG_NERVEGAS,
|
||||
DMG_RADIATION,
|
||||
DMG_SHOCK,
|
||||
DMG_CALTROP,
|
||||
DMG_BILLNYE,
|
||||
DMG_TRANQ,
|
||||
DMG_CONCUSS,
|
||||
DMG_HALLUC
|
||||
|
@ -57,13 +58,15 @@ int CHudHealth::Init( void )
|
|||
{
|
||||
HOOK_MESSAGE( Health );
|
||||
HOOK_MESSAGE( Damage );
|
||||
m_iHealth = 100;
|
||||
HOOK_MESSAGE(Items);
|
||||
m_iHealth = 101;
|
||||
m_fFade = 0;
|
||||
m_iFlags = 0;
|
||||
m_bitsDamage = 0;
|
||||
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
|
||||
giDmgHeight = 0;
|
||||
giDmgWidth = 0;
|
||||
item_mstar = 0;
|
||||
|
||||
memset( m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES );
|
||||
|
||||
|
@ -76,6 +79,8 @@ void CHudHealth::Reset( void )
|
|||
// make sure the pain compass is cleared when the player respawns
|
||||
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
|
||||
|
||||
item_mstar = 0;
|
||||
|
||||
// force all the flashing damage icons to expire
|
||||
m_bitsDamage = 0;
|
||||
for( int i = 0; i < NUM_DMG_TYPES; i++ )
|
||||
|
@ -89,7 +94,14 @@ int CHudHealth::VidInit( void )
|
|||
m_hSprite = 0;
|
||||
|
||||
m_HUD_dmg_bio = gHUD.GetSpriteIndex( "dmg_bio" ) + 1;
|
||||
m_HUD_cross = gHUD.GetSpriteIndex( "cross" );
|
||||
m_HUD_mgs3life = gHUD.GetSpriteIndex( "mgs3life" );
|
||||
m_HUD_mgs3name = gHUD.GetSpriteIndex( "mgs3name" );
|
||||
|
||||
m_HUD_mstar = gHUD.GetSpriteIndex( "mstar" );
|
||||
|
||||
m_prc2 = &gHUD.GetSpriteRect( m_HUD_mgs3life ); // Full
|
||||
|
||||
m_iWidth = m_prc2->right - m_prc2->left; // 32 - 160 = -128
|
||||
|
||||
giDmgHeight = gHUD.GetSpriteRect( m_HUD_dmg_bio ).right - gHUD.GetSpriteRect( m_HUD_dmg_bio ).left;
|
||||
giDmgWidth = gHUD.GetSpriteRect( m_HUD_dmg_bio ).bottom - gHUD.GetSpriteRect( m_HUD_dmg_bio ).top;
|
||||
|
@ -97,6 +109,25 @@ int CHudHealth::VidInit( void )
|
|||
return 1;
|
||||
}
|
||||
|
||||
int CHudHealth::MsgFunc_Items( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
int x = READ_LONG();
|
||||
|
||||
if( x == 0 )
|
||||
{
|
||||
item_mstar = 0;
|
||||
}
|
||||
|
||||
if( x == 1 )
|
||||
{
|
||||
item_mstar = 1;
|
||||
}
|
||||
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudHealth::MsgFunc_Health( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
// TODO: update local health data
|
||||
|
@ -110,6 +141,7 @@ int CHudHealth::MsgFunc_Health( const char *pszName, int iSize, void *pbuf )
|
|||
{
|
||||
m_fFade = FADE_TIME;
|
||||
m_iHealth = x;
|
||||
m_flHealth = ( (float)x ) / 100.0; // 100.0 divided by 100.0 = 1
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -165,7 +197,7 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
|
|||
#else
|
||||
if( m_iHealth > 25 )
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
UnpackRGB( r, g, b, RGB_GREENISH );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -188,50 +220,37 @@ int CHudHealth::Draw( float flTime )
|
|||
if( !m_hSprite )
|
||||
m_hSprite = LoadSprite( PAIN_NAME );
|
||||
|
||||
// Has health changed? Flash the health #
|
||||
if( m_fFade )
|
||||
{
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = MIN_ALPHA;
|
||||
m_fFade = 0;
|
||||
}
|
||||
|
||||
// Fade the health number back to dim
|
||||
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
|
||||
}
|
||||
else
|
||||
a = MIN_ALPHA;
|
||||
|
||||
// If health is getting low, make it bright red
|
||||
if( m_iHealth <= 15 )
|
||||
a = 255;
|
||||
|
||||
GetPainColor( r, g, b );
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
// Only draw health if we have the suit.
|
||||
if( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) )
|
||||
{
|
||||
HealthWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
int CrossWidth = gHUD.GetSpriteRect( m_HUD_cross ).right - gHUD.GetSpriteRect( m_HUD_cross ).left;
|
||||
int MGSX = ( gHUD.GetSpriteRect( m_HUD_mgs3life ).right - gHUD.GetSpriteRect( m_HUD_mgs3life ).left ) / 5; // Needs 20. It's 104
|
||||
int MGSY = ScreenHeight - ( ( gHUD.GetSpriteRect( m_HUD_mgs3name ).bottom - gHUD.GetSpriteRect( m_HUD_mgs3name ).top ) * 2.5 ); // needs ScreenHeight-40. It's
|
||||
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
x = CrossWidth / 2;
|
||||
//Kojima would be proud
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_mgs3name ), 255, 255, 255 );
|
||||
SPR_DrawHoles( 0, MGSX, MGSY, &gHUD.GetSpriteRect( m_HUD_mgs3name ) ); // Draw the name
|
||||
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_cross ), r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_cross ) );
|
||||
int iOffset = m_iWidth * ( 1.0 - m_flHealth ); // 32 * ( 1 - 1 ) = 0
|
||||
if( iOffset < m_iWidth )
|
||||
{
|
||||
rc = *m_prc2;
|
||||
rc.left += iOffset;
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_mgs3life ), 255, 255, 255 );
|
||||
SPR_Draw( 0, MGSX + 2, MGSY + 18, &rc );
|
||||
}
|
||||
}
|
||||
|
||||
x = CrossWidth + HealthWidth / 2;
|
||||
int x, y;
|
||||
int cardheight = gHUD.GetSpriteRect( m_HUD_mstar ).bottom - gHUD.GetSpriteRect( m_HUD_mstar ).top;
|
||||
int cardwidth = ( gHUD.GetSpriteRect( m_HUD_mstar ).right - gHUD.GetSpriteRect( m_HUD_mstar ).left ) + 5;
|
||||
|
||||
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
|
||||
if( item_mstar )
|
||||
{
|
||||
x = ScreenWidth - cardwidth;
|
||||
y = ScreenHeight - ( cardheight * 4 + 5 );
|
||||
|
||||
x += HealthWidth / 2;
|
||||
|
||||
int iHeight = gHUD.m_iFontHeight;
|
||||
int iWidth = HealthWidth / 10;
|
||||
FillRGBA( x, y, iWidth, iHeight, 255, 160, 0, a );
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_mstar ), 255, 255, 255 );
|
||||
SPR_DrawHoles( 0, x, y, &gHUD.GetSpriteRect( m_HUD_mstar ) );
|
||||
}
|
||||
|
||||
DrawDamage( flTime );
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
#define DMG_AIMED (1 << 28) // Does Hit location damage
|
||||
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
|
||||
|
||||
#define DMG_CALTROP (1<<30)
|
||||
#define DMG_BILLNYE (1<<30)
|
||||
#define DMG_HALLUC (1<<31)
|
||||
|
||||
// TF Healing Additions for TakeHealth
|
||||
|
@ -102,11 +102,16 @@ public:
|
|||
virtual int VidInit( void );
|
||||
virtual int Draw( float fTime );
|
||||
virtual void Reset( void );
|
||||
int MsgFunc_Items( const char *pszName, int iSize, void *pbuf );
|
||||
int MsgFunc_Health( const char *pszName, int iSize, void *pbuf );
|
||||
int MsgFunc_Damage( const char *pszName, int iSize, void *pbuf );
|
||||
int m_iHealth;
|
||||
float m_flHealth;
|
||||
int m_HUD_dmg_bio;
|
||||
int m_HUD_cross;
|
||||
//int m_HUD_cross;
|
||||
int m_HUD_mgs3life; // MGS3-styled lifebar
|
||||
int m_HUD_mgs3name; // MGS3-styled name
|
||||
// To find the stanima, look in battery.cp
|
||||
float m_fAttackFront, m_fAttackRear, m_fAttackLeft, m_fAttackRight;
|
||||
void GetPainColor( int &r, int &g, int &b );
|
||||
float m_fFade;
|
||||
|
@ -114,7 +119,12 @@ public:
|
|||
private:
|
||||
HSPRITE m_hSprite;
|
||||
HSPRITE m_hDamage;
|
||||
|
||||
wrect_t *m_prc2;
|
||||
int m_iWidth;
|
||||
|
||||
int m_HUD_mstar;
|
||||
int item_mstar;
|
||||
|
||||
DAMAGE_IMAGE m_dmg[NUM_DMG_TYPES];
|
||||
int m_bitsDamage;
|
||||
int DrawPain( float fTime );
|
||||
|
@ -122,3 +132,24 @@ private:
|
|||
void CalcDamageDirection( vec3_t vecFrom );
|
||||
void UpdateTiles( float fTime, long bits );
|
||||
};
|
||||
|
||||
class CHudCOD: public CHudBase
|
||||
{
|
||||
public:
|
||||
virtual int Init( void );
|
||||
virtual int VidInit( void );
|
||||
virtual int Draw( float fTime );
|
||||
int MsgFunc_COD( const char *pszName, int iSize, void *pbuf );
|
||||
int RankExists( int rank );
|
||||
int m_iRank;
|
||||
float m_fFade;
|
||||
|
||||
private:
|
||||
int Ranks[1000];
|
||||
int m_HUD_codrank;
|
||||
int m_HUD_codrank2;
|
||||
wrect_t *m_prc2;
|
||||
int m_iHeight;
|
||||
int m_iWidth;
|
||||
char *charSpriteName;
|
||||
};
|
||||
|
|
|
@ -75,6 +75,7 @@ void UTIL_PrecacheOther( const char *szClassname ) { }
|
|||
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { }
|
||||
void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) { }
|
||||
void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) { }
|
||||
void UTIL_PaintballDecalTrace( TraceResult *pTrace, int decalNumber ) { }
|
||||
void UTIL_MakeVectors( const Vector &vecAngles ) { }
|
||||
BOOL UTIL_IsValidEntity( edict_t *pent ) { return TRUE; }
|
||||
void UTIL_SetOrigin( entvars_t *, const Vector &org ) { }
|
||||
|
@ -95,7 +96,9 @@ void CGrenade::Explode( TraceResult *, int ) { }
|
|||
void CGrenade::Killed( entvars_t *, int ) { }
|
||||
void CGrenade::Spawn( void ) { }
|
||||
CGrenade *CGrenade::ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
|
||||
CGrenade *CGrenade::ShootJihad( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
|
||||
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; }
|
||||
CGrenade *CGrenade::ShootContact2( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; }
|
||||
void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ }
|
||||
|
||||
void UTIL_Remove( CBaseEntity *pEntity ){ }
|
||||
|
@ -236,6 +239,7 @@ int CBaseMonster::TakeHealth(float flHealth, int bitsDamageType) { return 0; }
|
|||
int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
|
||||
int CBaseMonster::Restore( class CRestore & ) { return 1; }
|
||||
int CBaseMonster::Save( class CSave & ) { return 1; }
|
||||
float CBaseMonster::GetHealth( float health, float multi ) { return 1; }
|
||||
|
||||
int TrainSpeed( int iSpeed, int iMax ) { return 0; }
|
||||
void CBasePlayer::DeathSound( void ) { }
|
||||
|
@ -252,6 +256,7 @@ void CBasePlayer::StartDeathCam( void ) { }
|
|||
void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { }
|
||||
void CBasePlayer::PlayerUse( void ) { }
|
||||
void CBasePlayer::Jump() { }
|
||||
// void CBasePlayer::Jason() { }
|
||||
void CBasePlayer::Duck() { }
|
||||
int CBasePlayer::Classify( void ) { return 0; }
|
||||
void CBasePlayer::PreThink(void) { }
|
||||
|
|
|
@ -26,18 +26,26 @@ void EV_FireShotGunSingle( struct event_args_s *args );
|
|||
void EV_FireShotGunDouble( struct event_args_s *args );
|
||||
void EV_FireMP5( struct event_args_s *args );
|
||||
void EV_FireMP52( struct event_args_s *args );
|
||||
void EV_FirePython( struct event_args_s *args );
|
||||
void EV_FireGauss( struct event_args_s *args );
|
||||
void EV_SpinGauss( struct event_args_s *args );
|
||||
void EV_Crowbar( struct event_args_s *args );
|
||||
void EV_FireCrossbow( struct event_args_s *args );
|
||||
void EV_FireCrossbow2( struct event_args_s *args );
|
||||
void EV_Boombox( struct event_args_s *args );
|
||||
void EV_FireRpg( struct event_args_s *args );
|
||||
void EV_EgonFire( struct event_args_s *args );
|
||||
void EV_EgonStop( struct event_args_s *args );
|
||||
void EV_HornetGunFire( struct event_args_s *args );
|
||||
void EV_SodaDrink( struct event_args_s *args );
|
||||
void EV_TripmineFire( struct event_args_s *args );
|
||||
void EV_SnarkFire( struct event_args_s *args );
|
||||
void EV_FireDosh( struct event_args_s *args );
|
||||
void EV_BeamKatana( struct event_args_s *args );
|
||||
void EV_FOTN( struct event_args_s *args );
|
||||
void EV_FireAK47( struct event_args_s *args );
|
||||
void EV_FireBow( struct event_args_s *args );
|
||||
void EV_FireModman( struct event_args_s *args );
|
||||
void EV_FireModman2( struct event_args_s *args );
|
||||
void EV_FireScientist( struct event_args_s *args );
|
||||
void EV_FireNStar( struct event_args_s *args );
|
||||
void EV_FireMW2( struct event_args_s *args );
|
||||
void EV_FireGOLDENGUN( struct event_args_s *args );
|
||||
void EV_FireJackal( struct event_args_s *args );
|
||||
void EV_Jihad( struct event_args_s *args );
|
||||
void EV_FireZAPPER( struct event_args_s *args );
|
||||
|
||||
void EV_TrainPitchAdjust( struct event_args_s *args );
|
||||
}
|
||||
|
@ -63,17 +71,25 @@ void Game_HookEvents( void )
|
|||
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
|
||||
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
|
||||
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
|
||||
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
|
||||
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
|
||||
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
|
||||
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
|
||||
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
|
||||
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
|
||||
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
|
||||
gEngfuncs.pfnHookEvent( "events/boombox.sc", EV_Boombox );
|
||||
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
|
||||
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
|
||||
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
|
||||
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
|
||||
gEngfuncs.pfnHookEvent( "events/soda.sc", EV_SodaDrink );
|
||||
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
|
||||
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
|
||||
gEngfuncs.pfnHookEvent( "events/dosh.sc", EV_FireDosh );
|
||||
gEngfuncs.pfnHookEvent( "events/beamkatana.sc", EV_BeamKatana );
|
||||
gEngfuncs.pfnHookEvent( "events/fotns.sc", EV_FOTN );
|
||||
gEngfuncs.pfnHookEvent( "events/ak47.sc", EV_FireAK47 );
|
||||
gEngfuncs.pfnHookEvent( "events/bow.sc", EV_FireBow );
|
||||
gEngfuncs.pfnHookEvent( "events/modman.sc", EV_FireModman );
|
||||
gEngfuncs.pfnHookEvent( "events/modman2.sc", EV_FireModman2 );
|
||||
gEngfuncs.pfnHookEvent( "events/scientist.sc", EV_FireScientist );
|
||||
gEngfuncs.pfnHookEvent( "events/nstar.sc", EV_FireNStar );
|
||||
gEngfuncs.pfnHookEvent( "events/mw2.sc", EV_FireMW2 );
|
||||
gEngfuncs.pfnHookEvent( "events/goldengun.sc", EV_FireGOLDENGUN );
|
||||
gEngfuncs.pfnHookEvent( "events/jackal.sc", EV_FireJackal );
|
||||
gEngfuncs.pfnHookEvent( "events/jihad.sc", EV_Jihad );
|
||||
gEngfuncs.pfnHookEvent( "events/zapper.sc", EV_FireZAPPER );
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "entity_types.h"
|
||||
#include "r_efx.h"
|
||||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
//extern BEAM *pBeam;
|
||||
//extern BEAM *pBeam2;
|
||||
void HUD_GetLastOrg( float *org );
|
||||
|
||||
void UpdateBeams( void )
|
||||
|
@ -63,29 +63,5 @@ void UpdateBeams( void )
|
|||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
||||
if( pBeam )
|
||||
{
|
||||
pBeam->target = tr.endpos;
|
||||
pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
|
||||
if( pBeam2 )
|
||||
{
|
||||
pBeam2->target = tr.endpos;
|
||||
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
Game_AddObjects
|
||||
|
||||
Add game specific, client-side objects here
|
||||
=====================
|
||||
*/
|
||||
void Game_AddObjects( void )
|
||||
{
|
||||
if( pBeam && pBeam2 )
|
||||
UpdateBeams();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "event_args.h"
|
||||
#include "r_efx.h"
|
||||
#include "event_api.h"
|
||||
//#include "event_args.h"
|
||||
//#include "../in_defs.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "usercmd.h"
|
||||
|
@ -55,18 +60,28 @@ vec3_t previousorigin;
|
|||
// HLDM Weapon placeholder entities.
|
||||
CGlock g_Glock;
|
||||
CCrowbar g_Crowbar;
|
||||
CPython g_Python;
|
||||
CBoombox g_Boombox;
|
||||
CMP5 g_Mp5;
|
||||
CCrossbow g_Crossbow;
|
||||
CShotgun g_Shotgun;
|
||||
CRpg g_Rpg;
|
||||
CGauss g_Gauss;
|
||||
CEgon g_Egon;
|
||||
CHgun g_HGun;
|
||||
CSodaCan g_Soda;
|
||||
CHandGrenade g_HandGren;
|
||||
CSatchel g_Satchel;
|
||||
CTripmine g_Tripmine;
|
||||
CSqueak g_Snark;
|
||||
CDosh g_Dosh;
|
||||
CBeamKatana g_BeamKatana;
|
||||
CSciPG g_SciPG;
|
||||
CFOTN g_FOTN;
|
||||
CAK47 g_AK47;
|
||||
CBow g_Bow;
|
||||
CModman g_Modman;
|
||||
CJihad g_Jihad;
|
||||
CNStar g_NStar;
|
||||
CMW2 g_MW2;
|
||||
CGOLDENGUN g_GOLDENGUN;
|
||||
CJackal g_Jackal;
|
||||
CZAPPER g_ZAPPER;
|
||||
|
||||
/*
|
||||
======================
|
||||
|
@ -625,18 +640,28 @@ void HUD_InitClientWeapons( void )
|
|||
// Allocate slot(s) for each weapon that we are going to be predicting
|
||||
HUD_PrepEntity( &g_Glock, &player );
|
||||
HUD_PrepEntity( &g_Crowbar, &player );
|
||||
HUD_PrepEntity( &g_Python, &player );
|
||||
HUD_PrepEntity( &g_Boombox, &player );
|
||||
HUD_PrepEntity( &g_Mp5, &player );
|
||||
HUD_PrepEntity( &g_Crossbow, &player );
|
||||
HUD_PrepEntity( &g_Shotgun, &player );
|
||||
HUD_PrepEntity( &g_Rpg, &player );
|
||||
HUD_PrepEntity( &g_Gauss, &player );
|
||||
HUD_PrepEntity( &g_Egon, &player );
|
||||
HUD_PrepEntity( &g_HGun, &player );
|
||||
HUD_PrepEntity( &g_Soda, &player );
|
||||
HUD_PrepEntity( &g_HandGren, &player );
|
||||
HUD_PrepEntity( &g_Satchel, &player );
|
||||
HUD_PrepEntity( &g_Tripmine, &player );
|
||||
HUD_PrepEntity( &g_Snark, &player );
|
||||
HUD_PrepEntity( &g_Dosh, &player );
|
||||
HUD_PrepEntity( &g_BeamKatana, &player );
|
||||
HUD_PrepEntity( &g_SciPG, &player );
|
||||
HUD_PrepEntity( &g_FOTN, &player );
|
||||
HUD_PrepEntity( &g_AK47, &player );
|
||||
HUD_PrepEntity( &g_Bow, &player );
|
||||
HUD_PrepEntity( &g_Modman, &player );
|
||||
HUD_PrepEntity( &g_Jihad, &player );
|
||||
HUD_PrepEntity( &g_NStar, &player );
|
||||
HUD_PrepEntity( &g_MW2, &player );
|
||||
HUD_PrepEntity( &g_Jackal, &player );
|
||||
HUD_PrepEntity( &g_GOLDENGUN, &player );
|
||||
HUD_PrepEntity( &g_ZAPPER, &player );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -703,32 +728,23 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
case WEAPON_CROWBAR:
|
||||
pWeapon = &g_Crowbar;
|
||||
break;
|
||||
case WEAPON_BOOMBOX:
|
||||
pWeapon = &g_Boombox;
|
||||
break;
|
||||
case WEAPON_GLOCK:
|
||||
pWeapon = &g_Glock;
|
||||
break;
|
||||
case WEAPON_PYTHON:
|
||||
pWeapon = &g_Python;
|
||||
break;
|
||||
case WEAPON_MP5:
|
||||
pWeapon = &g_Mp5;
|
||||
break;
|
||||
case WEAPON_CROSSBOW:
|
||||
pWeapon = &g_Crossbow;
|
||||
break;
|
||||
case WEAPON_SHOTGUN:
|
||||
pWeapon = &g_Shotgun;
|
||||
break;
|
||||
case WEAPON_RPG:
|
||||
pWeapon = &g_Rpg;
|
||||
break;
|
||||
case WEAPON_GAUSS:
|
||||
pWeapon = &g_Gauss;
|
||||
break;
|
||||
case WEAPON_EGON:
|
||||
pWeapon = &g_Egon;
|
||||
break;
|
||||
case WEAPON_HORNETGUN:
|
||||
pWeapon = &g_HGun;
|
||||
case WEAPON_SODA:
|
||||
pWeapon = &g_Soda;
|
||||
break;
|
||||
case WEAPON_HANDGRENADE:
|
||||
pWeapon = &g_HandGren;
|
||||
|
@ -742,6 +758,45 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
case WEAPON_SNARK:
|
||||
pWeapon = &g_Snark;
|
||||
break;
|
||||
case WEAPON_DOSH:
|
||||
pWeapon = &g_Dosh;
|
||||
break;
|
||||
case WEAPON_BEAMKATANA:
|
||||
pWeapon = &g_BeamKatana;
|
||||
break;
|
||||
case WEAPON_SCIENTIST:
|
||||
pWeapon = &g_SciPG;
|
||||
break;
|
||||
case WEAPON_FOTN:
|
||||
pWeapon = &g_FOTN;
|
||||
break;
|
||||
case WEAPON_JIHAD:
|
||||
pWeapon = &g_Jihad;
|
||||
break;
|
||||
case WEAPON_AK47:
|
||||
pWeapon = &g_AK47;
|
||||
break;
|
||||
case WEAPON_BOW:
|
||||
pWeapon = &g_Bow;
|
||||
break;
|
||||
case WEAPON_MODMAN:
|
||||
pWeapon = &g_Modman;
|
||||
break;
|
||||
case WEAPON_NSTAR:
|
||||
pWeapon = &g_NStar;
|
||||
break;
|
||||
case WEAPON_MW2:
|
||||
pWeapon = &g_MW2;
|
||||
break;
|
||||
case WEAPON_GOLDENGUN:
|
||||
pWeapon = &g_GOLDENGUN;
|
||||
break;
|
||||
case WEAPON_JACKAL:
|
||||
pWeapon = &g_Jackal;
|
||||
break;
|
||||
case WEAPON_ZAPPER:
|
||||
pWeapon = &g_ZAPPER;
|
||||
break;
|
||||
}
|
||||
|
||||
// Store pointer to our destination entity_state_t so we can get our origin, etc. from it
|
||||
|
@ -930,10 +985,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
if( pWeapon == &g_Tripmine )
|
||||
body = 0;
|
||||
|
||||
//Show laser sight/scope combo
|
||||
if( pWeapon == &g_Python && bIsMultiplayer() )
|
||||
body = 1;
|
||||
|
||||
// Force a fixed anim down to viewmodel
|
||||
HUD_SendWeaponAnim( to->client.weaponanim, body, 1 );
|
||||
}
|
||||
|
@ -1056,6 +1107,16 @@ void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s
|
|||
{
|
||||
g_runfuncs = runfuncs;
|
||||
|
||||
if( cl_lw && cl_lw->value && from->client.m_iId == WEAPON_GOLDENGUN )
|
||||
{
|
||||
HUD_WeaponsPostThink( from, to, cmd, time, random_seed );
|
||||
}
|
||||
|
||||
if( cl_lw && cl_lw->value && from->client.m_iId == WEAPON_ZAPPER )
|
||||
{
|
||||
HUD_WeaponsPostThink( from, to, cmd, time, random_seed );
|
||||
}
|
||||
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
if( cl_lw && cl_lw->value )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// Health.cpp
|
||||
//
|
||||
// implementation of CHudCOD class
|
||||
//
|
||||
|
||||
#include "STDIO.H"
|
||||
#include "STDLIB.H"
|
||||
#include "MATH.H"
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "parsemsg.h"
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
DECLARE_MESSAGE(m_COD, COD )
|
||||
|
||||
#define RANK_DELAY 8.0
|
||||
|
||||
int CHudCOD::Init(void)
|
||||
{
|
||||
HOOK_MESSAGE(COD);
|
||||
m_iRank = 0;
|
||||
|
||||
gHUD.AddHudElem(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudCOD::VidInit(void)
|
||||
{
|
||||
m_HUD_codrank = gHUD.GetSpriteIndex( "cod1000" );
|
||||
m_HUD_codrank2 = gHUD.GetSpriteIndex( "cod1" );
|
||||
m_prc2 = &gHUD.GetSpriteRect(m_HUD_codrank2);
|
||||
m_iHeight = m_prc2->bottom - m_prc2->top;
|
||||
m_iWidth = (m_prc2->right - m_prc2->left)/2;
|
||||
m_fFade = 0;
|
||||
|
||||
int dev = CVAR_GET_FLOAT( "developer" );
|
||||
|
||||
if (dev)
|
||||
ConsolePrint("\n\n****#### COD - Rank Scanner -- START\n");
|
||||
|
||||
int i;
|
||||
|
||||
for (i=0;i<101;i++)
|
||||
{
|
||||
if (RankExists(i))
|
||||
{
|
||||
if (dev)
|
||||
{
|
||||
char cod[12] = "FOUND: ";
|
||||
char lvl[3] = "";
|
||||
itoa(i, lvl, 10);
|
||||
strcat(cod, lvl);
|
||||
strcat(cod, "\n");
|
||||
ConsolePrint( cod );
|
||||
}
|
||||
Ranks[i] = TRUE;
|
||||
}
|
||||
else
|
||||
Ranks[i] = FALSE;
|
||||
}
|
||||
Ranks[360] = TRUE; //Hardcoded NOSCOPE
|
||||
Ranks[1000] = TRUE; //Hardcoded Grinman
|
||||
|
||||
if (dev)
|
||||
ConsolePrint("****#### COD - Rank Scanner -- END SUCCESSFULLY\n\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudCOD::Draw(float flTime)
|
||||
{
|
||||
// wrect_t rc;
|
||||
|
||||
if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() )
|
||||
return 1;
|
||||
|
||||
if (m_fFade > gHUD.m_flTime)
|
||||
{
|
||||
if (m_iRank && (Ranks[m_iRank]))
|
||||
{
|
||||
SPR_Set(gHUD.GetSprite(m_HUD_codrank), 12, 255, 12);
|
||||
SPR_DrawAdditive(0, (ScreenWidth/2)-m_iWidth, (ScreenHeight/2)-((m_iHeight/2)+(m_iHeight)), &gHUD.GetSpriteRect(m_HUD_codrank));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudCOD:: MsgFunc_COD(const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
// TODO: update local health data
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
int x = READ_BYTE();
|
||||
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
|
||||
// Only update the fade if we've changed health
|
||||
if (x != m_iRank)
|
||||
{
|
||||
m_fFade = gHUD.m_flTime + RANK_DELAY;
|
||||
m_iRank = x;
|
||||
|
||||
char lvl[3] = "";
|
||||
sprintf(lvl, "%i", m_iRank);
|
||||
|
||||
if (Ranks[m_iRank])
|
||||
{
|
||||
char temp[256];
|
||||
sprintf(temp, "cod/cod%s.wav", lvl);
|
||||
PlaySound( temp, 1 );
|
||||
}
|
||||
|
||||
char temp2[256];
|
||||
sprintf(temp2, "cod%s", lvl);
|
||||
charSpriteName = temp2;
|
||||
m_HUD_codrank = gHUD.GetSpriteIndex(charSpriteName);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudCOD::RankExists(int rank)
|
||||
{
|
||||
char cod[6] = "cod";
|
||||
char lvl[3] = "";
|
||||
itoa(rank, lvl, 10);
|
||||
strcat(cod, lvl);
|
||||
|
||||
if (gHUD.GetSpriteIndex( cod ) > -1)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
|||
#ifndef _FMOD_ERRORS_H
|
||||
#define _FMOD_ERRORS_H
|
||||
|
||||
static char *FMOD_ErrorString(int errcode)
|
||||
{
|
||||
switch (errcode)
|
||||
{
|
||||
case FMOD_ERR_NONE: return "No errors";
|
||||
case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first.";
|
||||
case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called";
|
||||
case FMOD_ERR_PLAY: return "Playing the sound failed.";
|
||||
case FMOD_ERR_INIT: return "Error initializing output device.";
|
||||
case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused.";
|
||||
case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)";
|
||||
case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware.";
|
||||
case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer.";
|
||||
case FMOD_ERR_FILE_NOTFOUND: return "File not found";
|
||||
case FMOD_ERR_FILE_FORMAT: return "Unknown file format";
|
||||
case FMOD_ERR_FILE_BAD: return "Error loading file";
|
||||
case FMOD_ERR_MEMORY: return "Not enough memory ";
|
||||
case FMOD_ERR_VERSION: return "The version number of this file format is not supported";
|
||||
case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function";
|
||||
case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output.";
|
||||
case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel";
|
||||
case FMOD_ERR_RECORD: return "Recording not supported on this device";
|
||||
case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed";
|
||||
|
||||
default : return "Unknown error";
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,527 @@
|
|||
/* ========================================================================================== */
|
||||
/* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd 1999-2003. */
|
||||
/* ========================================================================================== */
|
||||
|
||||
#ifndef _FMODDYN_H_
|
||||
#define _FMODDYN_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "fmod.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *module;
|
||||
|
||||
signed char (F_API *FSOUND_SetOutput)(int outputtype);
|
||||
signed char (F_API *FSOUND_SetDriver)(int driver);
|
||||
signed char (F_API *FSOUND_SetMixer)(int mixer);
|
||||
signed char (F_API *FSOUND_SetBufferSize)(int len_ms);
|
||||
signed char (F_API *FSOUND_SetHWND)(void *hwnd);
|
||||
signed char (F_API *FSOUND_SetMinHardwareChannels)(int min);
|
||||
signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max);
|
||||
signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree);
|
||||
signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags);
|
||||
void (F_API *FSOUND_Close)();
|
||||
void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode);
|
||||
void (F_API *FSOUND_SetSFXMasterVolume)(int volume);
|
||||
void (F_API *FSOUND_SetPanSeperation)(float pansep);
|
||||
void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell);
|
||||
int (F_API *FSOUND_GetError)();
|
||||
float (F_API *FSOUND_GetVersion)();
|
||||
int (F_API *FSOUND_GetOutput)();
|
||||
void * (F_API *FSOUND_GetOutputHandle)();
|
||||
int (F_API *FSOUND_GetDriver)();
|
||||
int (F_API *FSOUND_GetMixer)();
|
||||
int (F_API *FSOUND_GetNumDrivers)();
|
||||
signed char * (F_API *FSOUND_GetDriverName)(int id);
|
||||
signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps);
|
||||
int (F_API *FSOUND_GetOutputRate)();
|
||||
int (F_API *FSOUND_GetMaxChannels)();
|
||||
int (F_API *FSOUND_GetMaxSamples)();
|
||||
int (F_API *FSOUND_GetSFXMasterVolume)();
|
||||
int (F_API *FSOUND_GetNumHardwareChannels)();
|
||||
int (F_API *FSOUND_GetChannelsPlaying)();
|
||||
float (F_API *FSOUND_GetCPUUsage)();
|
||||
void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced);
|
||||
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length);
|
||||
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri);
|
||||
void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr);
|
||||
signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode);
|
||||
signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
|
||||
signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
|
||||
signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode);
|
||||
signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend);
|
||||
signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri);
|
||||
signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max);
|
||||
signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max);
|
||||
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno);
|
||||
char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr);
|
||||
unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr);
|
||||
signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend);
|
||||
signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri);
|
||||
unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr);
|
||||
int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr);
|
||||
int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
|
||||
signed char (F_API *FSOUND_StopSound)(int channel);
|
||||
signed char (F_API *FSOUND_SetFrequency)(int channel, int freq);
|
||||
signed char (F_API *FSOUND_SetVolume)(int channel, int vol);
|
||||
signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol);
|
||||
signed char (F_API *FSOUND_SetPan)(int channel, int pan);
|
||||
signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround);
|
||||
signed char (F_API *FSOUND_SetMute)(int channel, signed char mute);
|
||||
signed char (F_API *FSOUND_SetPriority)(int channel, int priority);
|
||||
signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved);
|
||||
signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused);
|
||||
signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode);
|
||||
signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset);
|
||||
signed char (F_API *FSOUND_IsPlaying)(int channel);
|
||||
int (F_API *FSOUND_GetFrequency)(int channel);
|
||||
int (F_API *FSOUND_GetVolume)(int channel);
|
||||
int (F_API *FSOUND_GetPan)(int channel);
|
||||
signed char (F_API *FSOUND_GetSurround)(int channel);
|
||||
signed char (F_API *FSOUND_GetMute)(int channel);
|
||||
int (F_API *FSOUND_GetPriority)(int channel);
|
||||
signed char (F_API *FSOUND_GetReserved)(int channel);
|
||||
signed char (F_API *FSOUND_GetPaused)(int channel);
|
||||
unsigned int (F_API *FSOUND_GetLoopMode)(int channel);
|
||||
unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel);
|
||||
FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel);
|
||||
signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r);
|
||||
int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */
|
||||
signed char (F_API *FSOUND_FX_Disable)(int channel);
|
||||
signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
|
||||
signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay);
|
||||
signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff);
|
||||
signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay);
|
||||
signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
|
||||
signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape);
|
||||
signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference);
|
||||
signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain);
|
||||
signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio);
|
||||
void (F_API *FSOUND_Update)(); /* you must call this once a frame */
|
||||
void (F_API *FSOUND_3D_SetDopplerFactor)(float scale);
|
||||
void (F_API *FSOUND_3D_SetDistanceFactor)(float scale);
|
||||
void (F_API *FSOUND_3D_SetRolloffFactor)(float scale);
|
||||
signed char (F_API *FSOUND_3D_SetAttributes)(int channel, float *pos, float *vel);
|
||||
signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel);
|
||||
void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */
|
||||
void (F_API *FSOUND_3D_Listener_SetAttributes)(float *pos, float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
|
||||
void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz);
|
||||
signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */
|
||||
FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length);
|
||||
FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, int userdata);
|
||||
signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream);
|
||||
int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream);
|
||||
int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused);
|
||||
signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream);
|
||||
signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position);
|
||||
unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream);
|
||||
signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms);
|
||||
int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream);
|
||||
int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream);
|
||||
int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream);
|
||||
signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode);
|
||||
unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream);
|
||||
signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm);
|
||||
signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count);
|
||||
int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream);
|
||||
FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, int param);
|
||||
signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, int userdata);
|
||||
signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, int userdata);
|
||||
FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, int userdata);
|
||||
signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point);
|
||||
int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream);
|
||||
FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index);
|
||||
char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset);
|
||||
signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index);
|
||||
int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream);
|
||||
signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, int *sentencelist, int numitems);
|
||||
signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num);
|
||||
signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length);
|
||||
signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length);
|
||||
signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy);
|
||||
char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)();
|
||||
signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent);
|
||||
signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent);
|
||||
signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, int userdata);
|
||||
signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags);
|
||||
signed char (F_API *FSOUND_CD_Play)(char drive, int track);
|
||||
void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode);
|
||||
signed char (F_API *FSOUND_CD_Stop)(char drive);
|
||||
signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused);
|
||||
signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume);
|
||||
signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms);
|
||||
signed char (F_API *FSOUND_CD_Eject)(char drive);
|
||||
signed char (F_API *FSOUND_CD_GetPaused)(char drive);
|
||||
int (F_API *FSOUND_CD_GetTrack)(char drive);
|
||||
int (F_API *FSOUND_CD_GetNumTracks)(char drive);
|
||||
int (F_API *FSOUND_CD_GetVolume)(char drive);
|
||||
int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track);
|
||||
int (F_API *FSOUND_CD_GetTrackTime)(char drive);
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, int param);
|
||||
void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit);
|
||||
void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority);
|
||||
int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit);
|
||||
void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active);
|
||||
signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit);
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)();
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)();
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)();
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)();
|
||||
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)();
|
||||
signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode);
|
||||
void (F_API *FSOUND_DSP_ClearMixBuffer)();
|
||||
int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */
|
||||
int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */
|
||||
float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */
|
||||
signed char (F_API *FSOUND_Reverb_SetProperties)(FSOUND_REVERB_PROPERTIES *prop);
|
||||
signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop);
|
||||
signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop);
|
||||
signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop);
|
||||
signed char (F_API *FSOUND_Record_SetDriver)(int outputtype);
|
||||
int (F_API *FSOUND_Record_GetNumDrivers)();
|
||||
signed char * (F_API *FSOUND_Record_GetDriverName)(int id);
|
||||
int (F_API *FSOUND_Record_GetDriver)();
|
||||
signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop);
|
||||
signed char (F_API *FSOUND_Record_Stop)();
|
||||
int (F_API *FSOUND_Record_GetPosition)();
|
||||
FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name);
|
||||
FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, int *samplelist, int samplelistnum);
|
||||
int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod);
|
||||
signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod);
|
||||
signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod);
|
||||
signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod);
|
||||
void (F_API *FMUSIC_StopAllSongs)();
|
||||
signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback);
|
||||
signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep);
|
||||
signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep);
|
||||
signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument);
|
||||
signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr);
|
||||
signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, unsigned int userdata);
|
||||
signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume);
|
||||
signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */
|
||||
signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping);
|
||||
signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order);
|
||||
signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause);
|
||||
signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume);
|
||||
signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed);
|
||||
signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep);
|
||||
char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod);
|
||||
FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno);
|
||||
int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno);
|
||||
signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod);
|
||||
signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod);
|
||||
signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod);
|
||||
int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel);
|
||||
unsigned int (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod);
|
||||
} FMOD_INSTANCE;
|
||||
|
||||
|
||||
static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName)
|
||||
{
|
||||
FMOD_INSTANCE *instance;
|
||||
|
||||
instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1);
|
||||
if (!instance)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
instance->module = LoadLibrary(dllName);
|
||||
#else
|
||||
instance->module = dlopen(dllName, RTLD_LAZY);
|
||||
#endif
|
||||
if (!instance->module)
|
||||
{
|
||||
free(instance);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#define F_GETPROC(_x, _y) \
|
||||
{ \
|
||||
*((unsigned int *)&instance->_x) = (unsigned int)GetProcAddress((HMODULE)instance->module, _y); \
|
||||
if (!instance->_x) \
|
||||
{ \
|
||||
FreeLibrary((HMODULE)instance->module); \
|
||||
free(instance); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define F_GETPROC(_x, _y) \
|
||||
{ \
|
||||
char tmp[] = _y; \
|
||||
*(strchr(tmp, '@')) = 0; \
|
||||
*((unsigned int *)&instance->_x) = (unsigned int)dlsym(instance->module, &tmp[1]); \
|
||||
if (!instance->_x) \
|
||||
{ \
|
||||
dlclose(instance->module); \
|
||||
free(instance); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4");
|
||||
F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4");
|
||||
F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4");
|
||||
F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4");
|
||||
F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4");
|
||||
F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4");
|
||||
F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4");
|
||||
F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20");
|
||||
F_GETPROC(FSOUND_Init, "_FSOUND_Init@12");
|
||||
F_GETPROC(FSOUND_Close, "_FSOUND_Close@0");
|
||||
F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4");
|
||||
F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4");
|
||||
F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4");
|
||||
F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0");
|
||||
F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0");
|
||||
F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0");
|
||||
F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0");
|
||||
F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0");
|
||||
F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0");
|
||||
F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0");
|
||||
F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4");
|
||||
F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8");
|
||||
F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0");
|
||||
F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0");
|
||||
F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0");
|
||||
F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0");
|
||||
F_GETPROC(FSOUND_GetNumHardwareChannels, "_FSOUND_GetNumHardwareChannels@0");
|
||||
F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0");
|
||||
F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0");
|
||||
F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8");
|
||||
F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20");
|
||||
F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28");
|
||||
F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4");
|
||||
F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12");
|
||||
F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28");
|
||||
F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20");
|
||||
F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8");
|
||||
F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12");
|
||||
F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20");
|
||||
F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12");
|
||||
F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8");
|
||||
F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4");
|
||||
F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4");
|
||||
F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4");
|
||||
F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12");
|
||||
F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20");
|
||||
F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4");
|
||||
F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8");
|
||||
F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16");
|
||||
F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4");
|
||||
F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8");
|
||||
F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8");
|
||||
F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8");
|
||||
F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8");
|
||||
F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8");
|
||||
F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8");
|
||||
F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8");
|
||||
F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8");
|
||||
F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8");
|
||||
F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8");
|
||||
F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4");
|
||||
F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4");
|
||||
F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4");
|
||||
F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4");
|
||||
F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4");
|
||||
F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4");
|
||||
F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4");
|
||||
F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4");
|
||||
F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4");
|
||||
F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4");
|
||||
F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4");
|
||||
F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8");
|
||||
F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4");
|
||||
F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12");
|
||||
F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8");
|
||||
F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4");
|
||||
F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32");
|
||||
F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28");
|
||||
F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24");
|
||||
F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24");
|
||||
F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32");
|
||||
F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12");
|
||||
F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52");
|
||||
F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16");
|
||||
F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20");
|
||||
F_GETPROC(FSOUND_Update, "_FSOUND_Update@0");
|
||||
F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12");
|
||||
F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12");
|
||||
F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8");
|
||||
F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32");
|
||||
F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32");
|
||||
F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4");
|
||||
F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4");
|
||||
F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4");
|
||||
F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16");
|
||||
F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20");
|
||||
F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8");
|
||||
F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16");
|
||||
F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4");
|
||||
F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4");
|
||||
F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12");
|
||||
F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12");
|
||||
F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4");
|
||||
F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16");
|
||||
F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4");
|
||||
F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8");
|
||||
F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4");
|
||||
F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8");
|
||||
F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4");
|
||||
F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4");
|
||||
F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4");
|
||||
F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8");
|
||||
F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4");
|
||||
F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8");
|
||||
F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4");
|
||||
F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12");
|
||||
F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12");
|
||||
F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8");
|
||||
F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12");
|
||||
F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4");
|
||||
F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4");
|
||||
F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8");
|
||||
F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8");
|
||||
F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4");
|
||||
F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8");
|
||||
F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24");
|
||||
F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20");
|
||||
F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4");
|
||||
F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0");
|
||||
F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12");
|
||||
F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12");
|
||||
F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12");
|
||||
F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20");
|
||||
F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8");
|
||||
F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8");
|
||||
F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4");
|
||||
F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8");
|
||||
F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8");
|
||||
F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8");
|
||||
F_GETPROC(FSOUND_CD_Eject, "_FSOUND_CD_Eject@4");
|
||||
F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4");
|
||||
F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4");
|
||||
F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4");
|
||||
F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4");
|
||||
F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8");
|
||||
F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4");
|
||||
F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12");
|
||||
F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4");
|
||||
F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8");
|
||||
F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4");
|
||||
F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8");
|
||||
F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4");
|
||||
F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0");
|
||||
F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0");
|
||||
F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0");
|
||||
F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0");
|
||||
F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0");
|
||||
F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28");
|
||||
F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0");
|
||||
F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0");
|
||||
F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0");
|
||||
F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0");
|
||||
F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4");
|
||||
F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4");
|
||||
F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8");
|
||||
F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8");
|
||||
F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4");
|
||||
F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0");
|
||||
F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4");
|
||||
F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0");
|
||||
F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8");
|
||||
F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0");
|
||||
F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0");
|
||||
F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20");
|
||||
F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4");
|
||||
F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24");
|
||||
F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4");
|
||||
F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4");
|
||||
F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4");
|
||||
F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4");
|
||||
F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0");
|
||||
F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8");
|
||||
F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12");
|
||||
F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12");
|
||||
F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12");
|
||||
F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12");
|
||||
F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8");
|
||||
F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12");
|
||||
F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4");
|
||||
F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8");
|
||||
F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8");
|
||||
F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8");
|
||||
F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8");
|
||||
F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8");
|
||||
F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8");
|
||||
F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4");
|
||||
F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4");
|
||||
F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4");
|
||||
F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4");
|
||||
F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4");
|
||||
F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4");
|
||||
F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4");
|
||||
F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8");
|
||||
F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8");
|
||||
F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4");
|
||||
F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4");
|
||||
F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4");
|
||||
F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4");
|
||||
F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4");
|
||||
F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4");
|
||||
F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4");
|
||||
F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4");
|
||||
F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4");
|
||||
F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4");
|
||||
F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4");
|
||||
F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8");
|
||||
F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4");
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
static void FMOD_FreeInstance(FMOD_INSTANCE *instance)
|
||||
{
|
||||
if (instance)
|
||||
{
|
||||
if (instance->module)
|
||||
{
|
||||
#ifdef WIN32
|
||||
FreeLibrary((HMODULE)instance->module);
|
||||
#else
|
||||
dlclose(instance->module);
|
||||
#endif
|
||||
}
|
||||
free(instance);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
|
@ -0,0 +1,240 @@
|
|||
|
||||
//
|
||||
// custom_message.cpp
|
||||
//
|
||||
// implementation of CHudHalloween class
|
||||
//
|
||||
// Coded By: Pongles
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "parsemsg.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MSG_RESPAWN 1
|
||||
#define MSG_GAME 2
|
||||
#define MSG_FIRSTBLOOD 3
|
||||
#define MSG_NAME 4
|
||||
#define MSG_VICTIM 5
|
||||
#define MSG_KILLER 6
|
||||
#define MSG_HALLOWEEN 7
|
||||
|
||||
const char *billymc [] = {
|
||||
"Victim #1",
|
||||
"Victim #2. Although he was still alive when he\nwas found starving in an\nabandoned apartment, he\ndied from blood loss on\nthe way to the hospital.\nThe place has apparently\nno tenant or owner",
|
||||
"The Three is The Terrible Treat for Those who Think",
|
||||
"YOU ENJOYTHIS DO YOU NOT?",
|
||||
"Does anyone suffer BEFORE?",
|
||||
"FEED ME A STRAY CAT",
|
||||
"EVERYONE IS GIYGAS, DONT BELIEVE THEIR LIES. YOU ARE RIGHT.",
|
||||
"Right?!!/",
|
||||
"I THouGHT Y/OU, LIKE,D, HALLOWEEN, ?!",
|
||||
"The pain reflects onto you. We all project pain onto others. To make them understand.",
|
||||
"GET BACK TO WHERE YOU BELONG? YOU HAVE MADE SUFFERING ENOUGH!",
|
||||
"THIS IS EVIL, STOP THIS THIS IS EVIL.",
|
||||
"HE HE HE HE HE :)",
|
||||
"AOBTD, I feel great about this! Is it not so?",
|
||||
"T0ggTVkgR09E\\\\STOP",
|
||||
"TONIGHT’S THE NIGHT; WHY HERE?",
|
||||
"17 Mothers without sons, Are yoU haPpy?",
|
||||
"I like scissors! 61!",
|
||||
"[Picture of Mario without eyes appears] MA MA MI YA",
|
||||
"The Black Wind Howls!",
|
||||
"why iS There yOu ProteCting what yOU Never ThINk is right aGain??",
|
||||
"WHY DO YOU NOT LEAVE AND LET LIVE?",
|
||||
"Game Over!",
|
||||
"614122876039093081593306193923589",
|
||||
"Do you realise??",
|
||||
":)",
|
||||
":(",
|
||||
"[Playername] was banned by the admin?",
|
||||
"RG8geW91IHJlYWxseSBlbmpveSB0aGlzIHNlbnNlbGVzcyBraWxsaW5nPyBUaGVzZSBwbGF5ZXJzIGFyZSByZWFsOyB0aGUgYm90cyBhcmUgYWxzbyByZWFsIHRvZGF5LiBUaGV5IGxpdmUgYW5kIGRpZSB3aXRoaW4gdGhlIGdhbWUgYW5kIGdldCBxdWlja2x5IHJlcGxhY2VkIHdoZW4geW91IGtpbGwgdGhlbS4gT25seSBvbiB0b2RheS4gVGhpcyBpcyBhbGwgdHJ1ZS4gVGhhdCBib3QgaXMgcmVhbC4gSSBob3BlIHlvdSBlbmpveSB5b3Vyc2VsZiwgS2lsbGVyLiAyIDMgMSA0IElTIFRIRSBXQVk=",
|
||||
"K!" };
|
||||
|
||||
CCustomMessage::CCustomMessage(byte rr, byte gg, byte bb, float yy, float fo, float ht,
|
||||
float st, char *szt)
|
||||
{
|
||||
r = rr;
|
||||
g = gg;
|
||||
b = bb;
|
||||
y = yy;
|
||||
fadeout = fo;
|
||||
holdtime = ht;
|
||||
time = st;
|
||||
strcpy(szText, szt);
|
||||
}
|
||||
|
||||
|
||||
DECLARE_MESSAGE(m_Halloween, Halloween);
|
||||
|
||||
int CHudHalloween::Init(void)
|
||||
{
|
||||
HOOK_MESSAGE(Halloween);
|
||||
|
||||
gHUD.AddHudElem(this);
|
||||
|
||||
Reset();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudHalloween::VidInit(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CHudHalloween::Reset( void )
|
||||
{
|
||||
for(int i = 0; i < maxCustomMessages; i++)
|
||||
{
|
||||
if (m_pCustomMsgs[i])
|
||||
delete m_pCustomMsgs[i];
|
||||
m_pCustomMsgs[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CHudHalloween::~CHudHalloween( )
|
||||
{
|
||||
for(int i = 0; i < maxCustomMessages; i++)
|
||||
{
|
||||
if(m_pCustomMsgs[i])
|
||||
{
|
||||
delete m_pCustomMsgs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CHudHalloween::Draw(float flTime)
|
||||
{
|
||||
int Index;
|
||||
|
||||
bool BeingDrawn = false;
|
||||
|
||||
float factor, endTime, holdTime;
|
||||
|
||||
CCustomMessage *pMessage;
|
||||
|
||||
// loop though 0 - 16
|
||||
for ( Index = 0; Index < maxCustomMessages; Index++ )
|
||||
{
|
||||
// is there one here?
|
||||
if ( m_pCustomMsgs[Index] )
|
||||
{
|
||||
pMessage = m_pCustomMsgs[Index];
|
||||
|
||||
endTime = pMessage->time + pMessage->fadeout
|
||||
+ pMessage->holdtime;
|
||||
holdTime = pMessage->time + pMessage->holdtime;
|
||||
|
||||
BeingDrawn = true;
|
||||
|
||||
if ( flTime <= holdTime )
|
||||
{
|
||||
// hold
|
||||
factor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// fade out
|
||||
factor = 1 - ((flTime - holdTime) / pMessage->fadeout);
|
||||
}
|
||||
|
||||
gHUD.DrawHudString( (ScreenWidth - CenterPos(pMessage->szText)) / 2,
|
||||
pMessage->y, ScreenWidth, pMessage->szText, factor * (pMessage->r),
|
||||
factor * (pMessage->g), factor * (pMessage->b) );
|
||||
|
||||
// finished ?
|
||||
if(flTime >= endTime)
|
||||
{
|
||||
m_pCustomMsgs[Index] = NULL;
|
||||
delete pMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !BeingDrawn )
|
||||
m_iFlags &= ~HUD_ACTIVE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudHalloween::MsgFunc_Halloween(const char*pszName, int iSize, void *pbuf)
|
||||
{
|
||||
BEGIN_READ(pbuf,iSize);
|
||||
|
||||
int x = READ_BYTE();
|
||||
|
||||
// reads string sent from server
|
||||
char *szText = READ_STRING();
|
||||
|
||||
MessageAdd( x, gHUD.m_flTime, szText );
|
||||
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudHalloween::CenterPos( char *szMessage )
|
||||
{
|
||||
int width = 0;
|
||||
|
||||
for (; *szMessage != 0 && *szMessage != '\n'; szMessage++ )
|
||||
{
|
||||
width += gHUD.m_scrinfo.charWidths[ *szMessage ];
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
void CHudHalloween::MessageAdd( int type, float time, char *text )
|
||||
{
|
||||
// check if there is an instance already
|
||||
|
||||
char tempBuffer[512];
|
||||
|
||||
if(m_pCustomMsgs[type] != NULL)
|
||||
{
|
||||
delete m_pCustomMsgs[type];
|
||||
}
|
||||
|
||||
// add new instance
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case MSG_RESPAWN:
|
||||
m_pCustomMsgs[type] = new CCustomMessage(0, 255, 0, (ScreenHeight / 2)
|
||||
+ (ScreenHeight / 4),1.5, 1, time, "Press [Fire] To Respawn");
|
||||
break;
|
||||
case MSG_GAME:
|
||||
m_pCustomMsgs[type] = new CCustomMessage(192, 192, 192, ScreenHeight / 2,
|
||||
1.5, 5, time, text);
|
||||
break;
|
||||
case MSG_FIRSTBLOOD:
|
||||
sprintf(tempBuffer, "%s Drew First Blood", text);
|
||||
m_pCustomMsgs[type] = new CCustomMessage(255, 0, 0, ScreenHeight / 4.5,
|
||||
1.5, 5, time, tempBuffer);
|
||||
break;
|
||||
case MSG_NAME:
|
||||
sprintf(tempBuffer, "Name: %s", text);
|
||||
m_pCustomMsgs[type] = new CCustomMessage(0, 255, 0, ScreenHeight / 2
|
||||
+ (ScreenHeight / 4),1, 1.5, time, tempBuffer);
|
||||
break;
|
||||
case MSG_VICTIM:
|
||||
sprintf(tempBuffer, "You were killed by %s", text);
|
||||
m_pCustomMsgs[type] = new CCustomMessage(0, 0, 255, ScreenHeight / 4,
|
||||
1.5, 1, time, tempBuffer);
|
||||
break;
|
||||
case MSG_KILLER:
|
||||
sprintf(tempBuffer, "You Killed %s", text);
|
||||
m_pCustomMsgs[type] = new CCustomMessage(255, 0, 0, ScreenHeight / 4.5,
|
||||
1.5, 1, time, tempBuffer);
|
||||
break;
|
||||
case MSG_HALLOWEEN:
|
||||
int youbet = atoi(text);
|
||||
sprintf(tempBuffer, "%s", billymc[youbet]);
|
||||
m_pCustomMsgs[type] = new CCustomMessage(200, 200, 200, ScreenHeight / 2
|
||||
+ (ScreenHeight / 4.5), 1.5, 5, time, tempBuffer);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Pongles [
|
||||
class CCustomMessage
|
||||
{
|
||||
public:
|
||||
byte r, g, b;
|
||||
float y;
|
||||
float fadein;
|
||||
float fadeout;
|
||||
float holdtime;
|
||||
char *pText;
|
||||
float time;
|
||||
char szText[64];
|
||||
|
||||
CCustomMessage() {}
|
||||
|
||||
CCustomMessage(byte rr, byte gg, byte bb, float yy, float fo, float ht,
|
||||
float st, char *szt);
|
||||
};
|
||||
|
||||
const int maxCustomMessages = 16;
|
||||
|
||||
class CHudHalloween : public CHudBase
|
||||
{
|
||||
CCustomMessage *m_pCustomMsgs[maxCustomMessages];
|
||||
|
||||
public:
|
||||
int Init(void);
|
||||
int VidInit( void );
|
||||
int Draw(float flTime);
|
||||
int MsgFunc_Halloween(const char *pszName, int iSize, void *pbuf);
|
||||
int CenterPos(char *szMessage);
|
||||
void MessageAdd( int type, float time, char *text );
|
||||
void Reset( void );
|
||||
|
||||
~CHudHalloween();
|
||||
};
|
||||
// Pongles ]
|
|
@ -0,0 +1,158 @@
|
|||
//mp3 support added by Killar
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "mp3.h"
|
||||
|
||||
int CMP3::Initialize()
|
||||
{
|
||||
|
||||
char fmodlib[256];
|
||||
|
||||
m_iIsPlaying = 0;
|
||||
sprintf( fmodlib, "%s/fmod.dll", gEngfuncs.pfnGetGameDirectory());
|
||||
// replace forward slashes with backslashes
|
||||
for( int i=0; i < 256; i++ )
|
||||
if( fmodlib[i] == '/' ) fmodlib[i] = '\\';
|
||||
|
||||
m_hFMod = LoadLibrary( fmodlib );
|
||||
|
||||
if( m_hFMod != NULL )
|
||||
{
|
||||
// fill in the function pointers
|
||||
// (FARPROC&)VER = GetProcAddress(m_hFMod, "_FSOUND_GetVersion@0");
|
||||
(FARPROC&)SCL = GetProcAddress(m_hFMod, "_FSOUND_Stream_Close@4");
|
||||
(FARPROC&)SOP = GetProcAddress(m_hFMod, "_FSOUND_SetOutput@4");
|
||||
(FARPROC&)SBS = GetProcAddress(m_hFMod, "_FSOUND_SetBufferSize@4");
|
||||
(FARPROC&)SDRV = GetProcAddress(m_hFMod, "_FSOUND_SetDriver@4");
|
||||
(FARPROC&)INIT = GetProcAddress(m_hFMod, "_FSOUND_Init@12");
|
||||
(FARPROC&)SOF = GetProcAddress(m_hFMod, "_FSOUND_Stream_OpenFile@12"); //
|
||||
// (FARPROC&)LNGTH = GetProcAddress(m_hFMod, "_FSOUND_Stream_GetLength@4"); //
|
||||
(FARPROC&)SO = GetProcAddress(m_hFMod, "_FSOUND_Stream_Open@16"); //AJH Use new version of fmod
|
||||
(FARPROC&)SPLAY = GetProcAddress(m_hFMod, "_FSOUND_Stream_Play@8");
|
||||
(FARPROC&)CLOSE = GetProcAddress(m_hFMod, "_FSOUND_Close@0");
|
||||
|
||||
if( !(SCL && SOP && SBS && SDRV && INIT && (SOF||SO) && SPLAY && CLOSE) )
|
||||
{
|
||||
FreeLibrary( m_hFMod );
|
||||
gEngfuncs.Con_Printf("Fatal Error: FMOD functions couldn't be loaded!\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
gEngfuncs.Con_Printf("Fatal Error: FMOD library couldn't be loaded!\n");
|
||||
return 0;
|
||||
}
|
||||
gEngfuncs.Con_Printf("FMOD.dll loaded successfully!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CMP3::Shutdown()
|
||||
{
|
||||
if( m_hFMod )
|
||||
{
|
||||
CLOSE();
|
||||
|
||||
FreeLibrary( m_hFMod );
|
||||
m_hFMod = NULL;
|
||||
m_iIsPlaying = 0;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CMP3::StopMP3( void )
|
||||
{
|
||||
SCL( m_Stream );
|
||||
m_iIsPlaying = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CMP3::PlayMP3( const char *pszSong )
|
||||
{
|
||||
if( m_iIsPlaying )
|
||||
{
|
||||
// sound system is already initialized
|
||||
SCL( m_Stream );
|
||||
}
|
||||
else
|
||||
{
|
||||
SOP( FSOUND_OUTPUT_DSOUND );
|
||||
SBS( 200 );
|
||||
SDRV( 0 );
|
||||
INIT( 44100, 3, 0 ); // we need just one channel, multiple mp3s at a time would be, erm, strange...
|
||||
}//AJH not for really cool effects, say walking past cars in a street playing different tunes, might change this later.
|
||||
|
||||
char song[256];
|
||||
|
||||
sprintf( song, "%s/%s", gEngfuncs.pfnGetGameDirectory(), pszSong);
|
||||
|
||||
//gEngfuncs.Con_Printf("Using fmod.dll version %f\n",VER());
|
||||
|
||||
if (SO)
|
||||
{
|
||||
m_Stream = SO( song, FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 0 ,0); //AJH new version fmod uses Open
|
||||
}
|
||||
else if( SOF )
|
||||
{
|
||||
m_Stream = SOF( song, FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 1 ); //AJH old version fmod OpenFile
|
||||
}
|
||||
if(m_Stream)
|
||||
{
|
||||
SPLAY( 0, m_Stream );
|
||||
m_iIsPlaying = 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iIsPlaying = 0;
|
||||
gEngfuncs.Con_Printf("Error: Could not load %s\n",song);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int CMP3::PlayMP3NL( const char *pszSong )
|
||||
{
|
||||
if( m_iIsPlaying )
|
||||
{
|
||||
// sound system is already initialized
|
||||
SCL( m_Stream );
|
||||
}
|
||||
else
|
||||
{
|
||||
SOP( FSOUND_OUTPUT_DSOUND );
|
||||
SBS( 200 );
|
||||
SDRV( 0 );
|
||||
INIT( 44100, 3, 0 ); // we need just one channel, multiple mp3s at a time would be, erm, strange...
|
||||
}//AJH not for really cool effects, say walking past cars in a street playing different tunes, might change this later.
|
||||
|
||||
char song[256];
|
||||
|
||||
sprintf( song, "%s/%s", gEngfuncs.pfnGetGameDirectory(), pszSong);
|
||||
|
||||
//gEngfuncs.Con_Printf("Using fmod.dll version %f\n",VER());
|
||||
|
||||
if (SO)
|
||||
{
|
||||
m_Stream = SO( song, FSOUND_NORMAL | FSOUND_LOOP_OFF, 0 ,0); //AJH new version fmod uses Open
|
||||
}
|
||||
else if( SOF )
|
||||
{
|
||||
m_Stream = SOF( song, FSOUND_NORMAL | FSOUND_LOOP_OFF, 1 ); //AJH old version fmod OpenFile
|
||||
}
|
||||
if(m_Stream)
|
||||
{
|
||||
SPLAY( 0, m_Stream );
|
||||
m_iIsPlaying = 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iIsPlaying = 0;
|
||||
gEngfuncs.Con_Printf("Error: Could not load %s\n",song);
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// mp3 support added by Killar
|
||||
|
||||
#ifndef MP3_H
|
||||
#define MP3_H
|
||||
|
||||
#include "fmod.h"
|
||||
#include "fmod_errors.h"
|
||||
#include "windows.h"
|
||||
|
||||
class CMP3
|
||||
{
|
||||
private:
|
||||
float (_stdcall * VER) (void);//AJH get fmod dll version
|
||||
signed char (_stdcall * SCL) (FSOUND_STREAM *stream);
|
||||
signed char (_stdcall * SOP) (int outputtype);
|
||||
signed char (_stdcall * SBS) (int len_ms);
|
||||
signed char (_stdcall * SDRV) (int driver);
|
||||
signed char (_stdcall * INIT) (int mixrate, int maxsoftwarechannels, unsigned int flags);
|
||||
FSOUND_STREAM* (_stdcall * SOF) (const char *filename, unsigned int mode,int memlength); //AJH old fmod
|
||||
FSOUND_STREAM* (_stdcall * SO) (const char *filename, unsigned int mode,int offset, int memlength); //AJH use new fmod
|
||||
int (_stdcall * SPLAY) (int channel, FSOUND_STREAM *stream);
|
||||
void (_stdcall * CLOSE) ( void );
|
||||
|
||||
FSOUND_STREAM *m_Stream;
|
||||
int m_iIsPlaying;
|
||||
HINSTANCE m_hFMod;
|
||||
|
||||
public:
|
||||
int Initialize();
|
||||
int Shutdown();
|
||||
int PlayMP3( const char *pszSong );
|
||||
int PlayMP3NL( const char *pszSong );
|
||||
int StopMP3();
|
||||
};
|
||||
|
||||
extern CMP3 gMP3;
|
||||
#endif
|
|
@ -0,0 +1,441 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// Message.cpp
|
||||
//
|
||||
// implementation of CHudTestText class
|
||||
//
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "parsemsg.h"
|
||||
|
||||
DECLARE_MESSAGE( m_TestText, TestText )
|
||||
|
||||
int CHudTestText::Init(void)
|
||||
{
|
||||
HOOK_MESSAGE( TestText );
|
||||
|
||||
gHUD.AddHudElem(this);
|
||||
|
||||
Reset();
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
int CHudTestText::VidInit( void )
|
||||
{
|
||||
m_HUD_title_test = gHUD.GetSpriteIndex( "title_test" );
|
||||
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
void CHudTestText::Reset( void )
|
||||
{
|
||||
memset( m_pMessages, 0, sizeof( m_pMessages[0] ) * maxHUDMessages );
|
||||
memset( m_startTime, 0, sizeof( m_startTime[0] ) * maxHUDMessages );
|
||||
|
||||
m_gameTitleTime = 0;
|
||||
m_pGameTitle = NULL;
|
||||
}
|
||||
|
||||
|
||||
float CHudTestText::FadeBlend( float fadein, float fadeout, float hold, float localTime )
|
||||
{
|
||||
float fadeTime = fadein + hold;
|
||||
float fadeBlend;
|
||||
|
||||
if ( localTime < 0 )
|
||||
return 0;
|
||||
|
||||
if ( localTime < fadein )
|
||||
{
|
||||
fadeBlend = 1 - ((fadein - localTime) / fadein);
|
||||
}
|
||||
else if ( localTime > fadeTime )
|
||||
{
|
||||
if ( fadeout > 0 )
|
||||
fadeBlend = 1 - ((localTime - fadeTime) / fadeout);
|
||||
else
|
||||
fadeBlend = 0;
|
||||
}
|
||||
else
|
||||
fadeBlend = 1;
|
||||
|
||||
return fadeBlend;
|
||||
}
|
||||
|
||||
|
||||
int CHudTestText::XPosition( float x, int width, int totalWidth )
|
||||
{
|
||||
int xPos;
|
||||
|
||||
if ( x == -1 )
|
||||
{
|
||||
xPos = (ScreenWidth - width) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( x < 0 )
|
||||
xPos = (1.0 + x) * ScreenWidth - totalWidth; // Alight right
|
||||
else
|
||||
xPos = x * ScreenWidth;
|
||||
}
|
||||
|
||||
if ( xPos + width > ScreenWidth )
|
||||
xPos = ScreenWidth - width;
|
||||
else if ( xPos < 0 )
|
||||
xPos = 0;
|
||||
|
||||
return xPos;
|
||||
}
|
||||
|
||||
|
||||
int CHudTestText::YPosition( float y, int height )
|
||||
{
|
||||
int yPos;
|
||||
|
||||
if ( y == -1 ) // Centered?
|
||||
yPos = (ScreenHeight - height) * 0.5;
|
||||
else
|
||||
{
|
||||
// Alight bottom?
|
||||
if ( y < 0 )
|
||||
yPos = (1.0 + y) * ScreenHeight - height; // Alight bottom
|
||||
else // align top
|
||||
yPos = y * ScreenHeight;
|
||||
}
|
||||
|
||||
if ( yPos + height > ScreenHeight )
|
||||
yPos = ScreenHeight - height;
|
||||
else if ( yPos < 0 )
|
||||
yPos = 0;
|
||||
|
||||
return yPos;
|
||||
}
|
||||
|
||||
|
||||
void CHudTestText::MessageScanNextChar( void )
|
||||
{
|
||||
int srcRed, srcGreen, srcBlue, destRed, destGreen, destBlue;
|
||||
int blend;
|
||||
|
||||
srcRed = m_parms.pMessage->r1;
|
||||
srcGreen = m_parms.pMessage->g1;
|
||||
srcBlue = m_parms.pMessage->b1;
|
||||
blend = 0; // Pure source
|
||||
|
||||
switch( m_parms.pMessage->effect )
|
||||
{
|
||||
// Fade-in / Fade-out
|
||||
case 0:
|
||||
case 1:
|
||||
destRed = destGreen = destBlue = 0;
|
||||
blend = m_parms.fadeBlend;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_parms.charTime += m_parms.pMessage->fadein;
|
||||
if ( m_parms.charTime > m_parms.time )
|
||||
{
|
||||
srcRed = srcGreen = srcBlue = 0;
|
||||
blend = 0; // pure source
|
||||
}
|
||||
else
|
||||
{
|
||||
float deltaTime = m_parms.time - m_parms.charTime;
|
||||
|
||||
destRed = destGreen = destBlue = 0;
|
||||
if ( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
blend = m_parms.fadeBlend;
|
||||
}
|
||||
else if ( deltaTime > m_parms.pMessage->fxtime )
|
||||
blend = 0; // pure dest
|
||||
else
|
||||
{
|
||||
destRed = m_parms.pMessage->r2;
|
||||
destGreen = m_parms.pMessage->g2;
|
||||
destBlue = m_parms.pMessage->b2;
|
||||
blend = 255 - (deltaTime * (1.0/m_parms.pMessage->fxtime) * 255.0 + 0.5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ( blend > 255 )
|
||||
blend = 255;
|
||||
else if ( blend < 0 )
|
||||
blend = 0;
|
||||
|
||||
m_parms.r = ((srcRed * (255-blend)) + (destRed * blend)) >> 8;
|
||||
m_parms.g = ((srcGreen * (255-blend)) + (destGreen * blend)) >> 8;
|
||||
m_parms.b = ((srcBlue * (255-blend)) + (destBlue * blend)) >> 8;
|
||||
|
||||
if ( m_parms.pMessage->effect == 1 && m_parms.charTime != 0 )
|
||||
{
|
||||
if ( m_parms.x >= 0 && m_parms.y >= 0 && (m_parms.x + gHUD.m_scrinfo.charWidths[ m_parms.text ]) <= ScreenWidth )
|
||||
TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.pMessage->r2, m_parms.pMessage->g2, m_parms.pMessage->b2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CHudTestText::MessageScanStart( void )
|
||||
{
|
||||
switch( m_parms.pMessage->effect )
|
||||
{
|
||||
// Fade-in / out with flicker
|
||||
case 1:
|
||||
case 0:
|
||||
m_parms.fadeTime = m_parms.pMessage->fadein + m_parms.pMessage->holdtime;
|
||||
|
||||
|
||||
if ( m_parms.time < m_parms.pMessage->fadein )
|
||||
{
|
||||
m_parms.fadeBlend = ((m_parms.pMessage->fadein - m_parms.time) * (1.0/m_parms.pMessage->fadein) * 255);
|
||||
}
|
||||
else if ( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
if ( m_parms.pMessage->fadeout > 0 )
|
||||
m_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);
|
||||
else
|
||||
m_parms.fadeBlend = 255; // Pure dest (off)
|
||||
}
|
||||
else
|
||||
m_parms.fadeBlend = 0; // Pure source (on)
|
||||
m_parms.charTime = 0;
|
||||
|
||||
if ( m_parms.pMessage->effect == 1 && (rand()%100) < 10 )
|
||||
m_parms.charTime = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_parms.fadeTime = (m_parms.pMessage->fadein * m_parms.length) + m_parms.pMessage->holdtime;
|
||||
|
||||
if ( m_parms.time > m_parms.fadeTime && m_parms.pMessage->fadeout > 0 )
|
||||
m_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);
|
||||
else
|
||||
m_parms.fadeBlend = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CHudTestText::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
||||
{
|
||||
int i, j, length, width;
|
||||
const char *pText;
|
||||
unsigned char line[80];
|
||||
|
||||
pText = pMessage->pMessage;
|
||||
// Count lines
|
||||
m_parms.lines = 1;
|
||||
m_parms.time = time;
|
||||
m_parms.pMessage = pMessage;
|
||||
length = 0;
|
||||
width = 0;
|
||||
m_parms.totalWidth = 0;
|
||||
while ( *pText )
|
||||
{
|
||||
if ( *pText == '\n' )
|
||||
{
|
||||
m_parms.lines++;
|
||||
if ( width > m_parms.totalWidth )
|
||||
m_parms.totalWidth = width;
|
||||
width = 0;
|
||||
}
|
||||
else
|
||||
width += gHUD.m_scrinfo.charWidths[*pText];
|
||||
pText++;
|
||||
length++;
|
||||
}
|
||||
m_parms.length = length;
|
||||
m_parms.totalHeight = (m_parms.lines * gHUD.m_scrinfo.iCharHeight);
|
||||
|
||||
|
||||
m_parms.y = YPosition( pMessage->y, m_parms.totalHeight );
|
||||
pText = pMessage->pMessage;
|
||||
|
||||
m_parms.charTime = 0;
|
||||
|
||||
MessageScanStart();
|
||||
|
||||
for ( i = 0; i < m_parms.lines; i++ )
|
||||
{
|
||||
m_parms.lineLength = 0;
|
||||
m_parms.width = 0;
|
||||
while ( *pText && *pText != '\n' )
|
||||
{
|
||||
unsigned char c = *pText;
|
||||
line[m_parms.lineLength] = c;
|
||||
m_parms.width += gHUD.m_scrinfo.charWidths[c];
|
||||
m_parms.lineLength++;
|
||||
pText++;
|
||||
}
|
||||
pText++; // Skip LF
|
||||
line[m_parms.lineLength] = 0;
|
||||
|
||||
m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth );
|
||||
|
||||
for ( j = 0; j < m_parms.lineLength; j++ )
|
||||
{
|
||||
m_parms.text = line[j];
|
||||
int next = m_parms.x + gHUD.m_scrinfo.charWidths[ m_parms.text ];
|
||||
MessageScanNextChar();
|
||||
|
||||
if ( m_parms.x >= 0 && m_parms.y >= 0 && next <= ScreenWidth )
|
||||
TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.r, m_parms.g, m_parms.b );
|
||||
m_parms.x = next;
|
||||
}
|
||||
|
||||
m_parms.y += gHUD.m_scrinfo.iCharHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CHudTestText::Draw( float fTime )
|
||||
{
|
||||
int i, drawn;
|
||||
client_textmessage_t *pMessage;
|
||||
float endTime;
|
||||
|
||||
drawn = 0;
|
||||
|
||||
if ( m_gameTitleTime > 0 )
|
||||
{
|
||||
float localTime = gHUD.m_flTime - m_gameTitleTime;
|
||||
float brightness;
|
||||
|
||||
// Maybe timer isn't set yet
|
||||
if ( m_gameTitleTime > gHUD.m_flTime )
|
||||
m_gameTitleTime = gHUD.m_flTime;
|
||||
|
||||
if ( localTime > (m_pGameTitle->fadein + m_pGameTitle->holdtime + m_pGameTitle->fadeout) )
|
||||
m_gameTitleTime = 0;
|
||||
else
|
||||
{
|
||||
brightness = FadeBlend( m_pGameTitle->fadein, m_pGameTitle->fadeout, m_pGameTitle->holdtime, localTime );
|
||||
|
||||
//int halfWidth = gHUD.GetSpriteRect(m_HUD_title_test).right - gHUD.GetSpriteRect(m_HUD_title_test).left;
|
||||
int fullWidth = 128 + gHUD.GetSpriteRect(m_HUD_title_test).right - gHUD.GetSpriteRect(m_HUD_title_test).left;
|
||||
int fullHeight = gHUD.GetSpriteRect(m_HUD_title_test).bottom - gHUD.GetSpriteRect(m_HUD_title_test).top;
|
||||
|
||||
int x = XPosition( m_pGameTitle->x, fullWidth, fullWidth );
|
||||
int y = YPosition( m_pGameTitle->y, fullHeight );
|
||||
|
||||
|
||||
SPR_Set( gHUD.GetSprite(m_HUD_title_test), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
|
||||
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_title_test) );
|
||||
|
||||
drawn = 1;
|
||||
}
|
||||
}
|
||||
// Fixup level transitions
|
||||
for ( i = 0; i < maxHUDMessages; i++ )
|
||||
{
|
||||
// Assume m_parms.time contains last time
|
||||
if ( m_pMessages[i] )
|
||||
{
|
||||
pMessage = m_pMessages[i];
|
||||
if ( m_startTime[i] > gHUD.m_flTime )
|
||||
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2; // Server takes 0.2 seconds to spawn, adjust for this
|
||||
}
|
||||
}
|
||||
|
||||
for ( i = 0; i < maxHUDMessages; i++ )
|
||||
{
|
||||
if ( m_pMessages[i] )
|
||||
{
|
||||
pMessage = m_pMessages[i];
|
||||
|
||||
// This is when the message is over
|
||||
switch( pMessage->effect )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
endTime = m_startTime[i] + pMessage->fadein + pMessage->fadeout + pMessage->holdtime;
|
||||
break;
|
||||
|
||||
// Fade in is per character in scanning messages
|
||||
case 2:
|
||||
endTime = m_startTime[i] + (pMessage->fadein * strlen( pMessage->pMessage )) + pMessage->fadeout + pMessage->holdtime;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( fTime <= endTime )
|
||||
{
|
||||
float messageTime = fTime - m_startTime[i];
|
||||
|
||||
// Draw the message
|
||||
// effect 0 is fade in/fade out
|
||||
// effect 1 is flickery credits
|
||||
// effect 2 is write out (training room)
|
||||
MessageDrawScan( pMessage, messageTime );
|
||||
|
||||
drawn++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The message is over
|
||||
m_pMessages[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remember the time -- to fix up level transitions
|
||||
m_parms.time = gHUD.m_flTime;
|
||||
// Don't call until we get another message
|
||||
if ( !drawn )
|
||||
m_iFlags &= ~HUD_ACTIVE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudTestText::MsgFunc_TestText (const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
m_pGameTitle = TextMessageGet( "GAMETITLE" );
|
||||
if ( m_pGameTitle != NULL )
|
||||
{
|
||||
m_gameTitleTime = gHUD.m_flTime;
|
||||
|
||||
// Turn on drawing
|
||||
if ( !(m_iFlags & HUD_ACTIVE) )
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CHudTestText::MessageAdd(client_textmessage_t * newMessage )
|
||||
{
|
||||
m_parms.time = gHUD.m_flTime;
|
||||
|
||||
// Turn on drawing
|
||||
if ( !(m_iFlags & HUD_ACTIVE) )
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
|
||||
for ( int i = 0; i < maxHUDMessages; i++ )
|
||||
{
|
||||
if ( !m_pMessages[i] )
|
||||
{
|
||||
m_pMessages[i] = newMessage;
|
||||
m_startTime[i] = gHUD.m_flTime;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
//========= Copyright © 2011, Half-Screwed Team, Released under the "Do whatever you want" license. ============//
|
||||
// //
|
||||
// Purpose: //
|
||||
// //
|
||||
// $NoKeywords: $ //
|
||||
//====================================================================================================//
|
||||
|
||||
//THIS IS CURRENTLY BROKEN IN THE DLL SIDE. IT CAUSED LOTS OF LAG.
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "parsemsg.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "mp3.h"
|
||||
|
||||
int g_iRoundtime;
|
||||
int smbSoundCounter = 0; //This will count up, where when it hits 5 it'll play a sound.
|
||||
|
||||
DECLARE_MESSAGE(m_Timer, Timer)
|
||||
int CHudTimer::Init(void)
|
||||
{
|
||||
HOOK_MESSAGE( Timer );
|
||||
gHUD.AddHudElem(this);
|
||||
return 1;
|
||||
};
|
||||
|
||||
int CHudTimer::VidInit(void)
|
||||
{
|
||||
gHUD.m_iRoundtime = -1;
|
||||
g_hud_timerbg = gHUD.GetSpriteIndex( "nestimerbg" );
|
||||
g_hud_timercolon = gHUD.GetSpriteIndex( "nestime" );
|
||||
return 1;
|
||||
};
|
||||
|
||||
int CHudTimer::MsgFunc_Timer( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
int x = READ_LONG();
|
||||
g_iRoundtime = x;
|
||||
gHUD.m_iRoundtime = x;
|
||||
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudTimer::Draw( float flTime )
|
||||
{
|
||||
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
|
||||
return 1;
|
||||
|
||||
if (!(gHUD.m_iWeaponBits & (1 <<(WEAPON_SUIT)) ))
|
||||
return 1;
|
||||
|
||||
if(g_iRoundtime > 0) //no negative numbers allowed
|
||||
{
|
||||
if (g_iRoundtime == 120)
|
||||
{
|
||||
smbSoundCounter += 1; //Start the countup to the super mario sound effect
|
||||
}
|
||||
if (smbSoundCounter == 5) //Note: the counter will still continue until 120 seconds turns into 119.
|
||||
{
|
||||
char * songchoice = "media/hurryup.mp3";
|
||||
gMP3.PlayMP3NL( songchoice );
|
||||
}
|
||||
//Draw BG
|
||||
SPR_Set(gHUD.GetSprite(g_hud_timerbg), 255, 255, 255 );
|
||||
SPR_Draw(0, (ScreenWidth/2-69), 0, &gHUD.GetSpriteRect(g_hud_timerbg));
|
||||
|
||||
gHUD.DrawHudNumberNES((ScreenWidth/2)-44, 20, DHN_2DIGITS | DHN_PREZERO, g_iRoundtime/60, 255, 255, 255);
|
||||
//Draw the numbers
|
||||
SPR_Set(gHUD.GetSprite(g_hud_timercolon), 255, 255, 255 );
|
||||
SPR_Draw(0, (ScreenWidth/2)-4, 20, &gHUD.GetSpriteRect(g_hud_timercolon));
|
||||
//Draw a String in this case ':'
|
||||
gHUD.DrawHudNumberNES((ScreenWidth/2)+6, 20, DHN_2DIGITS | DHN_PREZERO, g_iRoundtime%60, 255, 255, 255);
|
||||
}
|
||||
else //If the round is over write it, add something -- GOAHEAD
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (smbSoundCounter >= 0 && g_iRoundtime > 120) //If server manually changed the round time or new round, Reset the sound timer.
|
||||
{
|
||||
smbSoundCounter = 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "demo.h"
|
||||
#include "demo_api.h"
|
||||
//#include "mp3.h"
|
||||
|
||||
cvar_t *hud_textmode;
|
||||
float g_hud_text_color[3];
|
||||
|
@ -77,6 +78,26 @@ int __MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
|||
return gHUD.MsgFunc_GameMode( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
int __MsgFunc_PlayMP3(const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return gHUD.MsgFunc_PlayMP3( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
int __MsgFunc_PlayBGM(const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return gHUD.MsgFunc_PlayBGM( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
int __MsgFunc_StopMP3(const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return gHUD.MsgFunc_StopMP3( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
int __MsgFunc_AddELight(const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return gHUD.MsgFunc_AddELight( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
// TFFree Command Menu
|
||||
void __CmdFunc_OpenCommandMenu( void )
|
||||
{
|
||||
|
@ -99,6 +120,11 @@ void __CmdFunc_ToggleServerBrowser( void )
|
|||
{
|
||||
}
|
||||
|
||||
void __CmdFunc_StopMP3( void )
|
||||
{
|
||||
//gMP3.StopMP3();
|
||||
}
|
||||
|
||||
// TFFree Command Menu Message Handlers
|
||||
int __MsgFunc_ValClass( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
|
@ -160,6 +186,19 @@ void CHud::Init( void )
|
|||
HOOK_MESSAGE( ViewMode );
|
||||
HOOK_MESSAGE( SetFOV );
|
||||
HOOK_MESSAGE( Concuss );
|
||||
HOOK_MESSAGE( AddELight );
|
||||
|
||||
//HOOK_MESSAGE( PlayMP3 );
|
||||
//gMP3.Initialize();
|
||||
|
||||
//KILLAR: MP3
|
||||
if( gMP3.Initialize() )
|
||||
{
|
||||
HOOK_MESSAGE( PlayMP3 );
|
||||
HOOK_MESSAGE( PlayBGM );
|
||||
HOOK_MESSAGE( StopMP3 );
|
||||
HOOK_COMMAND( "stopaudio", StopMP3 );
|
||||
}
|
||||
|
||||
// TFFree CommandMenu
|
||||
HOOK_COMMAND( "+commandmenu", OpenCommandMenu );
|
||||
|
@ -186,6 +225,13 @@ void CHud::Init( void )
|
|||
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
|
||||
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );
|
||||
|
||||
CVAR_CREATE( "hud_red","0", FCVAR_ARCHIVE ); // Hud Color RED!
|
||||
CVAR_CREATE( "hud_green", "200", FCVAR_ARCHIVE ); // Hud Color GREEN!
|
||||
CVAR_CREATE( "hud_blue", "20", FCVAR_ARCHIVE ); // Hud Color BLUE!
|
||||
//CVAR_CREATE( "hud_purple", "999", FCVAR_ARCHIVE ); // Hud Color PURPLE, wait..
|
||||
|
||||
CVAR_CREATE( "hud_bgm", "1", FCVAR_ARCHIVE ); // Play Map BGM
|
||||
|
||||
m_iLogo = 0;
|
||||
m_iFOV = 0;
|
||||
|
||||
|
@ -213,6 +259,7 @@ void CHud::Init( void )
|
|||
// In case we get messages before the first update -- time will be valid
|
||||
m_flTime = 1.0;
|
||||
|
||||
m_Timer.Init();
|
||||
m_Ammo.Init();
|
||||
m_Health.Init();
|
||||
m_SayText.Init();
|
||||
|
@ -227,6 +274,7 @@ void CHud::Init( void )
|
|||
m_AmmoSecondary.Init();
|
||||
m_TextMessage.Init();
|
||||
m_StatusIcons.Init();
|
||||
m_COD.Init();
|
||||
m_MOTD.Init();
|
||||
m_Scoreboard.Init();
|
||||
|
||||
|
@ -378,9 +426,11 @@ void CHud::VidInit( void )
|
|||
|
||||
// assumption: number_1, number_2, etc, are all listed and loaded sequentially
|
||||
m_HUD_number_0 = GetSpriteIndex( "number_0" );
|
||||
m_HUD_number_0_NES = GetSpriteIndex( "number_0_nes" );
|
||||
|
||||
m_iFontHeight = m_rgrcRects[m_HUD_number_0].bottom - m_rgrcRects[m_HUD_number_0].top;
|
||||
|
||||
m_Timer.VidInit();
|
||||
m_Ammo.VidInit();
|
||||
m_Health.VidInit();
|
||||
m_Spectator.VidInit();
|
||||
|
@ -396,6 +446,7 @@ void CHud::VidInit( void )
|
|||
m_AmmoSecondary.VidInit();
|
||||
m_TextMessage.VidInit();
|
||||
m_StatusIcons.VidInit();
|
||||
m_COD.VidInit();
|
||||
m_Scoreboard.VidInit();
|
||||
m_MOTD.VidInit();
|
||||
}
|
||||
|
|
43
cl_dll/hud.h
43
cl_dll/hud.h
|
@ -31,6 +31,7 @@
|
|||
#define DHN_DRAWZERO 1
|
||||
#define DHN_2DIGITS 2
|
||||
#define DHN_3DIGITS 4
|
||||
#define DHN_PREZERO 8
|
||||
#define MIN_ALPHA 100
|
||||
|
||||
#define HUDELEM_ACTIVE 1
|
||||
|
@ -123,6 +124,7 @@ public:
|
|||
void _cdecl UserCmd_Close( void );
|
||||
void _cdecl UserCmd_NextWeapon( void );
|
||||
void _cdecl UserCmd_PrevWeapon( void );
|
||||
int ammo;
|
||||
|
||||
private:
|
||||
float m_fFade;
|
||||
|
@ -130,6 +132,11 @@ private:
|
|||
WEAPON *m_pWeapon;
|
||||
int m_HUD_bucket0;
|
||||
int m_HUD_selection;
|
||||
|
||||
int m_HUD_duckhunt2;
|
||||
int m_HUD_ammo1; // duck hunt
|
||||
int m_HUD_ammo2; // duck hunt
|
||||
int m_HUD_ammo3; // duck hunt
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -322,6 +329,7 @@ struct extra_player_info_t
|
|||
short deaths;
|
||||
short playerclass;
|
||||
short teamnumber;
|
||||
short hsdev;
|
||||
char teamname[MAX_TEAM_NAME];
|
||||
};
|
||||
|
||||
|
@ -360,6 +368,23 @@ private:
|
|||
int m_HUD_d_skull; // sprite index of skull icon
|
||||
};
|
||||
|
||||
|
||||
class CHudTimer: public CHudBase
|
||||
{
|
||||
public:
|
||||
int Init( void );
|
||||
int VidInit( void );
|
||||
int Draw( float flTime );
|
||||
int MsgFunc_Timer( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
int g_hud_timerbg;
|
||||
int g_hud_timercolon;
|
||||
/*
|
||||
private:
|
||||
int m_iRoundTime;
|
||||
*/
|
||||
};
|
||||
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
|
@ -415,9 +440,14 @@ public:
|
|||
private:
|
||||
HSPRITE m_hSprite1;
|
||||
HSPRITE m_hSprite2;
|
||||
int m_HUD_mgs3suitbar; // MGS3-styled suit sta.
|
||||
int m_HUD_mgs3suitdiv; // MGS3-styled suit sta divider.
|
||||
wrect_t *m_prc1;
|
||||
wrect_t *m_prc2;
|
||||
wrect_t *m_prc3;
|
||||
int m_iBat;
|
||||
int m_iWidth;
|
||||
float m_flBat;
|
||||
float m_fFade;
|
||||
int m_iHeight; // width of the battery innards
|
||||
};
|
||||
|
@ -581,6 +611,7 @@ public:
|
|||
int m_iKeyBits;
|
||||
int m_iHideHUDDisplay;
|
||||
int m_iFOV;
|
||||
int m_iRoundtime;
|
||||
int m_Teamplay;
|
||||
int m_iRes;
|
||||
cvar_t *m_pCvarStealMouse;
|
||||
|
@ -588,6 +619,7 @@ public:
|
|||
|
||||
int m_iFontHeight;
|
||||
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
||||
int DrawHudNumberNES( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
||||
int DrawHudString( int x, int y, int iMaxX, char *szString, int r, int g, int b );
|
||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b );
|
||||
int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
|
||||
|
@ -616,6 +648,7 @@ public:
|
|||
|
||||
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
|
||||
|
||||
CHudTimer m_Timer;
|
||||
CHudAmmo m_Ammo;
|
||||
CHudHealth m_Health;
|
||||
CHudSpectator m_Spectator;
|
||||
|
@ -629,6 +662,7 @@ public:
|
|||
CHudSayText m_SayText;
|
||||
CHudMenu m_Menu;
|
||||
CHudAmmoSecondary m_AmmoSecondary;
|
||||
CHudCOD m_COD;
|
||||
CHudTextMessage m_TextMessage;
|
||||
CHudStatusIcons m_StatusIcons;
|
||||
CHudScoreboard m_Scoreboard;
|
||||
|
@ -651,7 +685,11 @@ public:
|
|||
void _cdecl MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf );
|
||||
void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ); // KILLAR
|
||||
int _cdecl MsgFunc_PlayBGM( const char *pszName, int iSize, void *pbuf ); // KILLAR
|
||||
int _cdecl MsgFunc_StopMP3( const char *pszName, int iSize, void *pbuf ); // KILLAR
|
||||
int _cdecl MsgFunc_AddELight( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
// Screen information
|
||||
SCREENINFO m_scrinfo;
|
||||
|
@ -660,8 +698,11 @@ public:
|
|||
int m_fPlayerDead;
|
||||
int m_iIntermission;
|
||||
|
||||
int m_iRoundTime;
|
||||
|
||||
// sprite indexes
|
||||
int m_HUD_number_0;
|
||||
int m_HUD_number_0_NES;
|
||||
|
||||
int m_iNoConsolePrint;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// hud_msg.cpp
|
||||
//
|
||||
|
||||
//#include "mp3.h" // AJH - Killar MP3
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "parsemsg.h"
|
||||
|
@ -23,8 +24,8 @@
|
|||
|
||||
#define MAX_CLIENTS 32
|
||||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
//extern BEAM *pBeam;
|
||||
//extern BEAM *pBeam2;
|
||||
|
||||
/// USER-DEFINED SERVER MESSAGE HANDLERS
|
||||
|
||||
|
@ -71,7 +72,7 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
|||
}
|
||||
|
||||
//Probably not a good place to put this.
|
||||
pBeam = pBeam2 = NULL;
|
||||
//pBeam = pBeam2 = NULL;
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
||||
|
@ -115,3 +116,55 @@ int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
|
|||
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
int CHud::MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) //AJH -Killar MP3
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
gMP3.PlayMP3( READ_STRING() );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_PlayBGM( const char *pszName, int iSize, void *pbuf ) //AJH -Killar MP3
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
if( CVAR_GET_FLOAT( "hud_bgm" ) > 0 )
|
||||
gMP3.PlayMP3( READ_STRING() );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_StopMP3( const char *pszName, int iSize, void *pbuf ) //AJH -Killar MP3
|
||||
{
|
||||
gMP3.StopMP3();
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
int CHud::MsgFunc_AddELight( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocElight( READ_SHORT() );
|
||||
|
||||
int bELightActive = READ_BYTE();
|
||||
if( !bELightActive )
|
||||
{
|
||||
dl->die = gEngfuncs.GetClientTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
dl->die = gEngfuncs.GetClientTime() + 1E6;
|
||||
|
||||
dl->origin[0] = READ_COORD();
|
||||
dl->origin[1] = READ_COORD();
|
||||
dl->origin[2] = READ_COORD();
|
||||
dl->radius = READ_COORD();
|
||||
dl->color.r = READ_BYTE();
|
||||
dl->color.g = READ_BYTE();
|
||||
dl->color.b = READ_BYTE();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,47 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
|
||||
if( !m_iIntermission && intermission )
|
||||
{
|
||||
int ranmus;
|
||||
/*
|
||||
ranmus = gEngfuncs.pfnRandomLong( 0, 9 );
|
||||
char *songchoice;
|
||||
|
||||
switch( ranmus )
|
||||
{
|
||||
case 0:
|
||||
songchoice = "media/intermission1.mp3";
|
||||
break;
|
||||
case 1:
|
||||
songchoice = "media/intermission2.mp3";
|
||||
break;
|
||||
case 2:
|
||||
songchoice = "media/intermission3.mp3";
|
||||
break;
|
||||
case 3:
|
||||
songchoice = "media/intermission4.mp3";
|
||||
break;
|
||||
case 4:
|
||||
songchoice = "media/intermission5.mp3";
|
||||
break;
|
||||
case 5:
|
||||
songchoice = "media/intermission6.mp3";
|
||||
break;
|
||||
case 6:
|
||||
songchoice = "media/intermission7.mp3";
|
||||
break;
|
||||
case 7:
|
||||
songchoice = "media/intermission8.mp3";
|
||||
break;
|
||||
case 8:
|
||||
songchoice = "media/intermission9.mp3";
|
||||
break;
|
||||
case 9:
|
||||
songchoice = "media/intermission10.mp3";
|
||||
break;
|
||||
}
|
||||
|
||||
gMP3.PlayMP3NL( songchoice );
|
||||
*/
|
||||
// Take a screenshot if the client's got the cvar set
|
||||
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
|
||||
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
|
||||
|
@ -296,10 +337,10 @@ int CHud::DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, in
|
|||
int iWidth = GetSpriteRect( m_HUD_number_0 ).right - GetSpriteRect( m_HUD_number_0 ).left;
|
||||
int k;
|
||||
|
||||
if( iNumber > 0 )
|
||||
if( iNumber > 0 || ( ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) ) && ( iFlags &DHN_PREZERO ) ) )
|
||||
{
|
||||
// SPR_Draw 100's
|
||||
if( iNumber >= 100 )
|
||||
if( iNumber >= 100 || ( ( iFlags & DHN_3DIGITS ) && ( iFlags & DHN_PREZERO ) ) )
|
||||
{
|
||||
k = iNumber / 100;
|
||||
SPR_Set( GetSprite( m_HUD_number_0 + k ), r, g, b );
|
||||
|
@ -313,7 +354,7 @@ int CHud::DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, in
|
|||
}
|
||||
|
||||
// SPR_Draw 10's
|
||||
if( iNumber >= 10 )
|
||||
if( iNumber >= 10 || ( ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) ) && ( iFlags & DHN_PREZERO ) ) )
|
||||
{
|
||||
k = ( iNumber % 100 ) / 10;
|
||||
SPR_Set( GetSprite( m_HUD_number_0 + k ), r, g, b );
|
||||
|
@ -357,6 +398,72 @@ int CHud::DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, in
|
|||
return x;
|
||||
}
|
||||
|
||||
int CHud::DrawHudNumberNES( int x, int y, int iFlags, int iNumber, int r, int g, int b )
|
||||
{
|
||||
int iWidth = GetSpriteRect( m_HUD_number_0_NES ).right - GetSpriteRect( m_HUD_number_0_NES ).left;
|
||||
int k;
|
||||
|
||||
if( iNumber> 0 || ( ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) ) && ( iFlags &DHN_PREZERO ) ) )
|
||||
{
|
||||
// SPR_Draw 100's
|
||||
if( iNumber >= 100 || ( ( iFlags & DHN_3DIGITS ) && ( iFlags & DHN_PREZERO ) ) )
|
||||
{
|
||||
k = iNumber/100;
|
||||
SPR_Set(GetSprite( m_HUD_number_0_NES + k ), r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0_NES + k ) );
|
||||
x += iWidth;
|
||||
}
|
||||
else if( iFlags & ( DHN_3DIGITS ) )
|
||||
{
|
||||
//SPR_DrawAdditive( 0, x, y, &rc );
|
||||
x += iWidth;
|
||||
}
|
||||
|
||||
// SPR_Draw 10's
|
||||
if( iNumber >= 10 || ( ( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) ) && ( iFlags & DHN_PREZERO ) ) )
|
||||
{
|
||||
k = ( iNumber % 100 ) / 10;
|
||||
SPR_Set( GetSprite( m_HUD_number_0_NES + k ), r, g, b );
|
||||
SPR_Draw( 0, x, y, &GetSpriteRect( m_HUD_number_0_NES + k ) );
|
||||
x += iWidth;
|
||||
}
|
||||
else if( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) )
|
||||
{
|
||||
//SPR_DrawAdditive( 0, x, y, &rc );
|
||||
x += iWidth;
|
||||
}
|
||||
|
||||
// SPR_Draw ones
|
||||
k = iNumber % 10;
|
||||
SPR_Set( GetSprite( m_HUD_number_0_NES + k ), r, g, b );
|
||||
SPR_Draw( 0, x, y, &GetSpriteRect( m_HUD_number_0_NES + k ) );
|
||||
x += iWidth;
|
||||
}
|
||||
else if( iFlags & DHN_DRAWZERO )
|
||||
{
|
||||
SPR_Set( GetSprite( m_HUD_number_0_NES ), r, g, b );
|
||||
|
||||
// SPR_Draw 100's
|
||||
if( iFlags & ( DHN_3DIGITS ) )
|
||||
{
|
||||
//SPR_DrawAdditive( 0, x, y, &rc );
|
||||
x += iWidth;
|
||||
}
|
||||
|
||||
if( iFlags & (DHN_3DIGITS | DHN_2DIGITS ) )
|
||||
{
|
||||
//SPR_DrawAdditive( 0, x, y, &rc );
|
||||
x += iWidth;
|
||||
}
|
||||
|
||||
// SPR_Draw ones
|
||||
SPR_Draw( 0, x, y, &GetSpriteRect( m_HUD_number_0_NES ) );
|
||||
x += iWidth;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
int CHud::GetNumWidth( int iNumber, int iFlags )
|
||||
{
|
||||
if( iFlags & ( DHN_3DIGITS ) )
|
||||
|
|
|
@ -459,7 +459,7 @@ void CAM_OutUp( void )
|
|||
void CAM_ToThirdPerson( void )
|
||||
{
|
||||
vec3_t viewangles;
|
||||
#if !defined( _DEBUG )
|
||||
#if 0
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
// no thirdperson in multiplayer.
|
||||
|
@ -516,9 +516,9 @@ void CAM_Init( void )
|
|||
|
||||
cam_command = gEngfuncs.pfnRegisterVariable( "cam_command", "0", 0 ); // tells camera to go to thirdperson
|
||||
cam_snapto = gEngfuncs.pfnRegisterVariable( "cam_snapto", "0", 0 ); // snap to thirdperson view
|
||||
cam_idealyaw = gEngfuncs.pfnRegisterVariable( "cam_idealyaw", "90", 0 ); // thirdperson yaw
|
||||
cam_idealyaw = gEngfuncs.pfnRegisterVariable( "cam_idealyaw", "0", 0 ); // thirdperson yaw
|
||||
cam_idealpitch = gEngfuncs.pfnRegisterVariable( "cam_idealpitch", "0", 0 ); // thirperson pitch
|
||||
cam_idealdist = gEngfuncs.pfnRegisterVariable( "cam_idealdist", "64", 0 ); // thirdperson distance
|
||||
cam_idealdist = gEngfuncs.pfnRegisterVariable( "cam_idealdist", "128", 0 ); // thirdperson distance
|
||||
cam_contain = gEngfuncs.pfnRegisterVariable( "cam_contain", "0", 0 ); // contain camera to world
|
||||
|
||||
c_maxpitch = gEngfuncs.pfnRegisterVariable( "c_maxpitch", "90.0", 0 );
|
||||
|
|
|
@ -433,6 +433,14 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
// view is the weapon model (only visible from inside body)
|
||||
view = gEngfuncs.GetViewModel();
|
||||
|
||||
//I ain't Care -- Dethklan
|
||||
view->curstate.rendermode = ent->curstate.rendermode;
|
||||
view->curstate.renderfx = ent->curstate.renderfx;
|
||||
view->curstate.rendercolor.r = ent->curstate.rendercolor.r;
|
||||
view->curstate.rendercolor.b = ent->curstate.rendercolor.b;
|
||||
view->curstate.rendercolor.g = ent->curstate.rendercolor.g;
|
||||
view->curstate.renderamt = ent->curstate.renderamt;
|
||||
|
||||
// transform the view offset by the model's matrix to get the offset from
|
||||
// model origin for the view
|
||||
bob = V_CalcBob( pparams );
|
||||
|
|
|
@ -590,7 +590,7 @@ void CAGrunt::Spawn()
|
|||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_GREEN;
|
||||
pev->effects = 0;
|
||||
pev->health = gSkillData.agruntHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.agruntHealth, 3 );
|
||||
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_afCapability = 0;
|
||||
|
|
|
@ -128,7 +128,7 @@ void CApache::Spawn( void )
|
|||
|
||||
pev->flags |= FL_MONSTER;
|
||||
pev->takedamage = DAMAGE_AIM;
|
||||
pev->health = gSkillData.apacheHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.apacheHealth, 3 );
|
||||
|
||||
m_flFieldOfView = -0.707; // 270 degrees
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "scripted.h"
|
||||
#include "weapons.h"
|
||||
#include "soundent.h"
|
||||
#include "time.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
|
@ -254,7 +256,18 @@ int CBarney::ISoundMask( void)
|
|||
//=========================================================
|
||||
int CBarney::Classify( void )
|
||||
{
|
||||
return CLASS_PLAYER_ALLY;
|
||||
if( g_pGameRules->IsTest() && testmonsters.value <= 0 )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
else if( g_pGameRules->IsMonster() )
|
||||
{
|
||||
return CLASS_MONSTERHUNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CLASS_PLAYER_ALLY;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -395,13 +408,27 @@ void CBarney::Spawn()
|
|||
{
|
||||
Precache();
|
||||
|
||||
SET_MODEL( ENT( pev ), "models/barney.mdl" );
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
// This looks ugly - GOAHEAD
|
||||
if( ( sysDate->wMonth == 12 && sysDate->wDay == 25 ) || (sysDate->wMonth == 12 && sysDate->wDay == 24 ) || (sysDate->wMonth == 12 && sysDate->wDay == 23 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
{
|
||||
SET_MODEL( ENT( pev ), "models/barneyxmas.mdl" );
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_MODEL( ENT( pev ), "models/barney.mdl" );
|
||||
}
|
||||
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
pev->health = gSkillData.barneyHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.barneyHealth, 3 );;
|
||||
pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
@ -421,6 +448,7 @@ void CBarney::Spawn()
|
|||
void CBarney::Precache()
|
||||
{
|
||||
PRECACHE_MODEL( "models/barney.mdl" );
|
||||
PRECACHE_MODEL( "models/barneyxmas.mdl" );
|
||||
|
||||
PRECACHE_SOUND( "barney/ba_attack1.wav" );
|
||||
PRECACHE_SOUND( "barney/ba_attack2.wav" );
|
||||
|
@ -616,8 +644,9 @@ void CBarney::Killed( entvars_t *pevAttacker, int iGib )
|
|||
|
||||
GetAttachment( 0, vecGunPos, vecGunAngles );
|
||||
|
||||
CBaseEntity *pGun = DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
||||
}
|
||||
if( g_pGameRules->IsSinglePlayer() )
|
||||
CBaseEntity *pGun = DropItem( "weapon_9mmhandgun", vecGunPos, vecGunAngles );
|
||||
} // Ends the if there not anything else
|
||||
|
||||
SetUse( NULL );
|
||||
CTalkMonster::Killed( pevAttacker, iGib );
|
||||
|
@ -782,6 +811,7 @@ public:
|
|||
|
||||
void KeyValue( KeyValueData *pkvd );
|
||||
|
||||
void TalkDead( void );
|
||||
int m_iPose;// which sequence to display -- temporary, don't need to save
|
||||
static char *m_szPoses[3];
|
||||
};
|
||||
|
@ -817,10 +847,15 @@ void CDeadBarney::Spawn()
|
|||
pev->sequence = LookupSequence( m_szPoses[m_iPose] );
|
||||
if( pev->sequence == -1 )
|
||||
{
|
||||
ALERT( at_console, "Dead barney with bad pose\n" );
|
||||
ALERT( at_console, "Dead barney with bad pose\nFIX IT NOW\n" );
|
||||
}
|
||||
// Corpses have less health
|
||||
pev->health = 8;//gSkillData.barneyHealth;
|
||||
|
||||
MonsterInitDead();
|
||||
}
|
||||
|
||||
void CDeadBarney::TalkDead( void )
|
||||
{
|
||||
PlaySentence( "BA_POK", 2, VOL_NORM, ATTN_NORM );
|
||||
}
|
||||
|
|
|
@ -150,6 +150,8 @@ public:
|
|||
virtual BOOL FInViewCone( Vector *pOrigin );// see if given location is in monster's view cone
|
||||
virtual void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
|
||||
virtual float GetHealth( float health, float multi ); // Monster Hunt only
|
||||
|
||||
virtual int CheckLocalMove ( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist );// check validity of a straight move through space
|
||||
virtual void Move( float flInterval = 0.1 );
|
||||
virtual void MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval );
|
||||
|
|
11
dlls/cbase.h
11
dlls/cbase.h
|
@ -102,6 +102,9 @@ typedef void(CBaseEntity::*USEPTR)( CBaseEntity *pActivator, CBaseEntity *pCalle
|
|||
#define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players
|
||||
#define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace
|
||||
#define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.
|
||||
#define CLASS_GAYGLENN 14 // I'm gay
|
||||
#define CLASS_CWC 15 // trolls
|
||||
#define CLASS_MONSTERHUNT 16
|
||||
|
||||
class CBaseEntity;
|
||||
class CBaseMonster;
|
||||
|
@ -365,6 +368,7 @@ public:
|
|||
|
||||
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (a)
|
||||
#define SetTouch( a ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
|
||||
//#define SetTouch2( a ) m_pfnTouch = static_cast <BOOL (CGrenade::*)(CBasePlayer *)> (a)
|
||||
#define SetUse( a ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (a)
|
||||
#define SetBlocked( a ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
|
||||
#define ResetThink( ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (NULL)
|
||||
|
@ -545,7 +549,7 @@ public:
|
|||
|
||||
|
||||
// people gib if their health is <= this at the time of death
|
||||
#define GIB_HEALTH_VALUE -30
|
||||
#define GIB_HEALTH_VALUE -1
|
||||
|
||||
#define ROUTE_SIZE 8 // how many waypoints a monster can store at one time
|
||||
#define MAX_OLD_ENEMIES 4 // how many old enemies to remember
|
||||
|
@ -602,12 +606,15 @@ public:
|
|||
#define DMG_SLOWBURN (1 << 21) // in an oven
|
||||
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
|
||||
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
|
||||
#define DMG_BILLNYE (1 << 24) // Hit by BILL NYE THE SCIENCE GUY
|
||||
#define DMG_AK47 (1 << 25)
|
||||
#define DMG_BOW (1 << 26)
|
||||
|
||||
// these are the damage types that are allowed to gib corpses
|
||||
#define DMG_GIB_CORPSE ( DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB )
|
||||
|
||||
// these are the damage types that have client hud art
|
||||
#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK)
|
||||
#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK | DMG_BILLNYE)
|
||||
|
||||
// NOTE: tweak these values based on gameplay feedback:
|
||||
|
||||
|
|
789
dlls/client.cpp
789
dlls/client.cpp
|
@ -38,6 +38,23 @@
|
|||
#include "weaponinfo.h"
|
||||
#include "usercmd.h"
|
||||
#include "netadr.h"
|
||||
#include "time.h"
|
||||
|
||||
// START BOT
|
||||
#include "bot.h"
|
||||
#include "botcam.h"
|
||||
|
||||
void BotCreate(const char *skin, const char *name, const char *skill);
|
||||
extern int f_Observer; // flag for observer mode
|
||||
extern int f_botskill; // default bot skill level
|
||||
extern int f_botdontshoot; // flag to disable targeting other bots
|
||||
extern respawn_t bot_respawn[32];
|
||||
float bot_check_time = 10.0;
|
||||
int min_bots = 0;
|
||||
int max_bots = 0;
|
||||
// END BOT
|
||||
|
||||
extern cvar_t shtugn;
|
||||
|
||||
extern DLL_GLOBAL ULONG g_ulModelIndexPlayer;
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
|
@ -45,10 +62,10 @@ extern DLL_GLOBAL int g_iSkillLevel;
|
|||
extern DLL_GLOBAL ULONG g_ulFrameCount;
|
||||
|
||||
extern void CopyToBodyQue( entvars_t* pev );
|
||||
extern int giPrecacheGrunt;
|
||||
//extern int giPrecacheGrunt;
|
||||
extern int gmsgSayText;
|
||||
|
||||
extern int g_teamplay;
|
||||
extern int gmsgStopMP3;
|
||||
extern int g_gameplay;
|
||||
|
||||
void LinkUserMessages( void );
|
||||
|
||||
|
@ -78,6 +95,42 @@ called when a player connects to a server
|
|||
*/
|
||||
BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128] )
|
||||
{
|
||||
int i;
|
||||
int count = 0;
|
||||
|
||||
// check if this is NOT a bot joining the server...
|
||||
if( strcmp( pszAddress, "127.0.0.1" ) != 0 )
|
||||
{
|
||||
// don't try to add bots for 30 seconds, give client time to get added
|
||||
bot_check_time = gpGlobals->time + 30.0;
|
||||
|
||||
for( i = 0; i < 32; i++ )
|
||||
{
|
||||
if( bot_respawn[i].is_used ) // count the number of bots in use
|
||||
count++;
|
||||
}
|
||||
|
||||
// if there are currently more than the minimum number of bots running
|
||||
// then kick one of the bots off the server...
|
||||
if( ( min_bots != 0 ) && ( count > min_bots ) )
|
||||
{
|
||||
for( i = 0; i < 32; i++ )
|
||||
{
|
||||
if( bot_respawn[i].is_used ) // is this slot used?
|
||||
{
|
||||
char cmd[40];
|
||||
|
||||
sprintf( cmd, "kick \"%s\"\n", bot_respawn[i].name );
|
||||
|
||||
bot_respawn[i].state = BOT_IDLE;
|
||||
|
||||
SERVER_COMMAND( cmd ); // kick the bot using (kick "name")
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return g_pGameRules->ClientConnected( pEntity, pszName, pszAddress, szRejectReason );
|
||||
|
||||
// a client connecting during an intermission can cause problems
|
||||
|
@ -101,7 +154,23 @@ void ClientDisconnect( edict_t *pEntity )
|
|||
|
||||
char text[256] = "";
|
||||
if( pEntity->v.netname )
|
||||
snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) );
|
||||
{
|
||||
switch( RANDOM_LONG( 0, 3 ) )
|
||||
{
|
||||
case 0:
|
||||
snprintf( text, sizeof(text), "- %s has busted the fuck out\n", STRING( pEntity->v.netname ) );
|
||||
break;
|
||||
case 1:
|
||||
snprintf( text, sizeof(text),"- %s has ran away\n", STRING( pEntity->v.netname ) );
|
||||
break;
|
||||
case 2:
|
||||
snprintf( text, sizeof(text), "- %s ragequitted.\n", STRING( pEntity->v.netname ) );
|
||||
break;
|
||||
case 3:
|
||||
snprintf( text, sizeof(text), "- %s is out.\n", STRING( pEntity->v.netname ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
|
@ -167,8 +236,16 @@ void ClientKill( edict_t *pEntity )
|
|||
|
||||
// have the player kill themself
|
||||
pev->health = 0;
|
||||
pl->Killed( pev, GIB_NEVER );
|
||||
|
||||
switch( RANDOM_LONG( 0, 1 ) )
|
||||
{
|
||||
case 0:
|
||||
pl->Killed( pev, GIB_NEVER );
|
||||
break;
|
||||
case 1:
|
||||
pl->Killed( pev, GIB_ALWAYS );
|
||||
break;
|
||||
}
|
||||
//pev->modelindex = g_ulModelIndexPlayer;
|
||||
//pev->frags -= 2; // extra penalty
|
||||
//respawn( pev );
|
||||
|
@ -277,11 +354,27 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
|||
if( pc != NULL )
|
||||
return; // no character found, so say nothing
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
char *dd = "AM";
|
||||
|
||||
WORD hour = sysDate->wHour;
|
||||
|
||||
if( hour > 11 )
|
||||
{
|
||||
dd = "PM";
|
||||
hour = hour - 12;
|
||||
}
|
||||
if( hour == 0 )
|
||||
hour = 12;
|
||||
|
||||
// turn on color set 2 (color on, no sound)
|
||||
if( teamonly )
|
||||
sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) );
|
||||
sprintf( text, "[%d:%d %s] %c(TEAM) %s: ", hour, sysDate->wMinute, dd, 2, STRING( pEntity->v.netname ) );
|
||||
else
|
||||
sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) );
|
||||
sprintf( text, "[%d:%d %s] %c%s: ", hour, sysDate->wMinute, dd, 2, STRING( pEntity->v.netname ) );
|
||||
|
||||
j = sizeof( text ) - 2 - strlen( text ); // -2 for /n and null terminator
|
||||
if( (int)strlen( p ) > j )
|
||||
|
@ -338,7 +431,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
|||
temp = "say";
|
||||
|
||||
// team match?
|
||||
if( g_teamplay )
|
||||
if( g_gameplay == HL_TEAMPLAY || HS_SHYTPLAY )
|
||||
{
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" %s \"%s\"\n",
|
||||
STRING( pEntity->v.netname ),
|
||||
|
@ -367,12 +460,16 @@ called each time a player uses a "cmd" command
|
|||
============
|
||||
*/
|
||||
extern float g_flWeaponCheat;
|
||||
extern int gmsgPlayMP3; // AJH - Killars MP3player
|
||||
|
||||
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
|
||||
void ClientCommand( edict_t *pEntity )
|
||||
{
|
||||
const char *pcmd = CMD_ARGV( 0 );
|
||||
const char *pstr;
|
||||
int Evangelions = 0;
|
||||
|
||||
extern cvar_t enablebots;
|
||||
|
||||
// Is the client spawned yet?
|
||||
if( !pEntity->pvPrivateData )
|
||||
|
@ -392,6 +489,12 @@ void ClientCommand( edict_t *pEntity )
|
|||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->ForceClientDllUpdate();
|
||||
}
|
||||
else if( FStrEq( pcmd, "playaudio" ) ) // AJH - MP3/OGG player (based on killars MP3)
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgPlayMP3, NULL, ENT( pev ) );
|
||||
WRITE_STRING( (char *)CMD_ARGV( 1 ) );
|
||||
MESSAGE_END();
|
||||
}
|
||||
else if( FStrEq(pcmd, "give" ) )
|
||||
{
|
||||
if( g_flWeaponCheat != 0.0 )
|
||||
|
@ -459,34 +562,175 @@ void ClientCommand( edict_t *pEntity )
|
|||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->SelectLastItem();
|
||||
}
|
||||
else if( FStrEq( pcmd, "spectate" ) && ( pev->flags & FL_PROXY ) ) // added for proxy support
|
||||
else if( FStrEq( pcmd, "evangelion" ) )
|
||||
{
|
||||
char text[256];
|
||||
sprintf( text, "Evangelion Unit 01 is active!\n", STRING( pEntity->v.netname ) );
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
MESSAGE_END();
|
||||
}
|
||||
else if( FStrEq( pcmd, "tester" ) )
|
||||
{
|
||||
CBasePlayer * pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
char buf[128];
|
||||
sprintf( buf, "Steam ID: %s\n", GETPLAYERAUTHID( pEntity ) ); //WORKS!
|
||||
UTIL_SayTextAllHS( buf );
|
||||
}
|
||||
else if( FStrEq( pcmd, "make" ) )
|
||||
{
|
||||
if( g_pGameRules->IsMonster() && !g_flWeaponCheat )
|
||||
return;
|
||||
|
||||
int iszItem = ALLOC_STRING( CMD_ARGV( 1 ) ); // Make a copy of the classname
|
||||
GetClassPtr( (CBasePlayer *)pev )->SpawnNamedItem( STRING( iszItem ) );
|
||||
}
|
||||
else if( FStrEq( pcmd, "spectate" ) && ( pev->flags & FL_PROXY ) ) // added for proxy support
|
||||
{
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
|
||||
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer );
|
||||
pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles );
|
||||
}
|
||||
else if( g_pGameRules->ClientCommand( GetClassPtr( (CBasePlayer *)pev ), pcmd ) )
|
||||
// START BOT
|
||||
else if( FStrEq( pcmd, "addbot" ) )
|
||||
{
|
||||
// MenuSelect returns true only if the command is properly handled, so don't print a warning
|
||||
if( enablebots.value == 1 )
|
||||
{
|
||||
if( !IS_DEDICATED_SERVER() )
|
||||
{
|
||||
//If user types "addbot" in console, add a bot with skin and name
|
||||
BotCreate( CMD_ARGV( 1 ), CMD_ARGV( 2 ), CMD_ARGV( 3 ) );
|
||||
}
|
||||
else
|
||||
CLIENT_PRINTF( pEntity, print_console, "addbot not allowed from client!\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
CLIENT_PRINTF( pEntity, print_console, "Admins has disabled adding bots!\n" );
|
||||
}
|
||||
}
|
||||
else if( FStrEq( pcmd, "VModEnable" ) )
|
||||
else if( FStrEq( pcmd, "observer" ) )
|
||||
{
|
||||
// clear 'Unknown command: VModEnable' in singleplayer
|
||||
return;
|
||||
if( !IS_DEDICATED_SERVER() )
|
||||
{
|
||||
if( CMD_ARGC() > 1 ) // is there an argument to the command?
|
||||
{
|
||||
f_Observer = atoi( CMD_ARGV( 1 ) ); // set observer flag
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"observer\" set to %d\n", (int)f_Observer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"observer\" is %d\n", (int)f_Observer ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
CLIENT_PRINTF( pEntity, print_console, "observer not allowed from client!\n" );
|
||||
}
|
||||
else
|
||||
else if( FStrEq( pcmd, "botskill" ) )
|
||||
{
|
||||
// tell the user they entered an unknown command
|
||||
char command[128];
|
||||
if( !IS_DEDICATED_SERVER() )
|
||||
{
|
||||
if( CMD_ARGC() > 1 )
|
||||
{
|
||||
f_botskill = atoi( CMD_ARGV( 1 ) ); // set default bot skill level
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"botskill\" set to %d\n", (int)f_botskill ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"botskill\" is %d\n", (int)f_botskill ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
CLIENT_PRINTF( pEntity, print_console, "botskill not allowed from client!\n" );
|
||||
}
|
||||
else if( FStrEq( pcmd, "botdontshoot" ) )
|
||||
{
|
||||
if( !IS_DEDICATED_SERVER() )
|
||||
{
|
||||
if( CMD_ARGC() > 1 ) // is there an argument to the command?
|
||||
{
|
||||
f_botdontshoot = atoi( CMD_ARGV( 1 ) ); // set bot shoot flag
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"botdontshoot\" set to %d\n", (int)f_botdontshoot ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "\"botdontshoot\" is %d\n", (int)f_botdontshoot ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
CLIENT_PRINTF( pEntity, print_console, "botdontshoot not allowed from client!\n" );
|
||||
}
|
||||
else if( FStrEq( pcmd, "botcam" ) )
|
||||
{
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
CBasePlayer *pBot = NULL;
|
||||
char botname[BOT_NAME_LEN + 1];
|
||||
int index;
|
||||
|
||||
// check the length of the command (prevents crash)
|
||||
// max total length is 192 ...and we're adding a string below ("Unknown command: %s\n")
|
||||
strncpy( command, pcmd, 127 );
|
||||
command[127] = '\0';
|
||||
botname[0] = 0;
|
||||
|
||||
// tell the user they entered an unknown command
|
||||
ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, UTIL_VarArgs( "Unknown command: %s\n", command ) );
|
||||
if( CMD_ARGC() > 1 ) // is there an argument to the command?
|
||||
{
|
||||
if( strstr( CMD_ARGV( 1 ), "\"" ) == NULL )
|
||||
strcpy( botname, CMD_ARGV( 1 ) );
|
||||
else
|
||||
sscanf( CMD_ARGV( 1 ), "\"%s\"", &botname[0] );
|
||||
|
||||
index = 0;
|
||||
|
||||
while( index < 32 )
|
||||
{
|
||||
if( ( bot_respawn[index].is_used ) && ( stricmp( bot_respawn[index].name, botname ) == 0 ) )
|
||||
break;
|
||||
else
|
||||
index++;
|
||||
}
|
||||
|
||||
if( index < 32 )
|
||||
pBot = bot_respawn[index].pBot;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
|
||||
while( ( bot_respawn[index].is_used == FALSE ) && ( index < 32 ) )
|
||||
index++;
|
||||
|
||||
if( index < 32 )
|
||||
pBot = bot_respawn[index].pBot;
|
||||
}
|
||||
|
||||
if( pBot == NULL )
|
||||
{
|
||||
if( botname[0] )
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "there is no bot named \"%s\"!\n", botname ) );
|
||||
else
|
||||
CLIENT_PRINTF( pEntity, print_console, UTIL_VarArgs( "there are no bots!\n" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pPlayer->pBotCam ) // if botcam in use, disconnect first...
|
||||
pPlayer->pBotCam->Disconnect();
|
||||
|
||||
pPlayer->pBotCam = CBotCam::Create( pPlayer, pBot );
|
||||
}
|
||||
}
|
||||
else if( FStrEq( pcmd, "nobotcam" ) )
|
||||
{
|
||||
CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev );
|
||||
|
||||
if( pPlayer->pBotCam )
|
||||
pPlayer->pBotCam->Disconnect();
|
||||
}
|
||||
else if( FStrEq( pcmd, "use_starman" ) )
|
||||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->UseMarioStar();
|
||||
}
|
||||
else if( FStrEq( pcmd, "what_a_shame" ) )
|
||||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->WhatAShame();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,7 +769,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||
g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), infobuffer, "name", sName );
|
||||
|
||||
char text[256];
|
||||
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||
snprintf( text, 256, "* %s wants to be called %s from now on\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
|
||||
WRITE_BYTE( ENTINDEX( pEntity ) );
|
||||
WRITE_STRING( text );
|
||||
|
@ -534,7 +778,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||
// team match?
|
||||
if( g_teamplay )
|
||||
{
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" changed name to \"%s\"\n",
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" DEFECTED, just kidding, he wants to be called \"%s\"\n",
|
||||
STRING( pEntity->v.netname ),
|
||||
GETPLAYERUSERID( pEntity ),
|
||||
GETPLAYERAUTHID( pEntity ),
|
||||
|
@ -543,7 +787,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
|
|||
}
|
||||
else
|
||||
{
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%i>\" changed name to \"%s\"\n",
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%i>\" thought it was fun to change his name to \"%s\"\n",
|
||||
STRING( pEntity->v.netname ),
|
||||
GETPLAYERUSERID( pEntity ),
|
||||
GETPLAYERAUTHID( pEntity ),
|
||||
|
@ -664,21 +908,406 @@ void ParmsChangeLevel( void )
|
|||
//
|
||||
void StartFrame( void )
|
||||
{
|
||||
//ALERT( at_console, "SV_Physics( %g, frametime %g )\n", gpGlobals->time, gpGlobals->frametime );
|
||||
// START BOT
|
||||
static BOOL file_opened = FALSE;
|
||||
static int length;
|
||||
static char *pFileList, *aFileList;
|
||||
static char cmd_line[80];
|
||||
static char server_cmd[80];
|
||||
static int index, i;
|
||||
static float pause_time;
|
||||
static float check_server_cmd = 0;
|
||||
char *cmd, *arg1, *arg2, *arg3;
|
||||
static float respawn_time = 0;
|
||||
static float previous_time = 0.0;
|
||||
char msg[120];
|
||||
// END BOT
|
||||
|
||||
// START BOT - thanks Jehannum!
|
||||
// loop through all the players...
|
||||
for( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *pPlayer;
|
||||
pPlayer = UTIL_PlayerByIndex( i );
|
||||
|
||||
if( !pPlayer ) // if invalid then continue with next index...
|
||||
continue;
|
||||
|
||||
// check if this is a FAKECLIENT (i.e. is it a bot?)
|
||||
if( FBitSet( pPlayer->pev->flags, FL_FAKECLIENT ) )
|
||||
{
|
||||
CBot *pBot = (CBot *)pPlayer;
|
||||
|
||||
// call the think function for the bot...
|
||||
pBot->BotThink();
|
||||
}
|
||||
}
|
||||
// END BOT
|
||||
|
||||
// START BOT
|
||||
if( ( g_fGameOver ) && ( respawn_time < 1.0 ) )
|
||||
{
|
||||
// if the game is over (time/frag limit) set the respawn time...
|
||||
respawn_time = 5.0;
|
||||
|
||||
// check if any players are using the botcam...
|
||||
for( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBasePlayer *pPlayer;
|
||||
pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
|
||||
|
||||
if( !pPlayer )
|
||||
continue; // if invalid then continue with next index...
|
||||
|
||||
if( pPlayer->pBotCam )
|
||||
pPlayer->pBotCam->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// check if a map was changed via "map" without kicking bots...
|
||||
if( previous_time > gpGlobals->time )
|
||||
{
|
||||
bot_check_time = gpGlobals->time + 10.0;
|
||||
|
||||
for( index = 0; index < 32; index++ )
|
||||
{
|
||||
if( ( bot_respawn[index].is_used ) && // is this slot used?
|
||||
( bot_respawn[index].state != BOT_NEED_TO_RESPAWN ) )
|
||||
{
|
||||
// bot has already been "kicked" by server so just set flag
|
||||
bot_respawn[index].state = BOT_NEED_TO_RESPAWN;
|
||||
|
||||
// if the map was changed set the respawn time...
|
||||
respawn_time = 5.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// is new game started and time to respawn bots yet?
|
||||
if( ( !g_fGameOver ) && ( respawn_time > 1.0 ) &&
|
||||
( gpGlobals->time >= respawn_time ) )
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
bot_check_time = gpGlobals->time + 5.0;
|
||||
|
||||
// find bot needing to be respawned...
|
||||
while( ( index < 32 ) && ( bot_respawn[index].state != BOT_NEED_TO_RESPAWN ) )
|
||||
index++;
|
||||
|
||||
if( index < 32 )
|
||||
{
|
||||
bot_respawn[index].state = BOT_IS_RESPAWNING;
|
||||
bot_respawn[index].is_used = FALSE; // free up this slot
|
||||
|
||||
// respawn 1 bot then wait a while (otherwise engine crashes)
|
||||
BotCreate( bot_respawn[index].skin, bot_respawn[index].name,
|
||||
bot_respawn[index].skill );
|
||||
|
||||
respawn_time = gpGlobals->time + 1.0; // set next respawn time
|
||||
}
|
||||
else
|
||||
{
|
||||
respawn_time = 0.0;
|
||||
}
|
||||
}
|
||||
// END BOT
|
||||
|
||||
if( g_pGameRules )
|
||||
{
|
||||
g_pGameRules->Think();
|
||||
|
||||
// START BOT
|
||||
if( !file_opened ) // have we open bot.cfg file yet?
|
||||
{
|
||||
ALERT( at_console, "Executing bot.cfg\n" );
|
||||
pFileList = (char *)LOAD_FILE_FOR_ME( "bot.cfg", &length );
|
||||
file_opened = TRUE;
|
||||
if( pFileList == NULL )
|
||||
ALERT( at_console, "bot.cfg file not found\n" );
|
||||
|
||||
pause_time = gpGlobals->time;
|
||||
|
||||
index = 0;
|
||||
cmd_line[index] = 0; // null out command line
|
||||
}
|
||||
|
||||
// if the bot.cfg file is still open and time to execute command...
|
||||
while( ( pFileList && *pFileList ) && ( pause_time <= gpGlobals->time ) )
|
||||
{
|
||||
while( *pFileList == ' ' ) // skip any leading blanks
|
||||
pFileList++;
|
||||
|
||||
while( ( *pFileList != '\r' ) && ( *pFileList != '\n' ) && ( *pFileList != 0 ) )
|
||||
{
|
||||
if( *pFileList == '\t' ) // convert tabs to spaces
|
||||
*pFileList = ' ';
|
||||
|
||||
cmd_line[index] = *pFileList;
|
||||
pFileList++;
|
||||
|
||||
while( ( cmd_line[index] == ' ') && ( *pFileList == ' ' ) )
|
||||
pFileList++; // skip multiple spaces
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if( *pFileList == '\r' )
|
||||
{
|
||||
pFileList++; // skip the carriage return
|
||||
pFileList++; // skip the linefeed
|
||||
}
|
||||
else if (*pFileList == '\n')
|
||||
{
|
||||
pFileList++; // skip the newline
|
||||
}
|
||||
|
||||
cmd_line[index] = 0; // terminate the command line
|
||||
|
||||
// copy the command line to a server command buffer...
|
||||
strcpy( server_cmd, cmd_line );
|
||||
strcat( server_cmd, "\n" );
|
||||
|
||||
index = 0;
|
||||
cmd = cmd_line;
|
||||
arg1 = arg2 = arg3 = NULL;
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg1 = &cmd_line[index];
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg2 = &cmd_line[index];
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg3 = &cmd_line[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = 0; // reset for next input line
|
||||
|
||||
if( ( cmd_line[0] == '#' ) || ( cmd_line[0] == 0 ) )
|
||||
{
|
||||
continue; // ignore comments or blank lines
|
||||
}
|
||||
else if( strcmp(cmd, "addbot") == 0 )
|
||||
{
|
||||
BotCreate( arg1, arg2, arg3 );
|
||||
|
||||
// have to delay here or engine gives "Tried to write to
|
||||
// uninitialized sizebuf_t" error and crashes...
|
||||
|
||||
pause_time = gpGlobals->time + 1;
|
||||
break;
|
||||
}
|
||||
else if( strcmp( cmd, "botskill" ) == 0 )
|
||||
{
|
||||
f_botskill = atoi( arg1 ); // set default bot skill level
|
||||
}
|
||||
else if( strcmp( cmd, "observer" ) == 0 )
|
||||
{
|
||||
f_Observer = atoi( arg1 ); // set observer flag
|
||||
}
|
||||
else if( strcmp( cmd, "botdontshoot" ) == 0 )
|
||||
{
|
||||
f_botdontshoot = atoi( arg1 ); // set bot shoot flag
|
||||
}
|
||||
else if( strcmp( cmd, "min_bots" ) == 0 )
|
||||
{
|
||||
min_bots = atoi( arg1 );
|
||||
if( min_bots < 0 )
|
||||
min_bots = 0;
|
||||
|
||||
if( IS_DEDICATED_SERVER() )
|
||||
{
|
||||
sprintf( msg, "min_bots set to %d\n", min_bots );
|
||||
printf( msg );
|
||||
}
|
||||
}
|
||||
else if( strcmp( cmd, "max_bots" ) == 0 )
|
||||
{
|
||||
max_bots = atoi( arg1 );
|
||||
|
||||
if( max_bots >= gpGlobals->maxClients )
|
||||
max_bots = gpGlobals->maxClients - 1;
|
||||
|
||||
if( IS_DEDICATED_SERVER() )
|
||||
{
|
||||
sprintf( msg, "max_bots set to %d\n", max_bots );
|
||||
printf( msg );
|
||||
}
|
||||
}
|
||||
else if( strcmp( cmd, "pause" ) == 0 )
|
||||
{
|
||||
pause_time = gpGlobals->time + atoi( arg1 );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( msg, "executing server command: %s\n", server_cmd );
|
||||
ALERT( at_console, msg );
|
||||
|
||||
if( IS_DEDICATED_SERVER() )
|
||||
printf( msg );
|
||||
|
||||
SERVER_COMMAND( server_cmd );
|
||||
}
|
||||
}
|
||||
|
||||
// if bot.cfg file is open and reached end of file, then close and free it
|
||||
if( pFileList && ( *pFileList == 0 ) )
|
||||
{
|
||||
FREE_FILE( aFileList );
|
||||
pFileList = NULL;
|
||||
}
|
||||
|
||||
// if time to check for server commands then do so...
|
||||
if( check_server_cmd <= gpGlobals->time )
|
||||
{
|
||||
check_server_cmd = gpGlobals->time + 1.0;
|
||||
char *cvar_bot = (char *)CVAR_GET_STRING( "bot" );
|
||||
|
||||
if( cvar_bot && cvar_bot[0] )
|
||||
{
|
||||
strcpy( cmd_line, cvar_bot );
|
||||
|
||||
index = 0;
|
||||
cmd = cmd_line;
|
||||
arg1 = arg2 = arg3 = NULL;
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg1 = &cmd_line[index];
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg2 = &cmd_line[index];
|
||||
|
||||
// skip to blank or end of string...
|
||||
while( ( cmd_line[index] != ' ' ) && ( cmd_line[index] != 0 ) )
|
||||
index++;
|
||||
|
||||
if( cmd_line[index] == ' ' )
|
||||
{
|
||||
cmd_line[index++] = 0;
|
||||
arg3 = &cmd_line[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( strcmp( cmd, "addbot" ) == 0 )
|
||||
{
|
||||
printf( "adding new bot...\n" );
|
||||
BotCreate( arg1, arg2, arg3 );
|
||||
}
|
||||
else if( strcmp( cmd, "botskill" ) == 0 )
|
||||
{
|
||||
if( arg1 != NULL )
|
||||
{
|
||||
printf( "setting botskill to %d\n", atoi( arg1 ) );
|
||||
f_botskill = atoi( arg1 ); // set default bot skill level
|
||||
}
|
||||
else
|
||||
printf( "botskill is %d\n", f_botskill );
|
||||
}
|
||||
else if( strcmp( cmd, "botdontshoot" ) == 0 )
|
||||
{
|
||||
if( arg1 != NULL )
|
||||
{
|
||||
printf( "setting botdontshoot to %d\n", atoi( arg1 ) );
|
||||
f_botdontshoot = atoi( arg1 ); // set bot shoot flag
|
||||
}
|
||||
else
|
||||
printf( "botdontshoot is %d\n", f_botdontshoot );
|
||||
}
|
||||
|
||||
CVAR_SET_STRING( "bot", "" );
|
||||
}
|
||||
}
|
||||
// END BOT
|
||||
|
||||
}
|
||||
|
||||
if( g_fGameOver )
|
||||
{
|
||||
return;
|
||||
|
||||
gpGlobals->teamplay = teamplay.value;
|
||||
// START BOT
|
||||
check_server_cmd = 0;
|
||||
// END BOT
|
||||
}
|
||||
|
||||
gpGlobals->gameplay = gameplay.value;
|
||||
g_ulFrameCount++;
|
||||
|
||||
// START BOT
|
||||
// check if time to see if a bot needs to be created...
|
||||
if( bot_check_time < gpGlobals->time )
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
bot_check_time = gpGlobals->time + 5.0;
|
||||
|
||||
for( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *pPlayer;
|
||||
|
||||
pPlayer = UTIL_PlayerByIndex( i );
|
||||
|
||||
if( !pPlayer )
|
||||
continue; // if invalid then continue with next index...
|
||||
|
||||
if( pPlayer->pev->takedamage == DAMAGE_NO )
|
||||
continue; // if bot was kicked, don't count as a player...
|
||||
|
||||
count++; // count the number of bots and players
|
||||
}
|
||||
|
||||
// if there are currently less than the maximum number of "players"
|
||||
// then add another bot using the default skill level...
|
||||
if( count < max_bots )
|
||||
{
|
||||
BotCreate( NULL, NULL, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
previous_time = gpGlobals->time; // keep track of last time in StartFrame()
|
||||
// END BOT
|
||||
}
|
||||
|
||||
|
||||
void ClientPrecache( void )
|
||||
{
|
||||
PRECACHE_SOUND( "ambience/warn1.wav" );
|
||||
|
||||
// setup precaches always needed
|
||||
PRECACHE_SOUND( "player/sprayer.wav" ); // spray paint sound for PreAlpha
|
||||
|
||||
|
@ -743,6 +1372,8 @@ void ClientPrecache( void )
|
|||
PRECACHE_SOUND( "player/pl_wade3.wav" );
|
||||
PRECACHE_SOUND( "player/pl_wade4.wav" );
|
||||
|
||||
PRECACHE_SOUND( "player/plyrjmp8.wav" );
|
||||
|
||||
PRECACHE_SOUND( "debris/wood1.wav" ); // hit wood texture
|
||||
PRECACHE_SOUND( "debris/wood2.wav" );
|
||||
PRECACHE_SOUND( "debris/wood3.wav" );
|
||||
|
@ -755,6 +1386,10 @@ void ClientPrecache( void )
|
|||
PRECACHE_SOUND( "debris/glass2.wav" );
|
||||
PRECACHE_SOUND( "debris/glass3.wav" );
|
||||
|
||||
PRECACHE_SOUND( "starman.wav" );
|
||||
|
||||
PRECACHE_SOUND( "item/cv2_get.wav" );
|
||||
|
||||
PRECACHE_SOUND( SOUND_FLASHLIGHT_ON );
|
||||
PRECACHE_SOUND( SOUND_FLASHLIGHT_OFF );
|
||||
|
||||
|
@ -768,6 +1403,25 @@ void ClientPrecache( void )
|
|||
PRECACHE_SOUND( "player/pl_pain6.wav" );
|
||||
PRECACHE_SOUND( "player/pl_pain7.wav" );
|
||||
|
||||
// Half-screwed Death Sounds
|
||||
PRECACHE_SOUND( "player/death1.wav" );
|
||||
PRECACHE_SOUND( "player/death2.wav" );
|
||||
PRECACHE_SOUND( "player/death3.wav" );
|
||||
PRECACHE_SOUND( "player/death4.wav" );
|
||||
PRECACHE_SOUND( "player/death5.wav" );
|
||||
PRECACHE_SOUND( "player/death6.wav" );
|
||||
PRECACHE_SOUND( "player/death7.wav" );
|
||||
|
||||
// What a shame
|
||||
PRECACHE_SOUND( "player/shame.wav" );
|
||||
|
||||
// Christmas Time Sounds
|
||||
PRECACHE_SOUND( "misc/b2.wav" );
|
||||
PRECACHE_SOUND( "misc/party2.wav" );
|
||||
|
||||
// Test Zom
|
||||
PRECACHE_MODEL( "models/zombie.mdl" );
|
||||
|
||||
PRECACHE_MODEL( "models/player.mdl" );
|
||||
|
||||
// hud sounds
|
||||
|
@ -785,8 +1439,83 @@ void ClientPrecache( void )
|
|||
PRECACHE_SOUND( "player/geiger2.wav" );
|
||||
PRECACHE_SOUND( "player/geiger1.wav" );
|
||||
|
||||
if( giPrecacheGrunt )
|
||||
PRECACHE_SOUND( "bcry/battlecry1.wav" );
|
||||
PRECACHE_SOUND( "bcry/battlecry2.wav" );
|
||||
|
||||
PRECACHE_SOUND( "common/jingle1.wav" );
|
||||
|
||||
//if( giPrecacheGrunt )
|
||||
UTIL_PrecacheOther( "monster_human_grunt" );
|
||||
|
||||
//if( giPrecacheScientist )
|
||||
UTIL_PrecacheOther( "monster_scientist" );
|
||||
|
||||
//if( giPrecacheTree )
|
||||
UTIL_PrecacheOther( "monster_xmast" );
|
||||
|
||||
//if( giPrecacheBarney )
|
||||
UTIL_PrecacheOther( "monster_barney" );
|
||||
|
||||
//if( giPrecacheGlenn )
|
||||
UTIL_PrecacheOther( "monster_gay" );
|
||||
|
||||
//if( giPrecacheCreeper )
|
||||
UTIL_PrecacheOther( "monster_creeper" );
|
||||
|
||||
//if( giPrecacheSinistar )
|
||||
UTIL_PrecacheOther( "monster_sinistar" );
|
||||
|
||||
UTIL_PrecacheOther( "monster_chrischan" );
|
||||
|
||||
UTIL_PrecacheOther( "monster_homestuck" );
|
||||
|
||||
// START BOT
|
||||
if( !IS_DEDICATED_SERVER() )
|
||||
{
|
||||
PRECACHE_SOUND( HG_SND1 );
|
||||
PRECACHE_SOUND( HG_SND2 );
|
||||
PRECACHE_SOUND( HG_SND3 );
|
||||
PRECACHE_SOUND( HG_SND4 );
|
||||
PRECACHE_SOUND( HG_SND5 );
|
||||
|
||||
PRECACHE_SOUND( BA_SND1 );
|
||||
PRECACHE_SOUND( BA_SND2 );
|
||||
PRECACHE_SOUND( BA_SND3 );
|
||||
PRECACHE_SOUND( BA_SND4 );
|
||||
PRECACHE_SOUND( BA_SND5 );
|
||||
|
||||
PRECACHE_SOUND( SC_SND1 );
|
||||
PRECACHE_SOUND( SC_SND2 );
|
||||
PRECACHE_SOUND( SC_SND3 );
|
||||
PRECACHE_SOUND( SC_SND4 );
|
||||
PRECACHE_SOUND( SC_SND5 );
|
||||
|
||||
PRECACHE_SOUND( BA_TNT1 );
|
||||
PRECACHE_SOUND( BA_TNT2 );
|
||||
PRECACHE_SOUND( BA_TNT3 );
|
||||
PRECACHE_SOUND( BA_TNT4 );
|
||||
PRECACHE_SOUND( BA_TNT5 );
|
||||
|
||||
PRECACHE_SOUND( SC_TNT1 );
|
||||
PRECACHE_SOUND( SC_TNT2 );
|
||||
PRECACHE_SOUND( SC_TNT3 );
|
||||
PRECACHE_SOUND( SC_TNT4 );
|
||||
PRECACHE_SOUND( SC_TNT5 );
|
||||
|
||||
PRECACHE_SOUND( DV_TNT1 );
|
||||
PRECACHE_SOUND( DV_TNT2 );
|
||||
PRECACHE_SOUND( DV_TNT3 );
|
||||
PRECACHE_SOUND( DV_TNT4 );
|
||||
PRECACHE_SOUND( DV_TNT5 );
|
||||
|
||||
PRECACHE_SOUND( USE_TEAMPLAY_SND );
|
||||
PRECACHE_SOUND( USE_TEAMPLAY_LATER_SND );
|
||||
PRECACHE_SOUND( USE_TEAMPLAY_ENEMY_SND );
|
||||
}
|
||||
|
||||
UTIL_PrecacheOther( "entity_botcam" );
|
||||
PRECACHE_MODEL( "models/mechgibs.mdl" );
|
||||
// END BOT
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -801,7 +1530,7 @@ const char *GetGameDescription()
|
|||
if( g_pGameRules ) // this function may be called before the world has spawned, and the game rules initialized
|
||||
return g_pGameRules->GetGameDescription();
|
||||
else
|
||||
return "Half-Life";
|
||||
return "Half-Screwed";
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
131
dlls/combat.cpp
131
dlls/combat.cpp
|
@ -29,6 +29,10 @@
|
|||
#include "animation.h"
|
||||
#include "weapons.h"
|
||||
#include "func_break.h"
|
||||
#include "gamerules.h"
|
||||
#include "player.h"
|
||||
#include "monhunt_gamerules.h"
|
||||
#include "time.h"
|
||||
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
extern DLL_GLOBAL int g_iSkillLevel;
|
||||
|
@ -36,8 +40,12 @@ extern DLL_GLOBAL int g_iSkillLevel;
|
|||
extern Vector VecBModelOrigin( entvars_t *pevBModel );
|
||||
extern entvars_t *g_pevLastInflictor;
|
||||
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgDeathMsg;
|
||||
|
||||
#define GERMAN_GIB_COUNT 4
|
||||
#define HUMAN_GIB_COUNT 6
|
||||
#define PRESENT_GIB_COUNT 4
|
||||
#define ALIEN_GIB_COUNT 4
|
||||
|
||||
|
||||
|
@ -182,28 +190,62 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
|
|||
{
|
||||
int cSplat;
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
for( cSplat = 0; cSplat < cGibs; cSplat++ )
|
||||
{
|
||||
CGib *pGib = GetClassPtr( (CGib *)NULL );
|
||||
|
||||
if( g_Language == LANGUAGE_GERMAN )
|
||||
{
|
||||
pGib->Spawn( "models/germangibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, GERMAN_GIB_COUNT - 1 );
|
||||
if( ( sysDate->wMonth == 12 && sysDate->wDay == 25 ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pGib->Spawn( "models/germangibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, GERMAN_GIB_COUNT - 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( human )
|
||||
{
|
||||
// human pieces
|
||||
pGib->Spawn( "models/hgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 1, HUMAN_GIB_COUNT - 1 );// start at one to avoid throwing random amounts of skulls (0th gib)
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
}
|
||||
else if( CVAR_GET_FLOAT( "mp_christmas" ) == 1 )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// human pieces
|
||||
pGib->Spawn( "models/hgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 1, HUMAN_GIB_COUNT - 1 ); // start at one to avoid throwing random amounts of skulls (0th gib)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// aliens
|
||||
pGib->Spawn( "models/agibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, ALIEN_GIB_COUNT - 1 );
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// aliens
|
||||
pGib->Spawn( "models/agibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, ALIEN_GIB_COUNT - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +299,9 @@ BOOL CBaseMonster::HasHumanGibs( void )
|
|||
if( myClass == CLASS_HUMAN_MILITARY ||
|
||||
myClass == CLASS_PLAYER_ALLY ||
|
||||
myClass == CLASS_HUMAN_PASSIVE ||
|
||||
myClass == CLASS_PLAYER )
|
||||
myClass == CLASS_PLAYER ||
|
||||
myClass == CLASS_GAYGLENN ||
|
||||
myClass == CLASS_CWC )
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -300,12 +344,29 @@ void CBaseMonster::GibMonster( void )
|
|||
TraceResult tr;
|
||||
BOOL gibbed = FALSE;
|
||||
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM );
|
||||
LPSYSTEMTIME sysDate;
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "misc/party2.wav", 1, ATTN_NORM );
|
||||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
// only humans throw skulls !!!UNDONE - eventually monsters will have their own sets of gibs
|
||||
if( HasHumanGibs() )
|
||||
{
|
||||
if( CVAR_GET_FLOAT( "violence_hgibs" ) != 0 ) // Only the player will ever get here
|
||||
if( CVAR_GET_FLOAT( "violence_hgibs" ) != 0 && CVAR_GET_FLOAT( "ultraviolence" ) != 0 ) // Only the player will ever get here
|
||||
{
|
||||
CGib::SpawnHeadGib( pev );
|
||||
CGib::SpawnHeadGib( pev );
|
||||
CGib::SpawnRandomGibs( pev, 40, 1 ); // throw some human gibs.
|
||||
}
|
||||
else if( CVAR_GET_FLOAT( "violence_hgibs" ) != 0 && CVAR_GET_FLOAT( "ultraviolence" ) == 0 ) // Only the player will ever get here
|
||||
{
|
||||
CGib::SpawnHeadGib( pev );
|
||||
CGib::SpawnRandomGibs( pev, 4, 1 ); // throw some human gibs.
|
||||
|
@ -601,6 +662,24 @@ void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib )
|
|||
pOwner->DeathNotice( pev );
|
||||
}
|
||||
|
||||
//Monster Hunt stuff
|
||||
if( g_pGameRules->IsMonster() ) // Monster Hunt Mode
|
||||
{
|
||||
if( pev->flags & FL_MONSTER )
|
||||
{
|
||||
const char *monster_name = CMonsterplay::PrepareMonsterName( STRING( pev->classname ) );
|
||||
|
||||
CBaseEntity *ep = CBaseEntity::Instance( pevAttacker );
|
||||
ep->AddPoints( CMonsterplay::iKillforMonster( monster_name ), true );
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
|
||||
WRITE_BYTE( ENTINDEX( ep->edict() ) ); // the killer
|
||||
WRITE_BYTE( -1 ); // the victim
|
||||
WRITE_STRING( monster_name ); // what they were killed by (should this be a string?)
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
||||
if( ShouldGibMonster( iGib ) )
|
||||
{
|
||||
CallGibMonster();
|
||||
|
@ -1436,6 +1515,36 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
|
|||
TEXTURETYPE_PlaySound( &tr, vecSrc, vecEnd, iBulletType );
|
||||
DecalGunshot( &tr, iBulletType );
|
||||
break;
|
||||
case BULLET_PLAYER_GOLDENGUN:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgGOLDENGUN, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_PLAYER_JACKAL:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgJackal, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_PLAYER_AK47:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgAK47, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_PLAYER_BOW:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgBow, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_PLAYER_ZAPPER:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgZAPPER, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_PLAYER_NSTAR:
|
||||
{
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgStar, vecDir, &tr, DMG_BULLET );
|
||||
break;
|
||||
}
|
||||
case BULLET_MONSTER_MP5:
|
||||
pEntity->TraceAttack( pevAttacker, gSkillData.monDmgMP5, vecDir, &tr, DMG_BULLET );
|
||||
|
||||
|
|
|
@ -145,6 +145,11 @@ void CCrowbar::PrimaryAttack()
|
|||
}
|
||||
}
|
||||
|
||||
void CCrowbar::SecondaryAttack()
|
||||
{
|
||||
ClientPrint( m_pPlayer->pev, HUD_PRINTCENTER, "well, i got bast game, HL(all mod)" ); // digamos al cliente
|
||||
}
|
||||
|
||||
void CCrowbar::Smack()
|
||||
{
|
||||
DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR );
|
||||
|
|
|
@ -61,7 +61,10 @@ enum decal_e
|
|||
DECAL_SMALLSCORCH2, // Small scorch mark
|
||||
DECAL_SMALLSCORCH3, // Small scorch mark
|
||||
DECAL_MOMMABIRTH, // Big momma birth splatter
|
||||
DECAL_MOMMASPLAT
|
||||
DECAL_MOMMASPLAT,
|
||||
DECAL_PAINTBALL1,
|
||||
DECAL_PAINTBALL2,
|
||||
DECAL_PAINTBALL3
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
|
190
dlls/effects.cpp
190
dlls/effects.cpp
|
@ -2232,3 +2232,193 @@ void CItemSoda::CanTouch( CBaseEntity *pOther )
|
|||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
|
||||
//===============================================
|
||||
// Entity light
|
||||
// Code by Andrew "Lucas" Highlander
|
||||
// Additional help by Andrew "Confused" Hamilton
|
||||
//===============================================
|
||||
extern int gmsgAddELight;
|
||||
|
||||
#define SF_LIGHT_STARTON 1
|
||||
#define SF_LIGHT_NO_PVS_CHECK 2
|
||||
class CEnvELight : public CPointEntity
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void SendData( void );
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
|
||||
void EXPORT LightFrame( void );
|
||||
|
||||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
BOOL m_fNotReloaded; // magic boolean
|
||||
BOOL m_fLightActive;
|
||||
BOOL m_fDeactivatedByPVS;
|
||||
|
||||
BOOL m_fParentedElight;
|
||||
int m_iParentEntindex;
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( env_elight, CEnvELight )
|
||||
|
||||
TYPEDESCRIPTION CEnvELight::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD( CEnvELight, m_fLightActive, FIELD_BOOLEAN ),
|
||||
DEFINE_FIELD( CEnvELight, m_fParentedElight, FIELD_BOOLEAN ),
|
||||
DEFINE_FIELD( CEnvELight, m_fDeactivatedByPVS, FIELD_BOOLEAN ),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE( CEnvELight, CPointEntity )
|
||||
|
||||
void CEnvELight::Spawn( void )
|
||||
{
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->effects |= EF_NODRAW;
|
||||
pev->flags |= FL_ALWAYSTHINK;
|
||||
|
||||
if( FStringNull( pev->targetname ) || pev->spawnflags & SF_LIGHT_STARTON )
|
||||
m_fLightActive = TRUE;
|
||||
else
|
||||
m_fLightActive = FALSE;
|
||||
|
||||
if( m_fLightActive )
|
||||
{
|
||||
SetThink( &CEnvELight::LightFrame );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
void CEnvELight::SendData( void )
|
||||
{
|
||||
edict_t *pTarget = NULL;
|
||||
|
||||
if( pev->target != NULL )
|
||||
{
|
||||
pTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING( pev->target ) );
|
||||
m_fParentedElight = TRUE;
|
||||
}
|
||||
|
||||
if( FNullEnt( pTarget ) && m_fParentedElight )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
return;
|
||||
}
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgAddELight, NULL );
|
||||
|
||||
if( FNullEnt( pTarget ) )
|
||||
WRITE_SHORT( entindex() );
|
||||
else
|
||||
WRITE_SHORT( ENTINDEX( pTarget ) + 0x1000 * pev->impulse );
|
||||
|
||||
if( !m_fDeactivatedByPVS )
|
||||
WRITE_BYTE( m_fLightActive );
|
||||
else
|
||||
WRITE_BYTE( FALSE );
|
||||
|
||||
if( m_fLightActive && !m_fDeactivatedByPVS )
|
||||
{
|
||||
WRITE_COORD( pev->origin.x ); // X
|
||||
WRITE_COORD( pev->origin.y ); // Y
|
||||
WRITE_COORD( pev->origin.z ); // Z
|
||||
WRITE_COORD( pev->renderamt );
|
||||
WRITE_BYTE ( pev->rendercolor.x );
|
||||
WRITE_BYTE ( pev->rendercolor.y );
|
||||
WRITE_BYTE ( pev->rendercolor.z );
|
||||
}
|
||||
MESSAGE_END();
|
||||
|
||||
if( m_iParentEntindex == NULL && m_fParentedElight )
|
||||
m_iParentEntindex = ( ENTINDEX( pTarget ) + 0x1000 * pev->impulse );
|
||||
|
||||
m_fNotReloaded = TRUE;
|
||||
|
||||
if( m_fLightActive )
|
||||
{
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
SetThink( &CEnvELight::LightFrame );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void CEnvELight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
if( useType == USE_ON )
|
||||
{
|
||||
if( m_fLightActive )
|
||||
return;
|
||||
else
|
||||
m_fLightActive = TRUE;
|
||||
}
|
||||
else if( useType == USE_OFF )
|
||||
{
|
||||
if( !m_fLightActive )
|
||||
return;
|
||||
else
|
||||
m_fLightActive = FALSE;
|
||||
}
|
||||
else if( useType == USE_TOGGLE )
|
||||
{
|
||||
if ( !m_fLightActive )
|
||||
m_fLightActive = TRUE;
|
||||
else
|
||||
m_fLightActive = FALSE;
|
||||
}
|
||||
|
||||
SendData();
|
||||
};
|
||||
|
||||
void CEnvELight::LightFrame( void )
|
||||
{
|
||||
if( !m_fLightActive )
|
||||
return;
|
||||
|
||||
if( !m_fNotReloaded && !m_fDeactivatedByPVS )
|
||||
SendData();
|
||||
|
||||
edict_t *pTarget = edict();
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( m_fParentedElight )
|
||||
{
|
||||
pTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING( pev->target ) );
|
||||
|
||||
if( FNullEnt( pTarget ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgAddELight, NULL );
|
||||
WRITE_SHORT( m_iParentEntindex );
|
||||
WRITE_BYTE( FALSE );
|
||||
MESSAGE_END();
|
||||
|
||||
UTIL_Remove( this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( !( pev->spawnflags & SF_LIGHT_NO_PVS_CHECK ) )
|
||||
{
|
||||
if( FNullEnt( FIND_CLIENT_IN_PVS( pTarget ) ) )
|
||||
{
|
||||
if( !m_fDeactivatedByPVS )
|
||||
{
|
||||
m_fDeactivatedByPVS = TRUE;
|
||||
SendData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_fDeactivatedByPVS )
|
||||
{
|
||||
m_fDeactivatedByPVS = FALSE;
|
||||
SendData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ void CEgon::PrimaryAttack( void )
|
|||
|
||||
void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
||||
{
|
||||
Vector vecDest = vecOrigSrc + vecDir * 2048;
|
||||
Vector vecDest = vecOrigSrc + vecDir * 512;
|
||||
edict_t *pentIgnore;
|
||||
TraceResult tr;
|
||||
|
||||
|
@ -428,10 +428,10 @@ void CEgon::CreateEffect( void )
|
|||
|
||||
if( m_fireMode == FIRE_WIDE )
|
||||
{
|
||||
m_pBeam->SetScrollRate( 50 );
|
||||
m_pBeam->SetNoise( 20 );
|
||||
m_pNoise->SetColor( 50, 50, 255 );
|
||||
m_pNoise->SetNoise( 8 );
|
||||
m_pBeam->SetScrollRate( 520 );
|
||||
m_pBeam->SetNoise( 203 );
|
||||
m_pNoise->SetColor( 255, 50, 2 );
|
||||
m_pNoise->SetNoise( 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "decals.h"
|
||||
#include "explode.h"
|
||||
|
||||
int RESPAWN_TIME = 60;
|
||||
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
|
||||
// =================== FUNC_Breakable ==============================================
|
||||
|
@ -46,18 +48,31 @@ const char *CBreakable::pSpawnObjects[] =
|
|||
"ammo_ARgrenades", // 7
|
||||
"weapon_shotgun", // 8
|
||||
"ammo_buckshot", // 9
|
||||
"weapon_crossbow", // 10
|
||||
"ammo_crossbow", // 11
|
||||
"weapon_357", // 12
|
||||
"ammo_357", // 13
|
||||
//"weapon_crossbow", // 10
|
||||
//"ammo_crossbow", // 11
|
||||
//"weapon_357", // 12
|
||||
//"ammo_357", // 13
|
||||
"weapon_rpg", // 14
|
||||
"ammo_rpgclip", // 15
|
||||
"ammo_gaussclip", // 16
|
||||
//"ammo_gaussclip", // 16
|
||||
"weapon_handgrenade", // 17
|
||||
"weapon_tripmine", // 18
|
||||
"weapon_satchel", // 19
|
||||
"weapon_snark", // 20
|
||||
"weapon_hornetgun", // 21
|
||||
"weapon_soda", // 21 -- Soda
|
||||
"weapon_dosh", // 22 -- Dosh!
|
||||
"weapon_jason", // 23 -- Jaysun
|
||||
"weapon_beamkatana", // 24 -- FUCKHEAD
|
||||
"weapon_ak47", // 25 -- Cunter-Strike Ak47 stoled
|
||||
"weapon_bow", // 26 -- VERROUMM
|
||||
"weapon_jihad", // 27 -- AHBABABABABABA
|
||||
"weapon_nstar", // 28 -- Ninja Star
|
||||
"weapon_mw2", // 29 -- Modern Warfare 2
|
||||
"weapon_scientist", // 30 -- Scientist
|
||||
"weapon_fotn", // 31 -- FOTN
|
||||
"weapon_jackal", // 32 -- The Jackal
|
||||
"weapon_boombox", // 33 -- Boombox
|
||||
"weapon_modman", // 34 -- Modman!
|
||||
};
|
||||
|
||||
void CBreakable::KeyValue( KeyValueData* pkvd )
|
||||
|
@ -558,8 +573,16 @@ int CBreakable::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
|
|||
pev->health -= flDamage;
|
||||
if( pev->health <= 0 )
|
||||
{
|
||||
Killed( pevAttacker, GIB_NORMAL );
|
||||
Die();
|
||||
if( IsRespawnable() )
|
||||
{
|
||||
Die();
|
||||
}
|
||||
else
|
||||
{
|
||||
Killed( pevAttacker, GIB_NORMAL );
|
||||
Die();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -744,7 +767,16 @@ void CBreakable::Die( void )
|
|||
// Fire targets on break
|
||||
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
|
||||
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
if( IsRespawnable() )
|
||||
{
|
||||
pev->effects |= EF_NODRAW;
|
||||
m_iRespawnTime = gpGlobals->time + RESPAWN_TIME;
|
||||
SetThink( &CBreakable::RespawnThink );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
}
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
if( m_iszSpawnObject )
|
||||
CBaseEntity::Create( (char *)STRING( m_iszSpawnObject ), VecBModelOrigin( pev ), pev->angles, edict() );
|
||||
|
@ -760,6 +792,20 @@ BOOL CBreakable::IsBreakable( void )
|
|||
return m_Material != matUnbreakableGlass;
|
||||
}
|
||||
|
||||
void CBreakable::RespawnThink()
|
||||
{
|
||||
if( m_iRespawnTime < gpGlobals->time )
|
||||
{
|
||||
pev->solid = SOLID_BSP;
|
||||
pev->effects &= ~EF_NODRAW;
|
||||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "items/suitchargeok1.wav", 1, ATTN_NORM, 0, 150 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pev->nextthink = pev->ltime + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int CBreakable::DamageDecal( int bitsDamageType )
|
||||
{
|
||||
if( m_Material == matGlass )
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
// To spark when hit
|
||||
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
|
||||
|
||||
void RespawnThink();
|
||||
|
||||
BOOL IsRespawnable( void ) { return ( pev->spawnflags & SF_BREAK_RESPAWNABLE ); }
|
||||
BOOL IsBreakable( void );
|
||||
BOOL SparkWhenHit( void );
|
||||
|
||||
|
@ -86,5 +89,6 @@ public:
|
|||
float m_angle;
|
||||
int m_iszGibModel;
|
||||
int m_iszSpawnObject;
|
||||
int m_iRespawnTime;
|
||||
};
|
||||
#endif // FUNC_BREAK_H
|
||||
|
|
222
dlls/game.cpp
222
dlls/game.cpp
|
@ -24,21 +24,35 @@ cvar_t fragsleft = { "mp_fragsleft","0", FCVAR_SERVER | FCVAR_UNLOGGED }; // D
|
|||
cvar_t timeleft = { "mp_timeleft","0" , FCVAR_SERVER | FCVAR_UNLOGGED }; // " "
|
||||
|
||||
// multiplayer server rules
|
||||
cvar_t teamplay = { "mp_teamplay","0", FCVAR_SERVER };
|
||||
cvar_t gameplay = { "mp_gameplay","0", FCVAR_SERVER };
|
||||
cvar_t fraglimit = {"mp_fraglimit","0", FCVAR_SERVER };
|
||||
//cvar_t shytplay = { "mp_shytplay","0", FCVAR_SERVER };
|
||||
cvar_t timelimit = { "mp_timelimit","0", FCVAR_SERVER };
|
||||
cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
|
||||
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
|
||||
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
|
||||
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
|
||||
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
|
||||
cvar_t flashlight = { "mp_flashlight","1", FCVAR_SERVER };
|
||||
cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER };
|
||||
cvar_t decalfrequency = { "decalfrequency","30", FCVAR_SERVER };
|
||||
cvar_t teamlist = { "mp_teamlist","hgrunt;scientist", FCVAR_SERVER };
|
||||
cvar_t decalfrequency = { "decalfrequency", "5", FCVAR_SERVER };
|
||||
cvar_t teamlist = { "mp_teamlist","vader;minecraft", FCVAR_SERVER }; // Darth Vaders vs. Minecrafts
|
||||
cvar_t teamoverride = { "mp_teamoverride","1" };
|
||||
cvar_t defaultteam = { "mp_defaultteam","0" };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
|
||||
cvar_t ultraviolence = { "ultraviolence","0", FCVAR_SERVER };
|
||||
cvar_t christmas = { "mp_christmas","0", FCVAR_SERVER };
|
||||
cvar_t testzom = { "mp_testzom","0", FCVAR_SERVER };
|
||||
cvar_t allowmonsters = { "mp_allowmonsters","1", FCVAR_SERVER };
|
||||
cvar_t testmonsters = { "test_monsters_enable","1", FCVAR_SERVER };
|
||||
cvar_t scipgvel = { "test_scipg_vel","800", FCVAR_SERVER };
|
||||
cvar_t pausebots = { "test_pause_bots","0", FCVAR_SERVER };
|
||||
cvar_t enablebots = { "addbot_enable","0", FCVAR_SERVER };
|
||||
cvar_t bottaunt = { "bot_taunt","1", FCVAR_SERVER };
|
||||
cvar_t bottarget = { "bot_target_ent","monster_gay", FCVAR_SERVER };
|
||||
cvar_t shtugn = { "shotgun_enable","1", FCVAR_SERVER };
|
||||
cvar_t cwc = { "chris_bravery","0", FCVAR_SERVER };
|
||||
|
||||
cvar_t mp3player = { "mp3player", "1", FCVAR_SERVER };
|
||||
cvar_t mp3volume = { "mp3volume", "1", FCVAR_SERVER };
|
||||
cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER };
|
||||
|
||||
// Engine Cvars
|
||||
|
@ -243,6 +257,19 @@ cvar_t sk_snark_dmg_pop1 = {"sk_snark_dmg_pop1","0"};
|
|||
cvar_t sk_snark_dmg_pop2 = {"sk_snark_dmg_pop2","0"};
|
||||
cvar_t sk_snark_dmg_pop3 = {"sk_snark_dmg_pop3","0"};
|
||||
|
||||
// Xmas Tree
|
||||
cvar_t sk_xmast_health1 = {"sk_xmast_health1","0"};
|
||||
cvar_t sk_xmast_health2 = {"sk_xmast_health2","0"};
|
||||
cvar_t sk_xmast_health3 = {"sk_xmast_health3","0"};
|
||||
|
||||
cvar_t sk_xmast_dmg_one_slash1 = {"sk_xmast_dmg_one_slash1","0"};
|
||||
cvar_t sk_xmast_dmg_one_slash2 = {"sk_xmast_dmg_one_slash2","0"};
|
||||
cvar_t sk_xmast_dmg_one_slash3 = {"sk_xmast_dmg_one_slash3","0"};
|
||||
|
||||
cvar_t sk_xmast_dmg_both_slash1 = {"sk_xmast_dmg_both_slash1","0"};
|
||||
cvar_t sk_xmast_dmg_both_slash2 = {"sk_xmast_dmg_both_slash2","0"};
|
||||
cvar_t sk_xmast_dmg_both_slash3 = {"sk_xmast_dmg_both_slash3","0"};
|
||||
|
||||
// Zombie
|
||||
cvar_t sk_zombie_health1 = {"sk_zombie_health1","0"};
|
||||
cvar_t sk_zombie_health2 = {"sk_zombie_health2","0"};
|
||||
|
@ -256,6 +283,37 @@ cvar_t sk_zombie_dmg_both_slash1 = {"sk_zombie_dmg_both_slash1","0"};
|
|||
cvar_t sk_zombie_dmg_both_slash2 = {"sk_zombie_dmg_both_slash2","0"};
|
||||
cvar_t sk_zombie_dmg_both_slash3 = {"sk_zombie_dmg_both_slash3","0"};
|
||||
|
||||
// creeper
|
||||
cvar_t sk_creeper_health1 = {"sk_creeper_health1","0"};
|
||||
cvar_t sk_creeper_health2 = {"sk_creeper_health2","0"};
|
||||
cvar_t sk_creeper_health3 = {"sk_creeper_health3","0"};
|
||||
|
||||
// glenn
|
||||
cvar_t sk_glenn_health1 = {"sk_glenn_health1","0"};
|
||||
cvar_t sk_glenn_health2 = {"sk_glenn_health2","0"};
|
||||
cvar_t sk_glenn_health3 = {"sk_glenn_health3","0"};
|
||||
|
||||
cvar_t sk_glenn_dmg_one_slash1 = {"sk_glenn_dmg_one_slash1","0"};
|
||||
cvar_t sk_glenn_dmg_one_slash2 = {"sk_glenn_dmg_one_slash2","0"};
|
||||
cvar_t sk_glenn_dmg_one_slash3 = {"sk_glenn_dmg_one_slash3","0"};
|
||||
|
||||
cvar_t sk_glenn_dmg_both_slash1 = {"sk_glenn_dmg_both_slash1","0"};
|
||||
cvar_t sk_glenn_dmg_both_slash2 = {"sk_glenn_dmg_both_slash2","0"};
|
||||
cvar_t sk_glenn_dmg_both_slash3 = {"sk_glenn_dmg_both_slash3","0"};
|
||||
|
||||
// sinistar
|
||||
cvar_t sk_sinistar_health1 = {"sk_sinistar_health1","0"};
|
||||
cvar_t sk_sinistar_health2 = {"sk_sinistar_health2","0"};
|
||||
cvar_t sk_sinistar_health3 = {"sk_sinistar_health3","0"};
|
||||
|
||||
cvar_t sk_sinistar_dmg_one_slash1 = {"sk_sinistar_dmg_one_slash1","0"};
|
||||
cvar_t sk_sinistar_dmg_one_slash2 = {"sk_sinistar_dmg_one_slash2","0"};
|
||||
cvar_t sk_sinistar_dmg_one_slash3 = {"sk_sinistar_dmg_one_slash3","0"};
|
||||
|
||||
cvar_t sk_sinistar_dmg_both_slash1 = {"sk_sinistar_dmg_both_slash1","0"};
|
||||
cvar_t sk_sinistar_dmg_both_slash2 = {"sk_sinistar_dmg_both_slash2","0"};
|
||||
cvar_t sk_sinistar_dmg_both_slash3 = {"sk_sinistar_dmg_both_slash3","0"};
|
||||
|
||||
//Turret
|
||||
cvar_t sk_turret_health1 = {"sk_turret_health1","0"};
|
||||
cvar_t sk_turret_health2 = {"sk_turret_health2","0"};
|
||||
|
@ -293,12 +351,18 @@ cvar_t sk_plr_9mmAR_bullet1 = {"sk_plr_9mmAR_bullet1","0"};
|
|||
cvar_t sk_plr_9mmAR_bullet2 = {"sk_plr_9mmAR_bullet2","0"};
|
||||
cvar_t sk_plr_9mmAR_bullet3 = {"sk_plr_9mmAR_bullet3","0"};
|
||||
|
||||
cvar_t sk_plr_zapper_bullet1 = {"sk_plr_zapper_bullet1","0"};
|
||||
cvar_t sk_plr_zapper_bullet2 = {"sk_plr_zapper_bullet2","0"};
|
||||
cvar_t sk_plr_zapper_bullet3 = {"sk_plr_zapper_bullet3","0"};
|
||||
|
||||
// M203 grenade
|
||||
cvar_t sk_plr_9mmAR_grenade1 = {"sk_plr_9mmAR_grenade1","0"};
|
||||
cvar_t sk_plr_9mmAR_grenade2 = {"sk_plr_9mmAR_grenade2","0"};
|
||||
cvar_t sk_plr_9mmAR_grenade3 = {"sk_plr_9mmAR_grenade3","0"};
|
||||
|
||||
cvar_t sk_plr_goldengun_bullet1 = {"sk_plr_goldengun_bullet1","0"};
|
||||
cvar_t sk_plr_goldengun_bullet2 = {"sk_plr_goldengun_bullet2","0"};
|
||||
cvar_t sk_plr_goldengun_bullet3 = {"sk_plr_goldengun_bullet3","0"};
|
||||
|
||||
// Shotgun buckshot
|
||||
cvar_t sk_plr_buckshot1 = {"sk_plr_buckshot1","0"};
|
||||
|
@ -307,14 +371,9 @@ cvar_t sk_plr_buckshot3 = {"sk_plr_buckshot3","0"};
|
|||
|
||||
|
||||
// Crossbow
|
||||
cvar_t sk_plr_xbow_bolt_client1 = {"sk_plr_xbow_bolt_client1","0"};
|
||||
cvar_t sk_plr_xbow_bolt_client2 = {"sk_plr_xbow_bolt_client2","0"};
|
||||
cvar_t sk_plr_xbow_bolt_client3 = {"sk_plr_xbow_bolt_client3","0"};
|
||||
|
||||
cvar_t sk_plr_xbow_bolt_monster1 = {"sk_plr_xbow_bolt_monster1","0"};
|
||||
cvar_t sk_plr_xbow_bolt_monster2 = {"sk_plr_xbow_bolt_monster2","0"};
|
||||
cvar_t sk_plr_xbow_bolt_monster3 = {"sk_plr_xbow_bolt_monster3","0"};
|
||||
|
||||
cvar_t sk_plr_modman1 = {"sk_plr_modman1","0"};
|
||||
cvar_t sk_plr_modman2 = {"sk_plr_modman2","0"};
|
||||
cvar_t sk_plr_modman3 = {"sk_plr_modman3","0"};
|
||||
|
||||
// RPG
|
||||
cvar_t sk_plr_rpg1 = {"sk_plr_rpg1","0"};
|
||||
|
@ -355,6 +414,45 @@ cvar_t sk_plr_tripmine1 = {"sk_plr_tripmine1","0"};
|
|||
cvar_t sk_plr_tripmine2 = {"sk_plr_tripmine2","0"};
|
||||
cvar_t sk_plr_tripmine3 = {"sk_plr_tripmine3","0"};
|
||||
|
||||
// Beamkatana
|
||||
cvar_t sk_plr_beamkatana1 = {"sk_plr_beamkatana1","0"};
|
||||
cvar_t sk_plr_beamkatana2 = {"sk_plr_beamkatana2","0"};
|
||||
cvar_t sk_plr_beamkatana3 = {"sk_plr_beamkatana3","0"};
|
||||
|
||||
// Fotn
|
||||
cvar_t sk_plr_fotn1 = {"sk_plr_fotn1","0"};
|
||||
cvar_t sk_plr_fotn2 = {"sk_plr_fotn2","0"};
|
||||
cvar_t sk_plr_fotn3 = {"sk_plr_fotn3","0"};
|
||||
|
||||
// nstar
|
||||
cvar_t sk_plr_nstar1 = {"sk_plr_nstar1","0"};
|
||||
cvar_t sk_plr_nstar2 = {"sk_plr_nstar2","0"};
|
||||
cvar_t sk_plr_nstar3 = {"sk_plr_nstar3","0"};
|
||||
|
||||
// bow
|
||||
cvar_t sk_plr_bow1 = {"sk_plr_bow1","0"};
|
||||
cvar_t sk_plr_bow2 = {"sk_plr_bow2","0"};
|
||||
cvar_t sk_plr_bow3 = {"sk_plr_bow3","0"};
|
||||
|
||||
// ak47
|
||||
cvar_t sk_plr_ak47_bullet1 = {"sk_plr_ak47_bullet1","0"};
|
||||
cvar_t sk_plr_ak47_bullet2 = {"sk_plr_ak47_bullet2","0"};
|
||||
cvar_t sk_plr_ak47_bullet3 = {"sk_plr_ak47_bullet3","0"};
|
||||
|
||||
// jackal
|
||||
cvar_t sk_plr_jackal1 = { "sk_plr_jackal1","0" };
|
||||
cvar_t sk_plr_jackal2 = { "sk_plr_jackal2","0" };
|
||||
cvar_t sk_plr_jackal3 = { "sk_plr_jackal3","0" };
|
||||
|
||||
// modman client
|
||||
cvar_t sk_plr_horn_client1 = {"sk_plr_horn_client1","0"};
|
||||
cvar_t sk_plr_horn_client2 = {"sk_plr_horn_client2","0"};
|
||||
cvar_t sk_plr_horn_client3 = {"sk_plr_horn_client3","0"};
|
||||
|
||||
// modman monster
|
||||
cvar_t sk_plr_horn_monster1 = {"sk_plr_horn_monster1","0"};
|
||||
cvar_t sk_plr_horn_monster2 = {"sk_plr_horn_monster2","0"};
|
||||
cvar_t sk_plr_horn_monster3 = {"sk_plr_horn_monster3","0"};
|
||||
|
||||
// WORLD WEAPONS
|
||||
cvar_t sk_12mm_bullet1 = {"sk_12mm_bullet1","0"};
|
||||
|
@ -441,6 +539,10 @@ cvar_t sk_player_leg3 = { "sk_player_leg3","1" };
|
|||
|
||||
// END Cvars for Skill Level settings
|
||||
|
||||
//START BOT
|
||||
cvar_t cvar_bot = { "bot", "" };
|
||||
//END BOT
|
||||
|
||||
// Register your console variables here
|
||||
// This gets called one time when the game is initialied
|
||||
void GameDLLInit( void )
|
||||
|
@ -453,13 +555,16 @@ void GameDLLInit( void )
|
|||
|
||||
CVAR_REGISTER( &displaysoundlist );
|
||||
|
||||
CVAR_REGISTER( &teamplay );
|
||||
CVAR_REGISTER( &gameplay );
|
||||
CVAR_REGISTER( &fraglimit );
|
||||
CVAR_REGISTER( &timelimit );
|
||||
|
||||
CVAR_REGISTER( &fragsleft );
|
||||
CVAR_REGISTER( &timeleft );
|
||||
|
||||
CVAR_REGISTER( &ultraviolence );
|
||||
CVAR_REGISTER( &christmas );
|
||||
CVAR_REGISTER( &testzom );
|
||||
CVAR_REGISTER( &friendlyfire );
|
||||
CVAR_REGISTER( &falldamage );
|
||||
CVAR_REGISTER( &weaponstay );
|
||||
|
@ -471,6 +576,15 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &teamoverride );
|
||||
CVAR_REGISTER( &defaultteam );
|
||||
CVAR_REGISTER( &allowmonsters );
|
||||
CVAR_REGISTER( &testmonsters );
|
||||
CVAR_REGISTER( &scipgvel );
|
||||
CVAR_REGISTER( &pausebots );
|
||||
CVAR_REGISTER( &enablebots );
|
||||
CVAR_REGISTER( &bottaunt );
|
||||
CVAR_REGISTER( &bottarget );
|
||||
CVAR_REGISTER( &shtugn );
|
||||
CVAR_REGISTER( &cwc );
|
||||
//CVAR_REGISTER( &shtogn );
|
||||
|
||||
CVAR_REGISTER( &mp_chattime );
|
||||
|
||||
|
@ -663,6 +777,19 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &sk_snark_dmg_pop2 );// {"sk_snark_dmg_pop2","0"};
|
||||
CVAR_REGISTER( &sk_snark_dmg_pop3 );// {"sk_snark_dmg_pop3","0"};
|
||||
|
||||
// Xmas Tree
|
||||
CVAR_REGISTER( &sk_xmast_health1 );// {"sk_xmast_health1","0"};
|
||||
CVAR_REGISTER( &sk_xmast_health2 );// {"sk_xmast_health3","0"};
|
||||
CVAR_REGISTER( &sk_xmast_health3 );// {"sk_xmast_health3","0"};
|
||||
|
||||
CVAR_REGISTER( &sk_xmast_dmg_one_slash1 );// {"sk_xmast_dmg_one_slash1","0"};
|
||||
CVAR_REGISTER( &sk_xmast_dmg_one_slash2 );// {"sk_xmast_dmg_one_slash2","0"};
|
||||
CVAR_REGISTER( &sk_xmast_dmg_one_slash3 );// {"sk_xmast_dmg_one_slash3","0"};
|
||||
|
||||
CVAR_REGISTER( &sk_xmast_dmg_both_slash1 );// {"sk_xmast_dmg_both_slash1","0"};
|
||||
CVAR_REGISTER( &sk_xmast_dmg_both_slash2 );// {"sk_xmast_dmg_both_slash2","0"};
|
||||
CVAR_REGISTER( &sk_xmast_dmg_both_slash3 );// {"sk_xmast_dmg_both_slash3","0"};
|
||||
|
||||
// Zombie
|
||||
CVAR_REGISTER( &sk_zombie_health1 );// {"sk_zombie_health1","0"};
|
||||
CVAR_REGISTER( &sk_zombie_health2 );// {"sk_zombie_health3","0"};
|
||||
|
@ -704,10 +831,10 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &sk_plr_9mm_bullet2 );// {"sk_plr_9mm_bullet2","0"};
|
||||
CVAR_REGISTER( &sk_plr_9mm_bullet3 );// {"sk_plr_9mm_bullet3","0"};
|
||||
|
||||
// 357 Round
|
||||
CVAR_REGISTER( &sk_plr_357_bullet1 );// {"sk_plr_357_bullet1","0"};
|
||||
CVAR_REGISTER( &sk_plr_357_bullet2 );// {"sk_plr_357_bullet2","0"};
|
||||
CVAR_REGISTER( &sk_plr_357_bullet3 );// {"sk_plr_357_bullet3","0"};
|
||||
// ak47 Round
|
||||
CVAR_REGISTER( &sk_plr_ak47_bullet1 );// {"sk_plr_ak47_bullet1","0"};
|
||||
CVAR_REGISTER( &sk_plr_ak47_bullet2 );// {"sk_plr_ak47_bullet2","0"};
|
||||
CVAR_REGISTER( &sk_plr_ak47_bullet3 );// {"sk_plr_ak47_bullet3","0"};
|
||||
|
||||
// MP5 Round
|
||||
CVAR_REGISTER( &sk_plr_9mmAR_bullet1 );// {"sk_plr_9mmAR_bullet1","0"};
|
||||
|
@ -719,25 +846,45 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &sk_plr_9mmAR_grenade2 );// {"sk_plr_9mmAR_grenade2","0"};
|
||||
CVAR_REGISTER( &sk_plr_9mmAR_grenade3 );// {"sk_plr_9mmAR_grenade3","0"};
|
||||
|
||||
CVAR_REGISTER( &sk_plr_zapper_bullet1 );
|
||||
CVAR_REGISTER( &sk_plr_zapper_bullet2 );
|
||||
CVAR_REGISTER( &sk_plr_zapper_bullet3 );
|
||||
|
||||
// Shotgun buckshot
|
||||
CVAR_REGISTER( &sk_plr_buckshot1 );// {"sk_plr_buckshot1","0"};
|
||||
CVAR_REGISTER( &sk_plr_buckshot2 );// {"sk_plr_buckshot2","0"};
|
||||
CVAR_REGISTER( &sk_plr_buckshot3 );// {"sk_plr_buckshot3","0"};
|
||||
|
||||
// Crossbow
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_monster1 );// {"sk_plr_xbow_bolt1","0"};
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_monster2 );// {"sk_plr_xbow_bolt2","0"};
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_monster3 );// {"sk_plr_xbow_bolt3","0"};
|
||||
// Beam Katana
|
||||
CVAR_REGISTER( &sk_plr_beamkatana1 );// {"sk_plr_buckshot1","0"};
|
||||
CVAR_REGISTER( &sk_plr_beamkatana2 );// {"sk_plr_buckshot2","0"};
|
||||
CVAR_REGISTER( &sk_plr_beamkatana3 );// {"sk_plr_buckshot3","0"};
|
||||
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_client1 );// {"sk_plr_xbow_bolt1","0"};
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_client2 );// {"sk_plr_xbow_bolt2","0"};
|
||||
CVAR_REGISTER( &sk_plr_xbow_bolt_client3 );// {"sk_plr_xbow_bolt3","0"};
|
||||
// Fotn
|
||||
CVAR_REGISTER( &sk_plr_fotn1 );// {"sk_plr_buckshot1","0"};
|
||||
CVAR_REGISTER( &sk_plr_fotn2 );// {"sk_plr_buckshot2","0"};
|
||||
CVAR_REGISTER( &sk_plr_fotn3 );// {"sk_plr_buckshot3","0"};
|
||||
|
||||
// Modman
|
||||
CVAR_REGISTER( &sk_plr_modman1 );// {"sk_plr_modman_horn1","0"};
|
||||
CVAR_REGISTER( &sk_plr_modman2 );// {"sk_plr_modman_horn2","0"};
|
||||
CVAR_REGISTER( &sk_plr_modman3 );// {"sk_plr_modman_horn3","0"};
|
||||
|
||||
// 357 Round
|
||||
CVAR_REGISTER( &sk_plr_357_bullet1 );// {"sk_plr_357_bullet1","0"};
|
||||
CVAR_REGISTER( &sk_plr_357_bullet2 );// {"sk_plr_357_bullet2","0"};
|
||||
CVAR_REGISTER( &sk_plr_357_bullet3 );// {"sk_plr_357_bullet3","0"};
|
||||
|
||||
// RPG
|
||||
CVAR_REGISTER( &sk_plr_rpg1 );// {"sk_plr_rpg1","0"};
|
||||
CVAR_REGISTER( &sk_plr_rpg2 );// {"sk_plr_rpg2","0"};
|
||||
CVAR_REGISTER( &sk_plr_rpg3 );// {"sk_plr_rpg3","0"};
|
||||
|
||||
// jackal
|
||||
CVAR_REGISTER( &sk_plr_jackal1 );// {"sk_plr_rpg1","0"};
|
||||
CVAR_REGISTER( &sk_plr_jackal2 );// {"sk_plr_rpg2","0"};
|
||||
CVAR_REGISTER( &sk_plr_jackal3 );// {"sk_plr_rpg3","0"};
|
||||
|
||||
// Gauss Gun
|
||||
CVAR_REGISTER( &sk_plr_gauss1 );// {"sk_plr_gauss1","0"};
|
||||
CVAR_REGISTER( &sk_plr_gauss2 );// {"sk_plr_gauss2","0"};
|
||||
|
@ -767,6 +914,26 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &sk_plr_tripmine2 );// {"sk_plr_tripmine2","0"};
|
||||
CVAR_REGISTER( &sk_plr_tripmine3 );// {"sk_plr_tripmine3","0"};
|
||||
|
||||
// bow
|
||||
CVAR_REGISTER( &sk_plr_bow1 );// {"sk_plr_bow1","0"};
|
||||
CVAR_REGISTER( &sk_plr_bow2 );// {"sk_plr_bow2","0"};
|
||||
CVAR_REGISTER( &sk_plr_bow3 );// {"sk_plr_bow3","0"};
|
||||
|
||||
// nstar
|
||||
CVAR_REGISTER( &sk_plr_nstar1 );// {"sk_plr_nstar1","0"};
|
||||
CVAR_REGISTER( &sk_plr_nstar2 );// {"sk_plr_nstar2","0"};
|
||||
CVAR_REGISTER( &sk_plr_nstar3 );// {"sk_plr_nstar3","0"};
|
||||
|
||||
// modman client
|
||||
CVAR_REGISTER( &sk_plr_horn_client1 );// {"sk_plr_horn_client1","0"};
|
||||
CVAR_REGISTER( &sk_plr_horn_client2 );// {"sk_plr_horn_client2","0"};
|
||||
CVAR_REGISTER( &sk_plr_horn_client3 );// {"sk_plr_horn_client3","0"};
|
||||
|
||||
// modman monster
|
||||
CVAR_REGISTER( &sk_plr_horn_monster1 );// {"sk_plr_horn_monster1","0"};
|
||||
CVAR_REGISTER( &sk_plr_horn_monster2 );// {"sk_plr_horn_monster2","0"};
|
||||
CVAR_REGISTER( &sk_plr_horn_monster3 );// {"sk_plr_horn_monster3","0"};
|
||||
|
||||
// WORLD WEAPONS
|
||||
CVAR_REGISTER( &sk_12mm_bullet1 );// {"sk_12mm_bullet1","0"};
|
||||
CVAR_REGISTER( &sk_12mm_bullet2 );// {"sk_12mm_bullet2","0"};
|
||||
|
@ -849,6 +1016,11 @@ void GameDLLInit( void )
|
|||
CVAR_REGISTER( &sk_player_leg3 );
|
||||
// END REGISTER CVARS FOR SKILL LEVEL STUFF
|
||||
|
||||
//START BOT
|
||||
CVAR_REGISTER( &cvar_bot );
|
||||
//END BOT
|
||||
|
||||
SERVER_COMMAND( "echo HALF-SCREWED DEATH AND REBIRTH\n" );
|
||||
SERVER_COMMAND( "exec skill.cfg\n" );
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ extern void GameDLLInit( void );
|
|||
extern cvar_t displaysoundlist;
|
||||
|
||||
// multiplayer server rules
|
||||
extern cvar_t teamplay;
|
||||
extern cvar_t gameplay;
|
||||
extern cvar_t fraglimit;
|
||||
extern cvar_t timelimit;
|
||||
extern cvar_t friendlyfire;
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "teamplay_gamerules.h"
|
||||
#include "shytplay_gamerules.h"
|
||||
#include "heavyrain_gamerules.h"
|
||||
#include "monhunt_gamerules.h"
|
||||
#include "coop_gamerules.h"
|
||||
#include "cod_gamerules.h"
|
||||
#include "test_gamerules.h"
|
||||
#include "skill.h"
|
||||
#include "game.h"
|
||||
|
||||
|
@ -33,7 +39,7 @@ extern DLL_GLOBAL BOOL g_fGameOver;
|
|||
extern int gmsgDeathMsg; // client dll messages
|
||||
extern int gmsgMOTD;
|
||||
|
||||
int g_teamplay = 0;
|
||||
int g_gameplay = 0; // Team, Shyt, Jason Modes
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
|
@ -208,11 +214,29 @@ void CGameRules::RefreshSkillData ( void )
|
|||
gSkillData.snarkDmgBite = GetSkillCvar( "sk_snark_dmg_bite" );
|
||||
gSkillData.snarkDmgPop = GetSkillCvar( "sk_snark_dmg_pop" );
|
||||
|
||||
// xmast
|
||||
gSkillData.xmastHealth = GetSkillCvar( "sk_xmast_health");
|
||||
gSkillData.xmastDmgOneSlash = GetSkillCvar( "sk_xmast_dmg_one_slash");
|
||||
gSkillData.xmastDmgBothSlash = GetSkillCvar( "sk_xmast_dmg_both_slash");
|
||||
|
||||
// Zombie
|
||||
gSkillData.zombieHealth = GetSkillCvar( "sk_zombie_health" );
|
||||
gSkillData.zombieDmgOneSlash = GetSkillCvar( "sk_zombie_dmg_one_slash" );
|
||||
gSkillData.zombieDmgBothSlash = GetSkillCvar( "sk_zombie_dmg_both_slash" );
|
||||
|
||||
// sinistar
|
||||
gSkillData.sinistarHealth = GetSkillCvar( "sk_sinistar_health");
|
||||
gSkillData.sinistarDmgOneSlash = GetSkillCvar( "sk_sinistar_dmg_one_slash");
|
||||
gSkillData.sinistarDmgBothSlash = GetSkillCvar( "sk_sinistar_dmg_both_slash");
|
||||
|
||||
// creeper
|
||||
gSkillData.creeperHealth = GetSkillCvar( "sk_creeper_health");
|
||||
|
||||
// Gay Glenn
|
||||
gSkillData.glennHealth = GetSkillCvar( "sk_glenn_health");
|
||||
gSkillData.glennDmgOneSlash = GetSkillCvar( "sk_glenn_dmg_one_slash");
|
||||
gSkillData.glennDmgBothSlash = GetSkillCvar( "sk_glenn_dmg_both_slash");
|
||||
|
||||
//Turret
|
||||
gSkillData.turretHealth = GetSkillCvar( "sk_turret_health" );
|
||||
|
||||
|
@ -239,23 +263,18 @@ void CGameRules::RefreshSkillData ( void )
|
|||
// M203 grenade
|
||||
gSkillData.plrDmgM203Grenade = GetSkillCvar( "sk_plr_9mmAR_grenade" );
|
||||
|
||||
gSkillData.plrDmgGOLDENGUN = 400;
|
||||
|
||||
gSkillData.plrDmgJackal = GetSkillCvar( "sk_plr_jackal" );
|
||||
|
||||
gSkillData.plrDmgZAPPER = 25;
|
||||
|
||||
// Shotgun buckshot
|
||||
gSkillData.plrDmgBuckshot = GetSkillCvar( "sk_plr_buckshot" );
|
||||
|
||||
// Crossbow
|
||||
gSkillData.plrDmgCrossbowClient = GetSkillCvar( "sk_plr_xbow_bolt_client" );
|
||||
gSkillData.plrDmgCrossbowMonster = GetSkillCvar( "sk_plr_xbow_bolt_monster" );
|
||||
|
||||
// RPG
|
||||
gSkillData.plrDmgRPG = GetSkillCvar( "sk_plr_rpg" );
|
||||
|
||||
// Gauss gun
|
||||
gSkillData.plrDmgGauss = GetSkillCvar( "sk_plr_gauss" );
|
||||
|
||||
// Egon Gun
|
||||
gSkillData.plrDmgEgonNarrow = GetSkillCvar( "sk_plr_egon_narrow" );
|
||||
gSkillData.plrDmgEgonWide = GetSkillCvar( "sk_plr_egon_wide" );
|
||||
|
||||
// Hand Grendade
|
||||
gSkillData.plrDmgHandGrenade = GetSkillCvar( "sk_plr_hand_grenade" );
|
||||
|
||||
|
@ -265,6 +284,16 @@ void CGameRules::RefreshSkillData ( void )
|
|||
// Tripmine
|
||||
gSkillData.plrDmgTripmine = GetSkillCvar( "sk_plr_tripmine" );
|
||||
|
||||
// nstar
|
||||
gSkillData.plrDmgStar = GetSkillCvar( "sk_plr_nstar" );
|
||||
|
||||
// bow
|
||||
gSkillData.plrDmgBow = GetSkillCvar( "sk_plr_bow" );
|
||||
|
||||
// modman
|
||||
gSkillData.plrDmgModmanClient = GetSkillCvar( "sk_plr_horn_client" );
|
||||
gSkillData.plrDmgModmanMonster = GetSkillCvar( "sk_plr_horn_monster" );
|
||||
|
||||
// MONSTER WEAPONS
|
||||
gSkillData.monDmg12MM = GetSkillCvar( "sk_12mm_bullet" );
|
||||
gSkillData.monDmgMP5 = GetSkillCvar ("sk_9mmAR_bullet" );
|
||||
|
@ -273,6 +302,8 @@ void CGameRules::RefreshSkillData ( void )
|
|||
// MONSTER HORNET
|
||||
gSkillData.monDmgHornet = GetSkillCvar( "sk_hornet_dmg" );
|
||||
|
||||
gSkillData.plrDmgAK47 = GetSkillCvar( "sk_plr_ak47_bullet" );
|
||||
|
||||
// PLAYER HORNET
|
||||
// Up to this point, player hornet damage and monster hornet damage were both using
|
||||
// monDmgHornet to determine how much damage to do. In tuning the hivehand, we now need
|
||||
|
@ -301,6 +332,12 @@ void CGameRules::RefreshSkillData ( void )
|
|||
gSkillData.plrStomach = GetSkillCvar( "sk_player_stomach" );
|
||||
gSkillData.plrLeg = GetSkillCvar( "sk_player_leg" );
|
||||
gSkillData.plrArm = GetSkillCvar( "sk_player_arm" );
|
||||
|
||||
// Crowbar whack
|
||||
gSkillData.plrDmgBeamKatana = GetSkillCvar( "sk_plr_beamkatana" );
|
||||
|
||||
// Crowbar whack
|
||||
gSkillData.plrDmgFOTN = GetSkillCvar( "sk_plr_fotn" );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -315,27 +352,51 @@ CGameRules *InstallGameRules( void )
|
|||
if( !gpGlobals->deathmatch )
|
||||
{
|
||||
// generic half-life
|
||||
g_teamplay = 0;
|
||||
g_gameplay = HL_DEATHMATCH;
|
||||
return new CHalfLifeRules;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( teamplay.value > 0 )
|
||||
if( gameplay.value == HL_TEAMPLAY )
|
||||
{
|
||||
// teamplay
|
||||
g_teamplay = 1;
|
||||
g_gameplay = HL_TEAMPLAY;
|
||||
return new CHalfLifeTeamplay;
|
||||
}
|
||||
if( (int)gpGlobals->deathmatch == 1 )
|
||||
if( gameplay.value == HS_SHYTPLAY )
|
||||
{
|
||||
g_gameplay = HS_SHYTPLAY;
|
||||
return new CHalfLifeShytplay;
|
||||
}
|
||||
if ( gameplay.value == HS_HEAVYRAIN )
|
||||
{
|
||||
// vanilla deathmatch
|
||||
g_teamplay = 0;
|
||||
return new CHalfLifeMultiplay;
|
||||
g_gameplay = HS_HEAVYRAIN;
|
||||
return new CHeavyRainplay;
|
||||
}
|
||||
if( gameplay.value == HS_COD )
|
||||
{
|
||||
g_gameplay = HS_COD;
|
||||
return new CCodplay;
|
||||
}
|
||||
if( gameplay.value == HS_COOP )
|
||||
{
|
||||
g_gameplay = HS_COOP;
|
||||
return new CCoopplay;
|
||||
}
|
||||
if( gameplay.value == HS_MONSTER )
|
||||
{
|
||||
g_gameplay = HS_MONSTER;
|
||||
return new CMonsterplay;
|
||||
}
|
||||
if( gameplay.value == HS_TESTMODE )
|
||||
{
|
||||
g_gameplay = HS_TESTMODE;
|
||||
return new CTestplay;
|
||||
}
|
||||
else
|
||||
{
|
||||
// vanilla deathmatch??
|
||||
g_teamplay = 0;
|
||||
g_gameplay = 0;
|
||||
return new CHalfLifeMultiplay;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,11 +70,16 @@ public:
|
|||
virtual BOOL GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon ) = 0;// I can't use this weapon anymore, get me the next best one.
|
||||
|
||||
// Functions to verify the single/multiplayer status of a game
|
||||
virtual BOOL IsSinglePlayer( void ) { return FALSE; }; //is this Single Player?
|
||||
virtual BOOL IsMultiplayer( void ) = 0;// is this a multiplayer game? (either coop or deathmatch)
|
||||
virtual BOOL IsDeathmatch( void ) = 0;//is this a deathmatch game?
|
||||
virtual BOOL IsTeamplay( void ) { return FALSE; };// is this deathmatch game being played with team rules?
|
||||
virtual BOOL IsHeavyRain( void ) { return FALSE; }; //is this Heavy Rain?
|
||||
virtual BOOL IsCOD( void ) { return FALSE; }; // is this COD?
|
||||
virtual BOOL IsTest( void ) { return FALSE; }; // are we in test mode?
|
||||
virtual BOOL IsMonster( void ) { return FALSE; }; // are we in monster hunt mode?
|
||||
virtual BOOL IsCoOp( void ) = 0;// is this a coop game?
|
||||
virtual const char *GetGameDescription( void ) { return "Half-Life"; } // this is the game name that gets seen in the server browser
|
||||
virtual const char *GetGameDescription( void ) { return "Half-Screwed"; } // this is the game name that gets seen in the server browser
|
||||
|
||||
// Client connection/disconnection
|
||||
virtual BOOL ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128] ) = 0;// a client just connected to the server (player hasn't spawned yet)
|
||||
|
@ -183,6 +188,7 @@ public:
|
|||
virtual BOOL GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon );
|
||||
|
||||
// Functions to verify the single/multiplayer status of a game
|
||||
virtual BOOL IsSinglePlayer( void );
|
||||
virtual BOOL IsMultiplayer( void );
|
||||
virtual BOOL IsDeathmatch( void );
|
||||
virtual BOOL IsCoOp( void );
|
||||
|
@ -283,6 +289,9 @@ public:
|
|||
virtual void ClientDisconnected( edict_t *pClient );
|
||||
virtual void UpdateGameMode( CBasePlayer *pPlayer ); // the client needs to be informed of the current game mode
|
||||
|
||||
// Client Steam ID
|
||||
virtual int ClientDevCheck( CBasePlayer *pPlayer );
|
||||
|
||||
// Client damage rules
|
||||
virtual float FlPlayerFallDamage( CBasePlayer *pPlayer );
|
||||
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
|
||||
|
|
|
@ -739,7 +739,7 @@ void CGargantua::Spawn()
|
|||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_GREEN;
|
||||
pev->health = gSkillData.gargantuaHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.gargantuaHealth, 2 );
|
||||
//pev->view_ofs = Vector ( 0, 0, 96 );// taken from mdl file
|
||||
m_flFieldOfView = -0.2;// width of forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
|
|
@ -26,9 +26,13 @@
|
|||
#include "nodes.h"
|
||||
#include "soundent.h"
|
||||
#include "decals.h"
|
||||
#include "player.h"
|
||||
#include "items.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
//===================grenade
|
||||
|
||||
extern int gmsgItemPickup;
|
||||
|
||||
LINK_ENTITY_TO_CLASS( grenade, CGrenade )
|
||||
|
||||
|
@ -130,6 +134,76 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
|
|||
}
|
||||
}
|
||||
|
||||
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
|
||||
void CGrenade::Explode2( TraceResult *pTrace, int bitsDamageType )
|
||||
{
|
||||
float flRndSound;// sound randomizer
|
||||
|
||||
pev->model = iStringNull;//invisible
|
||||
pev->solid = SOLID_NOT;// intangible
|
||||
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
|
||||
// Pull out of the wall a bit
|
||||
if( pTrace->flFraction != 1.0 )
|
||||
{
|
||||
pev->origin = pTrace->vecEndPos + (pTrace->vecPlaneNormal * (pev->dmg - 24) * 0.6);
|
||||
}
|
||||
|
||||
int iContents = UTIL_PointContents ( pev->origin );
|
||||
|
||||
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the explosion sprites/sound
|
||||
WRITE_COORD( pev->origin.x ); // Send to PAS because of the sound
|
||||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
WRITE_SHORT( g_sModelIndexSMB );
|
||||
WRITE_BYTE( ( pev->dmg - 50 ) * .60 ); // scale * 10
|
||||
WRITE_BYTE( 4 ); // framerate
|
||||
WRITE_BYTE( TE_EXPLFLAG_NONE );
|
||||
MESSAGE_END();
|
||||
|
||||
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );
|
||||
entvars_t *pevOwner;
|
||||
if( pev->owner )
|
||||
pevOwner = VARS( pev->owner );
|
||||
else
|
||||
pevOwner = NULL;
|
||||
|
||||
pev->owner = NULL; // can't traceline attack owner if this is set
|
||||
|
||||
RadiusDamage( pev, pevOwner, pev->dmg, CLASS_NONE, bitsDamageType );
|
||||
|
||||
if( RANDOM_FLOAT( 0, 1 ) < 0.5 )
|
||||
{
|
||||
UTIL_DecalTrace( pTrace, DECAL_SCORCH1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
UTIL_DecalTrace( pTrace, DECAL_SCORCH2 );
|
||||
}
|
||||
|
||||
flRndSound = RANDOM_FLOAT( 0, 1 );
|
||||
|
||||
switch( RANDOM_LONG( 0, 2 ) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris1.wav", 0.55, ATTN_NORM );
|
||||
break;
|
||||
case 1:
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris2.wav", 0.55, ATTN_NORM );
|
||||
break;
|
||||
case 2:
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris3.wav", 0.55, ATTN_NORM );
|
||||
break;
|
||||
}
|
||||
|
||||
pev->effects |= EF_NODRAW;
|
||||
SetThink( &CGrenade::Smoke );
|
||||
pev->velocity = g_vecZero;
|
||||
pev->nextthink = gpGlobals->time + 0.3;
|
||||
}
|
||||
|
||||
void CGrenade::Smoke( void )
|
||||
{
|
||||
if( UTIL_PointContents( pev->origin ) == CONTENTS_WATER )
|
||||
|
@ -182,6 +256,27 @@ void CGrenade::Detonate( void )
|
|||
Explode( &tr, DMG_BLAST );
|
||||
}
|
||||
|
||||
void CGrenade::Detonate2( void )
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecSpot;// trace starts here!
|
||||
|
||||
vecSpot = pev->origin + Vector( 30, 30, 30 );
|
||||
UTIL_TraceLine( vecSpot, vecSpot + Vector( 30, 30, 30 ), ignore_monsters, ENT( pev ), &tr );
|
||||
|
||||
Explode( &tr, DMG_BLAST );
|
||||
}
|
||||
|
||||
void CGrenade::Detonate3( void )
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecSpot; // trace starts here!
|
||||
|
||||
vecSpot = pev->origin + Vector( 30, 30, 30 );
|
||||
UTIL_TraceLine( vecSpot, vecSpot + Vector( 30, 30, 30 ), ignore_monsters, ENT( pev ), &tr );
|
||||
|
||||
Explode2( &tr, DMG_BLAST );
|
||||
}
|
||||
|
||||
//
|
||||
// Contact grenade, explode when it touches something
|
||||
|
@ -199,6 +294,35 @@ void CGrenade::ExplodeTouch( CBaseEntity *pOther )
|
|||
Explode( &tr, DMG_BLAST );
|
||||
}
|
||||
|
||||
void CGrenade::ExplodeTouch2( CBaseEntity *pPlayer )
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecSpot;// trace starts here!
|
||||
|
||||
//pev->enemy = pOther->edict();
|
||||
|
||||
vecSpot = pev->origin - pev->velocity.Normalize() * 32;
|
||||
UTIL_TraceLine( vecSpot, vecSpot + pev->velocity.Normalize() * 64, ignore_monsters, ENT( pev ), &tr );
|
||||
|
||||
// Explode( &tr, DMG_BLAST );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/doshget.wav", 0.55, ATTN_NORM );
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
||||
void CGrenade::ExplodeTouch3( CBaseEntity *pOther )
|
||||
{
|
||||
TraceResult tr;
|
||||
Vector vecSpot;// trace starts here!
|
||||
|
||||
pev->enemy = pOther->edict();
|
||||
|
||||
vecSpot = pev->origin - pev->velocity.Normalize() * 32;
|
||||
UTIL_TraceLine( vecSpot, vecSpot + pev->velocity.Normalize() * 64, ignore_monsters, ENT( pev ), &tr );
|
||||
|
||||
Explode2( &tr, DMG_BLAST );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/smbexplode.wav", 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
void CGrenade::DangerSoundThink( void )
|
||||
{
|
||||
if( !IsInWorld() )
|
||||
|
@ -342,6 +466,34 @@ void CGrenade::TumbleThink( void )
|
|||
}
|
||||
}
|
||||
|
||||
void CGrenade::TumbleThink2( void )
|
||||
{
|
||||
if( !IsInWorld() )
|
||||
{
|
||||
UTIL_Remove( this );
|
||||
return;
|
||||
}
|
||||
|
||||
StudioFrameAdvance();
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( pev->dmgtime - 1 < gpGlobals->time )
|
||||
{
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * ( pev->dmgtime - gpGlobals->time ), 400, 0.1 );
|
||||
}
|
||||
|
||||
if( pev->dmgtime <= gpGlobals->time )
|
||||
{
|
||||
SetThink( &CGrenade::Detonate2 );
|
||||
}
|
||||
|
||||
if( pev->waterlevel != 0 )
|
||||
{
|
||||
pev->velocity = pev->velocity * 0.5;
|
||||
pev->framerate = 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
void CGrenade::Spawn( void )
|
||||
{
|
||||
pev->movetype = MOVETYPE_BOUNCE;
|
||||
|
@ -356,6 +508,20 @@ void CGrenade::Spawn( void )
|
|||
m_fRegisteredSound = FALSE;
|
||||
}
|
||||
|
||||
void CGrenade::DoshSpawn( void )
|
||||
{
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
pev->classname = MAKE_STRING( "grenade" );
|
||||
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
SET_MODEL( ENT( pev ), "models/dosh.mdl" );
|
||||
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
|
||||
|
||||
pev->dmg = 100;
|
||||
m_fRegisteredSound = FALSE;
|
||||
}
|
||||
|
||||
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
|
||||
{
|
||||
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
|
||||
|
@ -382,6 +548,33 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v
|
|||
return pGrenade;
|
||||
}
|
||||
|
||||
CGrenade *CGrenade::ShootContact2( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ) //No tumble, for dosh ONLY
|
||||
{
|
||||
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
|
||||
pGrenade->DoshSpawn();
|
||||
|
||||
// contact grenades arc lower
|
||||
pGrenade->pev->gravity = 0.4;// lower gravity since grenade is aerodynamic and engine doesn't know it.
|
||||
UTIL_SetOrigin( pGrenade->pev, vecStart );
|
||||
pGrenade->pev->velocity = vecVelocity;
|
||||
pGrenade->pev->angles = UTIL_VecToAngles( pGrenade->pev->velocity );
|
||||
pGrenade->pev->owner = ENT(pevOwner);
|
||||
|
||||
// make monsters afaid of it while in the air
|
||||
pGrenade->SetThink( &CGrenade::DangerSoundThink );
|
||||
pGrenade->pev->nextthink = gpGlobals->time;
|
||||
|
||||
// Tumble in air
|
||||
// pGrenade->pev->avelocity.x = RANDOM_FLOAT( -100, -500 );
|
||||
|
||||
// Explode on contact
|
||||
pGrenade->SetTouch( &CDoshRocket::DoshTouch );
|
||||
|
||||
// pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;
|
||||
|
||||
return pGrenade;
|
||||
}
|
||||
|
||||
CGrenade *CGrenade::ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
|
||||
{
|
||||
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
|
||||
|
@ -421,6 +614,46 @@ CGrenade *CGrenade::ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vec
|
|||
return pGrenade;
|
||||
}
|
||||
|
||||
CGrenade *CGrenade::ShootJihad( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
|
||||
{
|
||||
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
|
||||
pGrenade->Spawn();
|
||||
UTIL_SetOrigin( pGrenade->pev, vecStart );
|
||||
pGrenade->pev->velocity = vecVelocity;
|
||||
pGrenade->pev->angles = UTIL_VecToAngles( pGrenade->pev->velocity );
|
||||
pGrenade->pev->owner = ENT( pevOwner );
|
||||
|
||||
pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched
|
||||
|
||||
// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
|
||||
// will insert a DANGER sound into the world sound list and delay detonation for one second so that
|
||||
// the grenade explodes after the exact amount of time specified in the call to ShootTimed().
|
||||
|
||||
pGrenade->pev->dmgtime = gpGlobals->time + time;
|
||||
pGrenade->SetThink( &CGrenade::TumbleThink2 );
|
||||
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if( time < 0.1 )
|
||||
{
|
||||
pGrenade->pev->nextthink = gpGlobals->time;
|
||||
pGrenade->pev->velocity = Vector( 0, 0, 0 );
|
||||
}
|
||||
|
||||
pGrenade->pev->sequence = 0.01;
|
||||
pGrenade->pev->framerate = 1.0;
|
||||
|
||||
// Tumble through the air
|
||||
// pGrenade->pev->avelocity.x = -400;
|
||||
|
||||
pGrenade->pev->gravity = 0;
|
||||
pGrenade->pev->friction = 1;
|
||||
|
||||
SET_MODEL( ENT( pGrenade->pev ), "models/w_grenade.mdl" );
|
||||
pGrenade->pev->dmg = 1000;
|
||||
|
||||
return pGrenade;
|
||||
}
|
||||
|
||||
CGrenade *CGrenade::ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
|
||||
{
|
||||
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
|
||||
|
|
|
@ -282,7 +282,7 @@ void CHAssassin::Spawn()
|
|||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
pev->effects = 0;
|
||||
pev->health = gSkillData.hassassinHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.hassassinHealth, 2 );
|
||||
m_flFieldOfView = VIEW_FIELD_WIDE; // indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_afCapability = bits_CAP_MELEE_ATTACK1 | bits_CAP_DOORS_GROUP;
|
||||
|
|
|
@ -288,7 +288,7 @@ void CHeadCrab::Spawn()
|
|||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_GREEN;
|
||||
pev->effects = 0;
|
||||
pev->health = gSkillData.headcrabHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.headcrabHealth, 5 );
|
||||
pev->view_ofs = Vector( 0, 0, 20 );// position of the eyes relative to monster's origin.
|
||||
pev->yaw_speed = 5;//!!! should we put this in the monster's changeanim function since turn rates may vary with state/anim?
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
|
|
|
@ -979,7 +979,7 @@ void CHGrunt::Spawn()
|
|||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
pev->effects = 0;
|
||||
pev->health = gSkillData.hgruntHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.hgruntHealth, 2 );
|
||||
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_flNextGrenadeCheck = gpGlobals->time + 1;
|
||||
|
|
|
@ -98,7 +98,7 @@ int CHgun::GetItemInfo( ItemInfo *p )
|
|||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 3;
|
||||
p->iPosition = 3;
|
||||
p->iPosition = 2;
|
||||
p->iId = m_iId = WEAPON_HORNETGUN;
|
||||
p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY | ITEM_FLAG_NOAUTORELOAD;
|
||||
p->iWeight = HORNETGUN_WEIGHT;
|
||||
|
@ -113,7 +113,7 @@ BOOL CHgun::Deploy()
|
|||
|
||||
void CHgun::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.02;
|
||||
SendWeaponAnim( HGUN_DOWN );
|
||||
|
||||
//!!!HACKHACK - can't select hornetgun if it's empty! no way to get ammo for it, either.
|
||||
|
@ -240,7 +240,7 @@ void CHgun::SecondaryAttack( void )
|
|||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.001;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ void CHgun::Reload( void )
|
|||
while( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time )
|
||||
{
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
|
||||
m_flRechargeTime += 0.5;
|
||||
m_flRechargeTime += 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ void CHoundeye::Spawn()
|
|||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_YELLOW;
|
||||
pev->effects = 0;
|
||||
pev->health = gSkillData.houndeyeHealth;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.houndeyeHealth, 2 );
|
||||
pev->yaw_speed = 5;//!!! should we put this in the monster's changeanim function since turn rates may vary with state/anim?
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
// The Following is Based on Counter-Strike's AK-47 Weapon
|
||||
// In no way am I trying to break the law
|
||||
// I am simply practicing.
|
||||
// Valve or anyone will authority, please don't sue me.
|
||||
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "soundent.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
enum ak47_e
|
||||
{
|
||||
AK47_IDLE1 = 0,
|
||||
AK47_RELOAD,
|
||||
AK47_DRAW,
|
||||
AK47_SHOOT1,
|
||||
AK47_SHOOT2,
|
||||
AK47_SHOOT3,
|
||||
};
|
||||
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_ak47, CAK47 );
|
||||
//LINK_ENTITY_TO_CLASS( weapon_9mmAR, CMP5 );
|
||||
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
|
||||
void CAK47::Spawn( )
|
||||
{
|
||||
pev->classname = MAKE_STRING("weapon_ak47"); // hack to allow for old names
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_ak47.mdl");
|
||||
m_iId = WEAPON_AK47;
|
||||
|
||||
m_iDefaultAmmo = AK47_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CAK47::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_ak47.mdl");
|
||||
PRECACHE_MODEL("models/w_ak47.mdl");
|
||||
PRECACHE_MODEL("models/p_ak47.mdl");
|
||||
|
||||
m_iShell = PRECACHE_MODEL ("models/rshell.mdl");// brass shellTE_MODEL
|
||||
|
||||
//PRECACHE_MODEL("models/grenade.mdl"); // grenade
|
||||
|
||||
//PRECACHE_MODEL("models/w_ak47.mdl");
|
||||
//PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
|
||||
PRECACHE_SOUND("weapons/ak47_clipin.wav");
|
||||
PRECACHE_SOUND("weapons/ak47_clipin.wav");
|
||||
|
||||
PRECACHE_MODEL ("models/w_ak47clip.mdl");
|
||||
|
||||
PRECACHE_SOUND ("weapons/ak47-1.wav");// A to the K
|
||||
PRECACHE_SOUND ("weapons/ak47-2.wav");// A to the K
|
||||
//PRECACHE_SOUND ("weapons/hks3.wav");// H to the K
|
||||
|
||||
//PRECACHE_SOUND( "weapons/glauncher.wav" );
|
||||
//PRECACHE_SOUND( "weapons/glauncher2.wav" );
|
||||
|
||||
PRECACHE_SOUND ("weapons/ak47_boltpull.wav");
|
||||
|
||||
m_usAK47 = PRECACHE_EVENT( 1, "events/ak47.sc" );
|
||||
//m_usMP52 = PRECACHE_EVENT( 1, "events/mp52.sc" );
|
||||
}
|
||||
|
||||
int CAK47::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "ak47";
|
||||
p->iMaxAmmo1 = AK47_MAX_CARRY;
|
||||
//p->pszAmmo2 = "ARgrenades";
|
||||
//p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY;
|
||||
p->iMaxClip = AK47_MAX_CLIP;
|
||||
p->iSlot = 2;
|
||||
p->iPosition = 2;
|
||||
p->iFlags = 0;
|
||||
p->iId = m_iId = WEAPON_AK47;
|
||||
p->iWeight = AK47_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CAK47::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CAK47::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_ak47.mdl", "models/p_ak47.mdl", AK47_DRAW, "mp5" );
|
||||
}
|
||||
|
||||
|
||||
void CAK47::PrimaryAttack()
|
||||
{
|
||||
// don't fire underwater
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iClip <= 0)
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
|
||||
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
|
||||
|
||||
m_iClip--;
|
||||
|
||||
|
||||
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
Vector vecDir;
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
if ( !bIsMultiplayer() )
|
||||
#else
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
#endif
|
||||
{
|
||||
// optimized multiplayer. Widened to make it easier to hit a moving player
|
||||
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_6DEGREES, 8192, BULLET_PLAYER_AK47, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed );
|
||||
}
|
||||
else
|
||||
{
|
||||
// single player spread
|
||||
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_AK47, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed );
|
||||
}
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usAK47, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
if ( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
|
||||
void CAK47::Reload( void )
|
||||
{
|
||||
DefaultReload( AK47_MAX_CLIP, AK47_RELOAD, 3.0 );
|
||||
}
|
||||
|
||||
|
||||
void CAK47::WeaponIdle( void )
|
||||
{
|
||||
ResetEmptySound( );
|
||||
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
int iAnim;
|
||||
iAnim = AK47_IDLE1;
|
||||
|
||||
SendWeaponAnim( iAnim );
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CAK47AmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_ak47clip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_ak47clip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_AK47_GIVE, "ak47", AK47_MAX_CARRY) != -1);
|
||||
if (bResult)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_ak47, CAK47AmmoClip );
|
||||
//LINK_ENTITY_TO_CLASS( ammo_ak47, CAk47AmmoClip );
|
|
@ -0,0 +1,350 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
|
||||
#define BEAMKATANA_BODYHIT_VOLUME 128
|
||||
#define BEAMKATANA_WALLHIT_VOLUME 512
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_beamkatana, CBeamKatana );
|
||||
|
||||
|
||||
|
||||
enum gauss_e {
|
||||
BEAMKATANA_IDLE = 0,
|
||||
BEAMKATANA_DRAW,
|
||||
BEAMKATANA_HOLSTER,
|
||||
BEAMKATANA_ATTACK1HIT,
|
||||
BEAMKATANA_ATTACK1MISS,
|
||||
BEAMKATANA_ATTACK2MISS,
|
||||
BEAMKATANA_ATTACK2HIT,
|
||||
BEAMKATANA_ATTACK3MISS,
|
||||
BEAMKATANA_ATTACK3HIT
|
||||
};
|
||||
|
||||
|
||||
void CBeamKatana::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_BEAMKATANA;
|
||||
SET_MODEL(ENT(pev), "models/w_beamkatana.mdl");
|
||||
m_iClip = -1;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CBeamKatana::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_beamkatana.mdl");
|
||||
PRECACHE_MODEL("models/w_beamkatana.mdl");
|
||||
PRECACHE_MODEL("models/p_beamkatana.mdl");
|
||||
PRECACHE_SOUND("weapons/beamkatana_hit1.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_hit2.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_hitbod1.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_hitbod2.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_hitbod3.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_miss1.wav");
|
||||
PRECACHE_SOUND("weapons/beamkatana_out.wav");
|
||||
PRECACHE_SOUND("taunts/bk_1.wav");
|
||||
//PRECACHE_SOUND("taunts/bk_2.wav");
|
||||
PRECACHE_SOUND("taunts/bk_3.wav");
|
||||
PRECACHE_SOUND("taunts/bk_4.wav");
|
||||
PRECACHE_SOUND("taunts/bk_5.wav");
|
||||
PRECACHE_SOUND("taunts/bk_6.wav");
|
||||
|
||||
m_usBeamKatana = PRECACHE_EVENT ( 1, "events/beamkatana.sc" );
|
||||
}
|
||||
|
||||
int CBeamKatana::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 0;
|
||||
p->iPosition = 1;
|
||||
p->iId = WEAPON_BEAMKATANA;
|
||||
p->iWeight = BEAMKATANA_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CBeamKatana::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_beamkatana.mdl", "models/p_beamkatana.mdl", BEAMKATANA_DRAW, "crowbar" );
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_out.wav", 1, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
}
|
||||
|
||||
void CBeamKatana::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( BEAMKATANA_HOLSTER );
|
||||
}
|
||||
|
||||
|
||||
void FindBullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity )
|
||||
{
|
||||
int i, j, k;
|
||||
float distance;
|
||||
float *minmaxs[2] = {mins, maxs};
|
||||
TraceResult tmpTrace;
|
||||
Vector vecHullEnd = tr.vecEndPos;
|
||||
Vector vecEnd;
|
||||
|
||||
distance = 1e6f;
|
||||
|
||||
vecHullEnd = vecSrc + ((vecHullEnd - vecSrc)*2);
|
||||
UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
for ( j = 0; j < 2; j++ )
|
||||
{
|
||||
for ( k = 0; k < 2; k++ )
|
||||
{
|
||||
vecEnd.x = vecHullEnd.x + minmaxs[i][0];
|
||||
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
|
||||
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
float thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
|
||||
if ( thisDistance < distance )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
distance = thisDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CBeamKatana::PrimaryAttack()
|
||||
{
|
||||
if (! Swing( 1 ))
|
||||
{
|
||||
SetThink( &CBeamKatana::SwingAgain );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
void CBeamKatana::SecondaryAttack()
|
||||
{
|
||||
Fuckhead();
|
||||
}
|
||||
|
||||
void CBeamKatana::Fuckhead()
|
||||
{
|
||||
switch( RANDOM_LONG(0,4) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "taunts/bk_1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "taunts/bk_3.wav", 1, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "taunts/bk_4.wav", 1, ATTN_NORM); break;
|
||||
case 3:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "taunts/bk_5.wav", 1, ATTN_NORM); break;
|
||||
case 4:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "taunts/bk_6.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2;
|
||||
|
||||
}
|
||||
|
||||
void CBeamKatana::Smack( )
|
||||
{
|
||||
DecalGunshot( &m_trHit, BULLET_PLAYER_BEAMKATANA );
|
||||
}
|
||||
|
||||
|
||||
void CBeamKatana::SwingAgain( void )
|
||||
{
|
||||
Swing( 0 );
|
||||
}
|
||||
|
||||
|
||||
int CBeamKatana::Swing( int fFirst )
|
||||
{
|
||||
int fDidHit = FALSE;
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
UTIL_MakeVectors (m_pPlayer->pev->v_angle);
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
|
||||
if ( tr.flFraction < 1.0 )
|
||||
{
|
||||
// Calculate the point of intersection of the line (or hull) and the object we hit
|
||||
// This is and approximation of the "best" intersection
|
||||
CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit );
|
||||
if ( !pHit || pHit->IsBSPModel() )
|
||||
FindBullIntersection( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() );
|
||||
vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usBeamKatana,
|
||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
||||
0.0, 0, 0.0 );
|
||||
|
||||
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
if (fFirst)
|
||||
{
|
||||
// miss
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( ((m_iSwing++) % 2) + 1 )
|
||||
{
|
||||
case 0:
|
||||
SendWeaponAnim( BEAMKATANA_ATTACK1HIT ); break;
|
||||
case 1:
|
||||
SendWeaponAnim( BEAMKATANA_ATTACK2HIT ); break;
|
||||
case 2:
|
||||
SendWeaponAnim( BEAMKATANA_ATTACK3HIT ); break;
|
||||
}
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
|
||||
// hit
|
||||
fDidHit = TRUE;
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||
|
||||
ClearMultiDamage( );
|
||||
|
||||
if ( (m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// first swing does full damage
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
else
|
||||
{
|
||||
// subsequent swings do half
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgBeamKatana / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||
|
||||
// play thwack, smack, or dong sound
|
||||
float flVol = 1.0;
|
||||
int fHitWorld = TRUE;
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||
{
|
||||
// play thwack or smack sound
|
||||
switch( RANDOM_LONG(0,2) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_hitbod1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_hitbod2.wav", 1, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_hitbod3.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
m_pPlayer->m_iWeaponVolume = BEAMKATANA_BODYHIT_VOLUME;
|
||||
if ( !pEntity->IsAlive() )
|
||||
return TRUE;
|
||||
else
|
||||
flVol = 0.1;
|
||||
|
||||
fHitWorld = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// play texture hit sound
|
||||
// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line
|
||||
|
||||
if (fHitWorld)
|
||||
{
|
||||
float fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd-vecSrc)*2, BULLET_PLAYER_BEAMKATANA);
|
||||
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// override the volume here, cause we don't play texture sounds in multiplayer,
|
||||
// and fvolbar is going to be 0 from the above call.
|
||||
|
||||
fvolbar = 1;
|
||||
}
|
||||
|
||||
// also play crowbar strike
|
||||
switch( RANDOM_LONG(0,1) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_hit1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
case 1:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/beamkatana_hit2.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
}
|
||||
|
||||
// delay the decal a bit
|
||||
m_trHit = tr;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = flVol * BEAMKATANA_WALLHIT_VOLUME;
|
||||
#endif
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
||||
|
||||
SetThink( &CBeamKatana::Smack );
|
||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
|
||||
|
||||
|
||||
}
|
||||
return fDidHit;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
#include "time.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_boombox, CBoombox );
|
||||
|
||||
enum gauss_e {
|
||||
BOOMBOX_IDLE = 0,
|
||||
BOOMBOX_DRAW,
|
||||
BOOMBOX_HOLSTER,
|
||||
BOOMBOX_IDLE2,
|
||||
BOOMBOX_IDLE3,
|
||||
};
|
||||
|
||||
|
||||
const char *CBoombox::pBoomboxSongs[] =
|
||||
{
|
||||
"bbox/song1.wav",
|
||||
"bbox/song2.wav",
|
||||
"bbox/song3.wav",
|
||||
"bbox/song4.wav",
|
||||
"bbox/song5.wav",
|
||||
"bbox/song6.wav",
|
||||
"bbox/song7.wav"
|
||||
};
|
||||
|
||||
void CBoombox::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_BOOMBOX;
|
||||
SET_MODEL(ENT(pev), "models/w_boombox.mdl");
|
||||
m_iClip = -1;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CBoombox::Precache( void )
|
||||
{
|
||||
int i;
|
||||
PRECACHE_MODEL("models/v_boombox.mdl");
|
||||
PRECACHE_MODEL("models/w_boombox.mdl");
|
||||
PRECACHE_MODEL("models/p_boombox.mdl");
|
||||
for ( i = 0; i < ARRAYSIZE( pBoomboxSongs ); i++ )
|
||||
PRECACHE_SOUND((char *)pBoomboxSongs[i]);
|
||||
PRECACHE_SOUND("bbox/xmassong.wav");
|
||||
PRECACHE_SOUND("bbox/songrc.wav");
|
||||
|
||||
m_iSpriteTexture = PRECACHE_MODEL( "sprites/shockwave.spr" );
|
||||
|
||||
m_usBoombox = PRECACHE_EVENT ( 1, "events/boombox.sc" );
|
||||
}
|
||||
|
||||
int CBoombox::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 0;
|
||||
p->iPosition = 3;
|
||||
p->iId = WEAPON_BOOMBOX;
|
||||
p->iWeight = BOOMBOX_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CBoombox::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_boombox.mdl", "models/p_boombox.mdl", BOOMBOX_DRAW, "rpg" );
|
||||
}
|
||||
|
||||
void CBoombox::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
int i;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( BOOMBOX_HOLSTER );
|
||||
for ( i = 0; i < ARRAYSIZE( pBoomboxSongs ); i++ )
|
||||
{
|
||||
STOP_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, pBoomboxSongs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CBoombox::PrimaryAttack()
|
||||
{
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME) malloc(sizeof(SYSTEMTIME));
|
||||
GetLocalTime(sysDate);
|
||||
|
||||
if (sysDate->wMonth == 12 && sysDate->wDay == 25 ) {
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "bbox/xmassong.wav", 1, ATTN_NORM);
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
return;
|
||||
}
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, pBoomboxSongs[ RANDOM_LONG(0,ARRAYSIZE(pBoomboxSongs)-1) ], 1, ATTN_NORM);
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
}
|
||||
|
||||
void CBoombox::SecondaryAttack()
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "bbox/songrc.wav", 1, ATTN_NORM); //1.83
|
||||
#ifndef CLIENT_DLL
|
||||
UTIL_ScreenShake( m_pPlayer->pev->origin, 25.0, 200.0, 2, 750 );
|
||||
#endif
|
||||
RadiusDamage( m_pPlayer->pev->origin, pev, m_pPlayer->pev, 10, 750, CLASS_NONE, DMG_BILLNYE | DMG_ALWAYSGIB );
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.75;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,178 @@
|
|||
// botman's Half-Life bot example
|
||||
//
|
||||
// http://planethalflife.com/botman/
|
||||
//
|
||||
// bot.h
|
||||
//
|
||||
|
||||
#ifndef BOT_H
|
||||
#define BOT_H
|
||||
|
||||
#define LADDER_UP 1
|
||||
#define LADDER_DOWN 2
|
||||
|
||||
#define WANDER_LEFT 1
|
||||
#define WANDER_RIGHT 2
|
||||
|
||||
#define MODEL_HGRUNT 1
|
||||
#define MODEL_BARNEY 2
|
||||
#define MODEL_SCIENTIST 3
|
||||
#define MODEL_VADER 4
|
||||
|
||||
#define BOT_YAW_SPEED 20 // degrees per 10th of second turning speed
|
||||
|
||||
#define BOT_SKIN_LEN 16
|
||||
#define BOT_NAME_LEN 31
|
||||
|
||||
|
||||
typedef struct // used in checking if bot can pick up ammo
|
||||
{
|
||||
char *ammo_name;
|
||||
char *weapon_name;
|
||||
int max_carry;
|
||||
} ammo_check_t;
|
||||
|
||||
#define BOT_IDLE 0
|
||||
#define BOT_NEED_TO_KICK 1
|
||||
#define BOT_NEED_TO_RESPAWN 2
|
||||
#define BOT_IS_RESPAWNING 3
|
||||
|
||||
typedef struct // used to respawn bot at end of round (time/frag limit)
|
||||
{
|
||||
BOOL is_used; // is this slot in use?
|
||||
int state; // current state of the bot
|
||||
char skin[BOT_SKIN_LEN+1];
|
||||
char name[BOT_NAME_LEN+1];
|
||||
char skill[2];
|
||||
CBasePlayer *pBot;
|
||||
} respawn_t;
|
||||
|
||||
#define HG_SND1 "hgrunt/gr_pain1.wav"
|
||||
#define HG_SND2 "hgrunt/gr_pain2.wav"
|
||||
#define HG_SND3 "hgrunt/gr_pain3.wav"
|
||||
#define HG_SND4 "hgrunt/gr_pain4.wav"
|
||||
#define HG_SND5 "hgrunt/gr_pain5.wav"
|
||||
|
||||
#define BA_SND1 "barney/ba_bring.wav"
|
||||
#define BA_SND2 "barney/ba_pain1.wav"
|
||||
#define BA_SND3 "barney/ba_pain2.wav"
|
||||
#define BA_SND4 "barney/ba_pain3.wav"
|
||||
#define BA_SND5 "barney/ba_die1.wav"
|
||||
|
||||
#define SC_SND1 "scientist/sci_fear8.wav"
|
||||
#define SC_SND2 "scientist/sci_fear13.wav"
|
||||
#define SC_SND3 "scientist/sci_fear14.wav"
|
||||
#define SC_SND4 "scientist/sci_fear15.wav"
|
||||
#define SC_SND5 "scientist/sci_pain3.wav"
|
||||
|
||||
#define BA_TNT1 "barney/ba_another.wav"
|
||||
#define BA_TNT2 "barney/ba_endline.wav"
|
||||
#define BA_TNT3 "barney/ba_gotone.wav"
|
||||
#define BA_TNT4 "barney/ba_seethat.wav"
|
||||
#define BA_TNT5 "barney/ba_tomb.wav"
|
||||
|
||||
#define SC_TNT1 "scientist/odorfromyou.wav"
|
||||
#define SC_TNT2 "scientist/smellburn.wav"
|
||||
#define SC_TNT3 "scientist/somethingfoul.wav"
|
||||
#define SC_TNT4 "scientist/youlookbad.wav"
|
||||
#define SC_TNT5 "scientist/youneedmedic.wav"
|
||||
|
||||
#define DV_TNT1 "vader/t1.wav"
|
||||
#define DV_TNT2 "vader/t2.wav"
|
||||
#define DV_TNT3 "vader/t3.wav"
|
||||
#define DV_TNT4 "vader/t4.wav"
|
||||
#define DV_TNT5 "vader/t5.wav"
|
||||
|
||||
#define USE_TEAMPLAY_SND "barney/teamup2.wav"
|
||||
#define USE_TEAMPLAY_LATER_SND "barney/seeya.wav"
|
||||
#define USE_TEAMPLAY_ENEMY_SND "barney/ba_raincheck.wav"
|
||||
|
||||
|
||||
void BotDebug( char *buffer ); // print out message to HUD for debugging
|
||||
|
||||
|
||||
class CBot : public CBasePlayer //Derive a bot class from CBasePlayer
|
||||
{
|
||||
public:
|
||||
Vector v_prev_origin; // previous origin (i.e. location)
|
||||
float f_shoot_time; // next time to shoot weapon at
|
||||
float f_max_speed; // last sv_maxspeed setting
|
||||
float f_speed_check_time; // check sv_maxspeed every so often
|
||||
float f_move_speed; // speed at which the bot will move
|
||||
int ladder_dir; // direction traveling on ladder (UP or DOWN)
|
||||
int wander_dir; // randomly wander left or right
|
||||
float f_pause_time; // timeout for periods when the bot pauses
|
||||
float f_find_item; // timeout for not looking for items
|
||||
char model_name[20];
|
||||
int bot_model;
|
||||
int bot_skill; // bot skill level (0=very good, 4=very bad)
|
||||
float f_pain_time; // time when pain sound can be spoken
|
||||
BOOL b_use_health_station; // set if bot should "use" health station
|
||||
float f_use_health_time; // time when b_use_health_station is set
|
||||
BOOL b_use_HEV_station; // set if bot should "use" HEV station
|
||||
float f_use_HEV_time; // time when b_use_HEV_station is set
|
||||
BOOL b_use_button; // set if bot should "use" button
|
||||
float f_use_button_time; // time when b_use_button is set
|
||||
BOOL b_lift_moving; // flag set when lift (elevator) is moving
|
||||
float f_use_ladder_time; // time when bot sees a ladder
|
||||
BOOL b_see_tripmine; // set if bot "sees" a tripmine
|
||||
BOOL b_shoot_tripmine; // set if bot should shoot a tripmine
|
||||
Vector v_tripmine_origin; // origin of tripmine
|
||||
float f_fire_gauss; // time to release secondary fire on gauss gun
|
||||
BOOL bot_was_paused; // TRUE if bot was previously "paused"
|
||||
float f_weapon_inventory_time; // time to check weapon inventory
|
||||
int respawn_index; // index in respawn structure for this bot
|
||||
float f_dont_avoid_wall_time; // time when avoiding walls is OK
|
||||
float f_bot_use_time; // time the bot was "used" by player
|
||||
float f_wall_on_left; // time since bot has had a wall on the left
|
||||
float f_wall_on_right; // time since bot has had a wall on the right
|
||||
|
||||
CBaseEntity *pBotEnemy; // pointer to bot's enemy
|
||||
CBaseEntity *pBotUser; // pointer to player using bot
|
||||
CBaseEntity *pBotPickupItem; // pointer to item we are trying to get
|
||||
CBasePlayerItem *weapon_ptr[MAX_WEAPONS]; // pointer array to weapons
|
||||
int primary_ammo[MAX_WEAPONS]; // amount of primary ammo available
|
||||
int secondary_ammo[MAX_WEAPONS]; // amount of secondary ammo available
|
||||
|
||||
char message[256]; // buffer for debug messages
|
||||
|
||||
void Spawn( void );
|
||||
void BotThink( void ); // think function for the bot
|
||||
|
||||
// Bots should return FALSE for this, they can't receive NET messages
|
||||
virtual BOOL IsNetClient( void ) { return FALSE; }
|
||||
|
||||
int BloodColor() { return BLOOD_COLOR_RED; }
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker,
|
||||
float flDamage, int bitsDamageType );
|
||||
int ObjectCaps() { return FCAP_IMPULSE_USE; };
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
||||
USE_TYPE useType, float value );
|
||||
|
||||
int BotInFieldOfView( Vector dest );
|
||||
BOOL BotEntityIsVisible( Vector dest );
|
||||
float BotChangeYaw( float speed );
|
||||
void BotOnLadder( float moved_distance );
|
||||
void BotUnderWater( void );
|
||||
CBaseEntity * BotFindEnemy( void );
|
||||
Vector BotBodyTarget( CBaseEntity *pBotEnemy );
|
||||
void BotWeaponInventory( void );
|
||||
BOOL BotFireWeapon( Vector enemy, int weapon_choice = 0, BOOL primary = TRUE );
|
||||
void BotShootAtEnemy( void );
|
||||
void BotFindItem( void );
|
||||
void BotUseLift( float moved_distance );
|
||||
void BotTurnAtWall( TraceResult *tr );
|
||||
BOOL BotCantMoveForward( TraceResult *tr );
|
||||
BOOL BotCanJumpUp( void );
|
||||
BOOL BotCanDuckUnder( void );
|
||||
BOOL BotShootTripmine( void );
|
||||
BOOL BotFollowUser( void ); // returns FALSE if can find "user"
|
||||
BOOL BotCheckWallOnLeft( void );
|
||||
BOOL BotCheckWallOnRight( void );
|
||||
|
||||
private:
|
||||
char NormalChatter [100];
|
||||
};
|
||||
|
||||
#endif // BOT_H
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,142 @@
|
|||
// botman's Half-Life bot example
|
||||
//
|
||||
// http://planethalflife.com/botman/
|
||||
//
|
||||
// botcam.cpp
|
||||
//
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "client.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "botcam.h"
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS(entity_botcam, CBotCam);
|
||||
|
||||
|
||||
CBotCam *CBotCam::Create( CBasePlayer *pPlayer, CBasePlayer *pBot )
|
||||
{
|
||||
CBotCam *pBotCam = GetClassPtr( (CBotCam *)NULL );
|
||||
|
||||
PRECACHE_MODEL( "models/mechgibs.mdl" );
|
||||
|
||||
pBotCam->m_pPlayer = pPlayer;
|
||||
pBotCam->m_pBot = pBot;
|
||||
|
||||
pPlayer->pev->effects |= EF_NODRAW;
|
||||
pPlayer->pev->solid = SOLID_NOT;
|
||||
pPlayer->pev->takedamage = DAMAGE_NO;
|
||||
pPlayer->m_iHideHUD |= HIDEHUD_ALL;
|
||||
|
||||
pBotCam->Spawn();
|
||||
|
||||
return pBotCam;
|
||||
}
|
||||
|
||||
|
||||
void CBotCam::Spawn( void )
|
||||
{
|
||||
pev->classname = MAKE_STRING("entity_botcam");
|
||||
|
||||
UTIL_MakeVectors(m_pBot->pev->v_angle);
|
||||
|
||||
TraceResult tr;
|
||||
UTIL_TraceLine(m_pBot->pev->origin + m_pBot->pev->view_ofs,
|
||||
m_pBot->pev->origin + m_pBot->pev->view_ofs + gpGlobals->v_forward * -16 + gpGlobals->v_up * 10,
|
||||
dont_ignore_monsters, m_pBot->edict(), &tr );
|
||||
|
||||
UTIL_SetOrigin(pev, tr.vecEndPos);
|
||||
|
||||
pev->angles = m_pBot->pev->v_angle;
|
||||
|
||||
pev->fixangle = TRUE;
|
||||
|
||||
SET_VIEW (m_pPlayer->edict(), edict());
|
||||
|
||||
// mechgibs seems to be an "invisible" model. Other players won't see
|
||||
// anything when this model is used as the botcam...
|
||||
|
||||
SET_MODEL(ENT(pev), "models/mechgibs.mdl");
|
||||
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
|
||||
pev->renderamt = 0;
|
||||
|
||||
m_pPlayer->EnableControl(FALSE);
|
||||
|
||||
SetTouch( NULL );
|
||||
|
||||
SetThink( &CBotCam::IdleThink );
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
|
||||
|
||||
void CBotCam::IdleThink( void )
|
||||
{
|
||||
// make sure bot is still in the game...
|
||||
|
||||
if (m_pBot->pev->takedamage != DAMAGE_NO) // not "kicked"
|
||||
{
|
||||
UTIL_MakeVectors(m_pBot->pev->v_angle);
|
||||
|
||||
TraceResult tr;
|
||||
UTIL_TraceLine(m_pBot->pev->origin + m_pBot->pev->view_ofs,
|
||||
m_pBot->pev->origin + m_pBot->pev->view_ofs + gpGlobals->v_forward * -16 + gpGlobals->v_up * 10,
|
||||
dont_ignore_monsters, m_pBot->edict(), &tr );
|
||||
|
||||
UTIL_SetOrigin(pev, tr.vecEndPos);
|
||||
|
||||
pev->angles = m_pBot->pev->v_angle;
|
||||
|
||||
pev->fixangle = TRUE;
|
||||
|
||||
SET_VIEW (m_pPlayer->edict(), edict());
|
||||
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_VIEW (m_pPlayer->edict(), m_pPlayer->edict());
|
||||
|
||||
m_pPlayer->pev->effects &= ~EF_NODRAW;
|
||||
m_pPlayer->pev->solid = SOLID_SLIDEBOX;
|
||||
m_pPlayer->pev->takedamage = DAMAGE_AIM;
|
||||
m_pPlayer->m_iHideHUD &= ~HIDEHUD_ALL;
|
||||
|
||||
m_pPlayer->EnableControl(TRUE);
|
||||
|
||||
m_pPlayer->pBotCam = NULL; // player's botcam is no longer valid
|
||||
|
||||
m_pBot = NULL;
|
||||
m_pPlayer = NULL;
|
||||
|
||||
REMOVE_ENTITY( ENT(pev) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CBotCam::Disconnect( void )
|
||||
{
|
||||
SET_VIEW (m_pPlayer->edict(), m_pPlayer->edict());
|
||||
|
||||
m_pPlayer->pev->effects &= ~EF_NODRAW;
|
||||
m_pPlayer->pev->solid = SOLID_SLIDEBOX;
|
||||
m_pPlayer->pev->takedamage = DAMAGE_AIM;
|
||||
m_pPlayer->m_iHideHUD &= ~HIDEHUD_ALL;
|
||||
|
||||
m_pPlayer->EnableControl(TRUE);
|
||||
|
||||
m_pPlayer->pBotCam = NULL; // player's botcam is no longer valid
|
||||
|
||||
m_pBot = NULL;
|
||||
m_pPlayer = NULL;
|
||||
|
||||
REMOVE_ENTITY( ENT(pev) );
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// botman's Half-Life bot example
|
||||
//
|
||||
// http://planethalflife.com/botman/
|
||||
//
|
||||
// botcam.h
|
||||
//
|
||||
|
||||
#ifndef BOTCAM_H
|
||||
#define BOTCAM_H
|
||||
|
||||
class CBotCam : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
|
||||
CBasePlayer *m_pPlayer;
|
||||
CBasePlayer *m_pBot;
|
||||
|
||||
static CBotCam *Create( CBasePlayer *pPlayer, CBasePlayer *pBot );
|
||||
void Spawn( void );
|
||||
void Disconnect( void );
|
||||
|
||||
void EXPORT IdleThink( void );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,521 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD )
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
#define BOLT_AIR_VELOCITY 150
|
||||
#define BOLT_WATER_VELOCITY 50
|
||||
|
||||
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
||||
//
|
||||
// OVERLOADS SOME ENTVARS:
|
||||
//
|
||||
// speed - the ideal magnitude of my velocity
|
||||
class CBowBolt : public CBaseEntity
|
||||
{
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
int Classify ( void );
|
||||
void EXPORT BubbleThink( void );
|
||||
void EXPORT BoltTouch( CBaseEntity *pOther );
|
||||
void EXPORT ExplodeThink( void );
|
||||
|
||||
int m_iTrail;
|
||||
|
||||
public:
|
||||
static CBowBolt *BoltCreate( void );
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( bow_bolt, CBowBolt );
|
||||
|
||||
CBowBolt *CBowBolt::BoltCreate( void )
|
||||
{
|
||||
// Create a new entity with CCrossbowBolt private data
|
||||
CBowBolt *pBolt = GetClassPtr( (CBowBolt *)NULL );
|
||||
pBolt->pev->classname = MAKE_STRING("bolt");
|
||||
pBolt->Spawn();
|
||||
|
||||
return pBolt;
|
||||
}
|
||||
|
||||
void CBowBolt::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
pev->gravity = 0.5;
|
||||
|
||||
SET_MODEL(ENT(pev), "models/bow_bolt.mdl");
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
|
||||
|
||||
SetTouch( &CBowBolt::BoltTouch );
|
||||
SetThink( &CBowBolt::BubbleThink );
|
||||
pev->nextthink = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
|
||||
void CBowBolt::Precache( )
|
||||
{
|
||||
PRECACHE_MODEL ("models/bow_bolt.mdl");
|
||||
PRECACHE_SOUND("weapons/bow_hitbod1.wav");
|
||||
PRECACHE_SOUND("weapons/bow_hitbod2.wav");
|
||||
//PRECACHE_SOUND("weapons/bow_fly1.wav");
|
||||
PRECACHE_SOUND("weapons/bow_hit1.wav");
|
||||
PRECACHE_SOUND("weapons/arrow.wav");
|
||||
PRECACHE_SOUND("fvox/beep.wav");
|
||||
m_iTrail = PRECACHE_MODEL("sprites/streak.spr");
|
||||
}
|
||||
|
||||
|
||||
int CBowBolt :: Classify ( void )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
|
||||
void CBowBolt::BoltTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
if (pOther->pev->takedamage)
|
||||
{
|
||||
TraceResult tr = UTIL_GetGlobalTrace( );
|
||||
entvars_t *pevOwner;
|
||||
|
||||
pevOwner = VARS( pev->owner );
|
||||
|
||||
// UNDONE: this needs to call TraceAttack instead
|
||||
ClearMultiDamage( );
|
||||
|
||||
pOther->TraceAttack(pevOwner, gSkillData.plrDmgBow, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_ALWAYSGIB );
|
||||
|
||||
ApplyMultiDamage( pev, pevOwner );
|
||||
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
// play body "errgh" sound
|
||||
switch( RANDOM_LONG(0,1) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/bow_hitbod1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/bow_hitbod2.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
Killed( pev, GIB_ALWAYS ); //Smokey ;D
|
||||
}
|
||||
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(pev), CHAN_BODY, "weapons/bow_hit1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 98 + RANDOM_LONG(0,7));
|
||||
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
|
||||
|
||||
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
{
|
||||
// if what we hit is static architecture, can stay around for a while.
|
||||
Vector vecDir = pev->velocity.Normalize( );
|
||||
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
|
||||
pev->angles = UTIL_VecToAngles( vecDir );
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
pev->avelocity.z = 0;
|
||||
pev->angles.z = RANDOM_LONG(0,360);
|
||||
pev->nextthink = gpGlobals->time + 10.0;
|
||||
}
|
||||
|
||||
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
|
||||
{
|
||||
UTIL_Sparks( pev->origin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBowBolt::BubbleThink( void )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if (pev->waterlevel == 0)
|
||||
return;
|
||||
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 20 );
|
||||
}
|
||||
|
||||
void CBowBolt::ExplodeThink( void )
|
||||
{
|
||||
int iContents = UTIL_PointContents ( pev->origin );
|
||||
int iScale;
|
||||
|
||||
pev->dmg = 40;
|
||||
iScale = 10;
|
||||
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_EXPLOSION);
|
||||
WRITE_COORD( pev->origin.x );
|
||||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
if (iContents != CONTENTS_WATER)
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexFireball );
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexWExplosion );
|
||||
}
|
||||
WRITE_BYTE( iScale ); // scale * 10
|
||||
WRITE_BYTE( 15 ); // framerate
|
||||
WRITE_BYTE( TE_EXPLFLAG_NONE );
|
||||
MESSAGE_END();
|
||||
|
||||
entvars_t *pevOwner;
|
||||
|
||||
if ( pev->owner )
|
||||
pevOwner = VARS( pev->owner );
|
||||
else
|
||||
pevOwner = NULL;
|
||||
|
||||
pev->owner = NULL; // can't traceline attack owner if this is set
|
||||
|
||||
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
|
||||
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum bow_e { // Do this Link
|
||||
BOW_IDLE1 = 0, // full
|
||||
BOW_IDLE2, // empty
|
||||
BOW_FIDGET1, // full
|
||||
BOW_FIDGET2, // empty
|
||||
BOW_FIRE1, // full
|
||||
BOW_FIRE2, // reload
|
||||
BOW_FIRE3, // empty
|
||||
BOW_RELOAD, // from empty
|
||||
BOW_DRAW1, // full
|
||||
BOW_DRAW2, // empty
|
||||
BOW_HOLSTER1, // full
|
||||
BOW_HOLSTER2, // empty
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_bow, CBow );
|
||||
|
||||
void CBow::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_BOW;
|
||||
SET_MODEL(ENT(pev), "models/w_bow.mdl");
|
||||
|
||||
m_iDefaultAmmo = BOW_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
int CBow::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CBow::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_bow.mdl");
|
||||
PRECACHE_MODEL("models/v_bow.mdl");
|
||||
PRECACHE_MODEL("models/p_bow.mdl");
|
||||
|
||||
//PRECACHE_SOUND("weapons/xbow_fire1.wav");
|
||||
//PRECACHE_SOUND("weapons/xbow_reload1.wav");
|
||||
|
||||
UTIL_PrecacheOther( "bow_bolt" );
|
||||
|
||||
m_usBow = PRECACHE_EVENT( 1, "events/bow.sc" );
|
||||
//m_usCrossbow2 = PRECACHE_EVENT( 1, "events/crossbow2.sc" );
|
||||
}
|
||||
|
||||
|
||||
int CBow::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "arrows";
|
||||
p->iMaxAmmo1 = BOW_MAX_CARRY;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = BOW_MAX_CLIP;
|
||||
p->iSlot = 2;
|
||||
p->iPosition = 4;
|
||||
p->iId = WEAPON_BOW;
|
||||
p->iFlags = 0;
|
||||
p->iWeight = BOW_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CBow::Deploy( )
|
||||
{
|
||||
if (m_iClip)
|
||||
return DefaultDeploy( "models/v_bow.mdl", "models/p_bow.mdl", BOW_DRAW1, "bow" );
|
||||
return DefaultDeploy( "models/v_bow.mdl", "models/p_bow.mdl", BOW_DRAW2, "bow" );
|
||||
}
|
||||
|
||||
void CBow::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_fInReload = FALSE;// cancel any reload in progress.
|
||||
|
||||
/*if ( m_fInZoom )
|
||||
{
|
||||
SecondaryAttack( );
|
||||
}*/
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
if (m_iClip)
|
||||
SendWeaponAnim( BOW_HOLSTER1 );
|
||||
else
|
||||
SendWeaponAnim( BOW_HOLSTER2 );
|
||||
}
|
||||
|
||||
void CBow::PrimaryAttack( void )
|
||||
{
|
||||
FireBolt();
|
||||
}
|
||||
|
||||
// this function only gets called in multiplayer
|
||||
/*void CCrossbow::FireSniperBolt()
|
||||
{
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
|
||||
m_iClip--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecSrc + vecDir * 8192, dont_ignore_monsters, m_pPlayer->edict(), &tr);
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( tr.pHit->v.takedamage )
|
||||
{
|
||||
ClearMultiDamage( );
|
||||
CBaseEntity::Instance(tr.pHit)->TraceAttack(m_pPlayer->pev, 120, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB );
|
||||
ApplyMultiDamage( pev, m_pPlayer->pev );
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
void CBow::FireBolt()
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
|
||||
|
||||
//m_iClip--;
|
||||
m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ]--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usBow, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
|
||||
anglesAim.x = -anglesAim.x;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CBowBolt *pBolt = CBowBolt::BoltCreate();
|
||||
pBolt->pev->origin = vecSrc;
|
||||
pBolt->pev->angles = anglesAim;
|
||||
pBolt->pev->owner = m_pPlayer->edict();
|
||||
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
pBolt->pev->velocity = vecDir * BOLT_WATER_VELOCITY;
|
||||
pBolt->pev->speed = BOLT_WATER_VELOCITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBolt->pev->velocity = vecDir * BOLT_AIR_VELOCITY;
|
||||
pBolt->pev->speed = BOLT_AIR_VELOCITY;
|
||||
}
|
||||
pBolt->pev->avelocity.z = 10;
|
||||
#endif
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip != 0)
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
|
||||
else
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
|
||||
}
|
||||
|
||||
|
||||
/*void CCrossbow::SecondaryAttack()
|
||||
{
|
||||
if ( m_pPlayer->pev->fov != 0 )
|
||||
{
|
||||
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
|
||||
m_fInZoom = 0;
|
||||
}
|
||||
else if ( m_pPlayer->pev->fov != 20 )
|
||||
{
|
||||
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 20;
|
||||
m_fInZoom = 1;
|
||||
}
|
||||
|
||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
}*/
|
||||
|
||||
|
||||
/*void CCrossbow::Reload( void )
|
||||
{
|
||||
if ( m_pPlayer->ammo_bolts <= 0 )
|
||||
return;
|
||||
|
||||
if ( DefaultReload( 5, BOW_RELOAD, 4.5 ) )
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
void CBow::WeaponIdle( void )
|
||||
{
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM
|
||||
|
||||
ResetEmptySound( );
|
||||
|
||||
if ( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if (flRand <= 0.75)
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( BOW_IDLE1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( BOW_IDLE2 );
|
||||
}
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( BOW_FIDGET1 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( BOW_FIDGET2 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CBowAmmo : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_bow_clip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_bow_clip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
if (pOther->GiveAmmo( 30, "arrows", BOW_MAX_CARRY ) != -1)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_bow, CBowAmmo );
|
||||
|
||||
#endif
|
|
@ -0,0 +1,266 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This source code contains proprietary and confidential information of
|
||||
* Valve LLC and its suppliers. Access to this code is restricted to
|
||||
* persons who have executed a written SDK license with Valve. Any access,
|
||||
* use or distribution of this code by or to any unlicensed person is illegal.
|
||||
*
|
||||
****/
|
||||
//=========================================================
|
||||
// monster template
|
||||
//=========================================================
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
#include "soundent.h"
|
||||
|
||||
int SonicRings;
|
||||
extern cvar_t cwc;
|
||||
int bravery = 0; //He is brave... for now.
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
|
||||
class CChrisChan : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
void Killed( entvars_t *pevAttacker, int iGib );
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
//Schedule_t *GetSchedule( void ); // Handles some schedules
|
||||
|
||||
void IdleSound( void );
|
||||
void PainSound( void );
|
||||
void AlertSound( void );
|
||||
|
||||
CUSTOM_SCHEDULES;
|
||||
|
||||
static const char *pIdleSounds[];
|
||||
static const char *pAlertSounds[];
|
||||
static const char *pPainSounds[];
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( monster_chrischan, CChrisChan );
|
||||
|
||||
//====================
|
||||
// AI BULL
|
||||
//===================
|
||||
|
||||
Task_t tlCWCHide[] =
|
||||
{
|
||||
//{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
|
||||
{ TASK_STOP_MOVING, (float)0 },
|
||||
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
|
||||
{ TASK_PLAY_SEQUENCE, (float)ACT_CROUCH },
|
||||
{ TASK_SET_ACTIVITY, (float)ACT_CROUCHIDLE }, // FIXME: This looks lame
|
||||
{ TASK_WAIT_RANDOM, (float)10.0 },
|
||||
};
|
||||
|
||||
Schedule_t slCWCHide[] =
|
||||
{
|
||||
{
|
||||
tlCWCHide,
|
||||
ARRAYSIZE ( tlCWCHide ),
|
||||
bits_COND_SEE_FEAR,
|
||||
bits_SOUND_DANGER,
|
||||
"CWCHide"
|
||||
},
|
||||
};
|
||||
|
||||
DEFINE_CUSTOM_SCHEDULES( CChrisChan )
|
||||
{
|
||||
slCWCHide,
|
||||
};
|
||||
|
||||
const char *CChrisChan::pIdleSounds[] =
|
||||
{
|
||||
"cwc/cwc_idle1.wav",
|
||||
"cwc/cwc_idle2.wav",
|
||||
"cwc/cwc_idle3.wav",
|
||||
"cwc/cwc_idle4.wav",
|
||||
};
|
||||
|
||||
const char *CChrisChan::pAlertSounds[] =
|
||||
{
|
||||
"cwc/cwc_alert1.wav",
|
||||
"cwc/cwc_alert2.wav",
|
||||
"cwc/cwc_alert3.wav",
|
||||
"cwc/cwc_alert4.wav"
|
||||
|
||||
};
|
||||
|
||||
const char *CChrisChan::pPainSounds[] =
|
||||
{
|
||||
"cwc/cwc_pain1.wav",
|
||||
"cwc/cwc_pain2.wav",
|
||||
"cwc/cwc_pain3.wav",
|
||||
"cwc/cwc_pain4.wav",
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CChrisChan :: Classify ( void )
|
||||
{
|
||||
if (cwc.value == 1)
|
||||
{
|
||||
return CLASS_HUMAN_PASSIVE;
|
||||
}
|
||||
else if (cwc.value == 0)
|
||||
{
|
||||
return CLASS_CWC;
|
||||
}
|
||||
return CLASS_HUMAN_PASSIVE;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CChrisChan :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
switch ( m_Activity )
|
||||
{
|
||||
case ACT_IDLE:
|
||||
default:
|
||||
ys = 360;
|
||||
}
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CChrisChan :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CChrisChan :: Spawn()
|
||||
{
|
||||
Precache( );
|
||||
|
||||
SET_MODEL(ENT(pev), "models/chrischan.mdl");
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_LAVENDER; //There's part of why I chose this.
|
||||
pev->health = CBaseMonster::GetHealth( 251, 3 );
|
||||
pev->view_ofs = Vector ( 0, 0, 0 );// poBsition of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CChrisChan :: Precache()
|
||||
{
|
||||
PRECACHE_SOUND("cwc/death.wav");
|
||||
|
||||
PRECACHE_MODEL("models/chrischan.mdl");
|
||||
SonicRings = PRECACHE_MODEL("sprites/s2ring.spr");// client side spittle of coins!
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pIdleSounds[i]);
|
||||
for ( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pPainSounds[i]);
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
||||
void CChrisChan :: IdleSound( void )
|
||||
{
|
||||
// Play a random idle sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
void CChrisChan :: AlertSound( void )
|
||||
{
|
||||
// Play a random idle sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAlertSounds[ RANDOM_LONG(0,ARRAYSIZE(pAlertSounds)-1) ], 1.0, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
void CChrisChan :: PainSound( void )
|
||||
{
|
||||
// Play a random pain sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pPainSounds[ RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1) ], 1.0, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
void CChrisChan::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
//Blows up in coins, disappears. Scott Pilgrim and River City Ransom-esque.
|
||||
const Vector position = pev->origin;
|
||||
const Vector &direction = Vector(0,0,1);
|
||||
int count = RANDOM_LONG(45,160);
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_VOICE, "cwc/death.wav", 1, ATTN_NORM );
|
||||
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, position );
|
||||
WRITE_BYTE( TE_SPRITE_SPRAY );
|
||||
WRITE_COORD( position.x); // pos
|
||||
WRITE_COORD( position.y);
|
||||
WRITE_COORD( position.z);
|
||||
WRITE_COORD( direction.x); // dir
|
||||
WRITE_COORD( direction.y);
|
||||
WRITE_COORD( direction.z);
|
||||
WRITE_SHORT( SonicRings ); // model
|
||||
WRITE_BYTE ( count ); // count
|
||||
WRITE_BYTE ( 130 ); // speed
|
||||
WRITE_BYTE ( 80 ); // noise ( client will divide by 100 )
|
||||
MESSAGE_END();
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
//=========================================================
|
||||
// TakeDamage - overridden for chris-chan so we can simulate
|
||||
// trolling via attackers. Once he is attacked, he will switch. Like the real cwc.
|
||||
//=========================================================
|
||||
int CChrisChan :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
if (bravery == 0)
|
||||
{
|
||||
int bravery = RANDOM_LONG(0,1); //Roll the Dice, for Bravery, simulating fight or flight.
|
||||
}
|
||||
|
||||
if ( pevInflictor && pevInflictor->flags & FL_CLIENT )
|
||||
{
|
||||
Remember( bits_MEMORY_PROVOKED );
|
||||
}
|
||||
|
||||
return CBaseMonster :: TakeDamage ( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
IMPLEMENT_CUSTOM_SCHEDULES( CChrisChan, CBaseMonster );
|
|
@ -0,0 +1,131 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// heavyrain_gamerules.cpp
|
||||
//
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "cod_gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgCOD;
|
||||
extern int gmsgPlayMP3; //AJH - Killars MP3player
|
||||
|
||||
CCodplay :: CCodplay()
|
||||
{
|
||||
//Genfulect
|
||||
}
|
||||
|
||||
BOOL CCodplay::IsCOD()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CCodplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_mw2" );
|
||||
}
|
||||
}
|
||||
|
||||
void CCodplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
DeathNotice( pVictim, pKiller, pInflictor );
|
||||
|
||||
pVictim->m_iDeaths += 1;
|
||||
|
||||
FireTargets( "game_playerdie", pVictim, pVictim, USE_TOGGLE, 0 );
|
||||
CBasePlayer *peKiller = NULL;
|
||||
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
|
||||
if ( ktmp && (ktmp->Classify() == CLASS_PLAYER) )
|
||||
peKiller = (CBasePlayer*)ktmp;
|
||||
|
||||
if ( pVictim->pev == pKiller )
|
||||
{ // killed self
|
||||
pKiller->frags -= 1;
|
||||
}
|
||||
else if ( ktmp && ktmp->IsPlayer() )
|
||||
{
|
||||
// if a player dies in a deathmatch game and the killer is a client, award the killer some points
|
||||
pKiller->frags += IPointsForKill( peKiller, pVictim );
|
||||
FireTargets( "game_playerkill", ktmp, ktmp, USE_TOGGLE, 0 );
|
||||
}
|
||||
else
|
||||
{ // killed by the world
|
||||
pKiller->frags -= 1;
|
||||
}
|
||||
|
||||
// update the scores
|
||||
// killed scores
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||
WRITE_SHORT( pVictim->pev->frags );
|
||||
WRITE_SHORT( pVictim->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||
WRITE_SHORT( pVictim->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
|
||||
// killers score, if it's a player
|
||||
CBaseEntity *ep = CBaseEntity::Instance( pKiller );
|
||||
if ( ep && ep->Classify() == CLASS_PLAYER )
|
||||
{
|
||||
CBasePlayer *PK = (CBasePlayer*)ep;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(PK->edict()) );
|
||||
WRITE_SHORT( PK->pev->frags );
|
||||
WRITE_SHORT( PK->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName) + 1 );
|
||||
WRITE_SHORT( PK->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgCOD, NULL, PK->pev );
|
||||
WRITE_BYTE( PK->pev->frags );
|
||||
MESSAGE_END();
|
||||
|
||||
// let the killer paint another decal as soon as he'd like.
|
||||
PK->m_flNextDecalTime = gpGlobals->time;
|
||||
}
|
||||
#ifndef HLDEMO_BUILD
|
||||
if ( pVictim->HasNamedPlayerItem("weapon_satchel") )
|
||||
{
|
||||
DeactivateSatchels( pVictim );
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
class CCodplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CCodplay();
|
||||
virtual const char *GetGameDescription( void ) { return "Cawadooty"; } // this is the game name that gets seen in the server browser
|
||||
virtual BOOL IsCOD( void );
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
};
|
|
@ -0,0 +1,85 @@
|
|||
// Shitty Co-Op Implimention
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "coop_gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgShowGameTitle;
|
||||
|
||||
CCoopplay :: CCoopplay()
|
||||
{
|
||||
//Genuflect
|
||||
}
|
||||
|
||||
BOOL CCoopplay::IsDeathmatch()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CCoopplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_fotn" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_shotgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_buckshot" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_ARgrenades" );
|
||||
pPlayer->GiveNamedItem( "weapon_handgrenade" );
|
||||
pPlayer->GiveNamedItem( "weapon_tripmine" );
|
||||
pPlayer->GiveNamedItem( "weapon_rpg" );
|
||||
pPlayer->GiveNamedItem( "ammo_rpgclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_satchel" );
|
||||
pPlayer->GiveNamedItem( "weapon_snark" );
|
||||
pPlayer->GiveNamedItem( "weapon_soda" );
|
||||
pPlayer->GiveNamedItem( "weapon_dosh" );
|
||||
pPlayer->GiveNamedItem( "weapon_beamkatana" );
|
||||
pPlayer->GiveNamedItem( "weapon_ak47" );
|
||||
pPlayer->GiveNamedItem( "weapon_bow" );
|
||||
pPlayer->GiveNamedItem( "weapon_jason" );
|
||||
pPlayer->GiveNamedItem( "weapon_jihad" );
|
||||
pPlayer->GiveNamedItem( "weapon_jackal" );
|
||||
pPlayer->GiveNamedItem( "weapon_nstar" );
|
||||
pPlayer->GiveNamedItem( "weapon_mw2" );
|
||||
pPlayer->GiveNamedItem( "weapon_zapper" );
|
||||
pPlayer->GiveNamedItem( "weapon_goldengun" );
|
||||
pPlayer->GiveNamedItem( "weapon_boombox" );
|
||||
pPlayer->GiveNamedItem( "weapon_scientist" );
|
||||
pPlayer->GiveNamedItem( "weapon_modman" );
|
||||
}
|
||||
}
|
||||
|
||||
void CCoopplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
//Nothing
|
||||
}
|
||||
|
||||
BOOL CCoopplay::IsCoOp( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
// Shitty co-op addition. Bypasses a few things.
|
||||
// Buggy as hell, and YOU should fix it. I dont have the time.
|
||||
|
||||
#define JASON 0;
|
||||
|
||||
class CCoopplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CCoopplay();
|
||||
virtual const char *GetGameDescription( void ) { return "Co-Op"; } // this is the game name that gets seen in the server browser
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
virtual BOOL IsDeathmatch( void );
|
||||
virtual BOOL IsCoOp( void );
|
||||
};
|
|
@ -0,0 +1,195 @@
|
|||
/***
|
||||
*
|
||||
Creepers blow.
|
||||
*/
|
||||
//=========================================================
|
||||
// Creeper
|
||||
//=========================================================
|
||||
|
||||
// UNDONE: Don't flinch every time you get hit
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
#include "explode.h"
|
||||
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
#define CREEP_AE_ATTACK_RIGHT 0x01
|
||||
|
||||
#define CREEP_FLINCH_DELAY 1 // at most one flinch every n secs
|
||||
|
||||
class CCreeper : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int IgnoreConditions ( void );
|
||||
|
||||
float m_flNextFlinch;
|
||||
void AlertSound( void );
|
||||
static const char *pAlertSounds[];
|
||||
|
||||
// No range attacks
|
||||
BOOL CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
|
||||
BOOL CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( monster_creeper, CCreeper );
|
||||
|
||||
const char *CCreeper::pAlertSounds[] =
|
||||
{
|
||||
"fuse.wav", //ssssssssssssssss
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CCreeper :: Classify ( void )
|
||||
{
|
||||
return CLASS_ALIEN_MONSTER;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CCreeper :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
ys = 120;
|
||||
|
||||
#if 0
|
||||
switch ( m_Activity )
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
int CCreeper :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
// Take 70% damage from bullets
|
||||
if ( bitsDamageType == DMG_BULLET )
|
||||
{
|
||||
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
|
||||
vecDir = vecDir.Normalize();
|
||||
float flForce = DamageForce( flDamage );
|
||||
pev->velocity = pev->velocity + vecDir * flForce;
|
||||
flDamage *= 0.7;
|
||||
}
|
||||
|
||||
// HACK HACK -- until we fix this.
|
||||
if ( IsAlive() )
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
void CCreeper :: AlertSound( void )
|
||||
{
|
||||
// Play a random attack sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAlertSounds[ RANDOM_LONG(0,ARRAYSIZE(pAlertSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CCreeper :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case CREEP_AE_ATTACK_RIGHT:
|
||||
{
|
||||
pev->health = 1; // Hack because Creeper has an insane amount of health, this lasts for .1 seconds
|
||||
ExplosionCreate( Center(), pev->angles, edict(), 128, TRUE ); // BOOM!
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CCreeper :: Spawn()
|
||||
{
|
||||
Precache( );
|
||||
|
||||
if (CVAR_GET_FLOAT("mp_testzom") == 1)
|
||||
SET_MODEL(ENT(pev), "models/zombie.mdl");
|
||||
else
|
||||
SET_MODEL(ENT(pev), "models/creeper.mdl");
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_LAVENDER;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.creeperHealth, 3 );
|
||||
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_afCapability = bits_CAP_DOORS_GROUP;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CCreeper :: Precache()
|
||||
{
|
||||
int i;
|
||||
|
||||
PRECACHE_MODEL("models/creeper.mdl");
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
||||
|
||||
|
||||
int CCreeper::IgnoreConditions ( void )
|
||||
{
|
||||
int iIgnore = CBaseMonster::IgnoreConditions();
|
||||
|
||||
if ((m_Activity == ACT_MELEE_ATTACK1) || (m_Activity == ACT_MELEE_ATTACK1))
|
||||
{
|
||||
#if 0
|
||||
if (pev->health < 20)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
else
|
||||
#endif
|
||||
if (m_flNextFlinch >= gpGlobals->time)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
}
|
||||
|
||||
if ((m_Activity == ACT_SMALL_FLINCH) || (m_Activity == ACT_BIG_FLINCH))
|
||||
{
|
||||
if (m_flNextFlinch < gpGlobals->time)
|
||||
m_flNextFlinch = gpGlobals->time + CREEP_FLINCH_DELAY;
|
||||
}
|
||||
|
||||
return iIgnore;
|
||||
|
||||
}
|
|
@ -0,0 +1,411 @@
|
|||
|
||||
// includes needed for everything to compile
|
||||
#include "extdll.h"
|
||||
#include "decals.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "soundent.h"
|
||||
#include "shake.h"
|
||||
#include "gamerules.h"
|
||||
#include "ctf_gameplay.h"
|
||||
#include "teamplay_gamerules.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS( object_flag, CObjectFlag );
|
||||
|
||||
void CObjectFlag :: Spawn( )
|
||||
{
|
||||
// Calls the precache function to precache any models, sounds,ect you need
|
||||
//before it spawns
|
||||
Precache( );
|
||||
// Setup what model we want to use for the flag, change this to
|
||||
// whatever you want. Just remember precache it.
|
||||
SET_MODEL( ENT(pev), "models/flag.mdl" );
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin + Vector(0,0,10) );
|
||||
UTIL_SetSize( pev, Vector(-16,-16,0), Vector(16,16,16) );
|
||||
|
||||
// This is so it falls to the brush below it
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
|
||||
// This allows you to trigger it by walking through it
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
|
||||
// This just sets our Touch to Touch, which is down a little further
|
||||
SetTouch(Touch);
|
||||
|
||||
// This just makes a GlowShell around the model, you can
|
||||
// change the colour of the shell by changing the RGB values,
|
||||
// which are the XYZ values in this case. So at the moment we have
|
||||
// a nice bright red colour. Feel free to change this to your needs.
|
||||
pev->renderfx = kRenderFxGlowShell;
|
||||
pev->rendercolor.x = 255;
|
||||
pev->rendercolor.y = 0;
|
||||
pev->rendercolor.z = 0;
|
||||
pev->renderamt = 10; // 10 units off the sides of the model
|
||||
|
||||
// This just sets our IsInPlay bool to false, because its only just spawned and
|
||||
// no one has picked it up yet.
|
||||
m_fIsInPlay = false;
|
||||
}
|
||||
|
||||
// This is the Precache function which is called from the Spawn function.
|
||||
|
||||
void CObjectFlag :: Precache( )
|
||||
{
|
||||
// Precache's the model
|
||||
PRECACHE_MODEL( "models/flag.mdl" );
|
||||
}
|
||||
|
||||
// This is the Touch function which was set above, in the Spawn function,
|
||||
// its basically the stuff that runs when the flag has been touched by a player
|
||||
|
||||
void CObjectFlag :: Touch(CBaseEntity *pOther)
|
||||
{
|
||||
// If its in play, do nothing
|
||||
if(m_fIsInPlay)
|
||||
return;
|
||||
|
||||
// Determine if the object that touches it, is a player
|
||||
// and check if the player is alive.
|
||||
if(!pOther)
|
||||
return;
|
||||
if(!pOther->IsPlayer())
|
||||
return;
|
||||
if(!pOther->IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)pOther;
|
||||
|
||||
// Print to the HUD who has taken the flag
|
||||
UTIL_ClientPrintAll( HUD_PRINTCENTER, UTIL_VarArgs( "%s has the Flag!\n", STRING( pPlayer->pev->netname )));
|
||||
|
||||
pPlayer->m_fHasObject = true;
|
||||
|
||||
// Set the client attachment using an event
|
||||
PLAYBACK_EVENT_FULL(0, pPlayer->edict(), g_usObject, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, FLAG_STOLEN, 0, 0, 0);
|
||||
|
||||
m_fIsInPlay = true;
|
||||
|
||||
// Give the illusion of the player taking the model by not drawing it
|
||||
pev->effects = EF_NODRAW;
|
||||
|
||||
// Now don't let it accept any more touch's
|
||||
SetTouch(NULL);
|
||||
|
||||
// This is the Flag that is dropped by a player when killed,disconnected,ect.
|
||||
// Its basically the same as CObjectFlag, with a few changes.
|
||||
|
||||
LINK_ENTITY_TO_CLASS( dropped_flag, CDroppedFlag );
|
||||
|
||||
void CDroppedFlag :: Spawn( )
|
||||
{
|
||||
// Calls the precache function to precache any models or sounds,ect
|
||||
// you need before it spawns.
|
||||
Precache( );
|
||||
|
||||
// Setup what model we want to use for the flag, change this to
|
||||
// whatever you want. Just remember precache it.
|
||||
SET_MODEL( ENT(pev), "models/flag.mdl" );
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
UTIL_SetSize( pev, Vector(-16,-16,0), Vector(16,16,16) );
|
||||
|
||||
// This is so it falls to the brush below it
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
|
||||
// This allows you to trigger it by walking through it
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
|
||||
// This just sets our Touch to Touch, which is down a little further
|
||||
SetTouch(Touch);
|
||||
|
||||
// This just makes a GlowShell around the model, you can
|
||||
// change the colour of the shell by changing the RGB values,
|
||||
// which are the XYZ values in this case. So at the moment we have
|
||||
// a nice bright red colour. Feel free to change this to your needs.
|
||||
pev->effects = EF_BRIGHTFIELD;
|
||||
pev->renderfx = kRenderFxGlowShell;
|
||||
pev->rendercolor.x = 255;
|
||||
pev->rendercolor.y = 0;
|
||||
pev->rendercolor.z = 0;
|
||||
pev->renderamt = 10; // 10 units off the sides of the model
|
||||
pev->avelocity.z = 25;
|
||||
}
|
||||
|
||||
// This is the Precache function which is called from the Spawn function.
|
||||
|
||||
void CDroppedFlag :: Precache( )
|
||||
{
|
||||
// Precache's the model
|
||||
PRECACHE_MODEL( "models/flag.mdl" );
|
||||
}
|
||||
|
||||
// This is the Touch function which was set above, in the Spawn function,
|
||||
// its basically the stuff that runs when the flag has been touched by a player.
|
||||
|
||||
void CDroppedFlag :: Touch(CBaseEntity *pOther)
|
||||
{
|
||||
// Determine if the object that touches it, is a player
|
||||
// and check if the player is alive.
|
||||
if(!pOther)
|
||||
return;
|
||||
if(!pOther->IsPlayer())
|
||||
return;
|
||||
if(!pOther->IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)pOther;
|
||||
|
||||
// Print to the HUD who has taken the flag
|
||||
UTIL_ClientPrintAll( HUD_PRINTCENTER, UTIL_VarArgs( "%s has the Flag!\n", STRING( pPlayer->pev->netname )));
|
||||
|
||||
// Set it to true because the player has the flag
|
||||
pPlayer->m_fHasObject = true;
|
||||
|
||||
// Set the client attachment using an event
|
||||
PLAYBACK_EVENT_FULL(0, pPlayer->edict(), g_usObject, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, FLAG_STOLEN, 0, 0, 0);
|
||||
|
||||
// remove this item
|
||||
SetThink(SUB_Remove);
|
||||
|
||||
// next think time to now!
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( capture_team1, CCaptureTeam1 );
|
||||
|
||||
void CCaptureTeam1 :: Spawn( )
|
||||
{
|
||||
|
||||
// Calls the precache function to precache any models, sounds,ect
|
||||
// you need before it spawns
|
||||
Precache( );
|
||||
|
||||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
|
||||
// This allows you to trigger it by walking through it
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
|
||||
// This just sets our Touch to Touch and our Think to Think
|
||||
// which is down a little further.
|
||||
SetTouch(Touch);
|
||||
SetThink(Think);
|
||||
|
||||
// Sets next think time
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
// Make the entity invisible
|
||||
pev->rendermode = kRenderTransTexture;
|
||||
pev->renderamt = 0;
|
||||
|
||||
}
|
||||
|
||||
// This is the Precache function which is called from the Spawn function.
|
||||
|
||||
void CCaptureTeam1 :: Precache( )
|
||||
{
|
||||
PRECACHE_MODEL( (char*)STRING(pev->model) );
|
||||
}
|
||||
void CCaptureTeam1 :: Think( )
|
||||
{
|
||||
// loop through every player and check if they are in the area
|
||||
for(int i=0; i<gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex(i);
|
||||
if(pPlayer && pPlayer->m_iTeam == 1)
|
||||
{
|
||||
if((pPlayer->pev->origin.x >= pev->mins.x) && (pPlayer->pev->origin.x <= pev->maxs.x) &&
|
||||
(pPlayer->pev->origin.y >= pev->mins.y) && (pPlayer->pev->origin.y <= pev->maxs.y) &&
|
||||
(pPlayer->pev->origin.z >= pev->mins.z) && (pPlayer->pev->origin.z <= pev->maxs.z))
|
||||
pPlayer->m_bInCapture = true;
|
||||
else
|
||||
pPlayer->m_bInCapture = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Set next think time
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
|
||||
// This is the Touch function which was set above, in the Spawn function,
|
||||
// its basically the stuff that runs when the capture point has been touched by a player
|
||||
|
||||
void CCaptureTeam1 :: Touch( CBaseEntity* pOther )
|
||||
{
|
||||
// Determine if the object that touches it, is a player
|
||||
// and check if the player is alive.
|
||||
if(!pOther)
|
||||
return;
|
||||
if(!pOther->IsPlayer())
|
||||
return;
|
||||
if(!pOther->IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)pOther;
|
||||
|
||||
if(pPlayer && pPlayer->m_iTeam == 1)
|
||||
{
|
||||
// Check to see if they have the object
|
||||
if( !pPlayer->m_fHasObject )
|
||||
return;
|
||||
else
|
||||
{
|
||||
// Print to HUD who has captured the flag
|
||||
UTIL_ClientPrintAll( HUD_PRINTCENTER, UTIL_VarArgs
|
||||
( "%s has captured the Flag!\n", STRING( pPlayer->pev->netname )));
|
||||
|
||||
// Remove the flag
|
||||
pPlayer->m_fHasObject = false;
|
||||
|
||||
PLAYBACK_EVENT_FULL(0, pPlayer->edict(), g_usObject, 0, (float *)&g_vecZero,
|
||||
(float *)&g_vecZero, 0, 0, FLAG_CAPTURE, 0, 0, 0);
|
||||
|
||||
|
||||
// Reset the flag
|
||||
CObjectFlag *pFlag = (CObjectFlag *)UTIL_FindEntityByClassname(NULL, "object_flag");
|
||||
if(pFlag)
|
||||
{
|
||||
pFlag->m_fIsInPlay = false;
|
||||
|
||||
// Do a funky effect on the flag when it gets reset
|
||||
pFlag->pev->effects = EF_BRIGHTFIELD;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return; // wrong team
|
||||
}
|
||||
|
||||
void CCaptureTeam1 :: KeyValue( KeyValueData* Data )
|
||||
{
|
||||
// This will store the points but its not fully implemented. I'll leave it for you to do.
|
||||
if( FStrEq( Data->szKeyName, "points" ) )
|
||||
{
|
||||
int m_iPoints = atoi(Data->szValue);
|
||||
Data->fHandled = true;
|
||||
}
|
||||
|
||||
CBaseEntity::KeyValue(Data); // call the parent function
|
||||
}
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( capture_team2, CCaptureTeam2 );
|
||||
|
||||
void CCaptureTeam2 :: Spawn( )
|
||||
{
|
||||
// Calls the precache function to precache any models, sounds,ect
|
||||
// you need before it spawns.
|
||||
Precache( );
|
||||
|
||||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
|
||||
// This allows you to trigger it by walking through it
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
|
||||
// This just sets our Touch to Touch and our Think to Think
|
||||
// which is down a little further.
|
||||
SetTouch(Touch);
|
||||
SetThink(Think);
|
||||
|
||||
// Set next think time
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
// Make the entity invisible
|
||||
pev->rendermode = kRenderTransTexture;
|
||||
pev->renderamt = 0;
|
||||
}
|
||||
|
||||
void CCaptureTeam2 :: Precache( )
|
||||
{
|
||||
PRECACHE_MODEL( (char*)STRING(pev->model) );
|
||||
}
|
||||
void CCaptureTeam2 :: Think( )
|
||||
{
|
||||
// loop through every player and check if they are in the area
|
||||
for(int i=0; i<gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex(i);
|
||||
if(pPlayer && pPlayer->m_iTeam == 2)
|
||||
{
|
||||
if((pPlayer->pev->origin.x >= pev->mins.x) && (pPlayer->pev->origin.x <= pev->maxs.x) &&
|
||||
(pPlayer->pev->origin.y >= pev->mins.y) && (pPlayer->pev->origin.y <= pev->maxs.y) &&
|
||||
(pPlayer->pev->origin.z >= pev->mins.z) && (pPlayer->pev->origin.z <= pev->maxs.z))
|
||||
pPlayer->m_bInCapture = true;
|
||||
else
|
||||
pPlayer->m_bInCapture = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the next think time
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
}
|
||||
void CCaptureTeam2 :: Touch( CBaseEntity* pOther )
|
||||
{
|
||||
// Determine if the object that touches it, is a player
|
||||
// and check if the player is alive.
|
||||
if(!pOther)
|
||||
return;
|
||||
if(!pOther->IsPlayer())
|
||||
return;
|
||||
if(!pOther->IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = (CBasePlayer *)pOther;
|
||||
|
||||
if(pPlayer && pPlayer->m_iTeam == 2)
|
||||
{
|
||||
// Check to see if they have the object
|
||||
if( !pPlayer->m_fHasObject )
|
||||
return;
|
||||
else
|
||||
{
|
||||
// Print to HUD who has captured the flag
|
||||
UTIL_ClientPrintAll( HUD_PRINTCENTER, UTIL_VarArgs
|
||||
( "%s has captured the Flag!\n", STRING( pPlayer->pev->netname )));
|
||||
|
||||
// Remove the object
|
||||
pPlayer->m_fHasObject = false;
|
||||
|
||||
PLAYBACK_EVENT_FULL(0, pPlayer->edict(), g_usObject, 0, (float *)&g_vecZero,
|
||||
(float *)&g_vecZero, 0, 0, FLAG_CAPTURE, 0, 0, 0);
|
||||
|
||||
// Reset the object
|
||||
CObjectFlag *pFlag = (CObjectFlag *)UTIL_FindEntityByClassname(NULL, "object_flag");
|
||||
if(pFlag)
|
||||
{
|
||||
pFlag->m_fIsInPlay = false;
|
||||
|
||||
// Do a funky effect on the flag when it gets reset
|
||||
pFlag->pev->effects = EF_BRIGHTFIELD;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return; // Wrong team
|
||||
}
|
||||
|
||||
|
||||
void CCaptureTeam2 :: KeyValue( KeyValueData* Data )
|
||||
{
|
||||
// This will store the points but its not fully implemented. I'll leave it for you to do.
|
||||
if( FStrEq( Data->szKeyName, "points" ) )
|
||||
{
|
||||
int m_iPoints = atoi(Data->szValue);
|
||||
Data->fHandled = true;
|
||||
}
|
||||
|
||||
CBaseEntity::KeyValue(Data); // call the parent function
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
// Status of the flag
|
||||
#define FLAG_STOLEN 1
|
||||
#define FLAG_CAPTURE 2
|
||||
#define FLAG_DROPPED 3
|
||||
|
||||
// Our flag class which holds all our functions and variables we're going to use
|
||||
|
||||
class CObjectFlag : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
void Spawn( );
|
||||
void Precache( );
|
||||
void Touch(CBaseEntity *);
|
||||
bool m_fIsInPlay;
|
||||
};
|
||||
|
||||
// The Flag entity that is dropped by a player when killed/disconnected/whatnot
|
||||
class CDroppedFlag : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
void Spawn( );
|
||||
void Precache( );
|
||||
void Touch(CBaseEntity *);
|
||||
};
|
||||
|
||||
// Capture point for Team 1
|
||||
class CCaptureTeam1 : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
|
||||
void Spawn( );
|
||||
void Precache( );
|
||||
void EXPORT Touch(CBaseEntity *);
|
||||
void EXPORT Think( );
|
||||
void KeyValue( KeyValueData* );
|
||||
};
|
||||
|
||||
|
||||
// Capture point for Team 2
|
||||
class CCaptureTeam2 : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
|
||||
void Spawn( );
|
||||
void Precache( );
|
||||
void EXPORT Touch( CBaseEntity *);
|
||||
void EXPORT Think( );
|
||||
void KeyValue( KeyValueData* );
|
||||
};
|
|
@ -0,0 +1,319 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#if !defined( OEM_BUILD )
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
//#include "gamerules.h"
|
||||
|
||||
#include "soundent.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
enum dosh_e {
|
||||
DOSH_IDLE = 0,
|
||||
DOSH_FIDGET,
|
||||
DOSH_PINPULL,
|
||||
DOSH_THROW1, // to empty
|
||||
DOSH_THROW2, // loaded
|
||||
DOSH_THROW3, // loaded
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_dosh, CDosh );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
LINK_ENTITY_TO_CLASS( dosh_rocket, CDoshRocket );
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
CDoshRocket *CDoshRocket::CreateDoshRocket( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CDosh *pLauncher )
|
||||
{
|
||||
CDoshRocket *pRocket = GetClassPtr( (CDoshRocket *)NULL );
|
||||
|
||||
UTIL_SetOrigin( pRocket->pev, vecOrigin );
|
||||
pRocket->pev->angles = vecAngles;
|
||||
pRocket->Spawn();
|
||||
pRocket->SetTouch( &CDoshRocket::RocketTouch );
|
||||
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
|
||||
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
|
||||
pRocket->pev->owner = pOwner->edict();
|
||||
|
||||
return pRocket;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
void CDoshRocket :: Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
// motor
|
||||
pev->movetype = MOVETYPE_TOSS;
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
//SET_MODEL(ENT(pev), "models/doshrocket.mdl");
|
||||
UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0));
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
|
||||
pev->classname = MAKE_STRING("dosh_rocket");
|
||||
|
||||
SetThink( &CDoshRocket::IgniteThink );
|
||||
SetTouch( &CDoshRocket::DoshTouch );
|
||||
|
||||
pev->angles.x -= 30;
|
||||
UTIL_MakeVectors( pev->angles );
|
||||
pev->angles.x = -(pev->angles.x + 30);
|
||||
|
||||
pev->velocity = gpGlobals->v_forward * 250;
|
||||
pev->gravity = 0.5;
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.4;
|
||||
|
||||
pev->dmg = gSkillData.plrDmgDosh;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
void CDoshRocket :: RocketTouch ( CBaseEntity *pPlayer )
|
||||
{
|
||||
if ( m_pLauncher )
|
||||
{
|
||||
// my launcher is still around, tell it I'm dead.
|
||||
m_pLauncher->m_cActiveRockets--;
|
||||
}
|
||||
|
||||
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/doshget.wav", 1, 0.5 );
|
||||
ExplodeTouch2( pPlayer );
|
||||
}
|
||||
|
||||
void CDoshRocket::DoshTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
if (pOther->pev->takedamage)
|
||||
{
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/doshget.wav", 1, ATTN_NORM);
|
||||
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
|
||||
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
|
||||
|
||||
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
{
|
||||
// if what we hit is static architecture, can stay around for a while.
|
||||
Vector vecDir = pev->velocity.Normalize( );
|
||||
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
|
||||
//pev->angles = UTIL_VecToAngles( vecDir );
|
||||
pev->angles = Vector( 0, 0, 0 ); //Should reset it upright.
|
||||
//pev->velocity = Vector( 0, 0, 0 );
|
||||
pev->avelocity.y = 100; //Simulate the Killing Floor spinning
|
||||
pev->solid = SOLID_BBOX;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
pev->avelocity.z = 0;
|
||||
//pev->angles.x = RANDOM_LONG(0,360);
|
||||
pev->nextthink = gpGlobals->time + 10.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
void CDoshRocket :: Precache( void )
|
||||
{
|
||||
m_iTrail = PRECACHE_MODEL("sprites/smoke.spr");
|
||||
PRECACHE_SOUND ("weapons/doshget.wav");
|
||||
}
|
||||
|
||||
|
||||
void CDoshRocket :: IgniteThink( void )
|
||||
{
|
||||
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
m_flIgniteTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
#endif
|
||||
void CDosh::Reload( void )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void CDosh::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_DOSH;
|
||||
|
||||
SET_MODEL(ENT(pev), "models/w_dosh.mdl");
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CDosh::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_dosh.mdl");
|
||||
PRECACHE_MODEL("models/v_dosh.mdl");
|
||||
PRECACHE_MODEL("models/p_dosh.mdl");
|
||||
PRECACHE_MODEL("models/dosh.mdl"); //Jason!
|
||||
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
|
||||
// UTIL_PrecacheOther( "laser_spot" );
|
||||
UTIL_PrecacheOther( "dosh_rocket" );
|
||||
|
||||
PRECACHE_SOUND("weapons/dosh1.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
PRECACHE_SOUND("weapons/dosh2.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
PRECACHE_SOUND("weapons/dosh3.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
PRECACHE_SOUND("weapons/dosh4.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
PRECACHE_SOUND("weapons/dosh5.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
//PRECACHE_SOUND("weapons/dosh6.wav"); //Did I miss the dosh party?
|
||||
PRECACHE_SOUND("weapons/doshget.wav"); //HERES SOME CASH GUYS SOMEONE TAKE IT
|
||||
|
||||
m_usDosh = PRECACHE_EVENT ( 1, "events/dosh.sc" );
|
||||
m_usDosh2 = PRECACHE_EVENT( 1, "events/dosh2.sc" );
|
||||
}
|
||||
|
||||
|
||||
int CDosh::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = DOSH_MAX_CLIP;
|
||||
p->iSlot = 3;
|
||||
p->iPosition = 4;
|
||||
p->iId = m_iId = WEAPON_DOSH;
|
||||
p->iFlags = 0;
|
||||
p->iWeight = DOSH_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CDosh::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CDosh::Deploy( )
|
||||
{
|
||||
if ( m_iClip == 0 )
|
||||
{
|
||||
return DefaultDeploy( "models/v_dosh.mdl", "models/p_dosh.mdl", DOSH_IDLE, "crowbar" );
|
||||
}
|
||||
|
||||
return DefaultDeploy( "models/v_dosh.mdl", "models/p_dosh.mdl", DOSH_IDLE, "crowbar" );
|
||||
}
|
||||
|
||||
|
||||
BOOL CDosh::CanHolster( void )
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CDosh::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_fInReload = FALSE;// cancel any reload in progress.
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
||||
SendWeaponAnim( DOSH_THROW3 );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void CDosh::PrimaryAttack()
|
||||
{
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle );
|
||||
|
||||
// we don't add in player velocity anymore.
|
||||
CGrenade::ShootContact2( m_pPlayer->pev,
|
||||
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 60,
|
||||
gpGlobals->v_forward * 512 );
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usDosh );
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1;// idle pretty soon after shooting.
|
||||
}
|
||||
|
||||
void CDosh::WeaponIdle( void )
|
||||
{
|
||||
//UpdateSpot( );
|
||||
|
||||
ResetEmptySound( );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
|
||||
{
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if (flRand <= 0.75 || m_fSpotActive)
|
||||
{
|
||||
iAnim = DOSH_IDLE;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 15.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = DOSH_FIDGET;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;
|
||||
}
|
||||
|
||||
SendWeaponAnim( iAnim );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,309 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
#include "client.h"
|
||||
//#include "multiplay_gamerules.h"
|
||||
|
||||
#define CROWBAR_BODYHIT_VOLUME 128
|
||||
#define CROWBAR_WALLHIT_VOLUME 512
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_fotn, CFOTN );
|
||||
|
||||
|
||||
|
||||
enum gauss_e {
|
||||
FOTN_IDLE = 0,
|
||||
FOTN_IDLELONG,
|
||||
FOTN_LPUNCH,
|
||||
FOTN_RPUNCH,
|
||||
FOTN_DEPLOY,
|
||||
FOTN_HOLSTER,
|
||||
FOTN_BASEFIST
|
||||
};
|
||||
|
||||
|
||||
void CFOTN::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_CROWBAR;
|
||||
SET_MODEL(ENT(pev), "models/w_crowbar.mdl");
|
||||
m_iClip = -1;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_fotn.mdl");
|
||||
PRECACHE_MODEL("models/w_fotn.mdl");
|
||||
PRECACHE_MODEL("models/p_fotn.mdl");
|
||||
PRECACHE_SOUND("weapons/cbar_hit1.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hit2.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod1.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod2.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod3.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_miss1.wav");
|
||||
|
||||
m_usFotn = PRECACHE_EVENT ( 1, "events/fotn.sc" );
|
||||
}
|
||||
|
||||
int CFOTN::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 0;
|
||||
p->iPosition = 4;
|
||||
p->iId = WEAPON_FOTN;
|
||||
p->iWeight = CROWBAR_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CFOTN::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_fotn.mdl", "models/p_fotn.mdl", FOTN_DEPLOY, "crowbar" );
|
||||
}
|
||||
|
||||
void CFOTN::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( FOTN_HOLSTER );
|
||||
}
|
||||
|
||||
|
||||
void FindDullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity )
|
||||
{
|
||||
int i, j, k;
|
||||
float distance;
|
||||
float *minmaxs[2] = {mins, maxs};
|
||||
TraceResult tmpTrace;
|
||||
Vector vecHullEnd = tr.vecEndPos;
|
||||
Vector vecEnd;
|
||||
|
||||
distance = 1e6f;
|
||||
|
||||
vecHullEnd = vecSrc + ((vecHullEnd - vecSrc)*2);
|
||||
UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
for ( j = 0; j < 2; j++ )
|
||||
{
|
||||
for ( k = 0; k < 2; k++ )
|
||||
{
|
||||
vecEnd.x = vecHullEnd.x + minmaxs[i][0];
|
||||
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
|
||||
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
float thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
|
||||
if ( thisDistance < distance )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
distance = thisDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::PrimaryAttack()
|
||||
{
|
||||
if (! Swing( 1 ))
|
||||
{
|
||||
SetThink( &CFOTN::SwingAgain );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::Smack( )
|
||||
{
|
||||
DecalGunshot( &m_trHit, BULLET_PLAYER_CROWBAR );
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::SwingAgain( void )
|
||||
{
|
||||
Swing( 0 );
|
||||
}
|
||||
|
||||
|
||||
int CFOTN::Swing( int fFirst )
|
||||
{
|
||||
int fDidHit = FALSE;
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
UTIL_MakeVectors (m_pPlayer->pev->v_angle);
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
|
||||
if ( tr.flFraction < 1.0 )
|
||||
{
|
||||
// Calculate the point of intersection of the line (or hull) and the object we hit
|
||||
// This is and approximation of the "best" intersection
|
||||
CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit );
|
||||
if ( !pHit || pHit->IsBSPModel() )
|
||||
FindDullIntersection( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() );
|
||||
vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFotn,
|
||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
||||
0.0, 0, 0.0 );
|
||||
|
||||
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
if (fFirst)
|
||||
{
|
||||
// miss
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( FOTN_LPUNCH );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
|
||||
// hit
|
||||
fDidHit = TRUE;
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||
|
||||
ClearMultiDamage( );
|
||||
|
||||
if ( (m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// first swing does full damage
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
else
|
||||
{
|
||||
// subsequent swings do half
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||
|
||||
// play thwack, smack, or dong sound
|
||||
float flVol = 1.0;
|
||||
int fHitWorld = TRUE;
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||
{
|
||||
// play thwack or smack sound
|
||||
switch( RANDOM_LONG(0,2) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME;
|
||||
if ( !pEntity->IsAlive() )
|
||||
return TRUE;
|
||||
else
|
||||
flVol = 0.1;
|
||||
|
||||
fHitWorld = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// play texture hit sound
|
||||
// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line
|
||||
|
||||
if (fHitWorld)
|
||||
{
|
||||
float fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd-vecSrc)*2, BULLET_PLAYER_CROWBAR);
|
||||
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// override the volume here, cause we don't play texture sounds in multiplayer,
|
||||
// and fvolbar is going to be 0 from the above call.
|
||||
|
||||
fvolbar = 1;
|
||||
}
|
||||
|
||||
// also play crowbar strike
|
||||
switch( RANDOM_LONG(0,1) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hit1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
case 1:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hit2.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
}
|
||||
|
||||
// delay the decal a bit
|
||||
m_trHit = tr;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = flVol * CROWBAR_WALLHIT_VOLUME;
|
||||
#endif
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
||||
|
||||
SetThink( &CFOTN::Smack );
|
||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
|
||||
|
||||
|
||||
}
|
||||
return fDidHit;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,365 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
|
||||
#define FOTN_BODYHIT_VOLUME 128
|
||||
#define FOTN_WALLHIT_VOLUME 512
|
||||
|
||||
#define FOTN_DELAY 0.5 //1.5 Seconds
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_fotn, CFOTN );
|
||||
|
||||
|
||||
|
||||
enum gauss_e {
|
||||
FOTN_IDLE = 0,
|
||||
FOTN_IDLELONG,
|
||||
FOTN_LPUNCH,
|
||||
FOTN_RPUNCH,
|
||||
FOTN_DEPLOY,
|
||||
FOTN_HOLSTER,
|
||||
FOTN_BASEFIST
|
||||
};
|
||||
|
||||
|
||||
void CFOTN::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_FOTN;
|
||||
SET_MODEL(ENT(pev), "models/w_fotn.mdl");
|
||||
m_iClip = -1;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_fotn.mdl");
|
||||
PRECACHE_MODEL("models/w_fotn.mdl");
|
||||
PRECACHE_MODEL("models/p_fotn.mdl");
|
||||
PRECACHE_SOUND("weapons/fotn_hit1.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_hit2.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod1.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod2.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_hitbod3.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_start.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_wata.wav");
|
||||
PRECACHE_SOUND("weapons/cbar_miss1.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_atat1.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_atat2.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_atat3.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_atat4.wav");
|
||||
PRECACHE_SOUND("weapons/fotn_omae.wav");
|
||||
|
||||
flAhDelay = gpGlobals->time; //Ah immedately.
|
||||
|
||||
m_usFOTN = PRECACHE_EVENT ( 1, "events/fotns.sc" );
|
||||
}
|
||||
|
||||
int CFOTN::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 0;
|
||||
p->iPosition = 2;
|
||||
p->iId = WEAPON_FOTN;
|
||||
p->iWeight = BEAMKATANA_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CFOTN::Deploy( )
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_omae.wav", 1, ATTN_NORM);
|
||||
return DefaultDeploy( "models/v_fotn.mdl", "models/p_fotn.mdl", FOTN_DEPLOY, "crowbar" );
|
||||
}
|
||||
|
||||
void CFOTN::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( FOTN_HOLSTER );
|
||||
}
|
||||
|
||||
|
||||
void FindGullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity )
|
||||
{
|
||||
int i, j, k;
|
||||
float distance;
|
||||
float *minmaxs[2] = {mins, maxs};
|
||||
TraceResult tmpTrace;
|
||||
Vector vecHullEnd = tr.vecEndPos;
|
||||
Vector vecEnd;
|
||||
|
||||
distance = 1e6f;
|
||||
|
||||
vecHullEnd = vecSrc + ((vecHullEnd - vecSrc)*2);
|
||||
UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
for ( j = 0; j < 2; j++ )
|
||||
{
|
||||
for ( k = 0; k < 2; k++ )
|
||||
{
|
||||
vecEnd.x = vecHullEnd.x + minmaxs[i][0];
|
||||
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
|
||||
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace );
|
||||
if ( tmpTrace.flFraction < 1.0 )
|
||||
{
|
||||
float thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
|
||||
if ( thisDistance < distance )
|
||||
{
|
||||
tr = tmpTrace;
|
||||
distance = thisDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::WeaponIdle()
|
||||
{
|
||||
if(!flWataDelay)
|
||||
return;
|
||||
|
||||
if (flWataDelay < gpGlobals->time)
|
||||
{
|
||||
flWataDelay = 0;
|
||||
EndAttack();
|
||||
}
|
||||
}
|
||||
|
||||
void CFOTN::EndAttack()
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_wata.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
void CFOTN::PrimaryAttack()
|
||||
{
|
||||
if (flAhDelay < gpGlobals->time)
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_start.wav", 1, ATTN_NORM);
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3;
|
||||
flAhDelay = gpGlobals->time + FOTN_DELAY;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Play Swing sound
|
||||
switch(RANDOM_LONG(0,3))
|
||||
{
|
||||
case 0: EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_atat1.wav", 1, ATTN_NORM,0,RANDOM_LONG(90,100)); break;
|
||||
case 1: EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_atat2.wav", 1, ATTN_NORM,0,RANDOM_LONG(90,100)); break;
|
||||
case 2: EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_atat3.wav", 1, ATTN_NORM,0,RANDOM_LONG(90,100)); break;
|
||||
case 3: EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_atat4.wav", 1, ATTN_NORM,0,RANDOM_LONG(90,100)); break;
|
||||
}
|
||||
}
|
||||
flAhDelay = gpGlobals->time + FOTN_DELAY;
|
||||
flWataDelay = flAhDelay;
|
||||
if (! Swing( 1 ))
|
||||
{
|
||||
SetThink( &CFOTN::SwingAgain );
|
||||
pev->nextthink = gpGlobals->time + 0.12;
|
||||
}
|
||||
}
|
||||
|
||||
void CFOTN::SecondaryAttack()
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_omae.wav", 1, ATTN_NORM);
|
||||
SendWeaponAnim( FOTN_IDLELONG );
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 2.5;
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.5;
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::Smack( )
|
||||
{
|
||||
DecalGunshot( &m_trHit, BULLET_PLAYER_FOTN );
|
||||
}
|
||||
|
||||
|
||||
void CFOTN::SwingAgain( void )
|
||||
{
|
||||
Swing( 0 );
|
||||
}
|
||||
|
||||
|
||||
int CFOTN::Swing( int fFirst )
|
||||
{
|
||||
int fDidHit = FALSE;
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
UTIL_MakeVectors (m_pPlayer->pev->v_angle);
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
|
||||
if ( tr.flFraction < 1.0 )
|
||||
{
|
||||
// Calculate the point of intersection of the line (or hull) and the object we hit
|
||||
// This is and approximation of the "best" intersection
|
||||
CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit );
|
||||
if ( !pHit || pHit->IsBSPModel() )
|
||||
FindGullIntersection( vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict() );
|
||||
vecEnd = tr.vecEndPos; // This is the point on the actual surface (the hull could have hit space)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usFOTN,
|
||||
0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0,
|
||||
0.0, 0, 0.0 );
|
||||
|
||||
|
||||
if ( tr.flFraction >= 1.0 )
|
||||
{
|
||||
if (fFirst)
|
||||
{
|
||||
// miss
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( FOTN_LPUNCH );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
|
||||
// hit
|
||||
fDidHit = TRUE;
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||
|
||||
ClearMultiDamage( );
|
||||
|
||||
if ( (m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// first swing does full damage
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
else
|
||||
{
|
||||
// subsequent swings do half
|
||||
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgFOTN / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
|
||||
}
|
||||
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
|
||||
|
||||
// play thwack, smack, or dong sound
|
||||
float flVol = 1.0;
|
||||
int fHitWorld = TRUE;
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
if ( pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE )
|
||||
{
|
||||
// play thwack or smack sound
|
||||
switch( RANDOM_LONG(0,2) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod1.wav", .3, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod2.wav", .3, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/cbar_hitbod3.wav", .3, ATTN_NORM); break;
|
||||
}
|
||||
m_pPlayer->m_iWeaponVolume = FOTN_BODYHIT_VOLUME;
|
||||
if ( !pEntity->IsAlive() )
|
||||
return TRUE;
|
||||
else
|
||||
flVol = 0.1;
|
||||
|
||||
fHitWorld = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// play texture hit sound
|
||||
// UNDONE: Calculate the correct point of intersection when we hit with the hull instead of the line
|
||||
|
||||
if (fHitWorld)
|
||||
{
|
||||
float fvolbar = TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd-vecSrc)*2, BULLET_PLAYER_FOTN);
|
||||
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// override the volume here, cause we don't play texture sounds in multiplayer,
|
||||
// and fvolbar is going to be 0 from the above call.
|
||||
|
||||
fvolbar = 1;
|
||||
}
|
||||
|
||||
// also play fotn strike
|
||||
switch( RANDOM_LONG(0,1) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_hit1.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
case 1:
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/fotn_hit2.wav", fvolbar, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
|
||||
break;
|
||||
}
|
||||
|
||||
// delay the decal a bit
|
||||
m_trHit = tr;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = flVol * FOTN_WALLHIT_VOLUME;
|
||||
#endif
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.12;
|
||||
|
||||
SetThink( &CFOTN::Smack );
|
||||
pev->nextthink = UTIL_WeaponTimeBase() + 0.18;
|
||||
|
||||
|
||||
}
|
||||
return fDidHit;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,316 @@
|
|||
/***
|
||||
* Gay Glenn.cpp
|
||||
* Gay Glenn is actually not gay.
|
||||
****/
|
||||
//=========================================================
|
||||
// Glenn
|
||||
//=========================================================
|
||||
|
||||
// UNDONE: Don't flinch every time you get hit
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
#define GLENN_AE_ATTACK_RIGHT 0x01
|
||||
#define GLENN_AE_ATTACK_LEFT 0x02
|
||||
#define GLENN_AE_ATTACK_BOTH 0x03
|
||||
|
||||
#define GLENN_FLINCH_DELAY 2 // at most one flinch every n secs
|
||||
|
||||
class CGay : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int IgnoreConditions ( void );
|
||||
|
||||
float m_flNextFlinch;
|
||||
|
||||
void AlertSound( void );
|
||||
void IdleSound( void );
|
||||
void AttackSound( void );
|
||||
|
||||
static const char *pAttackSounds[];
|
||||
static const char *pIdleSounds[];
|
||||
static const char *pAlertSounds[];
|
||||
static const char *pPainSounds[];
|
||||
static const char *pAttackHitSounds[];
|
||||
static const char *pAttackMissSounds[];
|
||||
|
||||
// No range attacks
|
||||
BOOL CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
|
||||
BOOL CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( monster_gayglenn, CGay );
|
||||
LINK_ENTITY_TO_CLASS( monster_gay, CGay );
|
||||
|
||||
const char *CGay::pAttackHitSounds[] =
|
||||
{
|
||||
"glenn/strike1.wav",
|
||||
};
|
||||
|
||||
const char *CGay::pAttackMissSounds[] =
|
||||
{
|
||||
"glenn/miss1.wav",
|
||||
};
|
||||
|
||||
const char *CGay::pAttackSounds[] =
|
||||
{
|
||||
"glenn/gg_attack1.wav",
|
||||
"glenn/gg_attack2.wav",
|
||||
};
|
||||
|
||||
const char *CGay::pIdleSounds[] =
|
||||
{
|
||||
"glenn/gg_idle1.wav",
|
||||
"glenn/gg_idle2.wav",
|
||||
"glenn/gg_idle3.wav",
|
||||
"glenn/gg_idle4.wav",
|
||||
};
|
||||
|
||||
const char *CGay::pAlertSounds[] =
|
||||
{
|
||||
"glenn/gg_alert10.wav",
|
||||
"glenn/gg_alert20.wav",
|
||||
"glenn/gg_alert30.wav",
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CGay :: Classify ( void )
|
||||
{
|
||||
if (g_pGameRules->IsTest() && testmonsters.value <= 0)
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CLASS_GAYGLENN;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CGay :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
ys = 360;
|
||||
|
||||
#if 0
|
||||
switch ( m_Activity )
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
int CGay :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
// HACK HACK -- until we fix this.
|
||||
if ( IsAlive() )
|
||||
PainSound();
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
void CGay :: AlertSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG(0,9);
|
||||
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAlertSounds[ RANDOM_LONG(0,ARRAYSIZE(pAlertSounds)-1) ], 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CGay :: IdleSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG(0,9);
|
||||
|
||||
// Play a random idle sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
|
||||
void CGay :: AttackSound( void )
|
||||
{
|
||||
// Play a random attack sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CGay :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case GLENN_AE_ATTACK_RIGHT:
|
||||
{
|
||||
// do stuff for this event.
|
||||
// ALERT( at_console, "Slash right!\n" );
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.glennDmgOneSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.z = -18;
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
|
||||
}
|
||||
// Play a random attack hit sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else // Play a random attack miss sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
case GLENN_AE_ATTACK_LEFT:
|
||||
{
|
||||
// do stuff for this event.
|
||||
// ALERT( at_console, "Slash left!\n" );
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.glennDmgOneSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.z = 18;
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
|
||||
}
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
case GLENN_AE_ATTACK_BOTH:
|
||||
{
|
||||
// do stuff for this event.
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.glennDmgBothSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100;
|
||||
}
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CGay :: Spawn()
|
||||
{
|
||||
Precache( );
|
||||
|
||||
if (CVAR_GET_FLOAT("mp_testzom") == 1)
|
||||
SET_MODEL(ENT(pev), "models/zombie.mdl");
|
||||
else
|
||||
SET_MODEL(ENT(pev), "models/chris.mdl");
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.glennHealth, 3 );
|
||||
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_afCapability = bits_CAP_DOORS_GROUP | bits_CAP_AUTO_DOORS | bits_CAP_SQUAD;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CGay :: Precache()
|
||||
{
|
||||
int i;
|
||||
|
||||
PRECACHE_MODEL("models/chris.mdl");
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackHitSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackMissSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pIdleSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
||||
|
||||
|
||||
int CGay::IgnoreConditions ( void )
|
||||
{
|
||||
int iIgnore = CBaseMonster::IgnoreConditions();
|
||||
|
||||
if ((m_Activity == ACT_MELEE_ATTACK1) || (m_Activity == ACT_MELEE_ATTACK1))
|
||||
{
|
||||
#if 0
|
||||
if (pev->health < 20)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
else
|
||||
#endif
|
||||
if (m_flNextFlinch >= gpGlobals->time)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
}
|
||||
|
||||
if ((m_Activity == ACT_SMALL_FLINCH) || (m_Activity == ACT_BIG_FLINCH))
|
||||
{
|
||||
if (m_flNextFlinch < gpGlobals->time)
|
||||
m_flNextFlinch = gpGlobals->time + GLENN_FLINCH_DELAY;
|
||||
}
|
||||
|
||||
return iIgnore;
|
||||
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
//goldengun.cpp
|
||||
//created with Gott`s weapon creator by Cid Highwind www.warineuropemod.com
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
|
||||
enum GOLDENGUN_e
|
||||
{
|
||||
GOLDENGUN_LONGIDLE = 0,
|
||||
GOLDENGUN_IDLE1,
|
||||
GOLDENGUN_IDLE2,
|
||||
GOLDENGUN_FIRE1,
|
||||
GOLDENGUN_FIRE2,
|
||||
GOLDENGUN_RELOAD,
|
||||
GOLDENGUN_RELOAD2,
|
||||
GOLDENGUN_DEPLOY,
|
||||
GOLDENGUN_LAUNCH,
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_goldengun, CGOLDENGUN );
|
||||
|
||||
void CGOLDENGUN::Spawn( )
|
||||
{
|
||||
pev->classname = MAKE_STRING("weapon_goldengun");
|
||||
Precache( );
|
||||
m_iId = WEAPON_GOLDENGUN;
|
||||
SET_MODEL(ENT(pev), "models/w_goldengun.mdl");
|
||||
m_iDefaultAmmo = GOLDENGUN_MAX_DEFAULT_GIVE;
|
||||
FallInit();
|
||||
}
|
||||
|
||||
void CGOLDENGUN::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_goldengun.mdl");
|
||||
PRECACHE_MODEL("models/w_goldengun.mdl");
|
||||
PRECACHE_MODEL("models/p_goldengun.mdl");
|
||||
|
||||
m_iShell = PRECACHE_MODEL ("models/shell.mdl");
|
||||
|
||||
//PRECACHE_SOUND("items/goldengunclip.wav");
|
||||
PRECACHE_SOUND("weapons/ggun_fire.wav");
|
||||
|
||||
m_usFireGOLDENGUN = PRECACHE_EVENT( 1, "events/goldengun.sc" );
|
||||
}
|
||||
|
||||
int CGOLDENGUN::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "gold";
|
||||
p->iMaxAmmo1 = GOLDENGUN_MAX_CARRY;
|
||||
// p->pszAmmo2 = "Nothing";
|
||||
// p->iMaxAmmo2 = 0;
|
||||
p->iMaxClip = GOLDENGUN_MAX_CLIP;
|
||||
p->iSlot = 1;
|
||||
p->iPosition = 1;
|
||||
p->iFlags = 0;
|
||||
p->iId = m_iId = WEAPON_GOLDENGUN;
|
||||
p->iWeight = GOLDENGUN_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
BOOL CGOLDENGUN::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_goldengun.mdl", "models/p_goldengun.mdl", GOLDENGUN_DEPLOY, "goldengun", 0 );
|
||||
}
|
||||
|
||||
void CGOLDENGUN::SecondaryAttack( void )
|
||||
{
|
||||
//spaceholder
|
||||
}
|
||||
|
||||
void CGOLDENGUN::PrimaryAttack( void )
|
||||
{
|
||||
if (!(m_pPlayer->m_afButtonPressed & IN_ATTACK))
|
||||
return;
|
||||
GOLDENGUNFire( 0.085,(60/600) , FALSE );
|
||||
}
|
||||
|
||||
void CGOLDENGUN::GOLDENGUNFire( float flSpread , float flCycleTime, BOOL fUseAutoAim )
|
||||
{
|
||||
if (m_iClip <= 0)
|
||||
{
|
||||
if (m_fFireOnEmpty)
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
m_iClip--;
|
||||
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
|
||||
int flags;
|
||||
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGOLDENGUN : m_usFireGOLDENGUN, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 );
|
||||
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecAiming;
|
||||
|
||||
if ( fUseAutoAim )
|
||||
{
|
||||
vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
|
||||
}
|
||||
else
|
||||
{
|
||||
vecAiming = gpGlobals->v_forward;
|
||||
}
|
||||
|
||||
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_GOLDENGUN, 2 );
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime;
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
|
||||
if(m_pPlayer->pev->flags & FL_DUCKING)
|
||||
{
|
||||
switch (RANDOM_LONG(0,1))
|
||||
{
|
||||
case 0: m_pPlayer->pev->punchangle.y -= 3; break;
|
||||
case 1: m_pPlayer->pev->punchangle.y += 3; break;
|
||||
}
|
||||
}
|
||||
else if (m_pPlayer->pev->velocity.Length() > .01)
|
||||
{
|
||||
switch (RANDOM_LONG(0,1))
|
||||
{
|
||||
case 0: m_pPlayer->pev->punchangle.y -= 3; break;
|
||||
case 1: m_pPlayer->pev->punchangle.y += 3; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (RANDOM_LONG(0,1))
|
||||
{
|
||||
case 0: m_pPlayer->pev->punchangle.y -= 3; break;
|
||||
case 1: m_pPlayer->pev->punchangle.y += 3; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGOLDENGUN::Reload( void )
|
||||
{
|
||||
int iResult;
|
||||
|
||||
if (m_iClip == GOLDENGUN_MAX_CLIP)
|
||||
return;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
iResult = DefaultReload( GOLDENGUN_MAX_CLIP, GOLDENGUN_RELOAD2, 2.7, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
iResult = DefaultReload( GOLDENGUN_MAX_CLIP, GOLDENGUN_RELOAD2, 2.7, 0 );
|
||||
}
|
||||
if (iResult)
|
||||
{
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
}
|
||||
|
||||
void CGOLDENGUN::WeaponIdle( void )
|
||||
{
|
||||
ResetEmptySound( );
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
if (m_iClip != 0)
|
||||
{
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
|
||||
|
||||
if (flRand <= 0.3 + 0 * 0.75)
|
||||
{
|
||||
iAnim = GOLDENGUN_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
else if (flRand <= 0.6 + 0 * 0.875)
|
||||
{
|
||||
iAnim = GOLDENGUN_LONGIDLE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = GOLDENGUN_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
SendWeaponAnim( iAnim, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
class CGOLDENGUNAmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_goldengunclip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_goldengunclip.mdl");
|
||||
//PRECACHE_SOUND("items/goldengunclip.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_GOLDENGUNCLIP_GIVE, "gold", GOLDENGUN_MAX_CARRY) != -1);
|
||||
if(bResult)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_goldengun, CGOLDENGUNAmmoClip );
|
|
@ -0,0 +1,245 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This source code contains proprietary and confidential information of
|
||||
* Valve LLC and its suppliers. Access to this code is restricted to
|
||||
* persons who have executed a written SDK license with Valve. Any access,
|
||||
* use or distribution of this code by or to any unlicensed person is illegal.
|
||||
*
|
||||
****/
|
||||
//=========================================================
|
||||
// Grinman - unexplained entity.
|
||||
//=========================================================
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
#include "weapons.h"
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
|
||||
class CGrinman : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int ISoundMask ( void );
|
||||
|
||||
void DeclineFollowing( void );
|
||||
|
||||
int Save( CSave &save );
|
||||
int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
void StartTask( Task_t *pTask );
|
||||
void RunTask( Task_t *pTask );
|
||||
int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
||||
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
|
||||
|
||||
void PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener );
|
||||
|
||||
EHANDLE m_hPlayer;
|
||||
EHANDLE m_hTalkTarget;
|
||||
float m_flTalkTime;
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( monster_grinman, CGrinman );
|
||||
|
||||
|
||||
TYPEDESCRIPTION CGrinman::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD( CGrinman, m_hTalkTarget, FIELD_EHANDLE ),
|
||||
DEFINE_FIELD( CGrinman, m_flTalkTime, FIELD_TIME ),
|
||||
};
|
||||
IMPLEMENT_SAVERESTORE( CGrinman, CBaseMonster );
|
||||
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CGrinman :: Classify ( void )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CGrinman :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
switch ( m_Activity )
|
||||
{
|
||||
case ACT_IDLE:
|
||||
default:
|
||||
ys = 90;
|
||||
}
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CGrinman :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// ISoundMask - generic monster can't hear.
|
||||
//=========================================================
|
||||
int CGrinman :: ISoundMask ( void )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CGrinman :: Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
SET_MODEL( ENT(pev), "models/gman.mdl" );
|
||||
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = DONT_BLEED;
|
||||
pev->health = 100;
|
||||
m_flFieldOfView = -1;// 360 degrees, he sees all.
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CGrinman :: Precache()
|
||||
{
|
||||
PRECACHE_MODEL( "models/gman.mdl" );
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
||||
|
||||
void CGrinman :: StartTask( Task_t *pTask )
|
||||
{
|
||||
switch( pTask->iTask )
|
||||
{
|
||||
case TASK_WAIT:
|
||||
if (m_hPlayer == NULL)
|
||||
{
|
||||
m_hPlayer = UTIL_FindEntityByClassname( NULL, "player" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
CBaseMonster::StartTask( pTask );
|
||||
}
|
||||
|
||||
void CGrinman :: RunTask( Task_t *pTask )
|
||||
{
|
||||
switch( pTask->iTask )
|
||||
{
|
||||
case TASK_WAIT:
|
||||
// look at who I'm talking to
|
||||
if (m_flTalkTime > gpGlobals->time && m_hTalkTarget != NULL)
|
||||
{
|
||||
float yaw = VecToYaw(m_hTalkTarget->pev->origin - pev->origin) - pev->angles.y;
|
||||
|
||||
if (yaw > 180) yaw -= 360;
|
||||
if (yaw < -180) yaw += 360;
|
||||
|
||||
// turn towards vector
|
||||
SetBoneController( 0, yaw );
|
||||
}
|
||||
// look at player, but only if playing a "safe" idle animation
|
||||
else if (m_hPlayer != NULL && pev->sequence == 0)
|
||||
{
|
||||
float yaw = VecToYaw(m_hPlayer->pev->origin - pev->origin) - pev->angles.y;
|
||||
|
||||
if (yaw > 180) yaw -= 360;
|
||||
if (yaw < -180) yaw += 360;
|
||||
|
||||
// turn towards vector
|
||||
SetBoneController( 0, yaw );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBoneController( 0, 0 );
|
||||
}
|
||||
CBaseMonster::RunTask( pTask );
|
||||
break;
|
||||
default:
|
||||
SetBoneController( 0, 0 );
|
||||
CBaseMonster::RunTask( pTask );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// Override all damage
|
||||
//=========================================================
|
||||
int CGrinman :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
pev->health = pev->max_health / 2; // always trigger the 50% damage aitrigger
|
||||
|
||||
if ( flDamage > 0 )
|
||||
{
|
||||
SetConditions(bits_COND_LIGHT_DAMAGE);
|
||||
}
|
||||
|
||||
if ( flDamage >= 20 )
|
||||
{
|
||||
SetConditions(bits_COND_HEAVY_DAMAGE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void CGrinman::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
|
||||
{
|
||||
switch (RANDOM_LONG(1,3))
|
||||
{
|
||||
case 1:UTIL_Sparks( ptr->vecEndPos ); break;
|
||||
case 2:UTIL_Ricochet( ptr->vecEndPos, 2 ); break;
|
||||
case 3:UTIL_BloodStream( ptr->vecEndPos, UTIL_RandomBloodVector(), 330, RANDOM_LONG(50,150)); break;
|
||||
}
|
||||
|
||||
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
|
||||
void CGrinman::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener )
|
||||
{
|
||||
CBaseMonster::PlayScriptedSentence( pszSentence, duration, volume, attenuation, bConcurrent, pListener );
|
||||
|
||||
m_flTalkTime = gpGlobals->time + duration;
|
||||
m_hTalkTarget = pListener;
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// heavyrain_gamerules.cpp
|
||||
//
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "heavyrain_gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgPlayMP3; //AJH - Killars MP3player
|
||||
extern int gmsgStopMP3;
|
||||
|
||||
CHeavyRainplay :: CHeavyRainplay()
|
||||
{
|
||||
//Genuflect
|
||||
}
|
||||
|
||||
BOOL CHeavyRainplay::IsHeavyRain()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CHeavyRainplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_jason" );
|
||||
pPlayer->GiveNamedItem( "weapon_goldengun" );
|
||||
pPlayer->GiveAmmo( 15, "gold", GOLDENGUN_MAX_CARRY );
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgPlayMP3, NULL, pPlayer->edict() );
|
||||
WRITE_STRING( "media/jayson.mp3" );
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
||||
void CHeavyRainplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
CBasePlayer *peKiller = NULL;
|
||||
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
|
||||
if ( pVictim->pev == pKiller )
|
||||
{ // killed self
|
||||
pVictim->pev->frags -= 10;
|
||||
char victext[1024] = "You sacrificed your life for Jason\nYou lose 10 Jasons for revival costs.\n";
|
||||
UTIL_SayText( victext, pVictim );
|
||||
return;
|
||||
}
|
||||
else if ( ktmp && ktmp->IsPlayer() )
|
||||
{
|
||||
int FUCK = pVictim->pev->frags;
|
||||
pKiller->frags += JasonsStolen(FUCK);
|
||||
pVictim->pev->frags -= JasonsStolen(FUCK);
|
||||
|
||||
char victext[1024] = "You lose your Jasons to the killer.\nKILL HIM AND GET THEM BACK! ;)\n";
|
||||
UTIL_SayText( victext, pVictim );
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||
WRITE_SHORT( pVictim->pev->frags );
|
||||
WRITE_SHORT( pVictim->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||
WRITE_SHORT( pVictim->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
|
||||
CBaseEntity *ep = CBaseEntity::Instance( pKiller );
|
||||
if ( ep && ep->Classify() == CLASS_PLAYER )
|
||||
{
|
||||
CBasePlayer *PK = (CBasePlayer*)ep;
|
||||
|
||||
char kiltext[1024] = "You stole your victim's Jasons and it is now added to your score.\nNo doubt hes out for blood, watch out ;)\n";
|
||||
UTIL_SayText( kiltext, PK );
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(PK->edict()) );
|
||||
WRITE_SHORT( PK->pev->frags );
|
||||
WRITE_SHORT( PK->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( PK->m_szTeamName) + 1 );
|
||||
WRITE_SHORT( PK->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
|
||||
// let the killer paint another decal as soon as he'd like.
|
||||
PK->m_flNextDecalTime = gpGlobals->time;
|
||||
}
|
||||
else
|
||||
{
|
||||
// World did them in, Genuflect.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CHeavyRainplay::JasonsStolen(int jason)
|
||||
{
|
||||
return jason; //JASON! I found you!
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// heavyrain_gamerules.h
|
||||
//
|
||||
|
||||
#define JASON 0;
|
||||
|
||||
class CHeavyRainplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CHeavyRainplay();
|
||||
virtual const char *GetGameDescription( void ) { return "Heavy Rain Mode"; } // this is the game name that gets seen in the server browser
|
||||
virtual BOOL IsHeavyRain( void );
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
virtual int JasonsStolen( int jason );
|
||||
};
|
|
@ -0,0 +1,129 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This source code contains proprietary and confidential information of
|
||||
* Valve LLC and its suppliers. Access to this code is restricted to
|
||||
* persons who have executed a written SDK license with Valve. Any access,
|
||||
* use or distribution of this code by or to any unlicensed person is illegal.
|
||||
*
|
||||
****/
|
||||
//=========================================================
|
||||
// monster template
|
||||
//=========================================================
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
|
||||
class CHomestuckFan : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
|
||||
void IdleSound( void );
|
||||
void PainSound( void );
|
||||
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( monster_homestuck, CHomestuckFan );
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CHomestuckFan :: Classify ( void )
|
||||
{
|
||||
return CLASS_CWC;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CHomestuckFan :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
switch ( m_Activity )
|
||||
{
|
||||
case ACT_IDLE:
|
||||
default:
|
||||
ys = 90;
|
||||
}
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CHomestuckFan :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CHomestuckFan :: Spawn()
|
||||
{
|
||||
Precache( );
|
||||
|
||||
SET_MODEL(ENT(pev), "models/homosuck.mdl");
|
||||
UTIL_SetSize( pev, Vector( -12, -12, 0 ), Vector( 12, 12, 24 ) );
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_GREEN;
|
||||
pev->health = CBaseMonster::GetHealth( 45, 3 );
|
||||
pev->view_ofs = Vector ( 0, 0, 0 );// position of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CHomestuckFan :: Precache()
|
||||
{
|
||||
PRECACHE_SOUND("homestuck/lemmetellyou.wav");
|
||||
|
||||
PRECACHE_MODEL("models/homosuck.mdl");
|
||||
}
|
||||
|
||||
void CHomestuckFan::IdleSound( void )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "homestuck/lemmetellyou.wav", 1, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
void CHomestuckFan::PainSound( void )
|
||||
{
|
||||
EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "homestuck/lemmetellyou.wav", 1, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
|
@ -0,0 +1,225 @@
|
|||
/*
|
||||
|
||||
===== hs_model.cpp ========================================================
|
||||
|
||||
Half-Screwed Model Entites, or how we don't have to worry and rely on brushes and broken, laggy maps anymore.
|
||||
Phew.
|
||||
|
||||
NOTE: I ripped this from Cycler. so It's not me, man.
|
||||
|
||||
*/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "animation.h"
|
||||
#include "weapons.h"
|
||||
#include "player.h"
|
||||
|
||||
|
||||
#define TEMP_FOR_SCREEN_SHOTS
|
||||
#ifdef TEMP_FOR_SCREEN_SHOTS //===================================================
|
||||
|
||||
class CHSModel : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void GeneriCHSModelSpawn(char *szModel, Vector vecMin, Vector vecMax);
|
||||
virtual int ObjectCaps( void ) { return (CBaseEntity :: ObjectCaps() | FCAP_IMPULSE_USE); }
|
||||
void Spawn( void );
|
||||
void Think( void );
|
||||
|
||||
// Don't treat as a live target
|
||||
virtual BOOL IsAlive( void ) { return FALSE; }
|
||||
|
||||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
int m_animate;
|
||||
};
|
||||
|
||||
TYPEDESCRIPTION CHSModel::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD( CHSModel, m_animate, FIELD_INTEGER ),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE( CHSModel, CBaseMonster );
|
||||
|
||||
|
||||
//
|
||||
// we should get rid of all the other cyclers and replace them with this.
|
||||
//
|
||||
class CGeneriCHSModel : public CHSModel
|
||||
{
|
||||
public:
|
||||
void Spawn( void ) { GeneriCHSModelSpawn( (char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72) ); }
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( hs_model, CGeneriCHSModel );
|
||||
|
||||
|
||||
// Cycler member functions
|
||||
|
||||
void CHSModel :: GeneriCHSModelSpawn(char *szModel, Vector vecMin, Vector vecMax)
|
||||
{
|
||||
if (!szModel || !*szModel)
|
||||
{
|
||||
ALERT(at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z );
|
||||
REMOVE_ENTITY(ENT(pev));
|
||||
return;
|
||||
}
|
||||
|
||||
pev->classname = MAKE_STRING("cycler");
|
||||
PRECACHE_MODEL( szModel );
|
||||
SET_MODEL(ENT(pev), szModel);
|
||||
|
||||
CHSModel::Spawn( );
|
||||
|
||||
UTIL_SetSize(pev, vecMin, vecMax);
|
||||
}
|
||||
|
||||
|
||||
void CHSModel :: Spawn( )
|
||||
{
|
||||
InitBoneControllers();
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
pev->effects = 0;
|
||||
pev->health = 8675309;// no cycler should die
|
||||
pev->yaw_speed = 5;
|
||||
pev->ideal_yaw = pev->angles.y;
|
||||
ChangeYaw( 360 );
|
||||
|
||||
m_flFrameRate = 75;
|
||||
m_flGroundSpeed = 0;
|
||||
|
||||
pev->nextthink += 1.0;
|
||||
|
||||
ResetSequenceInfo( );
|
||||
|
||||
if (pev->sequence != 0 || pev->frame != 0)
|
||||
{
|
||||
m_animate = 0;
|
||||
pev->framerate = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_animate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// cycler think
|
||||
//
|
||||
void CHSModel :: Think( void )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if (m_animate)
|
||||
{
|
||||
StudioFrameAdvance ( );
|
||||
}
|
||||
if (m_fSequenceFinished && !m_fSequenceLoops)
|
||||
{
|
||||
// ResetSequenceInfo();
|
||||
// hack to avoid reloading model every frame
|
||||
pev->animtime = gpGlobals->time;
|
||||
pev->framerate = 1.0;
|
||||
m_fSequenceFinished = FALSE;
|
||||
m_flLastEventCheck = gpGlobals->time;
|
||||
pev->frame = 0;
|
||||
if (!m_animate)
|
||||
pev->framerate = 0.0; // FIX: don't reset framerate
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
class CHSModelSprite : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Think( void );
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
virtual int ObjectCaps( void ) { return (CBaseEntity :: ObjectCaps() | FCAP_DONT_SAVE | FCAP_IMPULSE_USE); }
|
||||
virtual int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );
|
||||
void Animate( float frames );
|
||||
|
||||
virtual int Save( CSave &save );
|
||||
virtual int Restore( CRestore &restore );
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
inline int ShouldAnimate( void ) { return m_animate && m_maxFrame > 1.0; }
|
||||
int m_animate;
|
||||
float m_lastTime;
|
||||
float m_maxFrame;
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( hs_sprite, CHSModelSprite );
|
||||
|
||||
TYPEDESCRIPTION CHSModelSprite::m_SaveData[] =
|
||||
{
|
||||
DEFINE_FIELD( CHSModelSprite, m_animate, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( CHSModelSprite, m_lastTime, FIELD_TIME ),
|
||||
DEFINE_FIELD( CHSModelSprite, m_maxFrame, FIELD_FLOAT ),
|
||||
};
|
||||
|
||||
IMPLEMENT_SAVERESTORE( CHSModelSprite, CBaseEntity );
|
||||
|
||||
|
||||
void CHSModelSprite::Spawn( void )
|
||||
{
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->takedamage = DAMAGE_NO;
|
||||
pev->effects = 0;
|
||||
|
||||
pev->frame = 0;
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
m_animate = 1;
|
||||
m_lastTime = gpGlobals->time;
|
||||
|
||||
PRECACHE_MODEL( (char *)STRING(pev->model) );
|
||||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
||||
|
||||
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
|
||||
}
|
||||
|
||||
|
||||
void CHSModelSprite::Think( void )
|
||||
{
|
||||
if ( ShouldAnimate() )
|
||||
Animate( pev->framerate * (gpGlobals->time - m_lastTime) );
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
m_lastTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
||||
void CHSModelSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
m_animate = !m_animate;
|
||||
ALERT( at_console, "Sprite: %s\n", STRING(pev->model) );
|
||||
}
|
||||
|
||||
|
||||
int CHSModelSprite::TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
if ( m_maxFrame > 1.0 )
|
||||
{
|
||||
Animate( 1.0 );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CHSModelSprite::Animate( float frames )
|
||||
{
|
||||
pev->frame += frames;
|
||||
if ( m_maxFrame > 0 )
|
||||
pev->frame = fmod( pev->frame, m_maxFrame );
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
//jackal.cpp
|
||||
//created with Gott`s weapon creator by Cid Highwind www.warineuropemod.com
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
|
||||
enum Jackal_e
|
||||
{
|
||||
Jackal_LONGIDLE = 0,
|
||||
Jackal_IDLE1,
|
||||
Jackal_IDLE2,
|
||||
Jackal_FIRE1,
|
||||
Jackal_FIRE2,
|
||||
Jackal_RELOAD,
|
||||
Jackal_RELOAD2,
|
||||
Jackal_DEPLOY,
|
||||
Jackal_LAUNCH,
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_jackal, CJackal );
|
||||
LINK_ENTITY_TO_CLASS( weapon_357, CJackal );
|
||||
|
||||
void CJackal::Spawn( )
|
||||
{
|
||||
pev->classname = MAKE_STRING("weapon_jackal");
|
||||
Precache( );
|
||||
m_iId = WEAPON_JACKAL;
|
||||
SET_MODEL(ENT(pev), "models/w_jackal.mdl");
|
||||
m_iDefaultAmmo = 12;
|
||||
FallInit();
|
||||
}
|
||||
|
||||
void CJackal::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_jackal.mdl");
|
||||
PRECACHE_MODEL("models/w_jackal.mdl");
|
||||
PRECACHE_MODEL("models/p_jackal.mdl");
|
||||
|
||||
m_iShell = PRECACHE_MODEL ("models/shell.mdl");
|
||||
|
||||
PRECACHE_SOUND("weapons/jackal-1.wav");
|
||||
|
||||
m_usFireJackal = PRECACHE_EVENT( 1, "events/jackal.sc" );
|
||||
}
|
||||
|
||||
int CJackal::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "jackal";
|
||||
p->iMaxAmmo1 = JACKAL_MAX_CARRY;
|
||||
p->iMaxClip = JACKAL_MAX_CLIP;
|
||||
p->iSlot = 1;
|
||||
p->iPosition = 3;
|
||||
p->iFlags = 0;
|
||||
p->iId = m_iId = WEAPON_JACKAL;
|
||||
p->iWeight = JACKAL_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
BOOL CJackal::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_jackal.mdl", "models/p_jackal.mdl", Jackal_DEPLOY, "jackal", 0 );
|
||||
}
|
||||
|
||||
void CJackal::SecondaryAttack( void )
|
||||
{
|
||||
//spaceholder
|
||||
}
|
||||
|
||||
void CJackal::PrimaryAttack( void )
|
||||
{
|
||||
if (!(m_pPlayer->m_afButtonPressed & IN_ATTACK))
|
||||
return;
|
||||
JackalFire( 0.385,(60/600) , FALSE );
|
||||
}
|
||||
|
||||
void CJackal::JackalFire( float flSpread , float flCycleTime, BOOL fUseAutoAim )
|
||||
{
|
||||
if (m_iClip <= 0)
|
||||
{
|
||||
if (m_fFireOnEmpty)
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
m_iClip--;
|
||||
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
|
||||
int flags;
|
||||
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireJackal : m_usFireJackal, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 );
|
||||
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecAiming;
|
||||
|
||||
if ( fUseAutoAim )
|
||||
{
|
||||
vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
|
||||
}
|
||||
else
|
||||
{
|
||||
vecAiming = gpGlobals->v_forward;
|
||||
}
|
||||
|
||||
m_pPlayer->FireBullets( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_JACKAL, 2 );
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
|
||||
int jackx = RANDOM_LONG(10,40);
|
||||
int jacky = RANDOM_LONG(10,40); //Jacky Boy.
|
||||
|
||||
m_pPlayer->pev->punchangle.x -= jackx;
|
||||
m_pPlayer->pev->punchangle.y -= jacky;
|
||||
|
||||
}
|
||||
|
||||
void CJackal::Reload( void )
|
||||
{
|
||||
int iResult;
|
||||
|
||||
if (m_iClip == JACKAL_MAX_CLIP)
|
||||
return;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
iResult = DefaultReload( JACKAL_MAX_CLIP, Jackal_RELOAD2, 2.7, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
iResult = DefaultReload( JACKAL_MAX_CLIP, Jackal_RELOAD2, 2.7, 0 );
|
||||
}
|
||||
if (iResult)
|
||||
{
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
}
|
||||
|
||||
void CJackal::WeaponIdle( void )
|
||||
{
|
||||
ResetEmptySound( );
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
if (m_iClip != 0)
|
||||
{
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
|
||||
|
||||
if (flRand <= 0.3 + 0 * 0.75)
|
||||
{
|
||||
iAnim = Jackal_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
else if (flRand <= 0.6 + 0 * 0.875)
|
||||
{
|
||||
iAnim = Jackal_LONGIDLE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = Jackal_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1 / 16;
|
||||
}
|
||||
SendWeaponAnim( iAnim, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
class CJackalAmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_jackalclip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_jackalclip.mdl");
|
||||
//PRECACHE_SOUND("items/jackalclip.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_JACKAL_GIVE, "jackal", JACKAL_MAX_CARRY) != -1);
|
||||
if(bResult)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_jackal, CJackalAmmoClip );
|
||||
LINK_ENTITY_TO_CLASS( ammo_357, CJackalAmmoClip );
|
|
@ -0,0 +1,129 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
|
||||
//#define CROWBAR_BODYHIT_VOLUME 128
|
||||
//#define CROWBAR_WALLHIT_VOLUME 512
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_jason, CJason );
|
||||
|
||||
|
||||
|
||||
enum gauss_e {
|
||||
JASON_IDLE = 0,
|
||||
JASON_DRAW,
|
||||
JASON_HOLSTER,
|
||||
JASON_ATTACK1HIT,
|
||||
JASON_ATTACK1MISS,
|
||||
JASON_ATTACK2MISS,
|
||||
JASON_ATTACK2HIT,
|
||||
JASON_ATTACK3MISS,
|
||||
JASON_ATTACK3HIT
|
||||
};
|
||||
|
||||
|
||||
void CJason::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_JASON;
|
||||
SET_MODEL(ENT(pev), "models/w_jason.mdl");
|
||||
m_iClip = -1;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CJason::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_jason.mdl");
|
||||
PRECACHE_MODEL("models/w_jason.mdl");
|
||||
PRECACHE_MODEL("models/p_jason.mdl");
|
||||
|
||||
m_usJason = PRECACHE_EVENT ( 1, "events/jason.sc" );
|
||||
}
|
||||
|
||||
int CJason::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 0;
|
||||
p->iPosition = 4;
|
||||
p->iId = WEAPON_JASON;
|
||||
p->iWeight = JASON_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CJason::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_jason.mdl", "models/p_jason.mdl", JASON_DRAW, "jason" );
|
||||
}
|
||||
|
||||
void CJason::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( JASON_HOLSTER );
|
||||
}
|
||||
|
||||
void CJason::PrimaryAttack()
|
||||
{
|
||||
switch( RANDOM_LONG(0,2) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/jason1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/jason2.wav", 1, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/jason3.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
|
||||
if (g_pGameRules->IsHeavyRain()) // is heavy rain enabled?
|
||||
{
|
||||
m_pPlayer->AddPoints(1,FALSE);
|
||||
}
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
|
||||
}
|
||||
|
||||
void CJason::SecondaryAttack()
|
||||
{
|
||||
switch( RANDOM_LONG(0,2) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/shaun1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/shaun2.wav", 1, ATTN_NORM); break;
|
||||
case 2:
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/shaun3.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
if (g_pGameRules->IsHeavyRain()) // is heavy rain enabled?
|
||||
{
|
||||
m_pPlayer->AddPoints(-1,TRUE);
|
||||
}
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "explode.h"
|
||||
|
||||
|
||||
#define JIHAD_PRIMARY_VOLUME 450
|
||||
|
||||
BOOL lolalo = FALSE;
|
||||
float timeouttemp = 0;
|
||||
float timeout = 3.5; //How many seconds until you need to yell again and reset to even explode.
|
||||
|
||||
enum jihad_e {
|
||||
JIHAD_IDLE = 0,
|
||||
JIHAD_SHOOT1, // bring out
|
||||
JIHAD_SHOOT2, // drop - never used in this
|
||||
JIHAD_SHOOT3, // Punch buttons
|
||||
};
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_jihad, CJihad );
|
||||
|
||||
|
||||
void CJihad::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_JIHAD;
|
||||
SET_MODEL(ENT(pev), "models/w_jihad.mdl");
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
pev->dmg = gSkillData.plrDmgJihad;
|
||||
#endif
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CJihad::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_jihad.mdl");
|
||||
PRECACHE_MODEL("models/v_jihad.mdl");
|
||||
PRECACHE_MODEL("models/p_jihad.mdl");
|
||||
PRECACHE_MODEL("models/w_grenade.mdl");
|
||||
PRECACHE_SOUND("weapons/jihad.wav");
|
||||
m_usJihad = PRECACHE_EVENT( 1, "events/jihad.sc" );
|
||||
}
|
||||
|
||||
int CJihad::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = NULL;
|
||||
p->iMaxAmmo1 = -1;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 4;
|
||||
p->iPosition = 4;
|
||||
p->iId = m_iId = WEAPON_JIHAD;
|
||||
p->iWeight = JIHAD_WEIGHT;
|
||||
p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CJihad::Deploy( )
|
||||
{
|
||||
//m_flReleaseThrow = -1;
|
||||
return DefaultDeploy( "models/v_jihad.mdl", "models/p_jihad.mdl", JIHAD_SHOOT1, "crowbar" );
|
||||
}
|
||||
|
||||
BOOL CJihad::CanHolster( void )
|
||||
{
|
||||
// can only holster hand grenades when not primed!
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CJihad::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
}
|
||||
|
||||
void CJihad::PrimaryAttack()
|
||||
{
|
||||
if ((lolalo == TRUE) && (gpGlobals->time > timeouttemp))
|
||||
{
|
||||
//Waited too long, reset the lolalo
|
||||
lolalo = FALSE;
|
||||
}
|
||||
|
||||
if ((lolalo == TRUE) && (gpGlobals->time < timeouttemp))
|
||||
{
|
||||
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
|
||||
Vector vecThrow = gpGlobals->v_forward * 500 + m_pPlayer->pev->velocity;
|
||||
SendWeaponAnim( JIHAD_SHOOT3 );
|
||||
lolalo = FALSE;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 2;
|
||||
#ifdef CLIENT_DLL
|
||||
//Genuflect
|
||||
#else
|
||||
ExplosionCreate( m_pPlayer->Center(), m_pPlayer->pev->angles, m_pPlayer->edict(), 1080, TRUE ); // BOOM!
|
||||
#endif
|
||||
//CGrenade::ShootJihad( m_pPlayer->pev, vecSrc, vecThrow, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( JIHAD_SHOOT3 );
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/jihad.wav", 1.0, ATTN_NORM);
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; // You shouldnt last this long for a next attack, in the old patch
|
||||
timeouttemp = gpGlobals->time + timeout;
|
||||
lolalo = TRUE;
|
||||
//return; //Don't wanna blow up just yet.
|
||||
}
|
||||
}
|
||||
void CJihad::WeaponIdle( void )
|
||||
{
|
||||
int iAnim;
|
||||
iAnim = JIHAD_IDLE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
|
||||
|
||||
SendWeaponAnim( iAnim );
|
||||
}
|
|
@ -0,0 +1,519 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD )
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
#define HORN_AIR_VELOCITY 1800
|
||||
#define HORN_WATER_VELOCITY 1600
|
||||
|
||||
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
||||
//
|
||||
// OVERLOADS SOME ENTVARS:
|
||||
//
|
||||
// speed - the ideal magnitude of my velocity
|
||||
class CModmanHorn : public CBaseEntity
|
||||
{
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
int Classify ( void );
|
||||
void EXPORT BubbleThink( void );
|
||||
void EXPORT HornTouch( CBaseEntity *pOther );
|
||||
void EXPORT ExplodeThink( void );
|
||||
|
||||
int m_iTrail;
|
||||
|
||||
public:
|
||||
static CModmanHorn *HornCreate( void );
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( modman_bolt, CModmanHorn );
|
||||
|
||||
CModmanHorn *CModmanHorn::HornCreate( void )
|
||||
{
|
||||
// Create a new entity with CModmanHorn private data
|
||||
CModmanHorn *pHorn = GetClassPtr( (CModmanHorn *)NULL );
|
||||
pHorn->pev->classname = MAKE_STRING("bolt");
|
||||
pHorn->Spawn();
|
||||
|
||||
return pHorn;
|
||||
}
|
||||
|
||||
void CModmanHorn::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
pev->gravity = 0.5;
|
||||
|
||||
SET_MODEL(ENT(pev), "models/modman_bolt.mdl");
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
|
||||
|
||||
SetTouch( &CModmanHorn::HornTouch );
|
||||
SetThink( &CModmanHorn::BubbleThink );
|
||||
pev->nextthink = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
|
||||
void CModmanHorn::Precache( )
|
||||
{
|
||||
PRECACHE_MODEL ("models/modman_bolt.mdl");
|
||||
PRECACHE_SOUND("weapons/xbow_hitbod1.wav");
|
||||
PRECACHE_SOUND("weapons/xbow_hitbod2.wav");
|
||||
PRECACHE_SOUND("weapons/mman_fire1.wav");
|
||||
PRECACHE_SOUND("weapons/mman_hit1.wav");
|
||||
PRECACHE_SOUND("fvox/beep.wav");
|
||||
m_iTrail = PRECACHE_MODEL("sprites/streak.spr");
|
||||
}
|
||||
|
||||
|
||||
int CModmanHorn :: Classify ( void )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
|
||||
void CModmanHorn::HornTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
if (pOther->pev->takedamage)
|
||||
{
|
||||
TraceResult tr = UTIL_GetGlobalTrace( );
|
||||
entvars_t *pevOwner;
|
||||
|
||||
pevOwner = VARS( pev->owner );
|
||||
|
||||
// UNDONE: this needs to call TraceAttack instead
|
||||
ClearMultiDamage( );
|
||||
|
||||
if ( pOther->IsPlayer() )
|
||||
{
|
||||
pOther->TraceAttack(pevOwner, gSkillData.plrDmgModmanClient, pev->velocity.Normalize(), &tr, DMG_NEVERGIB );
|
||||
}
|
||||
else
|
||||
{
|
||||
pOther->TraceAttack(pevOwner, gSkillData.plrDmgModmanMonster, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_NEVERGIB );
|
||||
}
|
||||
|
||||
ApplyMultiDamage( pev, pevOwner );
|
||||
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
// play body "thwack" sound
|
||||
switch( RANDOM_LONG(0,1) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM); break;
|
||||
case 1:
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM); break;
|
||||
}
|
||||
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
Killed( pev, GIB_NEVER );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(pev), CHAN_BODY, "weapons/mman_hit1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 98 + RANDOM_LONG(0,7));
|
||||
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
|
||||
|
||||
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
{
|
||||
// if what we hit is static architecture, can stay around for a while.
|
||||
Vector vecDir = pev->velocity.Normalize( );
|
||||
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
|
||||
pev->angles = UTIL_VecToAngles( vecDir );
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
pev->avelocity.z = 0;
|
||||
pev->angles.z = RANDOM_LONG(0,360);
|
||||
pev->nextthink = gpGlobals->time + 10.0;
|
||||
}
|
||||
|
||||
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
|
||||
{
|
||||
UTIL_Sparks( pev->origin );
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
SetThink( &CModmanHorn::ExplodeThink );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
void CModmanHorn::BubbleThink( void )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if (pev->waterlevel == 0)
|
||||
return;
|
||||
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 1 );
|
||||
}
|
||||
|
||||
void CModmanHorn::ExplodeThink( void )
|
||||
{
|
||||
int iContents = UTIL_PointContents ( pev->origin );
|
||||
int iScale;
|
||||
|
||||
pev->dmg = 40;
|
||||
iScale = 10;
|
||||
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_EXPLOSION);
|
||||
WRITE_COORD( pev->origin.x );
|
||||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
if (iContents != CONTENTS_WATER)
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexFireball );
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexWExplosion );
|
||||
}
|
||||
WRITE_BYTE( iScale ); // scale * 10
|
||||
WRITE_BYTE( 15 ); // framerate
|
||||
WRITE_BYTE( TE_EXPLFLAG_NONE );
|
||||
MESSAGE_END();
|
||||
|
||||
entvars_t *pevOwner;
|
||||
|
||||
if ( pev->owner )
|
||||
pevOwner = VARS( pev->owner );
|
||||
else
|
||||
pevOwner = NULL;
|
||||
|
||||
pev->owner = NULL; // can't traceline attack owner if this is set
|
||||
|
||||
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
|
||||
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum modman_e {
|
||||
CROSSBOW_IDLE1 = 0, // full
|
||||
CROSSBOW_IDLE2, // empty
|
||||
CROSSBOW_FIDGET1, // full
|
||||
CROSSBOW_FIDGET2, // empty
|
||||
CROSSBOW_FIRE1, // full
|
||||
CROSSBOW_FIRE2, // reload
|
||||
CROSSBOW_FIRE3, // empty
|
||||
CROSSBOW_RELOAD, // from empty
|
||||
CROSSBOW_DRAW1, // full
|
||||
CROSSBOW_DRAW2, // empty
|
||||
CROSSBOW_HOLSTER1, // full
|
||||
CROSSBOW_HOLSTER2, // empty
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_modman, CModman );
|
||||
LINK_ENTITY_TO_CLASS( weapon_crossbow, CModman );
|
||||
LINK_ENTITY_TO_CLASS( ammo_crossbow, CModman );
|
||||
|
||||
void CModman::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_MODMAN;
|
||||
SET_MODEL(ENT(pev), "models/w_modman.mdl");
|
||||
|
||||
m_iDefaultAmmo = CROSSBOW_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
int CModman::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CModman::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_modman.mdl");
|
||||
PRECACHE_MODEL("models/v_modman.mdl");
|
||||
PRECACHE_MODEL("models/p_modman.mdl");
|
||||
|
||||
PRECACHE_SOUND("weapons/xbow_fire1.wav");
|
||||
PRECACHE_SOUND("weapons/xbow_reload1.wav");
|
||||
|
||||
UTIL_PrecacheOther( "modman_bolt" );
|
||||
|
||||
m_usModman = PRECACHE_EVENT( 1, "events/modman.sc" );
|
||||
m_usModman2 = PRECACHE_EVENT( 1, "events/modman2.sc" );
|
||||
}
|
||||
|
||||
|
||||
int CModman::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "horns";
|
||||
p->iMaxAmmo1 = BOW_MAX_CARRY;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = CROSSBOW_MAX_CLIP;
|
||||
p->iSlot = 1;
|
||||
p->iPosition = 4;
|
||||
p->iId = WEAPON_MODMAN;
|
||||
p->iFlags = 0;
|
||||
p->iWeight = CROSSBOW_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CModman::Deploy( )
|
||||
{
|
||||
if (m_iClip)
|
||||
return DefaultDeploy( "models/v_modman.mdl", "models/p_modman.mdl", CROSSBOW_DRAW1, "rpg" );
|
||||
return DefaultDeploy( "models/v_modman.mdl", "models/p_modman.mdl", CROSSBOW_DRAW2, "rpg" );
|
||||
}
|
||||
|
||||
void CModman::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_fInReload = FALSE;// cancel any reload in progress.
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
if (m_iClip)
|
||||
SendWeaponAnim( CROSSBOW_HOLSTER1 );
|
||||
else
|
||||
SendWeaponAnim( CROSSBOW_HOLSTER2 );
|
||||
}
|
||||
|
||||
void CModman::PrimaryAttack( void )
|
||||
{
|
||||
|
||||
/*#ifdef CLIENT_DLL
|
||||
if ( bIsMultiplayer() )
|
||||
#else
|
||||
if (g_pGameRules->IsMultiplayer())
|
||||
#endif
|
||||
{
|
||||
FireSniperHorn();
|
||||
return;
|
||||
}*/
|
||||
|
||||
FireHorn();
|
||||
}
|
||||
|
||||
// this function only gets called in multiplayer
|
||||
void CModman::FireSniperHorn()
|
||||
{
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
TraceResult tr;
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
|
||||
m_iClip--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usModman2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecSrc + vecDir * 8192, dont_ignore_monsters, m_pPlayer->edict(), &tr);
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( tr.pHit->v.takedamage )
|
||||
{
|
||||
ClearMultiDamage( );
|
||||
CBaseEntity::Instance(tr.pHit)->TraceAttack(m_pPlayer->pev, 120, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB );
|
||||
ApplyMultiDamage( pev, m_pPlayer->pev );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CModman::FireHorn()
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
|
||||
|
||||
m_iClip--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usModman, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
|
||||
anglesAim.x = -anglesAim.x;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CModmanHorn *pHorn = CModmanHorn::HornCreate();
|
||||
pHorn->pev->origin = vecSrc;
|
||||
pHorn->pev->angles = anglesAim;
|
||||
pHorn->pev->owner = m_pPlayer->edict();
|
||||
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
pHorn->pev->velocity = vecDir * HORN_WATER_VELOCITY;
|
||||
pHorn->pev->speed = HORN_WATER_VELOCITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
pHorn->pev->velocity = vecDir * HORN_AIR_VELOCITY;
|
||||
pHorn->pev->speed = HORN_AIR_VELOCITY;
|
||||
}
|
||||
pHorn->pev->avelocity.z = 10;
|
||||
#endif
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip != 0)
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
|
||||
else
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
|
||||
}
|
||||
|
||||
void CModman::Reload( void )
|
||||
{
|
||||
|
||||
if ( DefaultReload( 5, CROSSBOW_RELOAD, 4.5 ) )
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CModman::WeaponIdle( void )
|
||||
{
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM
|
||||
|
||||
ResetEmptySound( );
|
||||
|
||||
if ( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if (flRand <= 0.75)
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( CROSSBOW_IDLE1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( CROSSBOW_IDLE2 );
|
||||
}
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( CROSSBOW_FIDGET1 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( CROSSBOW_FIDGET2 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CModmanAmmo : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_weaponbox.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_weaponbox.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
if (pOther->GiveAmmo( AMMO_CROSSBOWCLIP_GIVE, "horns", BOW_MAX_CARRY ) != -1)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_modman, CModmanAmmo );
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,361 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// monhunt_gamerules.cpp
|
||||
//
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "voice_gamemgr.h"
|
||||
#include "monhunt_gamerules.h"
|
||||
#include "game.h"
|
||||
//#include "mp3.h"
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgPlayMP3; //AJH - Killars MP3player
|
||||
extern int gmsgDeathMsg;
|
||||
|
||||
extern cvar_t timeleft, fragsleft;
|
||||
|
||||
extern cvar_t mp_chattime;
|
||||
|
||||
void CMonsterplay::Think( void )
|
||||
{
|
||||
// longest the intermission can last, in seconds
|
||||
#define MAX_INTERMISSION_TIME 120
|
||||
CVoiceGameMgr g_VoiceGameMgr;
|
||||
float g_flIntermissionStartTime = 0;
|
||||
|
||||
g_VoiceGameMgr.Update(gpGlobals->frametime);
|
||||
|
||||
///// Check game rules /////
|
||||
static int last_frags;
|
||||
static int last_time;
|
||||
|
||||
int frags_remaining = 0;
|
||||
int time_remaining = 0;
|
||||
|
||||
int ltime = 0; //Check to see if the times have changed
|
||||
|
||||
if ( g_fGameOver ) // someone else quit the game already
|
||||
{
|
||||
// bounds check
|
||||
int time = (int)CVAR_GET_FLOAT( "mp_chattime" );
|
||||
if ( time < 1 )
|
||||
CVAR_SET_STRING( "mp_chattime", "1" );
|
||||
else if ( time > MAX_INTERMISSION_TIME )
|
||||
CVAR_SET_STRING( "mp_chattime", UTIL_dtos1( MAX_INTERMISSION_TIME ) );
|
||||
|
||||
m_flIntermissionEndTime = g_flIntermissionStartTime + mp_chattime.value;
|
||||
|
||||
// check to see if we should change levels now
|
||||
if ( m_flIntermissionEndTime < gpGlobals->time )
|
||||
{
|
||||
if ( m_iEndIntermissionButtonHit // check that someone has pressed a key, or the max intermission time is over
|
||||
|| ( ( g_flIntermissionStartTime + MAX_INTERMISSION_TIME ) < gpGlobals->time) )
|
||||
ChangeLevel(); // intermission is over
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
float flTimeLimit = timelimit.value * 60;
|
||||
float flFragLimit = fraglimit.value;
|
||||
|
||||
time_remaining = (int)(flTimeLimit ? ( flTimeLimit - gpGlobals->time ) : 0);
|
||||
|
||||
if ( flTimeLimit != 0 && gpGlobals->time >= flTimeLimit )
|
||||
{
|
||||
GoToIntermission();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( flFragLimit )
|
||||
{
|
||||
int bestfrags = 9999;
|
||||
int remain;
|
||||
|
||||
// check if any player is over the frag limit
|
||||
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *pPlayer = UTIL_PlayerByIndex( i );
|
||||
|
||||
if ( pPlayer && pPlayer->pev->frags >= flFragLimit )
|
||||
{
|
||||
GoToIntermission();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( pPlayer )
|
||||
{
|
||||
remain = flFragLimit - pPlayer->pev->frags;
|
||||
if ( remain < bestfrags )
|
||||
{
|
||||
bestfrags = remain;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
frags_remaining = bestfrags;
|
||||
}
|
||||
|
||||
// Updates when frags change
|
||||
if ( frags_remaining != last_frags )
|
||||
{
|
||||
g_engfuncs.pfnCvar_DirectSet( &fragsleft, UTIL_VarArgs( "%i", frags_remaining ) );
|
||||
}
|
||||
|
||||
// Updates once per second
|
||||
if ( timeleft.value != last_time )
|
||||
{
|
||||
g_engfuncs.pfnCvar_DirectSet( &timeleft, UTIL_VarArgs( "%i", time_remaining ) );
|
||||
}
|
||||
|
||||
last_frags = frags_remaining;
|
||||
last_time = time_remaining;
|
||||
|
||||
//fMonHuntNextSpawn = gpGlobals->time + 6;
|
||||
|
||||
/*if (bMonsterCheck < 1)
|
||||
{
|
||||
CBaseEntity *pMonsterCheck;
|
||||
pMonsterCheck = UTIL_FindEntityByClassname(NULL, "monstermaker");
|
||||
if ( !FNullEnt( pMonsterCheck->edict() ))
|
||||
bMonsterMakers = true;
|
||||
|
||||
fMonHuntNextSpawn = gpGlobals->time + 6;
|
||||
UTIL_SayTextAllHS( "MONSTER CHECKED" );
|
||||
bMonsterCheck = 1;
|
||||
}*/
|
||||
|
||||
//If there is no Monster Makers.
|
||||
//if (/*!bMonsterMakers && (*/gpGlobals->time > fMonHuntNextSpawn/*)*/)
|
||||
/*{
|
||||
CBaseEntity *pMonsterSpawner;
|
||||
pMonsterSpawner = UTIL_FindEntityByClassname(NULL, "info_player_deathmatch");
|
||||
|
||||
CBaseEntity *pMonster = CBaseEntity::Create("monster_barney", pMonsterSpawner->pev->origin, pMonsterSpawner->pev->angles);
|
||||
|
||||
UTIL_SayTextAllHS( "CALLED" );
|
||||
|
||||
fMonHuntNextSpawn = gpGlobals->time + 6; //TODO: CVAR SET FUCK
|
||||
}*/
|
||||
|
||||
//if ( RANDOM_LONG(0,10) > 9)
|
||||
//{
|
||||
// CBaseEntity *pMonsterSpawner;
|
||||
|
||||
// for ( int i = RANDOM_LONG(1,5); i > 0; i-- )
|
||||
// pMonsterSpawner = UTIL_FindEntityByClassname(NULL, "info_player_deathmatch");
|
||||
|
||||
// CBaseEntity *pMonster = CBaseEntity::Create("monster_barney", pMonsterSpawner->pev->origin, pMonsterSpawner->pev->angles);
|
||||
|
||||
// UTIL_SayTextAllHS( "CALLED" );
|
||||
|
||||
// fMonHuntNextSpawn = gpGlobals->time + 6; //TODO: CVAR SET FUCK
|
||||
//}
|
||||
}
|
||||
|
||||
CMonsterplay :: CMonsterplay()
|
||||
{
|
||||
//Genuflect
|
||||
}
|
||||
|
||||
BOOL CMonsterplay::IsMonster()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CMonsterplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
//entvars_t *pev = &pEntity->v;
|
||||
|
||||
// CBasePlayer *pPlayer;
|
||||
|
||||
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_fotn" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_shotgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_buckshot" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_ARgrenades" );
|
||||
pPlayer->GiveNamedItem( "weapon_handgrenade" );
|
||||
pPlayer->GiveNamedItem( "weapon_tripmine" );
|
||||
pPlayer->GiveNamedItem( "weapon_rpg" );
|
||||
pPlayer->GiveNamedItem( "ammo_rpgclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_satchel" );
|
||||
pPlayer->GiveNamedItem( "weapon_snark" );
|
||||
pPlayer->GiveNamedItem( "weapon_soda" );
|
||||
pPlayer->GiveNamedItem( "weapon_dosh" );
|
||||
pPlayer->GiveNamedItem( "weapon_beamkatana" );
|
||||
pPlayer->GiveNamedItem( "weapon_ak47" );
|
||||
pPlayer->GiveNamedItem( "weapon_bow" );
|
||||
pPlayer->GiveNamedItem( "weapon_jason" );
|
||||
pPlayer->GiveNamedItem( "weapon_jihad" );
|
||||
pPlayer->GiveNamedItem( "weapon_jackal" );
|
||||
pPlayer->GiveNamedItem( "weapon_nstar" );
|
||||
pPlayer->GiveNamedItem( "weapon_mw2" );
|
||||
pPlayer->GiveNamedItem( "weapon_zapper" );
|
||||
pPlayer->GiveNamedItem( "weapon_goldengun" );
|
||||
pPlayer->GiveNamedItem( "weapon_boombox" );
|
||||
pPlayer->GiveNamedItem( "weapon_scientist" );
|
||||
pPlayer->GiveNamedItem( "weapon_modman" );
|
||||
}
|
||||
}
|
||||
|
||||
void CMonsterplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
CBaseEntity *pKira = CBaseEntity::Instance(pKiller);
|
||||
|
||||
if (pKira->Classify() != CLASS_PLAYER && pKira->pev->flags & FL_MONSTER)
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
|
||||
WRITE_BYTE( -1 ); // the killer
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); // the victim
|
||||
WRITE_STRING( PrepareMonsterName( STRING(pKiller->classname) ) ); // what they were killed by (should this be a string?)
|
||||
MESSAGE_END();
|
||||
|
||||
pVictim->m_iDeaths += 1;
|
||||
|
||||
// update the scores
|
||||
// killed scores
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
|
||||
WRITE_SHORT( pVictim->pev->frags );
|
||||
WRITE_SHORT( pVictim->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( GetTeamIndex( pVictim->m_szTeamName ) + 1 );
|
||||
WRITE_SHORT( pVictim->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
}
|
||||
else
|
||||
return CHalfLifeMultiplay::PlayerKilled(pVictim, pKiller, pInflictor);
|
||||
}
|
||||
|
||||
int CMonsterplay::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
|
||||
{
|
||||
if ( !pPlayer || !pTarget || !pTarget->IsPlayer() )
|
||||
return GR_NOTTEAMMATE;
|
||||
|
||||
// monster hunt has only teammates
|
||||
return GR_TEAMMATE;
|
||||
}
|
||||
|
||||
BOOL CMonsterplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker )
|
||||
{
|
||||
if ( pAttacker && PlayerRelationship( pPlayer, pAttacker ) == GR_TEAMMATE )
|
||||
{
|
||||
// my teammate hit me.
|
||||
if ( (friendlyfire.value == 0) && (pAttacker != pPlayer) )
|
||||
{
|
||||
// friendly fire is off, and this hit came from someone other than myself, then don't get hurt
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return CHalfLifeMultiplay::FPlayerCanTakeDamage( pPlayer, pAttacker );
|
||||
}
|
||||
|
||||
BOOL CMonsterplay::FAllowMonsters( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CMonsterplay::iKillforMonster(const char *classname)
|
||||
{
|
||||
if ( !strcmp( classname, "Gay Glenn" ) )
|
||||
return 1;
|
||||
else if ( !strcmp( classname, "Barney" ) )
|
||||
return 2;
|
||||
else if ( !strcmp( classname, "X-Mas Tree" ) )
|
||||
return 5;
|
||||
else if ( !strcmp( classname, "Scientist" ) )
|
||||
return 1;
|
||||
else if ( !strcmp( classname, "Sinistar" ) )
|
||||
return 3;
|
||||
else if ( !strcmp( classname, "Chris-Chan" ) )
|
||||
return 0;
|
||||
else if ( !strcmp( classname, "Zombie" ) )
|
||||
return 2;
|
||||
else if ( !strcmp( classname, "snark" ) )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
//What for? To strip "monster_" and give it a proper name.
|
||||
const char *CMonsterplay::PrepareMonsterName( const char *monster_name )
|
||||
{
|
||||
// Hack to fix name change
|
||||
char *gayglenn = "Gay Glenn";
|
||||
char *barney = "Barney";
|
||||
char *scientist = "Scientist";
|
||||
char *xmast = "X-Mas Tree";
|
||||
char *sinistar = "Sinistar";
|
||||
char *cwc = "Chris-Chan";
|
||||
char *zombie = "Zombie";
|
||||
char *controller = "Alien Controller";
|
||||
char *bullsquid = "Bull Squid";
|
||||
char *grinman = "Grinman";
|
||||
|
||||
monster_name += 8;
|
||||
|
||||
// replace the code names with the 'real' names
|
||||
if ( !strcmp( monster_name, "gay" ) )
|
||||
monster_name = gayglenn;
|
||||
else if ( !strcmp( monster_name, "barney" ) )
|
||||
monster_name = barney;
|
||||
else if ( !strcmp( monster_name, "xmast" ) )
|
||||
monster_name = xmast;
|
||||
else if ( !strcmp( monster_name, "scientist" ) )
|
||||
monster_name = scientist;
|
||||
else if ( !strcmp( monster_name, "sinistar" ) )
|
||||
monster_name = sinistar;
|
||||
else if ( !strcmp( monster_name, "chrischan" ) )
|
||||
monster_name = cwc;
|
||||
else if ( !strcmp( monster_name, "zombie" ) )
|
||||
monster_name = zombie;
|
||||
else if ( !strcmp( monster_name, "alien_controller") )
|
||||
monster_name = controller;
|
||||
else if ( !strcmp( monster_name, "bullsquid") )
|
||||
monster_name = bullsquid;
|
||||
else if ( !strcmp( monster_name, "grinman") )
|
||||
monster_name = grinman;
|
||||
|
||||
return monster_name;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// Monster_gamerules.h
|
||||
//
|
||||
|
||||
class CMonsterplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CMonsterplay();
|
||||
virtual void Think( void );
|
||||
virtual const char *GetGameDescription( void ) { return "Monster Hunt Mode"; } // this is the game name that gets seen in the server browser
|
||||
virtual BOOL IsMonster( void );
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
|
||||
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
|
||||
|
||||
virtual BOOL FAllowMonsters( void );
|
||||
|
||||
float fMonHuntNextSpawn; //Next Time to spawn monsters in spawn points if there is none. Set by a CVAR.
|
||||
int bMonsterMakers; //If there is no MonsterMaker ents
|
||||
int bMonsterCheck; //Check for MonsterMaker ents
|
||||
|
||||
static int iKillforMonster( const char *classname );
|
||||
static const char *PrepareMonsterName( const char *monster_name );
|
||||
};
|
|
@ -0,0 +1,234 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "soundent.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
enum mw2_e
|
||||
{
|
||||
MW2_LONGIDLE = 0,
|
||||
MW2_IDLE1,
|
||||
MW2_GRENADE,
|
||||
MW2_RELOAD,
|
||||
MW2_DRAW,
|
||||
MW2_SHOOT1,
|
||||
MW2_SHOOT2,
|
||||
MW2_SHOOT3,
|
||||
MW2_DEPLOY,
|
||||
};
|
||||
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_mw2, CMW2 );
|
||||
LINK_ENTITY_TO_CLASS( weapon_gauss, CMW2 );
|
||||
LINK_ENTITY_TO_CLASS( ammo_gaussclip, CMW2 );
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
|
||||
void CMW2::Spawn( )
|
||||
{
|
||||
pev->classname = MAKE_STRING("weapon_mw2"); // hack to allow for old names
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_mw2.mdl");
|
||||
m_iId = WEAPON_MW2;
|
||||
|
||||
m_iDefaultAmmo = MW2_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CMW2::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_mw2.mdl");
|
||||
PRECACHE_MODEL("models/w_mw2.mdl");
|
||||
PRECACHE_MODEL("models/p_mw2.mdl");
|
||||
|
||||
m_iShell = PRECACHE_MODEL ("models/rshell.mdl");// brass shell
|
||||
|
||||
PRECACHE_SOUND("weapons/m4a1_clipin.wav");
|
||||
|
||||
PRECACHE_MODEL ("models/w_9mmclip.mdl");
|
||||
|
||||
PRECACHE_SOUND ("weapons/m4a1_unsil-1.wav");
|
||||
PRECACHE_SOUND ("weapons/m4a1_unsil-2.wav");
|
||||
|
||||
PRECACHE_SOUND ("weapons/m4a1_boltpull.wav");
|
||||
|
||||
m_usMW2 = PRECACHE_EVENT( 1, "events/mw2.sc" );
|
||||
}
|
||||
|
||||
int CMW2::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "mw2";
|
||||
p->iMaxAmmo1 = MW2_MAX_CARRY;
|
||||
p->iMaxClip = MW2_MAX_CLIP;
|
||||
p->iSlot = 2;
|
||||
p->iPosition = 3;
|
||||
p->iFlags = 0;
|
||||
p->iId = m_iId = WEAPON_MW2;
|
||||
p->iWeight = MW2_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CMW2::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CMW2::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_mw2.mdl", "models/p_mw2.mdl", MW2_DRAW, "mp5" );
|
||||
}
|
||||
|
||||
|
||||
void CMW2::PrimaryAttack()
|
||||
{
|
||||
// don't fire underwater
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iClip <= 0)
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = LOUD_GUN_VOLUME;
|
||||
m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH;
|
||||
|
||||
m_iClip--;
|
||||
|
||||
|
||||
m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH;
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( );
|
||||
Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
Vector vecDir;
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
if ( !bIsMultiplayer() )
|
||||
#else
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
#endif
|
||||
{
|
||||
// optimized multiplayer. Widened to make it easier to hit a moving player
|
||||
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_9DEGREES, 8192, BULLET_PLAYER_MW2, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed );
|
||||
}
|
||||
else
|
||||
{
|
||||
// single player spread
|
||||
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_MW2, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed );
|
||||
}
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
UTIL_ScreenShake( m_pPlayer->pev->origin, 250.0, 200.0, 2.5, 1 );
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMW2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
if ( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
|
||||
void CMW2::Reload( void )
|
||||
{
|
||||
DefaultReload( MW2_MAX_CLIP, MW2_RELOAD, 3.0 );
|
||||
}
|
||||
|
||||
|
||||
void CMW2::WeaponIdle( void )
|
||||
{
|
||||
ResetEmptySound( );
|
||||
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
|
||||
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
int iAnim;
|
||||
iAnim = MW2_IDLE1;
|
||||
|
||||
SendWeaponAnim( iAnim );
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CMW2AmmoClip : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_9mmclip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_9mmclip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
int bResult = (pOther->GiveAmmo( AMMO_MW2_GIVE, "mw2", MW2_MAX_CARRY) != -1);
|
||||
if (bResult)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_mw2, CMW2AmmoClip );
|
|
@ -0,0 +1,396 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD )
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
#define STAR_AIR_VELOCITY 1500
|
||||
#define STAR_WATER_VELOCITY 150
|
||||
|
||||
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
||||
//
|
||||
// OVERLOADS SOME ENTVARS:
|
||||
//
|
||||
// speed - the ideal magnitude of my velocity
|
||||
class CNinjaStar : public CBaseEntity
|
||||
{
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
int Classify ( void );
|
||||
void EXPORT BubbleThink( void );
|
||||
void EXPORT StarTouch( CBaseEntity *pOther );
|
||||
void EXPORT ExplodeThink( void );
|
||||
|
||||
int m_iTrail;
|
||||
|
||||
public:
|
||||
static CNinjaStar *StarCreate( void );
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ninja_star, CNinjaStar );
|
||||
|
||||
CNinjaStar *CNinjaStar::StarCreate( void )
|
||||
{
|
||||
// Create a new entity with CCrossbowBolt private data
|
||||
CNinjaStar *pStar = GetClassPtr( (CNinjaStar *)NULL );
|
||||
pStar->pev->classname = MAKE_STRING("star");
|
||||
pStar->Spawn();
|
||||
|
||||
return pStar;
|
||||
}
|
||||
|
||||
void CNinjaStar::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
pev->gravity = 0.5;
|
||||
|
||||
SET_MODEL(ENT(pev), "models/nstar.mdl");
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
|
||||
|
||||
SetTouch( &CNinjaStar::StarTouch );
|
||||
SetThink( &CNinjaStar::BubbleThink );
|
||||
pev->nextthink = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
|
||||
void CNinjaStar::Precache( )
|
||||
{
|
||||
PRECACHE_MODEL ("models/nstar.mdl");
|
||||
PRECACHE_SOUND("weapons/nstar_hitbod.wav");
|
||||
PRECACHE_SOUND("weapons/nstar_hit.wav");
|
||||
PRECACHE_SOUND("weapons/nstar_fire.wav");
|
||||
PRECACHE_SOUND("fvox/beep.wav");
|
||||
m_iTrail = PRECACHE_MODEL("sprites/streak.spr");
|
||||
}
|
||||
|
||||
|
||||
int CNinjaStar :: Classify ( void )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
|
||||
void CNinjaStar::StarTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
if (pOther->pev->takedamage)
|
||||
{
|
||||
TraceResult tr = UTIL_GetGlobalTrace( );
|
||||
entvars_t *pevOwner;
|
||||
|
||||
pevOwner = VARS( pev->owner );
|
||||
|
||||
// UNDONE: this needs to call TraceAttack instead
|
||||
ClearMultiDamage( );
|
||||
|
||||
pOther->TraceAttack(pevOwner, gSkillData.plrDmgStar, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_NEVERGIB );
|
||||
|
||||
ApplyMultiDamage( pev, pevOwner );
|
||||
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
// play body "errgh" sound
|
||||
EMIT_SOUND(ENT(pev), CHAN_BODY, "weapons/nstar_hitbod.wav", 1, ATTN_NORM);
|
||||
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
switch (RANDOM_LONG(1,2))
|
||||
{
|
||||
case 1:
|
||||
Killed( pev, GIB_ALWAYS ); // Victim is lucky to have a heart at this point
|
||||
break;
|
||||
case 2:
|
||||
Killed( pev, GIB_NEVER ); // Victim is lucky and keeps his organs in his corpse
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(pev), CHAN_BODY, "weapons/nstar_hit.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 98 + RANDOM_LONG(0,7));
|
||||
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
|
||||
|
||||
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
{
|
||||
// if what we hit is static architecture, can stay around for a while.
|
||||
Vector vecDir = pev->velocity.Normalize( );
|
||||
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
|
||||
pev->angles = UTIL_VecToAngles( vecDir );
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
pev->avelocity.z = 0;
|
||||
pev->angles.z = RANDOM_LONG(0,360);
|
||||
pev->nextthink = gpGlobals->time + 10.0;
|
||||
}
|
||||
|
||||
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
|
||||
{
|
||||
UTIL_Sparks( pev->origin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNinjaStar::BubbleThink( void )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if (pev->waterlevel == 0)
|
||||
return;
|
||||
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 20 );
|
||||
}
|
||||
|
||||
void CNinjaStar::ExplodeThink( void )
|
||||
{
|
||||
int iContents = UTIL_PointContents ( pev->origin );
|
||||
int iScale;
|
||||
|
||||
pev->dmg = 40;
|
||||
iScale = 10;
|
||||
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_EXPLOSION);
|
||||
WRITE_COORD( pev->origin.x );
|
||||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
if (iContents != CONTENTS_WATER)
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexFireball );
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexWExplosion );
|
||||
}
|
||||
WRITE_BYTE( iScale ); // scale * 10
|
||||
WRITE_BYTE( 15 ); // framerate
|
||||
WRITE_BYTE( TE_EXPLFLAG_NONE );
|
||||
MESSAGE_END();
|
||||
|
||||
entvars_t *pevOwner;
|
||||
|
||||
if ( pev->owner )
|
||||
pevOwner = VARS( pev->owner );
|
||||
else
|
||||
pevOwner = NULL;
|
||||
|
||||
pev->owner = NULL; // can't traceline attack owner if this is set
|
||||
|
||||
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
|
||||
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum star_e { // Do this!@
|
||||
NSTAR_IDLE = 0, // full
|
||||
NSTAR_FIRE, // full
|
||||
NSTAR_DRAW, // full
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_nstar, CNStar );
|
||||
|
||||
void CNStar::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_NSTAR;
|
||||
SET_MODEL(ENT(pev), "models/w_nstar.mdl");
|
||||
|
||||
m_iDefaultAmmo = NSTAR_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
int CNStar::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CNStar::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_nstar.mdl");
|
||||
PRECACHE_MODEL("models/v_nstar.mdl");
|
||||
PRECACHE_MODEL("models/p_nstar.mdl");
|
||||
|
||||
UTIL_PrecacheOther( "ninja_star" );
|
||||
|
||||
m_usNStar = PRECACHE_EVENT( 1, "events/nstar.sc" );
|
||||
}
|
||||
|
||||
|
||||
int CNStar::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "stars";
|
||||
p->iMaxAmmo1 = NSTAR_MAX_CARRY;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = NSTAR_MAX_CLIP;
|
||||
p->iSlot = 3;
|
||||
p->iPosition = 3;
|
||||
p->iId = WEAPON_NSTAR;
|
||||
p->iFlags = 0;
|
||||
p->iWeight = NSTAR_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CNStar::Deploy( )
|
||||
{
|
||||
return DefaultDeploy( "models/v_nstar.mdl", "models/p_nstar.mdl", NSTAR_DRAW, "nstar" );
|
||||
}
|
||||
|
||||
void CNStar::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_fInReload = FALSE;// cancel any reload in progress.
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
}
|
||||
|
||||
void CNStar::PrimaryAttack( void )
|
||||
{
|
||||
if (m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] > 0)
|
||||
{
|
||||
FireStar();
|
||||
}
|
||||
}
|
||||
|
||||
void CNStar::FireStar()
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
|
||||
|
||||
//m_iClip--;
|
||||
m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ]--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usNStar, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
|
||||
anglesAim.x = -anglesAim.x;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CNinjaStar *pStar = CNinjaStar::StarCreate();
|
||||
pStar->pev->origin = vecSrc;
|
||||
pStar->pev->angles = anglesAim;
|
||||
pStar->pev->owner = m_pPlayer->edict();
|
||||
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
pStar->pev->velocity = vecDir * STAR_WATER_VELOCITY;
|
||||
pStar->pev->speed = STAR_WATER_VELOCITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
pStar->pev->velocity = vecDir * STAR_AIR_VELOCITY;
|
||||
pStar->pev->speed = STAR_AIR_VELOCITY;
|
||||
}
|
||||
pStar->pev->avelocity.z = 10;
|
||||
#endif
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3;
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip != 0)
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
|
||||
else
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
|
||||
}
|
||||
|
||||
void CNStar::WeaponIdle( void )
|
||||
{
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM
|
||||
|
||||
ResetEmptySound( );
|
||||
|
||||
SendWeaponAnim( NSTAR_IDLE );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CNStarAmmo : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_nstar.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_nstar.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
if (pOther->GiveAmmo( 30, "stars", NSTAR_MAX_CARRY ) != -1)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_nstar, CNStarAmmo );
|
||||
|
||||
#endif
|
|
@ -0,0 +1,454 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD )
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
#define BOLT_AIR_VELOCITY 800
|
||||
#define BOLT_WATER_VELOCITY 450
|
||||
|
||||
extern cvar_t scipgvel;
|
||||
|
||||
int TestSpray;
|
||||
|
||||
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
|
||||
//
|
||||
// OVERLOADS SOME ENTVARS:
|
||||
//
|
||||
// speed - the ideal magnitude of my velocity
|
||||
class CSciPGBolt : public CBaseEntity
|
||||
{
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
int Classify ( void );
|
||||
void EXPORT BubbleThink( void );
|
||||
void EXPORT BoltTouch( CBaseEntity *pOther );
|
||||
void EXPORT ExplodeThink( void );
|
||||
void SprayTest( const Vector &position, const Vector &direction, int spriteModel, int count );
|
||||
|
||||
//int m_iTrail;
|
||||
|
||||
public:
|
||||
static CSciPGBolt *BoltCreate( void );
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( scientist_bolt, CSciPGBolt );
|
||||
|
||||
CSciPGBolt *CSciPGBolt::BoltCreate( void )
|
||||
{
|
||||
// Create a new entity with CCrossbowBolt private data
|
||||
CSciPGBolt *pBolt = GetClassPtr( (CSciPGBolt *)NULL );
|
||||
pBolt->pev->classname = MAKE_STRING("scibolt");
|
||||
pBolt->Spawn();
|
||||
|
||||
return pBolt;
|
||||
}
|
||||
|
||||
void CSciPGBolt::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
pev->movetype = MOVETYPE_FLY;
|
||||
pev->solid = SOLID_BBOX;
|
||||
|
||||
pev->gravity = 0.5;
|
||||
|
||||
SET_MODEL( ENT(pev), "models/sci_rocket.mdl");
|
||||
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/sci_scream.wav", 1, ATTN_NORM );
|
||||
|
||||
UTIL_SetOrigin( pev, pev->origin );
|
||||
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
|
||||
|
||||
SetTouch( &CSciPGBolt::BoltTouch );
|
||||
SetThink( &CSciPGBolt::BubbleThink );
|
||||
pev->nextthink = gpGlobals->time + 0.2;
|
||||
}
|
||||
|
||||
|
||||
void CSciPGBolt::Precache( )
|
||||
{
|
||||
PRECACHE_MODEL("models/sci_rocket.mdl");
|
||||
PRECACHE_SOUND("weapons/sci_scream.wav");
|
||||
PRECACHE_SOUND("misc/kill.wav");
|
||||
TestSpray = PRECACHE_MODEL("sprites/spinning_coin.spr");// client side spittle of mario coins!
|
||||
}
|
||||
|
||||
|
||||
int CSciPGBolt :: Classify ( void )
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
|
||||
void CSciPGBolt::BoltTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
if (pOther->pev->takedamage)
|
||||
{
|
||||
TraceResult tr = UTIL_GetGlobalTrace( );
|
||||
entvars_t *pevOwner;
|
||||
|
||||
pevOwner = VARS( pev->owner );
|
||||
|
||||
// UNDONE: this needs to call TraceAttack instead
|
||||
ClearMultiDamage( );
|
||||
|
||||
pOther->TraceAttack(pevOwner, gSkillData.plrDmgBow, pev->velocity.Normalize(), &tr, DMG_BULLET | DMG_ALWAYSGIB );
|
||||
|
||||
ApplyMultiDamage( pev, pevOwner );
|
||||
|
||||
pev->velocity = Vector( 0, 0, 0 );
|
||||
|
||||
if ( !g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
Killed( pev, GIB_ALWAYS ); //Smokey ;D
|
||||
}
|
||||
STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/sci_scream.wav" ); //Often times this works on certain maps, others not. Fix this if you want -- GOAHEAD
|
||||
SetThink( &CSciPGBolt::ExplodeThink );
|
||||
SprayTest( pev->origin, Vector(0,0,1), TestSpray, 24 );
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
SetThink( &CSciPGBolt::ExplodeThink );
|
||||
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
|
||||
|
||||
if ( FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
{
|
||||
// if what we hit is static architecture, can stay around for a while.
|
||||
STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/sci_scream.wav" );
|
||||
SetThink( &CSciPGBolt::ExplodeThink );
|
||||
SprayTest( pev->origin, Vector(0,0,1), TestSpray, 24 );
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
}
|
||||
|
||||
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
|
||||
{
|
||||
STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/sci_scream.wav" );
|
||||
SetThink( &CSciPGBolt::ExplodeThink );
|
||||
SprayTest( pev->origin, Vector(0,0,1), TestSpray, 24 );
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSciPGBolt::SprayTest( const Vector &position, const Vector &direction, int spriteModel, int count )
|
||||
{
|
||||
EMIT_SOUND( ENT(pev), CHAN_VOICE, "misc/kill.wav", 1, ATTN_NORM );
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, position );
|
||||
WRITE_BYTE( TE_SPRITE_SPRAY );
|
||||
WRITE_COORD( position.x); // pos
|
||||
WRITE_COORD( position.y);
|
||||
WRITE_COORD( position.z);
|
||||
WRITE_COORD( direction.x); // dir
|
||||
WRITE_COORD( direction.y);
|
||||
WRITE_COORD( direction.z);
|
||||
WRITE_SHORT( spriteModel ); // model
|
||||
WRITE_BYTE ( count ); // count
|
||||
WRITE_BYTE ( 130 ); // speed
|
||||
WRITE_BYTE ( 80 ); // noise ( client will divide by 100 )
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
void CSciPGBolt::BubbleThink( void )
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
if (pev->waterlevel == 0)
|
||||
return;
|
||||
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 20 );
|
||||
}
|
||||
|
||||
void CSciPGBolt::ExplodeThink( void )
|
||||
{
|
||||
int iContents = UTIL_PointContents ( pev->origin );
|
||||
int iScale;
|
||||
|
||||
pev->dmg = 40;
|
||||
iScale = 10;
|
||||
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
|
||||
WRITE_BYTE( TE_EXPLOSION);
|
||||
WRITE_COORD( pev->origin.x );
|
||||
WRITE_COORD( pev->origin.y );
|
||||
WRITE_COORD( pev->origin.z );
|
||||
if (iContents != CONTENTS_WATER)
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexFireball );
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE_SHORT( g_sModelIndexWExplosion );
|
||||
}
|
||||
WRITE_BYTE( iScale ); // scale * 10
|
||||
WRITE_BYTE( 15 ); // framerate
|
||||
WRITE_BYTE( TE_EXPLFLAG_NONE );
|
||||
MESSAGE_END();
|
||||
|
||||
entvars_t *pevOwner;
|
||||
|
||||
if ( pev->owner )
|
||||
pevOwner = VARS( pev->owner );
|
||||
else
|
||||
pevOwner = NULL;
|
||||
|
||||
pev->owner = NULL; // can't traceline attack owner if this is set
|
||||
|
||||
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
|
||||
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum sci_e {
|
||||
RPG_IDLE = 0,
|
||||
RPG_FIDGET,
|
||||
RPG_RELOAD, // to reload
|
||||
RPG_FIRE2, // to empty
|
||||
RPG_HOLSTER1, // loaded
|
||||
RPG_DRAW1, // loaded
|
||||
RPG_HOLSTER2, // unloaded
|
||||
RPG_DRAW_UL, // unloaded
|
||||
RPG_IDLE_UL, // unloaded idle
|
||||
RPG_FIDGET_UL, // unloaded fidget
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_scientist, CSciPG );
|
||||
LINK_ENTITY_TO_CLASS( weapon_egon, CSciPG );
|
||||
|
||||
void CSciPG::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_SCIENTIST;
|
||||
SET_MODEL(ENT(pev), "models/w_rpg.mdl");
|
||||
|
||||
m_iDefaultAmmo = BOW_DEFAULT_GIVE;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
int CSciPG::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CSciPG::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/w_rpg.mdl");
|
||||
PRECACHE_MODEL("models/v_rpg.mdl");
|
||||
PRECACHE_MODEL("models/p_rpg.mdl");
|
||||
|
||||
UTIL_PrecacheOther( "scientist_bolt" );
|
||||
|
||||
m_usScientist = PRECACHE_EVENT( 1, "events/scientist.sc" );
|
||||
}
|
||||
|
||||
|
||||
int CSciPG::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "scientist";
|
||||
p->iMaxAmmo1 = BOW_MAX_CARRY;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = BOW_MAX_CLIP;
|
||||
p->iSlot = 3;
|
||||
p->iPosition = 2;
|
||||
p->iId = WEAPON_SCIENTIST;
|
||||
p->iFlags = 0;
|
||||
p->iWeight = CROWBAR_WEIGHT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CSciPG::Deploy( )
|
||||
{
|
||||
if (m_iClip)
|
||||
return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW1, "scientist" );
|
||||
return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW_UL, "scientist" );
|
||||
}
|
||||
|
||||
void CSciPG::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_fInReload = FALSE;// cancel any reload in progress.
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
if (m_iClip)
|
||||
SendWeaponAnim( RPG_HOLSTER1 );
|
||||
else
|
||||
SendWeaponAnim( RPG_HOLSTER2 );
|
||||
}
|
||||
|
||||
void CSciPG::PrimaryAttack( void )
|
||||
{
|
||||
FireBolt();
|
||||
}
|
||||
|
||||
void CSciPG::FireBolt()
|
||||
{
|
||||
TraceResult tr;
|
||||
|
||||
if (m_iClip == 0)
|
||||
{
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
|
||||
|
||||
//m_iClip--;
|
||||
m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ]--;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usScientist, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
|
||||
anglesAim.x = -anglesAim.x;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition( ) - gpGlobals->v_up * 2;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
CSciPGBolt *pBolt = CSciPGBolt::BoltCreate();
|
||||
pBolt->pev->origin = vecSrc;
|
||||
pBolt->pev->angles = anglesAim;
|
||||
pBolt->pev->owner = m_pPlayer->edict();
|
||||
|
||||
if (m_pPlayer->pev->waterlevel == 3)
|
||||
{
|
||||
pBolt->pev->velocity = vecDir * BOLT_WATER_VELOCITY;
|
||||
pBolt->pev->speed = BOLT_WATER_VELOCITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_pGameRules->IsTest())
|
||||
{
|
||||
pBolt->pev->velocity = vecDir * scipgvel.value;
|
||||
pBolt->pev->speed = scipgvel.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBolt->pev->velocity = vecDir * BOLT_AIR_VELOCITY;
|
||||
pBolt->pev->speed = BOLT_AIR_VELOCITY;
|
||||
}
|
||||
}
|
||||
pBolt->pev->avelocity.z = 10;
|
||||
#endif
|
||||
|
||||
if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0);
|
||||
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
|
||||
if (m_iClip != 0)
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
|
||||
else
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
|
||||
}
|
||||
|
||||
void CSciPG::WeaponIdle( void )
|
||||
{
|
||||
m_pPlayer->GetAutoaimVector( AUTOAIM_2DEGREES ); // get the autoaim vector but ignore it; used for autoaim crosshair in DM
|
||||
|
||||
ResetEmptySound( );
|
||||
|
||||
if ( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if (flRand <= 0.75)
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( RPG_IDLE );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( RPG_IDLE_UL );
|
||||
}
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iClip)
|
||||
{
|
||||
SendWeaponAnim( RPG_FIDGET );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendWeaponAnim( RPG_FIDGET_UL );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class CSciPGAmmo : public CBasePlayerAmmo
|
||||
{
|
||||
void Spawn( void )
|
||||
{
|
||||
Precache( );
|
||||
SET_MODEL(ENT(pev), "models/w_bow_clip.mdl");
|
||||
CBasePlayerAmmo::Spawn( );
|
||||
}
|
||||
void Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL ("models/w_bow_clip.mdl");
|
||||
PRECACHE_SOUND("items/9mmclip1.wav");
|
||||
}
|
||||
BOOL AddAmmo( CBaseEntity *pOther )
|
||||
{
|
||||
if (pOther->GiveAmmo( 30, "scientist", BOW_MAX_CARRY ) != -1)
|
||||
{
|
||||
EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
};
|
||||
LINK_ENTITY_TO_CLASS( ammo_scientist, CSciPGAmmo );
|
||||
|
||||
#endif
|
|
@ -0,0 +1,685 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// teamplay_gamerules.cpp
|
||||
//
|
||||
|
||||
// Shyt play rules are as simple. Standard Templay
|
||||
// Until someone gets a kill, then they get kicked auotmatically for pissing off
|
||||
// the admin, which in this case is the code.
|
||||
// So when you get a kill, you are too good.
|
||||
// HF
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "shytplay_gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
static char team_names[MAX_TEAMS][MAX_TEAMNAME_LENGTH];
|
||||
static int team_scores[MAX_TEAMS];
|
||||
static int num_teams = 0;
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
|
||||
CHalfLifeShytplay :: CHalfLifeShytplay()
|
||||
{
|
||||
m_DisableDeathMessages = FALSE;
|
||||
m_DisableDeathPenalty = FALSE;
|
||||
|
||||
memset( team_names, 0, sizeof(team_names) );
|
||||
memset( team_scores, 0, sizeof(team_scores) );
|
||||
num_teams = 0;
|
||||
|
||||
// Copy over the team from the server config
|
||||
m_szTeamList[0] = 0;
|
||||
|
||||
// Cache this because the team code doesn't want to deal with changing this in the middle of a game
|
||||
strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH );
|
||||
|
||||
edict_t *pWorld = INDEXENT(0);
|
||||
if ( pWorld && pWorld->v.team )
|
||||
{
|
||||
if ( teamoverride.value )
|
||||
{
|
||||
const char *pTeamList = STRING(pWorld->v.team);
|
||||
if ( pTeamList && strlen(pTeamList) )
|
||||
{
|
||||
strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Has the server set teams
|
||||
if ( strlen( m_szTeamList ) )
|
||||
m_teamLimit = TRUE;
|
||||
else
|
||||
m_teamLimit = FALSE;
|
||||
|
||||
RecountTeams();
|
||||
}
|
||||
|
||||
extern cvar_t timeleft, fragsleft;
|
||||
|
||||
#include "voice_gamemgr.h"
|
||||
extern CVoiceGameMgr g_VoiceGameMgr;
|
||||
|
||||
void CHalfLifeShytplay :: Think ( void )
|
||||
{
|
||||
///// Check game rules /////
|
||||
static int last_frags;
|
||||
static int last_time;
|
||||
|
||||
int frags_remaining = 0;
|
||||
int time_remaining = 0;
|
||||
|
||||
g_VoiceGameMgr.Update(gpGlobals->frametime);
|
||||
|
||||
if ( g_fGameOver ) // someone else quit the game already
|
||||
{
|
||||
CHalfLifeMultiplay::Think();
|
||||
return;
|
||||
}
|
||||
|
||||
float flTimeLimit = CVAR_GET_FLOAT("mp_timelimit") * 60;
|
||||
|
||||
time_remaining = (int)(flTimeLimit ? ( flTimeLimit - gpGlobals->time ) : 0);
|
||||
|
||||
if ( flTimeLimit != 0 && gpGlobals->time >= flTimeLimit )
|
||||
{
|
||||
GoToIntermission();
|
||||
return;
|
||||
}
|
||||
|
||||
float flFragLimit = fraglimit.value;
|
||||
if ( flFragLimit )
|
||||
{
|
||||
int bestfrags = 9999;
|
||||
int remain;
|
||||
|
||||
// check if any team is over the frag limit
|
||||
for ( int i = 0; i < num_teams; i++ )
|
||||
{
|
||||
if ( team_scores[i] >= flFragLimit )
|
||||
{
|
||||
GoToIntermission();
|
||||
return;
|
||||
}
|
||||
|
||||
remain = flFragLimit - team_scores[i];
|
||||
if ( remain < bestfrags )
|
||||
{
|
||||
bestfrags = remain;
|
||||
}
|
||||
}
|
||||
frags_remaining = bestfrags;
|
||||
}
|
||||
|
||||
// Updates when frags change
|
||||
if ( frags_remaining != last_frags )
|
||||
{
|
||||
g_engfuncs.pfnCvar_DirectSet( &fragsleft, UTIL_VarArgs( "%i", frags_remaining ) );
|
||||
}
|
||||
|
||||
// Updates once per second
|
||||
if ( timeleft.value != last_time )
|
||||
{
|
||||
g_engfuncs.pfnCvar_DirectSet( &timeleft, UTIL_VarArgs( "%i", time_remaining ) );
|
||||
}
|
||||
|
||||
last_frags = frags_remaining;
|
||||
last_time = time_remaining;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// ClientCommand
|
||||
// the user has typed a command which is unrecognized by everything else;
|
||||
// this check to see if the gamerules knows anything about the command
|
||||
//=========================================================
|
||||
BOOL CHalfLifeShytplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
|
||||
{
|
||||
if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
|
||||
return TRUE;
|
||||
|
||||
if ( FStrEq( pcmd, "menuselect" ) )
|
||||
{
|
||||
if ( CMD_ARGC() < 2 )
|
||||
return TRUE;
|
||||
|
||||
int slot = atoi( CMD_ARGV(1) );
|
||||
|
||||
// select the item from the current menu
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern int gmsgGameMode;
|
||||
extern int gmsgSayText;
|
||||
extern int gmsgTeamInfo;
|
||||
extern int gmsgTeamNames;
|
||||
extern int gmsgScoreInfo;
|
||||
|
||||
void CHalfLifeShytplay :: UpdateGameMode( CBasePlayer *pPlayer )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
|
||||
WRITE_BYTE( 1 ); // game mode teamplay
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
|
||||
const char *CHalfLifeShytplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
|
||||
{
|
||||
// copy out the team name from the model
|
||||
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
|
||||
strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH );
|
||||
|
||||
RecountTeams();
|
||||
|
||||
// update the current player of the team he is joining
|
||||
if ( pPlayer->m_szTeamName[0] == '\0' || !IsValidTeam( pPlayer->m_szTeamName ) || defaultteam.value )
|
||||
{
|
||||
const char *pTeamName = NULL;
|
||||
|
||||
if ( defaultteam.value )
|
||||
{
|
||||
pTeamName = team_names[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
pTeamName = TeamWithFewestPlayers();
|
||||
}
|
||||
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
|
||||
}
|
||||
|
||||
return pPlayer->m_szTeamName;
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// InitHUD
|
||||
//=========================================================
|
||||
void CHalfLifeShytplay::InitHUD( CBasePlayer *pPlayer )
|
||||
{
|
||||
int i;
|
||||
|
||||
SetDefaultPlayerTeam( pPlayer );
|
||||
CHalfLifeMultiplay::InitHUD( pPlayer );
|
||||
|
||||
// Send down the team names
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() );
|
||||
WRITE_BYTE( num_teams );
|
||||
for ( i = 0; i < num_teams; i++ )
|
||||
{
|
||||
WRITE_STRING( team_names[ i ] );
|
||||
}
|
||||
MESSAGE_END();
|
||||
|
||||
RecountTeams();
|
||||
|
||||
char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
|
||||
// update the current player of the team he is joining
|
||||
char text[1024];
|
||||
if ( !strcmp( mdls, pPlayer->m_szTeamName ) )
|
||||
{
|
||||
sprintf( text, "* you are on team \'%s\'\n", pPlayer->m_szTeamName );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( text, "* assigned to team %s\n", pPlayer->m_szTeamName );
|
||||
}
|
||||
|
||||
ChangePlayerTeam( pPlayer, pPlayer->m_szTeamName, FALSE, FALSE );
|
||||
UTIL_SayText( text, pPlayer );
|
||||
int clientIndex = pPlayer->entindex();
|
||||
RecountTeams();
|
||||
// update this player with all the other players team info
|
||||
// loop through all active players and send their team info to the new client
|
||||
for ( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *plr = UTIL_PlayerByIndex( i );
|
||||
if ( plr && IsValidTeam( plr->TeamID() ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgTeamInfo, NULL, pPlayer->edict() );
|
||||
WRITE_BYTE( plr->entindex() );
|
||||
WRITE_STRING( plr->TeamID() );
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CHalfLifeShytplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib )
|
||||
{
|
||||
int damageFlags = DMG_GENERIC;
|
||||
int clientIndex = pPlayer->entindex();
|
||||
|
||||
if ( !bGib )
|
||||
{
|
||||
damageFlags |= DMG_NEVERGIB;
|
||||
}
|
||||
else
|
||||
{
|
||||
damageFlags |= DMG_ALWAYSGIB;
|
||||
}
|
||||
|
||||
if ( bKill )
|
||||
{
|
||||
// kill the player, remove a death, and let them start on the new team
|
||||
m_DisableDeathMessages = TRUE;
|
||||
m_DisableDeathPenalty = TRUE;
|
||||
|
||||
entvars_t *pevWorld = VARS( INDEXENT(0) );
|
||||
pPlayer->TakeDamage( pevWorld, pevWorld, 900, damageFlags );
|
||||
|
||||
m_DisableDeathMessages = FALSE;
|
||||
m_DisableDeathPenalty = FALSE;
|
||||
}
|
||||
|
||||
// copy out the team name from the model
|
||||
strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
|
||||
|
||||
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
|
||||
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
|
||||
|
||||
// notify everyone's HUD of the team change
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
|
||||
WRITE_BYTE( clientIndex );
|
||||
WRITE_STRING( pPlayer->m_szTeamName );
|
||||
MESSAGE_END();
|
||||
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
|
||||
WRITE_BYTE( clientIndex );
|
||||
WRITE_SHORT( pPlayer->pev->frags );
|
||||
WRITE_SHORT( pPlayer->m_iDeaths );
|
||||
WRITE_SHORT( 0 );
|
||||
WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
|
||||
WRITE_SHORT( pPlayer->m_fHSDev );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// ClientUserInfoChanged
|
||||
//=========================================================
|
||||
void CHalfLifeShytplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
|
||||
{
|
||||
char text[1024];
|
||||
|
||||
// prevent skin/color/model changes
|
||||
char *mdls = g_engfuncs.pfnInfoKeyValue( infobuffer, "model" );
|
||||
|
||||
if ( !stricmp( mdls, pPlayer->m_szTeamName ) )
|
||||
return;
|
||||
|
||||
if ( defaultteam.value )
|
||||
{
|
||||
int clientIndex = pPlayer->entindex();
|
||||
|
||||
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
|
||||
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
|
||||
sprintf( text, "* Not allowed to change teams in this game!\n" );
|
||||
UTIL_SayText( text, pPlayer );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( defaultteam.value || !IsValidTeam( mdls ) )
|
||||
{
|
||||
int clientIndex = pPlayer->entindex();
|
||||
|
||||
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
|
||||
sprintf( text, "* Can't change team to \'%s\'\n", mdls );
|
||||
UTIL_SayText( text, pPlayer );
|
||||
sprintf( text, "* Server limits teams to \'%s\'\n", m_szTeamList );
|
||||
UTIL_SayText( text, pPlayer );
|
||||
return;
|
||||
}
|
||||
// notify everyone of the team change
|
||||
sprintf( text, "* %s has changed to team \'%s\'\n", STRING(pPlayer->pev->netname), mdls );
|
||||
UTIL_SayTextAll( text, pPlayer );
|
||||
|
||||
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" joined team \"%s\"\n",
|
||||
STRING(pPlayer->pev->netname),
|
||||
GETPLAYERUSERID( pPlayer->edict() ),
|
||||
GETPLAYERAUTHID( pPlayer->edict() ),
|
||||
pPlayer->m_szTeamName,
|
||||
mdls );
|
||||
|
||||
ChangePlayerTeam( pPlayer, mdls, TRUE, TRUE );
|
||||
// recound stuff
|
||||
RecountTeams( TRUE );
|
||||
}
|
||||
|
||||
extern int gmsgDeathMsg;
|
||||
|
||||
//=========================================================
|
||||
// Deathnotice.
|
||||
//=========================================================
|
||||
void CHalfLifeShytplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor )
|
||||
{
|
||||
if ( m_DisableDeathMessages )
|
||||
return;
|
||||
|
||||
if ( pVictim && pKiller && pKiller->flags & FL_CLIENT )
|
||||
{
|
||||
CBasePlayer *pk = (CBasePlayer*) CBaseEntity::Instance( pKiller );
|
||||
|
||||
if ( pk )
|
||||
{
|
||||
if ( (pk != pVictim) && (PlayerRelationship( pVictim, pk ) == GR_TEAMMATE) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
|
||||
WRITE_BYTE( ENTINDEX(ENT(pKiller)) ); // the killer
|
||||
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); // the victim
|
||||
WRITE_STRING( "teammate" ); // flag this as a teammate kill
|
||||
MESSAGE_END();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CHalfLifeMultiplay::DeathNotice( pVictim, pKiller, pevInflictor );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
void CHalfLifeShytplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
if ( !m_DisableDeathPenalty )
|
||||
{
|
||||
CHalfLifeMultiplay::PlayerKilled( pVictim, pKiller, pInflictor );
|
||||
RecountTeams();
|
||||
|
||||
if ( pVictim->pev == pKiller )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
char text[1024];
|
||||
switch(RANDOM_LONG(0,4))
|
||||
{
|
||||
case 0: sprintf( text, "Super Bitchy Admin: FAGGOT!\n" ); break;
|
||||
case 1: sprintf( text, "Super Bitchy Admin: OBVIOUS HACKER\n" ); break;
|
||||
case 2: sprintf( text, "Super Bitchy Admin: EAT SHIT IN THE BAN LIST MOTHERFUCKER!\n" ); break;
|
||||
case 3: sprintf( text, "Super Bitchy Admin: FUCK YOU!\n" ); break;
|
||||
case 4: sprintf( text, "Super Bitchy Admin: THIS AIN'T CALL OF DUTY! DON'T FIRE YOUR GUNS, AGAINST SERVER RULES!\n" ); break;
|
||||
}
|
||||
|
||||
UTIL_SayTextAll( text, pVictim );
|
||||
|
||||
char cmd[40];
|
||||
sprintf(cmd, "kick \"%s\"\n", STRING(pKiller->netname));
|
||||
SERVER_COMMAND(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// IsTeamplay
|
||||
//=========================================================
|
||||
BOOL CHalfLifeShytplay::IsTeamplay( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CHalfLifeShytplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker )
|
||||
{
|
||||
if ( pAttacker && PlayerRelationship( pPlayer, pAttacker ) == GR_TEAMMATE )
|
||||
{
|
||||
// my teammate hit me.
|
||||
if ( (friendlyfire.value == 0) && (pAttacker != pPlayer) )
|
||||
{
|
||||
// friendly fire is off, and this hit came from someone other than myself, then don't get hurt
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return CHalfLifeMultiplay::FPlayerCanTakeDamage( pPlayer, pAttacker );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
int CHalfLifeShytplay::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
|
||||
{
|
||||
// half life multiplay has a simple concept of Player Relationships.
|
||||
// you are either on another player's team, or you are not.
|
||||
if ( !pPlayer || !pTarget || !pTarget->IsPlayer() )
|
||||
return GR_NOTTEAMMATE;
|
||||
|
||||
if ( (*GetTeamID(pPlayer) != '\0') && (*GetTeamID(pTarget) != '\0') && !stricmp( GetTeamID(pPlayer), GetTeamID(pTarget) ) )
|
||||
{
|
||||
return GR_TEAMMATE;
|
||||
}
|
||||
|
||||
return GR_NOTTEAMMATE;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
BOOL CHalfLifeShytplay::ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target )
|
||||
{
|
||||
// always autoaim, unless target is a teammate
|
||||
CBaseEntity *pTgt = CBaseEntity::Instance( target );
|
||||
if ( pTgt && pTgt->IsPlayer() )
|
||||
{
|
||||
if ( PlayerRelationship( pPlayer, pTgt ) == GR_TEAMMATE )
|
||||
return FALSE; // don't autoaim at teammates
|
||||
}
|
||||
|
||||
return CHalfLifeMultiplay::ShouldAutoAim( pPlayer, target );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
int CHalfLifeShytplay::IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled )
|
||||
{
|
||||
if ( !pKilled )
|
||||
return 0;
|
||||
|
||||
if ( !pAttacker )
|
||||
return 1;
|
||||
|
||||
if ( pAttacker != pKilled && PlayerRelationship( pAttacker, pKilled ) == GR_TEAMMATE )
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
const char *CHalfLifeShytplay::GetTeamID( CBaseEntity *pEntity )
|
||||
{
|
||||
if ( pEntity == NULL || pEntity->pev == NULL )
|
||||
return "";
|
||||
|
||||
// return their team name
|
||||
return pEntity->TeamID();
|
||||
}
|
||||
|
||||
|
||||
int CHalfLifeShytplay::GetTeamIndex( const char *pTeamName )
|
||||
{
|
||||
if ( pTeamName && *pTeamName != 0 )
|
||||
{
|
||||
// try to find existing team
|
||||
for ( int tm = 0; tm < num_teams; tm++ )
|
||||
{
|
||||
if ( !stricmp( team_names[tm], pTeamName ) )
|
||||
return tm;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // No match
|
||||
}
|
||||
|
||||
|
||||
const char *CHalfLifeShytplay::GetIndexedTeamName( int teamIndex )
|
||||
{
|
||||
if ( teamIndex < 0 || teamIndex >= num_teams )
|
||||
return "";
|
||||
|
||||
return team_names[ teamIndex ];
|
||||
}
|
||||
|
||||
|
||||
BOOL CHalfLifeShytplay::IsValidTeam( const char *pTeamName )
|
||||
{
|
||||
if ( !m_teamLimit ) // Any team is valid if the teamlist isn't set
|
||||
return TRUE;
|
||||
|
||||
return ( GetTeamIndex( pTeamName ) != -1 ) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
const char *CHalfLifeShytplay::TeamWithFewestPlayers( void )
|
||||
{
|
||||
int i;
|
||||
int minPlayers = MAX_TEAMS;
|
||||
int teamCount[ MAX_TEAMS ];
|
||||
char *pTeamName = NULL;
|
||||
|
||||
memset( teamCount, 0, MAX_TEAMS * sizeof(int) );
|
||||
|
||||
// loop through all clients, count number of players on each team
|
||||
for ( i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *plr = UTIL_PlayerByIndex( i );
|
||||
|
||||
if ( plr )
|
||||
{
|
||||
int team = GetTeamIndex( plr->TeamID() );
|
||||
if ( team >= 0 )
|
||||
teamCount[team] ++;
|
||||
}
|
||||
}
|
||||
|
||||
// Find team with least players
|
||||
for ( i = 0; i < num_teams; i++ )
|
||||
{
|
||||
if ( teamCount[i] < minPlayers )
|
||||
{
|
||||
minPlayers = teamCount[i];
|
||||
pTeamName = team_names[i];
|
||||
}
|
||||
}
|
||||
|
||||
return pTeamName;
|
||||
}
|
||||
|
||||
void CHalfLifeShytplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
// CBasePlayer *pPlayer;
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
|
||||
pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
void CHalfLifeShytplay::RecountTeams( bool bResendInfo )
|
||||
{
|
||||
char *pName;
|
||||
char teamlist[TEAMPLAY_TEAMLISTLENGTH];
|
||||
|
||||
// loop through all teams, recounting everything
|
||||
num_teams = 0;
|
||||
|
||||
// Copy all of the teams from the teamlist
|
||||
// make a copy because strtok is destructive
|
||||
strcpy( teamlist, m_szTeamList );
|
||||
pName = teamlist;
|
||||
pName = strtok( pName, ";" );
|
||||
while ( pName != NULL && *pName )
|
||||
{
|
||||
if ( GetTeamIndex( pName ) < 0 )
|
||||
{
|
||||
strcpy( team_names[num_teams], pName );
|
||||
num_teams++;
|
||||
}
|
||||
pName = strtok( NULL, ";" );
|
||||
}
|
||||
|
||||
if ( num_teams < 2 )
|
||||
{
|
||||
num_teams = 0;
|
||||
m_teamLimit = FALSE;
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
memset( team_scores, 0, sizeof(team_scores) );
|
||||
|
||||
// loop through all clients
|
||||
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBaseEntity *plr = UTIL_PlayerByIndex( i );
|
||||
|
||||
if ( plr )
|
||||
{
|
||||
const char *pTeamName = plr->TeamID();
|
||||
// try add to existing team
|
||||
int tm = GetTeamIndex( pTeamName );
|
||||
|
||||
if ( tm < 0 ) // no team match found
|
||||
{
|
||||
if ( !m_teamLimit )
|
||||
{
|
||||
// add to new team
|
||||
tm = num_teams;
|
||||
num_teams++;
|
||||
team_scores[tm] = 0;
|
||||
strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH );
|
||||
}
|
||||
}
|
||||
|
||||
if ( tm >= 0 )
|
||||
{
|
||||
team_scores[tm] += plr->pev->frags;
|
||||
}
|
||||
|
||||
if ( bResendInfo ) //Someone's info changed, let's send the team info again.
|
||||
{
|
||||
if ( plr && IsValidTeam( plr->TeamID() ) )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo, NULL );
|
||||
WRITE_BYTE( plr->entindex() );
|
||||
WRITE_STRING( plr->TeamID() );
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
//
|
||||
// teamplay_gamerules.h
|
||||
//
|
||||
|
||||
#define MAX_TEAMNAME_LENGTH 16
|
||||
#define MAX_TEAMS 32
|
||||
|
||||
#define TEAMPLAY_TEAMLISTLENGTH MAX_TEAMS*MAX_TEAMNAME_LENGTH
|
||||
|
||||
class CHalfLifeShytplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CHalfLifeShytplay();
|
||||
|
||||
virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd );
|
||||
virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer );
|
||||
virtual BOOL IsTeamplay( void );
|
||||
virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
|
||||
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
|
||||
virtual const char *GetTeamID( CBaseEntity *pEntity );
|
||||
virtual BOOL ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target );
|
||||
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
|
||||
virtual void InitHUD( CBasePlayer *pl );
|
||||
virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor );
|
||||
virtual const char *GetGameDescription( void ) { return "Shytplay"; } // this is the game name that gets seen in the server browser
|
||||
virtual void UpdateGameMode( CBasePlayer *pPlayer ); // the client needs to be informed of the current game mode
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
virtual void Think ( void );
|
||||
virtual int GetTeamIndex( const char *pTeamName );
|
||||
virtual const char *GetIndexedTeamName( int teamIndex );
|
||||
virtual BOOL IsValidTeam( const char *pTeamName );
|
||||
const char *SetDefaultPlayerTeam( CBasePlayer *pPlayer );
|
||||
virtual void ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib );
|
||||
|
||||
private:
|
||||
void RecountTeams( bool bResendInfo = FALSE );
|
||||
const char *TeamWithFewestPlayers( void );
|
||||
|
||||
BOOL m_DisableDeathMessages;
|
||||
BOOL m_DisableDeathPenalty;
|
||||
BOOL m_teamLimit; // This means the server set only some teams as valid
|
||||
char m_szTeamList[TEAMPLAY_TEAMLISTLENGTH];
|
||||
};
|
|
@ -0,0 +1,354 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This source code contains proprietary and confidential information of
|
||||
* Valve LLC and its suppliers. Access to this code is restricted to
|
||||
* persons who have executed a written SDK license with Valve. Any access,
|
||||
* use or distribution of this code by or to any unlicensed person is illegal.
|
||||
*
|
||||
****/
|
||||
//=========================================================
|
||||
// Sinistar
|
||||
//=========================================================
|
||||
|
||||
// UNDONE: Don't flinch every time you get hit
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "schedule.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
//=========================================================
|
||||
// Monster's Anim Events Go Here
|
||||
//=========================================================
|
||||
#define SINISTAR_AE_ATTACK_RIGHT 0x01
|
||||
#define SINISTAR_AE_ATTACK_LEFT 0x02
|
||||
#define SINISTAR_AE_ATTACK_BOTH 0x03
|
||||
|
||||
#define SINISTAR_FLINCH_DELAY 2 // at most one flinch every n secs
|
||||
|
||||
class CSinistar : public CBaseMonster
|
||||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
void SetYawSpeed( void );
|
||||
int Classify ( void );
|
||||
void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int IgnoreConditions ( void );
|
||||
|
||||
float m_flNextFlinch;
|
||||
|
||||
void PainSound( void );
|
||||
void AlertSound( void );
|
||||
void IdleSound( void );
|
||||
void AttackSound( void );
|
||||
|
||||
static const char *pAttackSounds[];
|
||||
static const char *pIdleSounds[];
|
||||
static const char *pAlertSounds[];
|
||||
static const char *pPainSounds[];
|
||||
static const char *pAttackHitSounds[];
|
||||
static const char *pAttackMissSounds[];
|
||||
|
||||
// No range attacks
|
||||
BOOL CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
|
||||
BOOL CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
|
||||
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( monster_sinistar, CSinistar );
|
||||
|
||||
const char *CSinistar::pAttackHitSounds[] =
|
||||
{
|
||||
"zombie/claw_strike1.wav",
|
||||
"zombie/claw_strike2.wav",
|
||||
"zombie/claw_strike3.wav",
|
||||
};
|
||||
|
||||
const char *CSinistar::pAttackMissSounds[] =
|
||||
{
|
||||
"zombie/claw_miss1.wav",
|
||||
"zombie/claw_miss2.wav",
|
||||
};
|
||||
|
||||
const char *CSinistar::pAttackSounds[] =
|
||||
{
|
||||
"sinistar/ss_attack1.wav",
|
||||
"sinistar/ss_attack2.wav",
|
||||
};
|
||||
|
||||
const char *CSinistar::pIdleSounds[] =
|
||||
{
|
||||
"sinistar/ss_idle1.wav",
|
||||
};
|
||||
|
||||
const char *CSinistar::pAlertSounds[] =
|
||||
{
|
||||
"sinistar/ss_alert10.wav",
|
||||
"sinistar/ss_alert20.wav",
|
||||
"sinistar/ss_alert30.wav",
|
||||
};
|
||||
|
||||
const char *CSinistar::pPainSounds[] =
|
||||
{
|
||||
"sinistar/ss_pain1.wav",
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// Classify - indicates this monster's place in the
|
||||
// relationship table.
|
||||
//=========================================================
|
||||
int CSinistar :: Classify ( void )
|
||||
{
|
||||
if (g_pGameRules->IsTest() && testmonsters.value <= 0)
|
||||
{
|
||||
return CLASS_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CLASS_ALIEN_MONSTER;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// SetYawSpeed - allows each sequence to have a different
|
||||
// turn rate associated with it.
|
||||
//=========================================================
|
||||
void CSinistar :: SetYawSpeed ( void )
|
||||
{
|
||||
int ys;
|
||||
|
||||
ys = 120;
|
||||
|
||||
#if 0
|
||||
switch ( m_Activity )
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
||||
int CSinistar :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
|
||||
{
|
||||
// Take 30% damage from bullets
|
||||
if ( bitsDamageType == DMG_BULLET )
|
||||
{
|
||||
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
|
||||
vecDir = vecDir.Normalize();
|
||||
float flForce = DamageForce( flDamage );
|
||||
pev->velocity = pev->velocity + vecDir * flForce;
|
||||
flDamage *= 0.3;
|
||||
}
|
||||
|
||||
// HACK HACK -- until we fix this.
|
||||
if ( IsAlive() )
|
||||
PainSound();
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
void CSinistar :: PainSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG(0,9);
|
||||
|
||||
if (RANDOM_LONG(0,5) < 2)
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pPainSounds[ RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1) ], 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CSinistar :: AlertSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG(0,9);
|
||||
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAlertSounds[ RANDOM_LONG(0,ARRAYSIZE(pAlertSounds)-1) ], 1.0, ATTN_NORM, 0, pitch );
|
||||
}
|
||||
|
||||
void CSinistar :: IdleSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG(0,9);
|
||||
|
||||
// Play a random idle sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
|
||||
void CSinistar :: AttackSound( void )
|
||||
{
|
||||
// Play a random attack sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
|
||||
|
||||
//=========================================================
|
||||
// HandleAnimEvent - catches the monster-specific messages
|
||||
// that occur when tagged animation frames are played.
|
||||
//=========================================================
|
||||
void CSinistar :: HandleAnimEvent( MonsterEvent_t *pEvent )
|
||||
{
|
||||
switch( pEvent->event )
|
||||
{
|
||||
case SINISTAR_AE_ATTACK_RIGHT:
|
||||
{
|
||||
// do stuff for this event.
|
||||
// ALERT( at_console, "Slash right!\n" );
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.sinistarDmgOneSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.z = -18;
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 1000;
|
||||
}
|
||||
// Play a random attack hit sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else // Play a random attack miss sound
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
case SINISTAR_AE_ATTACK_LEFT:
|
||||
{
|
||||
// do stuff for this event.
|
||||
// ALERT( at_console, "Slash left!\n" );
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.sinistarDmgOneSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.z = 18;
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 1000;
|
||||
}
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
case SINISTAR_AE_ATTACK_BOTH:
|
||||
{
|
||||
// do stuff for this event.
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.sinistarDmgBothSlash, DMG_SLASH );
|
||||
if ( pHurt )
|
||||
{
|
||||
if ( pHurt->pev->flags & (FL_MONSTER|FL_CLIENT) )
|
||||
{
|
||||
pHurt->pev->punchangle.x = 5;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -1000;
|
||||
}
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
}
|
||||
else
|
||||
EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
|
||||
|
||||
if (RANDOM_LONG(0,1))
|
||||
AttackSound();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
CBaseMonster::HandleAnimEvent( pEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Spawn
|
||||
//=========================================================
|
||||
void CSinistar :: Spawn()
|
||||
{
|
||||
Precache( );
|
||||
|
||||
if (CVAR_GET_FLOAT("mp_testzom") == 1)
|
||||
SET_MODEL(ENT(pev), "models/zombie.mdl");
|
||||
else
|
||||
SET_MODEL(ENT(pev), "models/sinistar.mdl");
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
pev->renderfx = kRenderFxGlowShell;
|
||||
pev->rendercolor.x = 255;
|
||||
m_bloodColor = BLOOD_COLOR_GREEN;
|
||||
pev->health = gSkillData.sinistarHealth;
|
||||
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
|
||||
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
m_afCapability = bits_CAP_DOORS_GROUP;
|
||||
|
||||
MonsterInit();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Precache - precaches all resources this monster needs
|
||||
//=========================================================
|
||||
void CSinistar :: Precache()
|
||||
{
|
||||
int i;
|
||||
|
||||
PRECACHE_MODEL("models/sinistar.mdl");
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackHitSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackMissSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAttackSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pIdleSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pAlertSounds[i]);
|
||||
|
||||
for ( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND((char *)pPainSounds[i]);
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// AI Schedules Specific to this monster
|
||||
//=========================================================
|
||||
|
||||
|
||||
|
||||
int CSinistar::IgnoreConditions ( void )
|
||||
{
|
||||
int iIgnore = CBaseMonster::IgnoreConditions();
|
||||
|
||||
if ((m_Activity == ACT_MELEE_ATTACK1) || (m_Activity == ACT_MELEE_ATTACK1))
|
||||
{
|
||||
#if 0
|
||||
if (pev->health < 20)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
else
|
||||
#endif
|
||||
if (m_flNextFlinch >= gpGlobals->time)
|
||||
iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
|
||||
}
|
||||
|
||||
if ((m_Activity == ACT_SMALL_FLINCH) || (m_Activity == ACT_BIG_FLINCH))
|
||||
{
|
||||
if (m_flNextFlinch < gpGlobals->time)
|
||||
m_flNextFlinch = gpGlobals->time + SINISTAR_FLINCH_DELAY;
|
||||
}
|
||||
|
||||
return iIgnore;
|
||||
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Use, distribution, and modification of this source code and/or resulting
|
||||
* object code is restricted to non-commercial enhancements to products from
|
||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
||||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "monsters.h"
|
||||
#include "weapons.h"
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "hornet.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
|
||||
enum soda_e {
|
||||
SODA_IDLE1 = 0,
|
||||
SODA_FIDGET,
|
||||
SODA_DRINK
|
||||
};
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_soda, CSodaCan );
|
||||
|
||||
BOOL CSodaCan::IsUseable( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CSodaCan::Spawn( )
|
||||
{
|
||||
Precache( );
|
||||
m_iId = WEAPON_SODA;
|
||||
SET_MODEL(ENT(pev), "models/w_sodacan.mdl");
|
||||
|
||||
m_iDefaultAmmo = SODA_USUAL_DRINKS;
|
||||
|
||||
FallInit();// get ready to fall down.
|
||||
}
|
||||
|
||||
|
||||
void CSodaCan::Precache( void )
|
||||
{
|
||||
PRECACHE_MODEL("models/v_sodacan.mdl");
|
||||
PRECACHE_MODEL("models/w_sodacan.mdl");
|
||||
PRECACHE_MODEL("models/p_sodacan.mdl");
|
||||
|
||||
PRECACHE_SOUND("weapons/soda1.wav");
|
||||
PRECACHE_SOUND("weapons/soda2.wav");
|
||||
PRECACHE_SOUND("weapons/sodaup.wav");
|
||||
|
||||
m_usSodaDrink = PRECACHE_EVENT ( 1, "events/soda.sc" );
|
||||
}
|
||||
|
||||
int CSodaCan::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
|
||||
{
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// in multiplayer, all hivehands come full.
|
||||
pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] = SODA_USUAL_DRINKS;
|
||||
}
|
||||
#endif
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CSodaCan::GetItemInfo(ItemInfo *p)
|
||||
{
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "Soda";
|
||||
p->iMaxAmmo1 = SODA_USUAL_DRINKS;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = WEAPON_NOCLIP;
|
||||
p->iSlot = 4;
|
||||
p->iPosition = 3;
|
||||
p->iId = m_iId = WEAPON_SODA;
|
||||
p->iFlags = ITEM_FLAG_EXHAUSTIBLE;
|
||||
p->iWeight = HORNETGUN_WEIGHT;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CSodaCan::Deploy( )
|
||||
{
|
||||
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "weapons/sodaup.wav", 1, ATTN_NORM );
|
||||
return DefaultDeploy( "models/v_sodacan.mdl", "models/p_sodacan.mdl", SODA_IDLE1, "soda" );
|
||||
}
|
||||
|
||||
void CSodaCan::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
SendWeaponAnim( SODA_IDLE1 );
|
||||
}
|
||||
|
||||
|
||||
void CSodaCan::PrimaryAttack()
|
||||
{
|
||||
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
return;
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
m_pPlayer->TakeHealth( 15, DMG_GENERIC );
|
||||
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
|
||||
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
flags = FEV_NOTHOST;
|
||||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSodaDrink, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 1, 0, 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 3;
|
||||
|
||||
if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 3;
|
||||
}
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 105.0 / 30.0;
|
||||
}
|
||||
|
||||
void CSodaCan::WeaponIdle( void )
|
||||
{
|
||||
if ( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
return;
|
||||
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
|
||||
|
||||
if (flRand <= 0.3 + 0 * 0.75)
|
||||
{
|
||||
iAnim = SODA_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0 / 20.0;
|
||||
}
|
||||
else if (flRand <= 0.6 + 0 * 0.875)
|
||||
{
|
||||
iAnim = SODA_FIDGET;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 61.0 / 30.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = SODA_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0 / 20.0;
|
||||
}
|
||||
SendWeaponAnim( iAnim, 1 );
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
//
|
||||
// test_gamerules
|
||||
// Game rules for the game mode, for testing weapons
|
||||
// and other beta testing.
|
||||
//
|
||||
|
||||
#include "extdll.h"
|
||||
#include "util.h"
|
||||
#include "cbase.h"
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
#include "gamerules.h"
|
||||
#include "test_gamerules.h"
|
||||
#include "game.h"
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
extern int gmsgScoreInfo;
|
||||
extern int gmsgShowGameTitle;
|
||||
|
||||
CTestplay :: CTestplay()
|
||||
{
|
||||
//Genuflect
|
||||
}
|
||||
|
||||
BOOL CTestplay::IsHeavyRain()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CTestplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
{
|
||||
ALERT(at_console, "Test Game Mode Initalized!\no Giving Weapons\no Kills don't count\no This is for testing and sandboxing\no Have fun!");
|
||||
|
||||
BOOL addDefault;
|
||||
CBaseEntity *pWeaponEntity = NULL;
|
||||
|
||||
pPlayer->pev->weapons |= (1<<WEAPON_SUIT);
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
edict_t *pClient = g_engfuncs.pfnPEntityOfEntIndex( 1 );
|
||||
|
||||
while ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ))
|
||||
{
|
||||
pWeaponEntity->Touch( pPlayer );
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if ( addDefault )
|
||||
{
|
||||
pPlayer->GiveNamedItem( "weapon_fotn" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_shotgun" );
|
||||
pPlayer->GiveNamedItem( "ammo_buckshot" );
|
||||
pPlayer->GiveNamedItem( "weapon_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_9mmAR" );
|
||||
pPlayer->GiveNamedItem( "ammo_ARgrenades" );
|
||||
pPlayer->GiveNamedItem( "weapon_handgrenade" );
|
||||
pPlayer->GiveNamedItem( "weapon_tripmine" );
|
||||
pPlayer->GiveNamedItem( "weapon_rpg" );
|
||||
pPlayer->GiveNamedItem( "ammo_rpgclip" );
|
||||
pPlayer->GiveNamedItem( "weapon_satchel" );
|
||||
pPlayer->GiveNamedItem( "weapon_snark" );
|
||||
pPlayer->GiveNamedItem( "weapon_soda" );
|
||||
pPlayer->GiveNamedItem( "weapon_dosh" );
|
||||
pPlayer->GiveNamedItem( "weapon_beamkatana" );
|
||||
pPlayer->GiveNamedItem( "weapon_ak47" );
|
||||
pPlayer->GiveNamedItem( "weapon_bow" );
|
||||
pPlayer->GiveNamedItem( "weapon_jason" );
|
||||
pPlayer->GiveNamedItem( "weapon_jihad" );
|
||||
pPlayer->GiveNamedItem( "weapon_jackal" );
|
||||
pPlayer->GiveNamedItem( "weapon_nstar" );
|
||||
pPlayer->GiveNamedItem( "weapon_mw2" );
|
||||
pPlayer->GiveNamedItem( "weapon_zapper" );
|
||||
pPlayer->GiveNamedItem( "weapon_goldengun" );
|
||||
pPlayer->GiveNamedItem( "weapon_boombox" );
|
||||
pPlayer->GiveNamedItem( "weapon_scientist" );
|
||||
pPlayer->GiveNamedItem( "weapon_modman" );
|
||||
}
|
||||
//char welcometext[1024] = "Welcome to Test Gamemode!\n";
|
||||
//UTIL_SayText( welcometext, pPlayer );
|
||||
}
|
||||
|
||||
void CTestplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
CBasePlayer *peKiller = NULL;
|
||||
CBaseEntity *ktmp = CBaseEntity::Instance( pKiller );
|
||||
if ( pVictim->pev == pKiller )
|
||||
{ // killed self
|
||||
char victext[1024] = "You killed yourself.\n";
|
||||
UTIL_SayText( victext, pVictim );
|
||||
return;
|
||||
}
|
||||
else if ( ktmp && ktmp->IsPlayer() )
|
||||
{
|
||||
|
||||
char victext[1024] = "You got shot and died.\n";
|
||||
UTIL_SayText( victext, pVictim );
|
||||
|
||||
CBaseEntity *ep = CBaseEntity::Instance( pKiller );
|
||||
if ( ep && ep->Classify() == CLASS_PLAYER )
|
||||
{
|
||||
CBasePlayer *PK = (CBasePlayer*)ep;
|
||||
|
||||
char kiltext[1024] = "You killed a person.\n";
|
||||
UTIL_SayText( kiltext, PK );
|
||||
|
||||
PK->m_flNextDecalTime = gpGlobals->time;
|
||||
}
|
||||
else
|
||||
{
|
||||
// World did them in, Genuflect.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CTestplay::IsTest( void )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// test_gamerules
|
||||
// Game rules for the game mode, for testing weapons
|
||||
// and other beta testing.
|
||||
//
|
||||
|
||||
#define JASON 0;
|
||||
|
||||
class CTestplay : public CHalfLifeMultiplay
|
||||
{
|
||||
public:
|
||||
CTestplay();
|
||||
virtual const char *GetGameDescription( void ) { return "Test Mode"; } // this is the game name that gets seen in the server browser
|
||||
virtual BOOL IsHeavyRain( void );
|
||||
virtual void PlayerSpawn( CBasePlayer *pPlayer );
|
||||
virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor );
|
||||
virtual BOOL IsTest( void );
|
||||
//virtual int JasonsStolen( int jason );
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue