o Added labelled minimaps

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@198 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2005-06-19 14:39:47 +00:00
parent 2581c48cfc
commit dae5cc64f9
7 changed files with 196 additions and 161 deletions

View File

@ -92,6 +92,7 @@ cl_forcedefaultfov "0"
cl_highdetail "1" cl_highdetail "1"
cl_himodels "0" cl_himodels "0"
cl_idealpitchscale "0.8" cl_idealpitchscale "0.8"
cl_labelmaps "1"
cl_lc "1" cl_lc "1"
cl_logocolor "#Valve_Orange" cl_logocolor "#Valve_Orange"
cl_logofile "lambda" cl_logofile "lambda"

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1999, Valve LLC. All rights reserved. * Copyright (c) 1999, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -32,6 +32,7 @@
#include "ui/UIComponent.h" #include "ui/UIComponent.h"
#include "vgui_scorepanel.h" #include "vgui_scorepanel.h"
#include "mod/AvHClientVariables.h"
#include "mod/ChatPanel.h" #include "mod/ChatPanel.h"
class CHLVoiceStatusHelper : public IVoiceStatusHelper class CHLVoiceStatusHelper : public IVoiceStatusHelper
@ -257,7 +258,7 @@ int __MsgFunc_RandomPC(const char *pszName, int iSize, void *pbuf)
return gViewPort->MsgFunc_RandomPC( pszName, iSize, pbuf ); return gViewPort->MsgFunc_RandomPC( pszName, iSize, pbuf );
return 0; return 0;
} }
int __MsgFunc_ServerName(const char *pszName, int iSize, void *pbuf) int __MsgFunc_ServerName(const char *pszName, int iSize, void *pbuf)
{ {
if (gViewPort) if (gViewPort)
@ -356,6 +357,7 @@ void CHud :: Init( void )
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" ); cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
CVAR_CREATE( "cl_showspeed", "0", 0); CVAR_CREATE( "cl_showspeed", "0", 0);
CVAR_CREATE( kvLabelMaps, "0", FCVAR_ARCHIVE);
m_pSpriteList = NULL; m_pSpriteList = NULL;
@ -389,13 +391,13 @@ void CHud :: Init( void )
m_AmmoSecondary.Init(); m_AmmoSecondary.Init();
m_TextMessage.Init(); m_TextMessage.Init();
m_StatusIcons.Init(); m_StatusIcons.Init();
m_Spectator.m_chatEnabled = (m_SayText.m_HUD_saytext->value!=0); m_Spectator.m_chatEnabled = (m_SayText.m_HUD_saytext->value!=0);
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort); GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort);
m_Menu.Init(); m_Menu.Init();
ServersInit(); ServersInit();
MsgFunc_ResetHUD(0, 0, NULL ); MsgFunc_ResetHUD(0, 0, NULL );
@ -460,8 +462,8 @@ void CHud :: VidInit( void )
// Load Sprites // 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; m_hsprCursor = 0;
if (ScreenWidth() < 640) if (ScreenWidth() < 640)
@ -577,15 +579,15 @@ void COM_FileBase ( const char *in, char *out)
int len, start, end; int len, start, end;
len = strlen( in ); len = strlen( in );
// scan backward for '.' // scan backward for '.'
end = len - 1; end = len - 1;
while ( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' ) while ( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' )
end--; end--;
if ( in[end] != '.' ) // no '.', copy to end if ( in[end] != '.' ) // no '.', copy to end
end = len-1; end = len-1;
else else
end--; // Found ',', copy to left of '.' end--; // Found ',', copy to left of '.'
@ -596,7 +598,7 @@ void COM_FileBase ( const char *in, char *out)
if ( in[start] != '/' && in[start] != '\\' ) if ( in[start] != '/' && in[start] != '\\' )
start = 0; start = 0;
else else
start++; start++;
// Length of new sting // Length of new sting
@ -684,12 +686,12 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
// Set a new sensitivity // Set a new sensitivity
if ( m_iFOV == def_fov ) if ( m_iFOV == def_fov )
{ {
// reset to saved sensitivity // reset to saved sensitivity
m_flMouseSensitivity = 0; m_flMouseSensitivity = 0;
} }
else else
{ {
// set a new sensitivity that is proportional to the change from the FOV default // 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"); m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio");
} }

View File

@ -35,6 +35,9 @@ extern cvar_t* cl_musicdir;
// Variables // Variables
#define kvAutoHelp "cl_autohelp" #define kvAutoHelp "cl_autohelp"
// puzl: 1064 The cl var that controls the display of labelled minimaps
#define kvLabelMaps "cl_labelmaps"
// :puzl
#define kvCMHotKeys "cl_cmhotkeys" #define kvCMHotKeys "cl_cmhotkeys"
#define kvForceDefaultFOV "cl_forcedefaultfov" #define kvForceDefaultFOV "cl_forcedefaultfov"
#define kvCenterEntityID "cl_centerentityid" #define kvCenterEntityID "cl_centerentityid"

View File

@ -14,7 +14,7 @@ const int kGroundEndPaletteIndex = 254;
const int kHitNothingPaletteIndex = 255; const int kHitNothingPaletteIndex = 255;
#ifdef AVH_SERVER #ifdef AVH_SERVER
// Network message: // Network message:
// 0: means start processing, pass map name then num samples to process, map width, map height // 0: means start processing, pass map name then num samples to process, map width, map height
// 1: means update, pass num pixels, then data // 1: means update, pass num pixels, then data
// 2: means end processing // 2: means end processing
@ -56,7 +56,7 @@ AvHMiniMap::~AvHMiniMap()
bool AvHMiniMap::GetIsProcessing(float* outPercentageDone) const bool AvHMiniMap::GetIsProcessing(float* outPercentageDone) const
{ {
bool theIsProcessing = false; bool theIsProcessing = false;
if(this->mIsProcessing) if(this->mIsProcessing)
{ {
if(outPercentageDone) if(outPercentageDone)
@ -65,7 +65,7 @@ bool AvHMiniMap::GetIsProcessing(float* outPercentageDone) const
} }
theIsProcessing = true; theIsProcessing = true;
} }
return theIsProcessing; return theIsProcessing;
} }
@ -99,7 +99,7 @@ void AvHMiniMap::BuildMiniMap(const char* inMapName, AvHPlayer* inPlayer, const
this->mMinViewHeight = inMapExtents.GetMinViewHeight();//inMinViewHeight; this->mMinViewHeight = inMapExtents.GetMinViewHeight();//inMinViewHeight;
this->mMaxViewHeight = inMapExtents.GetMaxViewHeight();//inMaxViewHeight; this->mMaxViewHeight = inMapExtents.GetMaxViewHeight();//inMaxViewHeight;
this->mIsProcessing = true; this->mIsProcessing = true;
// Tell player to rebuild minimap // Tell player to rebuild minimap
@ -115,55 +115,55 @@ void AvHMiniMap::BuildMiniMap(const char* inMapName, AvHPlayer* inPlayer, const
bool AvHMiniMap::Process() bool AvHMiniMap::Process()
{ {
bool theProcessingComplete = false; bool theProcessingComplete = false;
if(this->GetIsProcessing()) if(this->GetIsProcessing())
{ {
// Process x pixels // Process x pixels
// If we've calculated them all, return true // If we've calculated them all, return true
// positive y on component is down, but that means negative y in world // positive y on component is down, but that means negative y in world
float theDiffY = this->mMaxY - this->mMinY; float theDiffY = this->mMaxY - this->mMinY;
// left to right // left to right
float theDiffX = this->mMaxX - this->mMinX; float theDiffX = this->mMaxX - this->mMinX;
// Preserve map aspect ratio // Preserve map aspect ratio
float theMapAspectRatio = (this->mMaxX - this->mMinX)/(this->mMaxY - this->mMinY); float theMapAspectRatio = (this->mMaxX - this->mMinX)/(this->mMaxY - this->mMinY);
float theXScale, theYScale; float theXScale, theYScale;
if(theMapAspectRatio > 1.0f) if(theMapAspectRatio > 1.0f)
{ {
theXScale = 1.0f; theXScale = 1.0f;
theYScale = 1.0f/theMapAspectRatio; theYScale = 1.0f/theMapAspectRatio;
} }
else else
{ {
theXScale = 1.0f/theMapAspectRatio; theXScale = 1.0f/theMapAspectRatio;
theYScale = 1.0f; theYScale = 1.0f;
} }
float theMapCenterX = (this->mMinX + this->mMaxX)/2.0f; float theMapCenterX = (this->mMinX + this->mMaxX)/2.0f;
float theMapCenterY = (this->mMinY + this->mMaxY)/2.0f; float theMapCenterY = (this->mMinY + this->mMaxY)/2.0f;
const int kNumPixelsPerCall = 50; const int kNumPixelsPerCall = 50;
char theSampleArray[kNumPixelsPerCall]; char theSampleArray[kNumPixelsPerCall];
memset(theSampleArray, 0, kNumPixelsPerCall); memset(theSampleArray, 0, kNumPixelsPerCall);
for(int i = 0; (i < kNumPixelsPerCall) && (this->mNumSamplesProcessed < this->mNumSamplesToProcess); i++) for(int i = 0; (i < kNumPixelsPerCall) && (this->mNumSamplesProcessed < this->mNumSamplesToProcess); i++)
{ {
int theSampleIndex = this->mNumSamplesProcessed; int theSampleIndex = this->mNumSamplesProcessed;
int theX = theSampleIndex % this->mMapWidth; int theX = theSampleIndex % this->mMapWidth;
int theY = theSampleIndex/this->mMapWidth; int theY = theSampleIndex/this->mMapWidth;
// Initialize the value to outside the map // Initialize the value to outside the map
int theValue = kHitNothingPaletteIndex; int theValue = kHitNothingPaletteIndex;
// Account for map center and aspect ratio // Account for map center and aspect ratio
float theXComponent = (theX/(float)this->mMapWidth) - .5f; float theXComponent = (theX/(float)this->mMapWidth) - .5f;
float theYComponent = (theY/(float)this->mMapHeight) - .5f; float theYComponent = (theY/(float)this->mMapHeight) - .5f;
float theCurrentX = theMapCenterX + theXComponent*theDiffX*theXScale; float theCurrentX = theMapCenterX + theXComponent*theDiffX*theXScale;
float theCurrentY = theMapCenterY - theYComponent*theDiffY*theYScale; float theCurrentY = theMapCenterY - theYComponent*theDiffY*theYScale;
// If the point is inside our map boundaries, do the trace // If the point is inside our map boundaries, do the trace
if((theCurrentX >= this->mMinX) && (theCurrentX <= this->mMaxX) && (theCurrentY >= this->mMinY) && (theCurrentY <= this->mMaxY)) if((theCurrentX >= this->mMinX) && (theCurrentX <= this->mMaxX) && (theCurrentY >= this->mMinY) && (theCurrentY <= this->mMaxY))
{ {
@ -172,27 +172,27 @@ bool AvHMiniMap::Process()
int theUserThree = 0; int theUserThree = 0;
float theHitHeight; float theHitHeight;
float theHeightGradient = 0.0f; float theHeightGradient = 0.0f;
if(AvHSHUTraceVerticalTangible(theCurrentX, theCurrentY, this->mMaxViewHeight, theUserThree, theHitHeight)) if(AvHSHUTraceVerticalTangible(theCurrentX, theCurrentY, this->mMaxViewHeight, theUserThree, theHitHeight))
{ {
// TODO: Modify trace to return world brushes that are hit // TODO: Modify trace to return world brushes that are hit
// Set color to "world brush hit", it will be changed if an entity was hit // Set color to "world brush hit", it will be changed if an entity was hit
theValue = kHitWorldPaletteIndex; theValue = kHitWorldPaletteIndex;
theHitHeight = min(mMaxViewHeight, max(theHitHeight, mMinViewHeight)); theHitHeight = min(mMaxViewHeight, max(theHitHeight, mMinViewHeight));
theHeightGradient = 1.0f - (this->mMaxViewHeight - theHitHeight)/(this->mMaxViewHeight - this->mMinViewHeight); theHeightGradient = 1.0f - (this->mMaxViewHeight - theHitHeight)/(this->mMaxViewHeight - this->mMinViewHeight);
theValue = kGroundStartPaletteIndex + (kGroundEndPaletteIndex - kGroundStartPaletteIndex)*theHeightGradient; theValue = kGroundStartPaletteIndex + (kGroundEndPaletteIndex - kGroundStartPaletteIndex)*theHeightGradient;
} }
} }
int theIndex = theX + theY*this->mMapWidth; int theIndex = theX + theY*this->mMapWidth;
ASSERT(theIndex < this->mNumSamplesToProcess); ASSERT(theIndex < this->mNumSamplesToProcess);
this->mMap[theIndex] = theValue; this->mMap[theIndex] = theValue;
theSampleArray[i] = theValue; theSampleArray[i] = theValue;
this->mNumSamplesProcessed++; this->mNumSamplesProcessed++;
} }
@ -208,7 +208,7 @@ bool AvHMiniMap::Process()
WRITE_BYTE(theSampleArray[j]); WRITE_BYTE(theSampleArray[j]);
} }
MESSAGE_END(); MESSAGE_END();
if(this->mNumSamplesProcessed == this->mNumSamplesToProcess) if(this->mNumSamplesProcessed == this->mNumSamplesToProcess)
{ {
theProcessingComplete = true; theProcessingComplete = true;
@ -219,7 +219,7 @@ bool AvHMiniMap::Process()
MESSAGE_END(); MESSAGE_END();
} }
} }
return theProcessingComplete; return theProcessingComplete;
} }
@ -227,13 +227,18 @@ bool AvHMiniMap::Process()
#ifdef AVH_CLIENT #ifdef AVH_CLIENT
string AvHMiniMap::GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName) string AvHMiniMap::GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels)
{ {
char theWidthString[128]; char theWidthString[128];
sprintf(theWidthString, "%d", inSpriteWidth); sprintf(theWidthString, "%d", inSpriteWidth);
// puzl: 1064
string theMiniMapName = kMiniMapSpritesDirectory + string("/") /*+ string(theWidthString)*/ + inMapName + string(".spr"); // insert _labelled into the filename before ".spr"
//string theMiniMapName = kMiniMapSpritesDirectory + string("/") + inMapName + string(".spr"); string extraname="";
if ( useLabels == 1 ) {
extraname="_labelled";
}
string theMiniMapName = kMiniMapSpritesDirectory + string("/") /*+ string(theWidthString)*/ + inMapName + extraname + string(".spr");
// :puzl
return theMiniMapName; return theMiniMapName;
} }
@ -246,13 +251,13 @@ void AvHMiniMap::InitializePalette()
// char theFillChar = i % 256; // char theFillChar = i % 256;
// memset(this->mMap + i*this->mMapWidth, theFillChar, this->mMapWidth); // memset(this->mMap + i*this->mMapWidth, theFillChar, this->mMapWidth);
// } // }
// //
// Set colors in image to use palette // Set colors in image to use palette
memset(this->mPalette, 0, 256*3); memset(this->mPalette, 0, 256*3);
float theGradient = 0.0f; float theGradient = 0.0f;
for(int i = 0; i < 256; i++) for(int i = 0; i < 256; i++)
{ {
const int kHitWorldR = 29; const int kHitWorldR = 29;
@ -264,11 +269,11 @@ void AvHMiniMap::InitializePalette()
const int kBorderB = 189; const int kBorderB = 189;
uint8* theColor = this->mPalette + i*3; uint8* theColor = this->mPalette + i*3;
if (i >= kGroundStartPaletteIndex && i <= kGroundEndPaletteIndex) if (i >= kGroundStartPaletteIndex && i <= kGroundEndPaletteIndex)
{ {
// Ground start to end // Ground start to end
// Set color according to height, blending to hit world color // Set color according to height, blending to hit world color
theGradient = (float)(i - kGroundStartPaletteIndex)/(kGroundEndPaletteIndex - kGroundStartPaletteIndex); theGradient = (float)(i - kGroundStartPaletteIndex)/(kGroundEndPaletteIndex - kGroundStartPaletteIndex);
theColor[0] = (int)(theGradient*kHitWorldR); theColor[0] = (int)(theGradient*kHitWorldR);
@ -287,7 +292,7 @@ void AvHMiniMap::InitializePalette()
} }
else else
{ {
switch(i) switch(i)
{ {
// On map but inaccessible // On map but inaccessible
@ -296,7 +301,7 @@ void AvHMiniMap::InitializePalette()
theColor[1] = 0; theColor[1] = 0;
theColor[2] = 0; theColor[2] = 0;
break; break;
case kHitWorldPaletteIndex: case kHitWorldPaletteIndex:
theColor[0] = kHitWorldR; theColor[0] = kHitWorldR;
theColor[1] = kHitWorldG; theColor[1] = kHitWorldG;
@ -310,7 +315,7 @@ void AvHMiniMap::InitializePalette()
theColor[2] = 189; theColor[2] = 189;
break; break;
*/ */
} }
} }
@ -343,7 +348,7 @@ int AvHMiniMap::ReceiveFromNetworkStream()
this->mMapHeight = READ_LONG(); this->mMapHeight = READ_LONG();
theBytesRead += 4; theBytesRead += 4;
this->mMap = new uint8[this->mNumSamplesToProcess]; this->mMap = new uint8[this->mNumSamplesToProcess];
memset(this->mMap, 0, this->mNumSamplesToProcess); memset(this->mMap, 0, this->mNumSamplesToProcess);
@ -386,7 +391,7 @@ bool AvHMiniMap::WriteMapToSprite()
if(!this->GetIsProcessing()) if(!this->GetIsProcessing())
{ {
// Open file // Open file
string theSpriteFileName = string(getModDirectory()) + string("/") + GetSpriteNameFromMap(0, this->mMapName); string theSpriteFileName = string(getModDirectory()) + string("/") + GetSpriteNameFromMap(0, this->mMapName, 0);
FILE* theFile = fopen(theSpriteFileName.c_str(), "wb"); FILE* theFile = fopen(theSpriteFileName.c_str(), "wb");
if(theFile) if(theFile)
{ {
@ -395,17 +400,17 @@ bool AvHMiniMap::WriteMapToSprite()
// Copy data // Copy data
memcpy(this->mSpriteData, this->mMap, kSpriteWidth*kSpriteHeight); memcpy(this->mSpriteData, this->mMap, kSpriteWidth*kSpriteHeight);
int theNumFrames = 1; int theNumFrames = 1;
this->WriteMapToSprite(theFile); this->WriteMapToSprite(theFile);
fclose(theFile); fclose(theFile);
theSuccess = true; theSuccess = true;
} }
} }
return theSuccess; return theSuccess;
} }
void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle) void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle)
@ -415,7 +420,7 @@ void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle)
const int spriteWidth = 256; const int spriteWidth = 256;
const int spriteHeight = 256; const int spriteHeight = 256;
int numXFrames = mMapWidth / spriteWidth; int numXFrames = mMapWidth / spriteWidth;
int numYFrames = mMapHeight / spriteHeight; int numYFrames = mMapHeight / spriteHeight;
@ -436,9 +441,9 @@ void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle)
spritetemp.synctype = ST_SYNC; spritetemp.synctype = ST_SYNC;
spritetemp.version = SPRITE_VERSION; spritetemp.version = SPRITE_VERSION;
spritetemp.ident = IDSPRITEHEADER; spritetemp.ident = IDSPRITEHEADER;
SafeWrite(inFileHandle, &spritetemp, sizeof(spritetemp)); SafeWrite(inFileHandle, &spritetemp, sizeof(spritetemp));
short cnt = 256; short cnt = 256;
SafeWrite(inFileHandle, (void *) &cnt, sizeof(cnt)); SafeWrite(inFileHandle, (void *) &cnt, sizeof(cnt));
SafeWrite(inFileHandle, this->mPalette, cnt*3); SafeWrite(inFileHandle, this->mPalette, cnt*3);
@ -450,14 +455,14 @@ void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle)
spriteframetype_t theType = SPR_SINGLE; spriteframetype_t theType = SPR_SINGLE;
SafeWrite ( inFileHandle, &theType, sizeof(theType)); SafeWrite ( inFileHandle, &theType, sizeof(theType));
dspriteframe_t frametemp; dspriteframe_t frametemp;
frametemp.origin[0] = 0; frametemp.origin[0] = 0;
frametemp.origin[1] = 0; frametemp.origin[1] = 0;
frametemp.width = spriteWidth; frametemp.width = spriteWidth;
frametemp.height = spriteHeight; frametemp.height = spriteHeight;
SafeWrite (inFileHandle, &frametemp, sizeof (frametemp)); SafeWrite (inFileHandle, &frametemp, sizeof (frametemp));
for (int i = 0; i < spriteHeight; ++i) for (int i = 0; i < spriteHeight; ++i)
@ -470,14 +475,14 @@ void AvHMiniMap::WriteMapToSprite(FILE* inFileHandle)
spriteframetype_t theType = SPR_SINGLE; spriteframetype_t theType = SPR_SINGLE;
SafeWrite ( inFileHandle, &theType, sizeof(theType)); SafeWrite ( inFileHandle, &theType, sizeof(theType));
dspriteframe_t frametemp; dspriteframe_t frametemp;
frametemp.origin[0] = 0; frametemp.origin[0] = 0;
frametemp.origin[1] = 0; frametemp.origin[1] = 0;
frametemp.width = kSpriteWidth / 2; frametemp.width = kSpriteWidth / 2;
frametemp.height = kSpriteHeight / 2; frametemp.height = kSpriteHeight / 2;
SafeWrite (inFileHandle, &frametemp, sizeof (frametemp)); SafeWrite (inFileHandle, &frametemp, sizeof (frametemp));
SafeWrite (inFileHandle, mCommanderSpriteData, kSpriteDataPixels / 4); SafeWrite (inFileHandle, mCommanderSpriteData, kSpriteDataPixels / 4);
@ -500,11 +505,11 @@ bool AvHMiniMap::WriteSpritesIfJustFinished()
{ {
for (int y = 0; y < kSpriteHeight / 2; ++y) for (int y = 0; y < kSpriteHeight / 2; ++y)
{ {
mCommanderSpriteData[x + y * (kSpriteWidth / 2)] = mCommanderSpriteData[x + y * (kSpriteWidth / 2)] =
mMap[(x * 2) + (y * 2) * kSpriteWidth]; mMap[(x * 2) + (y * 2) * kSpriteWidth];
} }
} }
this->DrawEdges(mMap, kSpriteWidth, kSpriteHeight); this->DrawEdges(mMap, kSpriteWidth, kSpriteHeight);
this->DrawEdges(mCommanderSpriteData, kSpriteWidth / 2, kSpriteHeight / 2); this->DrawEdges(mCommanderSpriteData, kSpriteWidth / 2, kSpriteHeight / 2);
@ -516,7 +521,7 @@ bool AvHMiniMap::WriteSpritesIfJustFinished()
this->mNumSamplesProcessed = this->mNumSamplesToProcess = 0; this->mNumSamplesProcessed = this->mNumSamplesToProcess = 0;
this->mIsProcessing = false; this->mIsProcessing = false;
} }
// For each resolution // For each resolution
return theSuccess; return theSuccess;
} }
@ -528,14 +533,14 @@ void AvHMiniMap::DrawEdges(uint8* inMap, int width, int height)
uint8* newMap = new uint8[numPixels]; uint8* newMap = new uint8[numPixels];
memset(newMap, kHitNothingPaletteIndex, numPixels); memset(newMap, kHitNothingPaletteIndex, numPixels);
for (int y = 1; y < width - 1; ++y) for (int y = 1; y < width - 1; ++y)
{ {
for (int x = 1; x < height - 1; ++x) for (int x = 1; x < height - 1; ++x)
{ {
int baseIndex = x + y * width; int baseIndex = x + y * width;
int color = inMap[baseIndex]; int color = inMap[baseIndex];
if (color == kHitNothingPaletteIndex) if (color == kHitNothingPaletteIndex)
{ {
@ -577,7 +582,7 @@ void AvHMiniMap::DrawEdges(uint8* inMap, int width, int height)
*/ */
} }
newMap[baseIndex] = color; newMap[baseIndex] = color;
} }

View File

@ -28,21 +28,21 @@ class AvHMiniMap
public: public:
AvHMiniMap(); AvHMiniMap();
virtual ~AvHMiniMap(); virtual ~AvHMiniMap();
bool GetIsProcessing(float* outPercentageDone = NULL) const; bool GetIsProcessing(float* outPercentageDone = NULL) const;
#ifdef AVH_SERVER #ifdef AVH_SERVER
void BuildMiniMap(const char* inMapName, AvHPlayer* inPlayer, const AvHMapExtents& inMapExtents); void BuildMiniMap(const char* inMapName, AvHPlayer* inPlayer, const AvHMapExtents& inMapExtents);
bool Process(); bool Process();
#endif #endif
#ifdef AVH_CLIENT #ifdef AVH_CLIENT
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName); static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels);
int ReceiveFromNetworkStream(); int ReceiveFromNetworkStream();
bool WriteSpritesIfJustFinished(); bool WriteSpritesIfJustFinished();
#endif #endif
private: private:
#ifdef AVH_CLIENT #ifdef AVH_CLIENT
void DrawEdges(uint8* inMap, int width, int height); void DrawEdges(uint8* inMap, int width, int height);
@ -50,7 +50,7 @@ private:
bool WriteMapToSprite(); bool WriteMapToSprite();
void WriteMapToSprite(FILE* inFileHandle); void WriteMapToSprite(FILE* inFileHandle);
#endif #endif
uint8* mMap; uint8* mMap;
int mMapWidth; int mMapWidth;
int mMapHeight; int mMapHeight;
@ -64,14 +64,14 @@ private:
uint8 mSpriteData[kSpriteDataPixels]; uint8 mSpriteData[kSpriteDataPixels];
uint8 mCommanderSpriteData[kSpriteDataPixels / 4]; uint8 mCommanderSpriteData[kSpriteDataPixels / 4];
#endif #endif
float mMinX; float mMinX;
float mMinY; float mMinY;
float mMaxX; float mMaxX;
float mMaxY; float mMaxY;
float mMinViewHeight; float mMinViewHeight;
float mMaxViewHeight; float mMaxViewHeight;
int mNumSamplesToProcess; int mNumSamplesToProcess;
int mNumSamplesProcessed; int mNumSamplesProcessed;
bool mIsProcessing; bool mIsProcessing;

View File

@ -12,7 +12,7 @@
#include "mod/AvHPlayerUpgrade.h" #include "mod/AvHPlayerUpgrade.h"
#include "mod/AvHSpriteAPI.h" #include "mod/AvHSpriteAPI.h"
#include "mod/AvHSprites.h" #include "mod/AvHSprites.h"
#include "mod/AvHClientVariables.h"
using std::string; using std::string;
@ -20,10 +20,10 @@ class DrawingOrderSort
{ {
public: public:
bool operator()(const DrawableEntity& entity1, const DrawableEntity& entity2) bool operator()(const DrawableEntity& entity1, const DrawableEntity& entity2)
{ {
// Draw resource nodes all the way on the bottom. // Draw resource nodes all the way on the bottom.
if (entity1.mUser3 == AVH_USER3_FUNC_RESOURCE) if (entity1.mUser3 == AVH_USER3_FUNC_RESOURCE)
@ -52,13 +52,13 @@ public:
{ {
return true; return true;
} }
// Draw players on top of structures. // Draw players on top of structures.
return (entity1.mEntityNumber > entity2.mEntityNumber); return (entity1.mEntityNumber > entity2.mEntityNumber);
} }
}; };
AvHOverviewMap::AvHOverviewMap() AvHOverviewMap::AvHOverviewMap()
@ -89,9 +89,9 @@ void AvHOverviewMap::Clear()
void AvHOverviewMap::GetSpriteForEntity(const DrawableEntity& entity, int& outSprite, int& outFrame, int& outRenderMode) void AvHOverviewMap::GetSpriteForEntity(const DrawableEntity& entity, int& outSprite, int& outFrame, int& outRenderMode)
{ {
outRenderMode = kRenderTransTexture; outRenderMode = kRenderTransTexture;
if ((this->mUser3 == AVH_USER3_COMMANDER_PLAYER) || (entity.mUser3 == AVH_USER3_UNKNOWN)) if ((this->mUser3 == AVH_USER3_COMMANDER_PLAYER) || (entity.mUser3 == AVH_USER3_UNKNOWN))
{ {
outSprite = Safe_SPR_Load(kCommBlipSprite); outSprite = Safe_SPR_Load(kCommBlipSprite);
@ -115,7 +115,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
} }
else if (entity.mTeam == TEAM_IND) else if (entity.mTeam == TEAM_IND)
{ {
if (entity.mUser3 == AVH_USER3_WELD) if (entity.mUser3 == AVH_USER3_WELD)
{ {
outR = 1.0; outR = 1.0;
@ -168,7 +168,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
// Color squads. // Color squads.
int localPlayerSquad; int localPlayerSquad;
if (g_iUser1 == OBS_NONE) if (g_iUser1 == OBS_NONE)
{ {
localPlayerSquad = gHUD.GetCurrentSquad(); localPlayerSquad = gHUD.GetCurrentSquad();
@ -182,7 +182,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
if (mUser3 != AVH_USER3_COMMANDER_PLAYER) if (mUser3 != AVH_USER3_COMMANDER_PLAYER)
{ {
if (entity.mIsLocalPlayer || if (entity.mIsLocalPlayer ||
(entity.mSquadNumber != 0 && (entity.mSquadNumber != 0 &&
entity.mSquadNumber == localPlayerSquad)) entity.mSquadNumber == localPlayerSquad))
{ {
@ -207,7 +207,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const DrawableEntity& inEntity) void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const DrawableEntity& inEntity)
{ {
if (!GetHasData()) if (!GetHasData())
{ {
return; return;
@ -229,10 +229,10 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
int theRenderMode; int theRenderMode;
GetSpriteForEntity(inEntity, theSprite, theFrame, theRenderMode); GetSpriteForEntity(inEntity, theSprite, theFrame, theRenderMode);
if (theSprite > 0) if (theSprite > 0)
{ {
int theSprWidth = SPR_Width(theSprite, theFrame); int theSprWidth = SPR_Width(theSprite, theFrame);
int theSprHeight = SPR_Height(theSprite, theFrame); int theSprHeight = SPR_Height(theSprite, theFrame);
@ -249,7 +249,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
bool isPlayer = inEntity.mUser3 == AVH_USER3_MARINE_PLAYER || inEntity.mUser3 == AVH_USER3_HEAVY; //heavy used for player in minimap system bool isPlayer = inEntity.mUser3 == AVH_USER3_MARINE_PLAYER || inEntity.mUser3 == AVH_USER3_HEAVY; //heavy used for player in minimap system
bool theIsWaypoint = inEntity.mUser3 == AVH_USER3_WAYPOINT; bool theIsWaypoint = inEntity.mUser3 == AVH_USER3_WAYPOINT;
float w = theSprWidth * scale; float w = theSprWidth * scale;
float h = theSprHeight * scale; float h = theSprHeight * scale;
@ -258,13 +258,13 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
float x = entityMiniMapX - w / 2.0f; float x = entityMiniMapX - w / 2.0f;
float y = entityMiniMapY - h / 2.0f; float y = entityMiniMapY - h / 2.0f;
if (theIsWaypoint) if (theIsWaypoint)
{ {
float theFractionalLastUpdate = mLastUpdateTime - (int)mLastUpdateTime; float theFractionalLastUpdate = mLastUpdateTime - (int)mLastUpdateTime;
if (theFractionalLastUpdate < .25f) if (theFractionalLastUpdate < .25f)
{ {
return; return;
} }
@ -279,12 +279,12 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
GetColorForEntity(inEntity, r, g, b); GetColorForEntity(inEntity, r, g, b);
AvHSpriteSetColor(r, g, b); AvHSpriteSetColor(r, g, b);
// If it's the local player, draw the FOV. // If it's the local player, draw the FOV.
if (inEntity.mIsLocalPlayer && mUser3 != AVH_USER3_COMMANDER_PLAYER) if (inEntity.mIsLocalPlayer && mUser3 != AVH_USER3_COMMANDER_PLAYER)
{ {
int theSprite = Safe_SPR_Load("sprites/fov.spr"); int theSprite = Safe_SPR_Load("sprites/fov.spr");
int theFrame = 0; int theFrame = 0;
@ -298,7 +298,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
float y2 = entityMiniMapY - h2 / 2; float y2 = entityMiniMapY - h2 / 2;
AvHSpriteSetRotation(-inEntity.mAngleRadians * 180 / M_PI, x2, y2 + h2 / 2); AvHSpriteSetRotation(-inEntity.mAngleRadians * 180 / M_PI, x2, y2 + h2 / 2);
AvHSpriteSetColor(1, 1, 1); AvHSpriteSetColor(1, 1, 1);
AvHSpriteSetRenderMode(kRenderTransAdd); AvHSpriteSetRenderMode(kRenderTransAdd);
AvHSpriteDraw(theSprite, theFrame, x2, y2, x2 + w2, y2 + h2, 0, 0, 1, 1); AvHSpriteDraw(theSprite, theFrame, x2, y2, x2 + w2, y2 + h2, 0, 0, 1, 1);
@ -362,7 +362,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
} }
AvHSpriteSetRenderMode(renderMode); AvHSpriteSetRenderMode(renderMode);
float r, g, b; float r, g, b;
GetColorForEntity(inEntity, r, g, b); GetColorForEntity(inEntity, r, g, b);
@ -373,7 +373,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
} }
} }
} }
} }
@ -414,13 +414,30 @@ void AvHOverviewMap::KillOldAlerts(float inCurrentTime)
void AvHOverviewMap::DrawMiniMap(const DrawInfo& inDrawInfo) void AvHOverviewMap::DrawMiniMap(const DrawInfo& inDrawInfo)
{ {
// Load the mini-map sprite if it's not already loaded. // puzl: 1064
// Use labelled minimaps if cl_labelmaps is 1
if (!mMiniMapSprite && (mMapName != "")) // Load the mini-map sprite if it's not already loaded.
{ static string lastMiniMapName="";
string theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName); if ( mMapName != "") {
mMiniMapSprite = Safe_SPR_Load(theMiniMapName.c_str()); int drawLabels=CVAR_GET_FLOAT(kvLabelMaps);
} string theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName, drawLabels);
if ( lastMiniMapName != theMiniMapName )
{
mMiniMapSprite = Safe_SPR_Load(theMiniMapName.c_str());
// We want to preserve the last minimap even if we fail. There's no point in failing again until the player
// changes the value of the cvar.
lastMiniMapName=theMiniMapName;
// Draw normal minimap if no labelled map exists ( for custom maps )
if ( !mMiniMapSprite && drawLabels ) {
theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName, 0);
mMiniMapSprite = Safe_SPR_Load(theMiniMapName.c_str());
}
}
}
// :puzl
if (!mMiniMapSprite) if (!mMiniMapSprite)
{ {
@ -434,14 +451,14 @@ void AvHOverviewMap::DrawMiniMap(const DrawInfo& inDrawInfo)
float mapYCenter = (mMapExtents.GetMaxMapY() + mMapExtents.GetMinMapY()) / 2; float mapYCenter = (mMapExtents.GetMaxMapY() + mMapExtents.GetMinMapY()) / 2;
float aspectRatio = mapXSize / mapYSize; float aspectRatio = mapXSize / mapYSize;
float xScale; float xScale;
float yScale; float yScale;
if(mapXSize > mapYSize) if(mapXSize > mapYSize)
{ {
xScale = 1.0f; xScale = 1.0f;
yScale = mapYSize / mapXSize; yScale = mapYSize / mapXSize;
} }
else else
{ {
@ -464,7 +481,7 @@ void AvHOverviewMap::DrawMiniMap(const DrawInfo& inDrawInfo)
AvHSpriteSetRotation(0, 0, 0); AvHSpriteSetRotation(0, 0, 0);
// TODO this should be based on a flag not the user3 // TODO this should be based on a flag not the user3
if (mUser3 == AVH_USER3_COMMANDER_PLAYER) if (mUser3 == AVH_USER3_COMMANDER_PLAYER)
{ {
// Use the small map if it's the commander view. // Use the small map if it's the commander view.
@ -499,7 +516,7 @@ void AvHOverviewMap::DrawAlerts(const DrawInfo& inDrawInfo)
int theWidth = inDrawInfo.mWidth; int theWidth = inDrawInfo.mWidth;
int theHeight = inDrawInfo.mHeight; int theHeight = inDrawInfo.mHeight;
AvHSpriteEnableClippingRect(true); AvHSpriteEnableClippingRect(true);
AvHSpriteSetClippingRect(theX, theY, theX + theWidth, theY + theHeight); AvHSpriteSetClippingRect(theX, theY, theX + theWidth, theY + theHeight);
@ -516,7 +533,7 @@ void AvHOverviewMap::DrawAlerts(const DrawInfo& inDrawInfo)
for (unsigned int i = 0; i < mAlertList.size(); ++i) for (unsigned int i = 0; i < mAlertList.size(); ++i)
{ {
float maxAlertSize = 5; float maxAlertSize = 5;
float minAlertSize = 0.4; float minAlertSize = 0.4;
@ -530,11 +547,11 @@ void AvHOverviewMap::DrawAlerts(const DrawInfo& inDrawInfo)
float w = theSprWidth * scale; float w = theSprWidth * scale;
float h = theSprHeight * scale; float h = theSprHeight * scale;
float cx = mAlertList[i].mX; float cx = mAlertList[i].mX;
float cy = mAlertList[i].mY; float cy = mAlertList[i].mY;
WorldToMiniMapCoords(inDrawInfo, cx, cy); WorldToMiniMapCoords(inDrawInfo, cx, cy);
float angle = dt * 180; float angle = dt * 180;
@ -551,20 +568,20 @@ void AvHOverviewMap::DrawAlerts(const DrawInfo& inDrawInfo)
AvHSpriteSetRotation(angle, cx, cy); AvHSpriteSetRotation(angle, cx, cy);
AvHSpriteDraw(theSprite, theFrame, cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2, 0, 0, 1, 1); AvHSpriteDraw(theSprite, theFrame, cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2, 0, 0, 1, 1);
} }
} }
void AvHOverviewMap::AddAlert(float x, float y) void AvHOverviewMap::AddAlert(float x, float y)
{ {
MapAlert alert; MapAlert alert;
alert.mStartTime = mLastUpdateTime; alert.mStartTime = mLastUpdateTime;
alert.mExpireTime = mLastUpdateTime + BALANCE_FVAR(kAlertExpireTime) / 5; alert.mExpireTime = mLastUpdateTime + BALANCE_FVAR(kAlertExpireTime) / 5;
alert.mX = x; alert.mX = x;
alert.mY = y; alert.mY = y;
mAlertList.push_back(alert); mAlertList.push_back(alert);
} }
@ -581,11 +598,11 @@ void AvHOverviewMap::Draw(const DrawInfo& inDrawInfo)
AvHSpriteEnableClippingRect(true); AvHSpriteEnableClippingRect(true);
AvHSpriteSetClippingRect(theX, theY, theX + theCompWidth, theY + theCompHeight); AvHSpriteSetClippingRect(theX, theY, theX + theCompWidth, theY + theCompHeight);
// Draw the minimap background. // Draw the minimap background.
DrawMiniMap(inDrawInfo); DrawMiniMap(inDrawInfo);
// Draw the entities on the minimap. // Draw the entities on the minimap.
if (mUser3 == AVH_USER3_COMMANDER_PLAYER) if (mUser3 == AVH_USER3_COMMANDER_PLAYER)
@ -599,33 +616,33 @@ void AvHOverviewMap::Draw(const DrawInfo& inDrawInfo)
} }
// Draw the way points as entities. // Draw the way points as entities.
{ {
for (MapOrderListType::const_iterator theIter = mMapOrderList.begin(); theIter != mMapOrderList.end(); theIter++) for (MapOrderListType::const_iterator theIter = mMapOrderList.begin(); theIter != mMapOrderList.end(); theIter++)
{ {
DrawableEntity drawableEntity; DrawableEntity drawableEntity;
drawableEntity.mUser3 = AVH_USER3_WAYPOINT; drawableEntity.mUser3 = AVH_USER3_WAYPOINT;
drawableEntity.mX = theIter->mX; drawableEntity.mX = theIter->mX;
drawableEntity.mY = theIter->mY; drawableEntity.mY = theIter->mY;
DrawMiniMapEntity(inDrawInfo, drawableEntity); DrawMiniMapEntity(inDrawInfo, drawableEntity);
} }
} }
// Draw the alerts. // Draw the alerts.
DrawAlerts(inDrawInfo); DrawAlerts(inDrawInfo);
// Draw the reticle. // Draw the reticle.
if(this->mUser3 == AVH_USER3_COMMANDER_PLAYER) if(this->mUser3 == AVH_USER3_COMMANDER_PLAYER)
{ {
int theFrame = 0; int theFrame = 0;
if (!this->mReticleSprite) if (!this->mReticleSprite)
{ {
this->mReticleSprite = Safe_SPR_Load(kReticleSprite); this->mReticleSprite = Safe_SPR_Load(kReticleSprite);
@ -662,16 +679,16 @@ int AvHOverviewMap::GetEntityAtWorldPosition(float inWorldX, float inWorldY, flo
for (int i = 0; i < (int)mDrawableEntityList.size(); ++i) for (int i = 0; i < (int)mDrawableEntityList.size(); ++i)
{ {
float dx = mDrawableEntityList[i].mX - inWorldX; float dx = mDrawableEntityList[i].mX - inWorldX;
float dy = mDrawableEntityList[i].mY - inWorldY; float dy = mDrawableEntityList[i].mY - inWorldY;
if (dx * dx + dy * dy < inRadius * inRadius) if (dx * dx + dy * dy < inRadius * inRadius)
{ {
return mDrawableEntityList[i].mEntityNumber; return mDrawableEntityList[i].mEntityNumber;
} }
} }
return 0; return 0;
@ -726,25 +743,25 @@ void AvHOverviewMap::Update(float inCurrentTime)
void AvHOverviewMap::UpdateDrawData(float inCurrentTime) void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
{ {
int theLocalPlayerIndex; int theLocalPlayerIndex;
if (g_iUser1 == OBS_NONE) if (g_iUser1 == OBS_NONE)
{ {
cl_entity_s* thePlayer = gEngfuncs.GetLocalPlayer(); cl_entity_s* thePlayer = gEngfuncs.GetLocalPlayer();
theLocalPlayerIndex = thePlayer->index; theLocalPlayerIndex = thePlayer->index;
} }
else else
{ {
theLocalPlayerIndex = g_iUser2; theLocalPlayerIndex = g_iUser2;
} }
cl_entity_s* thePlayer = gEngfuncs.GetEntityByIndex(theLocalPlayerIndex); cl_entity_s* thePlayer = gEngfuncs.GetEntityByIndex(theLocalPlayerIndex);
mTeam = (AvHTeamNumber)(thePlayer->curstate.team); mTeam = (AvHTeamNumber)(thePlayer->curstate.team);
// Clear list of drawable entities // Clear list of drawable entities
this->mDrawableEntityList.clear(); this->mDrawableEntityList.clear();
// Get all entities // Get all entities
MapEntityMap theEntityList; MapEntityMap theEntityList;
gHUD.GetEntityHierarchy().GetEntityInfoList(theEntityList); gHUD.GetEntityHierarchy().GetEntityInfoList(theEntityList);
@ -773,11 +790,11 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
// Get additional information about the entity from the client state. // Get additional information about the entity from the client state.
cl_entity_t* clientEntity = gEngfuncs.GetEntityByIndex(theDrawableEntity.mEntityNumber); cl_entity_t* clientEntity = gEngfuncs.GetEntityByIndex(theDrawableEntity.mEntityNumber);
if(clientEntity) if(clientEntity)
{ {
if (clientEntity->index >= 32) if (clientEntity->index >= 32)
{ {
theDrawableEntity.mAngleRadians = clientEntity->angles[1] * M_PI / 180; theDrawableEntity.mAngleRadians = clientEntity->angles[1] * M_PI / 180;
@ -785,19 +802,19 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
// Update the information for this entity from the client information // Update the information for this entity from the client information
// if they're in the local player's PVS. // if they're in the local player's PVS.
// We really want to check if the client data is more recent than the // We really want to check if the client data is more recent than the
// minimap data, but I don't know how to get the timestamp on the minimap // minimap data, but I don't know how to get the timestamp on the minimap
// data. // data.
if (clientEntity->curstate.messagenum >= thePlayer->curstate.messagenum) if (clientEntity->curstate.messagenum >= thePlayer->curstate.messagenum)
{ {
//theDrawableEntity.mUser3 = (AvHUser3)(clientEntity->curstate.iuser3); //theDrawableEntity.mUser3 = (AvHUser3)(clientEntity->curstate.iuser3);
// Brush entities don't have the correct position information, so // Brush entities don't have the correct position information, so
// don't update them from the client data. // don't update them from the client data.
if (theDrawableEntity.mUser3 != AVH_USER3_WELD) if (theDrawableEntity.mUser3 != AVH_USER3_WELD)
{ {
@ -809,28 +826,28 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
} }
else else
{ {
// If the difference between the minimap position and the client data // If the difference between the minimap position and the client data
// position is less than the minimap quantization error, then use // position is less than the minimap quantization error, then use
// the client position to avoid popping when the entity goes out of the // the client position to avoid popping when the entity goes out of the
// PVS. // PVS.
float dx = fabs(theDrawableEntity.mX - clientEntity->origin.x); float dx = fabs(theDrawableEntity.mX - clientEntity->origin.x);
float dy = fabs(theDrawableEntity.mY - clientEntity->origin.y); float dy = fabs(theDrawableEntity.mY - clientEntity->origin.y);
if (dx < kPositionNetworkConstant && dy < kPositionNetworkConstant) if (dx < kPositionNetworkConstant && dy < kPositionNetworkConstant)
{ {
theDrawableEntity.mX = clientEntity->origin.x; theDrawableEntity.mX = clientEntity->origin.x;
theDrawableEntity.mY = clientEntity->origin.y; theDrawableEntity.mY = clientEntity->origin.y;
} }
} }
if (theDrawableEntity.mUser3 != AVH_USER3_COMMANDER_PLAYER) if (theDrawableEntity.mUser3 != AVH_USER3_COMMANDER_PLAYER)
{ {
this->mDrawableEntityList.push_back(theDrawableEntity); this->mDrawableEntityList.push_back(theDrawableEntity);
} }
} }
} }
@ -849,7 +866,7 @@ void AvHOverviewMap::UpdateOrders(const OrderListType& inOrderList, const Entity
{ {
return; return;
} }
for (OrderListType::const_iterator theIter = inOrderList.begin(); theIter != inOrderList.end(); ++theIter) for (OrderListType::const_iterator theIter = inOrderList.begin(); theIter != inOrderList.end(); ++theIter)
{ {
@ -861,18 +878,18 @@ void AvHOverviewMap::UpdateOrders(const OrderListType& inOrderList, const Entity
{ {
theDrawWaypoint = true; theDrawWaypoint = true;
} }
if (theDrawWaypoint) if (theDrawWaypoint)
{ {
vec3_t position; vec3_t position;
theIter->GetLocation(position); theIter->GetLocation(position);
MapOrder mapOrder; MapOrder mapOrder;
mapOrder.mX = position[0]; mapOrder.mX = position[0];
mapOrder.mY = position[1]; mapOrder.mY = position[1];
mMapOrderList.push_back(mapOrder); mMapOrderList.push_back(mapOrder);
} }

View File

@ -32,7 +32,7 @@
// Half-Life User Info Configuration Layout Script (stores last settings chosen, too) // Half-Life User Info Configuration Layout Script (stores last settings chosen, too)
// File generated: Mon Jul 05 15:16:31 AM // File generated: Sun Jun 19 15:41:20 AM
// //
// //
// Cvar - Setting // Cvar - Setting
@ -49,11 +49,18 @@ DESCRIPTION INFO_OPTIONS
SetInfo SetInfo
} }
"cl_labelmaps"
{
"Draw location names"
{ BOOL }
{ "1" }
}
"cl_centerentityid" "cl_centerentityid"
{ {
"Center player names" "Center player names"
{ BOOL } { BOOL }
{ "1" } { "0" }
} }
"cl_highdetail" "cl_highdetail"
@ -88,14 +95,14 @@ DESCRIPTION INFO_OPTIONS
{ {
"Weapon fast-switch" "Weapon fast-switch"
{ BOOL } { BOOL }
{ "0" } { "1" }
} }
"cl_musicenabled" "cl_musicenabled"
{ {
"Music enabled" "Music enabled"
{ BOOL } { BOOL }
{ "0" } { "1" }
} }
"cl_musicvolume" "cl_musicvolume"