Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.5 KiB

//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
9 years ago
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#ifndef HUD_SPECTATOR_H
#define HUD_SPECTATOR_H
9 years ago
#include "cl_entity.h"
9 years ago
#define INSET_OFF 0
9 years ago
#define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2
#define INSET_MAP_FREE 3
#define INSET_MAP_CHASE 4
9 years ago
#define MAX_SPEC_HUD_MESSAGES 8
9 years ago
#define OVERVIEW_TILE_SIZE 128 // don't change this
#define OVERVIEW_MAX_LAYERS 1
//-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
//-----------------------------------------------------------------------------
9 years ago
typedef struct overviewInfo_s
{
9 years ago
char map[64]; // cl.levelname or empty
vec3_t origin; // center of map
float zoom; // zoom of map images
9 years ago
int layers; // how may layers do we have
9 years ago
float layersHeights[OVERVIEW_MAX_LAYERS];
char layersImages[OVERVIEW_MAX_LAYERS][255];
qboolean rotated; // are map images rotated (90 degrees) ?
9 years ago
int insetWindowX;
int insetWindowY;
int insetWindowHeight;
int insetWindowWidth;
} overviewInfo_t;
9 years ago
9 years ago
typedef struct overviewEntity_s
{
9 years ago
HSPRITE hSprite;
struct cl_entity_s * entity;
double killTime;
} overviewEntity_t;
#define MAX_OVERVIEW_ENTITIES 128
class CHudSpectator : public CHudBase
{
public:
void Reset();
9 years ago
int ToggleInset( bool allowOff );
9 years ago
void CheckSettings();
void InitHUDData( void );
9 years ago
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime );
void DeathMessage( int victim );
9 years ago
bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );
void CheckOverviewEntities();
void DrawOverview();
void DrawOverviewEntities();
void GetMapPosition( float *returnvec );
9 years ago
void DrawOverviewLayer();
void LoadMapSprites();
bool ParseOverviewFile();
bool IsActivePlayer( cl_entity_t *ent );
9 years ago
void SetModes( int iMainMode, int iInsetMode );
void HandleButtonsDown( int ButtonPressed );
void HandleButtonsUp( int ButtonPressed );
9 years ago
void FindNextPlayer( bool bReverse );
void DirectorMessage( int iSize, void *pbuf );
void SetSpectatorStartPosition();
int Init();
int VidInit();
9 years ago
int Draw( float flTime );
9 years ago
int m_iDrawCycle;
9 years ago
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
int m_lastHudMessage;
9 years ago
overviewInfo_t m_OverviewData;
overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES];
9 years ago
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;
9 years ago
qboolean m_chatEnabled;
vec3_t m_cameraOrigin; // a help camera
vec3_t m_cameraAngles; // and it's angles
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;
9 years ago
struct model_s *m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
9 years ago
float m_flNextObserverInput;
float m_zoomDelta;
float m_moveDelta;
9 years ago
int m_lastPrimaryObject;
int m_lastSecondaryObject;
9 years ago
};
#endif // SPECTATOR_H