Browse Source

Rework weapons code.

noffice
Andrey Akhmichin 5 years ago
parent
commit
77140d26a0
  1. 1
      cl_dll/Android.mk
  2. 1
      cl_dll/CMakeLists.txt
  3. 98
      cl_dll/ev_hldm.cpp
  4. 5
      cl_dll/hl/hl_baseentity.cpp
  5. 27
      cl_dll/hl/hl_events.cpp
  6. 2
      cl_dll/hud.cpp
  7. 18
      cl_dll/hud.h
  8. 165
      cl_dll/noffice/glow.cpp
  9. 1
      cl_dll/tri.cpp
  10. 3
      dlls/Android.mk
  11. 3
      dlls/CMakeLists.txt
  12. 71
      dlls/crowbar.cpp
  13. 50
      dlls/glock.cpp
  14. 3
      dlls/monsters.h
  15. 33
      dlls/mp5.cpp
  16. 30
      dlls/noffice/flashlightspot.h
  17. 41
      dlls/noffice/holster.cpp
  18. 62
      dlls/noffice/lightspot.cpp
  19. 273
      dlls/noffice/torch.cpp
  20. 40
      dlls/noffice/wallspot.cpp
  21. 66
      dlls/player.cpp
  22. 2
      dlls/player.h
  23. 13
      dlls/shotgun.cpp
  24. 109
      dlls/weapons.cpp
  25. 52
      dlls/weapons.h

1
cl_dll/Android.mk

@ -24,7 +24,6 @@ LOCAL_CFLAGS += -DCLIENT_DLL=1
SRCS= SRCS=
SRCS_C= SRCS_C=
SRCS+=./noffice/glow.cpp
SRCS+=./noffice/pain.cpp SRCS+=./noffice/pain.cpp
SRCS+=./noffice/cinematic.cpp SRCS+=./noffice/cinematic.cpp
SRCS+=./noffice/deathvision.cpp SRCS+=./noffice/deathvision.cpp

1
cl_dll/CMakeLists.txt

@ -52,7 +52,6 @@ endif()
set (CLDLL_SOURCES set (CLDLL_SOURCES
noffice/glow.cpp
noffice/pain.cpp noffice/pain.cpp
noffice/cinematic.cpp noffice/cinematic.cpp
noffice/deathvision.cpp noffice/deathvision.cpp

98
cl_dll/ev_hldm.cpp

@ -54,25 +54,13 @@ void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args ); void EV_FireGlock2( struct event_args_s *args );
void EV_FireShotGunSingle( struct event_args_s *args ); void EV_FireShotGunSingle( struct event_args_s *args );
void EV_FireShotGunDouble( struct event_args_s *args ); void EV_FireShotGunDouble( struct event_args_s *args );
void EV_FireShotGunX( struct event_args_s *args );
void EV_FireMP5( 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_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args ); void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( 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_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_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args ); void EV_TrainPitchAdjust( struct event_args_s *args );
void EV_Torch( struct event_args_s *args );
void EV_FireShotGunX( struct event_args_s *args );
} }
#define VECTOR_CONE_1DEGREES Vector( 0.00873f, 0.00873f, 0.00873f ) #define VECTOR_CONE_1DEGREES Vector( 0.00873f, 0.00873f, 0.00873f )
@ -493,7 +481,7 @@ void EV_FireGlock1( event_args_t *args )
V_PunchAxis( 0, -2.0 ); V_PunchAxis( 0, -2.0 );
} }
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 ); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 13, -8, 6 );
EV_EjectBrass( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL ); EV_EjectBrass( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL );
@ -685,7 +673,7 @@ void EV_FireMP5( event_args_t *args )
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) ); V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) );
} }
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 ); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 15, -10, 5 );
EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL ); EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL );
@ -712,36 +700,6 @@ void EV_FireMP5( event_args_t *args )
} }
} }
// We only predict the animation and sound
// The grenade is still launched from the server.
void EV_FireMP52( event_args_t *args )
{
int idx;
vec3_t origin;
idx = args->entindex;
VectorCopy( args->origin, origin );
if( EV_IsLocal( idx ) )
{
gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 2 );
V_PunchAxis( 0, -10 );
}
switch( gEngfuncs.pfnRandomLong( 0, 1 ) )
{
case 0:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/glauncher.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );
break;
case 1:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/glauncher2.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );
break;
}
}
//======================
// MP5 END
//======================
//====================== //======================
// PHYTON START // PHYTON START
// ( .357 ) // ( .357 )
@ -1761,56 +1719,6 @@ int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 )
return 0; return 0;
} }
//======================
// TORCH START
//======================
#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav"
#define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav"
enum torch_e
{
TORCH_IDLE_OFF = 0,
TORCH_DRAW,
TORCH_IDLE_ON,
TORCH_SWITCH,
TORCH_HOLSTER_OFF,
TORCH_HOLSTER_ON
};
void EV_Torch( struct event_args_s *args )
{
int idx;
vec3_t origin;
int flashlightOn;
idx = args->entindex;
VectorCopy( args->origin, origin );
flashlightOn = args->bparam1;
//Only play the weapon anims if I shot it.
if( EV_IsLocal( idx ) )
{
gEngfuncs.pEventAPI->EV_WeaponAnimation( TORCH_SWITCH, 1 );
}
if( flashlightOn )
{
// Play flashlight on sound.
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, SOUND_FLASHLIGHT_ON, 1, ATTN_NORM, 0, 100 );
}
else
{
// Play flashlight off sound.
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, 1, ATTN_NORM, 0, 100 );
}
}
//======================
// TORCH END
//======================
//====================== //======================
// SHOTGUNX START // SHOTGUNX START
//====================== //======================

5
cl_dll/hl/hl_baseentity.cpp

@ -345,10 +345,5 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) { }
int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; } int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
void CBasePlayerWeapon::RetireWeapon( void ) { } void CBasePlayerWeapon::RetireWeapon( void ) { }
void CBasePlayerWeapon::ItemPostFrame_Always( void ) { }
int CBasePlayerWeapon::DefaultAmmoBySkill( int iMaxClip, int iSkillLevel ) { return 0; }
string_t CBasePlayerWeapon::GetClipModel() const { return 0; }
void CBasePlayerWeapon::SetClipModel( const char* szModel ) { }
void CBasePlayerWeapon::DropClip( void ) { }
void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {} void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){} void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}

27
cl_dll/hl/hl_events.cpp

@ -24,25 +24,13 @@ void EV_FireGlock1( struct event_args_s *args );
void EV_FireGlock2( struct event_args_s *args ); void EV_FireGlock2( struct event_args_s *args );
void EV_FireShotGunSingle( struct event_args_s *args ); void EV_FireShotGunSingle( struct event_args_s *args );
void EV_FireShotGunDouble( struct event_args_s *args ); void EV_FireShotGunDouble( struct event_args_s *args );
void EV_FireShotGunX( struct event_args_s *args );
void EV_FireMP5( 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_FirePython( struct event_args_s *args );
void EV_FireGauss( struct event_args_s *args ); void EV_FireGauss( struct event_args_s *args );
void EV_SpinGauss( 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_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_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args ); void EV_TrainPitchAdjust( struct event_args_s *args );
void EV_Torch( struct event_args_s *args );
void EV_FireShotGunX( struct event_args_s *args );
} }
/* /*
@ -64,21 +52,10 @@ void Game_HookEvents( void )
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 ); gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle ); gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble ); gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
gEngfuncs.pfnHookEvent( "events/shotgunx.sc", EV_FireShotGunX );
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 ); gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython ); gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss ); gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss ); gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust ); 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/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/tripfire.sc", EV_TripmineFire );
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
gEngfuncs.pfnHookEvent( "events/torch.sc", EV_Torch );
gEngfuncs.pfnHookEvent( "events/shotgunx.sc", EV_FireShotGunX );
} }

2
cl_dll/hud.cpp

@ -233,7 +233,6 @@ void CHud::Init( void )
m_TextMessage.Init(); m_TextMessage.Init();
m_StatusIcons.Init(); m_StatusIcons.Init();
m_Cinematic.Init(); m_Cinematic.Init();
m_Glow.Init();
m_DeathVision.Init(); m_DeathVision.Init();
m_MOTD.Init(); m_MOTD.Init();
m_Scoreboard.Init(); m_Scoreboard.Init();
@ -417,7 +416,6 @@ void CHud::VidInit( void )
m_TextMessage.VidInit(); m_TextMessage.VidInit();
m_StatusIcons.VidInit(); m_StatusIcons.VidInit();
m_Cinematic.VidInit(); m_Cinematic.VidInit();
m_Glow.VidInit();
m_DeathVision.VidInit(); m_DeathVision.VidInit();
m_Scoreboard.VidInit(); m_Scoreboard.VidInit();
m_MOTD.VidInit(); m_MOTD.VidInit();

18
cl_dll/hud.h

@ -578,23 +578,6 @@ private:
float m_flCineTime; float m_flCineTime;
}; };
//
//-----------------------------------------------------
//
class CHudGlow : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw( float flTime );
int MsgFunc_Glow( const char *pszName, int iSize, void *pbuf );
void DrawGlow( void );
private:
HSPRITE m_hSprite;
};
// //
//----------------------------------------------------- //-----------------------------------------------------
// //
@ -690,7 +673,6 @@ public:
CHudTextMessage m_TextMessage; CHudTextMessage m_TextMessage;
CHudStatusIcons m_StatusIcons; CHudStatusIcons m_StatusIcons;
CHudCinematic m_Cinematic; CHudCinematic m_Cinematic;
CHudGlow m_Glow;
CHudDeathVision m_DeathVision; CHudDeathVision m_DeathVision;
CHudScoreboard m_Scoreboard; CHudScoreboard m_Scoreboard;
CHudMOTD m_MOTD; CHudMOTD m_MOTD;

165
cl_dll/noffice/glow.cpp

@ -1,165 +0,0 @@
/***
*
* 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.
*
****/
//
// Geiger.cpp
//
// implementation of CHudAmmo class
//
#include "hud.h"
#include "cl_util.h"
#include <string.h>
#include <time.h>
#include <stdio.h>
#include "event_api.h"
#include "event_args.h"
#include "triangleapi.h"
#include "pm_shared.h"
#include "pm_defs.h"
#include "pmtrace.h"
#include "parsemsg.h"
extern vec3_t v_origin; // last view origin
extern vec3_t v_angles; // last view angle
extern vec3_t v_cl_angles; // last client/mouse angle
extern vec3_t v_sim_org; // last sim origin
DECLARE_MESSAGE(m_Glow, Glow)
int CHudGlow::Init(void)
{
HOOK_MESSAGE(Glow);
m_iFlags = 0;
gHUD.AddHudElem(this);
srand((unsigned)time(NULL));
return 1;
};
int CHudGlow::VidInit(void)
{
m_iFlags = 0;
m_hSprite = SPR_Load("sprites/glow01.spr");
return 1;
};
int CHudGlow::MsgFunc_Glow(const char *pszName, int iSize, void *pbuf)
{
BEGIN_READ(pbuf, iSize);
int fOn = READ_BYTE();
if (fOn)
{
m_iFlags |= HUD_ACTIVE;
}
else
{
m_iFlags &= ~HUD_ACTIVE;
}
return 1;
}
int CHudGlow::Draw(float flTime)
{
return 1;
}
#define GLOW_TRACE_DISTANCE 80.0f
#define GLOW_MAX_ALPHA 1.0f
void CHudGlow::DrawGlow(void)
{
if (gHUD.m_iHideHUDDisplay & HIDEHUD_ALL)
return;
if (!(m_iFlags & HUD_ACTIVE))
return;
cl_entity_t* ent = gEngfuncs.GetViewModel();
if (!ent)
return;
float r, g, b, a;
vec3_t origin, forward, right, up, screen, point;
struct model_s *hSpriteModel;
int size = 10;
r = 1.0f; g = b = 0.95f;
VectorCopy(ent->attachment[0], origin);
AngleVectors(v_angles, forward, right, up);
vec3_t tracedir;
VectorScale(forward, GLOW_TRACE_DISTANCE, tracedir);
VectorAdd(tracedir, origin, tracedir);
pmtrace_t * trace = gEngfuncs.PM_TraceLine(origin, tracedir, PM_TRACELINE_PHYSENTSONLY, 2, -1);
if (trace->fraction != 1.0)
{
a = ((trace->fraction * GLOW_MAX_ALPHA) / GLOW_TRACE_DISTANCE) * 100;
}
else
{
a = GLOW_MAX_ALPHA;
}
a = Q_min(a, GLOW_MAX_ALPHA);
// gEngfuncs.Con_Printf("Glow opacity: %f.\n", a);
gEngfuncs.pTriAPI->WorldToScreen(origin, point);
hSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer(m_hSprite);
gEngfuncs.pTriAPI->SpriteTexture(hSpriteModel, 0);
gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd);
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
gEngfuncs.pTriAPI->Color4f( r, g, b, a );
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
gEngfuncs.pTriAPI->TexCoord2f(1, 0);
VectorMA(origin, size, up, point);
VectorMA(point, size, right, point);
gEngfuncs.pTriAPI->Vertex3fv(point);
gEngfuncs.pTriAPI->TexCoord2f(0, 0);
VectorMA(origin, size, up, point);
VectorMA(point, -size, right, point);
gEngfuncs.pTriAPI->Vertex3fv(point);
gEngfuncs.pTriAPI->TexCoord2f(0, 1);
VectorMA(origin, -size, up, point);
VectorMA(point, -size, right, point);
gEngfuncs.pTriAPI->Vertex3fv(point);
gEngfuncs.pTriAPI->TexCoord2f(1, 1);
VectorMA(origin, -size, up, point);
VectorMA(point, size, right, point);
gEngfuncs.pTriAPI->Vertex3fv(point);
gEngfuncs.pTriAPI->End();
return;
}

1
cl_dll/tri.cpp

@ -112,7 +112,6 @@ Render any triangles with transparent rendermode needs here
*/ */
void DLLEXPORT HUD_DrawTransparentTriangles( void ) void DLLEXPORT HUD_DrawTransparentTriangles( void )
{ {
gHUD.m_Glow.DrawGlow();
#if defined( TEST_IT ) #if defined( TEST_IT )
// Draw_Triangles(); // Draw_Triangles();
#endif #endif

3
dlls/Android.mk

@ -123,7 +123,8 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
noffice/dave.cpp \ noffice/dave.cpp \
noffice/female.cpp \ noffice/female.cpp \
noffice/clip.cpp \ noffice/clip.cpp \
noffice/flashlightspot.cpp \ noffice/lightspot.cpp \
noffice/wallspot.cpp \
noffice/furniture_passable.cpp \ noffice/furniture_passable.cpp \
noffice/holster.cpp \ noffice/holster.cpp \
noffice/news.cpp \ noffice/news.cpp \

3
dlls/CMakeLists.txt

@ -48,7 +48,8 @@ set (SVDLL_SOURCES
noffice/dave.cpp noffice/dave.cpp
noffice/female.cpp noffice/female.cpp
noffice/clip.cpp noffice/clip.cpp
noffice/flashlightspot.cpp noffice/lightspot.cpp
noffice/wallspot.cpp
noffice/furniture_passable.cpp noffice/furniture_passable.cpp
noffice/holster.cpp noffice/holster.cpp
noffice/news.cpp noffice/news.cpp

71
dlls/crowbar.cpp

@ -60,7 +60,7 @@ void CCrowbar::Precache( void )
PRECACHE_SOUND( "weapons/cbar_hitbod3.wav" ); PRECACHE_SOUND( "weapons/cbar_hitbod3.wav" );
PRECACHE_SOUND( "weapons/cbar_miss1.wav" ); PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
m_usCrowbar = PRECACHE_EVENT( 1, "events/crowbar.sc" ); // m_usCrowbar = PRECACHE_EVENT( 1, "events/crowbar.sc" );
} }
int CCrowbar::GetItemInfo( ItemInfo *p ) int CCrowbar::GetItemInfo( ItemInfo *p )
@ -92,16 +92,9 @@ int CCrowbar::AddToPlayer( CBasePlayer *pPlayer )
BOOL CCrowbar::Deploy() BOOL CCrowbar::Deploy()
{ {
m_flReleaseThrow = -1;
return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" ); return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" );
} }
BOOL CCrowbar::CanHolster( void )
{
// can only holster crowbar when not primed!
return ( m_flStartThrow == 0 );
}
void CCrowbar::Holster( int skiplocal /* = 0 */ ) void CCrowbar::Holster( int skiplocal /* = 0 */ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
@ -154,17 +147,19 @@ void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, f
void CCrowbar::PrimaryAttack() void CCrowbar::PrimaryAttack()
{ {
if( !m_flStartThrow ) if( m_fInAttack )
{ {
m_flStartThrow = gpGlobals->time; if( m_fInAttack == 1 && m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
m_flReleaseThrow = 0; {
SendWeaponAnim( CROWBAR_HOLD );
SendWeaponAnim( CROWBAR_AIM ); m_fInAttack = 2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.45f; }
} }
else if( m_flTimeWeaponIdle <= UTIL_WeaponTimeBase() ) else
{ {
SendWeaponAnim( CROWBAR_HOLD ); SendWeaponAnim( CROWBAR_AIM );
m_fInAttack = 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.4f;
} }
} }
@ -205,19 +200,18 @@ int CCrowbar::Swing( int fFirst )
} }
} }
#endif #endif
if( fFirst )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
0.0f, g_vecZero, g_vecZero, 0, 0, 0,
0, 0, 0 );
}
if( tr.flFraction >= 1.0f ) if( tr.flFraction >= 1.0f )
{ {
if( fFirst ) if( fFirst )
{ {
// miss // miss
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5 ; SendWeaponAnim( CROWBAR_RELEASEMISS );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/cbar_miss1.wav", 1, ATTN_NORM, 0, 94 + RANDOM_LONG( 0, 0xF ) );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
// player "shoot" animation // player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
} }
@ -334,36 +328,17 @@ int CCrowbar::Swing( int fFirst )
void CCrowbar::WeaponIdle( void ) void CCrowbar::WeaponIdle( void )
{ {
if( m_flReleaseThrow == 0 && m_flStartThrow )
m_flReleaseThrow = gpGlobals->time;
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
return; return;
if( m_flStartThrow ) if( m_fInAttack )
{ {
if( !Swing( 1 ) ) Swing( 0 );
{ m_fInAttack = 0;
SetThink( &CCrowbar::SwingAgain ); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
pev->nextthink = gpGlobals->time + 0.1f;
}
m_flReleaseThrow = 0;
m_flStartThrow = 0;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
return;
} }
else if( m_flReleaseThrow > 0 ) else
{ {
// we've finished the throw, restart. m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
m_flStartThrow = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flReleaseThrow = -1;
return;
} }
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 35.0 / 13.0;
SendWeaponAnim( CROWBAR_IDLE );
} }

50
dlls/glock.cpp

@ -45,20 +45,7 @@ void CGlock::Spawn()
m_iId = WEAPON_GLOCK; m_iId = WEAPON_GLOCK;
SET_MODEL( ENT( pev ), "models/w_9mmhandgun.mdl" ); SET_MODEL( ENT( pev ), "models/w_9mmhandgun.mdl" );
SetClipModel( "models/w_9mmclip.mdl" ); m_iDefaultAmmo = GLOCK_MAX_CLIP;
// ==========================================
// Code changes for- Night at the Office:
// ==========================================
//
// -Randomised Ammo. Picking up a gun from a fallen terrorist
// will not give you a pre-defined amount of bullets. The exact
// number is random (depending on the gun and clip size), which
// means the player will constantly need to keep a check on the
// ammo as it will no longer be 'comfortable' for the player to
// waste ammo.
m_iDefaultAmmo = DefaultAmmoBySkill( GLOCK_MAX_CLIP, gSkillData.iSkillLevel );
FallInit();// get ready to fall down. FallInit();// get ready to fall down.
} }
@ -69,7 +56,8 @@ void CGlock::Precache( void )
PRECACHE_MODEL( "models/w_9mmhandgun.mdl" ); PRECACHE_MODEL( "models/w_9mmhandgun.mdl" );
PRECACHE_MODEL( "models/p_9mmhandgun.mdl" ); PRECACHE_MODEL( "models/p_9mmhandgun.mdl" );
m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shell m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shell
m_iClipModel = PRECACHE_MODEL( "models/w_9mmclip.mdl" );
PRECACHE_SOUND( "items/9mmclip1.wav" ); PRECACHE_SOUND( "items/9mmclip1.wav" );
PRECACHE_SOUND( "items/9mmclip2.wav" ); PRECACHE_SOUND( "items/9mmclip2.wav" );
@ -223,17 +211,31 @@ void CGlock::Reload( void )
int iResult; int iResult;
if( m_iClip == 0 ) if( m_iClip != GLOCK_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0 )
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5f );
else
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5f );
if( iResult )
{ {
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle );
// Unblock primary attack. Vector vecShellVelocity = m_pPlayer->pev->velocity
m_fInAttack = 0; + gpGlobals->v_right * RANDOM_FLOAT( -10, 10 )
+ gpGlobals->v_forward * 23;
EjectClip( pev->origin + m_pPlayer->pev->view_ofs
+ gpGlobals->v_up * -22
+ gpGlobals->v_forward * 10
+ gpGlobals->v_right * 2, vecShellVelocity, pev->angles.y, m_iClipModel, TE_BOUNCE_SHELL );
if( m_iClip == 0 )
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5f );
else
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5f );
if( iResult )
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
// Unblock primary attack.
m_fInAttack = 0;
}
} }
} }

3
dlls/monsters.h

@ -75,7 +75,8 @@ extern DLL_GLOBAL Vector g_vecAttackDir;
extern DLL_GLOBAL CONSTANT float g_flMeleeRange; extern DLL_GLOBAL CONSTANT float g_flMeleeRange;
extern DLL_GLOBAL CONSTANT float g_flMediumRange; extern DLL_GLOBAL CONSTANT float g_flMediumRange;
extern DLL_GLOBAL CONSTANT float g_flLongRange; extern DLL_GLOBAL CONSTANT float g_flLongRange;
extern void EjectBrass(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ); extern void EjectBrass( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype );
extern void EjectClip( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype );
extern void ExplodeModel( const Vector &vecOrigin, float speed, int model, int count ); extern void ExplodeModel( const Vector &vecOrigin, float speed, int model, int count );
BOOL FBoxVisible( entvars_t *pevLooker, entvars_t *pevTarget ); BOOL FBoxVisible( entvars_t *pevLooker, entvars_t *pevTarget );

33
dlls/mp5.cpp

@ -40,17 +40,12 @@ LINK_ENTITY_TO_CLASS( weapon_9mmAR, CMP5 )
//========================================================= //=========================================================
//========================================================= //=========================================================
int CMP5::SecondaryAmmoIndex( void )
{
return m_iSecondaryAmmoType;
}
void CMP5::Spawn() void CMP5::Spawn()
{ {
pev->classname = MAKE_STRING( "weapon_9mmAR" ); // hack to allow for old names pev->classname = MAKE_STRING( "weapon_9mmAR" ); // hack to allow for old names
Precache(); Precache();
SET_MODEL( ENT( pev ), "models/w_AK47.mdl" ); SET_MODEL( ENT( pev ), "models/w_AK47.mdl" );
SetClipModel( "models/w_akclip.mdl" );
m_iId = WEAPON_MP5; m_iId = WEAPON_MP5;
@ -65,7 +60,7 @@ void CMP5::Spawn()
// ammo as it will no longer be 'comfortable' for the player to // ammo as it will no longer be 'comfortable' for the player to
// waste ammo. // waste ammo.
m_iDefaultAmmo = DefaultAmmoBySkill( MP5_MAX_CLIP, gSkillData.iSkillLevel ); m_iDefaultAmmo = RANDOM_LONG( 1, 37 );
FallInit();// get ready to fall down. FallInit();// get ready to fall down.
} }
@ -76,11 +71,11 @@ void CMP5::Precache( void )
PRECACHE_MODEL( "models/w_AK47.mdl" ); PRECACHE_MODEL( "models/w_AK47.mdl" );
PRECACHE_MODEL( "models/p_AK47.mdl" ); PRECACHE_MODEL( "models/p_AK47.mdl" );
m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shellTE_MODEL m_iShell = PRECACHE_MODEL( "models/shell.mdl" );// brass shellTE_MODEL
m_iClipModel = PRECACHE_MODEL( "models/w_akclip.mdl" );
PRECACHE_MODEL( "models/grenade.mdl" ); // grenade PRECACHE_MODEL( "models/grenade.mdl" ); // grenade
PRECACHE_MODEL( "models/w_akclip.mdl" );
PRECACHE_SOUND( "items/9mmclip1.wav" ); PRECACHE_SOUND( "items/9mmclip1.wav" );
PRECACHE_SOUND( "items/clipinsert1.wav" ); PRECACHE_SOUND( "items/clipinsert1.wav" );
@ -96,7 +91,7 @@ void CMP5::Precache( void )
PRECACHE_SOUND( "weapons/357_cock1.wav" ); PRECACHE_SOUND( "weapons/357_cock1.wav" );
m_usMP5 = PRECACHE_EVENT( 1, "events/mp5.sc" ); m_usMP5 = PRECACHE_EVENT( 1, "events/mp5.sc" );
m_usMP52 = PRECACHE_EVENT( 1, "events/mp52.sc" ); // m_usMP52 = PRECACHE_EVENT( 1, "events/mp52.sc" );
} }
int CMP5::GetItemInfo( ItemInfo *p ) int CMP5::GetItemInfo( ItemInfo *p )
@ -208,6 +203,20 @@ void CMP5::Reload( void )
return; return;
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5f ); DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5f );
if( m_iClip != MP5_MAX_CLIP && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0)
{
UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle );
Vector vecShellVelocity = m_pPlayer->pev->velocity
+ gpGlobals->v_right * RANDOM_FLOAT( -10, 10 )
+ gpGlobals->v_forward * 23;
EjectClip( pev->origin + m_pPlayer->pev->view_ofs
+ gpGlobals->v_up * -22
+ gpGlobals->v_forward * 10
+ gpGlobals->v_right * 2, vecShellVelocity, pev->angles.y, m_iClipModel, TE_BOUNCE_SHELL );
}
} }
void CMP5::WeaponIdle( void ) void CMP5::WeaponIdle( void )
@ -236,12 +245,6 @@ void CMP5::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again. m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
} }
BOOL CMP5::IsUseable()
{
//Can be used if the player has AR grenades. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0;
}
class CMP5AmmoClip : public CBasePlayerAmmo class CMP5AmmoClip : public CBasePlayerAmmo
{ {
void Spawn( void ) void Spawn( void )

30
dlls/noffice/flashlightspot.h

@ -1,30 +0,0 @@
/***
*
* 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.
*
****/
#ifndef FLASHLIGHTSPOT_H
#define FLASHLIGHTSPOT_H
class CFlashlightSpot : public CLaserSpot
{
public:
void Spawn(void);
void Precache(void);
virtual int ObjectCaps(void) { return FCAP_ACROSS_TRANSITION; }
static CFlashlightSpot *CreateSpot(void);
};
#endif // FLASHLIGHTSPOT_H

41
dlls/noffice/holster.cpp

@ -34,15 +34,15 @@ enum holster_e {
HOLSTER_ATTACK3MISS, HOLSTER_ATTACK3MISS,
HOLSTER_ATTACK3HIT, HOLSTER_ATTACK3HIT,
HOLSTER_IDLE2, HOLSTER_IDLE2,
HOLSTER_IDLE3, HOLSTER_IDLE3
}; };
LINK_ENTITY_TO_CLASS(weapon_holster, CHolster); LINK_ENTITY_TO_CLASS( weapon_holster, CHolster )
void CHolster::Spawn() void CHolster::Spawn()
{ {
Precache(); Precache();
SET_MODEL(ENT(pev), "models/w_holster.mdl"); SET_MODEL( ENT( pev ), "models/w_holster.mdl" );
m_iId = WEAPON_HOLSTER; m_iId = WEAPON_HOLSTER;
m_iClip = -1; m_iClip = -1;
@ -50,16 +50,16 @@ void CHolster::Spawn()
} }
void CHolster::Precache(void) void CHolster::Precache()
{ {
PRECACHE_MODEL("models/v_holster.mdl"); PRECACHE_MODEL( "models/v_holster.mdl" );
PRECACHE_MODEL("models/w_holster.mdl"); PRECACHE_MODEL( "models/w_holster.mdl" );
PRECACHE_MODEL("models/p_holster.mdl"); PRECACHE_MODEL( "models/p_holster.mdl" );
} }
int CHolster::GetItemInfo(ItemInfo *p) int CHolster::GetItemInfo( ItemInfo *p )
{ {
p->pszName = STRING(pev->classname); p->pszName = STRING( pev->classname );
p->pszAmmo1 = NULL; p->pszAmmo1 = NULL;
p->iMaxAmmo1 = -1; p->iMaxAmmo1 = -1;
p->pszAmmo2 = NULL; p->pszAmmo2 = NULL;
@ -73,12 +73,12 @@ int CHolster::GetItemInfo(ItemInfo *p)
return 1; return 1;
} }
int CHolster::AddToPlayer(CBasePlayer *pPlayer) int CHolster::AddToPlayer( CBasePlayer *pPlayer )
{ {
if (CBasePlayerWeapon::AddToPlayer(pPlayer)) if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{ {
MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev); MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE(m_iId); WRITE_BYTE( m_iId );
MESSAGE_END(); MESSAGE_END();
return TRUE; return TRUE;
} }
@ -87,20 +87,13 @@ int CHolster::AddToPlayer(CBasePlayer *pPlayer)
BOOL CHolster::Deploy() BOOL CHolster::Deploy()
{ {
return DefaultDeploy("models/v_holster.mdl", "models/p_holster.mdl", HOLSTER_DRAW, "holster"); return DefaultDeploy( "models/v_holster.mdl", "models/p_holster.mdl", HOLSTER_DRAW, "holster" );
} }
void CHolster::Holster(int skiplocal /*= 0*/) void CHolster::Holster( int skiplocal /*= 0*/ )
{ {
SendWeaponAnim( HOLSTER_HOLSTER );
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
} }
void CHolster::WeaponIdle(void)
{
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
SendWeaponAnim(HOLSTER_IDLE);
m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); // how long till we do this again.
}

62
dlls/noffice/lightspot.cpp

@ -0,0 +1,62 @@
/***
*
* 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"
LINK_ENTITY_TO_CLASS( light_spot2, CLightSpot )
//=========================================================
//=========================================================
CLightSpot *CLightSpot::CreateSpot( void )
{
CLightSpot *pSpot = GetClassPtr( (CLightSpot *)NULL );
pSpot->Spawn();
pSpot->pev->classname = MAKE_STRING( "light_spot2" );
return pSpot;
}
//=========================================================
//=========================================================
void CLightSpot::Spawn( void )
{
Precache();
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->rendermode = kRenderTransAdd;
pev->renderfx = kRenderFxNoDissipation;
SetBits( pev->effects, EF_DIMLIGHT );
pev->renderamt = 185;
SET_MODEL( ENT( pev ), "sprites/beam.spr" );
UTIL_SetOrigin( pev, pev->origin );
}
void CLightSpot::Precache( void )
{
PRECACHE_MODEL( "sprites/beam.spr" );
}

273
dlls/noffice/torch.cpp

@ -22,9 +22,6 @@
#include "player.h" #include "player.h"
#include "soundent.h" #include "soundent.h"
#include "gamerules.h" #include "gamerules.h"
#include "flashlightspot.h"
extern int gmsgGlow;
enum torch_e { enum torch_e {
TORCH_IDLE_OFF = 0, TORCH_IDLE_OFF = 0,
@ -32,97 +29,36 @@ enum torch_e {
TORCH_IDLE_ON, TORCH_IDLE_ON,
TORCH_SWITCH, TORCH_SWITCH,
TORCH_HOLSTER_OFF, TORCH_HOLSTER_OFF,
TORCH_HOLSTER_ON, TORCH_HOLSTER_ON
};
LINK_ENTITY_TO_CLASS(weapon_torch, CTorch);
#ifndef CLIENT_DLL
TYPEDESCRIPTION CTorch::m_SaveData[] =
{
DEFINE_FIELD(CTorch, m_pSpot, FIELD_CLASSPTR),
DEFINE_FIELD(CTorch, m_pGlow, FIELD_CLASSPTR),
DEFINE_FIELD(CTorch, m_fIsOn, FIELD_BOOLEAN),
}; };
int CTorch::Save(CSave &save) LINK_ENTITY_TO_CLASS( weapon_torch, CTorch )
{
if (!CBasePlayerWeapon::Save(save))
return 0;
return save.WriteFields("TORCH", this, m_SaveData, ARRAYSIZE(m_SaveData));
}
int CTorch::Restore(CRestore &restore)
{
if (!CBasePlayerWeapon::Restore(restore))
return 0;
int status = restore.ReadFields("TORCH", this, m_SaveData, ARRAYSIZE(m_SaveData));
if (status)
{
if (m_fIsOn)
{
m_fUpdate = TRUE;
}
}
return status;
}
#endif
void CTorch::Spawn() void CTorch::Spawn()
{ {
Precache(); Precache();
SET_MODEL(ENT(pev), "models/w_torch.mdl"); SET_MODEL( ENT( pev ), "models/w_torch.mdl" );
m_iId = WEAPON_TORCH; m_iId = WEAPON_TORCH;
m_iClip = -1; m_iClip = -1;
m_fIsOn = FALSE;
m_fUpdate = FALSE;
#ifndef CLIENT_DLL
m_pSpot = NULL;
m_pGlow = NULL;
#endif
FallInit();// get ready to fall down. FallInit();// get ready to fall down.
} }
void CTorch::Precache()
void CTorch::Precache(void)
{ {
PRECACHE_MODEL("models/v_torch.mdl"); PRECACHE_MODEL( "models/v_torch.mdl" );
PRECACHE_MODEL("models/w_torch.mdl"); PRECACHE_MODEL( "models/w_torch.mdl" );
PRECACHE_MODEL("models/p_torch.mdl"); PRECACHE_MODEL( "models/p_torch.mdl" );
PRECACHE_SOUND( SOUND_FLASHLIGHT_ON ); PRECACHE_SOUND( "items/flashlight1.wav" );
PRECACHE_MODEL("sprites/glow01.spr"); UTIL_PrecacheOther( "light_spot2" );
PRECACHE_MODEL("sprites/glow02.spr"); UTIL_PrecacheOther( "wall_spot2" );
PRECACHE_MODEL("sprites/glow03.spr");
PRECACHE_MODEL("sprites/glow04.spr");
PRECACHE_MODEL("sprites/glow05.spr");
PRECACHE_MODEL("sprites/flare1.spr");
PRECACHE_MODEL("sprites/flare2.spr");
PRECACHE_MODEL("sprites/flare3.spr");
PRECACHE_MODEL("sprites/flare4.spr");
PRECACHE_MODEL("sprites/flare5.spr");
PRECACHE_MODEL("sprites/flare6.spr");
PRECACHE_MODEL("sprites/blueflare1.spr");
m_usTorch = PRECACHE_EVENT(1, "events/torch.sc");
UTIL_PrecacheOther( "flashlight_spot" );
} }
int CTorch::GetItemInfo(ItemInfo *p) int CTorch::GetItemInfo( ItemInfo *p )
{ {
p->pszName = STRING(pev->classname); p->pszName = STRING( pev->classname );
p->pszAmmo1 = NULL; p->pszAmmo1 = NULL;
p->iMaxAmmo1 = -1; p->iMaxAmmo1 = -1;
p->pszAmmo2 = NULL; p->pszAmmo2 = NULL;
@ -136,12 +72,12 @@ int CTorch::GetItemInfo(ItemInfo *p)
return 1; return 1;
} }
int CTorch::AddToPlayer(CBasePlayer *pPlayer) int CTorch::AddToPlayer( CBasePlayer *pPlayer )
{ {
if (CBasePlayerWeapon::AddToPlayer(pPlayer)) if( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{ {
MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev); MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE(m_iId); WRITE_BYTE( m_iId );
MESSAGE_END(); MESSAGE_END();
return TRUE; return TRUE;
} }
@ -150,180 +86,73 @@ int CTorch::AddToPlayer(CBasePlayer *pPlayer)
BOOL CTorch::Deploy() BOOL CTorch::Deploy()
{ {
return DefaultDeploy("models/v_torch.mdl", "models/p_torch.mdl", TORCH_DRAW, "torch"); return DefaultDeploy( "models/v_torch.mdl", "models/p_torch.mdl", TORCH_DRAW, "torch" );
} }
void CTorch::Holster(int skiplocal /*= 0*/) void CTorch::Holster( int skiplocal /*= 0*/ )
{ {
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; if( m_fIsOn )
PrimaryAttack();
if ( m_fIsOn ) SendWeaponAnim( TORCH_HOLSTER_OFF );
TurnOff();
SendWeaponAnim(TORCH_HOLSTER_OFF); m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
} }
void CTorch::PrimaryAttack() void CTorch::PrimaryAttack()
{ {
// don't fire underwater SendWeaponAnim( TORCH_SWITCH );
if (m_pPlayer->pev->waterlevel == 3)
{
m_flNextPrimaryAttack = 0.15;
return;
}
int flags;
#if defined( CLIENT_WEAPONS )
flags = FEV_NOTHOST;
#else
flags = 0;
#endif
ToggleFlashlight();
PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usTorch, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, m_fIsOn, 0);
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15);
UpdateSpot();
}
void CTorch::WeaponIdle(void)
{
UpdateSpot();
if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase())
return;
int iAnim;
if (m_fIsOn)
iAnim = TORCH_IDLE_ON;
else
iAnim = TORCH_IDLE_OFF;
SendWeaponAnim(iAnim);
m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); // how long till we do this again.
}
void CTorch::TurnOn(void)
{
m_fIsOn = TRUE;
#ifndef CLIENT_DLL
if (!m_pSpot)
{
m_pSpot = CFlashlightSpot::CreateSpot();
}
MESSAGE_BEGIN(MSG_ONE, gmsgGlow, NULL, m_pPlayer->pev);
WRITE_BYTE(1);
MESSAGE_END();
#endif
m_pPlayer->pev->effects |= EF_DIMLIGHT; EMIT_SOUND( ENT( pev ), CHAN_VOICE, "items/flashlight1.wav", VOL_NORM, ATTN_NORM );
}
void CTorch::TurnOff(void) m_fIsOn = ( m_fIsOn == FALSE );
{
m_fIsOn = FALSE;
#ifndef CLIENT_DLL if( !m_fIsOn )
if (m_pSpot)
{ {
m_pSpot->Killed(NULL, GIB_NORMAL); SetBits( m_pLightSpot->pev->effects, EF_NODRAW );
m_pSpot = NULL; ClearBits( m_pLightSpot->pev->effects, EF_DIMLIGHT );
}
if (m_pGlow) SetBits( m_pWallSpot->pev->effects, EF_NODRAW );
{
UTIL_Remove(m_pGlow);
m_pGlow = NULL;
} }
MESSAGE_BEGIN(MSG_ONE, gmsgGlow, NULL, m_pPlayer->pev); m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4f;
WRITE_BYTE(0);
MESSAGE_END();
#endif
m_pPlayer->pev->effects &= ~EF_DIMLIGHT;
} }
void CTorch::ToggleFlashlight(void) void CTorch::WeaponIdle()
{ {
if (!m_fIsOn) UpdateSpot();
TurnOn();
else
TurnOff();
}
#define TORCH_TRACE_DISTANCE 144
#define TORCH_SPOT_MAX_ALPHA 128
#define TORCH_GLOW_MAX_ALPHA 200 m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; // how long till we do this again.
}
void CTorch::UpdateSpot(void) void CTorch::UpdateSpot()
{ {
if( m_fIsOn )
#ifndef CLIENT_DLL
if (m_fUpdate)
{ {
TurnOn(); if( !m_pLightSpot )
m_fUpdate = FALSE;
}
if (m_fIsOn && m_pSpot)
{
if (!m_pSpot)
{ {
m_pSpot = CFlashlightSpot::CreateSpot(); m_pLightSpot = CLightSpot::CreateSpot();
m_pWallSpot = CWallSpot::CreateSpot();
} }
else
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecAiming = gpGlobals->v_forward;
TraceResult tr;
UTIL_TraceLine(vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr);
UTIL_SetOrigin(m_pSpot->pev, tr.vecEndPos);
if (!m_pGlow)
{ {
m_pGlow = CSprite::SpriteCreate("sprites/flare1.spr", pev->origin, FALSE); ClearBits( m_pLightSpot->pev->effects, EF_NODRAW );
m_pGlow->SetTransparency(kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation); SetBits( m_pLightSpot->pev->effects, EF_DIMLIGHT );
m_pGlow->SetScale(1.0f);
}
UTIL_SetOrigin(m_pGlow->pev, tr.vecEndPos);
if (UTIL_PointContents(tr.vecEndPos) == CONTENTS_SKY) ClearBits( m_pWallSpot->pev->effects, EF_NODRAW );
{
m_pSpot->pev->renderamt = 0;
m_pGlow->SetBrightness(0);
} }
else
{
m_pSpot->pev->renderamt = TORCH_SPOT_MAX_ALPHA;
float dist = (tr.vecEndPos - vecSrc).Length(); UTIL_MakeVectors( m_pPlayer->pev->v_angle );
float brightness; Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecAiming = gpGlobals->v_forward;
if (dist < TORCH_TRACE_DISTANCE) TraceResult tr;
brightness = ((TORCH_TRACE_DISTANCE - dist) * TORCH_GLOW_MAX_ALPHA) / TORCH_TRACE_DISTANCE;
else
brightness = 0;
m_pGlow->SetBrightness(brightness); UTIL_SetOrigin( m_pLightSpot->pev, vecSrc + vecAiming * 10.0f );
// ALERT(at_console, "Server: Glow brightness: %f\n", brightness); UTIL_TraceLine( vecSrc, vecSrc + vecAiming * 250.0f, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
}
UTIL_SetOrigin( m_pWallSpot->pev, tr.vecEndPos );
} }
#endif
} }

40
dlls/noffice/flashlightspot.cpp → dlls/noffice/wallspot.cpp

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2001, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -16,43 +16,45 @@
#include "extdll.h" #include "extdll.h"
#include "util.h" #include "util.h"
#include "cbase.h" #include "cbase.h"
#include "monsters.h"
#include "weapons.h" #include "weapons.h"
#include "nodes.h"
#include "player.h" #include "player.h"
#include "gamerules.h" #include "gamerules.h"
#include "flashlightspot.h"
LINK_ENTITY_TO_CLASS(flashlight_spot, CFlashlightSpot); LINK_ENTITY_TO_CLASS( wall_spot, CWallSpot )
//========================================================= //=========================================================
//========================================================= //=========================================================
CFlashlightSpot *CFlashlightSpot::CreateSpot(void) CWallSpot *CWallSpot::CreateSpot( void )
{ {
CFlashlightSpot *pSpot = GetClassPtr((CFlashlightSpot *)NULL); CWallSpot *pSpot = GetClassPtr( (CWallSpot *)NULL );
pSpot->Spawn(); pSpot->Spawn();
pSpot->pev->classname = MAKE_STRING("flashlight_spot"); pSpot->pev->classname = MAKE_STRING( "wall_spot" );
return pSpot; return pSpot;
} }
//========================================================= //=========================================================
//========================================================= //=========================================================
void CFlashlightSpot::Spawn(void) void CWallSpot::Spawn( void )
{ {
Precache(); Precache();
pev->movetype = MOVETYPE_NONE; pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
pev->rendermode = kRenderGlow; // kRenderGlow pev->rendermode = kRenderGlow;
pev->renderfx = kRenderFxNoDissipation; pev->renderfx = kRenderFxNoDissipation;
pev->renderamt = 128; pev->scale = 4.0f;
pev->scale = 4; pev->renderamt = 90;
SET_MODEL(ENT(pev), "sprites/beam2.spr"); SET_MODEL( ENT( pev ), "sprites/beam2.spr" );
UTIL_SetOrigin(pev, pev->origin); UTIL_SetOrigin( pev, pev->origin );
}; }
void CFlashlightSpot::Precache(void) void CWallSpot::Precache( void )
{ {
PRECACHE_MODEL("sprites/beam2.spr"); PRECACHE_MODEL( "sprites/beam2.spr" );
}; }

66
dlls/player.cpp

@ -193,7 +193,6 @@ int gmsgStatusText = 0;
int gmsgStatusValue = 0; int gmsgStatusValue = 0;
int gmsgCinematic = 0; int gmsgCinematic = 0;
int gmsgGlow = 0;
int gmsgDeathVision = 0; int gmsgDeathVision = 0;
void LinkUserMessages( void ) void LinkUserMessages( void )
@ -244,7 +243,6 @@ void LinkUserMessages( void )
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
gmsgCinematic = REG_USER_MSG( "Cinematic", 1 ); gmsgCinematic = REG_USER_MSG( "Cinematic", 1 );
gmsgGlow = REG_USER_MSG( "Glow", 1 );
gmsgDeathVision = REG_USER_MSG( "DeathVision", 1 ); gmsgDeathVision = REG_USER_MSG( "DeathVision", 1 );
} }
@ -3223,10 +3221,34 @@ BOOL CBasePlayer::FlashlightIsOn( void )
void CBasePlayer::FlashlightTurnOn( void ) void CBasePlayer::FlashlightTurnOn( void )
{ {
if( !g_pGameRules->FAllowFlashlight() )
{
return;
}
if( (pev->weapons & ( 1 << WEAPON_SUIT ) ) )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, SOUND_FLASHLIGHT_ON, 1.0, ATTN_NORM, 0, PITCH_NORM );
SetBits( pev->effects, EF_DIMLIGHT );
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
WRITE_BYTE( 1 );
WRITE_BYTE( m_iFlashBattery );
MESSAGE_END();
m_flFlashLightTime = FLASH_DRAIN_TIME + gpGlobals->time;
}
} }
void CBasePlayer::FlashlightTurnOff( void ) void CBasePlayer::FlashlightTurnOff( void )
{ {
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, 1.0, ATTN_NORM, 0, PITCH_NORM );
ClearBits( pev->effects, EF_DIMLIGHT );
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
WRITE_BYTE( 0 );
WRITE_BYTE( m_iFlashBattery );
MESSAGE_END();
m_flFlashLightTime = FLASH_CHARGE_TIME + gpGlobals->time;
} }
/* /*
@ -3299,15 +3321,6 @@ void CBasePlayer::ImpulseCommands()
gmsgLogo = 0; gmsgLogo = 0;
break; break;
case 100: case 100:
{
// If the player has the torch and is not using it,
// requested to turn on the flashlight,
// change weapon to flashlight.
if( ( pev->weapons & ( 1 << WEAPON_TORCH ) ) && m_pActiveItem && !FClassnameIs( m_pActiveItem->pev, "weapon_torch" ) )
{
SwitchToFlashlight();
}
}
case 201: case 201:
// paint decal // paint decal
if( gpGlobals->time < m_flNextDecalTime ) if( gpGlobals->time < m_flNextDecalTime )
@ -3677,16 +3690,6 @@ void CBasePlayer::ItemPostFrame()
if( m_pTank != 0 ) if( m_pTank != 0 )
return; return;
if( m_pActiveItem )
{
CBasePlayerWeapon*pWeapon = (CBasePlayerWeapon*)m_pActiveItem;
// This function always gets called to update the current weapon,
// regardless of next attack time.
if( pWeapon )
pWeapon->ItemPostFrame_Always();
}
#if defined( CLIENT_WEAPONS ) #if defined( CLIENT_WEAPONS )
if( m_flNextAttack > 0 ) if( m_flNextAttack > 0 )
#else #else
@ -4593,27 +4596,6 @@ void CBasePlayer::UpdateStamina( void )
// ALERT( at_console, "Player stamina level: %d\n", m_iStaminaLevel ); // ALERT( at_console, "Player stamina level: %d\n", m_iStaminaLevel );
} }
void CBasePlayer::SwitchToFlashlight( void )
{
// go through all of the weapons and find the torch weapon.
for( int i = 0; i < MAX_ITEM_TYPES; i++ )
{
CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[i];
while( pPlayerItem )
{
if( pPlayerItem && pPlayerItem->m_iId == WEAPON_TORCH )
{
// Switch to torch.
SwitchWeapon( pPlayerItem );
return;
}
pPlayerItem = pPlayerItem->m_pNext;
}
}
}
//========================================================= //=========================================================
// Dead HEV suit prop // Dead HEV suit prop
//========================================================= //=========================================================

2
dlls/player.h

@ -326,8 +326,6 @@ public:
int m_iAutoWepSwitch; int m_iAutoWepSwitch;
void SwitchToFlashlight( void );
void UpdateStamina( void ); void UpdateStamina( void );
int m_iStaminaLevel; int m_iStaminaLevel;
float m_flStaminaStart; float m_flStaminaStart;

13
dlls/shotgun.cpp

@ -49,18 +49,7 @@ void CShotgun::Spawn()
m_iId = WEAPON_SHOTGUN; m_iId = WEAPON_SHOTGUN;
SET_MODEL( ENT( pev ), "models/w_shotgun.mdl" ); SET_MODEL( ENT( pev ), "models/w_shotgun.mdl" );
// ========================================== m_iDefaultAmmo = SHOTGUN_DEFAULT_GIVE;
// Code changes for- Night at the Office:
// ==========================================
//
// -Randomised Ammo. Picking up a gun from a fallen terrorist
// will not give you a pre-defined amount of bullets. The exact
// number is random (depending on the gun and clip size), which
// means the player will constantly need to keep a check on the
// ammo as it will no longer be 'comfortable' for the player to
// waste ammo.
m_iDefaultAmmo = DefaultAmmoBySkill( SHOTGUN_MAX_CLIP, gSkillData.iSkillLevel );
FallInit();// get ready to fall FallInit();// get ready to fall
} }

109
dlls/weapons.cpp

@ -206,6 +206,24 @@ void EjectBrass( const Vector &vecOrigin, const Vector &vecVelocity, float rotat
MESSAGE_END(); MESSAGE_END();
} }
void EjectClip( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype )
{
// FIX: when the player shoots, their gun isn't in the same position as it is on the model other players see.
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecOrigin );
WRITE_BYTE( TE_MODEL );
WRITE_COORD( vecOrigin.x );
WRITE_COORD( vecOrigin.y );
WRITE_COORD( vecOrigin.z );
WRITE_COORD( vecVelocity.x );
WRITE_COORD( vecVelocity.y );
WRITE_COORD( vecVelocity.z );
WRITE_ANGLE( rotation );
WRITE_SHORT( model );
WRITE_BYTE( soundtype );
WRITE_BYTE( 405 );// 40.5 seconds
MESSAGE_END();
}
#if 0 #if 0
// UNDONE: This is no longer used? // UNDONE: This is no longer used?
void ExplodeModel( const Vector &vecOrigin, float speed, int model, int count ) void ExplodeModel( const Vector &vecOrigin, float speed, int model, int count )
@ -391,8 +409,6 @@ TYPEDESCRIPTION CBasePlayerWeapon::m_SaveData[] =
DEFINE_FIELD( CBasePlayerWeapon, m_iDefaultAmmo, FIELD_INTEGER ), DEFINE_FIELD( CBasePlayerWeapon, m_iDefaultAmmo, FIELD_INTEGER ),
//DEFINE_FIELD( CBasePlayerWeapon, m_iClientClip, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly //DEFINE_FIELD( CBasePlayerWeapon, m_iClientClip, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly
//DEFINE_FIELD( CBasePlayerWeapon, m_iClientWeaponState, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly //DEFINE_FIELD( CBasePlayerWeapon, m_iClientWeaponState, FIELD_INTEGER ), reset to zero on load so hud gets updated correctly
DEFINE_FIELD( CBasePlayerWeapon, m_iszClipModel, FIELD_STRING ),
DEFINE_FIELD( CBasePlayerWeapon, m_flDropClipTime, FIELD_TIME ),
}; };
IMPLEMENT_SAVERESTORE( CBasePlayerWeapon, CBasePlayerItem ) IMPLEMENT_SAVERESTORE( CBasePlayerWeapon, CBasePlayerItem )
@ -966,12 +982,6 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
// Drop an instance of current weapon clip on the ground.
if( !FStringNull( GetClipModel() ) )
{
m_flDropClipTime = gpGlobals->time + GetDropClipDelay();
}
return TRUE; return TRUE;
} }
@ -1148,80 +1158,6 @@ void CBasePlayerWeapon::RetireWeapon( void )
} }
} }
void CBasePlayerWeapon::ItemPostFrame_Always( void )
{
// Check if it is time to drop the clip.
if( m_fInReload && m_flDropClipTime != 0 && m_flDropClipTime <= gpGlobals->time )
{
DropClip();
m_flDropClipTime = 0;
}
}
// ==========================================
// Code changes for- Night at the Office:
// ==========================================
//
// -Randomised Ammo. Picking up a gun from a fallen terrorist
// will not give you a pre-defined amount of bullets. The exact
// number is random (depending on the gun and clip size), which
// means the player will constantly need to keep a check on the
// ammo as it will no longer be 'comfortable' for the player to
// waste ammo.
int CBasePlayerWeapon::DefaultAmmoBySkill(int iMaxClip, int iSkillLevel)
{
int iDefaultAmmo = 0;
switch( iSkillLevel )
{
default:
case SKILL_EASY:
// Random ammunition equal or superior to 75% clip capacity.
iDefaultAmmo = RANDOM_LONG( (int)( ceilf( iMaxClip * 0.75f ) ), iMaxClip );
break;
case SKILL_MEDIUM:
// Random ammunition equal or superior to 50% clip capacity.
iDefaultAmmo = RANDOM_LONG( (int)( ceilf( iMaxClip * 0.5f ) ), iMaxClip );
break;
case SKILL_HARD:
// Random ammunition equal or superior to 25% clip capacity.
iDefaultAmmo = RANDOM_LONG( (int)( ceilf( iMaxClip * 0.25f ) ), iMaxClip );
break;
}
return iDefaultAmmo;
}
string_t CBasePlayerWeapon::GetClipModel() const
{
return m_iszClipModel;
}
void CBasePlayerWeapon::SetClipModel( const char* szModel )
{
m_iszClipModel = ALLOC_STRING( szModel );
}
// ==========================================
// Code changes for- Night at the Office:
// ==========================================
//
// -Clip Dropping. An extension of the realistic reloading.
// Whenever a gun with a weapon clip is reloaded, a clip
// model is 'ejected' onto the floor.
void CBasePlayerWeapon::DropClip( void )
{
UTIL_MakeVectors( m_pPlayer->pev->angles );
CWeaponClip *pClip = GetClassPtr( (CWeaponClip *)NULL );
pClip->pev->angles.x = pClip->pev->angles.z = 0;
pClip->pev->origin = pev->origin + gpGlobals->v_forward * -16;
pClip->Spawn( STRING( GetClipModel() ) );
pClip->pev->owner = edict();
pClip->pev->avelocity = Vector( RANDOM_FLOAT( 200, 400 ), RANDOM_FLOAT( 200, 400 ), 0.0f );
}
float CBasePlayerWeapon::GetNextAttackDelay( float delay ) float CBasePlayerWeapon::GetNextAttackDelay( float delay )
{ {
if( m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1.0f ) if( m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1.0f )
@ -1696,3 +1632,12 @@ TYPEDESCRIPTION CSatchel::m_SaveData[] =
}; };
IMPLEMENT_SAVERESTORE( CSatchel, CBasePlayerWeapon )*/ IMPLEMENT_SAVERESTORE( CSatchel, CBasePlayerWeapon )*/
TYPEDESCRIPTION CTorch::m_SaveData[] =
{
DEFINE_FIELD( CTorch, m_pLightSpot, FIELD_CLASSPTR ),
DEFINE_FIELD( CTorch, m_pWallSpot, FIELD_CLASSPTR ),
DEFINE_FIELD( CTorch, m_fIsOn, FIELD_BOOLEAN )
};
IMPLEMENT_SAVERESTORE( CTorch, CBasePlayerWeapon )

52
dlls/weapons.h

@ -296,18 +296,6 @@ public:
// hle time creep vars // hle time creep vars
float m_flPrevPrimaryAttack; float m_flPrevPrimaryAttack;
float m_flLastFireTime; float m_flLastFireTime;
virtual void ItemPostFrame_Always( void );
virtual int DefaultAmmoBySkill( int iMaxClip, int iSkillLevel );
virtual string_t GetClipModel() const;
void SetClipModel( const char* szModel );
void DropClip( void );
virtual float GetDropClipDelay( void ) const { return 0.0f; }
string_t m_iszClipModel;
float m_flDropClipTime;
}; };
class CBasePlayerAmmo : public CBaseEntity class CBasePlayerAmmo : public CBaseEntity
@ -440,9 +428,9 @@ public:
#endif #endif
} }
float GetDropClipDelay() const { return 0.72f; }
private: private:
int m_iShell; int m_iShell;
int m_iClipModel;
int m_fInAttack; int m_fInAttack;
unsigned short m_usFireGlock1; unsigned short m_usFireGlock1;
@ -470,8 +458,7 @@ public:
int m_iSwing; int m_iSwing;
TraceResult m_trHit; TraceResult m_trHit;
float m_flReleaseThrow; int m_fInAttack;
float m_flStartThrow;
virtual BOOL UseDecrement( void ) virtual BOOL UseDecrement( void )
{ {
#if defined( CLIENT_WEAPONS ) #if defined( CLIENT_WEAPONS )
@ -481,7 +468,6 @@ public:
#endif #endif
} }
BOOL CanHolster( void );
void WeaponIdle( void ); void WeaponIdle( void );
private: private:
@ -530,13 +516,12 @@ public:
void PrimaryAttack( void ); void PrimaryAttack( void );
void SecondaryAttack( void ); void SecondaryAttack( void );
int SecondaryAmmoIndex( void );
BOOL Deploy( void ); BOOL Deploy( void );
void Reload( void ); void Reload( void );
void WeaponIdle( void ); void WeaponIdle( void );
BOOL IsUseable();
float m_flNextAnimTime; float m_flNextAnimTime;
int m_iShell; int m_iShell;
int m_iClipModel;
virtual BOOL UseDecrement( void ) virtual BOOL UseDecrement( void )
{ {
@ -547,8 +532,6 @@ public:
#endif #endif
} }
float GetDropClipDelay() const { return 0.4f; }
private: private:
unsigned short m_usMP5; unsigned short m_usMP5;
unsigned short m_usMP52; unsigned short m_usMP52;
@ -641,6 +624,22 @@ public:
static CLaserSpot *CreateSpot( void ); static CLaserSpot *CreateSpot( void );
}; };
class CLightSpot : public CLaserSpot
{
void Spawn( void );
void Precache( void );
public:
static CLightSpot *CreateSpot( void );
};
class CWallSpot : public CLaserSpot
{
void Spawn( void );
void Precache( void );
public:
static CWallSpot *CreateSpot( void );
};
class CRpg : public CBasePlayerWeapon class CRpg : public CBasePlayerWeapon
{ {
public: public:
@ -983,7 +982,6 @@ public:
BOOL Deploy( void ); BOOL Deploy( void );
void Holster( int skiplocal = 0 ); void Holster( int skiplocal = 0 );
void WeaponIdle( void );
virtual BOOL UseDecrement( void ) virtual BOOL UseDecrement( void )
{ {
@ -1025,19 +1023,11 @@ public:
#endif #endif
} }
void TurnOn( void );
void TurnOff( void );
void ToggleFlashlight( void );
void UpdateSpot( void ); void UpdateSpot( void );
CLaserSpot* m_pSpot; CLightSpot *m_pLightSpot;
CSprite* m_pGlow; CWallSpot *m_pWallSpot;
BOOL m_fIsOn; BOOL m_fIsOn;
BOOL m_fUpdate;
private:
unsigned short m_usTorch;
}; };
#endif // WEAPONS_H #endif // WEAPONS_H

Loading…
Cancel
Save