mirror of
https://github.com/unknownworlds/NS.git
synced 2025-01-18 23:11:49 +00:00
o Added labelled minimaps
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@198 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
2581c48cfc
commit
dae5cc64f9
7 changed files with 196 additions and 161 deletions
|
@ -92,6 +92,7 @@ cl_forcedefaultfov "0"
|
|||
cl_highdetail "1"
|
||||
cl_himodels "0"
|
||||
cl_idealpitchscale "0.8"
|
||||
cl_labelmaps "1"
|
||||
cl_lc "1"
|
||||
cl_logocolor "#Valve_Orange"
|
||||
cl_logofile "lambda"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "ui/UIComponent.h"
|
||||
#include "vgui_scorepanel.h"
|
||||
|
||||
#include "mod/AvHClientVariables.h"
|
||||
#include "mod/ChatPanel.h"
|
||||
|
||||
class CHLVoiceStatusHelper : public IVoiceStatusHelper
|
||||
|
@ -356,6 +357,7 @@ void CHud :: Init( void )
|
|||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||
|
||||
CVAR_CREATE( "cl_showspeed", "0", 0);
|
||||
CVAR_CREATE( kvLabelMaps, "0", FCVAR_ARCHIVE);
|
||||
|
||||
m_pSpriteList = NULL;
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ extern cvar_t* cl_musicdir;
|
|||
|
||||
// Variables
|
||||
#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 kvForceDefaultFOV "cl_forcedefaultfov"
|
||||
#define kvCenterEntityID "cl_centerentityid"
|
||||
|
|
|
@ -227,13 +227,18 @@ bool AvHMiniMap::Process()
|
|||
|
||||
|
||||
#ifdef AVH_CLIENT
|
||||
string AvHMiniMap::GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName)
|
||||
string AvHMiniMap::GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels)
|
||||
{
|
||||
char theWidthString[128];
|
||||
sprintf(theWidthString, "%d", inSpriteWidth);
|
||||
|
||||
string theMiniMapName = kMiniMapSpritesDirectory + string("/") /*+ string(theWidthString)*/ + inMapName + string(".spr");
|
||||
//string theMiniMapName = kMiniMapSpritesDirectory + string("/") + inMapName + string(".spr");
|
||||
// puzl: 1064
|
||||
// insert _labelled into the filename before ".spr"
|
||||
string extraname="";
|
||||
if ( useLabels == 1 ) {
|
||||
extraname="_labelled";
|
||||
}
|
||||
string theMiniMapName = kMiniMapSpritesDirectory + string("/") /*+ string(theWidthString)*/ + inMapName + extraname + string(".spr");
|
||||
// :puzl
|
||||
return theMiniMapName;
|
||||
}
|
||||
|
||||
|
@ -386,7 +391,7 @@ bool AvHMiniMap::WriteMapToSprite()
|
|||
if(!this->GetIsProcessing())
|
||||
{
|
||||
// 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");
|
||||
if(theFile)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef AVH_CLIENT
|
||||
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName);
|
||||
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels);
|
||||
int ReceiveFromNetworkStream();
|
||||
bool WriteSpritesIfJustFinished();
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "mod/AvHPlayerUpgrade.h"
|
||||
#include "mod/AvHSpriteAPI.h"
|
||||
#include "mod/AvHSprites.h"
|
||||
|
||||
#include "mod/AvHClientVariables.h"
|
||||
using std::string;
|
||||
|
||||
|
||||
|
@ -414,13 +414,30 @@ void AvHOverviewMap::KillOldAlerts(float inCurrentTime)
|
|||
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 != ""))
|
||||
{
|
||||
string theMiniMapName = AvHMiniMap::GetSpriteNameFromMap(ScreenWidth(), mMapName);
|
||||
mMiniMapSprite = Safe_SPR_Load(theMiniMapName.c_str());
|
||||
}
|
||||
// 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 )
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
|
||||
// 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
|
||||
|
@ -49,11 +49,18 @@ DESCRIPTION INFO_OPTIONS
|
|||
SetInfo
|
||||
}
|
||||
|
||||
"cl_labelmaps"
|
||||
{
|
||||
"Draw location names"
|
||||
{ BOOL }
|
||||
{ "1" }
|
||||
}
|
||||
|
||||
"cl_centerentityid"
|
||||
{
|
||||
"Center player names"
|
||||
{ BOOL }
|
||||
{ "1" }
|
||||
{ "0" }
|
||||
}
|
||||
|
||||
"cl_highdetail"
|
||||
|
@ -88,14 +95,14 @@ DESCRIPTION INFO_OPTIONS
|
|||
{
|
||||
"Weapon fast-switch"
|
||||
{ BOOL }
|
||||
{ "0" }
|
||||
{ "1" }
|
||||
}
|
||||
|
||||
"cl_musicenabled"
|
||||
{
|
||||
"Music enabled"
|
||||
{ BOOL }
|
||||
{ "0" }
|
||||
{ "1" }
|
||||
}
|
||||
|
||||
"cl_musicvolume"
|
||||
|
|
Loading…
Reference in a new issue