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

@ -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
@ -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;

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

@ -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;
} }
@ -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)
{ {

View file

@ -37,7 +37,7 @@ public:
#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

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;
@ -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="";
if ( mMapName != "") {
int drawLabels=CVAR_GET_FLOAT(kvLabelMaps);
string theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName, drawLabels);
if ( lastMiniMapName != theMiniMapName )
{ {
string theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName); 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()); mMiniMapSprite = Safe_SPR_Load(theMiniMapName.c_str());
} }
}
}
// :puzl
if (!mMiniMapSprite) if (!mMiniMapSprite)
{ {

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"