- Updates from Puzl with latest version of the game (my backups were old compared to his working copy).

- Removed really strict anti exploit detection (that was never used)
- This should be the latest released version of NS!
This commit is contained in:
Flayra 2014-01-14 11:43:04 -08:00
parent a3194c3cd0
commit af3128ec1a
142 changed files with 91371 additions and 89440 deletions

Binary file not shown.

Binary file not shown.

View file

@ -26,6 +26,7 @@
#include "ammohistory.h"
#include "vgui_TeamFortressViewport.h"
#include "mod/AvHClientVariables.h"
#include "mod/AvHSharedUtil.h"
#include "mod/AvHScrollHandler.h"
#include "mod/AvHNetworkMessages.h"
@ -41,10 +42,26 @@ WeaponsResource gWR;
int g_weaponselect = 0;
extern bool gCanMove;
void IN_AttackDownForced(void);
void IN_AttackUpForced(void);
void IN_Attack2Down(void);
void IN_Attack2Up(void);
void IN_ReloadDown();
void IN_ReloadUp();
bool CheckInAttack(void);
//Equivalent to DECLARE_COMMAND(lastinv,LastInv) except we use gWR instead of gHud
void __CmdFunc_LastInv(void)
{ gWR.UserCmd_LastInv(); }
// +movement
void __CmdFunc_MovementOn(void)
{ gWR.UserCmd_MovementOn(); }
void __CmdFunc_MovementOff(void)
{ gWR.UserCmd_MovementOff(); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WeaponsResource::WeaponsResource(void) : lastWeapon(NULL), iOldWeaponBits(0) {}
@ -56,7 +73,10 @@ void WeaponsResource::Init( void )
{
memset( rgWeapons, 0, sizeof(WEAPON)*MAX_WEAPONS );
Reset();
HOOK_COMMAND("lastinv",LastInv);
HOOK_COMMAND("lastinv", LastInv);
// +movement
HOOK_COMMAND("+movement", MovementOn);
HOOK_COMMAND("-movement", MovementOff);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -73,10 +93,11 @@ void WeaponsResource::Reset( void )
void WeaponsResource :: LoadAllWeaponSprites( void )
{
int customCrosshairs=CVAR_GET_FLOAT(kvCustomCrosshair);
for (int i = 0; i < MAX_WEAPONS; i++)
{
if ( rgWeapons[i].iId )
LoadWeaponSprites( &rgWeapons[i] );
LoadWeaponSprites( &rgWeapons[i], customCrosshairs );
}
}
@ -100,24 +121,38 @@ inline void LoadWeaponSprite( client_sprite_t* ptr, HSPRITE& sprite, wrect_t& bo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon, int custom )
{
int i, iRes;
if ( custom < 0 || custom > 4 )
custom=1;
if (ScreenWidth() < 640)
iRes = 320;
else
iRes = 640;
int resolutions[6] = { 320, 640, 800, 1024, 1280, 1600};
const int numRes=6;
int i=0, j=0, iRes=320;
int screenWidth=ScreenWidth();
for ( j=0; j < numRes; j++ ) {
if ( screenWidth == resolutions[j] ) {
iRes=resolutions[j];
break;
}
if ( j > 0 && screenWidth > resolutions[j-1] && screenWidth < resolutions[j] ) {
iRes=resolutions[j-1];
break;
}
}
char sz[128];
if ( !pWeapon )
return;
memset( &pWeapon->rcCrosshair, 0, sizeof(wrect_t) );
memset( &pWeapon->rcActive, 0, sizeof(wrect_t) );
memset( &pWeapon->rcInactive, 0, sizeof(wrect_t) );
memset( &pWeapon->rcAmmo, 0, sizeof(wrect_t) );
memset( &pWeapon->rcAmmo2, 0, sizeof(wrect_t) );
pWeapon->hCrosshair =0;
pWeapon->hInactive = 0;
pWeapon->hActive = 0;
pWeapon->hAmmo = 0;
@ -132,31 +167,28 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
return;
}
LoadWeaponSprite( GetSpriteList( pList, "crosshair", iRes, i ), pWeapon->hCrosshair, pWeapon->rcCrosshair );
LoadWeaponSprite( GetSpriteList( pList, "autoaim", iRes, i ), pWeapon->hAutoaim, pWeapon->rcAutoaim );
LoadWeaponSprite( GetSpriteList( pList, "zoom", iRes, i ), pWeapon->hZoomedCrosshair, pWeapon->rcZoomedCrosshair );
LoadWeaponSprite( GetSpriteList( pList, "zoom_autoaim", iRes, i ), pWeapon->hZoomedAutoaim, pWeapon->rcZoomedAutoaim );
LoadWeaponSprite( GetSpriteList( pList, "weapon", iRes, i ), pWeapon->hInactive, pWeapon->rcInactive );
LoadWeaponSprite( GetSpriteList( pList, "weapon_s", iRes, i ), pWeapon->hActive, pWeapon->rcActive );
LoadWeaponSprite( GetSpriteList( pList, "ammo", iRes, i ), pWeapon->hAmmo, pWeapon->rcAmmo );
LoadWeaponSprite( GetSpriteList( pList, "ammo2", iRes, i ), pWeapon->hAmmo2, pWeapon->rcAmmo2 );
char crosshairName[32];
sprintf(crosshairName, "crosshair_%d", custom);
for ( j=numRes-1; j>=0; j-- ) {
if ( resolutions[j] <= iRes ) {
if( pWeapon->hCrosshair == NULL )
LoadWeaponSprite( GetSpriteList( pList, crosshairName, resolutions[j], i ), pWeapon->hCrosshair, pWeapon->rcCrosshair );
if( pWeapon->hCrosshair == NULL && custom != 0 )
LoadWeaponSprite( GetSpriteList( pList, "crosshair_0", resolutions[j], i ), pWeapon->hCrosshair, pWeapon->rcCrosshair );
if( pWeapon->hZoomedCrosshair == NULL ) //default to non-zoomed crosshair
{
pWeapon->hZoomedCrosshair = pWeapon->hCrosshair;
pWeapon->rcZoomedCrosshair = pWeapon->rcCrosshair;
}
if( pWeapon->hAutoaim == NULL ) //default to non-autoaim crosshair
{
pWeapon->hAutoaim = pWeapon->hCrosshair;
pWeapon->rcAutoaim = pWeapon->rcCrosshair;
}
if( pWeapon->hInactive == NULL )
LoadWeaponSprite( GetSpriteList( pList, "weapon", resolutions[j], i ), pWeapon->hInactive, pWeapon->rcInactive );
if( pWeapon->hZoomedAutoaim == NULL ) //default to non-autoaim zoomed crosshair
{
pWeapon->hZoomedAutoaim = pWeapon->hZoomedCrosshair;
pWeapon->rcZoomedAutoaim = pWeapon->rcZoomedCrosshair;
if( pWeapon->hActive == NULL )
LoadWeaponSprite( GetSpriteList( pList, "weapon_s", resolutions[j], i ), pWeapon->hActive, pWeapon->rcActive );
if( pWeapon->hAmmo == NULL )
LoadWeaponSprite( GetSpriteList( pList, "ammo", resolutions[j], i ), pWeapon->hAmmo, pWeapon->rcAmmo );
if( pWeapon->hAmmo2 == NULL )
LoadWeaponSprite( GetSpriteList( pList, "ammo2", resolutions[j], i ), pWeapon->hAmmo2, pWeapon->rcAmmo2 );
}
}
if( pWeapon->hActive || pWeapon->hInactive || pWeapon->hAmmo || pWeapon->hAmmo2 )
@ -291,8 +323,9 @@ HSPRITE* WeaponsResource::GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect )
void WeaponsResource::AddWeapon( WEAPON *wp )
{
int customCrosshairs=CVAR_GET_FLOAT(kvCustomCrosshair);
rgWeapons[ wp->iId ] = *wp;
LoadWeaponSprites( &rgWeapons[ wp->iId ] );
LoadWeaponSprites( &rgWeapons[ wp->iId ], customCrosshairs);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -329,13 +362,61 @@ void WeaponsResource::UserCmd_LastInv(void)
if(this->IsSelectable(this->lastWeapon))
{
this->SetCurrentWeapon(lastWeapon);
const char* theSound = AvHSHUGetCommonSoundName(gHUD.GetIsAlien(), WEAPON_SOUND_HUD_ON);
gHUD.PlayHUDSound(theSound, kHUDSoundVolume);
// : 764
//const char* theSound = AvHSHUGetCommonSoundName(gHUD.GetIsAlien(), WEAPON_SOUND_HUD_ON);
//gHUD.PlayHUDSound(theSound, kHUDSoundVolume);
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void WeaponsResource::UserCmd_MovementOn()
{
// Find out which weapon we want to trigger
AvHUser3 theUser3 = gHUD.GetHUDUser3();
int wID = -1;
switch(theUser3)
{
case AVH_USER3_ALIEN_PLAYER1:
wID = AVH_ABILITY_LEAP;
break;
case AVH_USER3_ALIEN_PLAYER3:
// TODO: Add flap
break;
case AVH_USER3_ALIEN_PLAYER4:
wID = AVH_WEAPON_BLINK;
break;
case AVH_USER3_ALIEN_PLAYER5:
wID = AVH_ABILITY_CHARGE;
break;
default:
IN_ReloadDown();
return;
}
if (wID > -1)
{
// Fetch the needed movement weapon
WEAPON *p = this->GetWeapon(wID);
if (p != NULL && this->IsSelectable(p))
{
// Send activation of ability asap
IN_Attack2Down();
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void WeaponsResource::UserCmd_MovementOff()
{
// Ensure that we're not activating any weapons when selected
IN_Attack2Up();
IN_ReloadUp();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void WeaponsResource::SetValidWeapon(void)
{
WEAPON* p = this->GetFirstPos(0); //alien attack 1 or primary marine weapon
@ -370,7 +451,7 @@ void WeaponsResource::SetValidWeapon(void)
void WeaponsResource::SetCurrentWeapon(WEAPON* newWeapon)
{
WEAPON* currentWeapon = this->GetWeapon(gHUD.GetCurrentWeaponID());
// puzl: 497 - Because weapon state can get out of sync, we should allow this even if the weapons are the same
// : 497 - Because weapon state can get out of sync, we should allow this even if the weapons are the same
// && newWeapon != currentWeapon
if( newWeapon != NULL )
{
@ -532,6 +613,7 @@ void CHudAmmo::Reset(void)
gWR.Reset();
gHR.Reset();
m_customCrosshair=0;
// VidInit();
}
@ -569,6 +651,7 @@ int CHudAmmo::VidInit(void)
// Think:
// Used for selection of weapon menu item.
//
void CHudAmmo::Think(void)
{
if ( gHUD.m_fPlayerDead )
@ -592,6 +675,19 @@ void CHudAmmo::Think(void)
}
}
}
if ( (int)CVAR_GET_FLOAT(kvCustomCrosshair) != m_customCrosshair ) {
m_customCrosshair=(int)CVAR_GET_FLOAT(kvCustomCrosshair);
for ( int i=0; i < MAX_WEAPONS; i++ ) {
WEAPON *weapon = gWR.GetWeapon(i);
if ( weapon ) {
gWR.LoadWeaponSprites(weapon, m_customCrosshair);
if ( gHUD.GetHUDPlayMode() != PLAYMODE_READYROOM && gHUD.GetCurrentWeaponID() == weapon->iId ) {
gHUD.SetCurrentCrosshair(weapon->hCrosshair, weapon->rcCrosshair, 255, 255, 255);
}
}
}
}
if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon
{
@ -733,6 +829,12 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
pWeapon->iEnabled = (iState & WEAPON_IS_ENABLED) != 0 ? TRUE : FALSE;
pWeapon->iClip = abs(iClip);
// Ensure that movement is enabled/disabled according to weapons
if (iId == 22 || iId == 11 || iId == 21)
{
gCanMove = pWeapon->iEnabled;
}
if( !bIsCurrent )
{ return 1; }
@ -740,7 +842,9 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
{
if ( gHUD.m_iFOV >= 90 )
gHUD.SetCurrentCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
/* if ( gHUD.m_iFOV >= 90 )
{ // normal crosshairs
if (bOnTarget && m_pWeapon->hAutoaim)
gHUD.SetCurrentCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255);
@ -753,7 +857,7 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
gHUD.SetCurrentCrosshair(m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255);
else
gHUD.SetCurrentCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
}*/
}
m_fFade = 200.0f; //!!!
@ -783,7 +887,7 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )
Weapon.iId = weapon_data.bit_index;
Weapon.iFlags = weapon_data.flags;
Weapon.iClip = 0;
// puzl: 497 - default value for enable state
// : 497 - default value for enable state
Weapon.iEnabled = 0;
gWR.AddWeapon( &Weapon );

View file

@ -33,7 +33,7 @@ struct WEAPON
int iFlags;
int iId;
int iClip;
// puzl: 497 - weapon enable state
// : 497 - weapon enable state
int iEnabled;
int iCount; // # of itesm in plist
@ -48,12 +48,14 @@ struct WEAPON
wrect_t rcAmmo2;
HSPRITE hCrosshair;
wrect_t rcCrosshair;
HSPRITE hAutoaim;
/* HSPRITE hAutoaim;
wrect_t rcAutoaim;
HSPRITE hZoomedCrosshair;
wrect_t rcZoomedCrosshair;
HSPRITE hZoomedAutoaim;
wrect_t rcZoomedAutoaim;
*/
};
typedef int AMMO;

View file

@ -38,7 +38,7 @@ public:
void Init( void );
void Reset( void );
void LoadWeaponSprites( WEAPON* wp );
void LoadWeaponSprites( WEAPON* wp, int custom );
void LoadAllWeaponSprites( void );
WEAPON* GetWeapon( int iId );
@ -62,6 +62,8 @@ public:
//CONSIDER: Should the selection functions be in the menu with the selection variables?
void UserCmd_LastInv( void );
void UserCmd_MovementOn( void );
void UserCmd_MovementOff( void );
void SetValidWeapon( void );
void SetCurrentWeapon( WEAPON* wp );
void SelectSlot( int iSlot, int fAdvance, int iDirection );

View file

@ -155,6 +155,8 @@ int CL_DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t));
EV_HookEvents();
gHUD.InitExploitPrevention();
// get tracker interface, if any
char szDir[512];
if (!gEngfuncs.COM_ExpandFilename("Bin/TrackerUI.dll", szDir, sizeof(szDir)))
@ -190,6 +192,7 @@ so the HUD can reinitialize itself.
int CL_DLLEXPORT HUD_VidInit( void )
{
gHUD.InitExploitPrevention();
RecClHudVidInit();
gHUD.VidInit();

View file

@ -113,6 +113,7 @@ private:
WEAPON *m_pWeapon;
int m_HUD_bucket0;
int m_HUD_selection;
int m_customCrosshair;
};
@ -220,7 +221,7 @@ protected:
};
class ScoreboardIcon;
// puzl: 0001073
// : 0001073
#define CUSTOM_ICON_LENGTH 32
struct extra_player_info_t
@ -228,14 +229,15 @@ struct extra_player_info_t
short score;
short lastScore;
float timeOfLastScoreChange;
short frags;
short deaths;
short playerclass;
short extra;
short auth;
short teamnumber;
char teamname[MAX_TEAM_NAME];
char customicon[CUSTOM_ICON_LENGTH + 3]; //last 3 characters is the color.
short health;
ScoreboardIcon* icon;
};

View file

@ -27,7 +27,7 @@
Optimization="0"
OptimizeForProcessor="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;U:\inlcude\stlport;U:\include\vgui;U:\include\nexus;U:\include\libpng;U:\include\fmod;U:\include\lua;U:\include\particle;U:\include\zlib"
PreprocessorDefinitions="_DEBUG;_MBCS;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NoInherit)"
PreprocessorDefinitions="_DEBUG;_MBCS;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;$(NoInherit);USE_OLDAUTH"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
SmallerTypeCheck="TRUE"
@ -113,7 +113,7 @@
EnableIntrinsicFunctions="TRUE"
OptimizeForProcessor="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;U:\inlcude\stlport;U:\include\vgui;U:\include\nexus;U:\include\libpng;U:\include\fmod;U:\include\lua;U:\include\particle;U:\include\zlib"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;AVH_PLAYTEST_BUILD;$(NOINHERIT)"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;$(NOINHERIT)"
StringPooling="TRUE"
RuntimeLibrary="0"
RuntimeTypeInfo="TRUE"
@ -5949,31 +5949,6 @@
RelativePath="..\textrep\TRTagValuePair.h">
</File>
</Filter>
<Filter
Name="scriptengine"
Filter="">
<File
RelativePath="..\scriptengine\AvHLUA.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUA.h">
</File>
<File
RelativePath="..\scriptengine\AvHLUABase.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUABase.h">
</File>
<File
RelativePath="..\scriptengine\AvHLUATime.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAUtil.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAUtil.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>

View file

@ -100,6 +100,7 @@ void CL_DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
int type;
int i = 0;
bool theMouseVisibility = false;
int particleIndex=0;
type = *( int * )buffer;
i += sizeof( int );
@ -176,7 +177,7 @@ void CL_DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
break;
case TYPE_PARTICLES:
i += gParticleTemplateList.InitializeDemoPlayback(size, (unsigned char*)&buffer[i]);
i += gParticleTemplateList.InitializeDemoPlayback(size, (unsigned char*)&buffer[i], particleIndex++);
break;
case TYPE_BASESTATE2:

View file

@ -297,7 +297,7 @@ void MoveModel( void )
}
#endif
*/
//#define TRACE_TEST
#if defined( TRACE_TEST )
@ -328,7 +328,7 @@ void TraceModel( void )
}
#endif
*/
/*
void ParticleCallback( struct particle_s *particle, float frametime )
@ -545,11 +545,11 @@ void CL_DLLEXPORT HUD_CreateEntities( void )
#if defined( TEST_IT )
MoveModel();
#endif
*/
#if defined( TRACE_TEST )
TraceModel();
#endif
*/
/*
Particles();
*/

View file

@ -104,6 +104,15 @@ qboolean EV_IsLocal( int idx )
return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;
}
qboolean EV_IsSpec( int idx )
{
// check if we are in some way in first person spec mode
if ( IS_FIRSTPERSON_SPEC )
return (g_iUser2 == idx);
else
return false;
}
/*
=================
EV_GetGunPosition

View file

@ -21,6 +21,7 @@ void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, i
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
void EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
qboolean EV_IsLocal( int idx );
qboolean EV_IsSpec( int idx );
qboolean EV_IsPlayer( int idx );
void EV_CreateTracer( float *start, float *end );

View file

@ -77,6 +77,7 @@
#include "mod/AvHAlienWeapons.h"
#include "mod/AvHAlienAbilities.h"
#include "mod/AvHAlienWeaponConstants.h"
#include "mod/AvHAlienAbilityConstants.h"
#include "mod/AvHMovementUtil.h"
#include "engine/APIProxy.h"
@ -97,6 +98,8 @@ static globalvars_t Globals;
static CBasePlayerWeapon *g_pWpns[ 32 ];
bool CheckInAttack2(void);
vec3_t previousorigin;
// HLDM Weapon placeholder entities.
@ -470,6 +473,9 @@ Handles weapon firing, reloading, etc.
*/
void CBasePlayerWeapon::ItemPostFrame( void )
{
// Hack initialization
if (this->m_flLastAnimationPlayed >= 3.0f * BALANCE_VAR(kLeapROF) + gpGlobals->time)
this->m_flLastAnimationPlayed = 0.0f;
if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= 0.0))
{
@ -489,20 +495,30 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fInReload = FALSE;
}
if ((m_pPlayer->pev->button & IN_ATTACK2) && (m_flNextSecondaryAttack <= 0.0))
// Properly propagate the end animation
if (this->PrevAttack2Status == true && !(m_pPlayer->pev->button & IN_ATTACK2))
{
if (GetCanUseWeapon())
{
if ( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
{
m_fFireOnEmpty = TRUE;
}
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
switch (gHUD.GetCurrentWeaponID())
{
case AVH_WEAPON_SWIPE:
this->SendWeaponAnim(12);
break;
case AVH_WEAPON_ACIDROCKET:
this->SendWeaponAnim(8);
break;
case AVH_WEAPON_CLAWS:
this->SendWeaponAnim(9);
break;
case AVH_WEAPON_STOMP:
this->SendWeaponAnim(8);
break;
case AVH_WEAPON_DEVOUR:
this->SendWeaponAnim(11);
break;
}
}
else if ( (m_pPlayer->pev->button & IN_ATTACK) && (m_flNextPrimaryAttack <= 0.0) )
if ( (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2) && (m_flNextPrimaryAttack <= 0.0) )
{
if (GetCanUseWeapon())
{
@ -512,12 +528,121 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fFireOnEmpty = TRUE;
}
//#ifdef AVH_CLIENT
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (gHUD.GetCurrentWeaponID() == AVH_ABILITY_LEAP)
&& (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
{
// : 0001151 predict energy too
AvHAlienWeapon* theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]);
if ( theWeapon && theWeapon->IsUseable() ) {
float theVolumeScalar = 1.0f;
cl_entity_t *player = gEngfuncs.GetLocalPlayer();
int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6);
switch(theSilenceLevel)
{
case 1:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume);
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume);
break;
case 3:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume);
break;
}
HUD_PlaySound( kLeapSound, theVolumeScalar);
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() );
gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2);
this->m_flLastAnimationPlayed = gpGlobals->time;
}
}
//#ifdef AVH_CLIENT
//if((m_iClip == 0) && ?
//#endif
PrimaryAttack();
//return;
}
}
// +movement: Rewritten to allow us to use +attack2 for movement abilities
else if ((m_pPlayer->pev->button & IN_ATTACK2) && (gHUD.GetIsAlien()))
{
//m_flNextSecondaryAttack
// Find out what kind of special movement we are using, and execute the animation for it
if (this->PrevAttack2Status == false)
{
bool enabled=false;
// : 0001151 predict energy too
AvHAlienWeapon *theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]);
if ( theWeapon )
enabled=theWeapon->IsUseable();
PrimaryAttack();
}
switch (gHUD.GetHUDUser3())
{
case AVH_USER3_ALIEN_PLAYER1:
if (enabled && (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
{
float theVolumeScalar = 1.0f;
cl_entity_t *player = gEngfuncs.GetLocalPlayer();
int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6);
switch(theSilenceLevel)
{
case 1:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume);
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume);
break;
case 3:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume);
break;
}
HUD_PlaySound( kLeapSound, theVolumeScalar);
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() );
this->SendWeaponAnim(3);
this->m_flLastAnimationPlayed = gpGlobals->time;
}
break;
case AVH_USER3_ALIEN_PLAYER4:
switch (gHUD.GetCurrentWeaponID())
{
case AVH_WEAPON_SWIPE:
this->SendWeaponAnim(9);
break;
case AVH_WEAPON_ACIDROCKET:
this->SendWeaponAnim(11);
break;
}
break;
case AVH_USER3_ALIEN_PLAYER5:
switch (gHUD.GetCurrentWeaponID())
{
case AVH_WEAPON_CLAWS:
this->SendWeaponAnim(5);
break;
case AVH_WEAPON_DEVOUR:
this->SendWeaponAnim(18);
break;
case AVH_WEAPON_STOMP:
this->SendWeaponAnim(15);
break;
}
break;
}
}
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (this->m_flLastAnimationPlayed + BALANCE_VAR(kLeapROF) < gpGlobals->time))
this->PrevAttack2Status = false;
else
this->PrevAttack2Status = true;
return;
// if (GetCanUseWeapon())
// {
// PrimaryAttack();
// }
}
else if ( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload )
{
@ -527,7 +652,8 @@ void CBasePlayerWeapon::ItemPostFrame( void )
Reload();
}
}
else if ( !(m_pPlayer->pev->button & (IN_ATTACK|IN_ATTACK2) ) )
// +movement: Removed case for +attack2
else if ( !(m_pPlayer->pev->button & (IN_ATTACK /*|IN_ATTACK2 */) ) )
{
if (GetCanUseWeapon())
{
@ -549,9 +675,12 @@ void CBasePlayerWeapon::ItemPostFrame( void )
WeaponIdle( );
}
this->PrevAttack2Status = false;
return;
}
this->PrevAttack2Status = false;
// catch all
if ( ShouldWeaponIdle() )
{
@ -642,6 +771,8 @@ void CBasePlayer::Spawn( void )
{
if (m_pActiveItem)
m_pActiveItem->Deploy( );
// this->m_flLastAnimationPlayed = gpGlobals->time;
}
/*
@ -989,7 +1120,7 @@ bool HUD_GetWeaponEnabled(int inID)
ASSERT(inID >= 0);
ASSERT(inID < 32);
// puzl: 497 - use the enabled state in the associated WEAPON instead of the CBasePlayerWeapon's iuser3
// : 497 - use the enabled state in the associated WEAPON instead of the CBasePlayerWeapon's iuser3
bool theWeaponEnabled = false;
CBasePlayerWeapon* theWeapon = g_pWpns[inID];
if(theWeapon)
@ -1240,7 +1371,9 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
// Make sure that weapon animation matches what the game .dll is telling us
// over the wire ( fixes some animation glitches )
if ( g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) )
// Ensure that the fade and onos won't get these, to play the blink and charge animations correctly
bool noRun = (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER4) || (to->client.iuser3 == AVH_USER3_ALIEN_PLAYER5);
if (g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) && !(CheckInAttack2()) && !noRun)
{
int body = 2;

View file

@ -34,9 +34,9 @@
#include "mod/AvHNetworkMessages.h"
#include "ui/ChatPanel.h"
#include "mod/AvHClientVariables.h"
// tankefugl: duck toggle
// : duck toggle
bool g_bDuckToggled;
// :tankefugl
// :
class CHLVoiceStatusHelper : public IVoiceStatusHelper
{
@ -167,6 +167,8 @@ int __MsgFunc_TeamInfo(const char *pszName, int iSize, void *pbuf)
void __CmdFunc_SpecialDummy(void) {}
void __CmdFunc_ClRateDummy(void) { }
// This is called every time the DLL is loaded
void CHud :: Init( void )
{
@ -178,6 +180,7 @@ void CHud :: Init( void )
HOOK_COMMAND( "special", SpecialDummy);
HOOK_COMMAND( "_special", SpecialDummy); //prevent abuse
HOOK_COMMAND( "cl_rate", ClRateDummy);
HOOK_MESSAGE( TeamNames );
HOOK_MESSAGE( MOTD );
@ -196,9 +199,9 @@ void CHud :: Init( void )
m_iLogo = 0;
m_iFOV = 0;
// tankefugl: duck toggle
// : duck toggle
g_bDuckToggled = false;
// :tankefugl
// :
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
@ -207,8 +210,14 @@ void CHud :: Init( void )
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
CVAR_CREATE( "cl_showspeed", "0", 0);
CVAR_CREATE( kvLabelMaps, "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvGammaRamp, "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelMaps, "1", FCVAR_ARCHIVE);
CVAR_CREATE( kvGammaRamp, "1", FCVAR_ARCHIVE);
CVAR_CREATE( kvCustomCrosshair, "1", FCVAR_ARCHIVE);
CVAR_CREATE( kvHudMapZoom, "3", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelHivesight, "1", FCVAR_ARCHIVE);
CVAR_CREATE( "cl_iconr", "0", FCVAR_ARCHIVE);
CVAR_CREATE( "cl_icong", "149", FCVAR_ARCHIVE);
CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE);
m_pSpriteList = NULL;

View file

@ -21,9 +21,9 @@
#include "common/r_efx.h"
#include "mod/AvHNetworkMessages.h"
// tankefugl: duck toggle
// : duck toggle
extern bool g_bDuckToggled;
// :tankefugl
// :
#define MAX_CLIENTS 32
@ -50,9 +50,9 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
// reset sensitivity
m_flMouseSensitivity = 0;
// tankefugl: duck toggle
// : duck toggle
g_bDuckToggled = false;
// :tankefugl
// :
return 0;
}

View file

@ -390,8 +390,10 @@ int CHudSpectator::Draw(float flTime)
// draw only in spectator mode
if ( !g_iUser1 )
return 0;
// string error;
// gHUD.Update( flTime, error);
// Removed by mmcguire.
// Removed by mmcguire.
/*
// if user pressed zoom, aplly changes
if ( (m_zoomDelta != 0.0f) && ( g_iUser1 == OBS_MAP_FREE ) )
@ -515,7 +517,7 @@ void CHudSpectator::DrawOverviewMap()
theDrawInfo.mY = YRES(SPECTATOR_PANEL_HEIGHT + 4);
theDrawInfo.mWidth = ScreenWidth() - theDrawInfo.mX - XRES(4);
theDrawInfo.mHeight = ScreenHeight() - YRES(SPECTATOR_PANEL_HEIGHT + 4) - theDrawInfo.mY;
theDrawInfo.mZoomScale = 1.0f;
AvHMapExtents theMapExtents;
theOverviewMap.GetMapExtents(theMapExtents);
@ -1924,6 +1926,7 @@ void CHudSpectator::Reset()
void CHudSpectator::InitHUDData()
{
gHUD.InitHUDData();
m_lastPrimaryObject = m_lastSecondaryObject = 0;
m_flNextObserverInput = 0.0f;
m_lastHudMessage = 0;

View file

@ -61,9 +61,9 @@ extern "C"
#include "engine/APIProxy.h"
#include "Exports.h"
// tankefugl: duck toggle
// : duck toggle
extern bool g_bDuckToggled;
// :tankefugl
// :
extern int g_iAlive;
@ -356,6 +356,8 @@ void KB_Shutdown( void )
void KeyDown (kbutton_t *b);
void KeyUp (kbutton_t *b);
void KeyDownForced (kbutton_t *b);
void KeyUpForced (kbutton_t *b);
/*
============
@ -392,13 +394,6 @@ void KeyDown (kbutton_t *b)
}
}
// //If they used mwheeldown/mwheelup to activate repeating command, make sure they didnt use +attack or +jump to prevent exploits.
// if(k == K_MWHEELDOWN || k == K_MWHEELUP && theBlockScripts == 2)
// {
// if(strstr(pCmd, "+"))//I could also do pCmd[0] == '+', but that could possibly be bypassed.
// bFound = false;
// }
if(!bFound
&& strcmp(pCmd, "+mlook")
@ -431,6 +426,21 @@ void KeyDown (kbutton_t *b)
b->state |= 1 + 2; // down + impulse down
}
/*
============
KeyDownForced
============
*/
void KeyDownForced (kbutton_t *b)
{
b->down[0] = 0;
b->down[1] = 0;
if (b->state & 1)
return; // still down
b->state |= 1 + 2; // down + impulse down
}
/*
============
KeyUp
@ -470,6 +480,16 @@ void KeyUp (kbutton_t *b)
b->state |= 4; // impulse up
}
/*
============
KeyUpForced
============
*/
void KeyUpForced (kbutton_t *b)
{
b->state &= ~1; // now up
b->state |= 4; // impulse up
}
bool AvHContainsBlockedCommands(const char* inInput)
{
@ -535,7 +555,7 @@ int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBind
if (theBlockScripts && AvHContainsBlockedCommands(pszCurrentBinding))
{
if(down)//voogru: only show when going down.
if(down)//: only show when going down.
gEngfuncs.pfnCenterPrint("Scripting is not allowed on this server.\n");
return 0;
}
@ -760,8 +780,8 @@ void IN_SpeedDown(void) {KeyDown(&in_speed);}
void IN_SpeedUp(void) {KeyUp(&in_speed);}
void IN_StrafeDown(void) {KeyDown(&in_strafe);}
void IN_StrafeUp(void) {KeyUp(&in_strafe);}
void IN_Attack2Down(void) {KeyDown(&in_attack2);}
void IN_Attack2Up(void) {KeyUp(&in_attack2);}
void IN_Attack2Down(void) {KeyDownForced(&in_attack2);}
void IN_Attack2Up(void) {KeyUpForced(&in_attack2);}
void IN_UseDown (void)
{
KeyDown(&in_use);
@ -794,14 +814,14 @@ void IN_DuckDown(void)
}
void IN_DuckUp(void) {KeyUp(&in_duck);}
// tankefugl: duck toggle
// : duck toggle
void IN_DuckToggle(void)
{
g_bDuckToggled = !g_bDuckToggled;
}
// :tankefugl
void IN_ReloadDown(void) {KeyDown(&in_reload);}
void IN_ReloadUp(void) {KeyUp(&in_reload);}
// :
void IN_ReloadDown(void) {KeyDownForced(&in_reload);}
void IN_ReloadUp(void) {KeyUpForced(&in_reload);}
void IN_Alt1Down(void) {KeyDown(&in_alt1);}
void IN_Alt1Up(void) {KeyUp(&in_alt1);}
void IN_GraphDown(void) {KeyDown(&in_graph);}
@ -817,6 +837,17 @@ void IN_AttackUp(void)
{
KeyUp( &in_attack );
in_cancel = 0;
IN_Attack2Up();
}
void IN_AttackDownForced(void)
{
KeyDownForced( &in_attack );
}
void IN_AttackUpForced(void)
{
KeyUpForced( &in_attack );
}
// Special handling
@ -825,6 +856,16 @@ void IN_Cancel(void)
in_cancel = 1;
}
bool CheckInAttack(void)
{
return (in_attack.state & 1 || in_attack2.state & 1);
}
bool CheckInAttack2(void)
{
return (in_attack2.state & 1);
}
void IN_Impulse (void)
{
//char msg[1024];
@ -863,11 +904,11 @@ void IN_ScoreUp(void)
void IN_MLookUp (void)
{
KeyUp( &in_mlook );
/*KeyUp( &in_mlook );
if ( !( in_mlook.state & 1 ) && lookspring->value )
{
V_StartPitchDrift();
}
}*/
}
/*
@ -1337,7 +1378,7 @@ int CL_ButtonBits( int bResetState )
bits |= IN_WALK;
}
// tankefugl: duck toggle
// : duck toggle
if ( g_bDuckToggled )
{
if (!(in_duck.state & 3))
@ -1349,7 +1390,7 @@ int CL_ButtonBits( int bResetState )
{
bits |= IN_DUCK;
}
// :tankefugl
// :
if (in_jump.state & 3)
{
@ -1466,6 +1507,7 @@ void CL_ResetButtonBits( int bits )
{
// totally clear state
in_attack.state &= ~7;
in_attack2.state &= ~7;
}
}
}
@ -1503,8 +1545,8 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("-speed", IN_SpeedUp);
gEngfuncs.pfnAddCommand ("+attack", IN_AttackDown);
gEngfuncs.pfnAddCommand ("-attack", IN_AttackUp);
gEngfuncs.pfnAddCommand ("+attack2", IN_Attack2Down);
gEngfuncs.pfnAddCommand ("-attack2", IN_Attack2Up);
//gEngfuncs.pfnAddCommand ("+movement", IN_Attack2Down);
//gEngfuncs.pfnAddCommand ("-movement", IN_Attack2Up);
gEngfuncs.pfnAddCommand ("+use", IN_UseDown);
gEngfuncs.pfnAddCommand ("-use", IN_UseUp);
gEngfuncs.pfnAddCommand ("+jump", IN_JumpDown);
@ -1518,9 +1560,9 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("-jlook", IN_JLookUp);
gEngfuncs.pfnAddCommand ("+duck", IN_DuckDown);
gEngfuncs.pfnAddCommand ("-duck", IN_DuckUp);
// tankefugl: duck toggle
// : duck toggle
gEngfuncs.pfnAddCommand ("toggleduck", IN_DuckToggle);
// :tankefugl
// :
gEngfuncs.pfnAddCommand ("+reload", IN_ReloadDown);
gEngfuncs.pfnAddCommand ("-reload", IN_ReloadUp);
gEngfuncs.pfnAddCommand ("+alt1", IN_Alt1Down);

View file

@ -427,7 +427,7 @@ void IN_MouseMove ( float frametime, float ioRotationDeltas[3], float ioTranslat
}
}
/*
//#define TRACE_TEST
#if defined( TRACE_TEST )
{
@ -437,7 +437,7 @@ void IN_MouseMove ( float frametime, float ioRotationDeltas[3], float ioTranslat
V_Move( mx, my );
}
#endif
*/
}
/*

View file

@ -247,7 +247,9 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
}
}
strncpy( g_szLineBuffer[i], pszBuf, min(iBufSize -1, MAX_CHARS_PER_LINE-1) );
// : 0001087
// don't strip last character ( often resulted in no carriage returns in the log )
strncpy( g_szLineBuffer[i], pszBuf, min(iBufSize, MAX_CHARS_PER_LINE-1) );
// make sure the text fits in one line
EnsureTextFitsInOneLineAndWrapIfHaveTo( i );
@ -277,7 +279,7 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
gViewPort->GetChatPanel()->getPos(theX, theY);
gViewPort->GetChatPanel()->getSize(theWidth, theHeight);
//Y_START = theY + theHeight + 5; //voogru: this is too high imo.
//Y_START = theY + theHeight + 5; //: this is too high imo.
//KGP: then move the viewport
Y_START = theY + theHeight + 5;
}

View file

@ -176,6 +176,24 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
psz[0] = 1;
origin = psz + 1;
}
// Ensure that message[0] does not contain exessive %'s, max 4x%s, all other %'s removed.
size_t lastpos = 0; size_t pos; int count = 0;
while(true)
{
pos = message[0].find("%", lastpos);
if (pos == string::npos)
break;
if ((message[0].substr(pos + 1, 1) == "s") && (count < 4))
count++;
else
message[0].replace(pos, 1, " ");
lastpos = pos + 1;
}
sprintf( origin, message[0].c_str(), message[1].c_str(), message[2].c_str(), message[3].c_str(), message[4].c_str() );
ConvertCRtoNL(psz);

View file

@ -75,6 +75,7 @@
#include "..\game_shared\vgui_loadtga.h"
#include "mod/AvHConstants.h"
#include "mod/AvHTitles.h"
#include "mod/AvHBasePlayerWeaponConstants.h"
#include "vgui_SpectatorPanel.h"
#include "cl_dll/demo.h"
#include "mod/AvHServerVariables.h"
@ -142,16 +143,19 @@ public:
SBColumnInfo g_ColumnInfo[NUM_COLUMNS] =
{
{NULL, 24, Label::a_east}, // tracker column
{NULL, 24, Label::a_east}, // status icons
{NULL, 150, Label::a_east}, // name
{NULL, 56, Label::a_east}, // class
{"#SCORE", 40, Label::a_east}, // score
{"#KILLS", 40, Label::a_east}, // kills
{"#DEATHS", 40, Label::a_east}, // deaths
{"#LATENCY", 40, Label::a_east}, // ping
{"#VOICE", 40, Label::a_east},
{NULL, 2, Label::a_east}, // blank column to take up the slack
{NULL, 24, Label::a_center}, // tracker column
{NULL, 24, Label::a_center}, // status icons
{NULL, 110, Label::a_center}, // name
{NULL, 56, Label::a_center}, // class
{NULL, 40, Label::a_center}, // resources
{NULL, 18, Label::a_center}, // weld
{NULL, 18, Label::a_center}, // weld
{"#SCORE", 35, Label::a_center}, // score
{"#KILLS", 35, Label::a_center}, // kills
{"#DEATHS", 35, Label::a_center}, // deaths
{"#LATENCY", 35, Label::a_center}, // ping
{"#VOICE", 40, Label::a_center},
{NULL, 2, Label::a_center}, // blank column to take up the slack
};
@ -196,7 +200,7 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
setBgColor(0, 0, 0, 96);
m_pCurrentHighlightLabel = NULL;
m_iHighlightRow = -1;
// puzl: 0001073
// : 0001073
m_pTrackerIcon = NULL;
m_pDevIcon = NULL;
m_pPTIcon = NULL;
@ -206,6 +210,13 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pCheatingDeathIcon = NULL;
m_pVeteranIcon = NULL;
m_pHMG = NULL;
m_pMine = NULL;
m_pWeld = NULL;
m_pGL = NULL;
m_pSG = NULL;
m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga");
m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga");
@ -215,6 +226,14 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");
m_pHMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardhmg.tga");
m_pMine = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardmine.tga");
m_pWeld = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardwelder.tga");
m_pGL = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardgl.tga");
m_pSG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardsg.tga");
m_iIconFrame = 0;
m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
@ -223,7 +242,7 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_TitleLabel.setText("");
m_TitleLabel.setBgColor( 0, 0, 0, 255 );
m_TitleLabel.setFgColor( Scheme::sc_primary1 );
m_TitleLabel.setContentAlignment( vgui::Label::a_west );
m_TitleLabel.setContentAlignment( vgui::Label::a_center );
LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
setBorder(border);
@ -365,7 +384,7 @@ void ScorePanel::Initialize( void )
m_fLastKillTime = 0;
m_iPlayerNum = 0;
m_iNumTeams = 0;
// puzl: 0001073
// : 0001073
// for( int counter = 0; counter < MAX_PLAYERS+1; counter++ )
// {
// delete g_PlayerExtraInfo[counter].icon;
@ -385,28 +404,33 @@ bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] )
void ScorePanel::Update()
{
// Set the title
string theTitleName;
char title[128];
char theServerName[MAX_SERVERNAME_LENGTH+1];
if (gViewPort->m_szServerName)
{
memset(theServerName, 0, MAX_SERVERNAME_LENGTH+1);
int iServerNameLength = max((int)strlen(gViewPort->m_szServerName),MAX_SERVERNAME_LENGTH);
theTitleName += string(gViewPort->m_szServerName,iServerNameLength);
strncat(theServerName, gViewPort->m_szServerName, iServerNameLength);
}
theServerName[MAX_SERVERNAME_LENGTH]=0;
char theMapName[MAX_MAPNAME_LENGTH+1];
sprintf(theMapName, "%s", gHUD.GetMapName().c_str());
int theTimeElapsed = gHUD.GetGameTime();
char elapsedString[64];
if ( theTimeElapsed > 0 ) {
int theMinutesElapsed = theTimeElapsed/60;
int theSecondsElapsed = theTimeElapsed%60;
sprintf(elapsedString, "Game time: %d:%02d", theMinutesElapsed, theSecondsElapsed);
}
else {
sprintf(elapsedString, "");
}
string theMapName = gHUD.GetMapName();
if(theMapName != "")
{
if(theTitleName != "")
{
theTitleName += " ";
}
sprintf(title, "%32s Map: %s %s", theServerName, theMapName, elapsedString);
theTitleName += "(";
theTitleName += theMapName;
theTitleName += ")";
}
m_TitleLabel.setText(theTitleName.c_str());
m_TitleLabel.setText(title);
int theColorIndex = 0;
@ -462,8 +486,8 @@ void ScorePanel::SortTeams()
for ( int i = 1; i <= m_iNumTeams; i++ )
{
if ( !g_TeamInfo[i].scores_overriden )
g_TeamInfo[i].score = g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0;
g_TeamInfo[i].ping = g_TeamInfo[i].packetloss = 0;
g_TeamInfo[i].score =0;
g_TeamInfo[i].frags = g_TeamInfo[i].deaths = g_TeamInfo[i].ping = g_TeamInfo[i].packetloss = 0;
}
// recalc the team scores, then draw them
@ -487,10 +511,10 @@ void ScorePanel::SortTeams()
if ( !g_TeamInfo[j].scores_overriden )
{
g_TeamInfo[j].score += g_PlayerExtraInfo[i].score;
g_TeamInfo[j].frags += g_PlayerExtraInfo[i].frags;
g_TeamInfo[j].deaths += g_PlayerExtraInfo[i].deaths;
}
g_TeamInfo[j].deaths += g_PlayerExtraInfo[i].deaths;
g_TeamInfo[j].frags += g_PlayerExtraInfo[i].frags;
g_TeamInfo[j].ping += g_PlayerInfoList[i].ping;
g_TeamInfo[j].packetloss += g_PlayerInfoList[i].packetloss;
@ -514,11 +538,20 @@ void ScorePanel::SortTeams()
g_TeamInfo[i].packetloss /= g_TeamInfo[i].players; // use the average ping of all the players in the team as the teams ping
}
}
vector<string> teams;
if ( gHUD.GetHUDTeam() == TEAM_TWO || gHUD.GetHUDTeam() == TEAM_FOUR ) {
SortActivePlayers(kAlien1Team);
SortActivePlayers(kMarine1Team);
SortActivePlayers(kAlien2Team);
SortActivePlayers(kMarine2Team);
}
else {
SortActivePlayers(kMarine1Team);
SortActivePlayers(kAlien1Team);
SortActivePlayers(kMarine2Team);
SortActivePlayers(kAlien2Team);
}
SortActivePlayers(kMarine1Team);
SortActivePlayers(kAlien1Team);
SortActivePlayers(kMarine2Team);
SortActivePlayers(kAlien2Team);
SortActivePlayers(kSpectatorTeam);
SortActivePlayers(kUndefinedTeam);
}
@ -699,6 +732,8 @@ int ScorePanel::GetIconFrame(void)
void ScorePanel::FillGrid()
{
bool isNsMode=( strnicmp(gHUD.GetMapName().c_str(), "ns_", 3) == 0 );
CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
@ -722,6 +757,21 @@ void ScorePanel::FillGrid()
}
bool bNextRowIsGap = false;
m_HeaderLabels[COLUMN_EXTRA].setText("");
m_HeaderLabels[COLUMN_MINE].setText("");
m_HeaderLabels[COLUMN_WELD].setText("");
if ( isNsMode ) {
if ( gHUD.GetHUDTeam() == TEAM_ONE || gHUD.GetHUDTeam() == TEAM_THREE ) {
m_HeaderLabels[COLUMN_EXTRA].setText(CHudTextMessage::BufferedLocaliseTextString("#COLWEAP"));
}
else if ( gHUD.GetHUDTeam() == TEAM_TWO || gHUD.GetHUDTeam() == TEAM_FOUR ) {
m_HeaderLabels[COLUMN_EXTRA].setText(CHudTextMessage::BufferedLocaliseTextString("#COLRES"));
}
}
else {
if ( gHUD.GetHUDTeam() != TEAM_IND && gHUD.GetHUDTeam() != TEAM_SPECT )
m_HeaderLabels[COLUMN_EXTRA].setText(CHudTextMessage::BufferedLocaliseTextString("#COLLEVEL"));
}
for(int row=0; row < NUM_ROWS; row++)
{
@ -750,7 +800,7 @@ void ScorePanel::FillGrid()
int thePlayerClass = theExtraPlayerInfo->playerclass;
short theTeamNumber = theExtraPlayerInfo->teamnumber;
string theCustomIcon = (string)theExtraPlayerInfo->customicon;
// puzl: 0001073
// : 0001073
short thePlayerAuthentication = theExtraPlayerInfo->auth;
bool thePlayerIsDead = false;
switch( thePlayerClass )
@ -896,10 +946,13 @@ void ScorePanel::FillGrid()
case COLUMN_SCORE:
case COLUMN_KILLS:
case COLUMN_DEATHS:
case COLUMN_EXTRA:
case COLUMN_MINE:
case COLUMN_WELD:
case COLUMN_DEATHS:
case COLUMN_LATENCY:
default:
pLabel->setContentAlignment( vgui::Label::a_east );
pLabel->setContentAlignment( vgui::Label::a_center );
break;
}
@ -947,10 +1000,15 @@ void ScorePanel::FillGrid()
case COLUMN_CLASS:
break;
case COLUMN_SCORE:
// Don't show score for enemies unless spectating or in RR
if ((m_iIsATeam[row] == TEAM_YES) && team_info && ((theLocalPlayerTeam == 0) || (theLocalPlayerTeam == team_info->teamnumber)))
if ((m_iIsATeam[row] == TEAM_YES) && team_info && (theLocalPlayerTeam == team_info->teamnumber || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER)))
sprintf(sz, "%d", team_info->score);
break;
case COLUMN_MINE:
break;
case COLUMN_WELD:
break;
case COLUMN_EXTRA:
break;
case COLUMN_KILLS:
if ((m_iIsATeam[row] == TEAM_YES) && team_info)
sprintf(sz, "%d", team_info->frags );
@ -1067,7 +1125,7 @@ void ScorePanel::FillGrid()
break;
case COLUMN_RANK_ICON:
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
// Check if we have authority. Right now these override the tracker icons. Listed in increasing order of "importance".
if(thePlayerAuthentication & PLAYERAUTH_CHEATINGDEATH)
@ -1184,7 +1242,7 @@ void ScorePanel::FillGrid()
#endif
break;
case COLUMN_SCORE:
if(!theIsForEnemy)
if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{
const float kDeltaDisplayTime = 3.0f;
float theTimeSinceChange = gHUD.GetTimeOfLastUpdate() - theExtraPlayerInfo->timeOfLastScoreChange;
@ -1201,7 +1259,68 @@ void ScorePanel::FillGrid()
}
break;
case COLUMN_WELD:
if ((theLocalPlayerTeam == theTeamNumber) || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{
if ( isNsMode ) {
if ( theExtraPlayerInfo->teamnumber == TEAM_ONE || theExtraPlayerInfo->teamnumber == TEAM_THREE ) {
if ( theExtraPlayerInfo->extra & WEAPON_WELDER ) {
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pWeld);
m_pWeld->setColor(BuildColor(0, 149, 221, gHUD.GetGammaSlope()));
}
}
}
}
break;
case COLUMN_MINE:
if ((theLocalPlayerTeam == theTeamNumber) || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{
if ( isNsMode ) {
if ( theExtraPlayerInfo->teamnumber == TEAM_ONE || theExtraPlayerInfo->teamnumber == TEAM_THREE ) {
if ( theExtraPlayerInfo->extra & WEAPON_MINE ) {
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pMine);
m_pMine->setColor(BuildColor(0, 149, 221, gHUD.GetGammaSlope()));
}
}
}
}
break;
case COLUMN_EXTRA:
if ((theLocalPlayerTeam == theTeamNumber) || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{
if ( isNsMode ) {
if ( theExtraPlayerInfo->teamnumber == TEAM_ONE || theExtraPlayerInfo->teamnumber == TEAM_THREE ) {
int r=0, g=149, b=221;
if ( theExtraPlayerInfo->extra & WEAPON_HMG ) {
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pHMG);
m_pHMG->setColor(BuildColor(r, g, b, gHUD.GetGammaSlope()));
}
if ( theExtraPlayerInfo->extra & WEAPON_SG ) {
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pSG);
m_pSG->setColor(BuildColor(r, g, b, gHUD.GetGammaSlope()));
}
if ( theExtraPlayerInfo->extra & WEAPON_GL ) {
pLabel->setFgColorAsImageColor(false);
pLabel->setImage(m_pGL);
m_pGL->setColor(BuildColor(r, g, b, gHUD.GetGammaSlope()));
}
}
else if ( theExtraPlayerInfo->teamnumber == TEAM_TWO || theExtraPlayerInfo->teamnumber == TEAM_FOUR ) {
sprintf(sz, "%d", theExtraPlayerInfo->extra);
}
}
else if ( theExtraPlayerInfo->teamnumber == TEAM_ONE || theExtraPlayerInfo->teamnumber == TEAM_TWO ||
theExtraPlayerInfo->teamnumber == TEAM_THREE || theExtraPlayerInfo->teamnumber == TEAM_FOUR ) {
sprintf(sz, "%d", theExtraPlayerInfo->extra);
}
}
break;
case COLUMN_KILLS:
sprintf(sz, "%d", theExtraPlayerInfo->frags);
break;
@ -1384,8 +1503,8 @@ void ScorePanel::MouseOverCell(int row, int col)
return;
// only act on audible players
if (!GetClientVoiceMgr()->IsPlayerAudible(m_iSortedRows[row]))
return;
//if (!GetClientVoiceMgr()->IsPlayerAudible(m_iSortedRows[row]))
// return;
// setup the new highlight
m_pCurrentHighlightLabel = label;

View file

@ -20,13 +20,16 @@
#define COLUMN_RANK_ICON 1
#define COLUMN_NAME 2
#define COLUMN_CLASS 3
#define COLUMN_SCORE 4
#define COLUMN_KILLS 5
#define COLUMN_DEATHS 6
#define COLUMN_LATENCY 7
#define COLUMN_VOICE 8
#define COLUMN_BLANK 9
#define NUM_COLUMNS 10
#define COLUMN_EXTRA 4
#define COLUMN_WELD 5
#define COLUMN_MINE 6
#define COLUMN_SCORE 7
#define COLUMN_KILLS 8
#define COLUMN_DEATHS 9
#define COLUMN_LATENCY 10
#define COLUMN_VOICE 11
#define COLUMN_BLANK 12
#define NUM_COLUMNS 13
#define NUM_ROWS (MAX_PLAYERS + (MAX_SCOREBOARD_TEAMS * 2))
using namespace vgui;
@ -86,6 +89,13 @@ private:
vgui::BitmapTGA *m_pContribIcon;
vgui::BitmapTGA *m_pCheatingDeathIcon;
vgui::BitmapTGA *m_pVeteranIcon;
vgui::BitmapTGA *m_pHMG;
vgui::BitmapTGA *m_pMine;
vgui::BitmapTGA *m_pWeld;
vgui::BitmapTGA *m_pGL;
vgui::BitmapTGA *m_pSG;
vector< pair <vgui::BitmapTGA *, string> > m_CustomIconList;
unsigned int m_iIconFrame;

View file

@ -89,15 +89,15 @@ void SpectatorPanel::StateChanged(CCheckButton2* pButton)
gHUD.m_Spectator.SetMode(theMode);
if (m_autoDirectorButton != NULL)
if (m_autoDirectorButton != NULL && pButton == m_autoDirectorButton )
{
if (m_autoDirectorButton->IsChecked())
{
gEngfuncs.Cvar_SetValue("spec_autodirector", 1);
gEngfuncs.Cvar_SetValue("spec_autodirector", 0);
}
else
{
gEngfuncs.Cvar_SetValue("spec_autodirector", 0);
gEngfuncs.Cvar_SetValue("spec_autodirector", 1);
}
}

View file

@ -707,10 +707,10 @@ TeamFortressViewport::TeamFortressViewport(int x,int y,int wide,int tall) : Pane
CreateServerBrowser();
// tankefugl: 0000989:
// : 0000989:
// m_chatPanel = new ChatPanel(10, (ScreenHeight() * 0.75 - 30) / 2, ScreenWidth() - 20, 30);
m_chatPanel = new ChatPanel(10, ScreenHeight() * 0.57f - 30, ScreenWidth() - 20, 30);
// :tankefugl
// :
m_chatPanel->setParent(this);
m_chatPanel->setVisible(false);
@ -1611,6 +1611,11 @@ void TeamFortressViewport::UpdateSpectatorPanel()
if ( player && name )
{
strcpy( bottomText, name );
if ( gEngfuncs.IsSpectateOnly() ) {
char tmp[32];
sprintf(tmp, " (%d)", g_PlayerExtraInfo[player].health);
strcat( bottomText, tmp);
}
}
/*
// in first person mode colorize player names
@ -2557,10 +2562,12 @@ int TeamFortressViewport::MsgFunc_ScoreInfo( const char *pszName, int iSize, voi
// Update other info
g_PlayerExtraInfo[info.player_index].frags = info.frags;
g_PlayerExtraInfo[info.player_index].deaths = info.deaths;
g_PlayerExtraInfo[info.player_index].extra = info.extra;
g_PlayerExtraInfo[info.player_index].playerclass = info.player_class;
// puzl: 0001073
// : 0001073
g_PlayerExtraInfo[info.player_index].auth = info.auth;
g_PlayerExtraInfo[info.player_index].teamnumber = max( info.team, 0 );
g_PlayerExtraInfo[info.player_index].health = info.health;
// Icon is now handled through the ProfileInfo update
@ -2579,8 +2586,8 @@ int TeamFortressViewport::MsgFunc_ScoreInfo( const char *pszName, int iSize, voi
int TeamFortressViewport::MsgFunc_TeamScore( const char *pszName, int iSize, void *pbuf )
{
string team_name;
int score, deaths;
NetMsg_TeamScore( pbuf, iSize, team_name, score, deaths );
int score, reset;
NetMsg_TeamScore( pbuf, iSize, team_name, score, reset);
// find the team matching the name
for ( int i = 1; i <= m_pScoreBoard->m_iNumTeams; i++ )
@ -2593,9 +2600,12 @@ int TeamFortressViewport::MsgFunc_TeamScore( const char *pszName, int iSize, voi
return 1;
// use this new score data instead of combined player scores
g_TeamInfo[i].scores_overriden = TRUE;
g_TeamInfo[i].frags = score;
g_TeamInfo[i].deaths = deaths;
if ( reset )
g_TeamInfo[i]. scores_overriden = FALSE;
else
g_TeamInfo[i]. scores_overriden = TRUE;
g_TeamInfo[i].score = score;
return 1;
}

View file

@ -7,6 +7,7 @@
// view/refresh setup functions
#include "hud.h"
#include "cl_util.h"
#include "common/cvardef.h"
@ -20,6 +21,7 @@
#include "pm_shared/pm_movevars.h"
#include "pm_shared/pm_shared.h"
#include "pm_shared/pm_defs.h"
#include "pm_shared/pm_debug.h"
#include "common/event_api.h"
#include "common/pmtrace.h"
#include "common/screenfade.h"
@ -41,8 +43,8 @@ extern float gTopDownViewAngles[3];
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
void PM_ParticleLine( float *start, float *end, int pcolor, float life, float vert);
//#include "pm_shared/pm_debug.h"
//void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert);
int PM_GetVisEntInfo( int ent );
int PM_GetPhysEntInfo( int ent );
void InterpolateAngles( float *start, float *end, float *output, float frac );
@ -2385,7 +2387,32 @@ float CalcFov (float fov_x, float width, float height)
}
int hitent = -1;
extern playermove_t *pmove;
void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert)
{
float linestep = 2.0f;
float curdist;
float len;
vec3_t curpos;
vec3_t diff;
int i;
// Determine distance;
VectorSubtract(end, start, diff);
len = VectorNormalize(diff);
curdist = 0;
while (curdist <= len)
{
for (i = 0; i < 3; i++)
curpos[i] = start[i] + curdist * diff[i];
pmove->PM_Particle( curpos, pcolor, life, 0, vert);
curdist += linestep;
}
}
void V_Move( int mx, int my )
{
float fov;
@ -2399,10 +2426,10 @@ void V_Move( int mx, int my )
vec3_t farpoint;
pmtrace_t tr;
fov = CalcFov( in_fov, (float)ScreenWidth, (float)ScreenHeight );
fov = CalcFov( in_fov, (float)ScreenWidth(), (float)ScreenHeight() );
c_x = (float)ScreenWidth / 2.0;
c_y = (float)ScreenHeight / 2.0;
c_x = (float)ScreenWidth() / 2.0;
c_y = (float)ScreenHeight() / 2.0;
dx = (float)mx - c_x;
dy = (float)my - c_y;
@ -2430,7 +2457,7 @@ void V_Move( int mx, int my )
if ( tr.fraction != 1.0 && tr.ent != 0 )
{
hitent = PM_GetPhysEntInfo( tr.ent );
PM_ParticleLine( (float *)&v_origin, (float *)&tr.endpos, 5, 1.0, 0.0 );
PM_ParticleLine( (vec3_t)v_origin, (vec3_t)tr.endpos, 5, 1.0, 0.0 );
}
else
{

View file

@ -25,6 +25,7 @@
#include "cbase.h"
#include "doors.h"
#include "mod/AvHSpecials.h"
#include "mod/AvHServerVariables.h"
extern DLL_GLOBAL Vector g_vecAttackDir;
@ -255,7 +256,7 @@ LINK_ENTITY_TO_CLASS( func_monsterclip, CFuncMonsterClip );
void CFuncMonsterClip::Spawn( void )
{
CFuncWall::Spawn();
if ( CVAR_GET_FLOAT("showtriggers") == 0 )
if ( ns_cvar_float(showtriggers) == 0 )
pev->effects = EF_NODRAW;
pev->flags |= FL_MONSTERCLIP;
}

View file

@ -674,10 +674,10 @@ private:
#define GIB_NORMAL 0// gib if entity was overkilled
#define GIB_NEVER 1// never gib, no matter how much death damage is done ( freezing, etc )
#define GIB_ALWAYS 2// always gib ( Houndeye Shock, Barnacle Bite )
// puzl: 980
// : 980
// Use gib paramater to control death of recycled buildings
#define GIB_RECYCLED 3// always gib ( Houndeye Shock, Barnacle Bite )
// :puzl
// :
class CBaseMonster;
class CCineMonster;

View file

@ -253,7 +253,7 @@ void ClientDisconnect( edict_t *pEntity )
g_pGameRules->ClientDisconnected( pEntity );
//voogru: If this isnt set, clients around this player will crash.
//: If this isnt set, clients around this player will crash.
pEntity->v.effects |= EF_NODRAW;
}
@ -494,26 +494,27 @@ void Host_Say( edict_t *pEntity, int teamonly )
bool theClientIsPlaying = ((client->GetPlayMode() == PLAYMODE_PLAYING) || (client->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT) || (client->GetPlayMode() == PLAYMODE_REINFORCING));
bool theTalkerIsObserver = theTalkingPlayer->IsObserver();
bool theClientIsObserver = client->IsObserver();
bool theClientIsHLTV = (client->pev->flags & FL_PROXY);
bool theClientInReadyRoom = client->GetInReadyRoom();
if (theClientInReadyRoom != theTalkerInReadyRoom)
if (theClientInReadyRoom != theTalkerInReadyRoom && !theClientIsHLTV)
{
continue;
}
if (!theClientIsObserver || theClientIsPlaying) // Non-playing Observers hear everything.
if (!theClientIsObserver || theClientIsPlaying ) // Non-playing Observers hear everything.
{
if ( theTalkingPlayerIsPlaying && teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE )
continue;
// chat can never go between play area and non-play area
if(theTalkingPlayerIsPlaying != theClientIsPlaying)
if(theTalkingPlayerIsPlaying != theClientIsPlaying && !theClientIsHLTV )
continue;
// chat of any kind doesn't go from ready room to play area in tournament mode
if(theTalkerInReadyRoom && GetGameRules()->GetIsTournamentMode() && theClientIsPlaying)
if(theTalkerInReadyRoom && GetGameRules()->GetIsTournamentMode() && theClientIsPlaying && !theClientIsHLTV)
continue;
}
@ -655,14 +656,14 @@ void ClientCommand( edict_t *pEntity )
// max total length is 192 ...and we're adding a string below ("Unknown command: %s\n")
strncpy( command, pcmd, 127 );
command[127] = '\0';
// puzl: 1071
// : 1071
// Remove printf formatting
for ( int i=0; i < 127; i++ ) {
if ( command[i] == '%' ) {
command[i] = ' ';
}
}
// :puzl
// :
// tell the user they entered an unknown command
ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, UTIL_VarArgs( "Unknown command: %s\n", command ) );
}
@ -1144,6 +1145,50 @@ void ClientPrecache( void )
PRECACHE_UNMODIFIED_MODEL("sprites/umbra.spr");
PRECACHE_UNMODIFIED_MODEL("sprites/umbra2.spr");
PRECACHE_UNMODIFIED_MODEL("sprites/webstrand.spr");
PRECACHE_UNMODIFIED_GENERIC("ns.wad");
PRECACHE_UNMODIFIED_GENERIC("ns2.wad");
PRECACHE_UNMODIFIED_GENERIC("v_wad.wad");
/* PRECACHE_UNMODIFIED_GENERIC("maps/co_angst_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_core_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_daimos_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_ether_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_faceoff_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_kestrel_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_niveus_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_pulse_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_sava_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_ulysses_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_umbra_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_altair_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_ayumi_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_bast_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_caged_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_eclipse_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_eon_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_hera_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_lost_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_lucid_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_machina_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_metal_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_nancy_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_nothing_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_origin_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_prometheus_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_shiva_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_tanith_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/ns_veil_detail.txt");
CStringList list;
string modDir=string(getModDirectory()) + "/";
if(BuildFileList(modDir, "maps/", "*_detail.txt", list))
{
for(CStringList::iterator it=list.begin(); it != list.end(); it++ ) {
int iString = ALLOC_STRING((char*)it);//: We cant do "(char*)theSoundToPrecache" directly cause it causes some wierd problems.
PRECACHE_UNMODIFIED_GENERIC((char*)STRING(iString));
}
}
*/
}
/*
@ -2233,12 +2278,35 @@ One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check for the sp
Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters )
================================
*/
static char *ignoreInConsistencyCheck[] = {
"sound/vox/ssay82.wav",
"sound/vox/ssay83.wav",
0
};
int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message )
{
// Server doesn't care?
if ( CVAR_GET_FLOAT( "mp_consistency" ) != 1 )
return 0;
int i=0;
while ( ignoreInConsistencyCheck[i] != 0 ) {
if ( !strcmp(ignoreInConsistencyCheck[i], filename) )
return 0;
i++;
}
/*if ( strstr(filename, "_detail.txt") != NULL ) {
ALERT(at_console, "Checking consistency of %s\n", filename);
string detailFilename=string("maps/") + STRING(gpGlobals->mapname) + string("_detail.txt");
if ( strcmp(filename, detailFilename.c_str()) != 0 ) {
ALERT(at_console, "Skipping != %s\n", detailFilename.c_str());
return 0;
}
}*/
// Default behavior is to kick the player
sprintf( disconnect_message, "Server is enforcing file consistency for %s\n", filename );
@ -2284,7 +2352,7 @@ inline bool AvHDetermineVisibility(struct entity_state_s *state, int e, edict_t
// Reasoning: if (v.effects & EF_NODRAW) and (ent!=host) were ever true, there would have been a return call in
// AddToFullPack before this function was called.
// Therefore, (ent->v.effects & EF_NODRAW) will always be false and !false will always be true.
// puzl - undid this change as it was causing problems in comm mode. Structures, players etc. were not visible to the comm.
// - undid this change as it was causing problems in comm mode. Structures, players etc. were not visible to the comm.
if(!(ent->v.effects & EF_NODRAW) || theEntityIsAWeldable || theIsNoBuild || (ent->v.classname == MAKE_STRING(kesMP3Audio)))
{
// This is duplicated from the above line for possible efficiency
@ -2797,7 +2865,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
marineGlow = true;
}
if(( marineGlow || (ent->v.team == theReceivingPlayer->pev->team)) && (ent != theReceivingPlayer->edict()) && (ent->v.team != 0))
if(( marineGlow || (ent->v.team == theReceivingPlayer->pev->team)) && (ent != theReceivingPlayer->edict()) && (ent->v.team != TEAM_IND) && (ent->v.team != TEAM_SPECT ) && (ent->v.classname != MAKE_STRING(kesTeamWebStrand)) )
{
state->rendermode = kRenderTransAdd;
state->renderamt = 150;

View file

@ -69,6 +69,7 @@
#include "mod/AvHServerUtil.h"
#include "mod/AvHAlienWeaponConstants.h"
#include "mod/AvHTurret.h"
#include "mod/AvHServerVariables.h"
//#include "mod/AvHMovementUtil.h"
extern DLL_GLOBAL Vector g_vecAttackDir;
@ -351,7 +352,7 @@ void CBaseMonster :: GibMonster( void )
// 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 ( ns_cvar_float(violence_hgibs) != 0 ) // Only the player will ever get here
{
CGib::SpawnHeadGib( pev );
CGib::SpawnRandomGibs( pev, 4, 1 ); // throw some human gibs.
@ -360,7 +361,7 @@ void CBaseMonster :: GibMonster( void )
}
else if ( HasAlienGibs() )
{
if ( CVAR_GET_FLOAT("violence_agibs") != 0 ) // Should never get here, but someone might call it directly
if ( ns_cvar_float(violence_hgibs) != 0 ) // Should never get here, but someone might call it directly
{
CGib::SpawnRandomGibs( pev, 4, 0 ); // Throw alien gibs
}
@ -588,12 +589,12 @@ void CBaseMonster::CallGibMonster( void )
if ( HasHumanGibs() )
{
if ( CVAR_GET_FLOAT("violence_hgibs") == 0 )
if ( ns_cvar_float(violence_hgibs) == 0 )
fade = TRUE;
}
else if ( HasAlienGibs() )
{
if ( CVAR_GET_FLOAT("violence_agibs") == 0 )
if ( ns_cvar_float(violence_agibs) == 0 )
fade = TRUE;
}
@ -1377,7 +1378,7 @@ BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity )
// || (pev->waterlevel == 3 && pEntity->pev->waterlevel == 0))
// return FALSE;
vecLookerOrigin = pev->origin + pev->view_ofs;//look through the caller's 'eyes'
vecLookerOrigin = this->EyePosition();//look through the caller's 'eyes'
vecTargetOrigin = pEntity->EyePosition();
return AvHCheckLineOfSight(vecLookerOrigin, vecTargetOrigin, ENT(pev));
@ -1534,9 +1535,9 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
if(theProtected && theEntityHit)
{
// joev: experiment
// : experiment
EMIT_SOUND(theEntityHit->edict(), CHAN_AUTO, kUmbraBlockedSound, 1.0f, ATTN_NORM);
// :joev
// :
}
else
{
@ -1702,15 +1703,37 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
// x * vecSpread.x * vecRight +
// y * vecSpread.y * vecUp;
// tankefugl: 0000973
Vector vecDir;
// : 0000973
// added inner cone for half of the shots
if (isShotgun && (iShot > (cShots/2)))
if (isShotgun)
{
vecSpread = kSGInnerSpread;
}
// :tankefugl
Vector vecMinSpread;
Vector vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
if ((iShot > (cShots/3)) && (iShot < (cShots*2/3)))
{
vecSpread = kSGMidSpread;
vecMinSpread = kSGInnerSpread;
vecDir = UTIL_GetRandomSpreadDirFrom(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread, vecMinSpread);
}
else
if ((iShot > (cShots*2/3)))
{
vecMinSpread = kSGMidSpread;
vecDir = UTIL_GetRandomSpreadDirFrom(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread, vecMinSpread);
}
else
{
vecSpread = kSGInnerSpread;
vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
}
}
// :
else
{
vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
}
Vector vecEnd;
vecEnd = vecSrc + vecDir * flDistance;
@ -1721,9 +1744,9 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
if(theProtected)
{
// joev: experiment
// : experiment
EMIT_SOUND(theEntityHit->edict(), CHAN_AUTO, kUmbraBlockedSound, 1.0f, ATTN_NORM);
// :joev
// :
}
else
{
@ -1738,7 +1761,7 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
if(theAdjustedDamage)
{
// tankefugl: 0000973
// : 0000973
// removed shotgun fallof
//if ( isShotgun && !( theEntityHit->pev->iuser3 & AVH_USER3_BREAKABLE) )
//{
@ -1750,7 +1773,7 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
// theAdjustedDamage*=fallOff;
// }
//}
// :tankefugl
// :
if ( theAdjustedDamage ) {
theEntityHit->TraceAttack(pevAttacker, theAdjustedDamage, vecDir, &tr, theDamageType | ((theAdjustedDamage > 16) ? DMG_ALWAYSGIB : DMG_NEVERGIB) );
}

View file

@ -22,6 +22,8 @@
#include "decals.h"
#include "func_break.h"
#include "engine/shake.h"
#include "mod/AvHServerVariables.h"
extern cvar_t avh_killdelay;
#define SF_GIBSHOOTER_REPEATABLE 1 // allows a gibshooter to be refired
@ -1454,7 +1456,7 @@ void CGibShooter::Spawn( void )
CGib *CGibShooter :: CreateGib ( void )
{
if ( CVAR_GET_FLOAT("violence_hgibs") == 0 )
if ( ns_cvar_float(violence_hgibs) == 0 )
return NULL;
CGib *pGib = GetClassPtr( (CGib *)NULL );

View file

@ -82,6 +82,15 @@ ENGINE_FORCE_UNMODIFIED(force_exactfile, NULL, NULL, s);
(*g_engfuncs.pfnPrecacheModel)(s);
#endif
#ifdef AVH_SERVER
#define PRECACHE_UNMODIFIED_GENERIC(s) \
(*g_engfuncs.pfnPrecacheGeneric)(s); \
ENGINE_FORCE_UNMODIFIED(force_exactfile, NULL, NULL, s);
#else
#define PRECACHE_UNMODIFIED_GENERIC(s) \
(*g_engfuncs.pfnPrecacheGeneric)(s);
#endif
#ifdef AVH_SERVER
#define PRECACHE_UNMODIFIED_SOUND(s) \
(*g_engfuncs.pfnPrecacheSound)(s); \

View file

@ -110,6 +110,7 @@ cvar_t avh_team1damagepercent = {kvTeam1DamagePercent, "100", FCVAR_SERVER}
cvar_t avh_team2damagepercent = {kvTeam2DamagePercent, "100", FCVAR_SERVER};
cvar_t avh_team3damagepercent = {kvTeam3DamagePercent, "100", FCVAR_SERVER};
cvar_t avh_team4damagepercent = {kvTeam4DamagePercent, "100", FCVAR_SERVER};
cvar_t avh_structurelimit = {kvStructureLimit, "300", FCVAR_SERVER};
cvar_t avh_votecasttime = {kvVoteCastTime, "2", FCVAR_SERVER};
cvar_t avh_votedowntime = {kvVoteDownTime, "180", FCVAR_SERVER};
cvar_t avh_minvotesneeded = {kvMinVotesNeeded, "2", FCVAR_SERVER};
@ -120,6 +121,15 @@ cvar_t avh_autoconcede = {kvAutoConcede, "4", FCVAR_SERVER};
cvar_t avh_combattime = {kvCombatTime, "10", FCVAR_SERVER};
cvar_t avh_mapvoteratio = {kvMapVoteRatio, ".6", FCVAR_SERVER};
cvar_t avh_blockscripts = {kvBlockScripts, "1", FCVAR_SERVER};
#ifdef DEBUG
cvar_t avh_testing = {kvTesting, "0", FCVAR_SERVER};
#endif
cvar_t *avh_cheats=0;
cvar_t *showtriggers=0;
cvar_t *violence_ablood=0;
cvar_t *violence_agibs=0;
cvar_t *violence_hblood=0;
cvar_t *violence_hgibs=0;
// TODO: Remove
cvar_t avh_ironman = {kvIronMan, "0", FCVAR_SERVER};
@ -130,7 +140,6 @@ cvar_t avh_spawninvulnerabletime = {kvSpawnInvulnerableTime, "0", FCVAR_SERVER};
cvar_t avh_trainingmode = {kvTrainingMode,"0", FCVAR_SERVER };
cvar_t avh_assert = {kvAssert, "1", FCVAR_SERVER };
cvar_t avh_bulletcam = {kvBulletCam, "0", FCVAR_SERVER };
cvar_t avh_testing = {kvTesting, "0", FCVAR_SERVER };
cvar_t avh_drawinvisible = {kvDrawInvisible, "0", FCVAR_SERVER };
cvar_t avh_serverscripts = {kvServerScripts, "0", FCVAR_SERVER};
#endif
@ -154,406 +163,6 @@ cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
cvar_t *g_footsteps = NULL;
//CVARS FOR SKILL LEVEL SETTINGS
// Agrunt
cvar_t sk_agrunt_health1 = {"sk_agrunt_health1","0"};
cvar_t sk_agrunt_health2 = {"sk_agrunt_health2","0"};
cvar_t sk_agrunt_health3 = {"sk_agrunt_health3","0"};
cvar_t sk_agrunt_dmg_punch1 = {"sk_agrunt_dmg_punch1","0"};
cvar_t sk_agrunt_dmg_punch2 = {"sk_agrunt_dmg_punch2","0"};
cvar_t sk_agrunt_dmg_punch3 = {"sk_agrunt_dmg_punch3","0"};
// Apache
cvar_t sk_apache_health1 = {"sk_apache_health1","0"};
cvar_t sk_apache_health2 = {"sk_apache_health2","0"};
cvar_t sk_apache_health3 = {"sk_apache_health3","0"};
// Barney
cvar_t sk_barney_health1 = {"sk_barney_health1","0"};
cvar_t sk_barney_health2 = {"sk_barney_health2","0"};
cvar_t sk_barney_health3 = {"sk_barney_health3","0"};
// Bullsquid
cvar_t sk_bullsquid_health1 = {"sk_bullsquid_health1","0"};
cvar_t sk_bullsquid_health2 = {"sk_bullsquid_health2","0"};
cvar_t sk_bullsquid_health3 = {"sk_bullsquid_health3","0"};
cvar_t sk_bullsquid_dmg_bite1 = {"sk_bullsquid_dmg_bite1","0"};
cvar_t sk_bullsquid_dmg_bite2 = {"sk_bullsquid_dmg_bite2","0"};
cvar_t sk_bullsquid_dmg_bite3 = {"sk_bullsquid_dmg_bite3","0"};
cvar_t sk_bullsquid_dmg_whip1 = {"sk_bullsquid_dmg_whip1","0"};
cvar_t sk_bullsquid_dmg_whip2 = {"sk_bullsquid_dmg_whip2","0"};
cvar_t sk_bullsquid_dmg_whip3 = {"sk_bullsquid_dmg_whip3","0"};
cvar_t sk_bullsquid_dmg_spit1 = {"sk_bullsquid_dmg_spit1","0"};
cvar_t sk_bullsquid_dmg_spit2 = {"sk_bullsquid_dmg_spit2","0"};
cvar_t sk_bullsquid_dmg_spit3 = {"sk_bullsquid_dmg_spit3","0"};
// Big Momma
cvar_t sk_bigmomma_health_factor1 = {"sk_bigmomma_health_factor1","1.0"};
cvar_t sk_bigmomma_health_factor2 = {"sk_bigmomma_health_factor2","1.0"};
cvar_t sk_bigmomma_health_factor3 = {"sk_bigmomma_health_factor3","1.0"};
cvar_t sk_bigmomma_dmg_slash1 = {"sk_bigmomma_dmg_slash1","50"};
cvar_t sk_bigmomma_dmg_slash2 = {"sk_bigmomma_dmg_slash2","50"};
cvar_t sk_bigmomma_dmg_slash3 = {"sk_bigmomma_dmg_slash3","50"};
cvar_t sk_bigmomma_dmg_blast1 = {"sk_bigmomma_dmg_blast1","100"};
cvar_t sk_bigmomma_dmg_blast2 = {"sk_bigmomma_dmg_blast2","100"};
cvar_t sk_bigmomma_dmg_blast3 = {"sk_bigmomma_dmg_blast3","100"};
cvar_t sk_bigmomma_radius_blast1 = {"sk_bigmomma_radius_blast1","250"};
cvar_t sk_bigmomma_radius_blast2 = {"sk_bigmomma_radius_blast2","250"};
cvar_t sk_bigmomma_radius_blast3 = {"sk_bigmomma_radius_blast3","250"};
// Gargantua
cvar_t sk_gargantua_health1 = {"sk_gargantua_health1","0"};
cvar_t sk_gargantua_health2 = {"sk_gargantua_health2","0"};
cvar_t sk_gargantua_health3 = {"sk_gargantua_health3","0"};
cvar_t sk_gargantua_dmg_slash1 = {"sk_gargantua_dmg_slash1","0"};
cvar_t sk_gargantua_dmg_slash2 = {"sk_gargantua_dmg_slash2","0"};
cvar_t sk_gargantua_dmg_slash3 = {"sk_gargantua_dmg_slash3","0"};
cvar_t sk_gargantua_dmg_fire1 = {"sk_gargantua_dmg_fire1","0"};
cvar_t sk_gargantua_dmg_fire2 = {"sk_gargantua_dmg_fire2","0"};
cvar_t sk_gargantua_dmg_fire3 = {"sk_gargantua_dmg_fire3","0"};
cvar_t sk_gargantua_dmg_stomp1 = {"sk_gargantua_dmg_stomp1","0"};
cvar_t sk_gargantua_dmg_stomp2 = {"sk_gargantua_dmg_stomp2","0"};
cvar_t sk_gargantua_dmg_stomp3 = {"sk_gargantua_dmg_stomp3","0"};
// Hassassin
cvar_t sk_hassassin_health1 = {"sk_hassassin_health1","0"};
cvar_t sk_hassassin_health2 = {"sk_hassassin_health2","0"};
cvar_t sk_hassassin_health3 = {"sk_hassassin_health3","0"};
// Headcrab
cvar_t sk_headcrab_health1 = {"sk_headcrab_health1","0"};
cvar_t sk_headcrab_health2 = {"sk_headcrab_health2","0"};
cvar_t sk_headcrab_health3 = {"sk_headcrab_health3","0"};
cvar_t sk_headcrab_dmg_bite1 = {"sk_headcrab_dmg_bite1","0"};
cvar_t sk_headcrab_dmg_bite2 = {"sk_headcrab_dmg_bite2","0"};
cvar_t sk_headcrab_dmg_bite3 = {"sk_headcrab_dmg_bite3","0"};
// Hgrunt
cvar_t sk_hgrunt_health1 = {"sk_hgrunt_health1","0"};
cvar_t sk_hgrunt_health2 = {"sk_hgrunt_health2","0"};
cvar_t sk_hgrunt_health3 = {"sk_hgrunt_health3","0"};
cvar_t sk_hgrunt_kick1 = {"sk_hgrunt_kick1","0"};
cvar_t sk_hgrunt_kick2 = {"sk_hgrunt_kick2","0"};
cvar_t sk_hgrunt_kick3 = {"sk_hgrunt_kick3","0"};
cvar_t sk_hgrunt_pellets1 = {"sk_hgrunt_pellets1","0"};
cvar_t sk_hgrunt_pellets2 = {"sk_hgrunt_pellets2","0"};
cvar_t sk_hgrunt_pellets3 = {"sk_hgrunt_pellets3","0"};
cvar_t sk_hgrunt_gspeed1 = {"sk_hgrunt_gspeed1","0"};
cvar_t sk_hgrunt_gspeed2 = {"sk_hgrunt_gspeed2","0"};
cvar_t sk_hgrunt_gspeed3 = {"sk_hgrunt_gspeed3","0"};
// Houndeye
cvar_t sk_houndeye_health1 = {"sk_houndeye_health1","0"};
cvar_t sk_houndeye_health2 = {"sk_houndeye_health2","0"};
cvar_t sk_houndeye_health3 = {"sk_houndeye_health3","0"};
cvar_t sk_houndeye_dmg_blast1 = {"sk_houndeye_dmg_blast1","0"};
cvar_t sk_houndeye_dmg_blast2 = {"sk_houndeye_dmg_blast2","0"};
cvar_t sk_houndeye_dmg_blast3 = {"sk_houndeye_dmg_blast3","0"};
// ISlave
cvar_t sk_islave_health1 = {"sk_islave_health1","0"};
cvar_t sk_islave_health2 = {"sk_islave_health2","0"};
cvar_t sk_islave_health3 = {"sk_islave_health3","0"};
cvar_t sk_islave_dmg_claw1 = {"sk_islave_dmg_claw1","0"};
cvar_t sk_islave_dmg_claw2 = {"sk_islave_dmg_claw2","0"};
cvar_t sk_islave_dmg_claw3 = {"sk_islave_dmg_claw3","0"};
cvar_t sk_islave_dmg_clawrake1 = {"sk_islave_dmg_clawrake1","0"};
cvar_t sk_islave_dmg_clawrake2 = {"sk_islave_dmg_clawrake2","0"};
cvar_t sk_islave_dmg_clawrake3 = {"sk_islave_dmg_clawrake3","0"};
cvar_t sk_islave_dmg_zap1 = {"sk_islave_dmg_zap1","0"};
cvar_t sk_islave_dmg_zap2 = {"sk_islave_dmg_zap2","0"};
cvar_t sk_islave_dmg_zap3 = {"sk_islave_dmg_zap3","0"};
// Icthyosaur
cvar_t sk_ichthyosaur_health1 = {"sk_ichthyosaur_health1","0"};
cvar_t sk_ichthyosaur_health2 = {"sk_ichthyosaur_health2","0"};
cvar_t sk_ichthyosaur_health3 = {"sk_ichthyosaur_health3","0"};
cvar_t sk_ichthyosaur_shake1 = {"sk_ichthyosaur_shake1","0"};
cvar_t sk_ichthyosaur_shake2 = {"sk_ichthyosaur_shake2","0"};
cvar_t sk_ichthyosaur_shake3 = {"sk_ichthyosaur_shake3","0"};
// Leech
cvar_t sk_leech_health1 = {"sk_leech_health1","0"};
cvar_t sk_leech_health2 = {"sk_leech_health2","0"};
cvar_t sk_leech_health3 = {"sk_leech_health3","0"};
cvar_t sk_leech_dmg_bite1 = {"sk_leech_dmg_bite1","0"};
cvar_t sk_leech_dmg_bite2 = {"sk_leech_dmg_bite2","0"};
cvar_t sk_leech_dmg_bite3 = {"sk_leech_dmg_bite3","0"};
// Controller
cvar_t sk_controller_health1 = {"sk_controller_health1","0"};
cvar_t sk_controller_health2 = {"sk_controller_health2","0"};
cvar_t sk_controller_health3 = {"sk_controller_health3","0"};
cvar_t sk_controller_dmgzap1 = {"sk_controller_dmgzap1","0"};
cvar_t sk_controller_dmgzap2 = {"sk_controller_dmgzap2","0"};
cvar_t sk_controller_dmgzap3 = {"sk_controller_dmgzap3","0"};
cvar_t sk_controller_speedball1 = {"sk_controller_speedball1","0"};
cvar_t sk_controller_speedball2 = {"sk_controller_speedball2","0"};
cvar_t sk_controller_speedball3 = {"sk_controller_speedball3","0"};
cvar_t sk_controller_dmgball1 = {"sk_controller_dmgball1","0"};
cvar_t sk_controller_dmgball2 = {"sk_controller_dmgball2","0"};
cvar_t sk_controller_dmgball3 = {"sk_controller_dmgball3","0"};
// Nihilanth
cvar_t sk_nihilanth_health1 = {"sk_nihilanth_health1","0"};
cvar_t sk_nihilanth_health2 = {"sk_nihilanth_health2","0"};
cvar_t sk_nihilanth_health3 = {"sk_nihilanth_health3","0"};
cvar_t sk_nihilanth_zap1 = {"sk_nihilanth_zap1","0"};
cvar_t sk_nihilanth_zap2 = {"sk_nihilanth_zap2","0"};
cvar_t sk_nihilanth_zap3 = {"sk_nihilanth_zap3","0"};
// Scientist
cvar_t sk_scientist_health1 = {"sk_scientist_health1","0"};
cvar_t sk_scientist_health2 = {"sk_scientist_health2","0"};
cvar_t sk_scientist_health3 = {"sk_scientist_health3","0"};
// Snark
cvar_t sk_snark_health1 = {"sk_snark_health1","0"};
cvar_t sk_snark_health2 = {"sk_snark_health2","0"};
cvar_t sk_snark_health3 = {"sk_snark_health3","0"};
cvar_t sk_snark_dmg_bite1 = {"sk_snark_dmg_bite1","0"};
cvar_t sk_snark_dmg_bite2 = {"sk_snark_dmg_bite2","0"};
cvar_t sk_snark_dmg_bite3 = {"sk_snark_dmg_bite3","0"};
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"};
// Zombie
cvar_t sk_zombie_health1 = {"sk_zombie_health1","0"};
cvar_t sk_zombie_health2 = {"sk_zombie_health2","0"};
cvar_t sk_zombie_health3 = {"sk_zombie_health3","0"};
cvar_t sk_zombie_dmg_one_slash1 = {"sk_zombie_dmg_one_slash1","0"};
cvar_t sk_zombie_dmg_one_slash2 = {"sk_zombie_dmg_one_slash2","0"};
cvar_t sk_zombie_dmg_one_slash3 = {"sk_zombie_dmg_one_slash3","0"};
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"};
//Turret
cvar_t sk_turret_health1 = {"sk_turret_health1","0"};
cvar_t sk_turret_health2 = {"sk_turret_health2","0"};
cvar_t sk_turret_health3 = {"sk_turret_health3","0"};
// MiniTurret
cvar_t sk_miniturret_health1 = {"sk_miniturret_health1","0"};
cvar_t sk_miniturret_health2 = {"sk_miniturret_health2","0"};
cvar_t sk_miniturret_health3 = {"sk_miniturret_health3","0"};
// Sentry Turret
cvar_t sk_sentry_health1 = {"sk_sentry_health1","0"};
cvar_t sk_sentry_health2 = {"sk_sentry_health2","0"};
cvar_t sk_sentry_health3 = {"sk_sentry_health3","0"};
// PLAYER WEAPONS
// Crowbar whack
cvar_t sk_plr_crowbar1 = {"sk_plr_crowbar1","0"};
cvar_t sk_plr_crowbar2 = {"sk_plr_crowbar2","0"};
cvar_t sk_plr_crowbar3 = {"sk_plr_crowbar3","0"};
// Glock Round
cvar_t sk_plr_9mm_bullet1 = {"sk_plr_9mm_bullet1","0"};
cvar_t sk_plr_9mm_bullet2 = {"sk_plr_9mm_bullet2","0"};
cvar_t sk_plr_9mm_bullet3 = {"sk_plr_9mm_bullet3","0"};
// 357 Round
cvar_t sk_plr_357_bullet1 = {"sk_plr_357_bullet1","0"};
cvar_t sk_plr_357_bullet2 = {"sk_plr_357_bullet2","0"};
cvar_t sk_plr_357_bullet3 = {"sk_plr_357_bullet3","0"};
// MP5 Round
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"};
// 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"};
// Shotgun buckshot
cvar_t sk_plr_buckshot1 = {"sk_plr_buckshot1","0"};
cvar_t sk_plr_buckshot2 = {"sk_plr_buckshot2","0"};
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"};
// RPG
cvar_t sk_plr_rpg1 = {"sk_plr_rpg1","0"};
cvar_t sk_plr_rpg2 = {"sk_plr_rpg2","0"};
cvar_t sk_plr_rpg3 = {"sk_plr_rpg3","0"};
// Zero Point Generator
cvar_t sk_plr_gauss1 = {"sk_plr_gauss1","0"};
cvar_t sk_plr_gauss2 = {"sk_plr_gauss2","0"};
cvar_t sk_plr_gauss3 = {"sk_plr_gauss3","0"};
// Tau Cannon
cvar_t sk_plr_egon_narrow1 = {"sk_plr_egon_narrow1","0"};
cvar_t sk_plr_egon_narrow2 = {"sk_plr_egon_narrow2","0"};
cvar_t sk_plr_egon_narrow3 = {"sk_plr_egon_narrow3","0"};
cvar_t sk_plr_egon_wide1 = {"sk_plr_egon_wide1","0"};
cvar_t sk_plr_egon_wide2 = {"sk_plr_egon_wide2","0"};
cvar_t sk_plr_egon_wide3 = {"sk_plr_egon_wide3","0"};
// Hand Grendade
cvar_t sk_plr_hand_grenade1 = {"sk_plr_hand_grenade1","0"};
cvar_t sk_plr_hand_grenade2 = {"sk_plr_hand_grenade2","0"};
cvar_t sk_plr_hand_grenade3 = {"sk_plr_hand_grenade3","0"};
// Satchel Charge
cvar_t sk_plr_satchel1 = {"sk_plr_satchel1","0"};
cvar_t sk_plr_satchel2 = {"sk_plr_satchel2","0"};
cvar_t sk_plr_satchel3 = {"sk_plr_satchel3","0"};
// Tripmine
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"};
// WORLD WEAPONS
cvar_t sk_12mm_bullet1 = {"sk_12mm_bullet1","0"};
cvar_t sk_12mm_bullet2 = {"sk_12mm_bullet2","0"};
cvar_t sk_12mm_bullet3 = {"sk_12mm_bullet3","0"};
cvar_t sk_9mmAR_bullet1 = {"sk_9mmAR_bullet1","0"};
cvar_t sk_9mmAR_bullet2 = {"sk_9mmAR_bullet2","0"};
cvar_t sk_9mmAR_bullet3 = {"sk_9mmAR_bullet3","0"};
cvar_t sk_9mm_bullet1 = {"sk_9mm_bullet1","0"};
cvar_t sk_9mm_bullet2 = {"sk_9mm_bullet2","0"};
cvar_t sk_9mm_bullet3 = {"sk_9mm_bullet3","0"};
// HORNET
cvar_t sk_hornet_dmg1 = {"sk_hornet_dmg1","0"};
cvar_t sk_hornet_dmg2 = {"sk_hornet_dmg2","0"};
cvar_t sk_hornet_dmg3 = {"sk_hornet_dmg3","0"};
// HEALTH/CHARGE
cvar_t sk_suitcharger1 = { "sk_suitcharger1","0" };
cvar_t sk_suitcharger2 = { "sk_suitcharger2","0" };
cvar_t sk_suitcharger3 = { "sk_suitcharger3","0" };
cvar_t sk_battery1 = { "sk_battery1","0" };
cvar_t sk_battery2 = { "sk_battery2","0" };
cvar_t sk_battery3 = { "sk_battery3","0" };
cvar_t sk_healthcharger1 = { "sk_healthcharger1","0" };
cvar_t sk_healthcharger2 = { "sk_healthcharger2","0" };
cvar_t sk_healthcharger3 = { "sk_healthcharger3","0" };
cvar_t sk_healthkit1 = { "sk_healthkit1","0" };
cvar_t sk_healthkit2 = { "sk_healthkit2","0" };
cvar_t sk_healthkit3 = { "sk_healthkit3","0" };
cvar_t sk_scientist_heal1 = { "sk_scientist_heal1","0" };
cvar_t sk_scientist_heal2 = { "sk_scientist_heal2","0" };
cvar_t sk_scientist_heal3 = { "sk_scientist_heal3","0" };
// monster damage adjusters
cvar_t sk_monster_head1 = { "sk_monster_head1","2" };
cvar_t sk_monster_head2 = { "sk_monster_head2","2" };
cvar_t sk_monster_head3 = { "sk_monster_head3","2" };
cvar_t sk_monster_chest1 = { "sk_monster_chest1","1" };
cvar_t sk_monster_chest2 = { "sk_monster_chest2","1" };
cvar_t sk_monster_chest3 = { "sk_monster_chest3","1" };
cvar_t sk_monster_stomach1 = { "sk_monster_stomach1","1" };
cvar_t sk_monster_stomach2 = { "sk_monster_stomach2","1" };
cvar_t sk_monster_stomach3 = { "sk_monster_stomach3","1" };
cvar_t sk_monster_arm1 = { "sk_monster_arm1","1" };
cvar_t sk_monster_arm2 = { "sk_monster_arm2","1" };
cvar_t sk_monster_arm3 = { "sk_monster_arm3","1" };
cvar_t sk_monster_leg1 = { "sk_monster_leg1","1" };
cvar_t sk_monster_leg2 = { "sk_monster_leg2","1" };
cvar_t sk_monster_leg3 = { "sk_monster_leg3","1" };
// player damage adjusters
cvar_t sk_player_head1 = { "sk_player_head1","2" };
cvar_t sk_player_head2 = { "sk_player_head2","2" };
cvar_t sk_player_head3 = { "sk_player_head3","2" };
cvar_t sk_player_chest1 = { "sk_player_chest1","1" };
cvar_t sk_player_chest2 = { "sk_player_chest2","1" };
cvar_t sk_player_chest3 = { "sk_player_chest3","1" };
cvar_t sk_player_stomach1 = { "sk_player_stomach1","1" };
cvar_t sk_player_stomach2 = { "sk_player_stomach2","1" };
cvar_t sk_player_stomach3 = { "sk_player_stomach3","1" };
cvar_t sk_player_arm1 = { "sk_player_arm1","1" };
cvar_t sk_player_arm2 = { "sk_player_arm2","1" };
cvar_t sk_player_arm3 = { "sk_player_arm3","1" };
cvar_t sk_player_leg1 = { "sk_player_leg1","1" };
cvar_t sk_player_leg2 = { "sk_player_leg2","1" };
cvar_t sk_player_leg3 = { "sk_player_leg3","1" };
// END Cvars for Skill Level settings
// Register your console variables here
@ -595,6 +204,14 @@ void GameDLLInit( void )
CVAR_REGISTER (&avh_deathmatchmode);
CVAR_REGISTER (&avh_countdowntime);
avh_cheats=CVAR_GET_POINTER("sv_cheats");
showtriggers=CVAR_GET_POINTER("showtriggers");
violence_ablood=CVAR_GET_POINTER("violence_ablood");
violence_agibs=CVAR_GET_POINTER("violence_agibs");
violence_hblood=CVAR_GET_POINTER("violence_hblood");
violence_hgibs=CVAR_GET_POINTER("violence_hgibs");
CVAR_REGISTER (&avh_latejointime);
CVAR_REGISTER (&avh_logdetail);
//CVAR_REGISTER (&avh_teamsizehandicapping);
@ -602,6 +219,7 @@ void GameDLLInit( void )
CVAR_REGISTER (&avh_team2damagepercent);
CVAR_REGISTER (&avh_team3damagepercent);
CVAR_REGISTER (&avh_team4damagepercent);
CVAR_REGISTER (&avh_structurelimit);
CVAR_REGISTER (&avh_votecasttime);
CVAR_REGISTER (&avh_votedowntime);
CVAR_REGISTER (&avh_minvotesneeded);
@ -639,407 +257,5 @@ void GameDLLInit( void )
CVAR_REGISTER (&avh_uplink);
CVAR_REGISTER (&avh_killdelay);
// REGISTER CVARS FOR SKILL LEVEL STUFF
// Agrunt
CVAR_REGISTER ( &sk_agrunt_health1 );// {"sk_agrunt_health1","0"};
CVAR_REGISTER ( &sk_agrunt_health2 );// {"sk_agrunt_health2","0"};
CVAR_REGISTER ( &sk_agrunt_health3 );// {"sk_agrunt_health3","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch1 );// {"sk_agrunt_dmg_punch1","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch2 );// {"sk_agrunt_dmg_punch2","0"};
CVAR_REGISTER ( &sk_agrunt_dmg_punch3 );// {"sk_agrunt_dmg_punch3","0"};
// Apache
CVAR_REGISTER ( &sk_apache_health1 );// {"sk_apache_health1","0"};
CVAR_REGISTER ( &sk_apache_health2 );// {"sk_apache_health2","0"};
CVAR_REGISTER ( &sk_apache_health3 );// {"sk_apache_health3","0"};
// Barney
CVAR_REGISTER ( &sk_barney_health1 );// {"sk_barney_health1","0"};
CVAR_REGISTER ( &sk_barney_health2 );// {"sk_barney_health2","0"};
CVAR_REGISTER ( &sk_barney_health3 );// {"sk_barney_health3","0"};
// Bullsquid
CVAR_REGISTER ( &sk_bullsquid_health1 );// {"sk_bullsquid_health1","0"};
CVAR_REGISTER ( &sk_bullsquid_health2 );// {"sk_bullsquid_health2","0"};
CVAR_REGISTER ( &sk_bullsquid_health3 );// {"sk_bullsquid_health3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite1 );// {"sk_bullsquid_dmg_bite1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite2 );// {"sk_bullsquid_dmg_bite2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_bite3 );// {"sk_bullsquid_dmg_bite3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip1 );// {"sk_bullsquid_dmg_whip1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip2 );// {"sk_bullsquid_dmg_whip2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_whip3 );// {"sk_bullsquid_dmg_whip3","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit1 );// {"sk_bullsquid_dmg_spit1","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit2 );// {"sk_bullsquid_dmg_spit2","0"};
CVAR_REGISTER ( &sk_bullsquid_dmg_spit3 );// {"sk_bullsquid_dmg_spit3","0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor1 );// {"sk_bigmomma_health_factor1","1.0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor2 );// {"sk_bigmomma_health_factor2","1.0"};
CVAR_REGISTER ( &sk_bigmomma_health_factor3 );// {"sk_bigmomma_health_factor3","1.0"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash1 );// {"sk_bigmomma_dmg_slash1","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash2 );// {"sk_bigmomma_dmg_slash2","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_slash3 );// {"sk_bigmomma_dmg_slash3","50"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast1 );// {"sk_bigmomma_dmg_blast1","100"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast2 );// {"sk_bigmomma_dmg_blast2","100"};
CVAR_REGISTER ( &sk_bigmomma_dmg_blast3 );// {"sk_bigmomma_dmg_blast3","100"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast1 );// {"sk_bigmomma_radius_blast1","250"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast2 );// {"sk_bigmomma_radius_blast2","250"};
CVAR_REGISTER ( &sk_bigmomma_radius_blast3 );// {"sk_bigmomma_radius_blast3","250"};
// Gargantua
CVAR_REGISTER ( &sk_gargantua_health1 );// {"sk_gargantua_health1","0"};
CVAR_REGISTER ( &sk_gargantua_health2 );// {"sk_gargantua_health2","0"};
CVAR_REGISTER ( &sk_gargantua_health3 );// {"sk_gargantua_health3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash1 );// {"sk_gargantua_dmg_slash1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash2 );// {"sk_gargantua_dmg_slash2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_slash3 );// {"sk_gargantua_dmg_slash3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire1 );// {"sk_gargantua_dmg_fire1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire2 );// {"sk_gargantua_dmg_fire2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_fire3 );// {"sk_gargantua_dmg_fire3","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp1 );// {"sk_gargantua_dmg_stomp1","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp2 );// {"sk_gargantua_dmg_stomp2","0"};
CVAR_REGISTER ( &sk_gargantua_dmg_stomp3 );// {"sk_gargantua_dmg_stomp3","0"};
// Hassassin
CVAR_REGISTER ( &sk_hassassin_health1 );// {"sk_hassassin_health1","0"};
CVAR_REGISTER ( &sk_hassassin_health2 );// {"sk_hassassin_health2","0"};
CVAR_REGISTER ( &sk_hassassin_health3 );// {"sk_hassassin_health3","0"};
// Headcrab
CVAR_REGISTER ( &sk_headcrab_health1 );// {"sk_headcrab_health1","0"};
CVAR_REGISTER ( &sk_headcrab_health2 );// {"sk_headcrab_health2","0"};
CVAR_REGISTER ( &sk_headcrab_health3 );// {"sk_headcrab_health3","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite1 );// {"sk_headcrab_dmg_bite1","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite2 );// {"sk_headcrab_dmg_bite2","0"};
CVAR_REGISTER ( &sk_headcrab_dmg_bite3 );// {"sk_headcrab_dmg_bite3","0"};
// Hgrunt
CVAR_REGISTER ( &sk_hgrunt_health1 );// {"sk_hgrunt_health1","0"};
CVAR_REGISTER ( &sk_hgrunt_health2 );// {"sk_hgrunt_health2","0"};
CVAR_REGISTER ( &sk_hgrunt_health3 );// {"sk_hgrunt_health3","0"};
CVAR_REGISTER ( &sk_hgrunt_kick1 );// {"sk_hgrunt_kick1","0"};
CVAR_REGISTER ( &sk_hgrunt_kick2 );// {"sk_hgrunt_kick2","0"};
CVAR_REGISTER ( &sk_hgrunt_kick3 );// {"sk_hgrunt_kick3","0"};
CVAR_REGISTER ( &sk_hgrunt_pellets1 );
CVAR_REGISTER ( &sk_hgrunt_pellets2 );
CVAR_REGISTER ( &sk_hgrunt_pellets3 );
CVAR_REGISTER ( &sk_hgrunt_gspeed1 );
CVAR_REGISTER ( &sk_hgrunt_gspeed2 );
CVAR_REGISTER ( &sk_hgrunt_gspeed3 );
// Houndeye
CVAR_REGISTER ( &sk_houndeye_health1 );// {"sk_houndeye_health1","0"};
CVAR_REGISTER ( &sk_houndeye_health2 );// {"sk_houndeye_health2","0"};
CVAR_REGISTER ( &sk_houndeye_health3 );// {"sk_houndeye_health3","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast1 );// {"sk_houndeye_dmg_blast1","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast2 );// {"sk_houndeye_dmg_blast2","0"};
CVAR_REGISTER ( &sk_houndeye_dmg_blast3 );// {"sk_houndeye_dmg_blast3","0"};
// ISlave
CVAR_REGISTER ( &sk_islave_health1 );// {"sk_islave_health1","0"};
CVAR_REGISTER ( &sk_islave_health2 );// {"sk_islave_health2","0"};
CVAR_REGISTER ( &sk_islave_health3 );// {"sk_islave_health3","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw1 );// {"sk_islave_dmg_claw1","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw2 );// {"sk_islave_dmg_claw2","0"};
CVAR_REGISTER ( &sk_islave_dmg_claw3 );// {"sk_islave_dmg_claw3","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake1 );// {"sk_islave_dmg_clawrake1","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake2 );// {"sk_islave_dmg_clawrake2","0"};
CVAR_REGISTER ( &sk_islave_dmg_clawrake3 );// {"sk_islave_dmg_clawrake3","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap1 );// {"sk_islave_dmg_zap1","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap2 );// {"sk_islave_dmg_zap2","0"};
CVAR_REGISTER ( &sk_islave_dmg_zap3 );// {"sk_islave_dmg_zap3","0"};
// Icthyosaur
CVAR_REGISTER ( &sk_ichthyosaur_health1 );// {"sk_ichthyosaur_health1","0"};
CVAR_REGISTER ( &sk_ichthyosaur_health2 );// {"sk_ichthyosaur_health2","0"};
CVAR_REGISTER ( &sk_ichthyosaur_health3 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake1 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake2 );// {"sk_ichthyosaur_health3","0"};
CVAR_REGISTER ( &sk_ichthyosaur_shake3 );// {"sk_ichthyosaur_health3","0"};
// Leech
CVAR_REGISTER ( &sk_leech_health1 );// {"sk_leech_health1","0"};
CVAR_REGISTER ( &sk_leech_health2 );// {"sk_leech_health2","0"};
CVAR_REGISTER ( &sk_leech_health3 );// {"sk_leech_health3","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite1 );// {"sk_leech_dmg_bite1","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite2 );// {"sk_leech_dmg_bite2","0"};
CVAR_REGISTER ( &sk_leech_dmg_bite3 );// {"sk_leech_dmg_bite3","0"};
// Controller
CVAR_REGISTER ( &sk_controller_health1 );
CVAR_REGISTER ( &sk_controller_health2 );
CVAR_REGISTER ( &sk_controller_health3 );
CVAR_REGISTER ( &sk_controller_dmgzap1 );
CVAR_REGISTER ( &sk_controller_dmgzap2 );
CVAR_REGISTER ( &sk_controller_dmgzap3 );
CVAR_REGISTER ( &sk_controller_speedball1 );
CVAR_REGISTER ( &sk_controller_speedball2 );
CVAR_REGISTER ( &sk_controller_speedball3 );
CVAR_REGISTER ( &sk_controller_dmgball1 );
CVAR_REGISTER ( &sk_controller_dmgball2 );
CVAR_REGISTER ( &sk_controller_dmgball3 );
// Nihilanth
CVAR_REGISTER ( &sk_nihilanth_health1 );// {"sk_nihilanth_health1","0"};
CVAR_REGISTER ( &sk_nihilanth_health2 );// {"sk_nihilanth_health2","0"};
CVAR_REGISTER ( &sk_nihilanth_health3 );// {"sk_nihilanth_health3","0"};
CVAR_REGISTER ( &sk_nihilanth_zap1 );
CVAR_REGISTER ( &sk_nihilanth_zap2 );
CVAR_REGISTER ( &sk_nihilanth_zap3 );
// Scientist
CVAR_REGISTER ( &sk_scientist_health1 );// {"sk_scientist_health1","0"};
CVAR_REGISTER ( &sk_scientist_health2 );// {"sk_scientist_health2","0"};
CVAR_REGISTER ( &sk_scientist_health3 );// {"sk_scientist_health3","0"};
// Snark
CVAR_REGISTER ( &sk_snark_health1 );// {"sk_snark_health1","0"};
CVAR_REGISTER ( &sk_snark_health2 );// {"sk_snark_health2","0"};
CVAR_REGISTER ( &sk_snark_health3 );// {"sk_snark_health3","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite1 );// {"sk_snark_dmg_bite1","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite2 );// {"sk_snark_dmg_bite2","0"};
CVAR_REGISTER ( &sk_snark_dmg_bite3 );// {"sk_snark_dmg_bite3","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop1 );// {"sk_snark_dmg_pop1","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop2 );// {"sk_snark_dmg_pop2","0"};
CVAR_REGISTER ( &sk_snark_dmg_pop3 );// {"sk_snark_dmg_pop3","0"};
// Zombie
CVAR_REGISTER ( &sk_zombie_health1 );// {"sk_zombie_health1","0"};
CVAR_REGISTER ( &sk_zombie_health2 );// {"sk_zombie_health3","0"};
CVAR_REGISTER ( &sk_zombie_health3 );// {"sk_zombie_health3","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash1 );// {"sk_zombie_dmg_one_slash1","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash2 );// {"sk_zombie_dmg_one_slash2","0"};
CVAR_REGISTER ( &sk_zombie_dmg_one_slash3 );// {"sk_zombie_dmg_one_slash3","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash1 );// {"sk_zombie_dmg_both_slash1","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash2 );// {"sk_zombie_dmg_both_slash2","0"};
CVAR_REGISTER ( &sk_zombie_dmg_both_slash3 );// {"sk_zombie_dmg_both_slash3","0"};
//Turret
CVAR_REGISTER ( &sk_turret_health1 );// {"sk_turret_health1","0"};
CVAR_REGISTER ( &sk_turret_health2 );// {"sk_turret_health2","0"};
CVAR_REGISTER ( &sk_turret_health3 );// {"sk_turret_health3","0"};
// MiniTurret
CVAR_REGISTER ( &sk_miniturret_health1 );// {"sk_miniturret_health1","0"};
CVAR_REGISTER ( &sk_miniturret_health2 );// {"sk_miniturret_health2","0"};
CVAR_REGISTER ( &sk_miniturret_health3 );// {"sk_miniturret_health3","0"};
// Sentry Turret
CVAR_REGISTER ( &sk_sentry_health1 );// {"sk_sentry_health1","0"};
CVAR_REGISTER ( &sk_sentry_health2 );// {"sk_sentry_health2","0"};
CVAR_REGISTER ( &sk_sentry_health3 );// {"sk_sentry_health3","0"};
// PLAYER WEAPONS
// Crowbar whack
CVAR_REGISTER ( &sk_plr_crowbar1 );// {"sk_plr_crowbar1","0"};
CVAR_REGISTER ( &sk_plr_crowbar2 );// {"sk_plr_crowbar2","0"};
CVAR_REGISTER ( &sk_plr_crowbar3 );// {"sk_plr_crowbar3","0"};
// Glock Round
CVAR_REGISTER ( &sk_plr_9mm_bullet1 );// {"sk_plr_9mm_bullet1","0"};
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"};
// MP5 Round
CVAR_REGISTER ( &sk_plr_9mmAR_bullet1 );// {"sk_plr_9mmAR_bullet1","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_bullet2 );// {"sk_plr_9mmAR_bullet2","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_bullet3 );// {"sk_plr_9mmAR_bullet3","0"};
// M203 grenade
CVAR_REGISTER ( &sk_plr_9mmAR_grenade1 );// {"sk_plr_9mmAR_grenade1","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_grenade2 );// {"sk_plr_9mmAR_grenade2","0"};
CVAR_REGISTER ( &sk_plr_9mmAR_grenade3 );// {"sk_plr_9mmAR_grenade3","0"};
// 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"};
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"};
// 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"};
// Gauss Gun
CVAR_REGISTER ( &sk_plr_gauss1 );// {"sk_plr_gauss1","0"};
CVAR_REGISTER ( &sk_plr_gauss2 );// {"sk_plr_gauss2","0"};
CVAR_REGISTER ( &sk_plr_gauss3 );// {"sk_plr_gauss3","0"};
// Egon Gun
CVAR_REGISTER ( &sk_plr_egon_narrow1 );// {"sk_plr_egon_narrow1","0"};
CVAR_REGISTER ( &sk_plr_egon_narrow2 );// {"sk_plr_egon_narrow2","0"};
CVAR_REGISTER ( &sk_plr_egon_narrow3 );// {"sk_plr_egon_narrow3","0"};
CVAR_REGISTER ( &sk_plr_egon_wide1 );// {"sk_plr_egon_wide1","0"};
CVAR_REGISTER ( &sk_plr_egon_wide2 );// {"sk_plr_egon_wide2","0"};
CVAR_REGISTER ( &sk_plr_egon_wide3 );// {"sk_plr_egon_wide3","0"};
// Hand Grendade
CVAR_REGISTER ( &sk_plr_hand_grenade1 );// {"sk_plr_hand_grenade1","0"};
CVAR_REGISTER ( &sk_plr_hand_grenade2 );// {"sk_plr_hand_grenade2","0"};
CVAR_REGISTER ( &sk_plr_hand_grenade3 );// {"sk_plr_hand_grenade3","0"};
// Satchel Charge
CVAR_REGISTER ( &sk_plr_satchel1 );// {"sk_plr_satchel1","0"};
CVAR_REGISTER ( &sk_plr_satchel2 );// {"sk_plr_satchel2","0"};
CVAR_REGISTER ( &sk_plr_satchel3 );// {"sk_plr_satchel3","0"};
// Tripmine
CVAR_REGISTER ( &sk_plr_tripmine1 );// {"sk_plr_tripmine1","0"};
CVAR_REGISTER ( &sk_plr_tripmine2 );// {"sk_plr_tripmine2","0"};
CVAR_REGISTER ( &sk_plr_tripmine3 );// {"sk_plr_tripmine3","0"};
// WORLD WEAPONS
CVAR_REGISTER ( &sk_12mm_bullet1 );// {"sk_12mm_bullet1","0"};
CVAR_REGISTER ( &sk_12mm_bullet2 );// {"sk_12mm_bullet2","0"};
CVAR_REGISTER ( &sk_12mm_bullet3 );// {"sk_12mm_bullet3","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet1 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet2 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mmAR_bullet3 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mm_bullet1 );// {"sk_9mm_bullet1","0"};
CVAR_REGISTER ( &sk_9mm_bullet2 );// {"sk_9mm_bullet2","0"};
CVAR_REGISTER ( &sk_9mm_bullet3 );// {"sk_9mm_bullet3","0"};
// HORNET
CVAR_REGISTER ( &sk_hornet_dmg1 );// {"sk_hornet_dmg1","0"};
CVAR_REGISTER ( &sk_hornet_dmg2 );// {"sk_hornet_dmg2","0"};
CVAR_REGISTER ( &sk_hornet_dmg3 );// {"sk_hornet_dmg3","0"};
// HEALTH/SUIT CHARGE DISTRIBUTION
CVAR_REGISTER ( &sk_suitcharger1 );
CVAR_REGISTER ( &sk_suitcharger2 );
CVAR_REGISTER ( &sk_suitcharger3 );
CVAR_REGISTER ( &sk_battery1 );
CVAR_REGISTER ( &sk_battery2 );
CVAR_REGISTER ( &sk_battery3 );
CVAR_REGISTER ( &sk_healthcharger1 );
CVAR_REGISTER ( &sk_healthcharger2 );
CVAR_REGISTER ( &sk_healthcharger3 );
CVAR_REGISTER ( &sk_healthkit1 );
CVAR_REGISTER ( &sk_healthkit2 );
CVAR_REGISTER ( &sk_healthkit3 );
CVAR_REGISTER ( &sk_scientist_heal1 );
CVAR_REGISTER ( &sk_scientist_heal2 );
CVAR_REGISTER ( &sk_scientist_heal3 );
// monster damage adjusters
CVAR_REGISTER ( &sk_monster_head1 );
CVAR_REGISTER ( &sk_monster_head2 );
CVAR_REGISTER ( &sk_monster_head3 );
CVAR_REGISTER ( &sk_monster_chest1 );
CVAR_REGISTER ( &sk_monster_chest2 );
CVAR_REGISTER ( &sk_monster_chest3 );
CVAR_REGISTER ( &sk_monster_stomach1 );
CVAR_REGISTER ( &sk_monster_stomach2 );
CVAR_REGISTER ( &sk_monster_stomach3 );
CVAR_REGISTER ( &sk_monster_arm1 );
CVAR_REGISTER ( &sk_monster_arm2 );
CVAR_REGISTER ( &sk_monster_arm3 );
CVAR_REGISTER ( &sk_monster_leg1 );
CVAR_REGISTER ( &sk_monster_leg2 );
CVAR_REGISTER ( &sk_monster_leg3 );
// player damage adjusters
CVAR_REGISTER ( &sk_player_head1 );
CVAR_REGISTER ( &sk_player_head2 );
CVAR_REGISTER ( &sk_player_head3 );
CVAR_REGISTER ( &sk_player_chest1 );
CVAR_REGISTER ( &sk_player_chest2 );
CVAR_REGISTER ( &sk_player_chest3 );
CVAR_REGISTER ( &sk_player_stomach1 );
CVAR_REGISTER ( &sk_player_stomach2 );
CVAR_REGISTER ( &sk_player_stomach3 );
CVAR_REGISTER ( &sk_player_arm1 );
CVAR_REGISTER ( &sk_player_arm2 );
CVAR_REGISTER ( &sk_player_arm3 );
CVAR_REGISTER ( &sk_player_leg1 );
CVAR_REGISTER ( &sk_player_leg2 );
CVAR_REGISTER ( &sk_player_leg3 );
// END REGISTER CVARS FOR SKILL LEVEL STUFF
SERVER_COMMAND( "exec skill.cfg\n" );
}

View file

@ -109,196 +109,6 @@ BOOL CGameRules::CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pWeap
//=========================================================
void CGameRules::RefreshSkillData ( void )
{
int iSkill;
iSkill = (int)CVAR_GET_FLOAT("skill");
g_iSkillLevel = iSkill;
if ( iSkill < 1 )
{
iSkill = 1;
}
else if ( iSkill > 3 )
{
iSkill = 3;
}
gSkillData.iSkillLevel = iSkill;
ALERT ( at_console, "\nGAME SKILL LEVEL:%d\n",iSkill );
//Agrunt
gSkillData.agruntHealth = GetSkillCvar( "sk_agrunt_health" );
gSkillData.agruntDmgPunch = GetSkillCvar( "sk_agrunt_dmg_punch");
// Apache
gSkillData.apacheHealth = GetSkillCvar( "sk_apache_health");
// Barney
gSkillData.barneyHealth = GetSkillCvar( "sk_barney_health");
// Big Momma
gSkillData.bigmommaHealthFactor = GetSkillCvar( "sk_bigmomma_health_factor" );
gSkillData.bigmommaDmgSlash = GetSkillCvar( "sk_bigmomma_dmg_slash" );
gSkillData.bigmommaDmgBlast = GetSkillCvar( "sk_bigmomma_dmg_blast" );
gSkillData.bigmommaRadiusBlast = GetSkillCvar( "sk_bigmomma_radius_blast" );
// Bullsquid
gSkillData.bullsquidHealth = GetSkillCvar( "sk_bullsquid_health");
gSkillData.bullsquidDmgBite = GetSkillCvar( "sk_bullsquid_dmg_bite");
gSkillData.bullsquidDmgWhip = GetSkillCvar( "sk_bullsquid_dmg_whip");
gSkillData.bullsquidDmgSpit = GetSkillCvar( "sk_bullsquid_dmg_spit");
// Gargantua
gSkillData.gargantuaHealth = GetSkillCvar( "sk_gargantua_health");
gSkillData.gargantuaDmgSlash = GetSkillCvar( "sk_gargantua_dmg_slash");
gSkillData.gargantuaDmgFire = GetSkillCvar( "sk_gargantua_dmg_fire");
gSkillData.gargantuaDmgStomp = GetSkillCvar( "sk_gargantua_dmg_stomp");
// Hassassin
gSkillData.hassassinHealth = GetSkillCvar( "sk_hassassin_health");
// Headcrab
gSkillData.headcrabHealth = GetSkillCvar( "sk_headcrab_health");
gSkillData.headcrabDmgBite = GetSkillCvar( "sk_headcrab_dmg_bite");
// Hgrunt
gSkillData.hgruntHealth = GetSkillCvar( "sk_hgrunt_health");
gSkillData.hgruntDmgKick = GetSkillCvar( "sk_hgrunt_kick");
gSkillData.hgruntShotgunPellets = GetSkillCvar( "sk_hgrunt_pellets");
gSkillData.hgruntGrenadeSpeed = GetSkillCvar( "sk_hgrunt_gspeed");
// Houndeye
gSkillData.houndeyeHealth = GetSkillCvar( "sk_houndeye_health");
gSkillData.houndeyeDmgBlast = GetSkillCvar( "sk_houndeye_dmg_blast");
// ISlave
gSkillData.slaveHealth = GetSkillCvar( "sk_islave_health");
gSkillData.slaveDmgClaw = GetSkillCvar( "sk_islave_dmg_claw");
gSkillData.slaveDmgClawrake = GetSkillCvar( "sk_islave_dmg_clawrake");
gSkillData.slaveDmgZap = GetSkillCvar( "sk_islave_dmg_zap");
// Icthyosaur
gSkillData.ichthyosaurHealth = GetSkillCvar( "sk_ichthyosaur_health");
gSkillData.ichthyosaurDmgShake = GetSkillCvar( "sk_ichthyosaur_shake");
// Leech
gSkillData.leechHealth = GetSkillCvar( "sk_leech_health");
gSkillData.leechDmgBite = GetSkillCvar( "sk_leech_dmg_bite");
// Controller
gSkillData.controllerHealth = GetSkillCvar( "sk_controller_health");
gSkillData.controllerDmgZap = GetSkillCvar( "sk_controller_dmgzap");
gSkillData.controllerSpeedBall = GetSkillCvar( "sk_controller_speedball");
gSkillData.controllerDmgBall = GetSkillCvar( "sk_controller_dmgball");
// Nihilanth
gSkillData.nihilanthHealth = GetSkillCvar( "sk_nihilanth_health");
gSkillData.nihilanthZap = GetSkillCvar( "sk_nihilanth_zap");
// Scientist
gSkillData.scientistHealth = GetSkillCvar( "sk_scientist_health");
// Snark
gSkillData.snarkHealth = GetSkillCvar( "sk_snark_health");
gSkillData.snarkDmgBite = GetSkillCvar( "sk_snark_dmg_bite");
gSkillData.snarkDmgPop = GetSkillCvar( "sk_snark_dmg_pop");
// Zombie
gSkillData.zombieHealth = GetSkillCvar( "sk_zombie_health");
gSkillData.zombieDmgOneSlash = GetSkillCvar( "sk_zombie_dmg_one_slash");
gSkillData.zombieDmgBothSlash = GetSkillCvar( "sk_zombie_dmg_both_slash");
//Turret
gSkillData.turretHealth = GetSkillCvar( "sk_turret_health");
// MiniTurret
gSkillData.miniturretHealth = GetSkillCvar( "sk_miniturret_health");
// Sentry Turret
gSkillData.sentryHealth = GetSkillCvar( "sk_sentry_health");
// PLAYER WEAPONS
// Crowbar whack
gSkillData.plrDmgCrowbar = GetSkillCvar( "sk_plr_crowbar");
// Glock Round
gSkillData.plrDmg9MM = GetSkillCvar( "sk_plr_9mm_bullet");
// 357 Round
gSkillData.plrDmg357 = GetSkillCvar( "sk_plr_357_bullet");
// MP5 Round
gSkillData.plrDmgMP5 = GetSkillCvar( "sk_plr_9mmAR_bullet");
// M203 grenade
gSkillData.plrDmgM203Grenade = GetSkillCvar( "sk_plr_9mmAR_grenade");
// 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");
// Satchel Charge
gSkillData.plrDmgSatchel = GetSkillCvar( "sk_plr_satchel");
// Tripmine
gSkillData.plrDmgTripmine = GetSkillCvar( "sk_plr_tripmine");
// MONSTER WEAPONS
gSkillData.monDmg12MM = GetSkillCvar( "sk_12mm_bullet");
gSkillData.monDmgMP5 = GetSkillCvar ("sk_9mmAR_bullet" );
gSkillData.monDmg9MM = GetSkillCvar( "sk_9mm_bullet");
// MONSTER HORNET
gSkillData.monDmgHornet = GetSkillCvar( "sk_hornet_dmg");
// 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
// to separate player damage and monster hivehand damage. Since it's so late in the project, we've
// added plrDmgHornet to the SKILLDATA struct, but not to the engine CVar list, so it's inaccesible
// via SKILLS.CFG. Any player hivehand tuning must take place in the code. (sjb)
gSkillData.plrDmgHornet = 7;
// HEALTH/CHARGE
gSkillData.suitchargerCapacity = GetSkillCvar( "sk_suitcharger" );
gSkillData.batteryCapacity = GetSkillCvar( "sk_battery" );
gSkillData.healthchargerCapacity = GetSkillCvar ( "sk_healthcharger" );
gSkillData.healthkitCapacity = GetSkillCvar ( "sk_healthkit" );
gSkillData.scientistHeal = GetSkillCvar ( "sk_scientist_heal" );
// monster damage adj
gSkillData.monHead = GetSkillCvar( "sk_monster_head" );
gSkillData.monChest = GetSkillCvar( "sk_monster_chest" );
gSkillData.monStomach = GetSkillCvar( "sk_monster_stomach" );
gSkillData.monLeg = GetSkillCvar( "sk_monster_leg" );
gSkillData.monArm = GetSkillCvar( "sk_monster_arm" );
// player damage adj
gSkillData.plrHead = GetSkillCvar( "sk_player_head" );
gSkillData.plrChest = GetSkillCvar( "sk_player_chest" );
gSkillData.plrStomach = GetSkillCvar( "sk_player_stomach" );
gSkillData.plrLeg = GetSkillCvar( "sk_player_leg" );
gSkillData.plrArm = GetSkillCvar( "sk_player_arm" );
}
//=========================================================

View file

@ -30,6 +30,7 @@
#include "mod/AvHServerVariables.h"
#include "mod/AvHMarineWeaponConstants.h"
#include "mod/AvHGamerules.h"
#include "mod/AvHServerVariables.h"
#include "util/MathUtil.h"
#include "common/vec_op.h"
@ -44,12 +45,16 @@ LINK_ENTITY_TO_CLASS( grenade, CGrenade );
//
// Grenade Explode
//
void CGrenade::Explode( Vector vecSrc, Vector vecAim )
void CGrenade::SetDamageType(int inDamageType) {
this->m_damageType=inDamageType;
}
void CGrenade::Explode( Vector vecSrc, Vector vecAim)
{
TraceResult tr;
UTIL_TraceLine ( pev->origin, pev->origin + Vector ( 0, 0, -32 ), ignore_monsters, ENT(pev), & tr);
Explode( &tr, NS_DMG_BLAST);
Explode( &tr, this->m_damageType);
}
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
@ -207,15 +212,17 @@ void CGrenade::Detonate( void )
TraceResult tr;
Vector vecSpot;// trace starts here!
if(CVAR_GET_FLOAT(kvBulletCam))
#ifdef DEBUG
if(ns_cvar_float(&avh_bulletcam))
{
SET_VIEW(this->pev->owner, this->pev->owner);
}
#endif
vecSpot = pev->origin + Vector ( 0 , 0 , 8 );
UTIL_TraceLine ( vecSpot, vecSpot + Vector ( 0, 0, -40 ), ignore_monsters, ENT(pev), & tr);
Explode( &tr, NS_DMG_BLAST);
Explode( &tr, this->m_damageType);
}
//
@ -252,7 +259,7 @@ void CGrenade::ExplodeTouch( CBaseEntity *pOther )
vecSpot = pev->origin - pev->velocity.Normalize() * 32;
UTIL_TraceLine( vecSpot, vecSpot + pev->velocity.Normalize() * 64, ignore_monsters, ENT(pev), &tr );
Explode( &tr, NS_DMG_BLAST);
Explode( &tr, this->m_damageType);
}
@ -315,7 +322,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
{
TraceResult tr = UTIL_GetGlobalTrace( );
ClearMultiDamage( );
pOther->TraceAttack(pevOwner, 1, gpGlobals->v_forward, &tr, NS_DMG_BLAST);
pOther->TraceAttack(pevOwner, 1, gpGlobals->v_forward, &tr, this->m_damageType);
ApplyMultiDamage( pev, pevOwner);
}
m_flNextAttack = gpGlobals->time + 1.0; // debounce
@ -452,6 +459,7 @@ void CGrenade:: Spawn( void )
UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0));
m_fRegisteredSound = FALSE;
m_damageType = NS_DMG_BLAST;
}
@ -481,9 +489,10 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v
return pGrenade;
}
CGrenade* CGrenade::ShootExplosiveTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
CGrenade* CGrenade::ShootExplosiveTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int inDamageType)
{
CGrenade *pGrenade = CGrenade::ShootTimed(pevOwner, vecStart, vecVelocity, time);
pGrenade->SetDamageType(inDamageType);
pGrenade->SetTouch(&CGrenade::ExplosiveBounceTouch);
return pGrenade;
}
@ -500,10 +509,12 @@ CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector v
pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched
if(CVAR_GET_FLOAT(kvBulletCam))
#ifdef DEBUG
if(ns_cvar_float(&avh_bulletcam))
{
SET_VIEW(ENT(pevOwner), ENT(pGrenade->pev));
}
#endif
// 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

View file

@ -27,7 +27,7 @@
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;U:\include\stlport;U:\include\nexus;U:\include\lua;U:\include\particle;U:\include"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_PLAYTEST_BUILD;$(NOINHERIT)"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_SECURE_PRERELEASE_BUILD;USE_OLDAUTH;$(NOINHERIT)"
StringPooling="TRUE"
MinimalRebuild="TRUE"
RuntimeLibrary="0"
@ -99,7 +99,7 @@
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;U:\include\stlport;U:\include\nexus;U:\include\lua;U:\include\particle;U:\include"
PreprocessorDefinitions="_DEBUG;DEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;$(NOINHERIT)"
PreprocessorDefinitions="_DEBUG;DEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_SECURE_PRERELEASE_BUILD;USE_OLDAUTH;$(NOINHERIT)"
RuntimeLibrary="1"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
@ -2783,12 +2783,6 @@
<File
RelativePath="..\mod\AvHNexusTunnelToClient.h">
</File>
<File
RelativePath="..\mod\AvHObjective.cpp">
</File>
<File
RelativePath="..\mod\AvHObjective.h">
</File>
<File
RelativePath="..\mod\AvHOrder.cpp">
<FileConfiguration
@ -5055,40 +5049,6 @@
RelativePath="..\textrep\TRTagValuePair.h">
</File>
</Filter>
<Filter
Name="scriptengine"
Filter="">
<File
RelativePath="..\scriptengine\AvHLUA.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUA.h">
</File>
<File
RelativePath="..\scriptengine\AvHLUABase.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUABase.h">
</File>
<File
RelativePath="..\scriptengine\AvHLUAServerEntity.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAServerEvents.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAServerTeam.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUATime.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAUtil.cpp">
</File>
<File
RelativePath="..\scriptengine\AvHLUAUtil.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>

View file

@ -29,6 +29,7 @@
#include "mod/AvHServerUtil.h"
#include "common/hltv.h"
#include "mod/AvHNetworkMessages.h"
#include "mod/AvHServerVariables.h"
extern DLL_GLOBAL CGameRules *g_pGameRules;
extern DLL_GLOBAL BOOL g_fGameOver;
@ -74,7 +75,7 @@ CHalfLifeMultiplay :: CHalfLifeMultiplay()
{
//g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients);
RefreshSkillData();
//RefreshSkillData();
m_flIntermissionEndTime = 0;
g_flIntermissionStartTime = 0;
@ -130,7 +131,7 @@ BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
void CHalfLifeMultiplay::RefreshSkillData( void )
{
// load all default values
CGameRules::RefreshSkillData();
//CGameRules::RefreshSkillData();
// override some values for multiplay.
@ -201,7 +202,7 @@ void CHalfLifeMultiplay :: Think ( void )
if ( g_fGameOver ) // someone else quit the game already
{
// bounds check
int time = (int)CVAR_GET_FLOAT( "mp_chattime" );
int time = (int)ns_cvar_float( &mp_chattime );
if ( time < 10 )
CVAR_SET_STRING( "mp_chattime", "10" );
else if ( time > MAX_INTERMISSION_TIME )
@ -1012,7 +1013,7 @@ void CHalfLifeMultiplay :: GoToIntermission( void )
MESSAGE_END();
// bounds check
int time = (int)CVAR_GET_FLOAT( "mp_chattime" );
int time = (int)ns_cvar_float( &mp_chattime );
if ( time < 10 )
CVAR_SET_STRING( "mp_chattime", "10" );
else if ( time > MAX_INTERMISSION_TIME )

View file

@ -92,6 +92,7 @@
#include "game.h"
#include "common/hltv.h"
#include "mod/AvHNetworkMessages.h"
#include "util/MathUtil.h"
// #define DUCKFIX
@ -951,11 +952,11 @@ void CBasePlayer::Suicide(void)
ASSERT(thePlayer);
if(thePlayer && thePlayer->GetUsedKilled())//voogru: prevent exploitation of "kill" command.
if(thePlayer && thePlayer->GetUsedKilled())//: prevent exploitation of "kill" command.
return;
// have the player kill themself
float theKillDelay = CVAR_GET_FLOAT(kvKillDelay);
float theKillDelay = ns_cvar_float(&avh_killdelay);
#ifdef DEBUG
#ifndef AVH_EXTERNAL_BUILD
@ -993,7 +994,7 @@ void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
float speed;
char szAnim[64];
bool theFoundAnim = true;
int theDebugAnimations = 0; // BALANCE_VAR(kDebugAnimations);
int theDebugAnimations = BALANCE_VAR(kDebugAnimations);
bool reloadAnim = false;
// Make sure the model is set, as gestating models aren't set before the animation starts playing
@ -1731,7 +1732,7 @@ void CBasePlayer::PlayerUse ( void )
if ( ! ((pev->button | m_afButtonPressed | m_afButtonReleased) & IN_USE) )
return;
//voogru: Dont do this on commanders to prevent phantom use sounds.
//: Dont do this on commanders to prevent phantom use sounds.
if(theAvHPlayer->GetIsInTopDownMode())
return;
@ -1778,6 +1779,7 @@ void CBasePlayer::PlayerUse ( void )
UTIL_MakeVectors ( pev->v_angle );// so we know which way we are facing
while ((pObject = UTIL_FindEntityInSphere( pObject, pev->origin, PLAYER_SEARCH_RADIUS )) != NULL)
{
@ -1802,8 +1804,32 @@ void CBasePlayer::PlayerUse ( void )
// ALERT( at_console, "%s : %f\n", STRING( pObject->pev->classname ), flDot );
}
}
pObject = pClosest;
// Add los test for aliens looking at hives.
if ( pObject == NULL && AvHGetIsAlien(this->pev->iuser3) ) {
Vector vecAiming = gpGlobals->v_forward;
Vector vecSrc = this->GetGunPosition( ) + vecAiming;
Vector vecEnd = vecSrc + vecAiming*800;
TraceResult theTraceResult;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, this->edict(), &theTraceResult);
edict_t* theEntityHit = theTraceResult.pHit;
AvHHive *theHive = dynamic_cast<AvHHive *>(CBaseEntity::Instance(theEntityHit));
if ( theHive) {
float the2DDistance = VectorDistance2D(this->pev->origin, theHive->pev->origin);
// Enabled state is true
if(the2DDistance <= 150.0 && (this->pev->origin < theHive->pev->origin) )
{
pObject=theHive;
}
}
}
// Found an object
if (pObject )
{
@ -2269,8 +2295,10 @@ void CBasePlayer::PreThink(void)
// If trying to duck, already ducked, or in the process of ducking
if ((pev->button & IN_DUCK) || FBitSet(pev->flags,FL_DUCKING) || (m_afPhysicsFlags & PFLAG_DUCKING) )
Duck();
if ((pev->button & IN_DUCK) || FBitSet(pev->flags,FL_DUCKING) || (m_afPhysicsFlags & PFLAG_DUCKING) ) {
if ( AvHMUGetCanDuck(this->pev->iuser3) )
Duck();
}
if ( !FBitSet ( pev->flags, FL_ONGROUND ) )
{
@ -2908,7 +2936,7 @@ void CBasePlayer::PostThink()
// EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_wade1.wav", 1, ATTN_NORM);
}
// skulks, lerks, fades and jetpackers don't take falling damage
else if ((m_flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER1) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER3) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER4) && (!GetHasUpgrade(this->pev->iuser4, MASK_UPGRADE_7) || !(this->pev->iuser3 == AVH_USER3_MARINE_PLAYER)) )
else if ((m_flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER1) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER3) && (this->pev->iuser3 != AVH_USER3_ALIEN_PLAYER4) && (this->pev->iuser3 != AVH_USER3_ALIEN_EMBRYO) && (!GetHasUpgrade(this->pev->iuser4, MASK_UPGRADE_7) || !(this->pev->iuser3 == AVH_USER3_MARINE_PLAYER)) )
{// after this point, we start doing damage
float flFallDamage = g_pGameRules->FlPlayerFallDamage( this );
@ -2916,6 +2944,8 @@ void CBasePlayer::PostThink()
if ( flFallDamage > pev->health )
{//splat
// note: play on item channel because we play footstep landing on body channel
// : 243 don't play gib sound if being digested
if ( AvHGetIsAlien(this->pev->iuser3) || !GetHasUpgrade(this->pev->iuser4, MASK_DIGESTING) )
EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/bodysplat.wav", 1, ATTN_NORM);
}
@ -3836,7 +3866,12 @@ int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem )
CBasePlayerItem *pInsert;
pInsert = m_rgpPlayerItems[pItem->iItemSlot()];
ItemInfo ii;
pItem->GetItemInfo(&ii);
if ( pItem->iItemSlot() == 1 || ii.iId == AVH_WEAPON_MINE || ii.iId == AVH_WEAPON_WELDER) {
this->EffectivePlayerClassChanged();
}
while (pInsert)
{
if (FClassnameIs( pInsert->pev, STRING( pItem->pev->classname) ))
@ -4165,7 +4200,7 @@ void CBasePlayer :: UpdateClientData( void )
gDisplayTitle = 0;
}
if ((int)pev->health != m_iClientHealth) //voogru: this cast to int is important, otherwise we spam the message, this is just a quick and easy fix.
if ((int)pev->health != m_iClientHealth) //: this cast to int is important, otherwise we spam the message, this is just a quick and easy fix.
{
NetMsg_Health( pev, max( pev->health, 0.0f ) );
m_iClientHealth = (int)pev->health;
@ -4239,9 +4274,9 @@ void CBasePlayer :: UpdateClientData( void )
// Send ALL the weapon info now
this->SendWeaponUpdate();
// tankefugl: HACK force an full curweapon update after each bunch of weaponlists sent
// : HACK force an full curweapon update after each bunch of weaponlists sent
forceCurWeaponUpdate = true;
// :tankefugl
// :
}

View file

@ -34,7 +34,7 @@ extern int gmsgMOTD;
//=========================================================
CHalfLifeRules::CHalfLifeRules( void )
{
RefreshSkillData();
//RefreshSkillData();
}
//=========================================================

View file

@ -95,12 +95,12 @@ void CHalfLifeTeamplay :: Think ( void )
return;
}
float flTimeLimit = CVAR_GET_FLOAT("mp_timelimit") * 60;
float flTimeLimit = ns_cvar_float(&timelimit) * 60;
time_remaining = (int)(flTimeLimit ? ( flTimeLimit - gpGlobals->time ) : 0);
// Don't map switch in tourny mode, it signals the end of the match instead
bool theIsTournyMode = (CVAR_GET_FLOAT(kvTournamentMode) > 0);
bool theIsTournyMode = (ns_cvar_int(&avh_tournamentmode) > 0);
if ( flTimeLimit != 0 && (gpGlobals->time >= flTimeLimit) && !theIsTournyMode)
{
GoToIntermission();

View file

@ -28,6 +28,7 @@
#include "trains.h" // trigger_camera has train functionality
#include "gamerules.h"
#include "dlls/triggers.h"
#include "mod/AvHServerVariables.h"
#define SF_TRIGGER_PUSH_START_OFF 2//spawnflag that makes trigger_push spawn turned OFF
#define SF_TRIGGER_HURT_TARGETONCE 1// Only fire hurt target once
@ -535,7 +536,7 @@ void CBaseTrigger::InitTrigger( )
pev->solid = SOLID_TRIGGER;
pev->movetype = MOVETYPE_NONE;
SET_MODEL(ENT(pev), STRING(pev->model)); // set size and link into world
if ( CVAR_GET_FLOAT("showtriggers") == 0 )
if ( ns_cvar_float(showtriggers) == 0 )
SetBits( pev->effects, EF_NODRAW );
}
@ -1738,7 +1739,7 @@ void CLadder :: Precache( void )
// Do all of this in here because we need to 'convert' old saved games
pev->solid = SOLID_NOT;
pev->skin = CONTENTS_LADDER;
if ( CVAR_GET_FLOAT("showtriggers") == 0 )
if ( ns_cvar_float(showtriggers) == 0 )
{
pev->rendermode = kRenderTransTexture;
pev->renderamt = 0;

View file

@ -32,6 +32,7 @@
#include "gamerules.h"
#include "mod/AvHServerUtil.h"
#include "mod/AvHNetworkMessages.h"
#include "mod/AvHServerVariables.h"
//#include "mod/AvHSharedUtil.h"
//#include "mod/AvHGamerules.h"
@ -1189,12 +1190,12 @@ BOOL UTIL_ShouldShowBlood( int color )
{
if ( color == BLOOD_COLOR_RED )
{
if ( CVAR_GET_FLOAT("violence_hblood") != 0 )
if ( ns_cvar_float(violence_hblood) != 0 )
return TRUE;
}
else
{
if ( CVAR_GET_FLOAT("violence_ablood") != 0 )
if ( ns_cvar_float(violence_ablood) != 0 )
return TRUE;
}
}

View file

@ -565,7 +565,7 @@ float UTIL_WeaponTimeBase( void );
void UTIL_SayText( const char *pText, CBaseEntity *pEntity, int inEntIndex = -1);
void UTIL_SayTextAll( const char *pText, CBaseEntity *pEntity, int inEntIndex = -1);
//voogru: hope you dont mind me adding this, I use this in NSAdmin
//: hope you dont mind me adding this, I use this in NSAdmin
// Statements like:
// #pragma message(Reminder "Fix this problem!")
// Which will cause messages like:

View file

@ -126,6 +126,7 @@ MULTIDAMAGE gMultiDamage;
#define TRACER_FREQ 4 // Tracers fire every fourth bullet
extern bool gCanMove[];
//=========================================================
// MaxAmmoCarry - pass in a name and this function will tell
@ -416,7 +417,7 @@ void W_Precache(void)
PRECACHE_UNMODIFIED_MODEL(kMarineCommanderModel);
PRECACHE_UNMODIFIED_MODEL(kAlienGestateModel);
// puzl: 1072
// : 1072
// Added some client side consistency checks.
PRECACHE_UNMODIFIED_MODEL("sprites/muzzleflash1.spr");
PRECACHE_UNMODIFIED_MODEL("sprites/muzzleflash2.spr");
@ -933,7 +934,7 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
void CBasePlayerWeapon::ItemPostFrame( void )
{
bool theAttackPressed = (m_pPlayer->pev->button & IN_ATTACK);
bool theAttackPressed = (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2);
bool theWeaponPrimes = (this->GetWeaponPrimeTime() > 0.0f);
bool theWeaponIsPriming = this->GetIsWeaponPriming();
@ -953,6 +954,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fInReload = FALSE;
}
/* // +movement: Removed case for +attack2 since it's used for movement abilities
if ((m_pPlayer->pev->button & IN_ATTACK2) && CanAttack( m_flNextSecondaryAttack, gpGlobals->time, UseDecrement() ) )
{
if (m_pPlayer->GetCanUseWeapon())
@ -968,7 +970,9 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
}
else if ( theAttackPressed && CanAttack( m_flNextPrimaryAttack, gpGlobals->time, UseDecrement() ) )
else
*/
if ( theAttackPressed && CanAttack( m_flNextPrimaryAttack, gpGlobals->time, UseDecrement() ) )
{
if (m_pPlayer->GetCanUseWeapon())
{
@ -989,7 +993,8 @@ void CBasePlayerWeapon::ItemPostFrame( void )
Reload();
}
}
else if ( !(m_pPlayer->pev->button & (IN_ATTACK|IN_ATTACK2) ) )
// +movement: Removed case for +attack2
else if ( !(m_pPlayer->pev->button & (IN_ATTACK /* |IN_ATTACK2 */) ) )
{
if (m_pPlayer->GetCanUseWeapon())
{
@ -1167,6 +1172,9 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
bSend = TRUE;
}
if (m_iId == 22 || m_iId == 11 || m_iId == 21)
gCanMove[pPlayer->entindex() - 1] = m_iEnabled;
if ( bSend )
{
NetMsg_CurWeapon( pPlayer->pev, state, m_iId, m_iClip );

View file

@ -54,8 +54,8 @@ public:
typedef enum { SATCHEL_DETONATE = 0, SATCHEL_RELEASE } SATCHELCODE;
static CGrenade *ShootExplosiveTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time );
static CGrenade *ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time );
static CGrenade *ShootExplosiveTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int inDamageType );
static CGrenade *ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time);
static CGrenade *ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity );
static CGrenade *ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity );
static void UseSatchelCharges( entvars_t *pevOwner, SATCHELCODE code );
@ -77,8 +77,11 @@ public:
virtual void BounceSound( void );
virtual int BloodColor( void ) { return DONT_BLEED; }
virtual void Killed( entvars_t *pevAttacker, int iGib );
virtual void SetDamageType(int inDamageType);
BOOL m_fRegisteredSound;// whether or not this grenade has issued its DANGER sound to the world sound list yet.
private:
int m_damageType;
};
@ -380,6 +383,8 @@ public:
int m_iDefaultAmmo;// how much ammo you get when you pick up this weapon as placed by a level designer.
bool PrevAttack2Status; // HACK: For +movement weapon animations
float m_flLastAnimationPlayed;
};

View file

@ -35,6 +35,7 @@
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "mod/AvHGamerules.h"
#include "mod/AvHServerVariables.h"
#include "pm_shared/pm_defs.h"
extern CGraph WorldGraph;
@ -480,7 +481,7 @@ void CWorld :: Spawn( void )
{
g_fGameOver = FALSE;
Precache( );
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
g_flWeaponCheat = ns_cvar_float(avh_cheats ); // Is the impulse 101 command allowed?
}
void CWorld :: Precache( void )

View file

@ -96,9 +96,17 @@ typedef struct hud_player_info_s
char *model;
short topcolor;
short bottomcolor;
char padding[8];
} hud_player_info_t;
#define MAX_ALIAS_NAME 32
typedef struct cmdalias_s
{
struct cmdalias_s *next;
char name[MAX_ALIAS_NAME];
char *value;
} cmdalias_t;
// this is by no means complete, or even accurate
typedef struct cl_enginefuncs_s
@ -251,6 +259,41 @@ typedef struct cl_enginefuncs_s
void ( *pfnGetMousePos )( struct tagPOINT *ppt );
void ( *pfnSetMousePos )( int x, int y );
void ( *pfnSetMouseEnable )( qboolean fEnable );
// missing functions from alfred reynolds. Return type and parameters unknown
void (* GetFirstCvarPtr)(void);
void (* GetFirstCmdFunctionHandle)(void);
void (* GetNextCmdFunctionHandle)(void);
void (* GetCmdFunctionName)(void);
void (* hudGetClientOldTime)(void);
void (* hudGetServerGravityValue)(void);
void (* hudGetModelByIndex)(void);
void (* pfnSetFilterMode)(void);
void (* pfnSetFilterColor)(void);
void (* pfnSetFilterBrightness)(void);
void (* pfnSequenceGet)(void);
void (* pfnSPR_DrawGeneric)(void);
void (* pfnSequencePickSentence)(void);
void (* pfnDrawString)(void);
void (* pfnDrawStringReverse)(void);
void (* LocalPlayerInfo_ValueForKey)(void);
void (* pfnVGUI2DrawCharacter)(void);
void (* pfnVGUI2DrawCharacterAdd)(void);
void (* COM_GetApproxWavePlayLength)(void);
void (* pfnGetCareerUI)(void);
void (* Cvar_Set)(void);
void (* pfnIsCareerMatch)(void);
void (* pfnPlaySoundVoiceByName)(void);
void (* pfnPrimeMusicStream)(void);
void (* GetAbsoluteTime)(void);
void (* pfnProcessTutorMessageDecayBuffer)(void);
void (* pfnConstructTutorMessageDecayBuffer)(void);
void (* pfnResetTutorMessageDecayData)(void);
void (* pfnPlaySoundByNameAtPitch)(void);
void (* pfnFillRGBABlend)(void);
void (* pfnGetAppID)(void);
// end: missing functions from alfred reynolds. Return type and parameters unknown
cmdalias_t* (*pfnGetAliases) ( void );
} cl_enginefunc_t;
#ifndef IN_BUTTONS_H

View file

@ -260,6 +260,7 @@ typedef struct enginefuncs_s
qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
const char* (*pfnGetPlayerAuthId) ( edict_t *e );
void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID );
} enginefuncs_t;
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
@ -480,6 +481,8 @@ typedef struct
void (*pfnOnFreeEntPrivateData)(edict_t *pEnt);
void (*pfnGameShutdown)(void);
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
void (*pfnCvarValue)( const edict_t *pEnt, const char *value );
void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value );
} NEW_DLL_FUNCTIONS;
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );

View file

@ -19,7 +19,7 @@
#ifndef TEAM_CONST_H
#define TEAM_CONST_H
#define MAX_PLAYERS 32//voogru: Why was this 64?!
#define MAX_PLAYERS 32//: Why was this 64?!
#define MAX_PLAYERS_PER_TEAM 16

View file

@ -14,7 +14,7 @@
//#include "ui/MemoryInputStream.h"
// tankefugl: HACK
// : HACK
// Implemented old MemoryInputStream to work around bugs(?) in the other implementation or in
// the vgui's handling of the other one
class MemoryInputStream2 : public vgui::InputStream
@ -63,14 +63,14 @@ public:
int m_DataLen;
int m_ReadPos;
};
// :tankefugl
// :
vgui::BitmapTGA* vgui_LoadTGANoInvertAlpha(char const *pFilename)
{ return vgui_LoadTGA(pFilename,false); }
vgui::BitmapTGA* vgui_LoadTGA(char const *pFilename, bool bInvertAlpha)
{
// tankefugl:
// :
MemoryInputStream2 stream;
stream.m_pData = gEngfuncs.COM_LoadFile((char*)pFilename, 5, &stream.m_DataLen);
@ -82,7 +82,7 @@ vgui::BitmapTGA* vgui_LoadTGA(char const *pFilename, bool bInvertAlpha)
gEngfuncs.COM_FreeFile(stream.m_pData);
return pRet;
// :tankefugl
// :
/* // New implementation:
int nLength = 0;

View file

@ -9,7 +9,7 @@
#include <stdio.h>
#include "voice_banmgr.h"
#include "dlls/extdll.h"
#include "localassert.h"
#define BANMGR_FILEVERSION 1
char const *g_pBanMgrFilename = "voice_ban.dt";
@ -18,12 +18,12 @@ char const *g_pBanMgrFilename = "voice_ban.dt";
// Hash a player ID to a byte.
unsigned char HashPlayerID(char const playerID[16])
{
unsigned char curHash = 0;
char curHash = 0;
for(int i=0; i < 16; i++)
curHash += (unsigned char)(playerID[i] & 0xFF);
curHash += (char)(playerID[i]);
return curHash;
return (unsigned char)curHash;
}
@ -169,7 +169,7 @@ void CVoiceBanMgr::Clear()
CVoiceBanMgr::BannedPlayer* CVoiceBanMgr::InternalFindPlayerSquelch(char const playerID[16])
{
int index = HashPlayerID(playerID);
int index = (int)HashPlayerID(playerID) & 0xFF;
BannedPlayer *pListHead = &m_PlayerHash[index];
for(BannedPlayer *pCur=pListHead->m_pNext; pCur != pListHead; pCur=pCur->m_pNext)
{

View file

@ -12,7 +12,7 @@
#include "dlls/util.h"
#include "dlls/cbase.h"
#include "dlls/player.h"
#include "mod/AvHServerVariables.h"
#define UPDATE_INTERVAL 0.3
@ -217,7 +217,7 @@ void CVoiceGameMgr::UpdateMasks()
{
m_UpdateInterval = 0;
bool bAllTalk = !!g_engfuncs.pfnCVarGetFloat( "sv_alltalk" );
bool bAllTalk = !!ns_cvar_float(&sv_alltalk);
for(int iClient=0; iClient < m_nMaxPlayers; iClient++)
{

View file

@ -360,13 +360,13 @@ void CVoiceStatus::CreateEntities()
pEnt->baseline.renderamt = 255;
pEnt->curstate.renderfx = kRenderFxNoDissipation;
pEnt->curstate.framerate = 1;
// tankefugl: different sprite for each team
// : different sprite for each team
if (pClient->curstate.team <= SPR_Frames(m_VoiceHeadModel))
pEnt->curstate.frame = pClient->curstate.team;
else
pEnt->curstate.frame = 0;
//pEnt->curstate.frame = 0;
// :tankefugl
// :
pEnt->model = (struct model_s*)gEngfuncs.GetSpritePointer(m_VoiceHeadModel);
pEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0;
pEnt->curstate.scale = 0.5f;

View file

@ -31,7 +31,9 @@ TEXT_OBJDIR=$(TEXT_SRCDIR)/obj
UTIL_OBJDIR=$(UTIL_SRCDIR)/obj
OUTPUT_DIR=../../hlds_l/ns/dlls
BASE_CFLAGS=-Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DAVH_SERVER -DLINUX -DVALVE_DLL -DQUIVER -DVOXEL -DQUAKE2 -DDEDICATED -DSWDS -D_STLP_USE_GLIBC -DAVH_PLAYTEST_BUILD -DUSE_OLDAUTH -DAVH_SECURE_PRERELEASE_BUILD
BASE_CFLAGS=-Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DAVH_SERVER -DLINUX -DVALVE_DLL -DQUIVER -DVOXEL -DQUAKE2 -DDEDICATED -DSWDS -D_STLP_USE_GLIBC -DUSE_OLDAUTH
# -DAVH_SECURE_PRERELEASE_BUILD for CM testing
#full optimization
CFLAGS=$(BASE_CFLAGS) -w -Wall -nostdinc++ -ffor-scope -fPIC -mcpu=i486 -O3 -pipe -funroll-loops -fdelayed-branch -malign-loops=4 -malign-jumps=4 -malign-functions=4

View file

@ -540,7 +540,7 @@ float NS_StudioEstimateFrame( mstudioseqdesc_t *pseqdesc, const NS_AnimationData
mstudioanim_t* NS_GetAnimation(studiohdr_t* inModelHeader, mstudioseqdesc_t* inSequence)
{
mstudioseqgroup_t* theSequenceGroup = (mstudioseqgroup_t*)((byte *)inModelHeader + inModelHeader->seqgroupindex) + inSequence->seqgroup;
// joev: 0000573
// : 0000573
// Unless we actually check for null, we can get null references...
if (theSequenceGroup) {
return (mstudioanim_t*)((byte*)inModelHeader + theSequenceGroup->data + inSequence->animindex);
@ -548,7 +548,7 @@ mstudioanim_t* NS_GetAnimation(studiohdr_t* inModelHeader, mstudioseqdesc_t* inS
else {
return NULL;
}
// :joev
// :
}
//-----------------------------------------------------------------------------
@ -578,7 +578,7 @@ void NS_GetBoneMatrices(const NS_AnimationData& inAnimationData, float time, NS_
mstudiobone_t* theBones = (mstudiobone_t*)((byte*)theModelHeader + theModelHeader->boneindex);
mstudiobbox_t* theHitBoxes = (mstudiobbox_t*)((byte*)theModelHeader + theModelHeader->hitboxindex);
// joev: 0000573
// : 0000573
// Unless we actually check for null, we can get null references...
// Regardless if the model is borked, the server shouldn't crash.
// Also, why have NS_GetAnimation when it's not used?
@ -588,7 +588,7 @@ void NS_GetBoneMatrices(const NS_AnimationData& inAnimationData, float time, NS_
{
return;
}
// :joev
// :
// Get the position and orientation of all of the bones in the skeleton.

View file

@ -57,6 +57,9 @@
#include "cl_dll/hud.h"
#include "mod/AvHHud.h"
extern int g_runfuncs;
void IN_Attack2Down();
void IN_Attack2Up();
bool CheckInAttack();
#endif
LINK_ENTITY_TO_CLASS(kwLeap, AvHLeap);
@ -124,7 +127,7 @@ void AvHLeap::Precache(void)
PRECACHE_UNMODIFIED_SOUND(kLeapHitSound1);
PRECACHE_UNMODIFIED_SOUND(kLeapKillSound);
this->mEvent = PRECACHE_EVENT(1, kLeapEventName);
this->mLeapEvent = PRECACHE_EVENT(1, kLeapEventName);
this->mAbilityEvent = PRECACHE_EVENT(1, kAbilityEventName);
}
@ -144,11 +147,23 @@ void AvHLeap::Spawn()
FallInit();// get ready to fall down.
}
float AvHLeap::GetRateOfFire(void) const
{
return (float)BALANCE_VAR(kLeapROF);// * 0.5f;
}
bool AvHLeap::UsesAmmo(void) const
{
return false;
}
void AvHLeap::SecondaryAttack()
{
#ifdef AVH_CLIENT
this->FireProjectiles();
#endif
}
void AvHLeap::FireProjectiles(void)
{
#ifdef AVH_SERVER
@ -161,6 +176,8 @@ void AvHLeap::FireProjectiles(void)
#ifdef AVH_CLIENT
if(g_runfuncs)
{
//IN_Attack2Down();
//CBasePlayerWeapon::SendWeaponAnim(3);
gHUD.SetAlienAbility(this->GetAbilityImpulse());
}
#endif
@ -220,7 +237,7 @@ int AvHCharge::GetDeployAnimation() const
float AvHCharge::GetDeployTime() const
{
return .6f;
return 0.0f; //.6f;
}
bool AvHCharge::GetFiresUnderwater() const
@ -250,7 +267,7 @@ void AvHCharge::Precache(void)
PRECACHE_UNMODIFIED_MODEL(kLevel5ViewModel);
PRECACHE_UNMODIFIED_MODEL(kNullModel);
PRECACHE_UNMODIFIED_SOUND(kChargeSound);
PRECACHE_UNMODIFIED_SOUND(kChargeSound2);
PRECACHE_UNMODIFIED_SOUND(kChargeKillSound);
this->mEvent = PRECACHE_EVENT(1, kChargeEventName);
@ -278,14 +295,30 @@ bool AvHCharge::UsesAmmo(void) const
return false;
}
void AvHCharge::SecondaryAttack()
{
#ifdef AVH_CLIENT
this->FireProjectiles();
#endif
}
void AvHCharge::FireProjectiles(void)
{
#ifdef AVH_CLIENT
if (CheckInAttack())
IN_Attack2Down();
else
IN_Attack2Up();
//gHUD.SetAlienAbility(this->GetAbilityImpulse());
#endif
// Event is played back. Mark pmove with proper flag so the alien Charges forward.
PLAYBACK_EVENT_FULL(0, this->m_pPlayer->edict(), this->mAbilityEvent, 0, this->m_pPlayer->pev->origin, (float *)&g_vecZero, 0.0, 0.0, this->GetAbilityImpulse(), 0, 1, 0 );
//PLAYBACK_EVENT_FULL(0, this->m_pPlayer->edict(), this->mAbilityEvent, 0, this->m_pPlayer->pev->origin, (float *)&g_vecZero, 0.0, 0.0, this->GetAbilityImpulse(), 0, 1, 0 );
// Send fire anim
//SendWeaponAnim(5);
this->PlaybackEvent(this->mWeaponAnimationEvent, 5);
//this->PlaybackEvent(this->mWeaponAnimationEvent, 5);
}
void AvHCharge::Init()
@ -295,6 +328,6 @@ void AvHCharge::Init()
float AvHCharge::GetRateOfFire() const
{
// Approximate length of charge sound
return 5.0f;
return 1.0f;
}

View file

@ -45,7 +45,9 @@ class AvHAlienAbilityWeapon : public AvHAlienWeapon
{
public:
virtual AvHMessageID GetAbilityImpulse() const = 0;
virtual void PlaybackLeapEvent(void) { this->PlaybackEvent(this->mLeapEvent, this->GetShootAnimation());};
int mAbilityEvent;
int mLeapEvent;
};
class AvHLeap : public AvHAlienAbilityWeapon
@ -83,6 +85,10 @@ public:
virtual bool UsesAmmo(void) const;
virtual BOOL GetTakesEnergy() { return FALSE; }
void SecondaryAttack();
virtual float GetRateOfFire(void) const;
protected:
virtual void FireProjectiles(void);
@ -129,6 +135,8 @@ public:
virtual bool UsesAmmo(void) const;
virtual BOOL GetTakesEnergy() { return FALSE; }
void SecondaryAttack();
protected:
virtual void FireProjectiles(void);
@ -175,6 +183,8 @@ public:
virtual float GetRateOfFire() const;
void SecondaryAttack();
protected:
virtual void FireProjectiles(void);

View file

@ -42,12 +42,12 @@ const float kLeapPunch = 2.5;
#define kLeapKillSound "weapons/leapkill.wav"
#define kLeapEventName "events/Leap.sc"
#define kLeapPModel "models/null.mdl"
const float kLeapROF = 1.5f;
const float kLeapDuration = 1.0f;
// Charge constants.
const float kChargePunch = 2.5;
#define kChargeSound "weapons/charge1.wav"
#define kChargeSound2 "weapons/charge2.wav"
#define kChargeKillSound "weapons/chargekill.wav"
#define kChargeEventName "events/Charge.sc"
const float kChargeROF = 5.0f;
@ -55,13 +55,17 @@ const float kChargeROF = 5.0f;
#define kAlienSightOnSound "misc/aliensighton.wav"
#define kAlienSightOffSound "misc/aliensightoff.wav"
// Blink constants
#define kBlinkSound "weapons/blinksuccess.wav"
const int kAlienCloakRenderMode = kRenderTransTexture;
const int kAlienCloakAmount = 25;
// puzl: 1061 full cloaking
// : 1061 full cloaking
const int kAlienStructureCloakAmount = 0;
// :puzl
// :
const int kAlienSelfCloakingBaseOpacity = 130;
const int kAlienSelfCloakingMinOpacity = 186;
const int kAlienCloakViewModelRenderMode = kRenderTransAdd;
const int kAlienCloakViewModelAmount = 35;

View file

@ -389,16 +389,18 @@ void AvHDefenseChamber::RegenAliensThink()
{
AvHBaseBuildable* theBuildable = dynamic_cast<AvHBaseBuildable*>(theBaseEntity);
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
float thePercent=BALANCE_VAR(kDefensiveChamberRegenPercent)/100.0f;
float amount=BALANCE_VAR(kDefensiveChamberRegenAmount) + (theBaseEntity->pev->max_health*thePercent);
if(thePlayer && thePlayer->IsAlive())
{
if(thePlayer->Heal(BALANCE_VAR(kDefensiveChamberRegenAmount)))
if(thePlayer->Heal(amount, true, true))
{
theNumEntsHealed++;
}
}
else if(theBuildable && theBuildable->GetIsBuilt() && (theBuildable != this))
{
if(theBuildable->Regenerate(BALANCE_VAR(kDefensiveChamberRegenAmount)))
if(theBuildable->Regenerate(amount, true, true))
{
theNumEntsHealed++;
}
@ -605,7 +607,7 @@ void AvHMovementChamber::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCa
{
bool theHiveIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntity->entindex());
if(theEntity->GetIsActive() || theHiveIsUnderAttack)
if(theEntity->GetIsActive() || theHiveIsUnderAttack || theEntity->GetEmergencyUse() )
{
float theCurrentDistance = VectorDistance(theEntity->pev->origin, inActivator->pev->origin);
bool theHiveIsFarther = (theCurrentDistance > theFarthestDistance);
@ -655,7 +657,7 @@ void AvHMovementChamber::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCa
{
thePlayer->SetPosition(theOriginToSpawn);
thePlayer->pev->velocity = Vector(0, 0, 0);
thePlayer->TriggerUncloak();
// Play teleport sound before and after
EMIT_SOUND(inActivator->edict(), CHAN_AUTO, kAlienSightOffSound, 1.0f, ATTN_NORM);
}

View file

@ -70,6 +70,9 @@ const float kWebThinkInterval = .1f;
const int kWebStrandWidth = 60;
const int kWebStrandLifetime = 50;
#define kWebStrandBreakSound "misc/web_break.wav"
#define kWebStrandHardenSound "misc/web_harden.wav"
#define kWebStrandFormSound "misc/web_form.wav"
#define kWebStrandHitSound "misc/web_hit.wav"
#define kAlienResourceTowerModel "models/ba_resource.mdl"

View file

@ -305,7 +305,7 @@ void AvHAlienTurret::Shoot(const Vector &inOrigin, const Vector &inToEnemy, cons
Vector theNetworkDirToEnemy;
VectorScale(theDirToEnemy, 100.0f, theNetworkDirToEnemy);
PLAYBACK_EVENT_FULL(0, this->edict(), this->mEvent, 0, theOrigin, theNetworkDirToEnemy, 1.0f, 0.0, /*theWeaponIndex*/ 0, 0, 0, 0 );
PLAYBACK_EVENT_FULL(0, 0, this->mEvent, 0, theOrigin, theNetworkDirToEnemy, 1.0f, 0.0, /*theWeaponIndex*/ this->entindex(), 0, 0, 0 );
// Play attack anim
this->PlayAnimationAtIndex(6, true);

View file

@ -53,6 +53,8 @@
extern int g_runfuncs;
#include "cl_dll/com_weapons.h"
#include "common/net_api.h"
#include "pm_shared/pm_defs.h"
#include "pm_shared/pm_shared.h"
#include "pm_shared/pm_movevars.h"
@ -266,8 +268,19 @@ BOOL AvHAlienWeapon::IsUseable(void)
// Make sure we have enough energy for this attack
float theEnergyCost = this->GetEnergyForAttack();
float& theFuser = this->GetEnergyLevel();
float theLatency = 0.0f;
#ifdef AVH_CLIENT
// : 991 -- added latency-based prediction for the ammount of energy available to the alien
net_status_s current_status;
gEngfuncs.pNetAPI->Status(&current_status);
theLatency = max(0.0f, current_status.latency);
if(AvHMUHasEnoughAlienEnergy(theFuser, theEnergyCost) && this->GetEnabledState())
int theNumLevels = AvHGetAlienUpgradeLevel(this->m_pPlayer->pev->iuser4, MASK_UPGRADE_5);
if(theNumLevels > 0)
theLatency *= (1.0 + theNumLevels * BALANCE_VAR(kAdrenalineEnergyPercentPerLevel));
#endif
if(AvHMUHasEnoughAlienEnergy(theFuser, theEnergyCost, theLatency) && this->GetEnabledState())
{
theIsUseable = TRUE;
}

View file

@ -339,7 +339,7 @@ const float kBileBombPunch = 8.0;
const int kBileBombBarrelLength = 20;
const float kBileBombFrictionConstant = .8f;
const int kBileBombVelocity = 750;
const int kBileBombVelocity = 650;
// The bile bomb size must be small so that the collision results on the server
// are close to the collision results for the temp entity on the client.

View file

@ -144,7 +144,7 @@ void AvHBaseBuildable::Init()
this->mTimeOfLastDamageUpdate = -1;
this->mTimeRecycleStarted = -1;
this->mTimeRecycleDone = -1;
this->mTimeOfLastDCRegeneration = -1;
SetThink(NULL);
}
@ -187,6 +187,29 @@ void AvHBaseBuildable::BuildableTouch(CBaseEntity* inEntity)
if(inEntity->pev->team != this->pev->team)
{
this->Uncloak();
// GHOSTBUILDING: Destroy and return res.
if (this->mGhost && inEntity->IsAlive() && inEntity->IsPlayer())
{
this->TakeDamage(inEntity->pev, this->pev, 80000, DMG_GENERIC);
AvHTeam* theTeam = GetGameRules()->GetTeam(AvHTeamNumber(this->pev->team));
if (theTeam)
{
float thePercentage = .8f;
float thePointsBack = GetGameRules()->GetCostForMessageID(this->mMessageID) * thePercentage;
theTeam->SetTeamResources(theTeam->GetTeamResources() + thePointsBack);
AvHSUPlayNumericEventAboveStructure(thePointsBack, this);
}
// Uncloak the player
AvHCloakable *theCloakable=dynamic_cast<AvHCloakable *>(inEntity);
if ( theCloakable ) {
theCloakable->Uncloak();
}
}
}
}
@ -226,7 +249,7 @@ void AvHBaseBuildable::ConstructUse( CBaseEntity *pActivator, CBaseEntity *pCall
// Ensure that buildings are never absolutely painful to create
int theBuildTime = max(GetGameRules()->GetBuildTimeForMessageID(this->mMessageID), 1);
if(GetGameRules()->GetIsTesting() || GetGameRules()->GetCheatsEnabled())
if((GetGameRules()->GetIsTesting() || GetGameRules()->GetCheatsEnabled()) && !GetGameRules()->GetIsCheatEnabled(kcSlowResearch))
{
theBuildTime = 2;
}
@ -264,6 +287,13 @@ void AvHBaseBuildable::ConstructUse( CBaseEntity *pActivator, CBaseEntity *pCall
this->SetNormalizedBuildPercentage(thePercentage);
theSuccess = true;
// GHOSTBUILD: Manifest structure.
pev->renderamt = 255;
pev->rendermode = kRenderNormal;
pev->solid = SOLID_BBOX;
this->mGhost = false;
}
}
}
@ -497,6 +527,15 @@ void AvHBaseBuildable::UpdateOnRecycle()
// empty, override to add events on recycle for buildings
}
Vector AvHBaseBuildable::EyePosition( ) {
if ( this->pev->iuser3 == AVH_USER3_HIVE )
return CBaseEntity::EyePosition();
vec3_t position=AvHSHUGetRealLocation(this->pev->origin, this->pev->mins, this->pev->maxs);
position[2]+=10;
return position;
}
void AvHBaseBuildable::StartRecycle()
{
if(!GetHasUpgrade(this->pev->iuser4, MASK_RECYCLING))
@ -654,31 +693,41 @@ int AvHBaseBuildable::GetTakeDamageAnimation() const
AvHTeamNumber AvHBaseBuildable::GetTeamNumber() const
{
return (AvHTeamNumber)this->pev->team;
AvHTeamNumber ret=TEAM_IND;
if ( this->pev )
ret=(AvHTeamNumber)this->pev->team;
return ret;
}
void AvHBaseBuildable::Killed(entvars_t* pevAttacker, int iGib)
{
bool theInReset = GetGameRules()->GetIsGameInReset();
AvHBaseBuildable::SetHasBeenKilled();
GetGameRules()->RemoveEntityUnderAttack( this->entindex() );
this->mKilled = true;
this->mInternalSetConstructionComplete = false;
this->mTimeOfLastAutoHeal = -1;
// puzl: 980
// Less smoke for recycled buildings
this->TriggerDeathAudioVisuals(iGib == GIB_RECYCLED);
if(!this->GetIsOrganic())
if (!theInReset)
{
// More sparks for recycled buildings
int numSparks = ( iGib == GIB_RECYCLED ) ? 7 : 3;
for ( int i=0; i < numSparks; i++ ) {
Vector vecSrc = Vector( (float)RANDOM_FLOAT( pev->absmin.x, pev->absmax.x ), (float)RANDOM_FLOAT( pev->absmin.y, pev->absmax.y ), (float)0 );
vecSrc = vecSrc + Vector( (float)0, (float)0, (float)RANDOM_FLOAT( pev->origin.z, pev->absmax.z ) );
UTIL_Sparks(vecSrc);
// : 980
// Less smoke for recycled buildings
this->TriggerDeathAudioVisuals(iGib == GIB_RECYCLED);
if(!this->GetIsOrganic())
{
// More sparks for recycled buildings
int numSparks = ( iGib == GIB_RECYCLED ) ? 7 : 3;
for ( int i=0; i < numSparks; i++ ) {
Vector vecSrc = Vector( (float)RANDOM_FLOAT( pev->absmin.x, pev->absmax.x ), (float)RANDOM_FLOAT( pev->absmin.y, pev->absmax.y ), (float)0 );
vecSrc = vecSrc + Vector( (float)0, (float)0, (float)RANDOM_FLOAT( pev->origin.z, pev->absmax.z ) );
UTIL_Sparks(vecSrc);
}
}
// :
}
// :puzl
this->TriggerRemoveTech();
AvHSURemoveEntityFromHotgroupsAndSelection(this->entindex());
@ -715,7 +764,7 @@ void AvHBaseBuildable::SetInactive()
this->pev->effects |= EF_NODRAW;
this->pev->solid = SOLID_NOT;
this->pev->takedamage = DAMAGE_NO;
SetUpgradeMask(&this->pev->iuser4, MASK_PARASITED, false);//voogru: remove parasite flag to prevent phantom parasites.
SetUpgradeMask(&this->pev->iuser4, MASK_PARASITED, false);//: remove parasite flag to prevent phantom parasites.
//this->pev->deadflag = DEAD_DEAD;
SetThink(NULL);
}
@ -778,10 +827,10 @@ void AvHBaseBuildable::RecycleComplete()
// Play "+ resources" event
AvHSUPlayNumericEventAboveStructure(thePointsBack, this);
// puzl: 980
// : 980
// Less smoke and more sparks for recycled buildings
this->Killed(this->pev, GIB_RECYCLED);
// :puzl
// :
}
}
@ -791,37 +840,39 @@ void AvHBaseBuildable::SetSelectID(int inSelectID)
this->mSelectID = inSelectID;
}
bool AvHBaseBuildable::Regenerate(float inRegenerationAmount, bool inPlaySound)
bool AvHBaseBuildable::Regenerate(float inRegenerationAmount, bool inPlaySound, bool dcHealing)
{
bool theDidHeal = false;
if ( gpGlobals->time > this->mTimeOfLastDCRegeneration + BALANCE_VAR(kDefenseChamberThinkInterval) - 0.05f || (dcHealing == false)) {
if ( dcHealing )
this->mTimeOfLastDCRegeneration = gpGlobals->time;
float theMaxHealth = this->mBaseHealth;
float theMaxHealth = this->mBaseHealth;
if(!this->GetIsBuilt())
{
float theNormalizedBuildPercentage = this->GetNormalizedBuildPercentage();
theMaxHealth = (kBaseHealthPercentage + theNormalizedBuildPercentage*(1.0f - kBaseHealthPercentage))*this->mBaseHealth;
}
// If we aren't at full health, heal health
if(this->pev->health < theMaxHealth)
{
this->pev->health = min(theMaxHealth, this->pev->health + inRegenerationAmount);
this->HealthChanged();
theDidHeal = true;
}
// Play regen event
if(theDidHeal)
{
if(inPlaySound)
if(!this->GetIsBuilt())
{
// Play regeneration event
PLAYBACK_EVENT_FULL(0, this->edict(), gRegenerationEventID, 0, this->pev->origin, (float *)&g_vecZero, 1.0f, 0.0, /*theWeaponIndex*/ 0, 0, 0, 0 );
float theNormalizedBuildPercentage = this->GetNormalizedBuildPercentage();
theMaxHealth = (kBaseHealthPercentage + theNormalizedBuildPercentage*(1.0f - kBaseHealthPercentage))*this->mBaseHealth;
}
// If we aren't at full health, heal health
if(this->pev->health < theMaxHealth)
{
this->pev->health = min(theMaxHealth, this->pev->health + inRegenerationAmount);
this->HealthChanged();
theDidHeal = true;
}
// Play regen event
if(theDidHeal)
{
if(inPlaySound)
{
// Play regeneration event
PLAYBACK_EVENT_FULL(0, this->edict(), gRegenerationEventID, 0, this->pev->origin, (float *)&g_vecZero, 1.0f, 0.0, /*theWeaponIndex*/ 0, 0, 0, 0 );
}
}
}
return theDidHeal;
}
@ -852,6 +903,10 @@ void AvHBaseBuildable::InternalSetConstructionComplete(bool inForce)
this->pev->rendermode = kRenderNormal;
this->pev->renderamt = 255;
// GHOSTBUILD: Ensure that finished buildings aren't ghosted.
this->mGhost = false;
this->pev->solid = SOLID_BBOX;
this->SetHasBeenBuilt();
this->SetActive();
@ -932,6 +987,14 @@ void AvHBaseBuildable::Spawn()
if(this->pev->spawnflags & 1)
this->SetConstructionComplete(true);
// GHOSTBUILD: Mark as unmanifested if it's a marine structure.
if (!this->GetIsOrganic())
{
pev->renderamt = 170;
pev->rendermode = kRenderTransTexture;
this->mGhost = true;
}
}
@ -957,6 +1020,7 @@ int AvHBaseBuildable::GetSequenceForBoundingBox() const
void AvHBaseBuildable::Materialize()
{
this->pev->solid = SOLID_BBOX;
this->pev->movetype = this->GetMoveType();
this->pev->classname = MAKE_STRING(this->mClassName);
@ -1059,7 +1123,7 @@ int AvHBaseBuildable::TakeDamage(entvars_t* inInflictor, entvars_t* inAttacker,
theDamage = CBaseAnimating::TakeDamage(inInflictor, inAttacker, inDamage, inBitsDamageType);
bool theDrawDamage = (CVAR_GET_FLOAT(kvDrawDamage) > 0);
bool theDrawDamage = (ns_cvar_float(&avh_drawdamage) > 0);
if(theDrawDamage)
{
@ -1253,7 +1317,7 @@ void AvHBaseBuildable::TriggerDeathAudioVisuals(bool isRecycled)
case AVH_CLASS_TYPE_MARINE:
// lots of smoke
// puzl: 980
// : 980
// Less smoke for recycled buildings
int smokeScale = isRecycled ? 15 : 25;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );

View file

@ -163,7 +163,7 @@ public:
virtual void Precache(void);
virtual bool Regenerate(float inRegenerationAmount, bool inPlaySound = true);
virtual bool Regenerate(float inRegenerationAmount, bool inPlaySound = true, bool dcHealing = false);
virtual void ResetEntity();
@ -183,6 +183,7 @@ public:
virtual void UpdateOnRecycle();
virtual Vector EyePosition( );
protected:
virtual bool GetHasBeenKilled() const;
@ -253,8 +254,10 @@ private:
float mTimeRecycleStarted;
float mTimeRecycleDone;
float mTimeOfLastDCRegeneration;
bool mKilled;
bool mGhost;
};
#endif

View file

@ -117,6 +117,21 @@ Vector UTIL_GetRandomSpreadDir(unsigned int inSeed, int inShotNumber, const Vect
return theRandomDir;
}
// test
Vector UTIL_GetRandomSpreadDirFrom(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread, const Vector& inFromSpread)
{
// Use player's random seed.
// get circular gaussian spread
float x = UTIL_SharedRandomFloat( inSeed + inShotNumber, -0.5, 0.5 ) + UTIL_SharedRandomFloat( inSeed + ( 1 + inShotNumber ) , -0.5, 0.5 );
float y = UTIL_SharedRandomFloat( inSeed + ( 2 + inShotNumber ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( inSeed + ( 3 + inShotNumber ), -0.5, 0.5 );
float z = x * x + y * y;
float xdir = x / fabs(x);
float ydir = y / fabs(y);
Vector theRandomDir = inBaseDirection + inFromSpread.x * inRight * xdir + x * inSpread.x * inRight + inFromSpread.y * inUp * ydir + y * inSpread.y * inUp;
return theRandomDir;
}
AvHBasePlayerWeapon::AvHBasePlayerWeapon()
{
@ -186,14 +201,14 @@ int AvHBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
BOOL AvHBasePlayerWeapon::Deploy()
{
// tankefugl: 0000938
// : 0000938
// removed deploy sounds for all weapons, leaving the sounds to the models
// char* theDeploySound = this->GetDeploySound();
// if(theDeploySound)
// {
// EMIT_SOUND(ENT(this->pev), CHAN_WEAPON, this->GetDeploySound(), this->GetDeploySoundVolume(), ATTN_NORM);
//}
// :tankefugl
// :
char* theAnimExt = this->GetAnimationExtension();
@ -246,10 +261,10 @@ BOOL AvHBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel,
BOOL AvHBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, int body)
{
// tankefugl: 0000996
// : 0000996
if (m_fInReload == TRUE)
return TRUE;
// :tankefugl
// :
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
return FALSE;
@ -709,7 +724,7 @@ bool AvHBasePlayerWeapon::ProcessValidAttack(void)
// Only shoot if deployed and enabled (iuser3 is 0 when disabled, 1 when enabled <from m_fireState>)
// puzl: 497 call GetEnabledState instead of testing directly
// : 497 call GetEnabledState instead of testing directly
int enabledState=this->GetEnabledState();
if(this->m_pPlayer->pev->viewmodel && ( enabledState == 1))
@ -1109,7 +1124,7 @@ bool AvHBasePlayerWeapon::GetEnabledState() const
#ifdef AVH_SERVER
result= (this->m_iEnabled == 1);
#else
// puzl: 497 client now uses the enabled state in the appropriate WEAPON
// : 497 client now uses the enabled state in the appropriate WEAPON
ItemInfo theItemInfo;
this->GetItemInfo(&theItemInfo);
WEAPON *pWeapon = gWR.GetWeapon( theItemInfo.iId );
@ -1207,7 +1222,7 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
}
}
// puzl: 497 save the state for when we send the CurWeapon message
// : 497 save the state for when we send the CurWeapon message
this->m_iEnabled = theEnabledState;
}

View file

@ -72,6 +72,7 @@ const int kShootEmptyAnimation = 4;
const int kDeployAnimation = 5;
Vector UTIL_GetRandomSpreadDir(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread);
Vector UTIL_GetRandomSpreadDirFrom(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread, const Vector& inFromSpread);
class AvHBasePlayerWeapon : public CBasePlayerWeapon
{

View file

@ -13,6 +13,7 @@ extern playermove_t* pmove;
#include "cl_dll/hud.h"
#include "mod/AvHHud.h"
extern int g_runfuncs;
void IN_Attack2Down();
#endif
#include "mod/AvHAlienAbilities.h"
@ -102,6 +103,13 @@ AvHMessageID AvHBlinkGun::GetAbilityImpulse() const
return ALIEN_ABILITY_BLINK;
}
void AvHBlinkGun::SecondaryAttack()
{
#ifdef AVH_CLIENT
//this->FireProjectiles();
#endif
}
void AvHBlinkGun::FireProjectiles(void)
{
#ifdef AVH_CLIENT
@ -117,12 +125,12 @@ void AvHBlinkGun::FireProjectiles(void)
thePlayer->TriggerUncloak();
}
#endif
if(this->mTimeOfNextBlinkEvent <= 0)
{
const float kEventDelay = 2.0f;
this->PlaybackEvent(this->mBlinkSuccessEvent, this->GetShootAnimation());
this->mTimeOfNextBlinkEvent = UTIL_WeaponTimeBase() + kEventDelay;
}
// if(this->mTimeOfNextBlinkEvent <= 0)
// {
// const float kEventDelay = 2.0f;
// this->PlaybackEvent(this->mBlinkSuccessEvent, this->GetShootAnimation());
// this->mTimeOfNextBlinkEvent = UTIL_WeaponTimeBase() + kEventDelay;
// }
}
bool AvHBlinkGun::GetMustPressTriggerForEachShot() const

View file

@ -82,6 +82,8 @@ void AvHBuildable::TriggerRemoveTech() const
if(theTeam)
{
theTeam->TriggerRemoveTech(this->mTechID);
if ( this->mTechID == TECH_ADVANCED_ARMORY )
theTeam->TriggerRemoveTech(TECH_ARMORY);
}
}

View file

@ -35,12 +35,16 @@ extern cvar_t* cl_musicdir;
// Variables
#define kvAutoHelp "cl_autohelp"
// puzl: 1064 The cl var that controls the display of labelled minimaps
// : 1064 The cl var that controls the display of labelled minimaps
#define kvLabelMaps "cl_labelmaps"
// :puzl
// tankefugl: 0001070 - enables forced gamma ramp loading
// :
// : 0001070 - enables forced gamma ramp loading
#define kvGammaRamp "cl_gammaramp"
// :tankefugl
#define kvLabelHivesight "cl_labelhivesight"
#define kvCustomCrosshair "cl_customcrosshair"
#define kvHudMapZoom "cl_hudmapzoom"
// :
#define kvCMHotKeys "cl_cmhotkeys"
#define kvForceDefaultFOV "cl_forcedefaultfov"
#define kvCenterEntityID "cl_centerentityid"

View file

@ -62,33 +62,34 @@ void AvHCloakable::Update()
float theTimePassed = theCurrentTime - this->mTimeOfLastUpdate;
float theOldOpacity=this->mOpacity;
if((this->mTimeOfLastCloak != -1) || (this->mTimeOfLastUncloak != -1))
{
float newOpacity=this->mOpacity;
if( this->mTimeOfLastCloak > this->mTimeOfLastUncloak )
{
// Cloaking
this->mOpacity -= theTimePassed/this->GetCloakTime();
if ( this->mOpacity < 0.45f && this->mCurrentSpeed > this->mMaxWalkSpeed )
{
float theExtraSpeed = max(0.0f, this->mCurrentSpeed - this->mMaxWalkSpeed);
float theSpeedRange = max(0.0f, this->mMaxSpeed - this->mMaxWalkSpeed);
float thePercent=theExtraSpeed/theSpeedRange;
this->mOpacity=0.30f * thePercent;
if ( this->mCurrentSpeed > this->mMaxSpeed ) {
//ALERT(at_console, "exceeded the speed limit %f\n", this->mCurrentSpeed);
this->mOpacity=0.30f + 0.30f * ((this->mCurrentSpeed - this->mMaxSpeed) / this->mMaxSpeed / 2.0f );
newOpacity -= theTimePassed/this->GetCloakTime();
// Adjust for movement
if ( this->mOpacity < 0.45f && this->mCurrentSpeed > this->mMaxWalkSpeed ) {
newOpacity=this->mOpacity;
if ( this->mCurrentSpeed > this->mMaxSpeed ) {
newOpacity += theTimePassed / this->GetUncloakTime();
}
this->mOpacity = min(max(0.0f, this->mOpacity), 0.45f);
else {
newOpacity += theTimePassed/this->GetUncloakTime() / 2.0f;
}
newOpacity = min(max(0.0f, newOpacity), 0.45f);
}
}
else
{
// Uncloaking
this->mOpacity += theTimePassed/this->GetUncloakTime();
newOpacity += theTimePassed/this->GetUncloakTime();
}
this->mOpacity = min(max(0.0f, this->mOpacity), 1.0f);
this->mOpacity = min(max(0.0f, newOpacity), 1.0f);
}
this->mTimeOfLastUpdate = theCurrentTime;
}
@ -107,7 +108,7 @@ void AvHCloakable::SetSpeeds(float inCurrentSpeed, float inMaxSpeed, float inMax
void AvHCloakable::Cloak(bool inNoFade)
{
// puzl: 864
// : 864
if ( (this->GetTime() > this->mTimeOfLastUncloak + BALANCE_VAR(kRecloakTime)) || inNoFade ) {
if(this->GetCanCloak())
{

View file

@ -39,12 +39,13 @@ bool AvHPlayer::GiveCombatModeUpgrade(AvHMessageID inMessageID, bool inInstantan
case BUILD_MINES:
case BUILD_JETPACK:
case BUILD_HEAVY:
//voogru: spawn the weapon in the middle of nowhere to prevent anyone else from getting it.
//: spawn the weapon in the middle of nowhere to prevent anyone else from getting it.
theCreatedItem = dynamic_cast<CBasePlayerItem*>(AvHSUBuildTechForPlayer(inMessageID, Vector(9999,9999,9999), this));
ASSERT(theCreatedItem);
if((inMessageID == BUILD_JETPACK) || (inMessageID == BUILD_HEAVY))
if((inMessageID == BUILD_JETPACK) || (inMessageID == BUILD_HEAVY) || (inMessageID == BUILD_HMG) ||
(inMessageID == BUILD_SHOTGUN) || (inMessageID == BUILD_GRENADE_GUN))
{
theEffectivePlayerClassChanged = true;
}
@ -216,6 +217,8 @@ void AvHPlayer::SetExperience(float inExperience)
int theIsMarine = this->GetIsMarine();
PLAYBACK_EVENT_FULL(0, this->edict(), gLevelUpEventID, 0, this->pev->origin, (float *)&g_vecZero, 0.0, 0.0, theIsMarine, 0, 0, 0 );
this->EffectivePlayerClassChanged();
// Give player health and armor back on level-up, to allow more soloing, heroics, and reduce dependence on hives/resupply
AvHUser3 theUser3 = AvHUser3(this->pev->iuser3);
float theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, theUser3, theCurrentLevel);

View file

@ -19,6 +19,7 @@
// Commands
//#define kcBuyReinforcements "buyreinforcements"
#define kcReadyRoom "readyroom"
#define kcMenuReadyRoom "menureadyroom"
#define kcJoinTeamOne "jointeamone"
#define kcJoinTeamTwo "jointeamtwo"
#define kcJoinTeamThree "jointeamthree"
@ -82,6 +83,7 @@
#define kcOrderSelf "orderself"
#define kcParasite "parasite"
#define kcKillAll "killall"
#define kcAuth "auth"
#define kcStun "stun"
#define kcBoxes "boxes"
#define kcOverflow "overflow"

View file

@ -239,11 +239,11 @@ void ReportPlayer(CBasePlayer* inPlayer, const char* inCommand)
BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
//adding Nexus TunnelToClient functionality up here...
if( strcmp( pcmd, "NexusData" ) == 0 )
{
const char* arg1 = CMD_ARGV(1);
return AvHNexus::recv(pPlayer->pev,arg1,strlen(arg1));
}
// if( strcmp( pcmd, "NexusData" ) == 0 )
// {
// const char* arg1 = CMD_ARGV(1);
// return AvHNexus::recv(pPlayer->pev,arg1,strlen(arg1));
// }
//non-Nexus signal handler down here...
AvHPlayer* theAvHPlayer = dynamic_cast<AvHPlayer*>(pPlayer);
@ -271,7 +271,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
theIsPlaytester = theAvHPlayer->GetIsMember(PLAYERAUTH_PLAYTESTER);
theIsPlayerHelper = theIsDeveloper || theIsGuide || theIsPlaytester;
#ifdef AVH_PLAYTEST_BUILD
#ifdef DEBUG
theIsPlaytest = theIsPlaytester || theIsDeveloper;
#endif
}
@ -329,6 +329,21 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
theSuccess = true;
}
}
else if ( FStrEq( pcmd, kcMenuReadyRoom ) )
{
if(theAvHPlayer)
{
if(!(theAvHPlayer->pev->flags & FL_FAKECLIENT))
{
if(!theAvHPlayer->GetIsBeingDigested())
{
theAvHPlayer->SetPlayMode(PLAYMODE_READYROOM, true);
}
theSuccess = true;
}
}
theSuccess = true;
}
else if ( FStrEq( pcmd, kcReadyRoom ) )
{
if(theAvHPlayer)
@ -337,7 +352,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
if(!theAvHPlayer->GetIsBeingDigested())
{
// puzl: 984
// : 984
// Add a throttle on the readyroom key
const static int kReadyRoomThrottleTimeout=2.0f;
if ( (theAvHPlayer->GetTimeLastF4() == -1.0f) ||
@ -386,7 +401,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
theAvHPlayer->SetPlayMode(PLAYMODE_READYROOM, true);
this->AttemptToJoinTeam(theAvHPlayer, theOtherTeamNumber, false);
// tankefugl: 0001010 - Boost the player 32 units up to avoid sticking in the ground
// : 0001010 - Boost the player 32 units up to avoid sticking in the ground
theCurrentPosition[2] += 32.0f;
// Set our position again
@ -451,7 +466,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
}
}
#endif
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
else if(FStrEq(pcmd, "forceuplink"))
{
@ -529,7 +544,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
if(theAvHPlayer && this->GetCheatsEnabled())
{
int theNumPlayers = GetGameRules()->GetNumberOfPlayers();
int theNumPlayers = GetGameRules()->GetNumberOfPlayers(true);
char theMessage[128];
sprintf(theMessage, "Num players: %d\n", theNumPlayers);
UTIL_SayText(theMessage, theAvHPlayer);
@ -1424,7 +1439,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
AvHNexus::handleUnauthorizedJoinTeamAttempt(theAvHPlayer->edict(),TEAM_SPECT);
}
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
else if(allow_spectators.value && GetGameRules()->PerformHardAuthorization(theAvHPlayer))
#else
@ -1564,7 +1579,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
theSuccess = true;
}
}
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
#ifndef AVH_SECURE_PRERELEASE_BUILD
else if(FStrEq(pcmd, kcAuth))

View file

@ -136,7 +136,7 @@ const int kMaxUpgradeLevel = 3;
const int kFuncResourceMaxResources = 300;
//const float kPlayerResourceScalar = 2.0f; // 1.5 might be better
const int kVictoryIntermission = 12;
const int kResetPlayersPerSecond = 8;
const int kResetPlayersPerSecond = 5;
const float kBuildingUseWarmupTime = 2.0f;
const float kRedeemInvulnerableTime = 1.0f;
@ -189,8 +189,7 @@ typedef enum
MAP_MODE_NS = 1,
MAP_MODE_CS = 2,
MAP_MODE_DM = 3,
MAP_MODE_CO = 4,
MAP_MODE_NSC = 5
MAP_MODE_CO = 4
}
AvHMapMode;
@ -253,7 +252,8 @@ typedef enum
ALERT_NEW_TRAIT = 13,
ALERT_ORDER_NEEDED = 14,
ALERT_ORDER_COMPLETE = 15,
ALERT_MAX_ALERTS = 16
ALERT_HIVE_DEFEND = 16,
ALERT_MAX_ALERTS = 17
} AvHAlertType;
typedef enum
@ -277,7 +277,7 @@ typedef enum
PLAYERCLASS_REINFORCINGCOMPLETE
} AvHPlayerClass;
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
// This is a mask because players can have more then one of these
typedef enum
@ -371,9 +371,9 @@ typedef enum
HUD_SOUND_YOU_WIN,
HUD_SOUND_YOU_LOSE,
HUD_SOUND_TOOLTIP,
// joev: bug 0000767
// : bug 0000767
HUD_SOUND_PLAYERJOIN,
// :joev
// :
HUD_SOUND_MAX
} AvHHUDSound;
@ -893,9 +893,9 @@ const float kCommanderHierarchyScaleFactor = .0002f;
#define kInvalidSound "misc/invalid.wav"
#define kLevelUpMarineSound "misc/levelup.wav"
#define kLevelUpAlienSound "misc/a-levelup.wav"
// joev: bug 0000767
// : bug 0000767
#define kPlayerJoinedSound "player/jointeam.wav"
// :joev
// :
// Events
#define kJetpackEvent "events/Jetpack.sc"

View file

@ -1658,7 +1658,7 @@ void AvHTriggerScript::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
AvHWebStrand::AvHWebStrand()
AvHWebStrand::AvHWebStrand() : mSolid(false)
{
}
@ -1666,6 +1666,7 @@ void AvHWebStrand::Break()
{
EMIT_SOUND(ENT(this->pev), CHAN_AUTO, kWebStrandBreakSound, 1.0, ATTN_IDLE);
UTIL_Remove(this);
SetThink(NULL);
// Decrement number of strands
AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)this->pev->team);
@ -1685,20 +1686,24 @@ void AvHWebStrand::Precache(void)
// Precache web strand sprite
PRECACHE_UNMODIFIED_MODEL(kWebStrandSprite);
PRECACHE_UNMODIFIED_SOUND(kWebStrandBreakSound);
PRECACHE_UNMODIFIED_SOUND(kWebStrandHardenSound);
PRECACHE_UNMODIFIED_SOUND(kWebStrandFormSound);
}
void AvHWebStrand::Setup(const Vector& inPointOne, const Vector& inPointTwo)
{
// Create a new entity with CBeam private data
this->BeamInit(kWebStrandSprite, kWebStrandWidth);
this->BeamInit(kWebStrandSprite, 40); //kWebStrandWidth);
this->PointsInit(inPointOne, inPointTwo);
this->SetColor( 255, 255, 255 );
this->SetScrollRate( 0 );
this->SetFrame(0);
//this->SetBrightness( 64 );
this->SetBrightness( 8 );
this->SetBrightness( 16 );
this->pev->classname = MAKE_STRING(kesTeamWebStrand);
this->pev->rendermode = kRenderNormal;
}
void AvHWebStrand::Spawn(void)
@ -1713,15 +1718,28 @@ void AvHWebStrand::Spawn(void)
//this->pev->solid = SOLID_BBOX;
this->pev->health = kWebHitPoints;
this->pev->takedamage = DAMAGE_YES;
this->mSolid=false;
this->pev->nextthink = gpGlobals->time + BALANCE_VAR(kWebWarmupTime);
SetThink(&AvHWebStrand::StrandThink);
//SetBits(this->pev->flags, FL_MONSTER);
this->RelinkBeam();
EMIT_SOUND(ENT(this->pev), CHAN_AUTO, kWebStrandFormSound, 1.0, ATTN_IDLE);
//SetThink(StrandExpire);
//this->pev->nextthink = gpGlobals->time + kWebStrandLifetime;
}
void AvHWebStrand::StrandThink()
{
EMIT_SOUND(ENT(this->pev), CHAN_AUTO, kWebStrandHardenSound, 1.0, ATTN_IDLE);
this->SetBrightness( 32 );
this->SetColor( 255, 255, 255 );
this->SetFrame(1);
this->mSolid=true;
SetThink(NULL);
}
void AvHWebStrand::StrandExpire()
{
this->Break();
@ -1734,15 +1752,20 @@ void AvHWebStrand::StrandTouch( CBaseEntity *pOther )
//if(GetGameRules()->CanEntityDoDamageTo(this, pOther))
if(pOther->pev->team != this->pev->team)
{
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(pOther);
if(thePlayer && thePlayer->GetCanBeAffectedByEnemies())
{
// Break web and ensnare player if possible (players can't be too webbed)
if(thePlayer->SetEnsnareState(true))
if ( this->mSolid ) {
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(pOther);
if(thePlayer && thePlayer->GetCanBeAffectedByEnemies())
{
this->Break();
// Break web and ensnare player if possible (players can't be too webbed)
if(thePlayer->SetEnsnareState(true))
{
this->Break();
}
}
}
else {
this->Break();
}
}
}

View file

@ -522,8 +522,10 @@ public:
void EXPORT StrandExpire();
virtual int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
void EXPORT StrandThink();
private:
bool mSolid;
};
class AvHFuncResource : public CBaseAnimating

View file

@ -68,6 +68,9 @@ AvHEntityHierarchy::AvHEntityHierarchy()
void AvHEntityHierarchy::Clear()
{
mNumMovement=0;
mNumSensory=0;
mNumDefence=0;
this->mEntityList.clear();
}
@ -95,6 +98,18 @@ void AvHEntityHierarchy::GetEntityInfoList(MapEntityMap& outList) const
outList = mEntityList;
}
int AvHEntityHierarchy::GetNumSensory() const {
return this->mNumSensory;
}
int AvHEntityHierarchy::GetNumMovement() const {
return this->mNumMovement;
}
int AvHEntityHierarchy::GetNumDefense() const {
return this->mNumDefence;
}
////////////////
// end shared //
////////////////
@ -130,11 +145,11 @@ int GetHotkeyGroupContainingPlayer(AvHPlayer* player)
}
void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType& inBaseEntityList)
{
this->Clear();
int mc=0, sc=0, dc=0;
if (inTeam->GetTeamType() == AVH_CLASS_TYPE_MARINE ||
inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN)
@ -143,18 +158,38 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
// Loop through all entities in the world
for(BaseEntityListType::iterator theIter = inBaseEntityList.begin(); theIter != inBaseEntityList.end(); theIter++)
{
CBaseEntity* theBaseEntity = *theIter;
int theEntityIndex = theBaseEntity->entindex();
bool theEntityIsVisible = (theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber())) ||
GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_SIGHTED);
bool theEntityIsDetected = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_DETECTED);
bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex);
if ( theEntityIsUnderAttack )
{
int a=0;
}
// Don't send ammo, health, weapons, or scans
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
MapEntity mapEntity;
if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN && theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber()) ) {
AvHBuildable *theBuildable=dynamic_cast<AvHBuildable *>(theBaseEntity);
if ( theBuildable && theBuildable->GetHasBeenBuilt() ) {
if ( theBaseEntity->pev->iuser3 == AVH_USER3_MOVEMENT_CHAMBER ) {
mc++;
}
if ( theBaseEntity->pev->iuser3 == AVH_USER3_SENSORY_CHAMBER ) {
sc++;
}
if ( theBaseEntity->pev->iuser3 == AVH_USER3_DEFENSE_CHAMBER ) {
dc++;
}
}
}
MapEntity mapEntity;
mapEntity.mX = theBaseEntity->pev->origin.x;
mapEntity.mY = theBaseEntity->pev->origin.y;
@ -167,6 +202,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
mapEntity.mAngle = theBaseEntity->pev->angles[1];
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
mapEntity.mSquadNumber = 0;
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
bool sendEntity = false;
@ -191,7 +227,6 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
}
else if ((theEntityIsVisible || theEntityIsDetected) && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient)
{
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
if (thePlayer)
@ -241,20 +276,136 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
mEntityList[theEntityIndex] = mapEntity;
}
}
if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN ) {
sc=min(3, sc);
dc=min(3,dc);
mc=min(3,mc);
if ( this->mNumSensory != sc || this->mNumDefence != dc || this->mNumMovement != mc ) {
this->mNumSensory=sc;
this->mNumDefence=dc;
this->mNumMovement=mc;
}
}
}
}
void AvHEntityHierarchy::BuildForSpec(BaseEntityListType& inBaseEntityList)
{
this->Clear();
// Loop through all entities in the world
for(BaseEntityListType::iterator theIter = inBaseEntityList.begin(); theIter != inBaseEntityList.end(); theIter++)
{
CBaseEntity* theBaseEntity = *theIter;
int theEntityIndex = theBaseEntity->entindex();
bool theEntityIsVisible = false;
if ( theBaseEntity->pev->team == TEAM_ONE || theBaseEntity->pev->team == TEAM_TWO || theBaseEntity->pev->team == TEAM_THREE || theBaseEntity->pev->team == TEAM_FOUR )
theEntityIsVisible=true;
bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex);
// Don't send ammo, health, weapons, or scans
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
MapEntity mapEntity;
mapEntity.mX = theBaseEntity->pev->origin.x;
mapEntity.mY = theBaseEntity->pev->origin.y;
mapEntity.mUser3 = (AvHUser3)(theBaseEntity->pev->iuser3);
mapEntity.mAngle = theBaseEntity->pev->angles[1];
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
mapEntity.mSquadNumber = 0;
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
bool sendEntity = false;
if (mapEntity.mUser3 == AVH_USER3_HIVE)
{
if (!theEntityIsVisible)
{
mapEntity.mTeam = TEAM_IND;
}
sendEntity = true;
}
else if (mapEntity.mUser3 == AVH_USER3_WELD)
{
vec3_t theEntityOrigin = AvHSHUGetRealLocation(theBaseEntity->pev->origin, theBaseEntity->pev->mins, theBaseEntity->pev->maxs);
mapEntity.mX = theEntityOrigin.x;
mapEntity.mY = theEntityOrigin.y;
sendEntity = true;
}
else if (mapEntity.mUser3 == AVH_USER3_FUNC_RESOURCE)
{
sendEntity = true;
}
else if (theEntityIsVisible && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient)
{
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
if (thePlayer)
{
ASSERT(theEntityIndex > 0);
ASSERT(theEntityIndex <= 32);
mapEntity.mSquadNumber = GetHotkeyGroupContainingPlayer(thePlayer) + 1;
if ((thePlayer->GetPlayMode() == PLAYMODE_PLAYING) && !thePlayer->GetIsSpectator())
{
sendEntity = true;
// If the player has the heavy armor upgrade switch the
// user3 to something that will let us reconstruct that later.
if (thePlayer->pev->iuser3 == AVH_USER3_MARINE_PLAYER &&
GetHasUpgrade(thePlayer->pev->iuser4, MASK_UPGRADE_13))
{
mapEntity.mUser3 = AVH_USER3_HEAVY;
}
}
}
else
{
if (mapEntity.mUser3 != AVH_USER3_HEAVY)
{
sendEntity = true;
}
}
}
}
if (sendEntity)
{
//const AvHMapExtents& theMapExtents = GetGameRules()->GetMapExtents();
// commented this out here, commented out corresponding shift in AvHOverviewMap::Draw at line 771
// float theMinMapX = theMapExtents.GetMinMapX();
// float theMinMapY = theMapExtents.GetMinMapY();
// mapEntity.mX -= theMinMapX;
// mapEntity.mY -= theMinMapY;
mEntityList[theEntityIndex] = mapEntity;
// debug the entity hierarchy message size
// if ( mapEntity.mUser3 == AVH_USER3_COMMANDER_STATION ) {
// for (int i=0; i<200; i++ ) {
// mEntityList[100+i] = mapEntity;
// }
// }
}
}
}
// Returns true when something was sent
bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer)
bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer, bool spectating)
{
// Get iterators for both hierarchies
MapEntityMap::const_iterator clientIter = inClientHierarchy.mEntityList.begin();
MapEntityMap::const_iterator clientEnd = inClientHierarchy.mEntityList.end();
MapEntityMap::const_iterator serverIter = mEntityList.begin();
MapEntityMap::iterator serverIter = mEntityList.begin();
MapEntityMap::const_iterator serverEnd = mEntityList.end();
// Create maps for changes
@ -262,42 +413,63 @@ bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarc
EntityListType OldItems; //to be deleted
//TODO : replace OldItems with vector<int>
int entityCount=0;
// HACK
// If we update more than kMaxSpecEntity then we need to clean out the remaining ones so they get sent next time.
const int kMaxSpecEntity=100;
while (clientIter != clientEnd && serverIter != serverEnd)
{
if (serverIter->first < clientIter->first)
{
NewItems.insert( *serverIter );
if ( entityCount < kMaxSpecEntity ) {
if (serverIter->first < clientIter->first)
{
NewItems.insert( *serverIter );
entityCount++;
++serverIter;
continue;
}
if (serverIter->first > clientIter->first)
{
OldItems.push_back( clientIter->first );
entityCount++;
++clientIter;
continue;
}
if (clientIter->second != serverIter->second )
{
entityCount++;
NewItems.insert( *serverIter );
}
++serverIter;
continue;
}
if (serverIter->first > clientIter->first)
{
OldItems.push_back( clientIter->first );
++clientIter;
continue;
}
if (clientIter->second != serverIter->second)
{
NewItems.insert( *serverIter );
else {
mEntityList.erase(serverIter++);
}
++serverIter;
++clientIter;
}
while(serverIter != serverEnd)
{
NewItems.insert( *serverIter );
++serverIter;
if ( entityCount < kMaxSpecEntity ) {
entityCount++;
NewItems.insert( *serverIter );
++serverIter;
}
else {
mEntityList.erase(serverIter++);
}
}
while(clientIter != clientEnd)
{
OldItems.push_back( clientIter->first );
if ( entityCount < kMaxSpecEntity ) {
entityCount++;
OldItems.push_back( clientIter->first );
}
++clientIter;
}
NetMsg_UpdateEntityHierarchy( inPlayer, NewItems, OldItems );
ASSERT(entityCount < kMaxSpecEntity +1);
NetMsg_UpdateEntityHierarchy( inPlayer, NewItems, OldItems, spectating );
return (!NewItems.empty() || !OldItems.empty());
}

View file

@ -54,7 +54,7 @@ const int kNumStatusTypes = 15;
class MapEntity
{
public:
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0) {}
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0) {}
AvHUser3 mUser3;
AvHTeamNumber mTeam;
@ -62,6 +62,7 @@ public:
float mY;
float mAngle;
int mSquadNumber;
int mUnderAttack;
bool operator==(const MapEntity& e) const
{
@ -70,6 +71,7 @@ public:
mX == e.mX &&
mY == e.mY &&
mAngle == e.mAngle &&
mUnderAttack == e.mUnderAttack &&
mSquadNumber == e.mSquadNumber;
}
@ -93,8 +95,9 @@ public:
void Clear();
#ifdef AVH_SERVER
bool SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer);
bool SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer, bool spectating);
void BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType& inBaseEntityList);
void BuildForSpec(BaseEntityListType& inBaseEntityList);
#endif
bool GetHasBaseLineBeenSent() const;
@ -108,13 +111,18 @@ public:
bool operator!=(const AvHEntityHierarchy& inHierarchy) const;
bool operator==(const AvHEntityHierarchy& inHierarchy) const;
int GetNumSensory() const;
int GetNumDefense() const;
int GetNumMovement() const;
private:
// The encoded entity info that has been sent to clients
MapEntityMap mEntityList;
int mNumMovement;
int mNumSensory;
int mNumDefence;
};
#endif

View file

@ -757,8 +757,13 @@ void EV_MachineGun(struct event_args_s* args)
// General x-punch axis
if ( EV_IsLocal( idx ) )
{
// Multiply punch by upgrade level
float theHalfSpread = (kMGXPunch/4.0f)*(theUpgradeLevel+1);
//float theHalfSpread = (kMGXPunch/4.0f)*(theUpgradeLevel+1);
// Changed to ignore upgrade level
float theHalfSpread = (kMGXPunch/4.0f);
if(theHalfSpread > 0.0f)
{
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -theHalfSpread, theHalfSpread ) );
@ -843,7 +848,11 @@ void EV_Pistol(struct event_args_s* args)
if ( EV_IsLocal( idx ) )
{
// Multiply punch by upgrade level
float theHalfSpread = (kHGXPunch/3.0f)*(theUpgradeLevel+1);
//float theHalfSpread = (kHGXPunch/3.0f)*(theUpgradeLevel+1);
// Changed to ignore upgrade level
float theHalfSpread = (kHGXPunch/3.0f);
if(theHalfSpread > 0.0f)
{
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -theHalfSpread, theHalfSpread ) );
@ -934,7 +943,12 @@ void EV_SonicGun(struct event_args_s* args)
// General x-punch axis
if ( EV_IsLocal( idx ) )
{
float theHalfSpread = (kSGXPunch/3.0f)*(theUpgradeLevel+1);
//float theHalfSpread = (kSGXPunch/3.0f)*(theUpgradeLevel+1);
// Changed to ignore upgrade level
float theHalfSpread = (kSGXPunch/3.0f);
if(theHalfSpread > 0.0f)
{
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -theHalfSpread, theHalfSpread ) );
@ -1033,7 +1047,11 @@ void EV_HeavyMachineGun(struct event_args_s* args)
// General x-punch axis
if ( EV_IsLocal( idx ) )
{
float theHalfSpread = (kHMGXPunch/4.0f)*(theUpgradeLevel+1);
//float theHalfSpread = (kHMGXPunch/4.0f)*(theUpgradeLevel+1);
// Changed to ignore upgrade level
float theHalfSpread = (kHMGXPunch/4.0f);
if(theHalfSpread > 0.0f)
{
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -theHalfSpread, theHalfSpread ) );
@ -1112,7 +1130,11 @@ void EV_GrenadeGun(struct event_args_s* inArgs)
// General x-punch axis
if ( EV_IsLocal( idx ) )
{
float theHalfSpread = (kGGXPunch/2.0f)*(theUpgradeLevel+1);
//float theHalfSpread = (kGGXPunch/2.0f)*(theUpgradeLevel+1);
// Changed to ignore upgrade level
float theHalfSpread = (kGGXPunch/2.0f);
if(theHalfSpread > 0.0f)
{
V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -theHalfSpread, theHalfSpread ) );
@ -1465,7 +1487,7 @@ void EV_OffenseChamber(struct event_args_s* inArgs)
theTempEntity->hitcallback = SpikeHit;
theTempEntity->flags = (FTENT_COLLIDEALL | FTENT_PERSIST | FTENT_COLLIDEKILL);
theTempEntity->die += kSpikeLifetime;
theTempEntity->clientIndex = inArgs->entindex; // Entity to ignore collisions with
theTempEntity->clientIndex = inArgs->iparam1; // Entity to ignore collisions with
//theTempEntity->entity.curstate.framerate = 30;
//theTempEntity->frameMax = 4;//theModel->numframes;
@ -1478,7 +1500,6 @@ void EV_OffenseChamber(struct event_args_s* inArgs)
//VectorCopy(inArgs->angles, theTempEntity->entity.angles);
}
//
//
// ASSERT(inArgs);
@ -2409,17 +2430,17 @@ void EV_Welder(struct event_args_s* inArgs)
float thePercentage;
AvHSHUGetBuildResearchState(thePhysEnt->iuser3, thePhysEnt->iuser4, thePhysEnt->fuser1, theIsBuilding, theIsResearching, thePercentage);
if(thePhysEnt->iuser3 == AVH_USER3_WELD)
{
if((thePercentage < 1.0f) && (thePercentage != -1))
{
gHUD.SetProgressStatus(thePercentage);
}
else
{
gHUD.HideProgressStatus();
}
}
// if(thePhysEnt->iuser3 == AVH_USER3_WELD)
// {
// if((thePercentage < 1.0f) && (thePercentage != -1))
// {
// gHUD.SetProgressStatus(thePercentage);
// }
// else
// {
// gHUD.HideProgressStatus();
// }
// }
}
}
// Fire light smoke from muzzle
@ -2994,11 +3015,14 @@ void EV_Leap(struct event_args_s* inArgs)
{
char* theSoundToPlay = kLeapSound;
gEngfuncs.pEventAPI->EV_PlaySound(inArgs->entindex, inArgs->origin, CHAN_WEAPON, theSoundToPlay, inArgs->fparam1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
if (EV_IsLocal(inArgs->entindex))
if (EV_IsSpec(inArgs->entindex))
{
gEngfuncs.pEventAPI->EV_WeaponAnimation(inArgs->iparam2, 2);
gEngfuncs.pEventAPI->EV_PlaySound(inArgs->entindex, inArgs->origin, CHAN_WEAPON, theSoundToPlay, inArgs->fparam1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
}
if (!EV_IsLocal(inArgs->entindex)) {
gEngfuncs.pEventAPI->EV_PlaySound(inArgs->entindex, inArgs->origin, CHAN_WEAPON, theSoundToPlay, inArgs->fparam1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
}
}
@ -3264,7 +3288,8 @@ void EV_MetabolizeSuccess(struct event_args_s* inArgs)
void WebHit(struct tempent_s* ent, struct pmtrace_s* ptr)
{
gEngfuncs.pEventAPI->EV_PlaySound(ent->entity.index, ptr->endpos, CHAN_AUTO, kWebSpinSound1, 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
gEngfuncs.pEventAPI->EV_PlaySound(ent->entity.index, ptr->endpos, CHAN_AUTO, kWebStrandHitSound, 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
//gEngfuncs.pEventAPI->EV_PlaySound(ent->entity.index, ptr->endpos, CHAN_AUTO, kWebSpinSound1, 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
if(ptr && ent)
{
ent->die = gEngfuncs.GetClientTime();

View file

@ -200,8 +200,9 @@
#include "util/MathUtil.h"
#include "mod/AvHNetworkMessages.h"
#include "mod/AvHNexusServer.h"
#include "mod/AvHParticleTemplateClient.h"
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
AuthMaskListType gAuthMaskList;
extern const char* kSteamIDPending;
@ -227,6 +228,7 @@ extern cvar_t avh_uplink;
extern cvar_t avh_gametime;
extern cvar_t avh_ironman;
extern cvar_t avh_mapvoteratio;
extern cvar_t avh_structurelimit;
BOOL IsSpawnPointValid( CBaseEntity *pPlayer, CBaseEntity *pSpot );
inline int FNullEnt( CBaseEntity *ent ) { return (ent == NULL) || FNullEnt( ent->edict() ); }
@ -264,11 +266,6 @@ int kProfileRunConfig = 0xFFFFFFFF;
std::string GetLogStringForPlayer( edict_t *pEntity );
// SCRIPTENGINE:
#include "scriptengine/AvHLUA.h"
extern AvHLUA *gLUA;
// :SCRIPTENGINE
const AvHMapExtents& GetMapExtents()
{
return GetGameRules()->GetMapExtents();
@ -310,6 +307,7 @@ void SetGameRules(AvHGamerules* inGameRules)
static float gSvCheatsLastUpdateTime;
AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
{
this->mLastJoinMessage = 0.0f;
this->mGameStarted = false;
this->mPreserveTeams = false;
@ -329,13 +327,14 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
this->mCheats.clear();
this->mSpawnEntity = NULL;
RegisterServerVariable(kvBlockScripts);
RegisterServerVariable(kvTournamentMode);
RegisterServerVariable(kvTeam1DamagePercent);
RegisterServerVariable(kvTeam2DamagePercent);
RegisterServerVariable(kvTeam3DamagePercent);
RegisterServerVariable(kvTeam4DamagePercent);
RegisterServerVariable("sv_cheats");
RegisterServerVariable(&avh_blockscripts);
RegisterServerVariable(&avh_tournamentmode);
RegisterServerVariable(&avh_team1damagepercent);
RegisterServerVariable(&avh_team2damagepercent);
RegisterServerVariable(&avh_team3damagepercent);
RegisterServerVariable(&avh_team4damagepercent);
RegisterServerVariable(avh_cheats);
RegisterServerVariable(&avh_structurelimit);
g_VoiceGameMgr.Init(&gVoiceHelper, gpGlobals->maxClients);
@ -343,6 +342,8 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
avh_drawinvisible.value = 1;
#endif
this->mGameInReset = false;
this->ResetGame();
}
@ -362,7 +363,7 @@ int AvHGamerules::WeaponShouldRespawn(CBasePlayerItem *pWeapon)
return GR_WEAPON_RESPAWN_NO;
}
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH //players are authorized by UPP now.
const AuthIDListType& AvHGamerules::GetServerOpList() const
{
@ -407,7 +408,7 @@ bool AvHGamerules::AttemptToJoinTeam(AvHPlayer* inPlayer, AvHTeamNumber inTeamTo
AvHNexus::handleUnauthorizedJoinTeamAttempt(inPlayer->edict(),inTeamToJoin);
}
else
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
if(this->PerformHardAuthorization(inPlayer))
#endif
@ -445,19 +446,19 @@ bool AvHGamerules::AttemptToJoinTeam(AvHPlayer* inPlayer, AvHTeamNumber inTeamTo
}
else
{
// joev: Bug 0000767
// : Bug 0000767
// Tell the other players that this player is joining a team.
if (!this->GetCheatsEnabled()) {
if (!this->GetCheatsEnabled() && this->mGameStarted == true && ( gpGlobals->time > this->mLastJoinMessage + 0.2f ) ) {
AvHTeam* theTeam = GetTeam(inTeamToJoin);
// ensure that the sound only plays if the game already has started
if (this->mGameStarted == true) {
theTeam->PlayHUDSoundForAlivePlayers(HUD_SOUND_PLAYERJOIN);
}
theTeam->PlayHUDSoundForAlivePlayers(HUD_SOUND_PLAYERJOIN);
char* theMessage = UTIL_VarArgs("%s has joined the %s\n",STRING(inPlayer->pev->netname),theTeam->GetTeamPrettyName());
UTIL_ClientPrintAll(HUD_PRINTTALK, theMessage);
UTIL_LogPrintf( "%s joined team \"%s\"\n", GetLogStringForPlayer( inPlayer->edict() ).c_str(), AvHSUGetTeamName(inPlayer->pev->team) );
this->mLastJoinMessage=gpGlobals->time;
}
// :joev
// :
}
}
return theSuccess;
@ -669,7 +670,7 @@ void AvHGamerules::CalculateMapGamma()
this->mCalculatedMapGamma = true;
}
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
BOOL AvHGamerules::GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplayMessage, bool inForcePending) const
{
@ -704,7 +705,18 @@ BOOL AvHGamerules::GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplay
theAuthMask = GetGameRules()->GetAuthenticationMask(theAuthID);
}
if(theAuthMask & theSecurityMask)
if ( inEntity->v.flags & FL_PROXY )
{
if(inDisplayMessage)
{
char theAuthenticateString[512];
sprintf(theAuthenticateString, "Allowing HLTV proxy to join\n");
ALERT(at_logged, theAuthenticateString);
}
theIsAuthorized = true;
}
else if(theAuthMask & theSecurityMask)
{
if(inDisplayMessage)
{
@ -725,7 +737,7 @@ BOOL AvHGamerules::GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplay
}
}
// Local players or bots are always allowed
else if((theAuthID == kSteamIDLocal) || (theAuthID == kSteamIDBot))
else if((theAuthID == kSteamIDLocal) || (theAuthID == kSteamIDBot) || strncmp(theAuthID.c_str(), "HLTV", 4) == 0 )
{
theIsAuthorized = true;
}
@ -744,7 +756,7 @@ BOOL AvHGamerules::GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplay
}
#endif
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
BOOL AvHGamerules::ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] )
{
@ -856,6 +868,10 @@ void AvHGamerules::DeathNotice(CBasePlayer* pVictim, entvars_t* pKiller, entvars
void AvHGamerules::DeleteAndResetEntities()
{
this->mGameInReset = true;
mHLTVEntityHierarchy.Clear();
// Print reset message at console
char theResetString[128];
@ -931,10 +947,6 @@ void AvHGamerules::DeleteAndResetEntities()
if(GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_BUILDABLE) && (!theBuildable || !theBuildable->GetIsPersistent()))
{
ASSERT(theBaseEntity->pev->iuser3 != AVH_USER3_HIVE);
if(theBaseEntity->pev->iuser3 == AVH_USER3_HIVE)
{
int a = 0;
}
UTIL_Remove(theBaseEntity);
}
END_FOR_ALL_BASEENTITIES();
@ -958,6 +970,9 @@ void AvHGamerules::DeleteAndResetEntities()
sprintf(theResetString, "Game reset complete.\n");
ALERT(at_logged, theResetString);
this->mGameInReset = false;
}
BOOL AvHGamerules::FAllowMonsters( void )
@ -991,6 +1006,7 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas
bool theIsFriendlyFireEnabled = friendlyfire.value;
bool theAttackerIsWorld = false;
bool theReceiverIsPlayer = false;
bool theReceiverIsWeb = false;
bool theAttackerIsReceiver = false;
float theScalar = 1.0f;
bool theReceiverIsWorld = false;
@ -1011,6 +1027,11 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas
theReceiverIsWorld = (dynamic_cast<const CWorld*>(inReceiver) != NULL);
}
if(!AvHSUGetIsExternalClassName(STRING(inReceiver->pev->classname)))
{
theReceiverIsWeb = (dynamic_cast<const AvHWebStrand*>(inReceiver) != NULL);
}
if(!theReceiverIsWorld)
{
if((inAttacker == inReceiver) || (CBaseEntity::Instance(inAttacker->pev->owner) == inReceiver))
@ -1038,6 +1059,16 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas
}
}
// Webs are immune to friendly fire
if(theReceiverIsWeb)
{
// Check if teams are the same
if( inAttacker->pev->team == inReceiver->pev->team )
{
theCanDoDamage = false;
}
}
// Mines never blow up friendly mines or anything else
if(theAttackerIsMine)
{
@ -1122,7 +1153,7 @@ bool AvHGamerules::GetArePlayersAllowedToJoinImmediately(void) const
else
{
// if it's not tournament mode and it's within x seconds of game start
float theLateJoinSeconds = CVAR_GET_FLOAT(kvLateJoinTime)*60;
float theLateJoinSeconds = ns_cvar_float(&avh_latejointime)*60;
if(!this->GetIsTournamentMode() && (gpGlobals->time < (this->mTimeGameStarted + theLateJoinSeconds)))
{
@ -1177,11 +1208,11 @@ bool AvHGamerules::GetCanJoinTeamInFuture(AvHPlayer* inPlayer, AvHTeamNumber inT
int theDiscrepancyAllowed = max(1.0f, avh_limitteams.value);
if(((theWouldBeNumPlayersOnTeam - theWouldBeNumPlayersOnOtherTeam) <= theDiscrepancyAllowed) || this->GetIsTournamentMode() || this->GetCheatsEnabled())
{
// tankefugl: 0000953
// : 0000953
if (!(this->GetCheatsEnabled()) && !(inPlayer->JoinTeamCooledDown(BALANCE_VAR(kJoinTeamCooldown))))
outString = kJoinTeamTooFast;
else
// :tankefugl
// :
theCanJoinTeam = true;
}
else
@ -1202,10 +1233,10 @@ const AvHBaseInfoLocationListType& AvHGamerules::GetInfoLocations() const
bool AvHGamerules::GetCheatsEnabled(void) const
{
static float theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
static float theCheatsEnabled = ns_cvar_float( avh_cheats );
if (gpGlobals->time > (gSvCheatsLastUpdateTime + 0.5f))
{
theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
theCheatsEnabled = ns_cvar_float( avh_cheats );
gSvCheatsLastUpdateTime = gpGlobals->time;
}
return (theCheatsEnabled == 1.0f);
@ -1320,12 +1351,16 @@ const AvHGameplay& AvHGamerules::GetGameplay() const
bool AvHGamerules::GetIsTesting(void) const
{
return CVAR_GET_FLOAT(kvTesting) > 0;
#ifdef DEBUG
return ns_cvar_float(&avh_testing) > 0;
#else
return false;
#endif
}
bool AvHGamerules::GetIsTournamentMode(void) const
{
return (CVAR_GET_FLOAT(kvTournamentMode) == 1.0f);
return (ns_cvar_float(&avh_tournamentmode) == 1.0f);
}
bool AvHGamerules::GetIsCombatMode(void) const
@ -1343,24 +1378,23 @@ bool AvHGamerules::GetIsNSMode(void) const
return (this->GetMapMode() == MAP_MODE_NS);
}
bool AvHGamerules::GetIsScriptedMode(void) const
{
return (this->GetMapMode() == MAP_MODE_NSC);
}
bool AvHGamerules::GetIsHamboneMode() const
{
return this->GetIsCombatMode() && (CVAR_GET_FLOAT(kvIronMan) == 2);
return this->GetIsCombatMode() && (ns_cvar_int(&avh_ironman) == 2);
}
bool AvHGamerules::GetIsIronMan(void) const
{
return this->GetIsCombatMode() && (CVAR_GET_FLOAT(kvIronMan) == 1);
return this->GetIsCombatMode() && (ns_cvar_int(&avh_ironman) == 1);
}
bool AvHGamerules::GetIsTrainingMode(void) const
{
return (CVAR_GET_FLOAT(kvTrainingMode) == 1.0f);
#ifdef DEBUG
return (ns_cvar_float(&avh_trainingmode) == 1.0f);
#else
return false;
#endif
}
AvHMapMode AvHGamerules::GetMapMode(void) const
@ -1385,6 +1419,9 @@ AvHEntityHierarchy& AvHGamerules::GetEntityHierarchy(AvHTeamNumber inTeam)
{
return this->mTeamBEntityHierarchy;
}
else if (inTeam == TEAM_SPECT) {
return this->mSpecEntityHierarchy;
}
else
{
ASSERT(false);
@ -1427,7 +1464,7 @@ const char* AvHGamerules::GetSpawnEntityName(AvHPlayer* inPlayer) const
// If there is no no avh start points, try to start up as CS. If that doesn't look
// right, always return DM spawns.
if((this->mMapMode == MAP_MODE_NS) || (this->mMapMode == MAP_MODE_CO) || (this->mMapMode == MAP_MODE_NSC))
if((this->mMapMode == MAP_MODE_NS) || (this->mMapMode == MAP_MODE_CO))
{
// The different cases:
// Player just connected to server and hasn't done anything yet OR
@ -1489,11 +1526,11 @@ float AvHGamerules::GetTimeGameStarted() const
int AvHGamerules::GetTimeLimit() const
{
float theMinutes = CVAR_GET_FLOAT("mp_timelimit");
float theMinutes = ns_cvar_float(&timelimit);
if(this->GetIsCombatMode())
{
theMinutes = CVAR_GET_FLOAT(kvCombatTime);
theMinutes = ns_cvar_float(&avh_combattime);
}
int theTimeLimit = (int)(theMinutes*60);
@ -1767,6 +1804,11 @@ void AvHGamerules::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapo
}
}
int AvHGamerules::GetStructureLimit()
{
return avh_structurelimit.value;
}
Vector AvHGamerules::GetSpawnAreaCenter(AvHTeamNumber inTeamNumber) const
{
Vector theCenter(0, 0, 0);
@ -1895,8 +1937,8 @@ void AvHGamerules::TallyVictoryStats() const
theLosingTeam = &this->mTeamA;
}
ALERT(at_logged, "Team \"%d\" scored \"%d\" with \"%d\" players\n", this->mTeamA.GetTeamNumber(), this->mTeamA.GetTotalResourcesGathered(), this->mTeamA.GetPlayerCount());
ALERT(at_logged, "Team \"%d\" scored \"%d\" with \"%d\" players\n", this->mTeamB.GetTeamNumber(), this->mTeamB.GetTotalResourcesGathered(), this->mTeamB.GetPlayerCount());
ALERT(at_logged, "Team \"%d\" scored \"%.2f\" with \"%d\" players\n", this->mTeamA.GetTeamNumber(), this->mTeamA.GetTotalResourcesGathered(), this->mTeamA.GetPlayerCount());
ALERT(at_logged, "Team \"%d\" scored \"%.2f\" with \"%d\" players\n", this->mTeamB.GetTeamNumber(), this->mTeamB.GetTotalResourcesGathered(), this->mTeamB.GetPlayerCount());
if(!this->mVictoryDraw)
{
@ -2035,6 +2077,7 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap)
this->mTeamAEntityHierarchy.Clear();
this->mTeamBEntityHierarchy.Clear();
this->mSpecEntityHierarchy.Clear();
// Set up both sides
this->mTeamA.SetTeamType(this->mGameplay.GetTeamAType());
@ -2171,11 +2214,6 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap)
this->mStartedCountdown = true;
}
// SCRIPTENGINE: Load map and execute OnLoad
gLUA->Init();
if (gLUA->LoadLUAForMap(STRING(gpGlobals->mapname)))
gLUA->OnLoad();
//gVoiceHelper.Reset();
}
@ -2215,12 +2253,6 @@ void AvHGamerules::JoinTeam(AvHPlayer* inPlayer, AvHTeamNumber inTeamToJoin, boo
if(theServerPlayerData)
theServerPlayerData->SetHasJoinedTeam(true);
}
// SCRIPTENGINE: Join team
if (this->GetIsScriptedMode())
if (thePrevTeam != inTeamToJoin)
gLUA->OnJointeam(inPlayer->entindex(), inTeamToJoin);
// :SCRIPTENGINE
}
// This is called before any entities are spawned, every time the map changes, including the first time
@ -2455,7 +2487,7 @@ int AvHGamerules::GetVotesNeededForMapChange() const
if(theMapVoteRatio > 0)
{
theMapVoteRatio = min(max(0.0f, theMapVoteRatio), 1.0f);
theNumVotes = max(theMapVoteRatio*this->GetNumberOfPlayers(), 1.0f);
theNumVotes = max(theMapVoteRatio*this->GetNumberOfPlayers(true), 1.0f);
}
return theNumVotes;
@ -2504,6 +2536,8 @@ void AvHGamerules::ResetGame(bool inPreserveTeams)
this->mFirstUpdate = true;
this->mPreserveTeams = inPreserveTeams;
gSvCheatsLastUpdateTime = -1.0f;
this->mHasPlayersToReset = false;
this->mLastPlayerResetTime = -1.0f;
}
void AvHGamerules::RecalculateMapMode( void )
@ -2531,10 +2565,6 @@ void AvHGamerules::RecalculateMapMode( void )
{
this->mMapMode = MAP_MODE_CO;
}
else if(!strnicmp(theCStrLevelName, "nsc_", 4))
{
this->mMapMode = MAP_MODE_NSC;
}
}
}
// Check for CS entities
@ -2645,6 +2675,45 @@ void AvHGamerules::MarkDramaticEvent(int inPriority, short inPrimaryEntityIndex,
this->MarkDramaticEvent(inPriority, inPrimaryEntityIndex, secondaryEntityIndex);
}
// Resets players in chunks of 6 and 6
void AvHGamerules::ResetPlayers()
{
const int maxReset = 6;
int numReset = 0;
FOR_ALL_BASEENTITIES();
// Reset the players
// Reset only players that have made it to the readyroom and have been on either team
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM) && (thePlayer->GetHasSeenATeam()))
{
int theUser3 = thePlayer->pev->iuser3;
int theUser4 = thePlayer->pev->iuser4;
int thePlayMode = thePlayer->pev->playerclass;
int thePlayerTeam = thePlayer->pev->team;
int theSolidType = thePlayer->pev->solid;
thePlayer->ResetEntity();
thePlayer->pev->iuser3 = theUser3;
thePlayer->pev->iuser4 = theUser4;
thePlayer->pev->playerclass = thePlayMode;
thePlayer->pev->team = thePlayerTeam;
thePlayer->pev->solid = theSolidType;
if (numReset++ >= maxReset)
{
this->mHasPlayersToReset = true;
return;
}
}
END_FOR_ALL_BASEENTITIES();
this->mHasPlayersToReset = false;
}
void AvHGamerules::ResetEntities()
{
// Now reset all the world entities and mark useable ones with AVH_USER3_USEABLE
@ -2652,9 +2721,9 @@ void AvHGamerules::ResetEntities()
FOR_ALL_BASEENTITIES();
// Reset the entity. Assumes that players in the ready room have already been reset recently.
// Reset non-player entities
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM))
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM)) // && (thePlayer->GetHasSeenATeam()))
{
int theUser3 = thePlayer->pev->iuser3;
int theUser4 = thePlayer->pev->iuser4;
@ -2701,6 +2770,8 @@ void AvHGamerules::ResetEntities()
}
}
END_FOR_ALL_BASEENTITIES();
this->mHasPlayersToReset = true;
}
void AvHGamerules::InternalResetGameRules()
@ -2710,10 +2781,15 @@ void AvHGamerules::InternalResetGameRules()
AvHNexus::cancelGame();
}
this->mGameStarted = false;
this->mLastJoinMessage = 0.0f;
this->mTimeCountDownStarted = 0;
this->mTimeGameStarted = -1;
this->mTimeOfLastGameTimeUpdate = -1;
this->mTimeOfLastHLTVProxyUpdate = -1;
this->mTimeOfForcedLastHLTVProxyUpdate = -1;
this->mTimeOfLastHLTVParticleTemplateSending = -1;
this->mHLTVNumParticleTemplatesSent=0;
this->mHLTVCurrentPlayer=1;
this->mTimeSentCountdown = 0;
this->mTimeLastWontStartMessageSent = 0;
this->mStartedCountdown = false;
@ -2735,7 +2811,7 @@ void AvHGamerules::InternalResetGameRules()
this->mLastWorldEntityUpdate = -1;
this->mLastCloakableUpdate = -1;
this->mLastVictoryUpdate = -1;
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH //under UPP, we don't want to reestablish a connection with each new game
this->mUpdatedUplink = false;
#endif
@ -2828,7 +2904,7 @@ bool AvHGamerules::CanPlayerBeacon(CBaseEntity *inPlayer)
return result;
}
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
unsigned int gTimeLastUpdatedUplink = 0;
void AvHGamerules::UpdateUplink()
@ -2952,28 +3028,94 @@ void AvHGamerules::UpdateHLTVProxy()
// Update proxy if connected
if(theHLTVProxyConnected)
{
const float kHLTVProxyUpdateTime = 6.0f;
const float kParticleTemplateRate = 0.1f;
if(gParticleTemplateList.GetCreatedTemplates())
{
// Make sure client clears out all particle systems first
int theNumberTemplates = gParticleTemplateList.GetNumberTemplates();
if(theNumberTemplates > this->mHLTVNumParticleTemplatesSent)
{
if((this->mTimeOfLastHLTVParticleTemplateSending == -1) || (gpGlobals->time > this->mTimeOfLastHLTVParticleTemplateSending + kParticleTemplateRate))
{
AvHParticleTemplate* theTemplate = gParticleTemplateList.GetTemplateAtIndex(this->mHLTVNumParticleTemplatesSent);
ASSERT(theTemplate);
NetMsg_SetParticleTemplate( NULL, this->mHLTVNumParticleTemplatesSent, *theTemplate );
this->mHLTVNumParticleTemplatesSent++;
this->mTimeOfLastHLTVParticleTemplateSending = gpGlobals->time;
}
}
}
// Send out team for all players (needed for late joiners)
for (int i = this->mHLTVCurrentPlayer; i <= gpGlobals->maxClients; i++ )
{
this->mHLTVCurrentPlayer++;
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
if ( plr && GetGameRules()->IsValidTeam( plr->TeamID() ) )
{
NetMsgSpec_TeamInfo( plr->entindex(), plr->TeamID() );
ScoreInfo info;
memset(&info, 0, sizeof(info));
AvHSUFillScoreInfo(info, dynamic_cast<AvHPlayer *>(plr));
NetMsgSpec_ScoreInfo( info );
break;
}
}
const float kHLTVProxyUpdateTime = 6.0f;
const float kForcedHLTVProxyUpdateTime = 30.0f;
if((this->mTimeOfLastHLTVProxyUpdate == -1) || (gpGlobals->time > (this->mTimeOfLastHLTVProxyUpdate + kHLTVProxyUpdateTime)))
{
//char theMessage[256];
//sprintf(theMessage, "AvHGamerules::UpdateHLTVProxy...\n");
//ALERT(at_console, theMessage);
if((this->mTimeOfForcedLastHLTVProxyUpdate == -1) || (gpGlobals->time > (this->mTimeOfForcedLastHLTVProxyUpdate + kForcedHLTVProxyUpdateTime))) {
// Every so often, send out team for all players (needed for late joiners)
for (int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
if ( plr && GetGameRules()->IsValidTeam( plr->TeamID() ) )
{
NetMsgSpec_TeamInfo( plr->entindex(), plr->TeamID() );
}
}
if(gParticleTemplateList.GetCreatedTemplates())
{
int theNumberTemplates = gParticleTemplateList.GetNumberTemplates();
if(theNumberTemplates <= this->mHLTVNumParticleTemplatesSent) {
// restart the hltv particle templates
this->mHLTVNumParticleTemplatesSent=0;
this->mTimeOfLastHLTVParticleTemplateSending = -1;
// Make sure client clears out all particle systems first
//NetMsg_DelParts(NULL);
}
}
// restart the scoreboard hltv updates
if ( this->mHLTVCurrentPlayer > gpGlobals->maxClients ) this->mHLTVCurrentPlayer=1;
// Send messages to HLTV viewers
NetMsgSpec_SetGammaRamp( GetGameRules()->GetMapGamma() );
// restart the enthier hltv updates
mHLTVEntityHierarchy.Clear();
NetMsg_DelEntityHierarchy(NULL);
this->mTimeOfLastHLTVProxyUpdate = gpGlobals->time;
// Send down map extents so players can start computing it
// Cache this so it isn't computed every round, only the when a player connects or a new map starts?
const char* theCStrLevelName = STRING(gpGlobals->mapname);
const AvHMapExtents& theMapExtents = GetGameRules()->GetMapExtents();
float mins[3] = { theMapExtents.GetMinMapX(), theMapExtents.GetMinMapY(), theMapExtents.GetMinViewHeight() };
float maxs[3] = { theMapExtents.GetMaxMapX(), theMapExtents.GetMaxMapY(), theMapExtents.GetMaxViewHeight() };
NetMsg_SetupMap_Extents( NULL, string( theCStrLevelName ), mins, maxs, theMapExtents.GetDrawMapBG() );
this->mTimeOfForcedLastHLTVProxyUpdate=gpGlobals->time;
}
else {
AvHEntityHierarchy& theEntityList = GetGameRules()->GetEntityHierarchy(TEAM_SPECT);
if ( theEntityList.SendToNetworkStream(mHLTVEntityHierarchy, NULL, true) )
{
mHLTVEntityHierarchy = theEntityList;
}
// Resend the gammaramp
NetMsgSpec_SetGammaRamp( GetGameRules()->GetMapGamma() );
HiveInfoListType theTeamHiveInfo = this->mTeamB.GetHiveInfoList();
const HiveInfoListType tmp;
NetMsg_AlienInfo_Hives( NULL, theTeamHiveInfo, tmp );
this->mTimeOfLastHLTVProxyUpdate = gpGlobals->time;
}
}
}
}
@ -3128,11 +3270,6 @@ void AvHGamerules::SetGameStarted(bool inGameStarted)
this->mTeamA.SetGameStarted(inGameStarted);
this->mTeamB.SetGameStarted(inGameStarted);
// SCRIPTENGINE: OnStart
if (this->GetIsScriptedMode())
gLUA->OnStarted();
// :SCRIPTENGINE
}
void AvHGamerules::SendMOTDToClient( edict_t *client )
@ -3153,19 +3290,20 @@ void AvHGamerules::SendMOTDToClient( edict_t *client )
FREE_FILE( aFileList );
}
int AvHGamerules::GetNumberOfPlayers() const
int AvHGamerules::GetNumberOfPlayers(bool inPlayingGame) const
{
int theNumberOfPlayers = 0;
FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*)
// GetIsRelevant()?
//if(!inPlayingGame || (inEntity->GetPlayMode() == PLAYMODE_PLAYING))
//{
if(UTIL_IsValidEntity(theEntity->edict()))
if(inPlayingGame && (theEntity->GetPlayMode() > 0))
{
theNumberOfPlayers++;
if(UTIL_IsValidEntity(theEntity->edict()))
{
theNumberOfPlayers++;
}
}
//}
END_FOR_ALL_ENTITIES(kAvHPlayerClassName);
return theNumberOfPlayers;
@ -3194,13 +3332,17 @@ void AvHGamerules::Think(void)
// Tell all HUDs to reset
NetMsg_GameStatus_State( kGameStatusReset, this->mMapMode );
// SCRIPTENGINE: Execute OnStart
if (this->GetIsScriptedMode())
gLUA->OnStart();
this->mFirstUpdate = false;
}
// ResetPlayer throttling, commented out for now
// const float playerResetDelay = 0.3f;
// if(this->mHasPlayersToReset && (this->mLastPlayerResetTime + playerResetDelay < theTime) )
// {
// this->ResetPlayers();
// this->mLastPlayerResetTime = theTime;
// }
// Handle queued network messages
#ifdef USE_NETWORK_METERING
const float kNetworkUpdateInterval = .1f;
@ -3221,7 +3363,7 @@ void AvHGamerules::Think(void)
PROFILE_START();
AvHNexus::processResponses();
this->RecalculateHandicap();
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
this->UpdateUplink();
#endif
@ -3293,10 +3435,6 @@ void AvHGamerules::Think(void)
kServerFrameRate = 0;
kNumReturn0 = kNumReturn1 = kNumCached = kNumComputed = 0;
}
else
{
int a = 0;
}
this->UpdateServerCommands();
this->UpdateGameTime();
@ -3376,9 +3514,9 @@ void AvHGamerules::Think(void)
}
void AvHGamerules::RegisterServerVariable(const char* inName)
void AvHGamerules::RegisterServerVariable(const cvar_t* inCvar)
{
mServerVariableList.push_back(inName);
mServerVariableList.push_back(inCvar);
}
int AvHGamerules::GetNumServerVariables() const
@ -3386,7 +3524,7 @@ int AvHGamerules::GetNumServerVariables() const
return mServerVariableList.size();
}
const std::string& AvHGamerules::GetServerVariable(int i) const
const cvar_t* AvHGamerules::GetServerVariable(int i) const
{
return mServerVariableList[i];
}
@ -3394,17 +3532,10 @@ const std::string& AvHGamerules::GetServerVariable(int i) const
bool AvHGamerules::GetIsEntityUnderAttack(int inEntityIndex) const
{
bool theEntityIsUnderAttack = false;
// If entity is in list, it's being attacked
for(EntityUnderAttackListType::const_iterator theIter = this->mEntitiesUnderAttack.begin(); theIter != this->mEntitiesUnderAttack.end(); theIter++)
{
if(inEntityIndex == theIter->first)
{
theEntityIsUnderAttack = true;
break;
}
if ( this->mEntitiesUnderAttack.find(inEntityIndex) != this->mEntitiesUnderAttack.end() ) {
theEntityIsUnderAttack=true;
}
return theEntityIsUnderAttack;
}
@ -3619,11 +3750,13 @@ void AvHGamerules::TriggerAlert(AvHTeamNumber inTeamNumber, AvHAlertType inAlert
{
theSound = HUD_SOUND_ALIEN_NEW_TRAIT;
}
else if(inAlertType == ALERT_HIVE_DEFEND)
{
theSound = HUD_SOUND_ALIEN_ENEMY_APPROACHES;
}
if(theSound != HUD_SOUND_INVALID)
{
int a = 0;
// For all players on this team, play the sound
FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*)
if((theEntity->pev->team == inTeamNumber) || this->GetIsTesting() || (theEntity->GetIsSpectatingTeam(inTeamNumber)))
@ -3641,7 +3774,7 @@ void AvHGamerules::TriggerAlert(AvHTeamNumber inTeamNumber, AvHAlertType inAlert
}
// Add entity to our list of entities that are under attack
if(((inAlertType == ALERT_UNDER_ATTACK) || (inAlertType == ALERT_PLAYER_ENGAGE) || (inAlertType == ALERT_HIVE_DYING)) && (inEntIndex > 0))
if(((inAlertType == ALERT_UNDER_ATTACK) || (inAlertType == ALERT_PLAYER_ENGAGE) || (inAlertType == ALERT_HIVE_DYING)|| (inAlertType == ALERT_HIVE_DEFEND) ) && (inEntIndex > 0))
{
// This will update current time longer if continually attacked
const float kUnderAttackDuration = 5.0f;
@ -3656,7 +3789,7 @@ bool AvHGamerules::GetIsCheatEnabled(const string& inCheatName) const
bool theAllowCheats = this->GetCheatsEnabled();
#ifdef AVH_PLAYTEST_BUILD
#ifdef DEBUG
theAllowCheats = true;
#endif
@ -3722,13 +3855,6 @@ void AvHGamerules::UpdateCheats()
void AvHGamerules::UpdateCountdown(float inTime)
{
if (this->GetIsScriptedMode())
{
// this->SetGameStarted(true);
// TODO: SCRIPTENGINE START
return;
}
const float kTimeWontStartInterval = 8.0f;
int kSecondsToCountdown = 5;
@ -3797,6 +3923,12 @@ void AvHGamerules::UpdateCountdown(float inTime)
}
}
void AvHGamerules::RemoveEntityUnderAttack(int entIndex) {
EntityUnderAttackListType::iterator theIter=this->mEntitiesUnderAttack.find(entIndex);
if ( theIter != mEntitiesUnderAttack.end() )
this->mEntitiesUnderAttack.erase(theIter);
}
void AvHGamerules::UpdateEntitiesUnderAttack()
{
// Expire entities under attack
@ -3905,42 +4037,6 @@ void AvHGamerules::UpdateVictoryStatus(void)
{
bool theCheckVictoryWithCheats = !this->GetCheatsEnabled() || this->GetIsCheatEnabled(kcEndGame1) || this->GetIsCheatEnabled(kcEndGame2);
// SCRIPTENGINE VICTORY
if (this->GetIsScriptedMode())
{
AvHObjectiveState teamAstate, teamBstate;
teamAstate = this->mTeamA.GetObjectiveManager()->GetObjectivesState();
teamBstate = this->mTeamB.GetObjectiveManager()->GetObjectivesState();
if (teamAstate != OBJECTIVE_INDETERMINED || teamBstate != OBJECTIVE_INDETERMINED)
{
// one team is victorious
this->mVictoryTime = gpGlobals->time;
if (teamAstate == teamBstate)
{
this->mVictoryTeam = TEAM_SPECT;
this->mVictoryDraw = true;
}
else if (teamAstate == OBJECTIVE_COMPLETED || teamBstate == OBJECTIVE_FAILED)
this->mVictoryTeam = this->mTeamA.GetTeamNumber();
else if (teamAstate == OBJECTIVE_FAILED || teamBstate == OBJECTIVE_COMPLETED)
this->mVictoryTeam = this->mTeamB.GetTeamNumber();
}
else
{
// Execute LUA callback OnVictoryCheck
AvHTeamNumber vicTeam = gLUA->OnVictoryCheck();
if (vicTeam != TEAM_IND)
{
this->mVictoryTime = gpGlobals->time;
this->mVictoryTeam = vicTeam;
}
}
// Execute LUA callback OnVictory
if (this->mVictoryTeam != TEAM_IND)
gLUA->OnVictory(this->mVictoryTeam);
}
else
if((this->mVictoryTeam == TEAM_IND) && this->mGameStarted && theCheckVictoryWithCheats && !this->GetIsTrainingMode())
{
char* theVictoryMessage = NULL;
@ -3958,7 +4054,7 @@ void AvHGamerules::UpdateVictoryStatus(void)
{
if(this->GetIsIronMan())
{
theTimeLimitSeconds = CVAR_GET_FLOAT(kvIronManTime)*60;
theTimeLimitSeconds = ns_cvar_float(&avh_ironmantime)*60;
}
}
@ -4113,13 +4209,18 @@ void AvHGamerules::UpdateVictoryStatus(void)
// Final game time update to all clients have same winning time
this->SendGameTimeUpdate(true);
// Send final score to everyone if needed
this->mTeamA.SendResourcesGatheredScore(false);
this->mTeamB.SendResourcesGatheredScore(false);
END_FOR_ALL_ENTITIES(kAvHPlayerClassName)
// Send final score to everyone if needed
this->mTeamA.SendResourcesGatheredScore(false);
this->mTeamB.SendResourcesGatheredScore(false);
// Tell everyone that the game ended
NetMsg_GameStatus_State( kGameStatusEnded, this->mMapMode );
NetMsg_TeamScore(this->mTeamA.GetTeamName(), 0, 1 );
NetMsg_TeamScore(this->mTeamB.GetTeamName(), 0, 1 );
}
}
}

View file

@ -121,7 +121,7 @@ public:
typedef vector< pair <string, int> > MapVoteListType;
typedef map< int, int > PlayerMapVoteListType;
typedef map< int, float > PlayerVoteTimeType;
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
typedef vector< pair<string, string> > AuthIDListType;
typedef map<AvHPlayerAuthentication, AuthIDListType> AuthMaskListType;
@ -133,7 +133,7 @@ public:
AvHGamerules();
virtual ~AvHGamerules();
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
virtual BOOL GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplayMessage, bool inForcePending = false) const;
virtual bool PerformHardAuthorization(AvHPlayer* inPlayer) const;
@ -213,9 +213,9 @@ public:
bool RoamingAllowedForPlayer(CBasePlayer* inPlayer) const;
virtual void Think(void);
void RegisterServerVariable(const char* inName);
void RegisterServerVariable(const cvar_t* inCvar);
int GetNumServerVariables() const;
const std::string& GetServerVariable(int i) const;
const cvar_t* GetServerVariable(int i) const;
bool GetCheatsEnabled(void) const;
bool GetIsCheatEnabled(const string& inCheatName) const;
@ -263,7 +263,6 @@ public:
virtual bool GetIsCombatMode(void) const;
virtual AvHTeamNumber GetCombatAttackingTeamNumber() const;
virtual bool GetIsNSMode(void) const;
virtual bool GetIsScriptedMode(void) const;
virtual bool GetIsTrainingMode(void) const;
int GetBaseHealthForMessageID(AvHMessageID inMessageID) const;
@ -287,6 +286,10 @@ public:
bool GetMapVoteStrings(StringList& outMapVoteList);
void RemovePlayerFromVotemap(int inPlayerIndex);
bool GetIsGameInReset() {return this->mGameInReset; };
int GetStructureLimit();
void RemoveEntityUnderAttack(int entIndex);
protected:
void AutoAssignPlayer(AvHPlayer* inPlayer);
void PerformMapValidityCheck();
@ -296,7 +299,7 @@ protected:
virtual void SendMOTDToClient( edict_t *client );
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
void AddAuthStatus(AvHPlayerAuthentication inAuthMask, const string& inWONID, const string& inSteamID);
@ -316,11 +319,12 @@ private:
int GetVotesNeededForMapChange() const;
void InitializeTechNodes();
void InternalResetGameRules();
int GetNumberOfPlayers() const;
int GetNumberOfPlayers(bool inPlayingGame=false) const;
void TallyVictoryStats() const;
void PostVictoryStatsToWeb(const string& inFormParams) const;
bool ReadyToStartCountdown();
void ResetGame(bool inPreserveTeams = false);
void ResetPlayers();
void SendGameTimeUpdate(bool inReliable = false);
void ProcessTeamUpgrades();
void ResetEntities();
@ -342,10 +346,17 @@ private:
bool mFirstUpdate;
bool mPreserveTeams;
bool mGameStarted;
float mLastJoinMessage;
AvHTeamNumber mVictoryTeam;
float mTimeCountDownStarted;
float mTimeGameStarted;
float mTimeOfLastHLTVProxyUpdate;
float mTimeOfForcedLastHLTVProxyUpdate;
float mTimeOfLastHLTVParticleTemplateSending;
int mHLTVNumParticleTemplatesSent;
int mHLTVCurrentPlayer;
AvHEntityHierarchy mHLTVEntityHierarchy;
float mTimeOfLastGameTimeUpdate;
float mTimeSentCountdown;
float mTimeLastWontStartMessageSent;
@ -357,7 +368,7 @@ private:
AvHTeam mTeamB;
float mVictoryTime;
AvHMapMode mMapMode;
// puzl: 0001073
// : 0001073
#ifdef USE_OLDAUTH
bool mUpdatedUplink;
AuthIDListType mServerOpList;
@ -381,6 +392,7 @@ private:
// Potentially marines vs. marines
AvHEntityHierarchy mTeamAEntityHierarchy;
AvHEntityHierarchy mTeamBEntityHierarchy;
AvHEntityHierarchy mSpecEntityHierarchy;
AvHGameplay mGameplay;
@ -390,6 +402,8 @@ private:
typedef map<int, float> EntityUnderAttackListType;
EntityUnderAttackListType mEntitiesUnderAttack;
bool mGameInReset;
AvHMiniMap mMiniMap;
AvHMapExtents mMapExtents;
@ -408,9 +422,12 @@ private:
PlayerMapVoteListType mPlayersVoted;
PlayerVoteTimeType mPlayersVoteTime;
std::vector<std::string> mServerVariableList;
std::vector<const cvar_t *> mServerVariableList;
AvHTeamNumber mCombatAttackingTeamNumber;
bool mHasPlayersToReset;
float mLastPlayerResetTime;
};
AvHGamerules* GetGameRules();

View file

@ -103,9 +103,7 @@ int AvHGrenade::GetDeployAnimation() const
char* AvHGrenade::GetDeploySound() const
{
//return kGRDeploySound;
return NULL;
return kGRDeploySound;
}
float AvHGrenade::GetDeployTime() const
@ -301,7 +299,7 @@ void AvHGrenade::Precache(void)
AvHMarineWeapon::Precache();
PRECACHE_UNMODIFIED_SOUND(kGRFireSound1);
//PRECACHE_UNMODIFIED_SOUND(kGRDeploySound);
PRECACHE_UNMODIFIED_SOUND(kGRDeploySound);
PRECACHE_UNMODIFIED_SOUND(kGRExplodeSound);
PRECACHE_UNMODIFIED_SOUND(kGRHitSound);
@ -380,7 +378,7 @@ void AvHGrenade::CreateProjectile()
}
// How to handle this? Only generate entity on server, but we should do SOMETHING on the client, no?
CGrenade* theGrenade = AvHSUShootServerGrenade(this->m_pPlayer->pev, theStartPosition, theVelocity, BALANCE_VAR(kGrenDetonateTime), true);
CGrenade* theGrenade = AvHSUShootServerGrenade(this->m_pPlayer->pev, theStartPosition, theVelocity, BALANCE_VAR(kHandGrenDetonateTime), true);
ASSERT(theGrenade);
theGrenade->pev->dmg = this->mDamage;

View file

@ -165,11 +165,12 @@ void AvHHealingSpray::FireProjectiles(void)
while((theCurrentEntity = UTIL_FindEntityInSphere(theCurrentEntity, theOriginatingPosition, kHealingSprayRange)) != NULL)
{
bool isSelf=(theCurrentEntity == this->m_pPlayer);
// Can't affect self
if(theCurrentEntity != this->m_pPlayer)
{
// if(theCurrentEntity != this->m_pPlayer)
// {
// If entity is in view cone, and within range
if(this->m_pPlayer->FInViewCone(&theCurrentEntity->pev->origin))
if(isSelf || this->m_pPlayer->FInViewCone(&theCurrentEntity->pev->origin) )
{
// UTIL_FindEntityInSphere doesn't seem to take height into account. Make sure the entity is within range.
float theMaxEntitySize = max(Length(theCurrentEntity->pev->mins), Length(theCurrentEntity->pev->maxs));
@ -208,6 +209,7 @@ void AvHHealingSpray::FireProjectiles(void)
// Players heal by base amount, plus percentage of health
float thePercentage = BALANCE_VAR(kHealingSprayPlayerPercent)/100.0f;
theDamage += thePercentage*theCurrentEntity->pev->max_health;
if ( isSelf ) theDamage *= 0.5f;
thePlayer->Heal(theDamage, true);
}
else if(theBuildable)
@ -240,7 +242,7 @@ void AvHHealingSpray::FireProjectiles(void)
}
}
}
}
// }
}
#endif

View file

@ -77,17 +77,22 @@
// - Post-crash checkin. Restored @Backup from around 4/16. Contains changes for last four weeks of development.
//
//===============================================================================
#include "mod/AvHHive.h"
#include "mod/AvHGamerules.h"
#include "mod/AvHServerUtil.h"
#include "mod/AvHSharedUtil.h"
#include "mod/AvHAlienAbilityConstants.h"
#include "mod/AvHAlienEquipmentConstants.h"
#include "mod/AvHHulls.h"
#include "mod/AvHMovementUtil.h"
#include "mod/AvHSoundListManager.h"
#include "mod/AvHServerVariables.h"
#include "mod/AvHParticleConstants.h"
#include "mod/AvHSpecials.h"
#include "mod/AvHPlayerUpgrade.h"
#include "util/MathUtil.h"
#include <vector>
extern AvHSoundListManager gSoundListManager;
BOOL IsSpawnPointValid( CBaseEntity *pPlayer, CBaseEntity *pSpot );
@ -108,6 +113,10 @@ AvHHive::AvHHive() : AvHBaseBuildable(TECH_HIVE, ALIEN_BUILD_HIVE, kesTeamHive,
this->mTimeLastWoundSound = -1;
this->mTechnology = MESSAGE_NULL;
this->mEnergy = 0.0f;
this->mLastTimeScannedHives=-1.0f;
this->mTimeEmergencyUseEnabled=-1.0f;
this->mTeleportHiveIndex=-1;
}
bool AvHHive::CanBecomeActive() const
@ -343,7 +352,7 @@ void AvHHive::KeyValue(KeyValueData* pkvd)
}
}
void AvHHive::TriggerDeathAudioVisuals()
void AvHHive::TriggerDeathAudioVisuals(bool isRecycled)
{
AvHSUPlayParticleEvent(kpsHiveDeath, this->edict(), this->pev->origin);
@ -424,8 +433,6 @@ void AvHHive::ResetEntity(void)
AvHReinforceable::ResetEntity();
AvHBaseBuildable::ResetEntity();
SetUse(&AvHHive::ConstructUse);
this->ResetCloaking();
this->SetInactive();
@ -541,6 +548,7 @@ bool AvHHive::StartSpawningForTeam(AvHTeamNumber inTeam, bool inForce)
this->pev->nextthink = gpGlobals->time + kHiveAliveThinkInterval;
SetThink(&AvHHive::HiveAliveThink);
SetUse(&AvHHive::TeleportUse);
theSuccess = true;
}
@ -574,7 +582,6 @@ void AvHHive::Spawn()
this->ResetEntity();
SetUse(&AvHHive::ConstructUse);
}
void AvHHive::SetActive()
@ -619,6 +626,7 @@ void AvHHive::SetInactive()
this->mSpawning = false;
this->mSolid = false;
this->mTimeLastContributed = -1;
this->mTimeEmergencyUseEnabled=-1.0f;
this->mTechnology = MESSAGE_NULL;
this->pev->health = 0;
@ -639,7 +647,7 @@ void AvHHive::SetInactive()
// No longer built at all
this->pev->fuser1 = 0.0f;
SetThink(NULL);
SetUse(NULL);
// Stop looping
UTIL_EmitAmbientSound(ENT(this->pev), this->pev->origin, kHiveAmbientSound, 1.0f, .5, SND_STOP, 100);
@ -670,7 +678,8 @@ int AvHHive::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
}
else
{
GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_UNDER_ATTACK, this->entindex());
if ( pevAttacker->team != this->pev->team )
GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_UNDER_ATTACK, this->entindex());
}
if((this->mTimeLastWoundSound == -1) || ((this->mTimeLastWoundSound + kWoundSoundInterval) < gpGlobals->time))
@ -834,7 +843,7 @@ float AvHHive::GetReinforceTime() const
float theRespawnTime = (kMaxRespawnTime - kMaxRespawnTime*this->mEnergy);
// puzl 0000854
// 0000854
// Decrease respawn wait time for aliens (NS: Classic)
// With one hive, for every player above six on the alien team,
// reduce the per-player respawn wait time by two-thirds of a second.
@ -897,3 +906,107 @@ void AvHHive::HiveTouch(CBaseEntity* inOther)
AvHBaseBuildable::BuildableTouch(inOther);
}
void AvHHive::SetEmergencyUse() {
if ( !this->GetEmergencyUse() ) {
GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_HIVE_DEFEND, this->entindex());
this->mTimeEmergencyUseEnabled=gpGlobals->time;
}
}
bool AvHHive::GetEmergencyUse() const {
return ( this->mTimeEmergencyUseEnabled > gpGlobals->time - 5.0f ); //BALANCE_VAR(kHiveEmergencyInterval)
}
void AvHHive::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE_TYPE inUseType, float inValue)
{
if ( this->GetIsSpawning() ) {
this->SetEmergencyUse();
return;
}
const float kHiveScanInterval = 1.0f;
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(inActivator);
if(thePlayer && (thePlayer->pev->team == this->pev->team) && (thePlayer->GetUser3() != AVH_USER3_ALIEN_EMBRYO) && thePlayer->GetCanUseHive() )
{
vector<int> theHives;
vector<int> theHivesUnderAttack;
if((this->mLastTimeScannedHives == -1) || (gpGlobals->time > (this->mLastTimeScannedHives + kHiveScanInterval)))
{
this->mTeleportHiveIndex = -1;
float theFarthestDistance = 0.0f; //sqrt((kMaxMapDimension*2)*(kMaxMapDimension*2));
// Loop through the hives for this team, look for the farthest one (hives under attack take precedence)
FOR_ALL_ENTITIES(kesTeamHive, AvHHive*)
if((theEntity->pev->team == this->pev->team) && theEntity != this )
{
bool theHiveIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntity->entindex());
// allow teleport to any built hive, or unbuilt hives under attack.
if(!theEntity->GetIsSpawning() || ( theEntity->GetIsSpawning() && ( theHiveIsUnderAttack || theEntity->GetEmergencyUse()) ) )
{
theHives.push_back(theEntity->entindex());
if ( theHiveIsUnderAttack )
theHivesUnderAttack.push_back(theEntity->entindex());
}
}
END_FOR_ALL_ENTITIES(kesTeamHive)
this->mLastTimeScannedHives = gpGlobals->time;
}
vector<int> *tmpPtr=&theHives;
if ( theHivesUnderAttack.size() > 0 )
tmpPtr=&theHivesUnderAttack;
if ( tmpPtr->size() > 0 ) {
int myIndex=this->entindex();
for ( int i=0; i < tmpPtr->size(); i++ ) {
int hiveIndex=(*tmpPtr)[i];
if ( hiveIndex > myIndex ) {
this->mTeleportHiveIndex=hiveIndex;
break;
}
}
if ( this->mTeleportHiveIndex == -1 ) {
this->mTeleportHiveIndex=(*tmpPtr)[0];
}
}
// If we have a valid hive index, jump the player to it
if(this->mTeleportHiveIndex != -1)
{
// Play sound at this entity
EMIT_SOUND(this->edict(), CHAN_AUTO, kAlienSightOnSound, 1.0f, ATTN_NORM);
// Move him to it!
AvHHive* theHive = NULL;
AvHSUGetEntityFromIndex(this->mTeleportHiveIndex, theHive);
if(theHive)
{
CBaseEntity* theSpawnEntity = GetGameRules()->GetRandomHiveSpawnPoint(thePlayer, theHive->pev->origin, theHive->GetMaxSpawnDistance());
if(theSpawnEntity)
{
Vector theMinSize;
Vector theMaxSize;
thePlayer->GetSize(theMinSize, theMaxSize);
int theOffset = AvHMUGetOriginOffsetForUser3(AvHUser3(thePlayer->pev->iuser3));
Vector theOriginToSpawn = theSpawnEntity->pev->origin;
theOriginToSpawn.z += theOffset;
if(AvHSUGetIsEnoughRoomForHull(theOriginToSpawn, AvHMUGetHull(false, thePlayer->pev->iuser3), thePlayer->edict()))
{
thePlayer->SetTimeOfLastHiveUse(gpGlobals->time);
thePlayer->SetPosition(theOriginToSpawn);
thePlayer->pev->velocity = Vector(0, 0, 0);
thePlayer->TriggerUncloak();
// Play teleport sound before and after
EMIT_SOUND(inActivator->edict(), CHAN_AUTO, kAlienSightOffSound, 1.0f, ATTN_NORM);
}
}
}
}
}
}

View file

@ -152,10 +152,15 @@ public:
virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual void TriggerDeathAudioVisuals();
virtual void TriggerDeathAudioVisuals(bool isRecycled=false);
virtual void Spawn();
virtual void SetEmergencyUse();
virtual bool GetEmergencyUse() const;
void EXPORT TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE_TYPE inUseType, float inValue);
//virtual void UpdateReinforcements();
protected:
@ -179,6 +184,10 @@ private:
float mTimeLastWoundSound;
float mTimeOfNextUmbra;
float mEnergy;
float mLastTimeScannedHives;
float mTimeEmergencyUseEnabled;
int mTeleportHiveIndex;
};
#endif

View file

@ -190,11 +190,6 @@
#include <sstream>
#include "mod/AvHNetworkMessages.h"
// SCRIPTENGINE:
#include "scriptengine/AvHLUA.h"
#include "scriptengine/AvHLUAUtil.h"
// :SCRIPTENGINE
//#include "cl_dll/studio_util.h"
//#include "cl_dll/r_studioint.h"
@ -254,18 +249,8 @@ float kOverwatchFlashInterval = 2.5f;
const float kReticleInfoMaxAlpha = 50;
int gVisibleMouse = 0;
//voogru: cvar pointers, these should always remain valid once they are set.
//: cvar pointers, these should always remain valid once they are set.
cvar_t *gl_monolights = NULL;
cvar_t *gl_overbright = NULL;
cvar_t *gl_clear = NULL;
cvar_t *hud_draw = NULL;
cvar_t *r_drawviewmodel = NULL;
extern cvar_t *cl_movespeedkey;
cvar_t *gl_d3dflip = NULL;
cvar_t *s_show = NULL;
cvar_t *lightgamma = NULL;
cvar_t *r_detailtextures = NULL;
const AvHMapExtents& GetMapExtents()
{
@ -598,6 +583,8 @@ void AvHHud::Cancel(void)
void AvHHud::ClearData()
{
gParticleTemplateList.Clear();
this->mResources = 0;
this->mHierarchy = NULL;
@ -652,12 +639,22 @@ void AvHHud::ClearData()
this->mAmbientSounds.clear();
// tankefugl: 0000971
// : 0000971
this->mTeammateOrder.clear();
this->mDisplayOrderIndex = 0;
this->mDisplayOrderTime = 0;
this->mDisplayOrderType = 0;
// :tankefugl
// :
this->mProgressBarDrawframe = PROGRESS_BAR_DEFAULT;
this->mProgressBarLastDrawn = -10.0f;
this->mHasWelder=false;
this->mHasMines=false;
this->mHasGrenades=false;
this->mNumSensory=0;
this->mNumMovement=0;
this->mNumDefense=0;
}
@ -688,10 +685,10 @@ typedef struct alias_t {
void TestAlias()
{
alias_s* alias = *(alias_s**)0x2D5929C;
cmdalias_t* alias = gEngfuncs.pfnGetAliases();// *(alias_s**)0x02d29b7c;
while(alias)
{
gEngfuncs.Con_Printf("name: %s\n%x - %x\n", alias->name, alias->name, gEngfuncs);
gEngfuncs.Con_Printf("%s=%s\n%x - %x\n", alias->name, alias->value, alias, gEngfuncs);
alias = alias->next;
}
}
@ -712,17 +709,17 @@ void AvHHud::AddCommands()
gEngfuncs.pfnAddCommand ("-mousepopupmenu", AvHPieMenuHandler::ClosePieMenu);
// Add scrolling commands
gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::ScrollUp);
gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::StopScroll);
gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::KeyScrollUp);
gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::KeyScrollUpStop);
gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::ScrollDown);
gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::StopScroll);
gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::KeyScrollDown);
gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::KeyScrollDownStop);
gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::ScrollLeft);
gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::StopScroll);
gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::KeyScrollLeft);
gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::KeyScrollLeftStop);
gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::ScrollRight);
gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::StopScroll);
gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::KeyScrollRight);
gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::KeyScrollRightStop);
gEngfuncs.pfnAddCommand ("toggleeditps", AvHParticleEditorHandler::ToggleEdit);
@ -731,7 +728,10 @@ void AvHHud::AddCommands()
gEngfuncs.pfnAddCommand ("+showmap", AvHHud::ShowMap);
gEngfuncs.pfnAddCommand ("-showmap", AvHHud::HideMap);
gEngfuncs.pfnAddCommand ("playstream", AvHHud::PlayStream);
gEngfuncs.pfnAddCommand ("+commandmenu", AvHHud::ShowCommandMenu);
gEngfuncs.pfnAddCommand ("-commandmenu", AvHHud::HideCommandMenu);
gEngfuncs.pfnAddCommand ("playstream", AvHHud::PlayStream);
gEngfuncs.pfnAddCommand ("stopstream", AvHHud::StopStream);
#ifdef DEBUG
@ -1822,7 +1822,7 @@ bool AvHHud::SetGamma(float inSlope)
theGammaToTry -= kGammaIncrement;
sGameGammaTable.ProcessSlope(theGammaToTry);
// tankefugl: fakes a successful gamma ramp change if cl_gammaramp is set to 0
// : fakes a successful gamma ramp change if cl_gammaramp is set to 0
if((CVAR_GET_FLOAT(kvGammaRamp) == 0) || sGameGammaTable.InitializeToVideoState())
{
// Tell UI components so they can change shading to look the same
@ -2035,7 +2035,7 @@ void AvHHud::ModifyAmbientSoundEntryIfChanged(bool inSoundOn, int inSoundIndex,
}
}
// tankefugl:
// :
void AvHHud::SetCenterText(const char* inText)
{
LocalizeString(inText, this->mCenterText);
@ -2048,7 +2048,7 @@ void AvHHud::ClearCenterText()
this->mCenterTextTime = -1;
}
// :tankefugl
// :
// Look at incoming order. If we are one of the receivers, play a HUD sound
// indicating our new order
@ -2064,7 +2064,7 @@ void AvHHud::OrderNotification(const AvHOrder& inOrder)
AvHOrderType theOrderType = inOrder.GetOrderType();
AvHHUDSound theSound = HUD_SOUND_INVALID;
// tankefugl: 0000992
// : 0000992
// popup indicator for order
bool thePopup = false;
@ -2109,12 +2109,12 @@ void AvHHud::OrderNotification(const AvHOrder& inOrder)
this->PlayHUDSound(theSound);
// tankefugl: 0000992 | 0001052
// : 0000992 | 0001052
if (thePopup && (this->GetInTopDownMode() == false) && (inOrder.GetOrderActive()))
{
this->SetDisplayOrder(2, this->GetFrameForOrderType(theOrderType), "", "", "");
}
// :tankefugl
// :
}
//}
}
@ -2334,7 +2334,7 @@ int AvHHud::MiniMap(const char* pszName, int iSize, void* pbuf)
return 1;
}
// tankefugl: 0000971
// : 0000971
BIND_MESSAGE(IssueOrder);
int AvHHud::IssueOrder(const char* pszName, int iSize, void* pbuf)
{
@ -2382,14 +2382,14 @@ int AvHHud::IssueOrder(const char* pszName, int iSize, void* pbuf)
return 1;
}
// :tankefugl
// :
BIND_MESSAGE(ServerVar);
int AvHHud::ServerVar(const char* pszName, int iSize, void* pbuf)
{
string name, value;
string name;
int value;
NetMsg_ServerVar( pbuf, iSize, name, value );
mServerVariableMap[name] = value;
return 1;
}
@ -2397,7 +2397,7 @@ int AvHHud::ServerVar(const char* pszName, int iSize, void* pbuf)
BIND_MESSAGE(Progress);
int AvHHud::Progress(const char* pszName, int iSize, void* pbuf)
{
NetMsg_ProgressBar( pbuf, iSize, this->mProgressBarEntityIndex, this->mProgressBarParam );
NetMsg_ProgressBar( pbuf, iSize, this->mProgressBarEntityIndex, this->mProgressBarParam, this->mProgressBarCompleted );
return 1;
}
@ -2421,14 +2421,15 @@ void AvHHud::ResetGame(bool inMapChanged)
//this->mArmorLevel = ARMOR_BASE;
// Clear out all particle systems and templates
if(inMapChanged)
if(inMapChanged || gEngfuncs.IsSpectateOnly() )
{
gParticleTemplateList.Clear();
this->mTimeOfLastUpdate = 0.0f;
this->mInfoLocationList.clear();
this->mMapName="";
}
// puzl: 1066 reset overview map on game restart
// : 1066 reset overview map on game restart
gHUD.GetOverviewMap().Clear();
AvHParticleSystemManager::Instance()->Reset();
@ -2454,6 +2455,8 @@ void AvHHud::ResetGame(bool inMapChanged)
// Selection and commander variables
this->mNumLocalSelectEvents = 0;
// Removed to allow map to be shown before gamestart.
// The map-mode will be re-set by the Gamestate messages anyway.
this->mMapMode = MAP_MODE_UNDEFINED;
this->mInTopDownMode = false;
this->mLeftMouseStarted = false;
@ -2477,6 +2480,7 @@ void AvHHud::ResetGame(bool inMapChanged)
this->mCurrentCursorFrame = 0;
this->mProgressBarEntityIndex = -1;
this->mProgressBarParam = -1;
this->mProgressBarCompleted = -1;
this->mEnemyBlips.Clear();
this->mFriendlyBlips.Clear();
@ -2559,7 +2563,7 @@ void AvHHud::ResetGame(bool inMapChanged)
memset(this->mMenuImpulses, MESSAGE_NULL, sizeof(AvHMessageID)*kNumUpgradeLines);
// tankefugl: 0000992 & 0000971
// : 0000992 & 0000971
this->mTeammateOrder.clear();
this->mCurrentOrderTarget = 0;
this->mCurrentOrderType = 0;
@ -2574,34 +2578,21 @@ void AvHHud::ResetGame(bool inMapChanged)
this->mCenterText.clear();
this->mCenterTextTime = -1;
// :tankefugl
// :
// SCRIPTENGINE:
if (inMapChanged)
{
gLUA->Init();
gLUA->LoadLUAForMap(this->GetMapName().c_str());
this->mProgressBarLastDrawn = -10.0f;
this->mHasGrenades=false;
this->mHasMines=false;
this->mHasWelder=false;
this->mNumSensory=0;
this->mNumMovement=0;
this->mNumDefense=0;
if ( this->mCrosshairShowCount != 1 ) {
this->mCrosshairShowCount = 1;
}
// :SCRIPTENGINE
}
// SCRIPTENGINE:
BIND_MESSAGE(LUAmsg);
int AvHHud::LUAmsg(const char* pszName, int iSize, void* pbuf)
{
int arguments;
lua_State *L = lua_newthread(gLUA->mGlobalContext);
NetMsg_LUAMessage(pbuf, iSize, L, arguments);
if (lua_resume(L, arguments))
{
AvHLUA_OnError(lua_tostring(L, -1));
}
return 1;
}
// :SCRIPTENGINE
BIND_MESSAGE(SetGmma);
int AvHHud::SetGmma(const char* pszName, int iSize, void* pbuf)
{
@ -2652,12 +2643,22 @@ int AvHHud::ClScript(const char *pszName, int iSize, void *pbuf)
return 1;
}
BIND_MESSAGE(DelParts);
int AvHHud::DelParts(const char *pszName, int iSize, void *pbuf)
{
NetMsg_DelParts( pbuf, iSize );
gParticleTemplateList.Clear();
return 1;
}
BIND_MESSAGE(Particles);
int AvHHud::Particles(const char *pszName, int iSize, void *pbuf)
{
int index=-1;
AvHParticleTemplate particle_template;
NetMsg_SetParticleTemplate( pbuf, iSize, particle_template );
gParticleTemplateList.Insert( particle_template );
NetMsg_SetParticleTemplate( pbuf, iSize, index, particle_template );
gParticleTemplateList.Insert( particle_template, index );
return 1;
}
@ -2779,8 +2780,9 @@ int AvHHud::SetupMap(const char* pszName, int iSize, void* pbuf)
this->mMapExtents.SetMinMapY( min_extents[1] );
this->mMapExtents.SetMinViewHeight( min_extents[2] );
this->mMapExtents.SetDrawMapBG( draw_background );
if ( gEngfuncs.IsSpectateOnly() )
this->mOverviewMap.SetMapExtents(this->GetMapName(), this->mMapExtents);
}
return 1;
}
@ -2818,7 +2820,7 @@ int AvHHud::SetTopDown(const char* pszName, int iSize, void* pbuf)
{
// Switch to top down mode!
this->mInTopDownMode = true;
this->ToggleMouse();
this->ShowMouse();
}
if(is_top_down)
@ -2833,6 +2835,12 @@ int AvHHud::SetTopDown(const char* pszName, int iSize, void* pbuf)
return 1;
}
BIND_MESSAGE(DelEntHier);
int AvHHud::DelEntHier(const char *pszName, int iSize, void *pbuf) {
NetMsg_DelEntityHierarchy(pbuf, iSize);
this->mEntityHierarchy.Clear();
return 0;
}
BIND_MESSAGE(EntHier);
int AvHHud::EntHier(const char *pszName, int iSize, void *pbuf)
@ -2887,6 +2895,30 @@ int AvHHud::Fog(const char* pszName, int iSize, void* pbuf)
return 1;
}
BIND_MESSAGE(SetUpgrades);
int AvHHud::SetUpgrades(const char* pszName, int iSize, void* pbuf)
{
int mask;
NetMsg_HUDSetUpgrades( pbuf, iSize, mask );
// Aliens
if ( mask & 0x80 ) {
this->mNumMovement=mask & 0x3;
mask >>=2;
this->mNumDefense=mask & 0x3;
mask >>=2;
this->mNumSensory=mask & 0x3;
}
// Marines
else {
this->mHasWelder=mask & 0x1;
this->mHasMines=mask & 0x2;
this->mHasGrenades=mask & 0x4;
}
return 1;
}
BIND_MESSAGE(ListPS);
int AvHHud::ListPS(const char* pszName, int iSize, void* pbuf)
{
@ -3011,9 +3043,9 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound)
// Some sounds are forced, but don't allow them to be spammed or cut themselves off
bool theForceSound = AvHSHUGetForceHUDSound(inSound) && (inSound != this->mLastHUDSoundPlayed);
// tankefugl: 0000407
// : 0000407
bool theAutoHelpEnabled = gEngfuncs.pfnGetCvarFloat(kvAutoHelp);
// :tankefugl
// :
if((this->mTimeOfNextHudSound == -1) || (this->mTimeOfCurrentUpdate >= this->mTimeOfNextHudSound) || theForceSound)
{
@ -3212,17 +3244,17 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound)
break;
case HUD_SOUND_MARINE_GIVEORDERS:
// tankefugl: 0000407
// : 0000407
if (theAutoHelpEnabled)
{
theSoundPtr = kMarineGiveOrders;
theSoundLength = 2.2f;
}
// :tankefugl
// :
break;
case HUD_SOUND_MARINE_NEEDPORTAL:
// tankefugl: 0000407
// : 0000407
if (theAutoHelpEnabled)
{
if(rand() % 2)
@ -3231,21 +3263,21 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound)
theSoundPtr = kMarineNeedPortal2;
theSoundLength = 1.8f;
}
// :tankefugl
// :
break;
case HUD_SOUND_MARINE_GOTOALERT:
// tankefugl: 0000407
// : 0000407
if (theAutoHelpEnabled)
{
theSoundPtr = kMarineGotoAlert;
theSoundLength = 2.2f;
}
// :tankefugl
// :
break;
case HUD_SOUND_MARINE_COMMANDERIDLE:
// tankefugl: 0000407
// : 0000407
if (theAutoHelpEnabled)
{
if(rand() % 2)
@ -3254,7 +3286,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound)
theSoundPtr = kMarineCommanderIdle2;
theSoundLength = 1.5f;
}
// :tankefugl
// :
break;
case HUD_SOUND_MARINE_ARMORYUPGRADING:
@ -3470,18 +3502,23 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound)
theSoundLength = -1.0f;
theVolume = .6f;
break;
// joev: bug 0000767
// : bug 0000767
case HUD_SOUND_PLAYERJOIN:
theSoundPtr = kPlayerJoinedSound;
theSoundLength = 3.0f;
theVolume = 1.1;
break;
// :joev
// :
}
if(theSoundPtr)
{
gEngfuncs.pfnPlaySoundByName(theSoundPtr, theVolume);
//gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin );
cl_entity_s* thePlayer = this->GetVisiblePlayer();
if ( thePlayer )
gEngfuncs.pfnPlaySoundByNameAtLocation(theSoundPtr, theVolume, thePlayer->origin);
else
gEngfuncs.pfnPlaySoundByName(theSoundPtr, theVolume);
if(theSoundLength >= 0.0f)
{
this->mTimeOfNextHudSound = this->mTimeOfCurrentUpdate + theSoundLength;
@ -3566,15 +3603,17 @@ bool AvHHud::GetMouseTwoDown() const
void AvHHud::HideProgressStatus()
{
if(this->mGenericProgressBar)
{
this->mGenericProgressBar->setVisible(false);
}
this->mProgressBarLastDrawn = -1.0f;
if(this->mAlienProgressBar)
{
this->mAlienProgressBar->setVisible(false);
}
// if(this->mGenericProgressBar)
// {
// this->mGenericProgressBar->setVisible(false);
// }
//
// if(this->mAlienProgressBar)
// {
// this->mAlienProgressBar->setVisible(false);
// }
}
void AvHHud::HideResearchProgressStatus()
@ -3590,7 +3629,9 @@ void AvHHud::Init(void)
{
UIHud::Init();
HOOK_MESSAGE(DelEntHier);
HOOK_MESSAGE(EntHier);
HOOK_MESSAGE(DelParts);
HOOK_MESSAGE(Particles);
HOOK_MESSAGE(SoundNames);
HOOK_MESSAGE(PlayHUDNot);
@ -3613,10 +3654,11 @@ void AvHHud::Init(void)
HOOK_MESSAGE(ClScript);
HOOK_MESSAGE(AlienInfo);
HOOK_MESSAGE(DebugCSP);
HOOK_MESSAGE(SetUpgrades);
HOOK_MESSAGE(TechSlots);
// tankefugl: 0000971
// : 0000971
HOOK_MESSAGE(IssueOrder);
// :tankefugl
// :
HOOK_MESSAGE(ServerVar);
@ -3656,10 +3698,19 @@ void AvHHud::Init(void)
this->mProgressBarEntityIndex = -1;
this->mProgressBarParam = -1;
this->mProgressBarCompleted = -1;
this->mSelectedNodeResourceCost = -1;
this->mCurrentUseableEnergyLevel = 0;
this->mVisualEnergyLevel = 0.0f;
this->mNumSensory=0;
this->mNumMovement=0;
this->mNumDefense=0;
this->mHasGrenades=false;
this->mHasWelder=false;
this->mHasMines=false;
this->mFogActive = false;
this->mFogColor.x = this->mFogColor.y = this->mFogColor.z = 0;
this->mFogStart = 0;
@ -3696,16 +3747,6 @@ void AvHHud::Init(void)
// Initialize viewport
this->mViewport[0] = this->mViewport[1] = this->mViewport[2] = this->mViewport[3] = 0;
gl_monolights = gEngfuncs.pfnGetCvarPointer("gl_monolights");
gl_overbright = gEngfuncs.pfnGetCvarPointer("gl_overbright");
gl_clear = gEngfuncs.pfnGetCvarPointer("gl_clear");
hud_draw = gEngfuncs.pfnGetCvarPointer("hud_draw");
r_drawviewmodel = gEngfuncs.pfnGetCvarPointer("r_drawviewmodel");
gl_d3dflip = gEngfuncs.pfnGetCvarPointer("gl_d3dflip");
s_show = gEngfuncs.pfnGetCvarPointer("s_show");
lightgamma = gEngfuncs.pfnGetCvarPointer("lightgamma");
r_detailtextures = gEngfuncs.pfnGetCvarPointer("r_detailtextures");
}
// This gives the HUD a chance to draw after the VGUI. A component must allow itself to be hooked by calling this function
@ -4423,32 +4464,37 @@ void AvHHud::SetAlienAbility(AvHMessageID inAlienAbility)
this->mAlienAbility = inAlienAbility;
}
void AvHHud::SetProgressStatus(float inPercentage)
void AvHHud::SetProgressStatus(float inPercentage, int inProgressbarType)
{
if(this->mGenericProgressBar)
{
this->mGenericProgressBar->setVisible(false);
}
this->mProgressBarStatus = inPercentage;
this->mProgressBarLastDrawn = this->GetTimeOfLastUpdate();
this->mProgressBarDrawframe = inProgressbarType;
if(this->mAlienProgressBar)
{
this->mAlienProgressBar->setVisible(false);
}
// if(this->mGenericProgressBar)
// {
// this->mGenericProgressBar->setVisible(false);
// }
//
// if(this->mAlienProgressBar)
// {
// this->mAlienProgressBar->setVisible(false);
// }
//
// ProgressBar* theProgressBar = this->mGenericProgressBar;
// if(this->GetIsAlien())
// {
// theProgressBar = this->mAlienProgressBar;
// }
//
// if(theProgressBar)
// {
// theProgressBar->setVisible(true);
//
// int theNumSegments = theProgressBar->getSegmentCount();
// int theSegment = inPercentage*theNumSegments;
// theProgressBar->setProgress(theSegment);
// }
ProgressBar* theProgressBar = this->mGenericProgressBar;
if(this->GetIsAlien())
{
theProgressBar = this->mAlienProgressBar;
}
if(theProgressBar)
{
theProgressBar->setVisible(true);
int theNumSegments = theProgressBar->getSegmentCount();
int theSegment = inPercentage*theNumSegments;
theProgressBar->setProgress(theSegment);
}
}
void AvHHud::SetReinforcements(int inReinforcements)
@ -4641,7 +4687,7 @@ void AvHHud::UpdateCommonUI()
if(this->GetManager().GetVGUIComponentNamed(this->mPieMenuControl, thePieMenu))
{
// tankefugl: Added check to ensure that it is only updated when a menu is visible
// : Added check to ensure that it is only updated when a menu is visible
if (thePieMenu->getChildCount() > 0)
{
vgui::Panel *rootMenu = thePieMenu->getChild(0);
@ -4670,23 +4716,115 @@ void AvHHud::UpdateCommonUI()
}
}
#define FORCE_CVAR(a,b) if(a)a->value = b;
void RemoveAlias(char *name)
{
cmdalias_t* alias = gEngfuncs.pfnGetAliases();// *(alias_s**)0x02d29b7c;
while(alias)
{
if ( name && (strlen(name) > 1) && alias->name && (strcmp(alias->name, name) == 0) ) {
strcat(alias->name, " ");
break;
}
alias = alias->next;
}
}
void ForceCvar(char *name, cvar_t *cvar, float value)
{
cmdalias_t* alias = gEngfuncs.pfnGetAliases();// *(alias_s**)0x02d29b7c;
while(alias)
{
if ( name && (strlen(name) > 1) && alias->name && (strcmp(alias->name, name) == 0) ) {
strcat(alias->name, " ");
break;
}
alias = alias->next;
}
if ( (cvar) && (cvar)->value != (value) ) (gEngfuncs.Cvar_SetValue)( (name) , (value) );
}
cvar_t *gl_monolights = NULL;
cvar_t *gl_overbright = NULL;
cvar_t *gl_clear = NULL;
cvar_t *cl_rate = NULL;
cvar_t *hud_draw = NULL;
cvar_t *r_drawviewmodel = NULL;
extern cvar_t *cl_movespeedkey;
cvar_t *gl_d3dflip = NULL;
cvar_t *s_show = NULL;
cvar_t *lightgamma = NULL;
cvar_t *texgamma = NULL;
cvar_t *r_detailtextures = NULL;
cvar_t *gl_max_size = NULL;
void AvHHud::InitExploitPrevention() {
gl_monolights = gEngfuncs.pfnGetCvarPointer("gl_monolights");
cl_rate = gEngfuncs.pfnGetCvarPointer("cl_rate");
gl_overbright = gEngfuncs.pfnGetCvarPointer("gl_overbright");
gl_clear = gEngfuncs.pfnGetCvarPointer("gl_clear");
hud_draw = gEngfuncs.pfnGetCvarPointer("hud_draw");
r_drawviewmodel = gEngfuncs.pfnGetCvarPointer("r_drawviewmodel");
gl_d3dflip = gEngfuncs.pfnGetCvarPointer("gl_d3dflip");
s_show = gEngfuncs.pfnGetCvarPointer("s_show");
lightgamma = gEngfuncs.pfnGetCvarPointer("lightgamma");
texgamma = gEngfuncs.pfnGetCvarPointer("texgamma");
r_detailtextures = gEngfuncs.pfnGetCvarPointer("r_detailtextures");
gl_max_size = gEngfuncs.pfnGetCvarPointer("gl_max_size");
ForceCvar("gl_monolights", gl_monolights, 0.0f);
ForceCvar("gl_overbright", gl_overbright, 0.0f);
ForceCvar("gl_clear", gl_clear, 0.0f);
ForceCvar("hud_draw", hud_draw, 1.0f);
ForceCvar("r_drawviewmodel", r_drawviewmodel, 1.0f);
ForceCvar("gl_d3dflip", gl_d3dflip, 1.0f);
ForceCvar("s_show", s_show, 0.0f);
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
ForceCvar("gl_max_size", gl_max_size, 256.0f);
RemoveAlias("lightgamma");
if(lightgamma && lightgamma->value < 2.0) {
ForceCvar("lightgamma", lightgamma, 2.0f);
}
if(lightgamma && lightgamma->value > 5.0) {
ForceCvar("lightgamma", lightgamma, 5.0f);
}
RemoveAlias("texgamma");
if(texgamma && texgamma->value < 1.0) {
ForceCvar("texgamma", texgamma, 1.0f);
}
if(texgamma && texgamma->value > 5.0) {
ForceCvar("texgamma", texgamma, 5.0f);
}
}
void AvHHud::UpdateExploitPrevention()
{
//Note: Sometimes some clients will not have these cvars, so be sure to check that they are not null.
FORCE_CVAR(gl_monolights, 0.0f);
FORCE_CVAR(gl_overbright, 0.0f);
FORCE_CVAR(gl_clear, 0.0f);
FORCE_CVAR(hud_draw, 1.0f);
FORCE_CVAR(r_drawviewmodel, 1.0f);
FORCE_CVAR(cl_movespeedkey, AvHMUGetWalkSpeedFactor(this->GetHUDUser3()));
FORCE_CVAR(gl_d3dflip, 1.0f);
FORCE_CVAR(s_show, 0.0f);
FORCE_CVAR(r_detailtextures, 0.0f);
ForceCvar("gl_monolights", gl_monolights, 0.0f);
ForceCvar("gl_overbright", gl_overbright, 0.0f);
ForceCvar("gl_clear", gl_clear, 0.0f);
ForceCvar("hud_draw", hud_draw, 1.0f);
ForceCvar("r_drawviewmodel", r_drawviewmodel, 1.0f);
float movespeedkey=AvHMUGetWalkSpeedFactor(this->GetHUDUser3());
ForceCvar("cl_movespeedkey", cl_movespeedkey, movespeedkey);
ForceCvar("gl_d3dflip", gl_d3dflip, 1.0f);
ForceCvar("s_show", s_show, 0.0f);
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
ForceCvar("gl_max_size", gl_max_size, 256.0f);
if(lightgamma && lightgamma->value < 2.0)
lightgamma->value = 2.0f;
if(lightgamma && lightgamma->value < 2.0) {
ForceCvar("lightgamma", lightgamma, 2.0f);
}
if(lightgamma && lightgamma->value > 5.0) {
ForceCvar("lightgamma", lightgamma, 5.0f);
}
if(texgamma && texgamma->value < 1.0) {
ForceCvar("texgamma", texgamma, 1.0f);
}
if(texgamma && texgamma->value > 5.0) {
ForceCvar("texgamma", texgamma, 5.0f);
}
}
void AvHHud::UpdateAlienUI(float inCurrentTime)
@ -4758,6 +4896,7 @@ bool AvHHud::GetCommanderLabelText(std::string& outCommanderName) const
{
std::stringstream theStream;
char buff[512+sizeof(hud_player_info_t)];
string theCommanderText;
LocalizeString(kCommander, theCommanderText);
@ -4765,13 +4904,15 @@ bool AvHHud::GetCommanderLabelText(std::string& outCommanderName) const
theStream << theCommanderText;
theStream << ": ";
hud_player_info_t thePlayerInfo;
gEngfuncs.pfnGetPlayerInfo(theCommander, &thePlayerInfo);
hud_player_info_t *thePlayerInfo=(hud_player_info_t *)&buff[0];
memset(thePlayerInfo, 0, 512+sizeof(hud_player_info_t));
memset(thePlayerInfo->padding, 0xe, sizeof(thePlayerInfo->padding));
gEngfuncs.pfnGetPlayerInfo(theCommander, thePlayerInfo);
if(thePlayerInfo.name)
if(thePlayerInfo->name)
{
const int kMaxCommNameLen = 8;
theStream << string(thePlayerInfo.name).substr(0, kMaxCommNameLen);
theStream << string(thePlayerInfo->name).substr(0, kMaxCommNameLen);
}
outCommanderName = theStream.str();
@ -4911,11 +5052,6 @@ bool AvHHud::GetIsNSMode() const
return (this->mMapMode == MAP_MODE_NS);
}
bool AvHHud::GetIsScriptedMode() const
{
return (this->mMapMode == MAP_MODE_NSC);
}
bool AvHHud::GetIsMouseInRegion(int inX, int inY, int inWidth, int inHeight)
{
bool theMouseIsInRegion = false;
@ -5693,7 +5829,7 @@ float AvHHud::GetTimeOfLastUpdate() const
void AvHHud::UpdateProgressBar()
{
this->HideProgressStatus();
// this->HideProgressStatus();
float thePercentage;
if(gMiniMap.GetIsProcessing(&thePercentage))
@ -5718,34 +5854,40 @@ void AvHHud::UpdateProgressBar()
if(theProgressEntity)
{
ASSERT(this->mProgressBarParam >= 1);
ASSERT(this->mProgressBarParam <= 4);
ASSERT(this->mProgressBarParam <= 5);
float theProgress = 0.0f;
switch(this->mProgressBarParam)
{
case 1:
theProgress = theProgressEntity->curstate.fuser1;
break;
case 2:
theProgress = theProgressEntity->curstate.fuser2;
break;
case 3:
theProgress = theProgressEntity->curstate.fuser3;
break;
case 4: // NOTE: check delta.lst for fuser4, it isn't propagated currently
theProgress = theProgressEntity->curstate.fuser4;
break;
if ( this->mProgressBarParam == 5 ) {
thePercentage=(float)(this->mProgressBarCompleted)/100.0f;
}
else {
switch(this->mProgressBarParam)
{
case 1:
theProgress = theProgressEntity->curstate.fuser1;
break;
case 2:
theProgress = theProgressEntity->curstate.fuser2;
break;
case 3:
theProgress = theProgressEntity->curstate.fuser3;
break;
case 4: // NOTE: check delta.lst for fuser4, it isn't propagated currently
theProgress = theProgressEntity->curstate.fuser4;
break;
}
if((this->GetHUDUser3() == AVH_USER3_ALIEN_EMBRYO) || this->GetIsDigesting())
{
theProgress = pmove->fuser3;
if((this->GetHUDUser3() == AVH_USER3_ALIEN_EMBRYO) || this->GetIsDigesting() )
{
theProgress = pmove->fuser3;
}
thePercentage = theProgress/kNormalizationNetworkFactor;
}
thePercentage = theProgress/kNormalizationNetworkFactor;
int theType = (this->GetIsAlien())? PROGRESS_BAR_ALIEN: PROGRESS_BAR_MARINE;
if(thePercentage < 1.0f)
{
this->SetProgressStatus(thePercentage);
this->SetProgressStatus(thePercentage, theType);
}
// else
// {
@ -5761,20 +5903,16 @@ void AvHHud::UpdateProgressBar()
if(theEntity)
{
this->HideProgressStatus();
this->HideResearchProgressStatus();
//this->HideResearchProgressStatus();
bool theIsBuilding, theIsResearching;
float thePercentage;
AvHSHUGetBuildResearchState(theEntity->curstate.iuser3, theEntity->curstate.iuser4, theEntity->curstate.fuser1, theIsBuilding, theIsResearching, thePercentage);
if(theIsBuilding && (thePercentage > 0.0f) && (thePercentage < 1.0f))
if(theIsResearching && (thePercentage > 0) && (thePercentage < 1.0f))
{
// Turned off progress bar now that we have circular build icons
//this->SetGenericProgressStatus(thePercentage);
}
else if(theIsResearching && (thePercentage > 0) && (thePercentage < 1.0f))
{
this->SetResearchProgressStatus(thePercentage);
this->SetProgressStatus(thePercentage, PROGRESS_BAR_DEFAULT);
//this->SetResearchProgressStatus(thePercentage);
}
}
}
@ -6379,12 +6517,12 @@ void AvHHud::UpdateViewModelEffects()
theRenderMode = kAlienCloakViewModelRenderMode;
theRenderAmount = 10;
}
else if( theRenderAmount > kAlienSelfCloakingBaseOpacity && theRenderAmount < 186)
else if( theRenderAmount > kAlienSelfCloakingBaseOpacity && theRenderAmount < kAlienSelfCloakingMinOpacity)
{
theRenderMode = kAlienCloakViewModelRenderMode;
theRenderAmount = 40;
}
else if ( theRenderAmount == 186 ) {
else if ( theRenderAmount == kAlienSelfCloakingMinOpacity ) {
theRenderMode = kAlienCloakViewModelRenderMode;
theRenderAmount = 50;
}
@ -6709,7 +6847,11 @@ void AvHHud::UpdateEnableState(PieMenu* inMenu)
void AvHHud::ShowMap()
{
if (!sShowMap && gHUD.GetIsNSMode())
bool isNsMode=false;
if ( strnicmp(gHUD.GetMapName().c_str(), "ns_", 3) == 0 )
isNsMode=true;
if ( (!sShowMap || gEngfuncs.IsSpectateOnly()) && isNsMode )
{
sShowMap = true;
gHUD.HideCrosshair();
@ -6727,6 +6869,16 @@ void AvHHud::HideMap()
}
}
void AvHHud::ShowCommandMenu()
{
gViewPort->ShowCommandMenu(gViewPort->m_StandardMenu);
}
void AvHHud::HideCommandMenu()
{
gViewPort->HideCommandMenu();
}
void AvHHud::GetSpriteForUser3(AvHUser3 inUser3, int& outSprite, int& outFrame, int& outRenderMode)
{
@ -6990,7 +7142,7 @@ float AvHHud::GetServerVariableFloat(const char* inName) const
}
else
{
return atof( iterator->second.c_str() );
return iterator->second;
}
}

View file

@ -262,6 +262,9 @@ public:
virtual void Init(void);
virtual void PostUIInit(void);
virtual void VidInit(void);
virtual void InitHUDData( void );
virtual void InitExploitPrevention( void );
void UpdateExploitPrevention();
bool GetGameStarted() const;
int GetGameTime() const;
@ -300,9 +303,9 @@ public:
void SetSelectingWeaponID(int inWeaponID, int inR = -1, int inG = -1, int inB = -1);
void SetTechHelpText(const string& inTechHelpText);
void DrawSelectionCircleOnGroundAtPoint(vec3_t inOrigin, int inRadius);
// tankefugl: 0000988
// : 0000988
void DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha = 1.0f);
// :tankefugl
// :
void DrawSelectionAndBuildEffects();
void DrawHUDNumber(int inX, int inY, int inFlags, int inNumber);
@ -321,7 +324,7 @@ public:
int GetMaxAlienResources() const;
int GetNumActiveHives() const;
void HideProgressStatus();
void SetProgressStatus(float inPercentage);
void SetProgressStatus(float inPercentage, int inProgressbarType = 0);
AvHVisibleBlipList& GetEnemyBlipList();
AvHVisibleBlipList& GetFriendlyBlipList();
@ -336,7 +339,6 @@ public:
bool SwitchUIMode(UIMode inNewMode);
bool GetIsCombatMode() const;
bool GetIsNSMode() const;
bool GetIsScriptedMode() const;
void HideResearchProgressStatus();
void SetResearchProgressStatus(float inPercentage);
@ -352,7 +354,7 @@ public:
int GetCurrentWeaponID(void);
void DrawTopDownBG();
void DrawTranslatedString(int inX, int inY, const char* inStringToTranslate, bool inCentered = false, bool inIgnoreUpgrades = false, bool inTrimExtraInfo = false);
void DrawTranslatedString(int inX, int inY, const char* inStringToTranslate, bool inCentered = false, bool inIgnoreUpgrades = false, bool inTrimExtraInfo = false, float alpha = 1.0f);
void HandleFog();
void PostModelRender(char* inModelName);
void PreRenderFrame();
@ -364,6 +366,7 @@ public:
void RenderMarineUI();
void RenderCommanderUI();
void RenderAlienUI();
void RenderProgressBar(char *spriteName);
void RenderMiniMap(int inX, int inY, int inWidth, int inHeight);
void RenderStructureRanges();
@ -386,10 +389,13 @@ public:
int Countdown(const char* pszName, int iSize, void* pbuf);
int DebugCSP(const char* pszName, int iSize, void* pbuf);
int EditPS(const char* pszName, int iSize, void* pbuf);
int DelEntHier(const char *pszName, int iSize, void *pbuf);
int EntHier(const char *pszName, int iSize, void *pbuf);
int Fog(const char* pszName, int iSize, void* pbuf);
int SetUpgrades(const char* pszName, int iSize, void* pbuf);
int ListPS(const char* pszName, int iSize, void* pbuf);
int Particles(const char *pszName, int iSize, void *pbuf);
int DelParts(const char *pszName, int iSize, void *pbuf);
int Particles(const char *pszName, int iSize, void *pbuf);
int SoundNames(const char *pszName, int iSize, void *pbuf);
int PlayHUDNot(const char* pszName, int iSize, void* pbuf);
@ -398,8 +404,9 @@ public:
int GameStatus(const char* pszName, int iSize, void* pbuf);
int MiniMap(const char* pszName, int iSize, void* pbuf);
// : 0000971
int IssueOrder(const char* pszName, int iSize, void* pbuf);
int LUAmsg(const char* pszName, int iSize, void* pbuf);
// :
int Progress(const char* pszName, int iSize, void* pbuf);
int SetGmma(const char* pszName, int iSize, void* pbuf);
int SetSelect(const char* pszName, int iSize, void* pbuf);
@ -433,18 +440,18 @@ public:
float GetServerVariableFloat(const char* inName) const;
// tankefugl:
// :
void SetCenterText(const char* inText);
void DrawCenterText();
void ClearCenterText();
// :tankefugl
// :
private:
// tankefugl:
// :
std::string mCenterText;
float mCenterTextTime;
// :tankefugl
// :
bool GetCommanderLabelText(std::string& outCommanderName) const;
@ -454,21 +461,21 @@ private:
void DrawMouseCursor(int inBaseX, int inBaseY);
void DrawOrders();
void DrawHelpIcons();
// tankefugl: 0000971
// : 0000971
void GetOrderDirection(vec3_t inTarget, int inOrderType);
void DrawTeammateOrders();
// tankefugl: 0000992
// : 0000992
void DrawDisplayOrder();
void SetDisplayOrder(int inOrderType, int inOrderIndex, string inText1, string inText2, string inText3);
// :tankefugl
// :
void DrawHUDStructureNotification();
void DrawInfoLocationText();
void DrawPlayerNames();
void DrawReticleInfo();
void DrawToolTips();
// tankefugl: 0000971 -- added inAlpha
// : 0000971 -- added inAlpha
void DrawWorldSprite(int inSpriteHandle, int inRenderMode, vec3_t inWorldPosition, int inFrame, float inWorldSize, float inAlpha = 1.0f);
// :tankefugl
// :
void DrawOrderIcon(const AvHOrder& inOrder);
void DrawOrderText(const AvHOrder& inOrder);
int GetFrameForOrderType(AvHOrderType inOrderType) const;
@ -520,7 +527,6 @@ private:
void UpdateAlienUI(float inCurrentTime);
void UpdateCommonUI();
void UpdateDataFromVuser4(float inCurrentTime);
void UpdateExploitPrevention();
void UpdateMarineUI(float inCurrentTime);
void UpdateUpgradeCosts();
void UpdateEnableState(PieMenu* inMenu);
@ -607,9 +613,9 @@ private:
OrderListType mOrders;
//AvHOrderType mOrderMode;
// tankefugl: 0000971
// : 0000971
map< int, TeammateOrderType > mTeammateOrder;
// tankefugl: 0000992
// : 0000992
float mDisplayOrderTime;
int mDisplayOrderType;
int mDisplayOrderDirection;
@ -620,7 +626,7 @@ private:
int mCurrentOrderTarget;
int mCurrentOrderType;
float mCurrentOrderTime;
// :tankefugl
// :
AvHMessageID mTechEvent;
AvHMessageID mAlienAbility;
AvHMessageID mGroupEvent;
@ -640,6 +646,14 @@ private:
string mPreviousHelpText;
float mTimeLastHelpTextChanged;
int mNumMovement;
int mNumSensory;
int mNumDefense;
bool mHasGrenades;
bool mHasWelder;
bool mHasMines;
int mSelectedNodeResourceCost;
float mCurrentUseableEnergyLevel;
float mVisualEnergyLevel;
@ -649,6 +663,9 @@ private:
static void ShowMap();
static void HideMap();
static void ShowCommandMenu();
static void HideCommandMenu();
float mTimeLastOverwatchPulse;
bool mInTopDownMode;
int mNumLocalSelectEvents;
@ -693,6 +710,7 @@ private:
HSPRITE mMarineUIJetpackSprite;
HSPRITE mAlienUIEnergySprite;
HSPRITE mAlienUICloakSprite;
HSPRITE mMembraneSprite;
HSPRITE mDigestingSprite;
@ -708,9 +726,9 @@ private:
HSPRITE mMarineOrderIndicator;
HSPRITE mMarineUpgradesSprite;
// tankefugl: 0000971
// : 0000971
HSPRITE mTeammateOrderSprite;
// :tankefugl
// :
typedef map<int, int> SpriteListType;
SpriteListType mActionButtonSprites;
//SpriteListType mHelpSprites;
@ -751,12 +769,19 @@ private:
int mProgressBarEntityIndex;
int mProgressBarParam;
int mProgressBarCompleted;
float mProgressBarStatus;
float mProgressBarLastDrawn;
int mProgressBarDrawframe;
bool mFogActive;
vec3_t mFogColor;
float mFogStart;
float mFogEnd;
HSPRITE mExperienceBarSprite;
HSPRITE mProgressBarSprite;
AvHBaseInfoLocationListType mInfoLocationList;
string mLocationText;
@ -834,7 +859,7 @@ private:
bool mSteamUIActive;
typedef std::map<std::string, std::string> ServerVariableMapType;
typedef std::map<std::string, int> ServerVariableMapType;
ServerVariableMapType mServerVariableMap;
static bool sShowMap;

View file

@ -138,6 +138,7 @@
#include "mod/AvHServerVariables.h"
#include "mod/AvHSpriteAPI.h"
#include "mod/AvHParticleEditorHandler.h"
#include "mod/AvHAlienAbilityConstants.h"
#include <list>
#include "common/entity_types.h"
@ -250,7 +251,7 @@ void ProjectPointFromViewOrigin(int inDistanceToProject, int inScreenX, int inSc
VectorMA(GetViewOrigin(), inDistanceToProject, theRay, outResult);
}
void AvHHud::DrawTranslatedString(int inX, int inY, const char* inStringToTranslate, bool inCentered, bool inIgnoreUpgrades, bool inTrimExtraInfo)
void AvHHud::DrawTranslatedString(int inX, int inY, const char* inStringToTranslate, bool inCentered, bool inIgnoreUpgrades, bool inTrimExtraInfo, float alpha)
{
// Translate
string theTranslatedText;
@ -274,6 +275,10 @@ void AvHHud::DrawTranslatedString(int inX, int inY, const char* inStringToTransl
char theCharBuffer[512];
sprintf(theCharBuffer, "%s", theTranslatedText.c_str());
theR *= alpha;
theB *= alpha;
theG *= alpha;
if(inCentered)
{
this->DrawHudStringCentered(inX, inY, ScreenWidth(), theCharBuffer, theR, theG, theB);
@ -885,7 +890,7 @@ void AvHHud::DrawToolTips()
}
void AvHHud::DrawWorldSprite(int inSpriteHandle, int inRenderMode, vec3_t inWorldPosition, int inFrame, float inWorldSize, float inAlpha)
// tankefugl: added inAlpha
// : added inAlpha
{
vec3_t theUpperLeft;
vec3_t theLowerRight;
@ -1066,13 +1071,13 @@ void AvHHud::DrawOrderText(const AvHOrder& inOrder)
string theTranslatedLocation = theLocationOfOrder;
LocalizeString(theLocationOfOrder.c_str(), theTranslatedLocation);
// tankefugl: 0000992
// : 0000992
string theFirstLine = theLocalizedTitle;
if(theRangeDisplayString != "")
{
theFirstLine += string(" : ") + theRangeDisplayString;
}
// :tankefugl
// :
Vector theScreenPos;
if(AvHCUWorldToScreen((float*)theOrderLocation, (float*)&theScreenPos))
@ -1101,17 +1106,17 @@ void AvHHud::DrawOrderText(const AvHOrder& inOrder)
this->DrawHudStringCentered(theBaseX, theBaseY + 2*theStringHeight, ScreenWidth(), theTranslatedLocation.c_str(), theR, theG, theB);
}
}
// tankefugl: 0000992
// : 0000992
if (this->mDisplayOrderType == 2)
{
// this->mDisplayOrderText1 = "The commander issued an order:";
this->mDisplayOrderText1 = theFirstLine.c_str();
this->mDisplayOrderText2 = theTranslatedLocation.c_str();
}
// :tankefugl
// :
}
// tankefugl:
// :
#define CENTER_TEXT_LENGTH 10
#define CENTER_TEXT_FADEOUT 2
void AvHHud::DrawCenterText()
@ -1136,9 +1141,9 @@ void AvHHud::DrawCenterText()
this->mFont.DrawString(posX, posY, this->mCenterText.c_str(), theR, theG, theB);
}
}
// :tankefugl
// :
// tankefugl: 0000992
// : 0000992
void AvHHud::SetDisplayOrder(int inOrderType, int inOrderIndex, string inText1, string inText2, string inText3)
{
this->mDisplayOrderTime = this->mTimeOfLastUpdate;
@ -1227,9 +1232,9 @@ void AvHHud::DrawDisplayOrder()
// this->DrawHudString(mTextX1, mIconY1 + theStringHeight * 2, ScreenWidth(), this->mDisplayOrderText3.c_str(), r, g, b);
}
}
// :tankefugl
// :
// tankefugl: 0000971
// : 0000971
void AvHHud::GetOrderDirection(vec3_t inTarget, int inOrderType)
{
if (this->mDisplayOrderType == inOrderType)
@ -1326,7 +1331,7 @@ void AvHHud::DrawTeammateOrders()
}
// :tankefugl
// :
void AvHHud::DrawOrders()
{
@ -1353,7 +1358,7 @@ void AvHHud::DrawOrders()
cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(theTargetIndex);
if(theEntity)
{
//voogru: dont follow if they are cloaked, leave the waypoint active so they have a clue where they may be at, the wp should snap back to the baddy
//: dont follow if they are cloaked, leave the waypoint active so they have a clue where they may be at, the wp should snap back to the baddy
//once they are spotted again.
if(theEntity->curstate.rendermode != kRenderTransTexture && theEntity->curstate.renderamt > 128)
@ -2398,15 +2403,19 @@ void AvHHud::DrawPendingRequests()
}
// tankefugl: 0000988
// : 0000988
void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
// :tankefugl
// :
{
if ( this->GetHUDPlayMode() == PLAYMODE_READYROOM )
return;
// Get entity
int theUser3 = 0;
int theUser4 = 0;
float theFuser1 = 0.0f;
int theEntityTeam = 0;
bool theIsOnOurTeam=false;
vec3_t theOrigin;
vec3_t theMins;
vec3_t theMaxs;
@ -2414,14 +2423,17 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
float theHealthPercentage = 0.0f;
double theDistanceToEntity = 0;
cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(inEntityIndex);
bool theEntityIsPlayer = ((inEntityIndex > 0) && (inEntityIndex <= gEngfuncs.GetMaxClients()));
if(theEntity)
{
theUser3 = theEntity->curstate.iuser3;
theUser4 = theEntity->curstate.iuser4;
theFuser1 = theEntity->curstate.fuser1;
theEntityTeam = theEntity->curstate.team;
theIsOnOurTeam = (theEntityTeam == (int)this->GetHUDTeam());
//theOrigin = theEntity->curstate.origin;
theOrigin = AvHSHUGetRealLocation(theEntity->origin, theEntity->curstate.mins, theEntity->curstate.maxs);
if(theEntity->player)
@ -2435,8 +2447,24 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
theMins = theEntity->curstate.mins;
theMaxs = theEntity->curstate.maxs;
theHealthPercentage = theEntity->curstate.fuser2/kNormalizationNetworkFactor;
// : 991 transmit armour and health for marines
if ( GetIsMarine() && theEntityIsPlayer && theIsOnOurTeam ) {
int tmpPercent=theEntity->curstate.fuser2;
if ( GetInTopDownMode() ) {
theHealthPercentage = (float)(tmpPercent&0x7F)/100;
}
else {
theHealthPercentage = (float)(tmpPercent >> 7)/100;
}
}
// :
theContinue = true;
// 991:
// Do not display health rings for enemy players unless we are commander
if ( !GetInTopDownMode() && theEntityIsPlayer && !theIsOnOurTeam ) {
theContinue=false;
}
}
// Get local player
@ -2444,8 +2472,6 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
bool theDrewBuildInProgress = false;
float theOversizeScalar = 1.0f;
bool theEntityIsPlayer = ((inEntityIndex > 0) && (inEntityIndex <= gEngfuncs.GetMaxClients()));
bool theIsOnOurTeam = (theEntityTeam == (int)this->GetHUDTeam());
if(AvHSHUGetDrawRingsForUser3((AvHUser3)theUser3, theOversizeScalar))
{
@ -2483,7 +2509,7 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
int theSpriteToUse = this->GetIsAlien() ? this->mAlienHealthSprite : this->mMarineHealthSprite;
bool theDrawAsRecyling = (GetHasUpgrade(theUser4, MASK_RECYCLING) && theIsOnOurTeam);
if((theIsBuilding && (GetHasUpgrade(theUser4, MASK_BUILDABLE))) || theDrawAsRecyling)
if((theIsOnOurTeam && theIsBuilding && (GetHasUpgrade(theUser4, MASK_BUILDABLE))) || theDrawAsRecyling)
{
theSpriteToUse = this->GetIsAlien() ? this->mAlienBuildSprite : this->mMarineBuildSprite;
theDrawHealth = false;
@ -2509,13 +2535,13 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
if ((theHealthPercentage < 1.0f) || theDrawAsRecyling)
{
theCurrentFrame = theNormalizedPercentage * (theNumFrames - 1);
// tankefugl: 0000893
// : 0000893
// quick hack to eliminate 1 red bar shown for dead players
if (theEntity->player)
theCurrentFrame = min(max(0, theCurrentFrame), theNumFrames - 1);
else
theCurrentFrame = min(max(1, theCurrentFrame), theNumFrames - 1);
// :tankefugl
// :
}
else
{
@ -2561,9 +2587,9 @@ void AvHHud::DrawHUDNumber(int inX, int inY, int inFlags, int inNumber)
void AvHHud::DrawSelectionAndBuildEffects()
{
// tankefugl: 0000988
// : 0000988
list<int> theSelectedList;
// :tankefugl
// :
// Draw build effects
for(SelectionListType::iterator theSelectIter = this->mSelectionEffects.begin(); theSelectIter != this->mSelectionEffects.end(); theSelectIter++)
@ -2571,22 +2597,23 @@ void AvHHud::DrawSelectionAndBuildEffects()
// Draw selection effect around the entity
int theEntIndex = theSelectIter->mEntIndex;
this->DrawBuildHealthEffectsForEntity(theEntIndex);
// tankefugl: 0000988
// : 0000988
theSelectedList.push_back(theEntIndex);
// :tankefugl
// :
}
bool theDrawBuildingEffect = false;
for(EntityListType::iterator theBuildingIter = this->mBuildingEffectsEntityList.begin(); theBuildingIter != this->mBuildingEffectsEntityList.end(); theBuildingIter++)
{
int theEntIndex = *theBuildingIter;
this->DrawBuildHealthEffectsForEntity(theEntIndex);
// tankefugl: 0000988
// : 0000988
theSelectedList.push_back(theEntIndex);
// :tankefugl
// :
}
// tankefugl: 0000988 & 0000991
// : 0000988 & 0000991
bool maintanceWeaponSelected = (this->mCurrentWeaponID == 18 || this->mCurrentWeaponID == 27);
bool isCommander = this->GetInTopDownMode();
if (isCommander || maintanceWeaponSelected) {
@ -2595,11 +2622,12 @@ void AvHHud::DrawSelectionAndBuildEffects()
gEngfuncs.pEventAPI->EV_SetSolidPlayers(-1);
int localPlayerIndex = gEngfuncs.GetLocalPlayer()->index;
int currentteam = gEngfuncs.GetLocalPlayer()->curstate.team;
int currentteam = this->GetHUDTeam();
int maxclients = gEngfuncs.GetMaxClients();
physent_t* theEntity = NULL;
int theNumEnts = pmove->numphysent;
physent_t* theEntity = NULL;
for (int i = 0; i < theNumEnts; i++)
{
theEntity = gEngfuncs.pEventAPI->EV_GetPhysent(i);
@ -2613,7 +2641,6 @@ void AvHHud::DrawSelectionAndBuildEffects()
{
bool theIsPlayer = ((theEntityIndex >= 1) && (theEntityIndex <= maxclients));
bool theSameTeam = (theEntity->team == currentteam );
if (isCommander && (theIsPlayer || theSameTeam))
{
this->DrawBuildHealthEffectsForEntity(theEntityIndex, 0.2);
@ -2631,13 +2658,12 @@ void AvHHud::DrawSelectionAndBuildEffects()
}
gEngfuncs.pEventAPI->EV_PopPMStates();
}
// :tankefugl
// :
}
void AvHHud::Render()
{
if (!IEngineStudio.IsHardware())
{
@ -2703,6 +2729,7 @@ void AvHHud::Render()
DrawWarpedOverlaySprite(mDigestingSprite, 4, 3, .02, .02, .3, .15);
}
RenderProgressBar(kProgressBarSprite);
}
else
{
@ -2741,6 +2768,8 @@ void AvHHud::Render()
{
RenderAlienUI();
}
RenderProgressBar(kProgressBarSprite);
}
}
@ -2752,42 +2781,58 @@ void AvHHud::Render()
void AvHHud::RenderCommonUI()
{
static bool speedMeasured=false;
if (!mSteamUIActive)
{
if (gHUD.GetServerVariableFloat("sv_cheats") != 0 && CVAR_GET_FLOAT("cl_showspeed") != 0)
{
if (gHUD.GetServerVariableFloat("sv_cheats") != 0 ) {
static int maxSpeed=0, maxGroundSpeed=0, maxClimb=0, maxDive=0;
if ( CVAR_GET_FLOAT("cl_showspeed") != 0) {
// Draw the speedometer.
// Draw the speedometer.
int theR, theG, theB;
this->GetPrimaryHudColor(theR, theG, theB, true, false);
int theR, theG, theB;
this->GetPrimaryHudColor(theR, theG, theB, true, false);
extern playermove_s* pmove;
extern playermove_s* pmove;
char buffer[1024];
char buffer[1024];
maxClimb=max(maxClimb, (int)pmove->velocity[2]);
maxDive=min(maxDive, (int)pmove->velocity[2]);
sprintf(buffer, "Speed = %d", (int)Length(pmove->velocity));
mFont.DrawString(10, 10, buffer, theR, theG, theB);
int speed=(int)Length(pmove->velocity);
float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]);
maxSpeed=max(speed, maxSpeed);
sprintf(buffer, "Speed = %d (%d) %d/%d", speed, maxSpeed, maxClimb, maxDive);
mFont.DrawString(10, 10, buffer, theR, theG, theB);
sprintf(buffer, "Ground speed = %d", (int)theGroundSpeed);
mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB);
}
float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]);
maxGroundSpeed=max(theGroundSpeed, maxGroundSpeed);
sprintf(buffer, "Ground speed = %d (%d)", (int)theGroundSpeed, maxGroundSpeed);
mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB);
speedMeasured = true;
}
else if ( speedMeasured == true ) {
char msg[256];
sprintf(msg, "Current Speed(%d)\tCurrent Ground Speed(%d) Max Speed(%d)\t Max Ground Speed (%d)\tMax Climb (%d)\tMax Dive(%d)\n",
(int)Length(pmove->velocity), (int)sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]),
maxSpeed, maxGroundSpeed, maxClimb, maxDive);
ConsolePrint(msg);
maxSpeed=0, maxGroundSpeed=0, maxClimb=0, maxDive=0;
speedMeasured = false;
}
}
DrawInfoLocationText();
DrawHUDStructureNotification();
this->DrawOrders();
this->DrawHelpIcons();
// tankefugl: 0000971
// : 0000971
this->DrawTeammateOrders();
// tankefugl: 0000992
// : 0000992
this->DrawDisplayOrder();
// :tankefugl
// :
if (this->GetIsCombatMode())
{
@ -2999,8 +3044,7 @@ void AvHHud::RenderCommonUI()
}
// Draw the combat HUD.
if (this->GetIsCombatMode())
if (this->GetIsCombatMode())
{
// Now draw our current experience level, so people know how close they are to the next level
// Load alien resource and energy sprites
@ -3052,12 +3096,55 @@ void AvHHud::RenderCommonUI()
}
void AvHHud::RenderProgressBar(char *spriteName)
{
// Draw the progress bars
const float progressBarStayTime = 0.2f;
if (this->mProgressBarLastDrawn + progressBarStayTime > this->GetTimeOfLastUpdate())
{
HSPRITE currentSprite=0;
if ( spriteName && ( strcmp(spriteName, kExperienceBarSprite) == 0 ) ) {
currentSprite=this->mExperienceBarSprite;
}
if ( spriteName && ( strcmp(spriteName, kProgressBarSprite) == 0 ) ) {
currentSprite=this->mProgressBarSprite;
}
if (currentSprite)
{
const float kNormalizedWidth = .1f;
const float kNormalizedYInset = .89f;
const float kNormalizedHeight = .025f;
// Draw full background
const int kXStart = mViewport[0] + (.5f - kNormalizedWidth/2.0f)*(mViewport[2] - mViewport[0]);
const int kYStart = mViewport[1] + mViewport[3] - (1 - kNormalizedYInset)*ScreenHeight();
AvHSpriteSetColor(1,1,1);
AvHSpriteSetRenderMode(kRenderTransAlpha);
AvHSpriteDraw(currentSprite, this->mProgressBarDrawframe + 1, kXStart, kYStart, kXStart + kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, 1, 1);
// Draw overlay showing progress
float theProgress = this->mProgressBarStatus;
if((theProgress >= 0.0f) && (theProgress <= 1.0f))
{
AvHSpriteDraw(currentSprite, this->mProgressBarDrawframe, kXStart, kYStart, kXStart + theProgress*kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, theProgress, 1.0f);
}
}
}
}
void AvHHud::RenderMiniMap(int inX, int inY, int inWidth, int inHeight)
{
AvHOverviewMap& theOverviewMap = gHUD.GetOverviewMap();
AvHOverviewMap::DrawInfo theDrawInfo;
float hudMinimap=CVAR_GET_FLOAT(kvHudMapZoom);
hudMinimap=min(3, max(1, hudMinimap));
float zoomScale=(3.0f-hudMinimap);
AvHOverviewMap::DrawInfo theDrawInfo;
theDrawInfo.mX = inX;
theDrawInfo.mY = inY;
@ -3065,9 +3152,12 @@ void AvHHud::RenderMiniMap(int inX, int inY, int inWidth, int inHeight)
theDrawInfo.mHeight = inHeight;
theDrawInfo.mFullScreen = false;
float worldViewWidth = 800.0f;
float worldViewWidth = 800 + 400.0f*zoomScale;
float aspectRatio = (float)(theDrawInfo.mHeight) / theDrawInfo.mWidth;
theDrawInfo.mZoomScale = 1-(0.25f * zoomScale );
float aspectRatio = (float)(theDrawInfo.mHeight) / theDrawInfo.mWidth;
float thePlayerX;
float thePlayerY;
@ -3100,18 +3190,27 @@ void AvHHud::RenderMarineUI()
AvHSpriteSetRenderMode(kRenderTransAdd);
AvHSpriteSetColor(1,1,1);
AvHSpriteDrawTiles(mMarineTopSprite, 3, 1, mViewport[2] - theWidth + mViewport[0],
mViewport[1], mViewport[2] + mViewport[0], mViewport[1] + theHeight, 0, 0, 1, 1);
int hudMinimap=CVAR_GET_FLOAT(kvHudMapZoom);
for ( int i=0; i<3; i++ ) {
float width=theWidth/3.0f;
int frame=i;
if ( hudMinimap == 0 && i == 2 ) frame=i+1;
AvHSpriteDraw(mMarineTopSprite, frame, mViewport[2] - width*(3-i) + mViewport[0],
mViewport[1], mViewport[2] - width*(2-i) + mViewport[0], mViewport[1] + theHeight, 0, 0, 1, 1);
}
// Draw the minimap.
if ( hudMinimap > 0 ) {
int theMiniMapX = mViewport[2] - 0.21f * ScreenWidth() + mViewport[0];
int theMiniMapY = mViewport[1] + 0.013 * ScreenHeight();
int theMiniMapWidth = 0.200 * ScreenWidth();
int theMiniMapHeight = 0.202 * ScreenHeight();
int theMiniMapX = mViewport[2] - 0.21f * ScreenWidth() + mViewport[0];
int theMiniMapY = mViewport[1] + 0.013 * ScreenHeight();
int theMiniMapWidth = 0.200 * ScreenWidth();
int theMiniMapHeight = 0.202 * ScreenHeight();
RenderMiniMap(theMiniMapX, theMiniMapY, theMiniMapWidth, theMiniMapHeight);
RenderMiniMap(theMiniMapX, theMiniMapY, theMiniMapWidth, theMiniMapHeight);
}
// Draw the resource label.
theHeight = ScreenHeight() * 0.038;
@ -3294,12 +3393,42 @@ void AvHHud::RenderMarineUI()
AvHSpriteSetRenderMode(kRenderTransAdd);
AvHSpriteEnableClippingRect(false);
AvHSpriteSetColor(1, 1, 1, this->GetGammaSlope());
AvHSpriteSetColor(1, 1, 1);
AvHSpriteDraw(mMarineUpgradesSprite, 0, x1, y1, x2, y2, theStartU, theStartV, theEndU, theEndV);
}
}
bool frames[3] = { false, false, false};
if ( this->mHasGrenades ) frames[0]=true;
if ( this->mHasMines ) frames[1]=true;
if ( this->mHasWelder ) frames[2]=true;
for(int i = 0; i < 3; i++)
{
int theFrame=i+9;
if ( frames[i] == true ) {
const int kIconWidth = .05*ScreenWidth();
const int kIconHeight = .05*ScreenHeight();
const int kBaseX = ScreenWidth() - .05*ScreenWidth();
const int kBaseY = .75*ScreenHeight();
float theStartU = (theFrame % 4)*.25f;
float theStartV = (theFrame / 4)*.333f;
float theEndU = theStartU + .25f;
float theEndV = theStartV + .333f;
float x1 = kBaseX;
float y1 = kBaseY - (i+1)*kIconHeight;
float x2 = x1 + kIconWidth;
float y2 = y1 + kIconHeight;
AvHSpriteSetRenderMode(kRenderTransAdd);
AvHSpriteEnableClippingRect(false);
AvHSpriteSetColor(1, 1, 1);
AvHSpriteDraw(mMarineUpgradesSprite, theFrame, x1, y1, x2, y2, theStartU, theStartV, theEndU, theEndV);
}
}
}
void AvHHud::RenderCommanderUI()
@ -3541,7 +3670,7 @@ void AvHHud::RenderStructureRanges()
float theMaxRadius2 = max(max(theMinSize.x, theMaxSize.x), max(theMinSize.y, theMaxSize.y));
int theSprite = this->mBuildCircleSprite;
// joev: 0000291
// : 0000291
// It's possible to place "on" marines if you're offset a little from center. This code and
// associated changes above and in AvHSharedUtil.cpp is to enforce a build distance around marines,
// in the same way as structures, to prevent this exploit.
@ -3553,7 +3682,7 @@ void AvHHud::RenderStructureRanges()
{
theMinMarineBuildDistance = BALANCE_VAR(kMinMarineBuildDistance);
}
// :joev
// :
RenderStructureRange(thePosition, theMinMarineBuildDistance + theMaxRadius2, theSprite, kRenderTransAdd, 0, 1, 0, 0, 0.3f);
}
@ -3627,13 +3756,13 @@ void AvHHud::RenderAlienUI()
const float kTextInset = kResourceEnergyBarWidth*.5f;
const int kNumericYOffset = 1.5*this->GetHudStringHeight();
// tankefugl: 0000989
// : 0000989
// moved resource label a bit down
//int theResourceLabelX = mViewport[0] + kTextInset*ScreenWidth();
//int theResourceLabelY = theY - + .05f * ScreenHeight();
int theResourceLabelX = 10;
int theResourceLabelY = .68f * ScreenHeight();
// :tankefugl
// :
if(this->mMapMode == MAP_MODE_NS)
{
@ -3667,6 +3796,35 @@ void AvHHud::RenderAlienUI()
AvHSpriteDraw(mAlienUIEnergySprite, 0, theX, theY, theX + theWidth, theY + theHeight * theFactor, 0, 0, 1, theFactor);
AvHSpriteDraw(mAlienUIEnergySprite, 1, theX, theY + theHeight * theFactor, theX + theWidth, theY + theHeight, 0, theFactor, 1, 1);
}
if (mAlienUICloakSprite )
{
cl_entity_s* theLocalPlayer = GetVisiblePlayer();
if(theLocalPlayer ) {
theX = mViewport[2] - theWidth + mViewport[0];
int amount=0;
int range=255-kAlienSelfCloakingBaseOpacity;
if ( theLocalPlayer->curstate.renderamt > 0 ) {
amount=theLocalPlayer->curstate.renderamt-kAlienSelfCloakingBaseOpacity;
amount=max(0, min(range, amount));
}
float theFactor = 1;
if ( theLocalPlayer->curstate.rendermode == kRenderTransTexture )
theFactor=(float)amount/(float)range;
AvHSpriteSetColor(1,1,1);
AvHSpriteSetRenderMode(kRenderTransTexture);
AvHSpriteDraw(mAlienUICloakSprite, 0, theX, theY, theX + theWidth, theY + theHeight * theFactor, 0, 0, 1, theFactor);
AvHSpriteDraw(mAlienUICloakSprite, 1, theX, theY + theHeight * theFactor, theX + theWidth, theY + theHeight, 0, theFactor, 1, 1);
// }
// else {
// int a=0;
// }
}
}
// Draw hive indicators.
@ -3785,7 +3943,7 @@ void AvHHud::RenderAlienUI()
const int kVerticalUpgradeSpacing = kNormalizedSpacing*kAspectRatio*ScreenHeight();
int theUpgradeVar = this->GetHUDUpgrades();
const int kUpgradeFrame = 0;
const float kUpgradeSize = 0.05;
const float kUpgradeSize = 0.04;
int theUpgradeWidth = kUpgradeSize*ScreenWidth();
int theUpgradeHeight = kUpgradeSize*kAspectRatio*ScreenHeight();
@ -3819,7 +3977,7 @@ void AvHHud::RenderAlienUI()
theNumDrawnInCategory[theCategory]++;
int theLevelOfUpgrade = AvHGetAlienUpgradeLevel(theUpgradeVar, theUpgradeMask);
for(int theLevel = 0; theLevel < theLevelOfUpgrade; theLevel++)
for(int theLevel = theLevelOfUpgrade; theLevel > 0; theLevel--)
{
// Draw them slightly overlapping
const float kOffset = .01f;
@ -3844,14 +4002,29 @@ void AvHHud::RenderAlienUI()
int theSecondOfLastUpdate = (int)this->mTimeOfLastUpdate;
if(theSecondOfLastUpdate % 2)
{
int theFrame = theCategory-1;
int numSprites=1;
switch ( theCategory ) {
case ALIEN_UPGRADE_CATEGORY_DEFENSE:
numSprites=this->mNumDefense;
break;
case ALIEN_UPGRADE_CATEGORY_SENSORY:
numSprites=this->mNumSensory;
break;
case ALIEN_UPGRADE_CATEGORY_MOVEMENT:
numSprites=this->mNumMovement;
break;
}
for ( int j = numSprites; j > 0; j-- ) {
const float kOffset = .01f;
int theFrame = theCategory-1;
float x1 = theX;
float y1 = theY;
float x2 = x1 + theUpgradeWidth;
float y2 = y1 + theUpgradeHeight;
float x1 = theX - j*(kOffset*ScreenWidth());
float y1 = theY - j*(kOffset*ScreenHeight());
float x2 = x1 + theUpgradeWidth;
float y2 = y1 + theUpgradeHeight;
AvHSpriteDraw(mAlienUIUpgradeCategories, theFrame, x1, y1, x2, y2, 0, 0, 1, 1);
AvHSpriteDraw(mAlienUIUpgradeCategories, theFrame, x1, y1, x2, y2, 0, 0, 1, 1);
}
}
break;
}
@ -3941,17 +4114,26 @@ void AvHHud::RenderAlienUI()
if(AvHCUWorldToScreen(theMessageWorldPos, (float*)&theScreenPos))
{
if((theBlipName != "") && (theBlipStatusText != "") && (theLocationName != ""))
if((theBlipName != "") && (theBlipStatusText != "") && (theLocationName != "") && (CVAR_GET_FLOAT(kvLabelHivesight) == 1))
{
// Find alpha for the blip-text based on position on the screen
float screenWidth = ScreenWidth();
float screenHeight = ScreenHeight();
float xdiff = fabs(theScreenPos[0] - screenWidth/2);
float ydiff = fabs(theScreenPos[1] - screenHeight/2);
float quadrance = xdiff * xdiff + ydiff * ydiff;
float alpha = max(0.0f, 0.9f - quadrance / (screenHeight * screenHeight));
alpha *= alpha * alpha * alpha;
// "MonsieurEvil is under attack"
// "Resource tower is under attack"
char theFirstLine[512];
sprintf(theFirstLine, "%s %s\n", theBlipName.c_str(), theBlipStatusText.c_str());
this->DrawTranslatedString(theScreenPos[0], theScreenPos[1], theFirstLine, true, true);
this->DrawTranslatedString(theScreenPos[0], theScreenPos[1], theFirstLine, true, true, false, alpha);
char theLocationNameCStr[512];
strcpy(theLocationNameCStr, theLocationName.c_str());
this->DrawTranslatedString(theScreenPos[0], theScreenPos[1] + .022f*ScreenHeight(), theLocationNameCStr, true, true, true);
this->DrawTranslatedString(theScreenPos[0], theScreenPos[1] + .022f*ScreenHeight(), theLocationNameCStr, true, true, true, alpha);
}
}
@ -4159,6 +4341,11 @@ void AvHHud::RenderNoZBuffering()
}
void AvHHud::InitHUDData( void )
{
this->ResetGame(true);
}
void AvHHud::VidInit(void)
{
UIHud::VidInit();
@ -4199,6 +4386,8 @@ void AvHHud::VidInit(void)
// Load alien energy sprite
theSpriteName = UINameToSprite(kAlienEnergySprite, theScreenWidth);
this->mAlienUIEnergySprite = Safe_SPR_Load(theSpriteName.c_str());
theSpriteName = UINameToSprite(kAlienCloakSprite, theScreenWidth);
this->mAlienUICloakSprite = Safe_SPR_Load(theSpriteName.c_str());
// Load background for topdown mode
this->mBackgroundSprite = Safe_SPR_Load(kTopDownBGSprite);
@ -4232,7 +4421,6 @@ void AvHHud::VidInit(void)
this->mAlienCursor = Safe_SPR_Load(kAlienCursorSprite);
this->mMarineOrderIndicator = Safe_SPR_Load(kMarineOrderSprite);
this->mMarineUpgradesSprite = Safe_SPR_Load(kMarineUpgradesSprite);
//this->mMappingTechSprite = Safe_SPR_Load("sprites/ns.spr");
this->mAlienBuildSprite = Safe_SPR_Load(kAlienBuildSprite);
@ -4250,9 +4438,12 @@ void AvHHud::VidInit(void)
string theIconName = string(kHelpIconPrefix) + ".spr";
this->mHelpSprite = Safe_SPR_Load(theIconName.c_str());
// tankefugl: 0000971
// : 0000971
this->mTeammateOrderSprite = Safe_SPR_Load(kTeammateOrderSprite);
// :tankefugl
// :
this->mExperienceBarSprite = Safe_SPR_Load(kExperienceBarSprite);
this->mProgressBarSprite = Safe_SPR_Load(kProgressBarSprite);
this->mEnemyBlips.VidInit();
this->mFriendlyBlips.VidInit();

View file

@ -90,9 +90,7 @@ float AvHKnife::GetDeployTime() const
char* AvHKnife::GetDeploySound() const
{
//return kKNDeploySound;
return NULL;
return kKNDeploySound;
}
char* AvHKnife::GetHeavyViewModel() const
@ -157,8 +155,6 @@ void AvHKnife::FireProjectiles(void)
// Do trace hull here
float theDamage = this->mDamage;
CBaseEntity* pHurt = this->m_pPlayer->CheckTraceHullAttack(kKNRange, theDamage, DMG_SLASH);
if(pHurt)
{
char* theSoundToPlay = NULL;
@ -189,7 +185,6 @@ void AvHKnife::FireProjectiles(void)
}
}
#endif
}

View file

@ -581,7 +581,7 @@ BOOL AvHHealth::GiveHealth(CBaseEntity* inOther, float points)
{
BOOL theSuccess = FALSE;
// puzl: 1017
// : 1017
// Amount of health to give is now a paramater to allow us to vary the resupply amount for the armoury
// float thePointsPerHealth = BALANCE_VAR(kPointsPerHealth)
@ -597,7 +597,7 @@ BOOL AvHHealth::GiveHealth(CBaseEntity* inOther, float points)
thePlayer->pev->health += thePointsGiven;
if(CVAR_GET_FLOAT(kvDrawDamage))
if(ns_cvar_float(&avh_drawdamage))
{
thePlayer->PlaybackNumericalEvent(kNumericalInfoHealthEvent, thePointsGiven);
}
@ -617,7 +617,7 @@ BOOL AvHHealth::GiveHealth(CBaseEntity* inOther, float points)
void AvHHealth::Touch(CBaseEntity* inOther)
{
// puzl: 1017 medpack health amount
// : 1017 medpack health amount
if(AvHHealth::GiveHealth(inOther, BALANCE_VAR(kPointsPerHealth)))
{
UTIL_Remove(this);
@ -720,7 +720,7 @@ void AvHHeavyArmor::Touch(CBaseEntity* inOther)
if(thePlayer->GetIsMarine())
{
// Check to make sure they don't have heavy armor or jetpack already
if((!thePlayer->GetHasJetpack() || GetGameRules()->GetIsCombatMode()) && !thePlayer->GetHasHeavyArmor())//voogru: ignore in combat mode since were trying to touch it.
if((!thePlayer->GetHasJetpack() || GetGameRules()->GetIsCombatMode()) && !thePlayer->GetHasHeavyArmor())//: ignore in combat mode since were trying to touch it.
{
// Needed because view model changes
if(thePlayer->HolsterWeaponToUse())
@ -773,7 +773,7 @@ void AvHJetpack::Touch(CBaseEntity* inOther)
if(thePlayer->GetIsMarine())
{
// Check to make sure they don't have heavy armor or jetpack already
if((!thePlayer->GetHasHeavyArmor() || GetGameRules()->GetIsCombatMode()) && !thePlayer->GetHasJetpack())//voogru: ignore in combat mode since were trying to touch it.
if((!thePlayer->GetHasHeavyArmor() || GetGameRules()->GetIsCombatMode()) && !thePlayer->GetHasJetpack())//: ignore in combat mode since were trying to touch it.
{
if(thePlayer->HolsterWeaponToUse())
{
@ -1281,7 +1281,8 @@ void AvHPhaseGate::TeleportUse(CBaseEntity *pActivator, CBaseEntity *pCaller, US
this->SetTimeOfLastDeparture(gpGlobals->time);
AvHSUPlayPhaseInEffect(theFlags, this, thePlayer);
AvHSUKillPlayersTouchingPlayer(thePlayer, this->pev);
// AvHSUKillPlayersTouchingPlayer(thePlayer, this->pev);
AvHSUPushbackPlayersTouchingPlayer(thePlayer, this->pev);
KillBuildablesTouchingPlayer(thePlayer, this->pev);
Vector theFadeColor;
@ -1527,8 +1528,14 @@ void AvHMarineBaseBuildable::SetEnergy(float inEnergy)
this->mEnergy = max(min(inEnergy, kMarineStructureMaxEnergy), 0.0f);
float theNormValue = this->mEnergy/kMarineStructureMaxEnergy;
bool theIsResearching=false;
if(this->pev && this->GetIsBuilt())
const AvHTeam* theTeam = GetGameRules()->GetTeam(AvHTeamNumber(this->GetTeamNumber()));
if ( theTeam ) {
theIsResearching=theTeam->GetResearchManager().GetIsResearching(this->entindex());
}
if(this->pev && this->GetIsBuilt() && (!theIsResearching))
{
AvHSHUSetEnergyState(this->pev->iuser3, this->pev->fuser1, theNormValue);
}
@ -1813,7 +1820,8 @@ void AvHInfantryPortal::ResetReinforcingPlayer(bool inSuccess)
if(theTelefrag)
{
AvHSUKillPlayersTouchingPlayer(thePlayer, this->pev);
//AvHSUKillPlayersTouchingPlayer(thePlayer, this->pev);
AvHSUPushbackPlayersTouchingPlayer(thePlayer, this->pev);
}
}
@ -1847,17 +1855,17 @@ int AvHInfantryPortal::GetIdle2Animation() const
return 2;
}
// tankefugl:
int AvHInfantryPortal::GetDeployAnimation() const
{
return 0;
}
// : Uncomment for the new IP from Alpha
//int AvHInfantryPortal::GetDeployAnimation() const
//{
// return 0;
//}
int AvHInfantryPortal::GetSpawnAnimation() const
{
return 1;
}
// :tankefugl
//int AvHInfantryPortal::GetSpawnAnimation() const
//{
// return 1;
//}
// :
const int kCommandStationExitAnimation = 12;
@ -2328,7 +2336,7 @@ void AvHArmory::ResupplyUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE
{
if(thePlayer->GetCanBeResupplied())
{
// puzl: 1017
// : 1017
// // Give health back occasionally
// bool theGiveHealthIfNeeded = (RANDOM_LONG(0, 3) == 0);
//

View file

@ -126,7 +126,7 @@ private:
class AvHHealth : public AvHPlayerEquipment
{
public:
// puzl: 1017 GiveHealth now takes the amount as a paramater.
// : 1017 GiveHealth now takes the amount as a paramater.
static BOOL GiveHealth(CBaseEntity* inOther, float points);
void Precache( void );
@ -310,8 +310,8 @@ public:
virtual int GetIdle1Animation() const;
virtual int GetIdle2Animation() const;
virtual int GetDeployAnimation() const;
virtual int GetSpawnAnimation() const;
// virtual int GetDeployAnimation() const;
// virtual int GetSpawnAnimation() const;
protected:

View file

@ -208,7 +208,7 @@ void AvHReloadableMarineWeapon::Reload(void)
void AvHReloadableMarineWeapon::WeaponIdle(void)
{
// tankefugl: 0000484 - ensures that all idle weapons can fire the empty sound
// : 0000484 - ensures that all idle weapons can fire the empty sound
ResetEmptySound();
if(this->m_flTimeWeaponIdle < UTIL_WeaponTimeBase())

View file

@ -152,7 +152,7 @@ const int kHGBarrelLength = 10;
#define kHGSpread VECTOR_CONE_1DEGREES
// Sonic/Shot gun constants.
const int kSGRange = 8192;
const int kSGRange = 700;
const float kSGXPunch = .8f;
#define kSGEjectModel "models/shotshell.mdl"
#define kSGEventName "events/SonicGun.sc"
@ -169,7 +169,8 @@ const float kSGXPunch = .8f;
#define kSGDeploySound "weapons/sg-deploy.wav"
const int kSGBarrelLength = 25;
#define kSGSpread VECTOR_CONE_20DEGREES
#define kSGInnerSpread VECTOR_CONE_7DEGREES
#define kSGMidSpread VECTOR_CONE_8DEGREES
#define kSGInnerSpread VECTOR_CONE_3DEGREES
// Heavy machine gun
const int kHMGRange = 6000;

View file

@ -78,6 +78,8 @@ void AvHMine::DeductCostForShot(void)
//if(this->m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
if(!this->m_iClip)
{
if ( this->m_pPlayer )
this->m_pPlayer->EffectivePlayerClassChanged();
// no more mines!
RetireWeapon();
}
@ -202,7 +204,7 @@ bool AvHMine::GetDropLocation(Vector& outLocation, Vector* outAngles) const
{
CBaseEntity* theEntity = CBaseEntity::Instance( tr.pHit );
// puzl: 981
// : 981
// Mines can't be planted on players or buildings
if (!dynamic_cast<AvHDeployedMine*>(theEntity) && !dynamic_cast<AvHPlayer *>(theEntity) && !dynamic_cast<AvHBaseBuildable *>(theEntity))
{
@ -225,7 +227,7 @@ bool AvHMine::GetDropLocation(Vector& outLocation, Vector* outAngles) const
theSuccess = true;
for(BaseEntityListType::iterator theIter = theEntityList.begin(); theIter != theEntityList.end(); theIter++)
{
// puzl: 225 make sure there are no mines within kMineSearchRadius of each other ( 15 units )
// : 225 make sure there are no mines within kMineSearchRadius of each other ( 15 units )
CBaseEntity* theCurrentEntity = *theIter;
if(!theCurrentEntity || (theCurrentEntity->pev->flags & FL_CONVEYOR) || AvHSUGetIsExternalClassName(STRING(theCurrentEntity->pev->classname)) || dynamic_cast<CBaseDoor*>(theCurrentEntity) || dynamic_cast<CRotDoor*>(theCurrentEntity)
|| dynamic_cast<AvHDeployedMine*>(theCurrentEntity) )

View file

@ -222,14 +222,24 @@ string AvHMiniMap::GetSpriteNameFromMap(int inSpriteWidth, const string& inMapNa
{
char theWidthString[128];
sprintf(theWidthString, "%d", inSpriteWidth);
// puzl: 1064
// : 1064
// insert _labelled into the filename before ".spr"
string extraname="";
if ( useLabels == 1 ) {
extraname="_labelled";
switch ( useLabels ) {
case 1:
extraname="_1";
break;
case 2:
extraname="_2";
break;
case 3:
extraname="_3";
break;
default:
break;
}
string theMiniMapName = kMiniMapSpritesDirectory + string("/") /*+ string(theWidthString)*/ + inMapName + extraname + string(".spr");
// :puzl
// :
return theMiniMapName;
}
@ -330,10 +340,10 @@ bool AvHMiniMap::WriteMapToSprite()
if(this->GetIsProcessing())
{
// Open file
// puzl: 1064
// : 1064
// We always want to use the normal filename when generating a minimap
string theSpriteFileName = string(getModDirectory()) + string("/") + GetSpriteNameFromMap(0, this->mMapName, 0);
// :puzl
// :
FILE* theFile = fopen(theSpriteFileName.c_str(), "wb");
if(theFile)
{
@ -435,14 +445,6 @@ bool AvHMiniMap::WriteSpritesIfJustFinished()
{
bool theSuccess = false;
// test
char test[255];
sprintf(test, "this->GetIsProcessing() = %d, this->mNumSamplesProcessed = %d, this->mNumSamplesToProcess = %d\n", this->GetIsProcessing(), this->mNumSamplesProcessed, this->mNumSamplesToProcess);
gEngfuncs.pfnConsolePrint(test);
// :test
if(this->GetIsProcessing() && (this->mNumSamplesProcessed == this->mNumSamplesToProcess))
{
this->mIsProcessing = false;

View file

@ -29,7 +29,7 @@ public:
#endif
#ifdef AVH_CLIENT
// puzl: 1064
// : 1064
// Allow the caller to specify the use of the labelled minimap
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels);
int ReceiveFromNetworkStream(void* const buffer, const int size);

View file

@ -240,7 +240,8 @@ bool AvHMUGetEnergyCost(AvHWeaponID inWeaponID, float& outEnergyCost)
theCost = (float)BALANCE_VAR(kLeapEnergyCost);
break;
case AVH_ABILITY_CHARGE:
theCost = (float)BALANCE_VAR(kChargeEnergyCost);
// Charge cost deducted in pm_shared now
theCost = 0.0f; // (float)BALANCE_VAR(kChargeEnergyCost);
break;
}
@ -285,12 +286,20 @@ float AvHMUGetWalkSpeedFactor(AvHUser3 inUser3)
return theMoveSpeed;
}
bool AvHMUHasEnoughAlienEnergy(float& ioFuser, float inNormAmount)
// : 991 -- added latency-based prediction for the ammount of energy available to the alien
bool AvHMUHasEnoughAlienEnergy(float& ioFuser, float inNormAmount, float latency)
{
bool theSuccess = false;
float theCurrentEnergy = ioFuser/kNormalizationNetworkFactor;
if(theCurrentEnergy >= inNormAmount)
float thePredictedByLatency = 0.0f;
#ifdef AVH_CLIENT
float theAlienEnergyRate = (float)BALANCE_VAR(kAlienEnergyRate);
float theUpgradeFactor = 1.0f;
thePredictedByLatency = (latency / 1000) * theAlienEnergyRate * theUpgradeFactor;
#endif
if((theCurrentEnergy + thePredictedByLatency) >= inNormAmount)
{
theSuccess = true;
}

View file

@ -35,7 +35,7 @@ bool AvHMUGiveAlienEnergy(float& ioFuser, float inNormAmount);
bool AvHMUGetEnergyCost(AvHWeaponID inWeaponID, float& outEnergyCost);
float AvHMUGetWalkSpeedFactor(AvHUser3 inUser3);
bool AvHMUHasEnoughAlienEnergy(float& ioFuser, float inNormAmount);
bool AvHMUHasEnoughAlienEnergy(float& ioFuser, float inNormAmount, float latency = 0.0f);
void AvHMUUpdateAlienEnergy(float inTimePassed, int inUser3, int inUser4, float& ioFuser);
void AvHMUUpdateJetpackEnergy(bool inIsJetpacking, float theTimePassed, float& ioJetpackEnergy);

View file

@ -21,10 +21,10 @@ int g_msgAmmoPickup = 0, g_msgAmmoX, g_msgBattery, g_msgCurWeapon, g_msgDamage,
g_msgTrain, g_msgWeaponList, g_msgWeapPickup, g_msgAlienInfo, g_msgBalanceVar,
g_msgBlipList, g_msgBuildMiniMap, g_msgClientScripts, g_msgDebugCSP, g_msgEditPS,
g_msgFog, g_msgGameStatus, g_msgListPS, g_msgPlayHUDNotification, g_msgProgressBar,
g_msgServerVar, g_msgSetGammaRamp, g_msgSetOrder, g_msgSetParticleTemplates,
g_msgServerVar, g_msgSetGammaRamp, g_msgSetOrder, g_msgSetParticleTemplates,g_msgDelParts,
g_msgSetSelect, g_msgSetRequest, g_msgSetSoundNames, g_msgSetTechNodes, g_msgSetTechSlots,
g_msgSetTopDown, g_msgSetupMap, g_msgUpdateCountdown, g_msgUpdateEntityHierarchy,
g_msgProfileInfo, g_msgNexusBytes, g_msgIssueOrder, g_msgLUAMessage;
g_msgSetTopDown, g_msgSetupMap, g_msgUpdateCountdown, g_msgUpdateEntityHierarchy, g_msgDelEntityHierarchy,
g_msgProfileInfo, g_msgNexusBytes, g_msgIssueOrder, g_msgHUDSetUpgrades;
void Net_InitializeMessages(void)
{
@ -47,6 +47,7 @@ void Net_InitializeMessages(void)
g_msgMOTD = REG_USER_MSG( "MOTD", -1 );
g_msgResetHUD = REG_USER_MSG( "ResetHUD", 0 );
g_msgSayText = REG_USER_MSG( "SayText", -1 );
// : 0001073
g_msgScoreInfo = REG_USER_MSG( "ScoreInfo", -1 );
g_msgServerName = REG_USER_MSG( "ServerName", -1 );
g_msgSetFOV = REG_USER_MSG( "SetFOV", 1 );
@ -73,11 +74,13 @@ void Net_InitializeMessages(void)
g_msgGameStatus = REG_USER_MSG( "GameStatus", -1 );
g_msgListPS = REG_USER_MSG( "ListPS", -1 );
g_msgPlayHUDNotification = REG_USER_MSG( "PlayHUDNot", 6 );
g_msgProgressBar = REG_USER_MSG( "Progress", 3 );
g_msgHUDSetUpgrades = REG_USER_MSG( "SetUpgrades", 1);
g_msgProgressBar = REG_USER_MSG( "Progress", -1 );
g_msgServerVar = REG_USER_MSG( "ServerVar", -1 );
g_msgSetGammaRamp = REG_USER_MSG( "SetGmma", 2 );
g_msgSetGammaRamp = REG_USER_MSG( "SetGmma", 1 );
g_msgSetOrder = REG_USER_MSG( "SetOrder", -1 );
g_msgSetParticleTemplates = REG_USER_MSG( "Particles", -1 );
g_msgDelParts = REG_USER_MSG( "DelParts", 0);
g_msgSetSelect = REG_USER_MSG( "SetSelect", -1 );
g_msgSetRequest = REG_USER_MSG( "SetRequest", 2 );
g_msgSetSoundNames = REG_USER_MSG( "SoundNames", -1 );
@ -87,10 +90,12 @@ void Net_InitializeMessages(void)
g_msgSetupMap = REG_USER_MSG( "SetupMap", -1 );
g_msgUpdateCountdown = REG_USER_MSG( "Countdown", 1 );
g_msgUpdateEntityHierarchy = REG_USER_MSG( "EntHier", -1 );
g_msgDelEntityHierarchy = REG_USER_MSG( "DelEntHier", 0);
g_msgProfileInfo = REG_USER_MSG( "ProfileInfo", 8 );
g_msgNexusBytes = REG_USER_MSG( "NexusBytes", -1 );
// : 0000971
g_msgIssueOrder = REG_USER_MSG( "IssueOrder", 9);
g_msgLUAMessage = REG_USER_MSG( "LUAmsg", -1);
// :
}
#endif
@ -474,7 +479,7 @@ void Net_InitializeMessages(void)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// puzl: 0001073
// : 0001073
#ifndef AVH_SERVER
void NetMsg_ScoreInfo( void* const buffer, const int size, ScoreInfo& info )
{
@ -483,9 +488,11 @@ void Net_InitializeMessages(void)
info.score = READ_SHORT();
info.frags = READ_SHORT();
info.deaths = READ_SHORT();
info.extra = READ_SHORT();
info.player_class = READ_BYTE();
info.auth = READ_SHORT();
info.team = READ_SHORT();
info.health = READ_SHORT();
char* theString = READ_STRING();
#ifdef USE_OLDAUTH
if(info.auth & PLAYERAUTH_CUSTOM)
@ -511,9 +518,26 @@ void Net_InitializeMessages(void)
WRITE_SHORT( info.score );
WRITE_SHORT( info.frags );
WRITE_SHORT( info.deaths );
WRITE_SHORT( info.extra );
WRITE_BYTE( info.player_class );
WRITE_SHORT( info.auth );
WRITE_SHORT( info.team );
WRITE_SHORT( info.health );
WRITE_STRING("0");
MESSAGE_END();
}
void NetMsgSpec_ScoreInfo( const ScoreInfo& info )
{
MESSAGE_BEGIN( MSG_SPEC, g_msgScoreInfo );
WRITE_BYTE( info.player_index );
WRITE_SHORT( info.score );
WRITE_SHORT( info.frags );
WRITE_SHORT( info.deaths );
WRITE_SHORT( info.extra );
WRITE_BYTE( info.player_class );
WRITE_SHORT( info.auth );
WRITE_SHORT( info.team );
WRITE_SHORT( info.health );
WRITE_STRING("0");
MESSAGE_END();
}
@ -727,30 +751,30 @@ void Net_InitializeMessages(void)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_TeamScore( void* const buffer, const int size, string& team_name, int& score, int& deaths )
void NetMsg_TeamScore( void* const buffer, const int size, string& team_name, int& score, int& reset )
{
BEGIN_READ( buffer, size );
team_name = READ_STRING();
score = READ_SHORT();
deaths = READ_SHORT();
reset = READ_SHORT();
END_READ();
}
#else
void NetMsg_TeamScore( entvars_t* const pev, const string& team_name, const int score, const int deaths )
void NetMsg_TeamScore( entvars_t* const pev, const string& team_name, const int score, const int reset )
{
MESSAGE_BEGIN( MSG_ONE, g_msgTeamScore, NULL, pev );
WRITE_STRING( team_name.c_str() );
WRITE_SHORT( score );
WRITE_SHORT( deaths );
WRITE_SHORT( reset );
MESSAGE_END();
}
void NetMsg_TeamScore( const string& team_name, const int score, const int deaths )
void NetMsg_TeamScore( const string& team_name, const int score, const int reset )
{
MESSAGE_BEGIN( MSG_ALL, g_msgTeamScore );
WRITE_STRING( team_name.c_str() );
WRITE_SHORT( score );
WRITE_SHORT( deaths );
WRITE_SHORT( reset );
MESSAGE_END();
}
#endif
@ -976,7 +1000,10 @@ enum AlienInfo_ChangeFlags
void NetMsg_AlienInfo_Hives( entvars_t* const pev, const HiveInfoListType& hives, const HiveInfoListType& client_hives )
{
MESSAGE_BEGIN( MSG_ONE, g_msgAlienInfo, NULL, pev );
if ( pev == NULL )
MESSAGE_BEGIN( MSG_SPEC, g_msgAlienInfo);
else
MESSAGE_BEGIN( MSG_ONE, g_msgAlienInfo, NULL, pev );
WRITE_BYTE( hives.size() );
HiveInfoListType::const_iterator current, end = hives.end();
int status, tech, index = 0;
@ -1160,9 +1187,12 @@ union float_converter
#else
void NetMsg_BlipList( entvars_t* const pev, const bool friendly_blips, const AvHVisibleBlipList& list )
{
int maxBlips = friendly_blips ? 20 : 25;
maxBlips = min ( list.mNumBlips, maxBlips );
MESSAGE_BEGIN( MSG_ONE_UNRELIABLE, g_msgBlipList, NULL, pev );
//pack header - 7 bits for blip count (doesn't go over 40 in practice), 1 bit for Friend or Foe
unsigned char list_info = list.mNumBlips | (friendly_blips ? 0x80 : 0);
unsigned char list_info = maxBlips | (friendly_blips ? 0x80 : 0);
WRITE_BYTE( list_info );
//pack each blip - this could be optimized as follows once bit packer is implemented:
// convert X, Y to integer values ranging from 0 to 2047 (11 bits each) based on map extents
@ -1174,7 +1204,7 @@ union float_converter
// blip precision would be equal to double large minimap precision, with worst case of 4 unit X,Y separation for MT.
// because maps are much smaller vertically than horizontally as a rule, the worst case of 16 unit Z separation
// will very rarely occur.
for( int counter = 0; counter < list.mNumBlips; counter++ )
for( int counter = 0; counter < maxBlips; counter++ )
{
WRITE_COORD( list.mBlipPositions[counter][0] );
WRITE_COORD( list.mBlipPositions[counter][1] );
@ -1441,6 +1471,28 @@ union float_converter
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_HUDSetUpgrades( void* const buffer, const int size, int& upgradeMask )
{
BEGIN_READ( buffer, size );
upgradeMask=READ_BYTE();
END_READ();
}
#else
void NetMsg_HUDSetUpgrades( int upgradeMask )
{
MESSAGE_BEGIN( MSG_ALL, g_msgHUDSetUpgrades);
WRITE_BYTE( upgradeMask );
MESSAGE_END();
}
void NetMsg_HUDSetUpgrades( entvars_t* const pev, int upgradeMask )
{
MESSAGE_BEGIN( MSG_ONE, g_msgHUDSetUpgrades, NULL, pev );
WRITE_BYTE( upgradeMask );
MESSAGE_END();
}
#endif
#ifndef AVH_SERVER
void NetMsg_PlayHUDNotification( void* const buffer, const int size, int& flags, int& sound, float& location_x, float& location_y )
{
@ -1466,19 +1518,24 @@ union float_converter
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress )
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress, int& seconds)
{
BEGIN_READ( buffer, size );
entity_number = READ_SHORT();
progress = READ_BYTE();
if ( progress == 5 )
seconds=READ_BYTE();
END_READ();
}
#else
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress )
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress, int seconds )
{
MESSAGE_BEGIN( MSG_ONE_UNRELIABLE, g_msgProgressBar, NULL, pev );
WRITE_SHORT( entity_number );
WRITE_BYTE( progress );
if ( progress == 5 )
WRITE_BYTE( seconds );
MESSAGE_END();
}
#endif
@ -1486,19 +1543,19 @@ union float_converter
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_ServerVar( void* const buffer, const int size, string& name, string& value )
void NetMsg_ServerVar( void* const buffer, const int size, string& name, int& value )
{
BEGIN_READ( buffer, size );
name = READ_STRING();
value = READ_STRING();
value = READ_SHORT();
END_READ();
}
#else
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const string& value )
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const int& value )
{
MESSAGE_BEGIN( MSG_ONE, g_msgServerVar, NULL, pev );
WRITE_STRING( name.c_str() );
WRITE_STRING( value.c_str() );
WRITE_SHORT( value );
MESSAGE_END();
}
#endif
@ -1509,21 +1566,21 @@ union float_converter
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma )
{
BEGIN_READ( buffer, size );
gamma = READ_COORD();
gamma = READ_BYTE() / 128.0f;
END_READ();
}
#else
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma )
{
MESSAGE_BEGIN( MSG_ONE, g_msgSetGammaRamp, NULL, pev );
WRITE_COORD( gamma );
WRITE_BYTE( floor( min( max(gamma, 0.0f), 1.992f) * 128.0f) );
MESSAGE_END();
}
void NetMsgSpec_SetGammaRamp( const float gamma )
{
MESSAGE_BEGIN( MSG_SPEC, g_msgSetGammaRamp );
WRITE_COORD( gamma );
WRITE_BYTE( floor( min( max(gamma, 0.0f), 1.992f) * 128.0f) );
MESSAGE_END();
}
#endif
@ -1555,7 +1612,7 @@ union float_converter
}
order.SetUser3TargetType( (AvHUser3)READ_BYTE() );
order.SetOrderCompleted( READ_BYTE() );
// puzl: 1050
// : 1050
// Need to sync the order status as it is only manipulated by the serverside state machine
order.SetOrderStatus( READ_BYTE() );
END_READ();
@ -1584,7 +1641,7 @@ union float_converter
}
WRITE_BYTE( order.GetTargetUser3Type() );
WRITE_BYTE( order.GetOrderCompleted() );
// puzl: 1050
// : 1050
// Need to sync the order status as it is only manipulated by the serverside state machine
WRITE_BYTE( order.GetOrderStatus() );
MESSAGE_END();
@ -1594,11 +1651,18 @@ union float_converter
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_SetParticleTemplate( void* const buffer, const int size, AvHParticleTemplate& particle_template )
void NetMsg_DelParts( void* const buffer, const int size)
{
BEGIN_READ( buffer, size );
READ_BYTE();
END_READ();
}
void NetMsg_SetParticleTemplate( void* const buffer, const int size, int &index, AvHParticleTemplate& particle_template )
{
ParticleParams gen_params, vel_params;
PSVector gravity;
BEGIN_READ( buffer, size );
index=READ_SHORT();
particle_template.SetName( string( READ_STRING() ) );
particle_template.SetMaxParticles( READ_LONG() );
particle_template.SetParticleSize( READ_COORD() );
@ -1626,35 +1690,47 @@ union float_converter
END_READ();
}
#else
void NetMsg_SetParticleTemplate( entvars_t* const pev, const AvHParticleTemplate& particle_template )
void NetMsg_SetParticleTemplate( entvars_t* const pev, const int index, const AvHParticleTemplate& particle_template )
{
ParticleParams gen_params, vel_params;
PSVector gravity;
MESSAGE_BEGIN( MSG_ONE, g_msgSetParticleTemplates, NULL, pev );
WRITE_STRING( particle_template.GetName().c_str() );
WRITE_LONG( particle_template.GetMaxParticles() );
WRITE_COORD( particle_template.GetParticleSize() );
WRITE_STRING( particle_template.GetSprite().c_str() );
WRITE_COORD( particle_template.GetParticleSystemLifetime() );
WRITE_COORD( particle_template.GetParticleLifetime() );
WRITE_COORD( particle_template.GetAnimationSpeed() );
WRITE_BYTE( particle_template.GetNumSpriteFrames() );
WRITE_COORD( particle_template.GetParticleScaling() );
WRITE_BYTE( particle_template.GetRenderMode() );
WRITE_LONG( particle_template.GetGenerationRate() );
WRITE_BYTE( particle_template.GetGenerationShape() );
particle_template.GetGenerationParams( gen_params );
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( gen_params[counter] ); }
WRITE_LONG( particle_template.GetGenerationEntityIndex() );
WRITE_COORD( particle_template.GetGenerationEntityParameter() );
WRITE_BYTE( particle_template.GetStartingVelocityShape() );
particle_template.GetStartingVelocityParams( vel_params );
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( vel_params[counter] ); }
particle_template.GetGravity( gravity );
for( int counter = 0; counter < 3; counter++ ) { WRITE_COORD( gravity[counter] ); }
WRITE_COORD( particle_template.GetMaxAlpha() );
WRITE_LONG( particle_template.GetParticleSystemIndexToGenerate() );
WRITE_LONG( particle_template.GetFlags() );
if ( pev )
MESSAGE_BEGIN( MSG_ONE, g_msgSetParticleTemplates, NULL, pev );
else
MESSAGE_BEGIN( MSG_SPEC, g_msgSetParticleTemplates);
WRITE_SHORT(index);
WRITE_STRING( particle_template.GetName().c_str() );
WRITE_LONG( particle_template.GetMaxParticles() );
WRITE_COORD( particle_template.GetParticleSize() );
WRITE_STRING( particle_template.GetSprite().c_str() );
WRITE_COORD( particle_template.GetParticleSystemLifetime() );
WRITE_COORD( particle_template.GetParticleLifetime() );
WRITE_COORD( particle_template.GetAnimationSpeed() );
WRITE_BYTE( particle_template.GetNumSpriteFrames() );
WRITE_COORD( particle_template.GetParticleScaling() );
WRITE_BYTE( particle_template.GetRenderMode() );
WRITE_LONG( particle_template.GetGenerationRate() );
WRITE_BYTE( particle_template.GetGenerationShape() );
particle_template.GetGenerationParams( gen_params );
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( gen_params[counter] ); }
WRITE_LONG( particle_template.GetGenerationEntityIndex() );
WRITE_COORD( particle_template.GetGenerationEntityParameter() );
WRITE_BYTE( particle_template.GetStartingVelocityShape() );
particle_template.GetStartingVelocityParams( vel_params );
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( vel_params[counter] ); }
particle_template.GetGravity( gravity );
for( int counter = 0; counter < 3; counter++ ) { WRITE_COORD( gravity[counter] ); }
WRITE_COORD( particle_template.GetMaxAlpha() );
WRITE_LONG( particle_template.GetParticleSystemIndexToGenerate() );
WRITE_LONG( particle_template.GetFlags() );
MESSAGE_END();
}
void NetMsg_DelParts( entvars_t* const pev )
{
if ( pev )
MESSAGE_BEGIN( MSG_ONE, g_msgDelParts, NULL, pev );
else
MESSAGE_BEGIN( MSG_SPEC, g_msgDelParts);
MESSAGE_END();
}
#endif
@ -1886,17 +1962,20 @@ union float_converter
#else
void NetMsg_SetupMap_Extents( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents, const bool draw_background )
{
MESSAGE_BEGIN( MSG_ONE, g_msgSetupMap, NULL, pev );
WRITE_BYTE( 0 );
WRITE_STRING( name.c_str() );
WRITE_COORD( min_extents[2] );
WRITE_COORD( max_extents[2] );
WRITE_COORD( min_extents[0] );
WRITE_COORD( min_extents[1] );
WRITE_COORD( max_extents[0] );
WRITE_COORD( max_extents[1] );
WRITE_BYTE( draw_background ? 1 : 0 );
MESSAGE_END();
if ( pev)
MESSAGE_BEGIN( MSG_ONE, g_msgSetupMap, NULL, pev );
else
MESSAGE_BEGIN( MSG_SPEC, g_msgSetupMap);
WRITE_BYTE( 0 );
WRITE_STRING( name.c_str() );
WRITE_COORD( min_extents[2] );
WRITE_COORD( max_extents[2] );
WRITE_COORD( min_extents[0] );
WRITE_COORD( min_extents[1] );
WRITE_COORD( max_extents[0] );
WRITE_COORD( max_extents[1] );
WRITE_BYTE( draw_background ? 1 : 0 );
MESSAGE_END();
}
void NetMsg_SetupMap_Location( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents )
@ -1950,15 +2029,21 @@ const int kNumPlayerIndexBits = 6;
const int kPlayerIndexMask = 0x3F;
const int kNumIndexBits = 14;
const int kIndexMask = 0x3FFF;
const int kNumFlagBits = 2;
const int kFlagMask = 0x03;
const int kNumFlagBits = 3;
const int kFlagMask = 0x07;
const int kEntHierFlagPlayer = 0x01;
const int kEntHierFlagDeletion = 0x02;
const int kEntHierFlagUnderAttack = 0x04;
#ifndef AVH_SERVER
//TODO : replace OldItems with vector<int>
void ReadEntHier( MapEntityMap& NewItems, EntityListType& OldItems, int short_data, int long_data );
float UnpackageCoord( const int packaged_coord );
void NetMsg_DelEntityHierarchy(void* const buffer, const int size ) {
BEGIN_READ( buffer, size );
END_READ();
}
void NetMsg_UpdateEntityHierarchy( void* const buffer, const int size, MapEntityMap& NewItems, EntityListType& OldItems )
{
NewItems.clear();
@ -1994,6 +2079,7 @@ const int kEntHierFlagDeletion = 0x02;
MapEntity ent;
int index = 0;
ent.mUnderAttack = ((flags & kEntHierFlagUnderAttack) == kEntHierFlagUnderAttack );
ent.mUser3 = (AvHUser3)(long_data & kStatusMask);
long_data >>= kNumStatusBits;
ent.mTeam = (AvHTeamNumber)(long_data & kTeamMask);
@ -2013,6 +2099,7 @@ const int kEntHierFlagDeletion = 0x02;
else // Other item added/changed
{
index = short_data & kIndexMask;
short_data >>= kNumIndexBits;
ent.mSquadNumber = 0;
ent.mAngle = 0;
}
@ -2031,7 +2118,18 @@ const int kEntHierFlagDeletion = 0x02;
#else
void WriteEntHier( const int index, const MapEntity& ent, bool delete_flag, int& short_data, int& long_data );
int PackageCoord( const float coord );
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems )
void NetMsg_DelEntityHierarchy( entvars_t* const pev )
{
if ( pev == NULL ) {
MESSAGE_BEGIN( MSG_SPEC, g_msgDelEntityHierarchy);
}
else {
MESSAGE_BEGIN( MSG_ONE, g_msgDelEntityHierarchy, NULL, pev );
}
MESSAGE_END();
}
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems, bool specMsg )
{
const int kMaxUpdatesPerPacket = 30;
if( NewItems.empty() && OldItems.empty() ) { return; } //nothing to send!
@ -2040,28 +2138,41 @@ const int kEntHierFlagDeletion = 0x02;
MapEntity temp;
EntityListType::const_iterator old_current, old_end = OldItems.end();
int short_data, long_data, count = 1;
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
for( new_current = NewItems.begin(); new_current != new_end; ++new_current, ++count )
if ( specMsg ) {
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
}
else {
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
}
for( new_current = NewItems.begin(); new_current != new_end; ++new_current, ++count )
{
if( count % kMaxUpdatesPerPacket == 0 )
{
if( count % kMaxUpdatesPerPacket == 0 )
{
MESSAGE_END();
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
MESSAGE_END();
if ( specMsg ) {
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
}
WriteEntHier( new_current->first, new_current->second, false, short_data, long_data );
WRITE_SHORT(short_data);
WRITE_LONG(long_data);
else
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
}
for( old_current = OldItems.begin(); old_current != old_end; ++old_current, ++count )
WriteEntHier( new_current->first, new_current->second, false, short_data, long_data );
WRITE_SHORT(short_data);
WRITE_LONG(long_data);
}
for( old_current = OldItems.begin(); old_current != old_end; ++old_current, ++count )
{
if( count % kMaxUpdatesPerPacket == 0 )
{
if( count % kMaxUpdatesPerPacket == 0 )
{
MESSAGE_END();
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
MESSAGE_END();
if ( specMsg ) {
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
}
WriteEntHier( *old_current, temp, true, short_data, long_data );
WRITE_SHORT(short_data);
else
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
}
WriteEntHier( *old_current, temp, true, short_data, long_data );
WRITE_SHORT(short_data);
}
MESSAGE_END();
}
@ -2090,6 +2201,7 @@ const int kEntHierFlagDeletion = 0x02;
ASSERT((ent.mUser3 & ~kStatusMask) == 0);
long_data |= ent.mUser3 & kStatusMask;
switch( ent.mUser3 )
{
case AVH_USER3_MARINE_PLAYER: case AVH_USER3_COMMANDER_PLAYER:
@ -2113,12 +2225,17 @@ const int kEntHierFlagDeletion = 0x02;
short_data <<= kNumFlagBits;
ASSERT( ( short_data & kFlagMask ) == 0 );
short_data |= kEntHierFlagPlayer;
if ( ent.mUnderAttack ) short_data |= kEntHierFlagUnderAttack;
break;
}
default:
ASSERT( ( index & ~kIndexMask ) == 0 );
short_data = index & kIndexMask;
short_data <<= kNumFlagBits;
ASSERT( (short_data & kFlagMask) == 0 );
if ( ent.mUnderAttack ) {
short_data |= kEntHierFlagUnderAttack;
}
}
}
@ -2137,7 +2254,7 @@ const int kEntHierFlagDeletion = 0x02;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tankefugl: 0000971
// : 0000971
#ifndef AVH_SERVER
void NetMsg_IssueOrder( void* const buffer, const int size, int& ordertype, int& ordersource, int& ordertarget )
{
@ -2157,85 +2274,4 @@ const int kEntHierFlagDeletion = 0x02;
MESSAGE_END();
}
#endif
// :tankefugl
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_LUAMessage( void* const buffer, const int size, lua_State *L, int &arguments)
{
BEGIN_READ( buffer, size );
arguments = READ_BYTE();
for (int i = arguments; i > 0; i--)
{
if (i == arguments)
{
std::string temp = READ_STRING();
lua_getglobal(L, temp.c_str());
continue;
}
int theLuaType = READ_BYTE();
switch (theLuaType)
{
case LUA_TBOOLEAN:
lua_pushboolean(L, READ_BYTE());
break;
case LUA_TNUMBER:
lua_pushnumber(L, (float)(READ_LONG()));
break;
case LUA_TSTRING:
lua_pushstring(L, READ_STRING());
break;
default:
ASSERT(false);
break;
}
}
END_READ();
arguments--;
}
#else
void NetMsg_LUAMessage(entvars_t* const pev, lua_State *L)
{
luaL_checktype(L, 2, LUA_TSTRING);
int arguments = lua_gettop(L);
for (int i = 3; i <= arguments; i++)
{
int theLuaType = lua_type(L, i);
if (!(theLuaType == LUA_TBOOLEAN ||
theLuaType == LUA_TNUMBER ||
theLuaType == LUA_TSTRING))
luaL_typerror(L, i, "boolean|number|string");
}
MESSAGE_BEGIN( MSG_ONE, g_msgLUAMessage, NULL, pev );
WRITE_BYTE(arguments - 1);
WRITE_STRING(lua_tostring(L, 2));
int top = lua_gettop(L);
int current = 3;
while (current <= top)
{
int theLuaType = lua_type(L, current);
WRITE_BYTE(theLuaType);
switch (theLuaType)
{
case LUA_TBOOLEAN:
WRITE_BYTE(lua_toboolean(L, current));
break;
case LUA_TNUMBER:
WRITE_LONG((float)(lua_tonumber(L, current)));
break;
case LUA_TSTRING:
WRITE_STRING(lua_tostring(L, current));
break;
default:
ASSERT(false);
break;
}
current++;
}
MESSAGE_END();
}
#endif
// :

View file

@ -34,11 +34,6 @@
#include "AvHEntityHierarchy.h"
#include "../engine/shake.h"
#include "../common/weaponinfo.h"
extern "C" {
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
//FUNCTION PROTOTYPES
#ifdef AVH_SERVER
@ -70,7 +65,7 @@ extern "C" {
void NetMsg_StatusValue( entvars_t* const pev, const int location, const int state );
void NetMsg_TeamInfo( entvars_t* const pev, const int player_index, const string& team_id );
void NetMsg_TeamNames( entvars_t* const pev, const vector<string>& team_names );
void NetMsg_TeamScore( entvars_t* const pev, const string& team_name, const int score, const int deaths );
void NetMsg_TeamScore( entvars_t* const pev, const string& team_name, const int score, const int reset );
void NetMsg_TextMsg( entvars_t* const pev, const int destination, const vector<string>& message );
void NetMsg_Train( entvars_t* const pev, const int state );
void NetMsg_WeaponList( entvars_t* const pev, const WeaponList& weapon );
@ -95,12 +90,15 @@ extern "C" {
void NetMsg_GameStatus_State( entvars_t* const pev, const int status_code, const int map_mode );
void NetMsg_GameStatus_UnspentLevels( entvars_t* const pev, const int status_code, const int map_mode, const int unspent_levels );
void NetMsg_ListPS( entvars_t* const pev, const string& system_name );
void NetMsg_HUDSetUpgrades( int upgradeMask );
void NetMsg_HUDSetUpgrades( entvars_t* const pev, int upgradeMask );
void NetMsg_PlayHUDNotification( entvars_t* const pev, const int flags, const int sound, const float location_x, const float location_y );
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress );
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const string& value );
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress, int percent=0 );
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const int& value );
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma );
void NetMsg_SetOrder( entvars_t* const pev, const AvHOrder& order );
void NetMsg_SetParticleTemplate( entvars_t* const pev, const AvHParticleTemplate& particle_template );
void NetMsg_DelParts( entvars_t* const pev);
void NetMsg_SetParticleTemplate( entvars_t* const pev, const int index, const AvHParticleTemplate& particle_template );
void NetMsg_SetRequest( entvars_t* pev, const int request_type, const int request_count );
void NetMsg_SetSelect( entvars_t* const pev, Selection& selection );
void NetMsg_SetSoundNames( entvars_t* pev, const bool reset, const string& sound_name );
@ -110,9 +108,9 @@ extern "C" {
void NetMsg_SetTopDown_TechSlots( entvars_t* const pev, const int tech_slots );
void NetMsg_SetupMap_Extents( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents, const bool draw_background );
void NetMsg_SetupMap_Location( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents );
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems );
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems, bool specMsg);
void NetMsg_DelEntityHierarchy( entvars_t* const pev);
void NetMsg_IssueOrder(entvars_t* const pev, const int ordertype, const int ordersource, const int ordertarget);
void NetMsg_LUAMessage(entvars_t* const pev, lua_State *L);
//BROADCAST MESSAGE TRANSMISSION
void NetMsg_DeathMsg( const int killer_index, const int victim_index, string& weapon_name );
@ -120,9 +118,10 @@ extern "C" {
void NetMsg_GameStatus_Time( const int status_code, const int map_mode, const int game_time, const int timelimit, const int attacking_team_number, const bool is_reliable );
void NetMsg_SayText( const int entity_index, const string& text, const string& location );
void NetMsg_TeamInfo( const int player_index, const string& team_id );
void NetMsg_TeamScore( const string& team_name, const int score, const int deaths );
void NetMsg_TeamScore( const string& team_name, const int score, const int reset );
void NetMsg_TextMsg( const int destination, const vector<string>& message );
void NetMsg_ScoreInfo( const ScoreInfo& info );
void NetMsgSpec_ScoreInfo( const ScoreInfo& info );
void NetMsg_UpdateCountdown( const int countdown );
//SPECTATOR MESSAGE TRANSMISSION
@ -166,7 +165,7 @@ extern "C" {
void NetMsg_StatusValue( void* const buffer, const int size, int& location, int& state );
void NetMsg_TeamInfo( void* const buffer, const int size, int& player_index, string& team_id );
void NetMsg_TeamNames( void* const buffer, const int size, vector<string>& team_names );
void NetMsg_TeamScore( void* const buffer, const int size, string& team_name, int& score, int& deaths );
void NetMsg_TeamScore( void* const buffer, const int size, string& team_name, int& score, int& reset );
void NetMsg_TextMsg( void* const buffer, const int size, int& destination, vector<string>& message );
//30
void NetMsg_Train( void* const buffer, const int size, int& state );
@ -184,13 +183,15 @@ extern "C" {
void NetMsg_Fog( void* const buffer, const int size, bool& enabled, int& R, int& G, int& B, float& start, float& end );
void NetMsg_GameStatus( void* const buffer, const int size, int& status_code, AvHMapMode& map_mode, int& game_time, int& timelimit, int& misc_data );
void NetMsg_ListPS( void* const buffer, const int size, string& system_name );
void NetMsg_HUDSetUpgrades( void* const buffer, const int size, int& upgradeMask );
void NetMsg_PlayHUDNotification( void* const buffer, const int size, int& flags, int& sound, float& location_x, float& location_y );
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress );
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress, int &percent);
//45
void NetMsg_ServerVar( void* const buffer, const int size, string& name, string& value );
void NetMsg_ServerVar( void* const buffer, const int size, string& name, int& value );
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma );
void NetMsg_SetOrder( void* const buffer, const int size, AvHOrder& order );
void NetMsg_SetParticleTemplate( void* const buffer, const int size, AvHParticleTemplate& particle_template );
void NetMsg_SetParticleTemplate( void* const buffer, const int size, int &index, AvHParticleTemplate& particle_template );
void NetMsg_DelParts( void* const buffer, const int size);
void NetMsg_SetRequest( void* const buffer, const int size, int& request_type, int& request_count );
//50
void NetMsg_SetSelect( void* const buffer, const int size, Selection& selection );
@ -202,9 +203,8 @@ extern "C" {
void NetMsg_SetupMap( void* const buffer, const int size, bool& is_location, string& name, float* min_extents, float* max_extents, bool& draw_background );
void NetMsg_UpdateCountdown( void* const buffer, const int size, int& countdown );
void NetMsg_UpdateEntityHierarchy( void* const buffer, const int size, MapEntityMap& NewItems, EntityListType& OldItems );
void NetMsg_DelEntityHierarchy( void* const buffer, const int size);
void NetMsg_IssueOrder( void* const buffer, const int size, int& ordertype, int& ordersource, int& ordertarget );
void NetMsg_LUAMessage( void* const buffer, const int size, lua_State *L, int &arguments);
// 60
#endif //AVH_SERVER

Some files were not shown because too many files have changed in this diff Show more