mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 21:24:27 +00:00
Upload missing file. Fix build.
This commit is contained in:
parent
a522ae20c3
commit
ecaba0de22
@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *stub_NameForFunction( unsigned long function )
|
const char *stub_NameForFunction( unsigned int function )
|
||||||
{
|
{
|
||||||
return "func";
|
return "func";
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
|
|||||||
int stub_PrecacheModel( char* s );
|
int stub_PrecacheModel( char* s );
|
||||||
int stub_PrecacheSound( char* s );
|
int stub_PrecacheSound( char* s );
|
||||||
unsigned short stub_PrecacheEvent( int type, const char *s );
|
unsigned short stub_PrecacheEvent( int type, const char *s );
|
||||||
const char *stub_NameForFunction( unsigned long function );
|
const char *stub_NameForFunction( unsigned int function );
|
||||||
void stub_SetModel( struct edict_s *e, const char *m );
|
void stub_SetModel( struct edict_s *e, const char *m );
|
||||||
|
|
||||||
extern cvar_t *cl_lw;
|
extern cvar_t *cl_lw;
|
||||||
|
@ -314,6 +314,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
|
|||||||
int CBasePlayerItem::Save( class CSave & ) { return 1; }
|
int CBasePlayerItem::Save( class CSave & ) { return 1; }
|
||||||
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
||||||
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
||||||
|
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
|
||||||
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
||||||
void CBasePlayerItem::FallInit( void ) { }
|
void CBasePlayerItem::FallInit( void ) { }
|
||||||
void CBasePlayerItem::FallThink( void ) { }
|
void CBasePlayerItem::FallThink( void ) { }
|
||||||
|
@ -560,27 +560,6 @@ void UTIL_ParticleLine( CBasePlayer *player, float *start, float *end, float lif
|
|||||||
gEngfuncs.pEfxAPI->R_ParticleLine( start, end, r, g, b, life );
|
gEngfuncs.pEfxAPI->R_ParticleLine( start, end, r, g, b, life );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=====================
|
|
||||||
CBasePlayerWeapon::PrintState
|
|
||||||
|
|
||||||
For debugging, print out state variables to log file
|
|
||||||
=====================
|
|
||||||
*/
|
|
||||||
void CBasePlayerWeapon::PrintState( void )
|
|
||||||
{
|
|
||||||
COM_Log( "c:\\hl.log", "%.4f ", gpGlobals->time );
|
|
||||||
COM_Log( "c:\\hl.log", "%.4f ", m_pPlayer->m_flNextAttack );
|
|
||||||
COM_Log( "c:\\hl.log", "%.4f ", m_flNextPrimaryAttack );
|
|
||||||
COM_Log( "c:\\hl.log", "%.4f ", m_flTimeWeaponIdle - gpGlobals->time );
|
|
||||||
COM_Log( "c:\\hl.log", "%i ", m_iClip );
|
|
||||||
}
|
|
||||||
|
|
||||||
int RandomLong( int a, int b )
|
|
||||||
{
|
|
||||||
return gEngfuncs.pfnRandomLong( a, b );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=====================
|
=====================
|
||||||
HUD_InitClientWeapons
|
HUD_InitClientWeapons
|
||||||
|
@ -90,6 +90,7 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
|
|||||||
multiplay_gamerules.cpp \
|
multiplay_gamerules.cpp \
|
||||||
nihilanth.cpp \
|
nihilanth.cpp \
|
||||||
nodes.cpp \
|
nodes.cpp \
|
||||||
|
observer.cpp \
|
||||||
osprey.cpp \
|
osprey.cpp \
|
||||||
pathcorner.cpp \
|
pathcorner.cpp \
|
||||||
plane.cpp \
|
plane.cpp \
|
||||||
|
@ -92,6 +92,7 @@ set (SVDLL_SOURCES
|
|||||||
multiplay_gamerules.cpp
|
multiplay_gamerules.cpp
|
||||||
nihilanth.cpp
|
nihilanth.cpp
|
||||||
nodes.cpp
|
nodes.cpp
|
||||||
|
observer.cpp
|
||||||
osprey.cpp
|
osprey.cpp
|
||||||
pathcorner.cpp
|
pathcorner.cpp
|
||||||
plane.cpp
|
plane.cpp
|
||||||
|
@ -129,6 +129,7 @@ OBJ = \
|
|||||||
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
||||||
$(DLL_OBJDIR)/nihilanth.o \
|
$(DLL_OBJDIR)/nihilanth.o \
|
||||||
$(DLL_OBJDIR)/nodes.o \
|
$(DLL_OBJDIR)/nodes.o \
|
||||||
|
$(DLL_OBJDIR)/observer.cpp \^M
|
||||||
$(DLL_OBJDIR)/osprey.o \
|
$(DLL_OBJDIR)/osprey.o \
|
||||||
$(DLL_OBJDIR)/pathcorner.o \
|
$(DLL_OBJDIR)/pathcorner.o \
|
||||||
$(DLL_OBJDIR)/plane.o \
|
$(DLL_OBJDIR)/plane.o \
|
||||||
|
268
dlls/observer.cpp
Normal file
268
dlls/observer.cpp
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
|
||||||
|
//
|
||||||
|
// The copyright to the contents herein is the property of Valve, L.L.C.
|
||||||
|
// The contents may be used and/or copied only with the written permission of
|
||||||
|
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||||
|
// the agreement/contract under which the contents have been supplied.
|
||||||
|
//
|
||||||
|
// Purpose: Functionality for the observer chase camera
|
||||||
|
//
|
||||||
|
// $Workfile: $
|
||||||
|
// $Date: $
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// $Log: $
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================
|
||||||
|
#include "extdll.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "cbase.h"
|
||||||
|
#include "player.h"
|
||||||
|
#include "weapons.h"
|
||||||
|
#include "pm_shared.h"
|
||||||
|
|
||||||
|
extern int gmsgCurWeapon;
|
||||||
|
extern int gmsgSetFOV;
|
||||||
|
// Find the next client in the game for this player to spectate
|
||||||
|
void CBasePlayer::Observer_FindNextPlayer( bool bReverse )
|
||||||
|
{
|
||||||
|
// MOD AUTHORS: Modify the logic of this function if you want to restrict the observer to watching
|
||||||
|
// only a subset of the players. e.g. Make it check the target's team.
|
||||||
|
int iStart;
|
||||||
|
if( m_hObserverTarget )
|
||||||
|
iStart = ENTINDEX( m_hObserverTarget->edict() );
|
||||||
|
else
|
||||||
|
iStart = ENTINDEX( edict() );
|
||||||
|
int iCurrent = iStart;
|
||||||
|
m_hObserverTarget = NULL;
|
||||||
|
int iDir = bReverse ? -1 : 1;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
iCurrent += iDir;
|
||||||
|
|
||||||
|
// Loop through the clients
|
||||||
|
if( iCurrent > gpGlobals->maxClients )
|
||||||
|
iCurrent = 1;
|
||||||
|
if( iCurrent < 1 )
|
||||||
|
iCurrent = gpGlobals->maxClients;
|
||||||
|
|
||||||
|
CBaseEntity *pEnt = UTIL_PlayerByIndex( iCurrent );
|
||||||
|
if( !pEnt )
|
||||||
|
continue;
|
||||||
|
if( pEnt == this )
|
||||||
|
continue;
|
||||||
|
// Don't spec observers or players who haven't picked a class yet
|
||||||
|
if( ( (CBasePlayer*)pEnt )->IsObserver() || ( pEnt->pev->effects & EF_NODRAW ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// MOD AUTHORS: Add checks on target here.
|
||||||
|
m_hObserverTarget = pEnt;
|
||||||
|
break;
|
||||||
|
}while( iCurrent != iStart );
|
||||||
|
|
||||||
|
// Did we find a target?
|
||||||
|
if( m_hObserverTarget )
|
||||||
|
{
|
||||||
|
// Move to the target
|
||||||
|
UTIL_SetOrigin( pev, m_hObserverTarget->pev->origin );
|
||||||
|
|
||||||
|
// ALERT( at_console, "Now Tracking %s\n", STRING( m_hObserverTarget->pev->netname ) );
|
||||||
|
|
||||||
|
// Store the target in pev so the physics DLL can get to it
|
||||||
|
if( pev->iuser1 != OBS_ROAMING )
|
||||||
|
pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle buttons in observer mode
|
||||||
|
void CBasePlayer::Observer_HandleButtons()
|
||||||
|
{
|
||||||
|
// Slow down mouse clicks
|
||||||
|
if( m_flNextObserverInput > gpGlobals->time )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Jump changes from modes: Chase to Roaming
|
||||||
|
if( m_afButtonPressed & IN_JUMP )
|
||||||
|
{
|
||||||
|
if( pev->iuser1 == OBS_CHASE_LOCKED )
|
||||||
|
Observer_SetMode( OBS_CHASE_FREE );
|
||||||
|
else if( pev->iuser1 == OBS_CHASE_FREE )
|
||||||
|
Observer_SetMode( OBS_IN_EYE );
|
||||||
|
else if( pev->iuser1 == OBS_IN_EYE )
|
||||||
|
Observer_SetMode( OBS_ROAMING );
|
||||||
|
else if( pev->iuser1 == OBS_ROAMING )
|
||||||
|
Observer_SetMode( OBS_MAP_FREE );
|
||||||
|
else if( pev->iuser1 == OBS_MAP_FREE )
|
||||||
|
Observer_SetMode( OBS_MAP_CHASE );
|
||||||
|
else
|
||||||
|
Observer_SetMode( OBS_CHASE_FREE ); // don't use OBS_CHASE_LOCKED anymore
|
||||||
|
|
||||||
|
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attack moves to the next player
|
||||||
|
if ( m_afButtonPressed & IN_ATTACK )//&& pev->iuser1 != OBS_ROAMING )
|
||||||
|
{
|
||||||
|
Observer_FindNextPlayer( false );
|
||||||
|
|
||||||
|
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attack2 moves to the prev player
|
||||||
|
if ( m_afButtonPressed & IN_ATTACK2)// && pev->iuser1 != OBS_ROAMING )
|
||||||
|
{
|
||||||
|
Observer_FindNextPlayer( true );
|
||||||
|
|
||||||
|
m_flNextObserverInput = gpGlobals->time + 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBasePlayer::Observer_CheckTarget()
|
||||||
|
{
|
||||||
|
if( pev->iuser1 == OBS_ROAMING )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// try to find a traget if we have no current one
|
||||||
|
if( m_hObserverTarget == NULL )
|
||||||
|
{
|
||||||
|
Observer_FindNextPlayer( false );
|
||||||
|
|
||||||
|
if( m_hObserverTarget == NULL )
|
||||||
|
{
|
||||||
|
// no target found at all
|
||||||
|
|
||||||
|
int lastMode = pev->iuser1;
|
||||||
|
|
||||||
|
Observer_SetMode( OBS_ROAMING );
|
||||||
|
|
||||||
|
m_iObserverLastMode = lastMode; // don't overwrite users lastmode
|
||||||
|
|
||||||
|
return; // we still have np target return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CBasePlayer* target = (CBasePlayer*)( UTIL_PlayerByIndex( ENTINDEX( m_hObserverTarget->edict() ) ) );
|
||||||
|
|
||||||
|
if( !target )
|
||||||
|
{
|
||||||
|
Observer_FindNextPlayer( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check taget
|
||||||
|
if( target->pev->deadflag == DEAD_DEAD )
|
||||||
|
{
|
||||||
|
if( ( target->m_fDeadTime + 2.0f ) < gpGlobals->time )
|
||||||
|
{
|
||||||
|
// 3 secs after death change target
|
||||||
|
Observer_FindNextPlayer( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBasePlayer::Observer_CheckProperties()
|
||||||
|
{
|
||||||
|
// try to find a traget if we have no current one
|
||||||
|
if( pev->iuser1 == OBS_IN_EYE && m_hObserverTarget != NULL )
|
||||||
|
{
|
||||||
|
CBasePlayer* target = (CBasePlayer*)( UTIL_PlayerByIndex( ENTINDEX( m_hObserverTarget->edict() ) ) );
|
||||||
|
|
||||||
|
if( !target )
|
||||||
|
return;
|
||||||
|
|
||||||
|
int weapon = ( target->m_pActiveItem != NULL ) ? target->m_pActiveItem->m_iId : 0;
|
||||||
|
// use fov of tracked client
|
||||||
|
if( m_iFOV != target->m_iFOV || m_iObserverWeapon != weapon )
|
||||||
|
{
|
||||||
|
m_iFOV = target->m_iFOV;
|
||||||
|
m_iClientFOV = m_iFOV;
|
||||||
|
// write fov before wepon data, so zoomed crosshair is set correctly
|
||||||
|
MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev );
|
||||||
|
WRITE_BYTE( m_iFOV );
|
||||||
|
MESSAGE_END();
|
||||||
|
|
||||||
|
m_iObserverWeapon = weapon;
|
||||||
|
//send weapon update
|
||||||
|
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
|
||||||
|
WRITE_BYTE( 1 ); // 1 = current weapon, not on target
|
||||||
|
WRITE_BYTE( m_iObserverWeapon );
|
||||||
|
WRITE_BYTE( 0 ); // clip
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_iFOV = 90;
|
||||||
|
|
||||||
|
if( m_iObserverWeapon != 0 )
|
||||||
|
{
|
||||||
|
m_iObserverWeapon = 0;
|
||||||
|
|
||||||
|
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
|
||||||
|
WRITE_BYTE( 1 ); // 1 = current weapon
|
||||||
|
WRITE_BYTE( m_iObserverWeapon );
|
||||||
|
WRITE_BYTE( 0 ); // clip
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to change the observer mode
|
||||||
|
void CBasePlayer::Observer_SetMode( int iMode )
|
||||||
|
{
|
||||||
|
|
||||||
|
// Just abort if we're changing to the mode we're already in
|
||||||
|
if( iMode == pev->iuser1 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// is valid mode ?
|
||||||
|
if( iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE )
|
||||||
|
iMode = OBS_IN_EYE; // now it is
|
||||||
|
// verify observer target again
|
||||||
|
if( m_hObserverTarget != NULL )
|
||||||
|
{
|
||||||
|
CBaseEntity *pEnt = m_hObserverTarget;
|
||||||
|
|
||||||
|
if( ( pEnt == this ) || ( pEnt == NULL ) )
|
||||||
|
m_hObserverTarget = NULL;
|
||||||
|
else if( ( (CBasePlayer*)pEnt )->IsObserver() || ( pEnt->pev->effects & EF_NODRAW ) )
|
||||||
|
m_hObserverTarget = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set spectator mode
|
||||||
|
pev->iuser1 = iMode;
|
||||||
|
|
||||||
|
// if we are not roaming, we need a valid target to track
|
||||||
|
if( ( iMode != OBS_ROAMING ) && ( m_hObserverTarget == NULL ) )
|
||||||
|
{
|
||||||
|
Observer_FindNextPlayer( false );
|
||||||
|
|
||||||
|
// if we didn't find a valid target switch to roaming
|
||||||
|
if( m_hObserverTarget == NULL )
|
||||||
|
{
|
||||||
|
ClientPrint( pev, HUD_PRINTCENTER, "#Spec_NoTarget" );
|
||||||
|
pev->iuser1 = OBS_ROAMING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set target if not roaming
|
||||||
|
if( pev->iuser1 == OBS_ROAMING )
|
||||||
|
{
|
||||||
|
pev->iuser2 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pev->iuser2 = ENTINDEX( m_hObserverTarget->edict() );
|
||||||
|
|
||||||
|
pev->iuser3 = 0; // clear second target from death cam
|
||||||
|
|
||||||
|
// print spepctaor mode on client screen
|
||||||
|
|
||||||
|
char modemsg[16];
|
||||||
|
sprintf( modemsg,"#Spec_Mode%i", pev->iuser1 );
|
||||||
|
ClientPrint( pev, HUD_PRINTCENTER, modemsg );
|
||||||
|
|
||||||
|
m_iObserverLastMode = iMode;
|
||||||
|
}
|
@ -211,7 +211,7 @@ typedef struct cl_enginefuncs_s
|
|||||||
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||||
void (*pfnWeaponAnim)( int iAnim, int body );
|
void (*pfnWeaponAnim)( int iAnim, int body );
|
||||||
float (*pfnRandomFloat)( float flLow, float flHigh );
|
float (*pfnRandomFloat)( float flLow, float flHigh );
|
||||||
long (*pfnRandomLong)( long lLow, long lHigh );
|
int (*pfnRandomLong)( int lLow, int lHigh );
|
||||||
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args ));
|
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args ));
|
||||||
int (*Con_IsVisible) ();
|
int (*Con_IsVisible) ();
|
||||||
const char *(*pfnGetGameDirectory)( void );
|
const char *(*pfnGetGameDirectory)( void );
|
||||||
@ -311,4 +311,4 @@ typedef struct cl_enginefuncs_s
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//CDLL_INT_H
|
#endif//CDLL_INT_H
|
||||||
|
@ -155,7 +155,7 @@ typedef struct ui_enginefuncs_s
|
|||||||
// menu interface is freezed at version 0.75
|
// menu interface is freezed at version 0.75
|
||||||
// new functions starts here
|
// new functions starts here
|
||||||
float (*pfnRandomFloat)( float flLow, float flHigh );
|
float (*pfnRandomFloat)( float flLow, float flHigh );
|
||||||
long (*pfnRandomLong)( long lLow, long lHigh );
|
int (*pfnRandomLong)( int lLow, int lHigh );
|
||||||
|
|
||||||
void (*pfnSetCursor)( void *hCursor ); // change cursor
|
void (*pfnSetCursor)( void *hCursor ); // change cursor
|
||||||
int (*pfnIsMapValid)( char *filename );
|
int (*pfnIsMapValid)( char *filename );
|
||||||
@ -185,4 +185,4 @@ typedef struct
|
|||||||
|
|
||||||
typedef int (*MENUAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals );
|
typedef int (*MENUAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals );
|
||||||
|
|
||||||
#endif//MENU_INT_H
|
#endif//MENU_INT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user