Mantis: 1064

o Added new setting to advanced multiplayer options.  Default value is 'on'
o cvar is cl_labelmaps ( default 1 )
o If the cvar is changed the map sprite will dynamically update.
o If no labelled minimap exists the default one is displayed
o We always write a generated minimap to the normal file

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@165 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2005-06-08 00:43:30 +00:00
parent 8bcf4a9a33
commit e50079c075
35 changed files with 51 additions and 12 deletions

View file

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

View file

@ -33,7 +33,7 @@
#include "mod/AvHNetworkMessages.h"
#include "ui/ChatPanel.h"
#include "mod/AvHClientVariables.h"
// tankefugl: duck toggle
bool g_bDuckToggled;
// :tankefugl
@ -207,6 +207,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;

View file

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

View file

@ -218,13 +218,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;
}
@ -325,7 +330,10 @@ bool AvHMiniMap::WriteMapToSprite()
if(!this->GetIsProcessing())
{
// Open file
string theSpriteFileName = string(getModDirectory()) + string("/") + GetSpriteNameFromMap(0, this->mMapName);
// puzl: 1064
// We always want to use the normal filename when generating a minimap
string theSpriteFileName = string(getModDirectory()) + string("/") + GetSpriteNameFromMap(0, this->mMapName, 0);
// :puzl
FILE* theFile = fopen(theSpriteFileName.c_str(), "wb");
if(theFile)
{

View file

@ -29,7 +29,9 @@ public:
#endif
#ifdef AVH_CLIENT
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName);
// puzl: 1064
// Allow the caller to specify the use of the labelled minimap
static string GetSpriteNameFromMap(int inSpriteWidth, const string& inMapName, int useLabels);
int ReceiveFromNetworkStream(void* const buffer, const int size);
bool WriteSpritesIfJustFinished();
#endif

View file

@ -12,6 +12,7 @@
#include "mod/AvHPlayerUpgrade.h"
#include "mod/AvHSpriteAPI.h"
#include "mod/AvHSprites.h"
#include "mod/AvHClientVariables.h"
using std::string;
@ -414,14 +415,30 @@ void AvHOverviewMap::KillOldAlerts(float inCurrentTime)
void AvHOverviewMap::DrawMiniMap(const DrawInfo& inDrawInfo)
{
// puzl: 1064
// Use labelled minimaps if cl_labelmaps is 1
// 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());
if (!mMiniMapSprite && (mMapName != ""))
{
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());
}
}
}
// :puzl
if (!mMiniMapSprite)
{
return;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -49,6 +49,13 @@ DESCRIPTION INFO_OPTIONS
SetInfo
}
"cl_labelmaps"
{
"Draw location names"
{ BOOL }
{ "1" }
}
"cl_centerentityid"
{
"Center player names"