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 ); }
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
||||
@ -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,14 +136,14 @@ 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();
|
||||
@ -151,8 +151,8 @@ void CHud :: Init( void )
|
||||
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();
|
||||
@ -162,7 +162,7 @@ void CHud :: Init( void )
|
||||
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,7 +236,7 @@ void CHud :: VidInit( void )
|
||||
// ----------
|
||||
// Load Sprites
|
||||
// ---------
|
||||
// m_hsprFont = LoadSprite("sprites/%d_font.spr");
|
||||
// m_hsprFont = LoadSprite("sprites/%d_font.spr");
|
||||
|
||||
m_hsprLogo = 0;
|
||||
m_hsprCursor = 0;
|
||||
@ -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];
|
||||
|
||||
@ -488,7 +488,7 @@ void CHud::AddHudElem(CHudBase *phudelem)
|
||||
{
|
||||
HUDLIST *pdl, *ptemp;
|
||||
|
||||
//phudelem->Think();
|
||||
//phudelem->Think();
|
||||
|
||||
if (!phudelem)
|
||||
return;
|
||||
|
@ -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
|
||||
@ -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:
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "studio_util.h"
|
||||
#include "screenfade.h"
|
||||
|
||||
|
||||
#pragma warning(disable: 4244)
|
||||
|
||||
extern "C" int iJumpSpectator;
|
||||
@ -77,7 +76,7 @@ void SpectatorSpray(void)
|
||||
if ( trace->fraction != 1.0 )
|
||||
{
|
||||
sprintf(string, "drc_spray %.2f %.2f %.2f %i",
|
||||
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
|
||||
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
|
||||
gEngfuncs.pfnServerCmd(string);
|
||||
}
|
||||
|
||||
@ -90,7 +89,7 @@ void SpectatorHelp(void)
|
||||
}
|
||||
else*/
|
||||
{
|
||||
char *text = CHudTextMessage::BufferedLocaliseTextString( "#Spec_Help_Text" );
|
||||
char *text = CHudTextMessage::BufferedLocaliseTextString( "#Spec_Help_Text" );
|
||||
|
||||
if ( 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)
|
||||
{
|
||||
@ -391,6 +392,26 @@ 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 ) )
|
||||
{
|
||||
@ -441,7 +462,7 @@ int CHudSpectator::Draw(float flTime)
|
||||
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;
|
||||
) continue;
|
||||
}
|
||||
|
||||
color = GetClientColor( i+1 );
|
||||
@ -472,130 +493,130 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
|
||||
|
||||
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_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);
|
||||
// fake a InitHUD & ResetHUD message
|
||||
gHUD.MsgFunc_InitHUD(NULL,0, NULL);
|
||||
gHUD.MsgFunc_ResetHUD(NULL, 0, NULL);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case DRC_CMD_EVENT :
|
||||
m_lastPrimaryObject = READ_WORD();
|
||||
m_lastSecondaryObject = READ_WORD();
|
||||
m_iObserverFlags = READ_LONG();
|
||||
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();
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
if ( (g_iUser2 != m_lastPrimaryObject) || (g_iUser3 != m_lastSecondaryObject) )
|
||||
V_ResetChaseCam();
|
||||
|
||||
g_iUser2 = m_lastPrimaryObject;
|
||||
g_iUser3 = m_lastSecondaryObject;
|
||||
}
|
||||
g_iUser2 = m_lastPrimaryObject;
|
||||
g_iUser3 = m_lastSecondaryObject;
|
||||
}
|
||||
|
||||
// gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject);
|
||||
break;
|
||||
// gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject);
|
||||
break;
|
||||
|
||||
case DRC_CMD_MODE :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
SetModes( READ_BYTE(), -1 );
|
||||
}
|
||||
break;
|
||||
case DRC_CMD_MODE :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
SetModes( READ_BYTE(), -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_CAMERA :
|
||||
if ( m_autoDirector->value )
|
||||
{
|
||||
vJumpOrigin[0] = READ_COORD(); // position
|
||||
vJumpOrigin[1] = READ_COORD();
|
||||
vJumpOrigin[2] = READ_COORD();
|
||||
|
||||
vJumpAngles[0] = READ_COORD(); // view angle
|
||||
vJumpAngles[1] = READ_COORD();
|
||||
vJumpAngles[2] = READ_COORD();
|
||||
vJumpAngles[0] = READ_COORD(); // view angle
|
||||
vJumpAngles[1] = READ_COORD();
|
||||
vJumpAngles[2] = READ_COORD();
|
||||
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
gEngfuncs.SetViewAngles( vJumpAngles );
|
||||
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
iJumpSpectator = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRC_CMD_MESSAGE:
|
||||
{
|
||||
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
|
||||
case DRC_CMD_MESSAGE:
|
||||
{
|
||||
client_textmessage_t * msg = &m_HUDMessages[m_lastHudMessage];
|
||||
|
||||
msg->effect = READ_BYTE(); // effect
|
||||
msg->effect = READ_BYTE(); // effect
|
||||
|
||||
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
|
||||
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->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;
|
||||
msg->fadein = READ_FLOAT(); // fadein
|
||||
msg->fadeout = READ_FLOAT(); // fadeout
|
||||
msg->holdtime = READ_FLOAT(); // holdtime
|
||||
msg->fxtime = READ_FLOAT(); // fxtime;
|
||||
|
||||
strncpy( m_HUDMessageText[m_lastHudMessage], READ_STRING(), 128 );
|
||||
m_HUDMessageText[m_lastHudMessage][127]=0; // text
|
||||
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";
|
||||
msg->pMessage = m_HUDMessageText[m_lastHudMessage];
|
||||
msg->pName = "HUD_MESSAGE";
|
||||
|
||||
gHUD.m_Message.MessageAdd( msg );
|
||||
gHUD.m_Message.MessageAdd( msg );
|
||||
|
||||
m_lastHudMessage++;
|
||||
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
|
||||
m_lastHudMessage++;
|
||||
m_lastHudMessage %= MAX_SPEC_HUD_MESSAGES;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case DRC_CMD_SOUND :
|
||||
string = READ_STRING();
|
||||
value = READ_FLOAT();
|
||||
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 );
|
||||
// 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;
|
||||
break;
|
||||
|
||||
case DRC_CMD_TIMESCALE :
|
||||
value = READ_FLOAT();
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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,36 +846,36 @@ 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) )
|
||||
@ -887,8 +908,8 @@ bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
@ -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++;
|
||||
@ -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++;
|
||||
@ -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( 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( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f (x+left[0], y+left[1], (z+left[2]) * zScale);
|
||||
gEngfuncs.pTriAPI->End ();
|
||||
|
||||
}
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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;
|
||||
|
||||
|
||||
|
183
cl_dll/view.cpp
183
cl_dll/view.cpp
@ -1,4 +1,4 @@
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright ? 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@ -30,11 +30,11 @@
|
||||
// Spectator Mode
|
||||
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
|
||||
@ -43,21 +43,21 @@ 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 );
|
||||
@ -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;
|
||||
}
|
||||
@ -703,7 +703,7 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
|
||||
|
||||
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,7 +791,7 @@ 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);
|
||||
@ -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
|
||||
@ -944,20 +941,23 @@ 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 );
|
||||
} */
|
||||
}*/
|
||||
|
||||
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];
|
||||
}
|
||||
@ -994,7 +1000,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
||||
V_GetChaseOrigin( angle, newOrigin, distance, origin );
|
||||
|
||||
VectorCopy(angle, v_lastAngles);
|
||||
}*/
|
||||
}
|
||||
|
||||
void V_GetSingleTargetCam(cl_entity_t * ent1, float * angle, float * origin)
|
||||
{
|
||||
@ -1234,11 +1240,12 @@ 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;
|
||||
cl_entity_t *local = gEngfuncs.GetLocalPlayer();
|
||||
|
||||
if ( target )
|
||||
{
|
||||
ent = gEngfuncs.GetEntityByIndex( target );
|
||||
};
|
||||
}
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
@ -1249,15 +1256,23 @@ void V_GetChasePos(int target, float * cl_angles, float * origin, float * angles
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
@ -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_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_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;
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
@ -1619,7 +1644,7 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
|
||||
V_CalcNormalRefdef ( pparams );
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
// Example of how to overlay the whole screen with red at 50 % alpha
|
||||
#define SF_TEST
|
||||
#if defined SF_TEST
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user