Fix glock18 burst mode(again), ugly fix of death cam. Autoindent on some files
This commit is contained in:
parent
0b2fe9c159
commit
1a1d5d68a6
@ -27,10 +27,10 @@ project (CLDLL)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX -D_LINUX -DCLIENT_WEAPONS -DCLIENT_DLL")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -Wl,--no-undefined")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os")
|
||||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3")
|
||||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ggdb -O3")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
|
@ -28,15 +28,15 @@ extern cvar_t *hud_textmode;
|
||||
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x );
|
||||
|
||||
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
|
||||
{ \
|
||||
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
|
||||
}
|
||||
{ \
|
||||
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
|
||||
}
|
||||
|
||||
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
|
||||
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
|
||||
{ \
|
||||
gHUD.y.UserCmd_##x( ); \
|
||||
}
|
||||
{ \
|
||||
gHUD.y.UserCmd_##x( ); \
|
||||
}
|
||||
|
||||
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
|
||||
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
|
||||
@ -90,7 +90,7 @@ inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f);
|
||||
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
|
||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||
{
|
||||
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||
}
|
||||
|
||||
inline int DrawConsoleString( int x, int y, const char *string )
|
||||
@ -107,7 +107,7 @@ inline int DrawSetTextColor(float r, float g, float b)
|
||||
color[0]=r, color[1] = g, color[2] = b;
|
||||
else
|
||||
gEngfuncs.pfnDrawSetTextColor( r, g, b );
|
||||
|
||||
|
||||
}
|
||||
inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
||||
{
|
||||
|
@ -169,9 +169,9 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
|
||||
g_iPlayerClass = dst->playerclass;
|
||||
g_iTeamNumber = g_PlayerExtraInfo[dst->number].teamnumber;
|
||||
|
||||
g_iUser1 = src->iuser1;
|
||||
g_iUser2 = src->iuser2;
|
||||
g_iUser3 = src->iuser3;
|
||||
dst->iuser1 = g_iUser1 = src->iuser1;
|
||||
dst->iuser2 = g_iUser2 = src->iuser2;
|
||||
dst->iuser3 = g_iUser3 = src->iuser3;
|
||||
}
|
||||
dst->fuser2 = src->fuser2;
|
||||
iOnTrain[src->number] = src->iuser4;
|
||||
|
@ -297,10 +297,10 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName )
|
||||
int wallPuffSprite;
|
||||
switch( iRand % 4 ) // but every bullet makes a wall puff
|
||||
{
|
||||
case 0: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff1.spr"); break;
|
||||
case 1: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff2.spr"); break;
|
||||
case 2: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff3.spr"); break;
|
||||
case 3: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff4.spr"); break;
|
||||
case 0: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff1.spr"); break;
|
||||
case 1: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff2.spr"); break;
|
||||
case 2: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff3.spr"); break;
|
||||
case 3: wallPuffSprite = gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff4.spr"); break;
|
||||
}
|
||||
TEMPENTITY *te = gEngfuncs.pEfxAPI->R_DefaultSprite( pTrace->endpos, wallPuffSprite, 20.0f );
|
||||
if( te )
|
||||
@ -482,15 +482,15 @@ void EV_Dummy( struct event_args_s *args )
|
||||
|
||||
void RemoveBody(TEMPENTITY *te, float frametime, float current_time)
|
||||
{
|
||||
// go underground...
|
||||
if ( current_time >= 2 * te->entity.curstate.fuser2 + 5.0 )
|
||||
te->entity.origin.z -= 5.0 * frametime;
|
||||
// go underground...
|
||||
/*if ( current_time >= 2 * te->entity.curstate.fuser2 + 5.0 )
|
||||
te->entity.origin.z -= 5.0 * frametime;*/
|
||||
}
|
||||
|
||||
void HitBody(TEMPENTITY *ent, pmtrace_s *ptr)
|
||||
{
|
||||
if ( ptr->plane.normal.z > 0.0 )
|
||||
ent->flags |= FTENT_NONE;
|
||||
/*if ( ptr->plane.normal.z > 0.0 )
|
||||
ent->flags |= FTENT_NONE;*/
|
||||
}
|
||||
|
||||
|
||||
@ -499,11 +499,11 @@ void CreateCorpse(Vector *p_vOrigin, Vector *p_vAngles, const char *pModel, floa
|
||||
int modelIdx = gEngfuncs.pEventAPI->EV_FindModelIndex(pModel);
|
||||
vec3_t null(0, 0, 0);
|
||||
TEMPENTITY *model = gEngfuncs.pEfxAPI->R_TempModel( (float*)p_vOrigin,
|
||||
null,
|
||||
(float*)p_vAngles,
|
||||
gEngfuncs.pfnGetCvarFloat("cl_corpsestay"),
|
||||
modelIdx,
|
||||
0 );
|
||||
null,
|
||||
(float*)p_vAngles,
|
||||
gEngfuncs.pfnGetCvarFloat("cl_corpsestay"),
|
||||
modelIdx,
|
||||
0 );
|
||||
|
||||
if(model)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ void EV_CreateSmoke(event_args_s *args)
|
||||
{
|
||||
// don't die when animation is ended
|
||||
pTemp->flags |= (FTENT_SPRANIMATELOOP | FTENT_COLLIDEWORLD);
|
||||
pTemp->die = 80.0f;
|
||||
pTemp->die = gEngfuncs.GetClientTime() + 10.0f;
|
||||
pTemp->entity.curstate.framerate = 4.0f;
|
||||
pTemp->entity.curstate.rendermode = kRenderTransTexture;
|
||||
pTemp->entity.curstate.renderfx = kRenderFxNone;
|
||||
|
@ -27,6 +27,8 @@
|
||||
*/
|
||||
#include "events.h"
|
||||
|
||||
bool g_bGlockBurstMode = false;
|
||||
|
||||
enum glock18_e
|
||||
{
|
||||
GLOCK18_IDLE1 = 0,
|
||||
@ -88,7 +90,7 @@ void EV_Fireglock18( event_args_t *args )
|
||||
if( g_bHoldingShield )
|
||||
seq = GLOCK18_SHIELD_SHOOT;
|
||||
else
|
||||
seq = g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE != 0 ? GLOCK18_SHOOT1: GLOCK18_SHOOT3;
|
||||
seq = g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE != 0 || g_bGlockBurstMode? GLOCK18_SHOOT1: GLOCK18_SHOOT3;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,7 +106,7 @@ void EV_Fireglock18( event_args_t *args )
|
||||
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 );
|
||||
EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL);
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON,
|
||||
g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE != 0 ? "weapons/glock18-1.wav": "weapons/glock18-2.wav",
|
||||
g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE != 0 || g_bGlockBurstMode ? "weapons/glock18-1.wav": "weapons/glock18-2.wav",
|
||||
1, ATTN_NORM, 0,
|
||||
94 + gEngfuncs.pfnRandomLong( 0, 0xf ) );
|
||||
EV_GetGunPosition( args, vecSrc, origin );
|
||||
|
@ -53,7 +53,7 @@ int giDmgFlags[NUM_DMG_TYPES] =
|
||||
DMG_FREEZE|DMG_SLOWFREEZE,
|
||||
DMG_DROWN,
|
||||
DMG_BURN|DMG_SLOWBURN,
|
||||
DMG_NERVEGAS,
|
||||
DMG_NERVEGAS,
|
||||
DMG_RADIATION,
|
||||
DMG_SHOCK,
|
||||
DMG_CALTROP,
|
||||
@ -248,7 +248,7 @@ int CHudHealth::Draw(float flTime)
|
||||
// If health is getting low, make it bright red
|
||||
if (m_iHealth <= 15)
|
||||
a = 255;
|
||||
|
||||
|
||||
GetPainColor( r, g, b );
|
||||
ScaleColors(r, g, b, a );
|
||||
|
||||
@ -310,7 +310,7 @@ void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
|
||||
{
|
||||
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (side > 0)
|
||||
{
|
||||
@ -448,7 +448,7 @@ int CHudHealth::DrawDamage(float flTime)
|
||||
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
|
||||
|
||||
if ( pdmg->fExpire <= flTime // when the time has expired
|
||||
&& a < 40 ) // and the flash is at the low point of the cycle
|
||||
&& a < 40 ) // and the flash is at the low point of the cycle
|
||||
{
|
||||
pdmg->fExpire = 0;
|
||||
|
||||
@ -471,7 +471,7 @@ int CHudHealth::DrawDamage(float flTime)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
|
||||
{
|
||||
@ -512,8 +512,8 @@ void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
|
||||
|
||||
}
|
||||
pdmg = &m_dmg[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// damage bits are only turned on here; they are turned off when the draw time has expired (in DrawDamage())
|
||||
m_bitsDamage |= bitsDamage;
|
||||
@ -598,7 +598,7 @@ void CHudHealth :: DrawRadar( float flTime )
|
||||
}
|
||||
|
||||
if( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == 1)
|
||||
// draw bomb for T
|
||||
// draw bomb for T
|
||||
{
|
||||
if( g_PlayerExtraInfo[33].radarflashon )
|
||||
{
|
||||
@ -609,7 +609,7 @@ void CHudHealth :: DrawRadar( float flTime )
|
||||
}
|
||||
}
|
||||
else
|
||||
// draw hostages for CT
|
||||
// draw hostages for CT
|
||||
{
|
||||
for( int i = 0; i < MAX_HOSTAGES; i++ )
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ extern "C" char PM_FindTextureType( char *name );
|
||||
|
||||
extern globalvars_t *gpGlobals;
|
||||
extern int g_iUser1;
|
||||
extern bool g_bGlockBurstMode;
|
||||
|
||||
// Pool of client side entities/entvars_t
|
||||
static entvars_t ev[ 32 ];
|
||||
@ -1449,7 +1450,8 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
||||
player.m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ] = (int)from->client.vuser4[ 2 ];
|
||||
}
|
||||
|
||||
g_iWeaponFlags = from->weapondata[ from->client.m_iId - 1 ].m_iWeaponState;
|
||||
if( g_pWpns[ from->client.m_iId - 1 ] )
|
||||
g_iWeaponFlags = g_pWpns[ from->client.m_iId - 1 ]->m_iWeaponState;
|
||||
|
||||
// For random weapon events, use this seed to seed random # generator
|
||||
player.random_seed = random_seed;
|
||||
@ -1725,6 +1727,7 @@ void _DLLEXPORT HUD_PostRunCmd( local_state_t *from, local_state_t *to, struct u
|
||||
g_iFreezeTimeOver = !(from->client.iuser3 & PLAYER_FREEZE_TIME_OVER);
|
||||
g_bInBombZone = (from->client.iuser3 & PLAYER_IN_BOMB_ZONE) != 0;
|
||||
g_bHoldingShield = (from->client.iuser3 & PLAYER_HOLDING_SHIELD) != 0;
|
||||
g_bGlockBurstMode = false; // will be taken from g_iWeaponFlags
|
||||
}
|
||||
|
||||
// All games can use FOV state
|
||||
|
@ -44,18 +44,18 @@ cvar_t *cl_lw = NULL;
|
||||
wrect_t nullrc = { 0, 0, 0, 0 };
|
||||
char *sPlayerModelFiles[12] =
|
||||
{
|
||||
"models/player.mdl",
|
||||
"models/player/leet/leet.mdl", // t
|
||||
"models/player/gign/gign.mdl", // ct
|
||||
"models/player/vip/vip.mdl", //ct
|
||||
"models/player/gsg9/gsg9.mdl", // ct
|
||||
"models/player/guerilla/guerilla.mdl", // t
|
||||
"models/player/arctic/arctic.mdl", // t
|
||||
"models/player/sas/sas.mdl", // ct
|
||||
"models/player/terror/terror.mdl", // t
|
||||
"models/player/urban/urban.mdl", // ct
|
||||
"models/player/spetsnaz/spetsnaz.mdl", // ct
|
||||
"models/player/militia/militia.mdl" // t
|
||||
"models/player.mdl",
|
||||
"models/player/leet/leet.mdl", // t
|
||||
"models/player/gign/gign.mdl", // ct
|
||||
"models/player/vip/vip.mdl", //ct
|
||||
"models/player/gsg9/gsg9.mdl", // ct
|
||||
"models/player/guerilla/guerilla.mdl", // t
|
||||
"models/player/arctic/arctic.mdl", // t
|
||||
"models/player/sas/sas.mdl", // ct
|
||||
"models/player/terror/terror.mdl", // t
|
||||
"models/player/urban/urban.mdl", // ct
|
||||
"models/player/spetsnaz/spetsnaz.mdl", // ct
|
||||
"models/player/militia/militia.mdl" // t
|
||||
};
|
||||
|
||||
void ShutdownInput (void);
|
||||
@ -136,23 +136,23 @@ void CHud :: Init( void )
|
||||
m_flTime = 1.0;
|
||||
m_iNoConsolePrint = 0;
|
||||
|
||||
// fullscreen overlays
|
||||
// fullscreen overlays
|
||||
m_SniperScope.Init();
|
||||
m_NVG.Init();
|
||||
|
||||
// Game HUD things
|
||||
|
||||
// Game HUD things
|
||||
m_Ammo.Init();
|
||||
m_Health.Init();
|
||||
m_Radio.Init();
|
||||
m_Radio.Init();
|
||||
m_Timer.Init();
|
||||
m_Money.Init();
|
||||
m_AmmoSecondary.Init();
|
||||
m_Train.Init();
|
||||
m_Battery.Init();
|
||||
m_StatusIcons.Init();
|
||||
|
||||
// chat, death notice, status bars and other
|
||||
m_SayText.Init();
|
||||
|
||||
// chat, death notice, status bars and other
|
||||
m_SayText.Init();
|
||||
m_Spectator.Init();
|
||||
m_Geiger.Init();
|
||||
m_Flash.Init();
|
||||
@ -161,8 +161,8 @@ void CHud :: Init( void )
|
||||
m_DeathNotice.Init();
|
||||
m_TextMessage.Init();
|
||||
m_MOTD.Init();
|
||||
|
||||
// all things that have own background and must be drawn last
|
||||
|
||||
// all things that have own background and must be drawn last
|
||||
m_ProgressBar.Init();
|
||||
m_Menu.Init();
|
||||
m_Scoreboard.Init();
|
||||
@ -236,9 +236,9 @@ void CHud :: VidInit( void )
|
||||
// ----------
|
||||
// Load Sprites
|
||||
// ---------
|
||||
// m_hsprFont = LoadSprite("sprites/%d_font.spr");
|
||||
// m_hsprFont = LoadSprite("sprites/%d_font.spr");
|
||||
|
||||
m_hsprLogo = 0;
|
||||
m_hsprLogo = 0;
|
||||
m_hsprCursor = 0;
|
||||
|
||||
if (ScreenWidth < 640)
|
||||
@ -266,7 +266,7 @@ void CHud :: VidInit( void )
|
||||
}
|
||||
|
||||
// allocated memory for sprite handle arrays
|
||||
m_rghSprites = new HSPRITE[m_iSpriteCount];
|
||||
m_rghSprites = new HSPRITE[m_iSpriteCount];
|
||||
m_rgrcRects = new wrect_t[m_iSpriteCount];
|
||||
m_rgszSpriteNames = new char[m_iSpriteCount * MAX_SPRITE_NAME_LENGTH];
|
||||
|
||||
@ -372,7 +372,7 @@ void COM_FileBase ( const char *in, char *out)
|
||||
|
||||
if ( in[end] != '.' ) // no '.', copy to end
|
||||
end = len-1;
|
||||
else
|
||||
else
|
||||
end--; // Found ',', copy to left of '.'
|
||||
|
||||
|
||||
@ -383,7 +383,7 @@ void COM_FileBase ( const char *in, char *out)
|
||||
|
||||
if ( in[start] != '/' && in[start] != '\\' )
|
||||
start = 0;
|
||||
else
|
||||
else
|
||||
start++;
|
||||
|
||||
// Length of new sting
|
||||
@ -471,12 +471,12 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
|
||||
|
||||
// Set a new sensitivity
|
||||
if ( m_iFOV == def_fov )
|
||||
{
|
||||
{
|
||||
// reset to saved sensitivity
|
||||
m_flMouseSensitivity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// set a new sensitivity that is proportional to the change from the FOV default
|
||||
m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio");
|
||||
}
|
||||
@ -488,7 +488,7 @@ void CHud::AddHudElem(CHudBase *phudelem)
|
||||
{
|
||||
HUDLIST *pdl, *ptemp;
|
||||
|
||||
//phudelem->Think();
|
||||
//phudelem->Think();
|
||||
|
||||
if (!phudelem)
|
||||
return;
|
||||
|
16
cl_dll/hud.h
16
cl_dll/hud.h
@ -19,7 +19,7 @@
|
||||
//
|
||||
// CHud handles the message, calculation, and drawing the HUD
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
|
||||
#define RGB_REDISH 0x00FF1010 //255,16,16
|
||||
@ -94,7 +94,7 @@ class CHudBase
|
||||
public:
|
||||
POSITION m_pos;
|
||||
int m_type;
|
||||
int m_iFlags; // active, moving,
|
||||
int m_iFlags; // active, moving,
|
||||
virtual ~CHudBase() {}
|
||||
virtual int Init( void ) {return 0;}
|
||||
virtual int VidInit( void ) {return 0;}
|
||||
@ -338,7 +338,7 @@ public:
|
||||
CHudMsgFunc(StatusValue);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
enum {
|
||||
MAX_STATUSTEXT_LENGTH = 128,
|
||||
MAX_STATUSBAR_VALUES = 8,
|
||||
MAX_STATUSBAR_LINES = 2,
|
||||
@ -468,7 +468,7 @@ public:
|
||||
CHudMsgFunc(SayText);
|
||||
void SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex = -1 );
|
||||
void EnsureTextFitsInOneLineAndWrapIfHaveTo( int line );
|
||||
friend class CHudSpectator;
|
||||
friend class CHudSpectator;
|
||||
|
||||
private:
|
||||
|
||||
@ -495,7 +495,7 @@ private:
|
||||
HSPRITE m_hSprite2Helmet;
|
||||
wrect_t *m_prc1;
|
||||
wrect_t *m_prc2;
|
||||
int m_iBat;
|
||||
int m_iBat;
|
||||
float m_fFade;
|
||||
int m_iHeight; // width of the battery innards
|
||||
|
||||
@ -527,8 +527,8 @@ private:
|
||||
wrect_t *m_prc1;
|
||||
wrect_t *m_prc2;
|
||||
wrect_t *m_prcBeam;
|
||||
float m_flBat;
|
||||
int m_iBat;
|
||||
float m_flBat;
|
||||
int m_iBat;
|
||||
int m_fOn;
|
||||
float m_fFade;
|
||||
int m_iWidth; // width of the battery innards
|
||||
@ -618,7 +618,7 @@ public:
|
||||
int Draw(float flTime);
|
||||
CHudMsgFunc(StatusIcon);
|
||||
|
||||
enum {
|
||||
enum {
|
||||
MAX_ICONSPRITENAME_LENGTH = MAX_SPRITE_NAME_LENGTH,
|
||||
MAX_ICONSPRITES = 4,
|
||||
};
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "studio_util.h"
|
||||
#include "screenfade.h"
|
||||
|
||||
|
||||
#pragma warning(disable: 4244)
|
||||
|
||||
extern "C" int iJumpSpectator;
|
||||
@ -59,7 +58,7 @@ void SpectatorMode(void)
|
||||
if ( gEngfuncs.Cmd_Argc() == 2 )
|
||||
gHUD.m_Spectator.SetModes( atoi( gEngfuncs.Cmd_Argv(1) ), -1 );
|
||||
else if ( gEngfuncs.Cmd_Argc() == 3 )
|
||||
gHUD.m_Spectator.SetModes( atoi( gEngfuncs.Cmd_Argv(1) ), atoi( gEngfuncs.Cmd_Argv(2) ) );
|
||||
gHUD.m_Spectator.SetModes( atoi( gEngfuncs.Cmd_Argv(1) ), atoi( gEngfuncs.Cmd_Argv(2) ) );
|
||||
}
|
||||
|
||||
void SpectatorSpray(void)
|
||||
@ -76,8 +75,8 @@ void SpectatorSpray(void)
|
||||
pmtrace_t * trace = gEngfuncs.PM_TraceLine( v_origin, forward, PM_TRACELINE_PHYSENTSONLY, 2, -1 );
|
||||
if ( trace->fraction != 1.0 )
|
||||
{
|
||||
sprintf(string, "drc_spray %.2f %.2f %.2f %i",
|
||||
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
|
||||
sprintf(string, "drc_spray %.2f %.2f %.2f %i",
|
||||
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
|
||||
gEngfuncs.pfnServerCmd(string);
|
||||
}
|
||||
|
||||
@ -90,8 +89,8 @@ void SpectatorHelp(void)
|
||||
}
|
||||
else*/
|
||||
{
|
||||
char *text = CHudTextMessage::BufferedLocaliseTextString( "#Spec_Help_Text" );
|
||||
|
||||
char *text = CHudTextMessage::BufferedLocaliseTextString( "#Spec_Help_Text" );
|
||||
|
||||
if ( text )
|
||||
{
|
||||
while ( *text )
|
||||
@ -154,11 +153,13 @@ int CHudSpectator::Init()
|
||||
gEngfuncs.pfnAddCommand ("spec_menu", SpectatorMenu );
|
||||
gEngfuncs.pfnAddCommand ("togglescores", ToggleScores );
|
||||
|
||||
m_drawnames = gEngfuncs.pfnRegisterVariable("spec_drawnames","1",0);
|
||||
m_drawcone = gEngfuncs.pfnRegisterVariable("spec_drawcone","1",0);
|
||||
m_drawstatus = gEngfuncs.pfnRegisterVariable("spec_drawstatus","1",0);
|
||||
m_autoDirector = gEngfuncs.pfnRegisterVariable("spec_autodirector","1",0);
|
||||
m_drawnames = gEngfuncs.pfnRegisterVariable("spec_drawnames_internal","1",0);
|
||||
m_specmode = gEngfuncs.pfnRegisterVariable("spec_mode_internal","1",0);
|
||||
m_drawcone = gEngfuncs.pfnRegisterVariable("spec_drawcone_internal","1",0);
|
||||
m_drawstatus = gEngfuncs.pfnRegisterVariable("spec_drawstatus_internal","1",0);
|
||||
m_autoDirector = gEngfuncs.pfnRegisterVariable("spec_autodirector_internal","1",0);
|
||||
m_pip = gEngfuncs.pfnRegisterVariable("spec_pip","1",0);
|
||||
m_lastAutoDirector = 0.0f;
|
||||
|
||||
if ( !m_drawnames || !m_drawcone || !m_drawstatus || !m_autoDirector || !m_pip)
|
||||
{
|
||||
@ -182,7 +183,7 @@ void UTIL_StringToVector( float * pVector, const char *pString )
|
||||
strcpy( tempString, pString );
|
||||
pstr = pfront = tempString;
|
||||
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for ( j = 0; j < 3; j++ )
|
||||
{
|
||||
pVector[j] = atof( pfront );
|
||||
|
||||
@ -237,14 +238,14 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
|
||||
// we parse the first { now parse entities properties
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
{
|
||||
// parse key
|
||||
data = gEngfuncs.COM_ParseFile(data, token);
|
||||
if (token[0] == '}')
|
||||
break; // finish parsing this entity
|
||||
|
||||
if (!data)
|
||||
{
|
||||
{
|
||||
gEngfuncs.Con_DPrintf("UTIL_FindEntityInMap: EOF without closing brace\n");
|
||||
return 0;
|
||||
};
|
||||
@ -259,14 +260,14 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
|
||||
n--;
|
||||
}
|
||||
|
||||
// parse value
|
||||
// parse value
|
||||
data = gEngfuncs.COM_ParseFile(data, token);
|
||||
if (!data)
|
||||
{
|
||||
{
|
||||
gEngfuncs.Con_DPrintf("UTIL_FindEntityInMap: EOF without closing brace\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
if (token[0] == '}')
|
||||
{
|
||||
gEngfuncs.Con_DPrintf("UTIL_FindEntityInMap: closing brace without data");
|
||||
@ -314,7 +315,7 @@ int UTIL_FindEntityInMap(char * name, float * origin, float * angle)
|
||||
UTIL_StringToVector(origin, token);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // while (1)
|
||||
|
||||
if (found)
|
||||
@ -391,15 +392,35 @@ int CHudSpectator::Draw(float flTime)
|
||||
if ( !g_iUser1 )
|
||||
return 0;
|
||||
|
||||
|
||||
if ( m_lastAutoDirector != m_autoDirector->value )
|
||||
{
|
||||
m_lastAutoDirector = m_autoDirector->value;
|
||||
char cmd[64];
|
||||
snprintf(cmd, sizeof(cmd), "spec_set_ad %f", m_autoDirector->value);
|
||||
gEngfuncs.pfnClientCmd(cmd);
|
||||
if ( m_lastAutoDirector == 0.0 )
|
||||
{
|
||||
if ( m_lastAutoDirector == 0.0 && g_iUser1 == OBS_CHASE_LOCKED )
|
||||
{
|
||||
SetModes(OBS_CHASE_FREE, INSET_OFF);
|
||||
}
|
||||
}
|
||||
else if ( g_iUser1 == OBS_CHASE_FREE )
|
||||
{
|
||||
SetModes(OBS_CHASE_LOCKED, INSET_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
// if user pressed zoom, aplly changes
|
||||
if ( (m_zoomDelta != 0.0f) && ( g_iUser1 == OBS_MAP_FREE ) )
|
||||
{
|
||||
m_mapZoom += m_zoomDelta;
|
||||
|
||||
if ( m_mapZoom > 3.0f )
|
||||
if ( m_mapZoom > 3.0f )
|
||||
m_mapZoom = 3.0f;
|
||||
|
||||
if ( m_mapZoom < 0.5f )
|
||||
if ( m_mapZoom < 0.5f )
|
||||
m_mapZoom = 0.5f;
|
||||
}
|
||||
|
||||
@ -416,7 +437,7 @@ int CHudSpectator::Draw(float flTime)
|
||||
}
|
||||
|
||||
// Only draw the icon names only if map mode is in Main Mode
|
||||
if ( g_iUser1 < OBS_MAP_FREE )
|
||||
if ( g_iUser1 < OBS_MAP_FREE )
|
||||
return 1;
|
||||
|
||||
if ( !m_drawnames->value )
|
||||
@ -440,8 +461,8 @@ int CHudSpectator::Draw(float flTime)
|
||||
if ( m_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) &&
|
||||
m_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) &&
|
||||
m_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
|
||||
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)
|
||||
) continue;
|
||||
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)
|
||||
) continue;
|
||||
}
|
||||
|
||||
color = GetClientColor( i+1 );
|
||||
@ -469,133 +490,133 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
int cmd = READ_BYTE();
|
||||
|
||||
switch ( cmd ) // director command byte
|
||||
{
|
||||
case DRC_CMD_START :
|
||||
// now we have to do some things clientside, since the proxy doesn't know our mod
|
||||
g_iPlayerClass = 0;
|
||||
g_iTeamNumber = 0;
|
||||
|
||||
// fake a InitHUD & ResetHUD message
|
||||
gHUD.MsgFunc_InitHUD(NULL,0, NULL);
|
||||
gHUD.MsgFunc_ResetHUD(NULL, 0, NULL);
|
||||
|
||||
break;
|
||||
switch ( cmd ) // director command byte
|
||||
{
|
||||
case DRC_CMD_START :
|
||||
// now we have to do some things clientside, since the proxy doesn't know our mod
|
||||
g_iPlayerClass = 0;
|
||||
g_iTeamNumber = 0;
|
||||
|
||||
case DRC_CMD_EVENT :
|
||||
m_lastPrimaryObject = READ_WORD();
|
||||
m_lastSecondaryObject = READ_WORD();
|
||||
m_iObserverFlags = READ_LONG();
|
||||
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
if ( (g_iUser2 != m_lastPrimaryObject) || (g_iUser3 != m_lastSecondaryObject) )
|
||||
V_ResetChaseCam();
|
||||
// fake a InitHUD & ResetHUD message
|
||||
gHUD.MsgFunc_InitHUD(NULL,0, NULL);
|
||||
gHUD.MsgFunc_ResetHUD(NULL, 0, NULL);
|
||||
|
||||
g_iUser2 = m_lastPrimaryObject;
|
||||
g_iUser3 = m_lastSecondaryObject;
|
||||
}
|
||||
break;
|
||||
|
||||
// gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject);
|
||||
break;
|
||||
case DRC_CMD_EVENT :
|
||||
m_lastPrimaryObject = READ_WORD();
|
||||
m_lastSecondaryObject = READ_WORD();
|
||||
m_iObserverFlags = READ_LONG();
|
||||
|
||||
case DRC_CMD_MODE :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
SetModes( READ_BYTE(), -1 );
|
||||
}
|
||||
break;
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
if ( (g_iUser2 != m_lastPrimaryObject) || (g_iUser3 != m_lastSecondaryObject) )
|
||||
V_ResetChaseCam();
|
||||
|
||||
case DRC_CMD_CAMERA :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
vJumpOrigin[0] = READ_COORD(); // position
|
||||
vJumpOrigin[1] = READ_COORD();
|
||||
vJumpOrigin[2] = READ_COORD();
|
||||
g_iUser2 = m_lastPrimaryObject;
|
||||
g_iUser3 = m_lastSecondaryObject;
|
||||
}
|
||||
|
||||
vJumpAngles[0] = READ_COORD(); // view angle
|
||||
vJumpAngles[1] = READ_COORD();
|
||||
vJumpAngles[2] = READ_COORD();
|
||||
// gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject);
|
||||
break;
|
||||
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
case DRC_CMD_MODE :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
SetModes( READ_BYTE(), -1 );
|
||||
}
|
||||
break;
|
||||
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
case DRC_CMD_CAMERA :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
vJumpOrigin[0] = READ_COORD(); // position
|
||||
vJumpOrigin[1] = READ_COORD();
|
||||
vJumpOrigin[2] = READ_COORD();
|
||||
|
||||
case DRC_CMD_MESSAGE:
|
||||
{
|
||||
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
|
||||
|
||||
msg->effect = READ_BYTE(); // effect
|
||||
vJumpAngles[0] = READ_COORD(); // view angle
|
||||
vJumpAngles[1] = READ_COORD();
|
||||
vJumpAngles[2] = READ_COORD();
|
||||
|
||||
UnpackRGB( (int&)msg->r1, (int&)msg->g1, (int&)msg->b1, READ_LONG() ); // color
|
||||
msg->r2 = msg->r1;
|
||||
msg->g2 = msg->g1;
|
||||
msg->b2 = msg->b1;
|
||||
msg->a2 = msg->a1 = 0xFF; // not transparent
|
||||
|
||||
msg->x = READ_FLOAT(); // x pos
|
||||
msg->y = READ_FLOAT(); // y pos
|
||||
|
||||
msg->fadein = READ_FLOAT(); // fadein
|
||||
msg->fadeout = READ_FLOAT(); // fadeout
|
||||
msg->holdtime = READ_FLOAT(); // holdtime
|
||||
msg->fxtime = READ_FLOAT(); // fxtime;
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
|
||||
strncpy( m_HUDMessageText[m_lastHudMessage], READ_STRING(), 128 );
|
||||
m_HUDMessageText[m_lastHudMessage][127]=0; // text
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
msg->pMessage = m_HUDMessageText[m_lastHudMessage];
|
||||
msg->pName = "HUD_MESSAGE";
|
||||
case DRC_CMD_MESSAGE:
|
||||
{
|
||||
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
|
||||
|
||||
gHUD.m_Message.MessageAdd( msg );
|
||||
msg->effect = READ_BYTE(); // effect
|
||||
|
||||
m_lastHudMessage++;
|
||||
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
|
||||
|
||||
}
|
||||
UnpackRGB( (int&)msg->r1, (int&)msg->g1, (int&)msg->b1, READ_LONG() ); // color
|
||||
msg->r2 = msg->r1;
|
||||
msg->g2 = msg->g1;
|
||||
msg->b2 = msg->b1;
|
||||
msg->a2 = msg->a1 = 0xFF; // not transparent
|
||||
|
||||
break;
|
||||
msg->x = READ_FLOAT(); // x pos
|
||||
msg->y = READ_FLOAT(); // y pos
|
||||
|
||||
case DRC_CMD_SOUND :
|
||||
string = READ_STRING();
|
||||
value = READ_FLOAT();
|
||||
|
||||
// gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM );
|
||||
|
||||
break;
|
||||
msg->fadein = READ_FLOAT(); // fadein
|
||||
msg->fadeout = READ_FLOAT(); // fadeout
|
||||
msg->holdtime = READ_FLOAT(); // holdtime
|
||||
msg->fxtime = READ_FLOAT(); // fxtime;
|
||||
|
||||
case DRC_CMD_TIMESCALE :
|
||||
value = READ_FLOAT();
|
||||
break;
|
||||
strncpy( m_HUDMessageText[m_lastHudMessage], READ_STRING(), 128 );
|
||||
m_HUDMessageText[m_lastHudMessage][127]=0; // text
|
||||
|
||||
msg->pMessage = m_HUDMessageText[m_lastHudMessage];
|
||||
msg->pName = "HUD_MESSAGE";
|
||||
|
||||
gHUD.m_Message.MessageAdd( msg );
|
||||
|
||||
m_lastHudMessage++;
|
||||
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DRC_CMD_SOUND :
|
||||
string = READ_STRING();
|
||||
value = READ_FLOAT();
|
||||
|
||||
// gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, value, ATTN_NORM, 0, PITCH_NORM );
|
||||
|
||||
break;
|
||||
|
||||
case DRC_CMD_TIMESCALE :
|
||||
value = READ_FLOAT();
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case DRC_CMD_STATUS:
|
||||
READ_LONG(); // total number of spectator slots
|
||||
m_iSpectatorNumber = READ_LONG(); // total number of spectator
|
||||
READ_WORD(); // total number of relay proxies
|
||||
case DRC_CMD_STATUS:
|
||||
READ_LONG(); // total number of spectator slots
|
||||
m_iSpectatorNumber = READ_LONG(); // total number of spectator
|
||||
READ_WORD(); // total number of relay proxies
|
||||
|
||||
//gViewPort->UpdateSpectatorPanel();
|
||||
break;
|
||||
//gViewPort->UpdateSpectatorPanel();
|
||||
break;
|
||||
|
||||
case DRC_CMD_BANNER:
|
||||
// gEngfuncs.Con_DPrintf("GUI: Banner %s\n",READ_STRING() ); // name of banner tga eg gfx/temp/7454562234563475.tga
|
||||
//gViewPort->m_pSpectatorPanel->m_TopBanner->LoadImage( READ_STRING() );
|
||||
//gViewPort->UpdateSpectatorPanel();
|
||||
break;
|
||||
case DRC_CMD_BANNER:
|
||||
// gEngfuncs.Con_DPrintf("GUI: Banner %s\n",READ_STRING() ); // name of banner tga eg gfx/temp/7454562234563475.tga
|
||||
//gViewPort->m_pSpectatorPanel->m_TopBanner->LoadImage( READ_STRING() );
|
||||
//gViewPort->UpdateSpectatorPanel();
|
||||
break;
|
||||
|
||||
case DRC_CMD_FADE:
|
||||
break;
|
||||
/*case DRC_CMD_FADE:
|
||||
break;*/
|
||||
|
||||
case DRC_CMD_STUFFTEXT:
|
||||
ClientCmd( READ_STRING() );
|
||||
break;
|
||||
case DRC_CMD_STUFFTEXT:
|
||||
ClientCmd( READ_STRING() );
|
||||
break;
|
||||
|
||||
default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
|
||||
default : gEngfuncs.Con_DPrintf("CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,7 +647,7 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
|
||||
|
||||
int iCurrent = iStart;
|
||||
|
||||
int iDir = bReverse ? -1 : 1;
|
||||
int iDir = bReverse ? -1 : 1;
|
||||
|
||||
// make sure we have player info
|
||||
//gViewPort->GetAllPlayersInfo();
|
||||
@ -658,7 +679,7 @@ void CHudSpectator::FindNextPlayer(bool bReverse)
|
||||
if ( !g_iUser2 )
|
||||
{
|
||||
gEngfuncs.Con_DPrintf( "No observer targets.\n" );
|
||||
// take save camera position
|
||||
// take save camera position
|
||||
VectorCopy(m_cameraOrigin, vJumpOrigin);
|
||||
VectorCopy(m_cameraAngles, vJumpAngles);
|
||||
}
|
||||
@ -679,12 +700,12 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
|
||||
int newInsetMode = m_pip->value;
|
||||
|
||||
// gEngfuncs.Con_Printf(" HandleButtons:%i\n", ButtonPressed );
|
||||
// if ( !gViewPort )
|
||||
return;
|
||||
// if ( !gViewPort )
|
||||
return;
|
||||
|
||||
//Not in intermission.
|
||||
if ( gHUD.m_iIntermission )
|
||||
return;
|
||||
return;
|
||||
|
||||
if ( !g_iUser1 )
|
||||
return; // dont do anything if not in spectator mode
|
||||
@ -692,7 +713,7 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
|
||||
// don't handle buttons during normal demo playback
|
||||
if ( gEngfuncs.pDemoAPI->IsPlayingback() && !gEngfuncs.IsSpectateOnly() )
|
||||
return;
|
||||
// Slow down mouse clicks.
|
||||
// Slow down mouse clicks.
|
||||
if ( m_flNextObserverInput > time )
|
||||
return;
|
||||
|
||||
@ -735,14 +756,14 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
|
||||
|
||||
// Attack moves to the next player
|
||||
if ( ButtonPressed & (IN_ATTACK | IN_ATTACK2) )
|
||||
{
|
||||
{
|
||||
FindNextPlayer( (ButtonPressed & IN_ATTACK2) ? true:false );
|
||||
|
||||
if ( g_iUser1 == OBS_ROAMING )
|
||||
{
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
iJumpSpectator = 1;
|
||||
|
||||
|
||||
}
|
||||
// lease directed mode if player want to see another player
|
||||
m_autoDirector->value = 0.0f;
|
||||
@ -772,9 +793,9 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed )
|
||||
void CHudSpectator::HandleButtonsUp( int ButtonPressed )
|
||||
{
|
||||
//if ( !gViewPort )
|
||||
return;
|
||||
return;
|
||||
|
||||
// if ( !gViewPort->m_pSpectatorPanel->isVisible() )
|
||||
// if ( !gViewPort->m_pSpectatorPanel->isVisible() )
|
||||
// return; // dont do anything if not in spectator mode
|
||||
|
||||
if ( ButtonPressed & (IN_FORWARD | IN_BACK) )
|
||||
@ -825,52 +846,52 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
|
||||
|
||||
switch ( iNewMainMode )
|
||||
{
|
||||
case OBS_CHASE_LOCKED: g_iUser1 = OBS_CHASE_LOCKED;
|
||||
break;
|
||||
case OBS_CHASE_LOCKED: g_iUser1 = OBS_CHASE_LOCKED;
|
||||
break;
|
||||
|
||||
case OBS_CHASE_FREE : g_iUser1 = OBS_CHASE_FREE;
|
||||
break;
|
||||
case OBS_CHASE_FREE : g_iUser1 = OBS_CHASE_FREE;
|
||||
break;
|
||||
|
||||
case OBS_ROAMING : // jump to current vJumpOrigin/angle
|
||||
g_iUser1 = OBS_ROAMING;
|
||||
if ( g_iUser2 )
|
||||
{
|
||||
V_GetChasePos( g_iUser2, v_cl_angles, vJumpOrigin, vJumpAngles );
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
case OBS_ROAMING : // jump to current vJumpOrigin/angle
|
||||
g_iUser1 = OBS_ROAMING;
|
||||
if ( g_iUser2 )
|
||||
{
|
||||
V_GetChasePos( g_iUser2, v_cl_angles, vJumpOrigin, vJumpAngles );
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OBS_IN_EYE : g_iUser1 = OBS_IN_EYE;
|
||||
break;
|
||||
case OBS_IN_EYE : g_iUser1 = OBS_IN_EYE;
|
||||
break;
|
||||
|
||||
case OBS_MAP_FREE : g_iUser1 = OBS_MAP_FREE;
|
||||
// reset user values
|
||||
m_mapZoom = m_OverviewData.zoom;
|
||||
m_mapOrigin = m_OverviewData.origin;
|
||||
break;
|
||||
case OBS_MAP_FREE : g_iUser1 = OBS_MAP_FREE;
|
||||
// reset user values
|
||||
m_mapZoom = m_OverviewData.zoom;
|
||||
m_mapOrigin = m_OverviewData.origin;
|
||||
break;
|
||||
|
||||
case OBS_MAP_CHASE : g_iUser1 = OBS_MAP_CHASE;
|
||||
// reset user values
|
||||
m_mapZoom = m_OverviewData.zoom;
|
||||
m_mapOrigin = m_OverviewData.origin;
|
||||
break;
|
||||
case OBS_MAP_CHASE : g_iUser1 = OBS_MAP_CHASE;
|
||||
// reset user values
|
||||
m_mapZoom = m_OverviewData.zoom;
|
||||
m_mapOrigin = m_OverviewData.origin;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (g_iUser1 == OBS_IN_EYE) || (g_iUser1 == OBS_ROAMING) )
|
||||
if ( (g_iUser1 == OBS_IN_EYE) || (g_iUser1 == OBS_ROAMING) )
|
||||
{
|
||||
m_crosshairRect.left = 24;
|
||||
m_crosshairRect.top = 0;
|
||||
m_crosshairRect.right = 48;
|
||||
m_crosshairRect.bottom = 24;
|
||||
|
||||
|
||||
SetCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( &m_crosshairRect,0,sizeof(m_crosshairRect) );
|
||||
SetCrosshair( 0, m_crosshairRect, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
char string[128];
|
||||
sprintf(string, "#Spec_Mode%d", g_iUser1 );
|
||||
@ -884,11 +905,11 @@ void CHudSpectator::SetModes(int iNewMainMode, int iNewInsetMode)
|
||||
|
||||
bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
|
||||
{
|
||||
return ( ent &&
|
||||
ent->player &&
|
||||
return ( ent &&
|
||||
ent->player &&
|
||||
ent->curstate.solid != SOLID_NOT &&
|
||||
ent != gEngfuncs.GetLocalPlayer() &&
|
||||
g_PlayerInfoList[ent->index].name != NULL
|
||||
ent != gEngfuncs.GetLocalPlayer() &&
|
||||
g_PlayerInfoList[ent->index].name != NULL
|
||||
);
|
||||
}
|
||||
|
||||
@ -945,7 +966,7 @@ bool CHudSpectator::ParseOverviewFile( )
|
||||
{
|
||||
// parse the global data
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile, token);
|
||||
if ( stricmp( token, "{" ) )
|
||||
if ( stricmp( token, "{" ) )
|
||||
{
|
||||
gEngfuncs.Con_Printf("Error parsing overview file %s. (expected { )\n", filename );
|
||||
return false;
|
||||
@ -959,30 +980,30 @@ bool CHudSpectator::ParseOverviewFile( )
|
||||
{
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.zoom = atof( token );
|
||||
}
|
||||
}
|
||||
else if ( !stricmp( token, "origin" ) )
|
||||
{
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile, token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile, token);
|
||||
m_OverviewData.origin[0] = atof( token );
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.origin[1] = atof( token );
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile, token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile, token);
|
||||
m_OverviewData.origin[2] = atof( token );
|
||||
}
|
||||
else if ( !stricmp( token, "rotated" ) )
|
||||
{
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.rotated = atoi( token );
|
||||
}
|
||||
else if ( !stricmp( token, "inset" ) )
|
||||
{
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.insetWindowX = atof( token );
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.insetWindowY = atof( token );
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.insetWindowWidth = atof( token );
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
m_OverviewData.insetWindowHeight = atof( token );
|
||||
|
||||
}
|
||||
@ -1008,8 +1029,8 @@ bool CHudSpectator::ParseOverviewFile( )
|
||||
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
|
||||
|
||||
if ( stricmp( token, "{" ) )
|
||||
|
||||
if ( stricmp( token, "{" ) )
|
||||
{
|
||||
gEngfuncs.Con_Printf("Error parsing overview file %s. (expected { )\n", filename );
|
||||
return false;
|
||||
@ -1025,10 +1046,10 @@ bool CHudSpectator::ParseOverviewFile( )
|
||||
strcpy(m_OverviewData.layersImages[ m_OverviewData.layers ], token);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else if ( !stricmp( token, "height" ) )
|
||||
{
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
pfile = gEngfuncs.COM_ParseFile(pfile,token);
|
||||
height = atof(token);
|
||||
m_OverviewData.layersHeights[ m_OverviewData.layers ] = height;
|
||||
}
|
||||
@ -1088,13 +1109,13 @@ void CHudSpectator::DrawOverviewLayer()
|
||||
}
|
||||
|
||||
|
||||
screenaspect = 4.0f/3.0f;
|
||||
screenaspect = 4.0f/3.0f;
|
||||
|
||||
|
||||
xs = m_OverviewData.origin[0];
|
||||
ys = m_OverviewData.origin[1];
|
||||
z = ( 90.0f - v_angles[0] ) / 90.0f;
|
||||
z *= m_OverviewData.layersHeights[0]; // gOverviewData.z_min - 32;
|
||||
z = ( 90.0f - v_angles[0] ) / 90.0f;
|
||||
z *= m_OverviewData.layersHeights[0]; // gOverviewData.z_min - 32;
|
||||
|
||||
// i = r_overviewTexture + ( layer*OVERVIEW_X_TILES*OVERVIEW_Y_TILES );
|
||||
|
||||
@ -1125,17 +1146,17 @@ void CHudSpectator::DrawOverviewLayer()
|
||||
gEngfuncs.pTriAPI->SpriteTexture( dummySprite, 0 );
|
||||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep ,y, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep ,y, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->End();
|
||||
|
||||
frame++;
|
||||
@ -1144,13 +1165,13 @@ void CHudSpectator::DrawOverviewLayer()
|
||||
|
||||
y+=yStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xStep = -(2*4096.0f / m_OverviewData.zoom ) / xTiles;
|
||||
yStep = -(2*4096.0f / (m_OverviewData.zoom* screenaspect) ) / yTiles;
|
||||
|
||||
|
||||
|
||||
x = xs + (4096.0f / (m_OverviewData.zoom * screenaspect ));
|
||||
|
||||
|
||||
@ -1158,9 +1179,9 @@ void CHudSpectator::DrawOverviewLayer()
|
||||
for (ix = 0; ix < yTiles; ix++)
|
||||
{
|
||||
|
||||
y = ys + (4096.0f / (m_OverviewData.zoom));
|
||||
|
||||
for (iy = 0; iy < xTiles; iy++)
|
||||
y = ys + (4096.0f / (m_OverviewData.zoom));
|
||||
|
||||
for (iy = 0; iy < xTiles; iy++)
|
||||
{
|
||||
if (hasMapImage)
|
||||
gEngfuncs.pTriAPI->SpriteTexture( m_MapSprite, frame );
|
||||
@ -1168,17 +1189,17 @@ void CHudSpectator::DrawOverviewLayer()
|
||||
gEngfuncs.pTriAPI->SpriteTexture( dummySprite, 0 );
|
||||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep ,y, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep ,y, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+xStep, y+yStep, z);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y+yStep, z);
|
||||
gEngfuncs.pTriAPI->End();
|
||||
|
||||
frame++;
|
||||
@ -1214,7 +1235,7 @@ void CHudSpectator::DrawOverviewEntities()
|
||||
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
|
||||
|
||||
for (i=0; i < MAX_PLAYERS; i++ )
|
||||
m_vPlayerPos[i][2] = -1; // mark as invisible
|
||||
m_vPlayerPos[i][2] = -1; // mark as invisible
|
||||
|
||||
// draw all players
|
||||
for (i=0 ; i < MAX_OVERVIEW_ENTITIES ; i++)
|
||||
@ -1318,14 +1339,14 @@ void CHudSpectator::DrawOverviewEntities()
|
||||
offset[0] = XPROJECT(offset[0]);
|
||||
offset[1] = YPROJECT(offset[1]);
|
||||
offset[2] = 0.0f;
|
||||
|
||||
|
||||
VectorSubtract(offset, screen, offset );
|
||||
|
||||
int playerNum = ent->index - 1;
|
||||
|
||||
m_vPlayerPos[playerNum][0] = screen[0];
|
||||
m_vPlayerPos[playerNum][1] = screen[1] + Length(offset);
|
||||
m_vPlayerPos[playerNum][2] = 1; // mark player as visible
|
||||
m_vPlayerPos[playerNum][0] = screen[0];
|
||||
m_vPlayerPos[playerNum][1] = screen[1] + Length(offset);
|
||||
m_vPlayerPos[playerNum][2] = 1; // mark player as visible
|
||||
}
|
||||
|
||||
if ( !m_pip->value || !m_drawcone->value )
|
||||
@ -1334,7 +1355,7 @@ void CHudSpectator::DrawOverviewEntities()
|
||||
// get current camera position and angle
|
||||
|
||||
if ( m_pip->value == INSET_IN_EYE || g_iUser1 == OBS_IN_EYE )
|
||||
{
|
||||
{
|
||||
V_GetInEyePos( g_iUser2, origin, angles );
|
||||
}
|
||||
else if ( m_pip->value == INSET_CHASE_FREE || g_iUser1 == OBS_CHASE_FREE )
|
||||
@ -1368,9 +1389,9 @@ void CHudSpectator::DrawOverviewEntities()
|
||||
AngleVectors(angles, forward, NULL, NULL );
|
||||
VectorScale (forward, 512.0f, forward);
|
||||
|
||||
offset[0] = 0.0f;
|
||||
offset[1] = 45.0f;
|
||||
offset[2] = 0.0f;
|
||||
offset[0] = 0.0f;
|
||||
offset[1] = 45.0f;
|
||||
offset[2] = 0.0f;
|
||||
|
||||
AngleMatrix(offset, rmatrix );
|
||||
VectorTransform(forward, rmatrix , right );
|
||||
@ -1380,14 +1401,14 @@ void CHudSpectator::DrawOverviewEntities()
|
||||
VectorTransform(forward, rmatrix , left );
|
||||
|
||||
gEngfuncs.pTriAPI->Begin (TRI_TRIANGLES);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+right[0], y+right[1], (z+right[2]) * zScale);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+right[0], y+right[1], (z+right[2]) * zScale);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z * zScale);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+left[0], y+left[1], (z+left[2]) * zScale);
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x, y, z * zScale);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+left[0], y+left[1], (z+left[2]) * zScale);
|
||||
gEngfuncs.pTriAPI->End ();
|
||||
|
||||
}
|
||||
@ -1401,7 +1422,7 @@ void CHudSpectator::DrawOverview()
|
||||
return;
|
||||
|
||||
// Only draw the overview if Map Mode is selected for this view
|
||||
if ( m_iDrawCycle == 0 && ( (g_iUser1 != OBS_MAP_FREE) && (g_iUser1 != OBS_MAP_CHASE) ) )
|
||||
if ( m_iDrawCycle == 0 && ( (g_iUser1 != OBS_MAP_FREE) && (g_iUser1 != OBS_MAP_CHASE) ) )
|
||||
return;
|
||||
|
||||
if ( m_iDrawCycle == 1 && m_pip->value < INSET_MAP_FREE )
|
||||
@ -1440,10 +1461,10 @@ bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const
|
||||
{
|
||||
switch ( g_PlayerExtraInfo[ent->index].teamnumber )
|
||||
{
|
||||
// blue and red teams are swapped in CS and TFC
|
||||
case TEAM_TERRORIST: hSprite = m_hsprPlayerRed; break;
|
||||
case TEAM_CT: hSprite = m_hsprPlayerBlue; break;
|
||||
default: hSprite = m_hsprPlayer; break;
|
||||
// blue and red teams are swapped in CS and TFC
|
||||
case TEAM_TERRORIST: hSprite = m_hsprPlayerRed; break;
|
||||
case TEAM_CT: hSprite = m_hsprPlayerBlue; break;
|
||||
default: hSprite = m_hsprPlayer; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1454,7 +1475,7 @@ bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
|
||||
return AddOverviewEntityToList(hSprite, ent, gEngfuncs.GetClientTime() + duration );
|
||||
}
|
||||
@ -1500,7 +1521,7 @@ void CHudSpectator::CheckSettings()
|
||||
{
|
||||
// both would show map views
|
||||
m_pip->value = INSET_CHASE_FREE;
|
||||
}
|
||||
}
|
||||
|
||||
// disble in intermission screen
|
||||
if ( gHUD.m_iIntermission )
|
||||
@ -1522,20 +1543,20 @@ void CHudSpectator::CheckSettings()
|
||||
}
|
||||
|
||||
// HL/TFC has no oberserver corsshair, so set it client side
|
||||
if ( (g_iUser1 == OBS_IN_EYE) || (g_iUser1 == OBS_ROAMING) )
|
||||
if ( (g_iUser1 == OBS_IN_EYE) || (g_iUser1 == OBS_ROAMING) )
|
||||
{
|
||||
m_crosshairRect.left = 24;
|
||||
m_crosshairRect.top = 0;
|
||||
m_crosshairRect.right = 48;
|
||||
m_crosshairRect.bottom = 24;
|
||||
|
||||
|
||||
SetCrosshair( m_hCrosshair, m_crosshairRect, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( &m_crosshairRect,0,sizeof(m_crosshairRect) );
|
||||
SetCrosshair( 0, m_crosshairRect, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1547,7 +1568,7 @@ void CHudSpectator::CheckSettings()
|
||||
m_pip->value = INSET_OFF;
|
||||
|
||||
// draw small border around inset view, adjust upper black bar
|
||||
// gViewPort->m_pSpectatorPanel->EnableInsetView( m_pip->value != INSET_OFF );
|
||||
// gViewPort->m_pSpectatorPanel->EnableInsetView( m_pip->value != INSET_OFF );
|
||||
}
|
||||
|
||||
int CHudSpectator::ToggleInset(bool allowOff)
|
||||
@ -1559,13 +1580,13 @@ int CHudSpectator::ToggleInset(bool allowOff)
|
||||
if ( newInsetMode > INSET_MAP_CHASE )
|
||||
{
|
||||
if (allowOff)
|
||||
newInsetMode = INSET_OFF;
|
||||
newInsetMode = INSET_OFF;
|
||||
else
|
||||
newInsetMode = INSET_MAP_FREE;
|
||||
}
|
||||
|
||||
if ( newInsetMode == INSET_CHASE_FREE )
|
||||
newInsetMode = INSET_MAP_FREE;
|
||||
newInsetMode = INSET_MAP_FREE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1622,3 +1643,7 @@ void CHudSpectator::InitHUDData()
|
||||
gHUD.m_iFOV = CVAR_GET_FLOAT("default_fov");
|
||||
}
|
||||
|
||||
int CHudSpectator::MsgFunc_Spectator(const char *pszName, int iSize, void *buf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "cl_entity.h"
|
||||
|
||||
#include "hud.h"
|
||||
|
||||
|
||||
#define INSET_OFF 0
|
||||
@ -78,6 +78,7 @@ public:
|
||||
void FindNextPlayer( bool bReverse );
|
||||
void DirectorMessage( int iSize, void *pbuf );
|
||||
void SetSpectatorStartPosition();
|
||||
CHudMsgFunc(Spectator);
|
||||
int Init();
|
||||
int VidInit();
|
||||
|
||||
@ -95,9 +96,11 @@ public:
|
||||
float m_mapZoom; // zoom the user currently uses
|
||||
vec3_t m_mapOrigin; // origin where user rotates around
|
||||
cvar_t * m_drawnames;
|
||||
cvar_t * m_specmode;
|
||||
cvar_t * m_drawcone;
|
||||
cvar_t * m_drawstatus;
|
||||
cvar_t * m_autoDirector;
|
||||
float m_lastAutoDirector;
|
||||
cvar_t * m_pip;
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ float VectorNormalize (float *v)
|
||||
v[1] *= ilength;
|
||||
v[2] *= ilength;
|
||||
}
|
||||
|
||||
|
||||
return length;
|
||||
|
||||
}
|
||||
@ -119,7 +119,7 @@ void VectorMA (const float *veca, float scale, const float *vecb, float *vecc)
|
||||
HSPRITE LoadSprite(const char *pszName)
|
||||
{
|
||||
int i;
|
||||
char sz[256];
|
||||
char sz[256];
|
||||
|
||||
if (ScreenWidth < 640)
|
||||
i = 320;
|
||||
|
365
cl_dll/view.cpp
365
cl_dll/view.cpp
@ -1,6 +1,6 @@
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright ? 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
@ -28,36 +28,36 @@
|
||||
#include "hltv.h"
|
||||
|
||||
// Spectator Mode
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
float vecNewViewAngles[3];
|
||||
int iHasNewViewAngles;
|
||||
float vecNewViewOrigin[3];
|
||||
int iHasNewViewOrigin;
|
||||
int iIsSpectator;
|
||||
float vecNewViewAngles[3];
|
||||
int iHasNewViewAngles;
|
||||
float vecNewViewOrigin[3];
|
||||
int iHasNewViewOrigin;
|
||||
int iIsSpectator;
|
||||
}
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
int CL_IsThirdPerson( void );
|
||||
void CL_CameraOffset( float *ofs );
|
||||
int CL_IsThirdPerson( void );
|
||||
void CL_CameraOffset( float *ofs );
|
||||
|
||||
void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams );
|
||||
void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams );
|
||||
|
||||
void PM_ParticleLine( float *start, float *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 );
|
||||
void NormalizeAngles( float * angles );
|
||||
float Distance(const float * v1, const float * v2);
|
||||
float AngleBetweenVectors( const float * v1, const float * v2 );
|
||||
void PM_ParticleLine( float *start, float *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 );
|
||||
void NormalizeAngles( float * angles );
|
||||
float Distance(const float * v1, const float * v2);
|
||||
float AngleBetweenVectors( const float * v1, const float * v2 );
|
||||
|
||||
float vJumpOrigin[3];
|
||||
float vJumpAngles[3];
|
||||
float vJumpOrigin[3];
|
||||
float vJumpAngles[3];
|
||||
}
|
||||
|
||||
void V_DropPunchAngle ( float frametime, float *ev_punchangle );
|
||||
@ -84,7 +84,7 @@ extern cvar_t *cl_vsmoothing;
|
||||
#define CAM_MODE_FOCUS 2
|
||||
|
||||
vec3_t v_origin, v_angles, v_cl_angles, v_sim_org, v_lastAngles;
|
||||
float v_frametime, v_lastDistance;
|
||||
float v_frametime, v_lastDistance;
|
||||
float v_cameraRelaxAngle = 5.0f;
|
||||
float v_cameraFocusAngle = 35.0f;
|
||||
int v_cameraMode = CAM_MODE_FOCUS;
|
||||
@ -149,7 +149,7 @@ void V_InterpolateAngles( float *start, float *end, float *output, float frac )
|
||||
int i;
|
||||
float ang1, ang2;
|
||||
float d;
|
||||
|
||||
|
||||
V_NormalizeAngles( start );
|
||||
V_NormalizeAngles( end );
|
||||
|
||||
@ -164,7 +164,7 @@ void V_InterpolateAngles( float *start, float *end, float *output, float frac )
|
||||
d -= 360;
|
||||
}
|
||||
else if ( d < -180 )
|
||||
{
|
||||
{
|
||||
d += 360;
|
||||
}
|
||||
|
||||
@ -182,13 +182,13 @@ float V_CalcBob ( struct ref_params_s *pparams )
|
||||
float cycle;
|
||||
static float lasttime;
|
||||
vec3_t vel;
|
||||
|
||||
|
||||
|
||||
if ( pparams->onground == -1 ||
|
||||
pparams->time == lasttime )
|
||||
{
|
||||
// just use old value
|
||||
return bob;
|
||||
return bob;
|
||||
}
|
||||
|
||||
lasttime = pparams->time;
|
||||
@ -196,7 +196,7 @@ float V_CalcBob ( struct ref_params_s *pparams )
|
||||
bobtime += pparams->frametime;
|
||||
cycle = bobtime - (int)( bobtime / cl_bobcycle->value ) * cl_bobcycle->value;
|
||||
cycle /= cl_bobcycle->value;
|
||||
|
||||
|
||||
if ( cycle < cl_bobup->value )
|
||||
{
|
||||
cycle = M_PI * cycle / cl_bobup->value;
|
||||
@ -216,7 +216,7 @@ float V_CalcBob ( struct ref_params_s *pparams )
|
||||
bob = min( bob, 4 );
|
||||
bob = max( bob, -7 );
|
||||
return bob;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -227,23 +227,23 @@ Used by view and sv_user
|
||||
*/
|
||||
float V_CalcRoll (vec3_t angles, vec3_t velocity, float rollangle, float rollspeed )
|
||||
{
|
||||
float sign;
|
||||
float side;
|
||||
float value;
|
||||
float sign;
|
||||
float side;
|
||||
float value;
|
||||
vec3_t forward, right, up;
|
||||
|
||||
|
||||
AngleVectors ( angles, forward, right, up );
|
||||
|
||||
|
||||
side = DotProduct (velocity, right);
|
||||
sign = side < 0 ? -1 : 1;
|
||||
side = fabs( side );
|
||||
|
||||
sign = side < 0 ? -1 : 1;
|
||||
side = fabs( side );
|
||||
|
||||
value = rollangle;
|
||||
if (side < rollspeed)
|
||||
if (side < rollspeed)
|
||||
{
|
||||
side = side * value / rollspeed;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
side = value;
|
||||
}
|
||||
@ -310,14 +310,14 @@ void V_DriftPitch ( struct ref_params_s *pparams )
|
||||
pd.driftmove = 0;
|
||||
else
|
||||
pd.driftmove += pparams->frametime;
|
||||
|
||||
|
||||
if ( pd.driftmove > v_centermove->value)
|
||||
{
|
||||
V_StartPitchDrift ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
delta = pparams->idealpitch - pparams->cl_viewangles[PITCH];
|
||||
|
||||
if (!delta)
|
||||
@ -328,7 +328,7 @@ void V_DriftPitch ( struct ref_params_s *pparams )
|
||||
|
||||
move = pparams->frametime * pd.pitchvel;
|
||||
pd.pitchvel += pparams->frametime * v_centerspeed->value;
|
||||
|
||||
|
||||
if (delta > 0)
|
||||
{
|
||||
if (move > delta)
|
||||
@ -349,11 +349,11 @@ void V_DriftPitch ( struct ref_params_s *pparams )
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
==============================================================================
|
||||
VIEW RENDERING
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
==============================================================================
|
||||
VIEW RENDERING
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
@ -361,9 +361,9 @@ V_CalcGunAngle
|
||||
==================
|
||||
*/
|
||||
void V_CalcGunAngle ( struct ref_params_s *pparams )
|
||||
{
|
||||
{
|
||||
cl_entity_t *viewent;
|
||||
|
||||
|
||||
viewent = gEngfuncs.GetViewModel();
|
||||
if ( !viewent )
|
||||
return;
|
||||
@ -371,7 +371,7 @@ void V_CalcGunAngle ( struct ref_params_s *pparams )
|
||||
viewent->angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
|
||||
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;
|
||||
viewent->angles[ROLL] -= v_idlescale * sin(pparams->time*v_iroll_cycle.value) * v_iroll_level.value;
|
||||
|
||||
|
||||
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
|
||||
viewent->angles[PITCH] -= v_idlescale * sin(pparams->time*v_ipitch_cycle.value) * (v_ipitch_level.value * 0.5);
|
||||
viewent->angles[YAW] -= v_idlescale * sin(pparams->time*v_iyaw_cycle.value) * v_iyaw_level.value;
|
||||
@ -406,7 +406,7 @@ void V_CalcViewRoll ( struct ref_params_s *pparams )
|
||||
{
|
||||
float side;
|
||||
cl_entity_t *viewentity;
|
||||
|
||||
|
||||
viewentity = gEngfuncs.GetEntityByIndex( pparams->viewentity );
|
||||
if ( !viewentity )
|
||||
return;
|
||||
@ -417,7 +417,7 @@ void V_CalcViewRoll ( struct ref_params_s *pparams )
|
||||
|
||||
if ( pparams->health <= 0 && ( pparams->viewheight[2] != 0 ) )
|
||||
{
|
||||
// only roll the view if the player is dead and the viewheight[2] is nonzero
|
||||
// only roll the view if the player is dead and the viewheight[2] is nonzero
|
||||
// this is so deadcam in multiplayer will work.
|
||||
pparams->viewangles[ROLL] = 80; // dead view angle
|
||||
return;
|
||||
@ -438,7 +438,7 @@ void V_CalcIntermissionRefdef ( struct ref_params_s *pparams )
|
||||
|
||||
// ent is the player model ( visible when out of body )
|
||||
ent = gEngfuncs.GetLocalPlayer();
|
||||
|
||||
|
||||
// view is the weapon model (only visible from inside body )
|
||||
view = gEngfuncs.GetViewModel();
|
||||
|
||||
@ -470,7 +470,7 @@ void V_CalcIntermissionRefdef ( struct ref_params_s *pparams )
|
||||
#define ORIGIN_BACKUP 64
|
||||
#define ORIGIN_MASK ( ORIGIN_BACKUP - 1 )
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
float Origins[ ORIGIN_BACKUP ][3];
|
||||
float OriginTime[ ORIGIN_BACKUP ];
|
||||
@ -513,7 +513,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
// ent is the player model ( visible when out of body )
|
||||
ent = gEngfuncs.GetLocalPlayer();
|
||||
}
|
||||
|
||||
|
||||
// view is the weapon model (only visible from inside body )
|
||||
view = gEngfuncs.GetViewModel();
|
||||
|
||||
@ -535,12 +535,12 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// FIXME, we send origin at 1/128 now, change this?
|
||||
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
|
||||
|
||||
|
||||
pparams->vieworg[0] += 1.0/32;
|
||||
pparams->vieworg[1] += 1.0/32;
|
||||
pparams->vieworg[2] += 1.0/32;
|
||||
|
||||
// Check for problems around water, move the viewer artificially if necessary
|
||||
// Check for problems around water, move the viewer artificially if necessary
|
||||
// -- this prevents drawing errors in GL due to waves
|
||||
|
||||
waterOffset = 0;
|
||||
@ -566,11 +566,11 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
{
|
||||
waterEntity = 0; // Don't need this in software
|
||||
}
|
||||
|
||||
|
||||
VectorCopy( pparams->vieworg, point );
|
||||
|
||||
// Eyes are above water, make sure we're above the waves
|
||||
if ( pparams->waterlevel == 2 )
|
||||
if ( pparams->waterlevel == 2 )
|
||||
{
|
||||
point[2] -= waterDist;
|
||||
for ( i = 0; i < waterDist; i++ )
|
||||
@ -599,9 +599,9 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
}
|
||||
|
||||
pparams->vieworg[2] += waterOffset;
|
||||
|
||||
|
||||
V_CalcViewRoll ( pparams );
|
||||
|
||||
|
||||
V_AddIdle ( pparams );
|
||||
|
||||
// offsets
|
||||
@ -617,7 +617,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
pparams->vieworg[i] += scr_ofsx->value*pparams->forward[i] + scr_ofsy->value*pparams->right[i] + scr_ofsz->value*pparams->up[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Treating cam_ofs[2] as the distance
|
||||
if( CL_IsThirdPerson() )
|
||||
{
|
||||
@ -637,15 +637,15 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
pparams->vieworg[ i ] += -ofs[2] * camForward[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Give gun our viewangles
|
||||
VectorCopy ( pparams->cl_viewangles, view->angles );
|
||||
|
||||
|
||||
// set up gun position
|
||||
V_CalcGunAngle ( pparams );
|
||||
|
||||
// Use predicted origin as view origin.
|
||||
VectorCopy ( pparams->simorg, view->origin );
|
||||
VectorCopy ( pparams->simorg, view->origin );
|
||||
view->origin[2] += ( waterOffset );
|
||||
VectorAdd( view->origin, pparams->viewheight, view->origin );
|
||||
|
||||
@ -665,7 +665,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
|
||||
// pushing the view origin down off of the same X/Z plane as the ent's origin will give the
|
||||
// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem
|
||||
// with view model distortion, this may be a cause. (SJB).
|
||||
// with view model distortion, this may be a cause. (SJB).
|
||||
view->origin[2] -= 1;
|
||||
|
||||
// fudge position around to keep amount of weapon visible
|
||||
@ -700,10 +700,10 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
if ( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0)
|
||||
{
|
||||
float steptime;
|
||||
|
||||
|
||||
steptime = pparams->time - lasttime;
|
||||
if (steptime < 0)
|
||||
//FIXME I_Error ("steptime < 0");
|
||||
//FIXME I_Error ("steptime < 0");
|
||||
steptime = 0;
|
||||
|
||||
oldz += steptime * 150;
|
||||
@ -738,7 +738,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
|
||||
// Smooth out whole view in multiplayer when on trains, lifts
|
||||
if ( cl_vsmoothing && cl_vsmoothing->value &&
|
||||
( pparams->smoothing && ( pparams->maxclients > 1 ) ) )
|
||||
( pparams->smoothing && ( pparams->maxclients > 1 ) ) )
|
||||
{
|
||||
int foundidx;
|
||||
int i;
|
||||
@ -791,14 +791,14 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
// Store off v_angles before munging for third person
|
||||
v_angles = pparams->viewangles;
|
||||
v_lastAngles = pparams->viewangles;
|
||||
// v_cl_angles = pparams->cl_viewangles; // keep old user mouse angles !
|
||||
// v_cl_angles = pparams->cl_viewangles; // keep old user mouse angles !
|
||||
if ( CL_IsThirdPerson() )
|
||||
{
|
||||
VectorCopy( camAngles, pparams->viewangles);
|
||||
float pitch = camAngles[ 0 ];
|
||||
|
||||
// Normalize angles
|
||||
if ( pitch > 180 )
|
||||
if ( pitch > 180 )
|
||||
pitch -= 360.0;
|
||||
else if ( pitch < -180 )
|
||||
pitch += 360;
|
||||
@ -836,7 +836,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * finalAngle, float degreesPerSec )
|
||||
{
|
||||
float absd,frac,d,threshhold;
|
||||
|
||||
|
||||
NormalizeAngles( startAngle );
|
||||
NormalizeAngles( endAngle );
|
||||
|
||||
@ -849,7 +849,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
|
||||
d -= 360.0f;
|
||||
}
|
||||
else if ( d < -180.0f )
|
||||
{
|
||||
{
|
||||
d += 360.0f;
|
||||
}
|
||||
|
||||
@ -900,12 +900,12 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
int maxLoops = 8;
|
||||
|
||||
int ignoreent = -1; // first, ignore no entity
|
||||
|
||||
|
||||
cl_entity_t * ent = NULL;
|
||||
|
||||
|
||||
// Trace back from the target using the player's view angles
|
||||
AngleVectors(angles, forward, NULL, NULL);
|
||||
|
||||
|
||||
VectorScale(forward,-1,forward);
|
||||
|
||||
VectorCopy( origin, vecStart );
|
||||
@ -923,11 +923,8 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
|
||||
ent = gEngfuncs.GetEntityByIndex( PM_GetPhysEntInfo( trace->ent ) );
|
||||
|
||||
if ( ent == NULL )
|
||||
break;
|
||||
|
||||
// hit non-player solid BSP , stop here
|
||||
if ( ent->curstate.solid == SOLID_BSP && !ent->player )
|
||||
if ( ent == NULL && ent->curstate.solid == SOLID_BSP && !ent->player )
|
||||
break;
|
||||
|
||||
// if close enought to end pos, stop, otherwise continue trace
|
||||
@ -942,22 +939,25 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
}
|
||||
|
||||
maxLoops--;
|
||||
}
|
||||
}
|
||||
|
||||
/* if ( ent )
|
||||
/*if ( ent )
|
||||
{
|
||||
gEngfuncs.Con_Printf("Trace loops %i , entity %i, model %s, solid %i\n",(8-maxLoops),ent->curstate.number, ent->model->name , ent->curstate.solid );
|
||||
} */
|
||||
gEngfuncs.Con_Printf("Trace loops %i , entity %i, model %s, solid %i\n",(8-maxLoops),ent->curstate.number, ent->model->name , ent->curstate.solid );
|
||||
}*/
|
||||
|
||||
VectorMA( trace->endpos, 4, trace->plane.normal, returnvec );
|
||||
VectorMA( trace->endpos, 8, trace->plane.normal, returnvec );
|
||||
|
||||
//gEngfuncs.Con_DPrintf("origin(%f %f %f) returnvec(%f %f %f)\n", origin[0], origin[1], origin[2], returnvec[0], returnvec[1], returnvec[2]);
|
||||
|
||||
v_lastDistance = Distance(trace->endpos, origin); // real distance without offset
|
||||
}
|
||||
|
||||
/*void V_GetDeathCam(cl_entity_t * ent1, cl_entity_t * ent2, float * angle, float * origin)
|
||||
void V_GetDeathCam(cl_entity_t * ent1, cl_entity_t * ent2, float * angle, float * origin)
|
||||
{
|
||||
float newAngle[3]; float newOrigin[3];
|
||||
|
||||
float newAngle[3];
|
||||
float newOrigin[3];
|
||||
static vec3_t nonDestructedOrigin;
|
||||
float distance = 168.0f;
|
||||
|
||||
v_lastDistance+= v_frametime * 96.0f; // move unit per seconds back
|
||||
@ -968,7 +968,13 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
if ( distance > v_lastDistance )
|
||||
distance = v_lastDistance;
|
||||
|
||||
VectorCopy(ent1->origin, newOrigin);
|
||||
if (ent1->origin.x == 0 && ent1->origin.y == 0 && ent1->origin.z == 0)
|
||||
nonDestructedOrigin.CopyToArray(newOrigin);
|
||||
else
|
||||
{
|
||||
nonDestructedOrigin = ent1->origin;
|
||||
VectorCopy(ent1->origin, newOrigin);
|
||||
}
|
||||
|
||||
if ( ent1->player )
|
||||
newOrigin[2]+= 17; // head level of living player
|
||||
@ -976,7 +982,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
// get new angle towards second target
|
||||
if ( ent2 )
|
||||
{
|
||||
VectorSubtract( ent2->origin, ent1->origin, newAngle );
|
||||
VectorSubtract(ent2->origin, nonDestructedOrigin, newAngle);
|
||||
VectorAngles( newAngle, newAngle );
|
||||
newAngle[0] = -newAngle[0];
|
||||
}
|
||||
@ -990,46 +996,46 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
|
||||
// and smooth view
|
||||
V_SmoothInterpolateAngles( v_lastAngles, newAngle, angle, 120.0f );
|
||||
|
||||
|
||||
V_GetChaseOrigin( angle, newOrigin, distance, origin );
|
||||
|
||||
VectorCopy(angle, v_lastAngles);
|
||||
}*/
|
||||
}
|
||||
|
||||
void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
|
||||
{
|
||||
float newAngle[3]; float newOrigin[3];
|
||||
|
||||
float newAngle[3]; float newOrigin[3];
|
||||
|
||||
int flags = gHUD.m_Spectator.m_iObserverFlags;
|
||||
|
||||
// see is target is a dead player
|
||||
qboolean deadPlayer = ent1->player && (ent1->curstate.solid == SOLID_NOT);
|
||||
|
||||
|
||||
float dfactor = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;
|
||||
|
||||
float distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;
|
||||
|
||||
|
||||
// go away in final scenes or if player just died
|
||||
if ( flags & DRC_FLAG_FINAL )
|
||||
distance*=2.0f;
|
||||
distance*=2.0f;
|
||||
else if ( deadPlayer )
|
||||
distance*=1.5f;
|
||||
distance*=1.5f;
|
||||
|
||||
// let v_lastDistance float smoothly away
|
||||
v_lastDistance+= v_frametime * 32.0f; // move unit per seconds back
|
||||
|
||||
if ( distance > v_lastDistance )
|
||||
distance = v_lastDistance;
|
||||
|
||||
|
||||
VectorCopy(ent1->origin, newOrigin);
|
||||
|
||||
if ( ent1->player )
|
||||
{
|
||||
if ( deadPlayer )
|
||||
if ( deadPlayer )
|
||||
newOrigin[2]+= 2; //laying on ground
|
||||
else
|
||||
newOrigin[2]+= 17; // head level of living player
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
newOrigin[2]+= 8; // object, tricky, must be above bomb in CS
|
||||
@ -1047,9 +1053,9 @@ void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
|
||||
|
||||
// if final scene (bomb), show from real high pos
|
||||
if ( flags & DRC_FLAG_FINAL )
|
||||
newAngle[0] = 22.5f;
|
||||
newAngle[0] = 22.5f;
|
||||
|
||||
// choose side of object/player
|
||||
// choose side of object/player
|
||||
if ( flags & DRC_FLAG_SIDE )
|
||||
newAngle[1]+=22.5f;
|
||||
else
|
||||
@ -1076,7 +1082,7 @@ float MaxAngleBetweenAngles( float * a1, float * a2 )
|
||||
d -= 360;
|
||||
}
|
||||
else if ( d < -180 )
|
||||
{
|
||||
{
|
||||
d += 360;
|
||||
}
|
||||
|
||||
@ -1098,11 +1104,11 @@ void V_GetDoubleTargetsCam(cl_entity_t * ent1, cl_entity_t * ent2,float * angle
|
||||
float dfactor = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;
|
||||
|
||||
float distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;
|
||||
|
||||
|
||||
// go away in final scenes or if player just died
|
||||
if ( flags & DRC_FLAG_FINAL )
|
||||
distance*=2.0f;
|
||||
|
||||
distance*=2.0f;
|
||||
|
||||
// let v_lastDistance float smoothly away
|
||||
v_lastDistance+= v_frametime * 32.0f; // move unit per seconds back
|
||||
|
||||
@ -1124,7 +1130,7 @@ void V_GetDoubleTargetsCam(cl_entity_t * ent1, cl_entity_t * ent2,float * angle
|
||||
|
||||
// set angle diffrent in Dramtaic scenes
|
||||
newAngle[0]+= 12.5f * dfactor; // lower angle if dramatic
|
||||
|
||||
|
||||
if ( flags & DRC_FLAG_SIDE )
|
||||
newAngle[1]+=22.5f;
|
||||
else
|
||||
@ -1171,8 +1177,8 @@ void V_GetDoubleTargetsCam(cl_entity_t * ent1, cl_entity_t * ent2,float * angle
|
||||
|
||||
/* take middle between two viewangles
|
||||
InterpolateAngles( newAngle, tempVec, newAngle, 0.5f); */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1207,17 +1213,17 @@ void V_GetDirectedChasePosition(cl_entity_t * ent1, cl_entity_t * ent2,float *
|
||||
float dfactor = ( flags & DRC_FLAG_DRAMATIC )? -1.0f : 1.0f;
|
||||
|
||||
float distance = 112.0f + ( 16.0f * dfactor ); // get close if dramatic;
|
||||
|
||||
|
||||
// go away in final scenes or if player just died
|
||||
if ( flags & DRC_FLAG_FINAL )
|
||||
distance*=2.0f;
|
||||
|
||||
distance*=2.0f;
|
||||
|
||||
// let v_lastDistance float smoothly away
|
||||
v_lastDistance+= v_frametime * 32.0f; // move unit per seconds back
|
||||
|
||||
if ( distance > v_lastDistance )
|
||||
distance = v_lastDistance;
|
||||
|
||||
|
||||
VectorCopy(ent1->origin, newOrigin);
|
||||
|
||||
if ( ent1->player )
|
||||
@ -1234,12 +1240,13 @@ void V_GetDirectedChasePosition(cl_entity_t * ent1, cl_entity_t * ent2,float *
|
||||
void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles)
|
||||
{
|
||||
cl_entity_t * ent = NULL;
|
||||
|
||||
if ( target )
|
||||
cl_entity_t *local = gEngfuncs.GetLocalPlayer();
|
||||
|
||||
if ( target )
|
||||
{
|
||||
ent = gEngfuncs.GetEntityByIndex( target );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
// just copy a save in-map position
|
||||
@ -1247,17 +1254,25 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
|
||||
VectorCopy ( vJumpOrigin, origin );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( gHUD.m_Spectator.m_autoDirector->value )
|
||||
|
||||
|
||||
if( ent->index == local->index )
|
||||
{
|
||||
if ( g_iUser3 )
|
||||
V_GetDirectedChasePosition( ent, gEngfuncs.GetEntityByIndex( g_iUser3 ),
|
||||
angles, origin );
|
||||
if ( g_iUser3 && g_iUser3 != 1 )
|
||||
V_GetDeathCam( ent, gEngfuncs.GetEntityByIndex( g_iUser3 ),
|
||||
angles, origin );
|
||||
else
|
||||
V_GetDirectedChasePosition( ent, ( cl_entity_t*)0xFFFFFFFF,
|
||||
angles, origin );
|
||||
V_GetDeathCam( ent, NULL,
|
||||
angles, origin );
|
||||
}
|
||||
else if ( gHUD.m_Spectator.m_autoDirector->value )
|
||||
{
|
||||
if ( g_iUser3 && g_iUser3 != 1 )
|
||||
V_GetDirectedChasePosition( ent, gEngfuncs.GetEntityByIndex( g_iUser3 ),
|
||||
angles, origin );
|
||||
else
|
||||
V_GetDirectedChasePosition( ent, (cl_entity_t*)0xFFFFFFFF,
|
||||
angles, origin );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1271,13 +1286,13 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
|
||||
|
||||
|
||||
VectorCopy ( ent->origin, origin);
|
||||
|
||||
|
||||
origin[2]+= 28; // DEFAULT_VIEWHEIGHT - some offset
|
||||
|
||||
V_GetChaseOrigin( angles, origin, cl_chasedist->value, origin );
|
||||
}
|
||||
|
||||
v_resetCamera = false;
|
||||
v_resetCamera = false;
|
||||
}
|
||||
|
||||
void V_ResetChaseCam()
|
||||
@ -1333,7 +1348,7 @@ void V_GetMapFreePosition( float * cl_angles, float * origin, float * angles )
|
||||
zScaledTarget[0] = gHUD.m_Spectator.m_mapOrigin[0];
|
||||
zScaledTarget[1] = gHUD.m_Spectator.m_mapOrigin[1];
|
||||
zScaledTarget[2] = gHUD.m_Spectator.m_mapOrigin[2] * (( 90.0f - angles[0] ) / 90.0f );
|
||||
|
||||
|
||||
|
||||
AngleVectors(angles, forward, NULL, NULL);
|
||||
|
||||
@ -1355,7 +1370,7 @@ void V_GetMapChasePosition(int target, float * cl_angles, float * origin, float
|
||||
// this is done to get the angles made by director mode
|
||||
V_GetChasePos(target, cl_angles, origin, angles);
|
||||
VectorCopy(ent->origin, origin);
|
||||
|
||||
|
||||
// keep fix chase angle horizontal
|
||||
angles[0] = 45.0f;
|
||||
}
|
||||
@ -1382,7 +1397,7 @@ void V_GetMapChasePosition(int target, float * cl_angles, float * origin, float
|
||||
|
||||
VectorNormalize(forward);
|
||||
|
||||
VectorMA(origin, -1536, forward, origin);
|
||||
VectorMA(origin, -1536, forward, origin);
|
||||
}
|
||||
|
||||
int V_FindViewModelByWeaponModel(int weaponindex)
|
||||
@ -1442,9 +1457,9 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
|
||||
static int lastWeaponModelIndex = 0;
|
||||
static int lastViewModelIndex = 0;
|
||||
|
||||
|
||||
cl_entity_t * ent = gEngfuncs.GetEntityByIndex( g_iUser2 );
|
||||
|
||||
|
||||
pparams->onlyClientDraw = false;
|
||||
|
||||
// refresh position
|
||||
@ -1469,7 +1484,7 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
velocity[0] = velocity[0]*0.9f + distance[0]*0.1f;
|
||||
velocity[1] = velocity[1]*0.9f + distance[1]*0.1f;
|
||||
velocity[2] = velocity[2]*0.9f + distance[2]*0.1f;
|
||||
|
||||
|
||||
VectorCopy(velocity, pparams->simvel);
|
||||
}
|
||||
|
||||
@ -1505,7 +1520,7 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
gunModel->model = IEngineStudio.GetModelByIndex( lastViewModelIndex );
|
||||
gunModel->curstate.modelindex = lastViewModelIndex;
|
||||
gunModel->curstate.frame = 0;
|
||||
gunModel->curstate.colormap = 0;
|
||||
gunModel->curstate.colormap = 0;
|
||||
gunModel->index = g_iUser2;
|
||||
}
|
||||
else
|
||||
@ -1529,26 +1544,32 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
|
||||
switch ( g_iUser1 )
|
||||
{
|
||||
case OBS_CHASE_LOCKED: V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
|
||||
break;
|
||||
case OBS_CHASE_LOCKED:
|
||||
V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
|
||||
break;
|
||||
|
||||
case OBS_CHASE_FREE: V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
case OBS_CHASE_FREE:
|
||||
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
|
||||
case OBS_ROAMING : VectorCopy (v_cl_angles, v_angles);
|
||||
VectorCopy (v_sim_org, v_origin);
|
||||
break;
|
||||
case OBS_ROAMING:
|
||||
VectorCopy (v_cl_angles, v_angles);
|
||||
VectorCopy (v_sim_org, v_origin);
|
||||
break;
|
||||
|
||||
case OBS_IN_EYE : V_CalcNormalRefdef ( pparams );
|
||||
break;
|
||||
|
||||
case OBS_MAP_FREE : pparams->onlyClientDraw = true;
|
||||
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
case OBS_IN_EYE:
|
||||
V_CalcNormalRefdef ( pparams );
|
||||
break;
|
||||
|
||||
case OBS_MAP_CHASE : pparams->onlyClientDraw = true;
|
||||
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
case OBS_MAP_FREE:
|
||||
pparams->onlyClientDraw = true;
|
||||
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
|
||||
case OBS_MAP_CHASE:
|
||||
pparams->onlyClientDraw = true;
|
||||
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( gHUD.m_Spectator.m_pip->value )
|
||||
@ -1571,24 +1592,28 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
// override some settings in certain modes
|
||||
switch ( (int)gHUD.m_Spectator.m_pip->value )
|
||||
{
|
||||
case INSET_CHASE_FREE : V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
case INSET_CHASE_FREE:
|
||||
V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
|
||||
case INSET_IN_EYE : V_CalcNormalRefdef ( pparams );
|
||||
break;
|
||||
case INSET_IN_EYE:
|
||||
V_CalcNormalRefdef ( pparams );
|
||||
break;
|
||||
|
||||
case INSET_MAP_FREE : pparams->onlyClientDraw = true;
|
||||
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
case INSET_MAP_FREE:
|
||||
pparams->onlyClientDraw = true;
|
||||
V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
|
||||
break;
|
||||
|
||||
case INSET_MAP_CHASE : pparams->onlyClientDraw = true;
|
||||
case INSET_MAP_CHASE:
|
||||
pparams->onlyClientDraw = true;
|
||||
|
||||
if ( g_iUser1 == OBS_ROAMING )
|
||||
V_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );
|
||||
else
|
||||
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
if ( g_iUser1 == OBS_ROAMING )
|
||||
V_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );
|
||||
else
|
||||
V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
gHUD.m_Spectator.m_iDrawCycle = 1;
|
||||
@ -1597,7 +1622,7 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
|
||||
// write back new values into pparams
|
||||
VectorCopy ( v_cl_angles, pparams->cl_viewangles );
|
||||
VectorCopy ( v_angles, pparams->viewangles )
|
||||
VectorCopy ( v_origin, pparams->vieworg );
|
||||
VectorCopy ( v_origin, pparams->vieworg );
|
||||
|
||||
}
|
||||
|
||||
@ -1607,19 +1632,19 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
|
||||
{
|
||||
// intermission / finale rendering
|
||||
if ( pparams->intermission )
|
||||
{
|
||||
V_CalcIntermissionRefdef ( pparams );
|
||||
{
|
||||
V_CalcIntermissionRefdef ( pparams );
|
||||
}
|
||||
else if ( pparams->spectator || g_iUser1 ) // g_iUser true if in spectator mode
|
||||
{
|
||||
V_CalcSpectatorRefdef ( pparams );
|
||||
V_CalcSpectatorRefdef ( pparams );
|
||||
}
|
||||
else if ( !pparams->paused )
|
||||
{
|
||||
V_CalcNormalRefdef ( pparams );
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
// Example of how to overlay the whole screen with red at 50 % alpha
|
||||
#define SF_TEST
|
||||
#if defined SF_TEST
|
||||
@ -1648,7 +1673,7 @@ V_DropPunchAngle
|
||||
void V_DropPunchAngle ( float frametime, float *ev_punchangle )
|
||||
{
|
||||
float len;
|
||||
|
||||
|
||||
len = VectorNormalize ( ev_punchangle );
|
||||
len -= (10.0 + len * 0.5) * frametime;
|
||||
len = max( len, 0.0 );
|
||||
|
@ -6,6 +6,9 @@ LOCAL_MODULE := server
|
||||
|
||||
include $(XASH3D_CONFIG)
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
|
||||
LOCAL_MODULE_FILENAME = libserver_hardfp
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -w -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
|
||||
-fno-exceptions
|
||||
|
@ -637,4 +637,4 @@ void SendItemStatus(CBasePlayer *pPlayer);
|
||||
extern bool UseBotArgs;
|
||||
extern const char *BotArgs[4];
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -34,6 +34,8 @@
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
bool g_bGlockBurstMode;
|
||||
|
||||
DLL_GLOBAL short g_sModelIndexLaser;
|
||||
DLL_GLOBAL const char *g_pModelNameLaser = "sprites/laserbeam.spr";
|
||||
DLL_GLOBAL short g_sModelIndexLaserDot;
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include "player.h"
|
||||
#include "weapons.h"
|
||||
|
||||
#ifdef CLIENT_WEAPONS
|
||||
extern bool g_bGlockBurstMode;
|
||||
#endif
|
||||
|
||||
enum glock18_e
|
||||
{
|
||||
GLOCK18_IDLE1,
|
||||
@ -131,11 +135,17 @@ void CGLOCK18::SecondaryAttack(void)
|
||||
{
|
||||
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_SemiAuto");
|
||||
m_iWeaponState &= ~WPNSTATE_GLOCK18_BURST_MODE;
|
||||
#ifdef CLIENT_WEAPONS
|
||||
g_bGlockBurstMode = false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire");
|
||||
m_iWeaponState |= WPNSTATE_GLOCK18_BURST_MODE;
|
||||
#ifdef CLIENT_WEAPONS
|
||||
g_bGlockBurstMode = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;
|
||||
@ -301,4 +311,4 @@ void CGLOCK18::WeaponIdle(void)
|
||||
SendWeaponAnim(GLOCK18_IDLE2, UseDecrement() != FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user