2018-01-19 18:00:32 +01:00
|
|
|
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
2016-06-04 15:24:23 +02:00
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
// $NoKeywords: $
|
|
|
|
//=============================================================================
|
|
|
|
|
2017-12-10 21:40:41 +01:00
|
|
|
#pragma once
|
2021-06-20 00:53:07 +02:00
|
|
|
#if !defined(HUD_SPECTATOR_H)
|
2017-12-10 18:19:34 +01:00
|
|
|
#define HUD_SPECTATOR_H
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
#include "cl_entity.h"
|
2024-02-12 23:41:13 +01:00
|
|
|
#include "interpolation.h"
|
2016-06-04 15:24:23 +02:00
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
#define INSET_OFF 0
|
2016-06-04 15:24:23 +02:00
|
|
|
#define INSET_CHASE_FREE 1
|
|
|
|
#define INSET_IN_EYE 2
|
|
|
|
#define INSET_MAP_FREE 3
|
|
|
|
#define INSET_MAP_CHASE 4
|
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
#define MAX_SPEC_HUD_MESSAGES 8
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
#define OVERVIEW_TILE_SIZE 128 // don't change this
|
|
|
|
#define OVERVIEW_MAX_LAYERS 1
|
|
|
|
|
2024-02-12 23:41:13 +01:00
|
|
|
extern void VectorAngles( const float *forward, float *angles );
|
|
|
|
extern "C" void NormalizeAngles( float *angles );
|
|
|
|
|
2016-06-04 15:24:23 +02:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
typedef struct overviewInfo_s
|
|
|
|
{
|
2016-06-04 15:24:23 +02:00
|
|
|
char map[64]; // cl.levelname or empty
|
|
|
|
vec3_t origin; // center of map
|
|
|
|
float zoom; // zoom of map images
|
2016-07-03 15:39:55 +02:00
|
|
|
int layers; // how may layers do we have
|
2016-06-04 15:24:23 +02:00
|
|
|
float layersHeights[OVERVIEW_MAX_LAYERS];
|
|
|
|
char layersImages[OVERVIEW_MAX_LAYERS][255];
|
|
|
|
qboolean rotated; // are map images rotated (90 degrees) ?
|
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
int insetWindowX;
|
|
|
|
int insetWindowY;
|
|
|
|
int insetWindowHeight;
|
|
|
|
int insetWindowWidth;
|
|
|
|
} overviewInfo_t;
|
2016-06-04 15:24:23 +02:00
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
typedef struct overviewEntity_s
|
|
|
|
{
|
2016-06-04 15:24:23 +02:00
|
|
|
HSPRITE hSprite;
|
|
|
|
struct cl_entity_s * entity;
|
|
|
|
double killTime;
|
|
|
|
} overviewEntity_t;
|
|
|
|
|
2024-02-12 23:41:13 +01:00
|
|
|
typedef struct cameraWayPoint_s
|
|
|
|
{
|
|
|
|
float time;
|
|
|
|
vec3_t position;
|
|
|
|
vec3_t angle;
|
|
|
|
float fov;
|
|
|
|
int flags;
|
|
|
|
} cameraWayPoint_t;
|
|
|
|
|
2016-06-04 15:24:23 +02:00
|
|
|
#define MAX_OVERVIEW_ENTITIES 128
|
2024-02-12 23:41:13 +01:00
|
|
|
#define MAX_CAM_WAYPOINTS 32
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
class CHudSpectator : public CHudBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Reset();
|
2016-07-03 15:39:55 +02:00
|
|
|
int ToggleInset( bool allowOff );
|
2016-06-04 15:24:23 +02:00
|
|
|
void CheckSettings();
|
|
|
|
void InitHUDData( void );
|
2016-07-03 15:39:55 +02:00
|
|
|
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime );
|
|
|
|
void DeathMessage( int victim );
|
2016-06-04 15:24:23 +02:00
|
|
|
bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );
|
|
|
|
void CheckOverviewEntities();
|
|
|
|
void DrawOverview();
|
|
|
|
void DrawOverviewEntities();
|
2017-07-20 20:32:06 +02:00
|
|
|
void GetMapPosition( float *returnvec );
|
2016-06-04 15:24:23 +02:00
|
|
|
void DrawOverviewLayer();
|
|
|
|
void LoadMapSprites();
|
|
|
|
bool ParseOverviewFile();
|
2017-07-20 20:32:06 +02:00
|
|
|
bool IsActivePlayer( cl_entity_t *ent );
|
2016-07-03 15:39:55 +02:00
|
|
|
void SetModes( int iMainMode, int iInsetMode );
|
|
|
|
void HandleButtonsDown( int ButtonPressed );
|
|
|
|
void HandleButtonsUp( int ButtonPressed );
|
2016-06-04 15:24:23 +02:00
|
|
|
void FindNextPlayer( bool bReverse );
|
2024-02-12 23:41:13 +01:00
|
|
|
void FindPlayer( const char *name );
|
2016-06-04 15:24:23 +02:00
|
|
|
void DirectorMessage( int iSize, void *pbuf );
|
|
|
|
void SetSpectatorStartPosition();
|
|
|
|
int Init();
|
|
|
|
int VidInit();
|
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
int Draw( float flTime );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
2024-02-12 23:41:13 +01:00
|
|
|
void AddWaypoint( float time, vec3_t pos, vec3_t angle, float fov, int flags );
|
|
|
|
void SetCameraView( vec3_t pos, vec3_t angle, float fov );
|
|
|
|
float GetFOV();
|
|
|
|
bool GetDirectorCamera( vec3_t &position, vec3_t &angle );
|
|
|
|
void SetWayInterpolation( cameraWayPoint_t *prev, cameraWayPoint_t *start, cameraWayPoint_t *end, cameraWayPoint_t *next );
|
|
|
|
|
|
|
|
|
2016-06-04 15:24:23 +02:00
|
|
|
int m_iDrawCycle;
|
2016-07-03 15:39:55 +02:00
|
|
|
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
|
|
|
|
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
|
|
|
|
int m_lastHudMessage;
|
2016-06-04 15:24:23 +02:00
|
|
|
overviewInfo_t m_OverviewData;
|
|
|
|
overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES];
|
2016-07-03 15:39:55 +02:00
|
|
|
int m_iObserverFlags;
|
|
|
|
int m_iSpectatorNumber;
|
|
|
|
|
|
|
|
float m_mapZoom; // zoom the user currently uses
|
|
|
|
vec3_t m_mapOrigin; // origin where user rotates around
|
|
|
|
cvar_t *m_drawnames;
|
|
|
|
cvar_t *m_drawcone;
|
|
|
|
cvar_t *m_drawstatus;
|
|
|
|
cvar_t *m_autoDirector;
|
|
|
|
cvar_t *m_pip;
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
qboolean m_chatEnabled;
|
|
|
|
|
2024-02-12 23:41:13 +01:00
|
|
|
qboolean m_IsInterpolating;
|
|
|
|
int m_ChaseEntity; // if != 0, follow this entity with viewangles
|
|
|
|
int m_WayPoint; // current waypoint 1
|
|
|
|
int m_NumWayPoints; // current number of waypoints
|
2016-06-04 15:24:23 +02:00
|
|
|
vec3_t m_cameraOrigin; // a help camera
|
|
|
|
vec3_t m_cameraAngles; // and it's angles
|
2024-02-12 23:41:13 +01:00
|
|
|
CInterpolation m_WayInterpolation;
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
vec3_t m_vPlayerPos[MAX_PLAYERS];
|
|
|
|
HSPRITE m_hsprPlayerBlue;
|
|
|
|
HSPRITE m_hsprPlayerRed;
|
|
|
|
HSPRITE m_hsprPlayer;
|
|
|
|
HSPRITE m_hsprCamera;
|
|
|
|
HSPRITE m_hsprPlayerDead;
|
|
|
|
HSPRITE m_hsprViewcone;
|
|
|
|
HSPRITE m_hsprUnkownMap;
|
|
|
|
HSPRITE m_hsprBeam;
|
|
|
|
HSPRITE m_hCrosshair;
|
|
|
|
|
|
|
|
wrect_t m_crosshairRect;
|
|
|
|
|
2016-07-03 15:39:55 +02:00
|
|
|
struct model_s *m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
|
2016-06-04 15:24:23 +02:00
|
|
|
float m_flNextObserverInput;
|
2024-02-12 23:41:13 +01:00
|
|
|
float m_FOV;
|
2016-06-04 15:24:23 +02:00
|
|
|
float m_zoomDelta;
|
|
|
|
float m_moveDelta;
|
2016-07-03 15:39:55 +02:00
|
|
|
int m_lastPrimaryObject;
|
|
|
|
int m_lastSecondaryObject;
|
2024-02-12 23:41:13 +01:00
|
|
|
cameraWayPoint_t m_CamPath[MAX_CAM_WAYPOINTS];
|
2016-06-04 15:24:23 +02:00
|
|
|
};
|
|
|
|
#endif // SPECTATOR_H
|