diff --git a/releases/valve/cl_dlls/client.dll b/releases/valve/cl_dlls/client.dll index a5a23aa5..0cb6060e 100644 Binary files a/releases/valve/cl_dlls/client.dll and b/releases/valve/cl_dlls/client.dll differ diff --git a/releases/valve/dlls/ns.dll b/releases/valve/dlls/ns.dll index da1d7d9b..c772b999 100644 Binary files a/releases/valve/dlls/ns.dll and b/releases/valve/dlls/ns.dll differ diff --git a/releases/valve/source/cl_dll/cdll_int.cpp b/releases/valve/source/cl_dll/cdll_int.cpp index f9cba9d5..138bd7de 100644 --- a/releases/valve/source/cl_dll/cdll_int.cpp +++ b/releases/valve/source/cl_dll/cdll_int.cpp @@ -49,7 +49,7 @@ cl_enginefunc_t gEngfuncs; //UIHud gHUD("StratHL/ui.txt", new AvHUIFactory()); AvHHud& getHUD() { - static AvHHud theGlobalHud( (string(getModDirectory()) + string("/ui.txt")).c_str(), new AvHUIFactory()); + static AvHHud theGlobalHud( "ui.txt", new AvHUIFactory()); return theGlobalHud; } diff --git a/releases/valve/source/mod/AvHGamerules.cpp b/releases/valve/source/mod/AvHGamerules.cpp index 7f66cb74..b615829e 100644 --- a/releases/valve/source/mod/AvHGamerules.cpp +++ b/releases/valve/source/mod/AvHGamerules.cpp @@ -2059,22 +2059,37 @@ void AvHGamerules::PreWorldPrecacheInitParticles() // Load up the particle systems from modname.ps then levelname.ps TRDescriptionList theDescriptionList; - string theLevelBaseSystemFile = string(getModDirectory()) + "/" + kBasePSName; - if(TRFactory::ReadDescriptions(theLevelBaseSystemFile, theDescriptionList)) + + char *pbuffer = NULL; + int len; + // Read them in from proper file + pbuffer = (char *)LOAD_FILE_FOR_ME( kBasePSName, &len ); // Use malloc + ASSERT(pbuffer); + + strstream trstream(pbuffer, len); + if(TRFactory::ReadDescriptions(trstream, theDescriptionList)) { gParticleTemplateList.CreateTemplates(theDescriptionList); } theDescriptionList.clear(); + FREE_FILE(pbuffer); // TODO: the level name isn't populated yet for some reason const char* theCStrLevelName = STRING(gpGlobals->mapname); if(theCStrLevelName && !FStrEq(theCStrLevelName, "")) { string theLevelName = theCStrLevelName; - string theLevelParticleSystemFile = string(getModDirectory()) + string("/") + theLevelName + string(".ps"); - if(TRFactory::ReadDescriptions(theLevelParticleSystemFile, theDescriptionList)) - { - gParticleTemplateList.CreateTemplates(theDescriptionList); + string theLevelParticleSystemFile = theLevelName + string(".ps"); + // Read them in from proper file + pbuffer = (char *)LOAD_FILE_FOR_ME( (char *)theLevelParticleSystemFile.c_str(), &len ); // Use malloc + if ( pbuffer ) { + + strstream trstream(pbuffer, len); + if(TRFactory::ReadDescriptions(trstream, theDescriptionList)) + { + gParticleTemplateList.CreateTemplates(theDescriptionList); + } + FREE_FILE(pbuffer); } } } diff --git a/releases/valve/source/textrep/TRFactory.cpp b/releases/valve/source/textrep/TRFactory.cpp index 7a88689d..a225e315 100644 --- a/releases/valve/source/textrep/TRFactory.cpp +++ b/releases/valve/source/textrep/TRFactory.cpp @@ -25,35 +25,30 @@ const int maxLineLength = 256; -bool TRFactory::ReadDescriptions(const string& inRelativePathFilename, TRDescriptionList& outDescriptionList) +bool TRFactory::ReadDescriptions(strstream &trstream, TRDescriptionList& outDescriptionList) { bool theSuccess = false; bool theDescriptionRead = false; + int count=0; + do + { + // Try to read the next description in + TRDescription theNextDescription; + theDescriptionRead = ReadDescription(trstream, theNextDescription); - // Open file specified by relative path name - fstream infile; - infile.open(inRelativePathFilename.c_str(), ios::in); - - if(infile.is_open()) - { - do + // add it to the description list + if(theDescriptionRead) { - // Try to read the next description in - TRDescription theNextDescription; - theDescriptionRead = ReadDescription(infile, theNextDescription); + count++; + // Function is successful if at least one description was found + outDescriptionList.push_back(theNextDescription); + theSuccess = true; + } + else { + int a=0; + } - // add it to the description list - if(theDescriptionRead) - { - // Function is successful if at least one description was found - outDescriptionList.push_back(theNextDescription); - theSuccess = true; - } - - } while(theDescriptionRead); - - infile.close(); - } + } while(theDescriptionRead); return theSuccess; } @@ -93,7 +88,7 @@ bool TRFactory::WriteDescriptions(const string& inRelativePathFilename, const TR } // TODO: Add case-insensitivity -bool TRFactory::ReadDescription(fstream& infile, TRDescription& outDescription) +bool TRFactory::ReadDescription(strstream& infile, TRDescription& outDescription) { bool theSuccess = false; string currentLine; diff --git a/releases/valve/source/textrep/TRFactory.h b/releases/valve/source/textrep/TRFactory.h index 47325ac9..3f700e04 100644 --- a/releases/valve/source/textrep/TRFactory.h +++ b/releases/valve/source/textrep/TRFactory.h @@ -18,7 +18,7 @@ //=============================================================================== #ifndef TRFACTORY_H #define TRFACTORY_H - +#include #include "textrep/TRDescription.h" #include "string.h" @@ -28,11 +28,11 @@ class TRFactory { public: // Read all the descriptions from the file - static bool ReadDescriptions(const string& inRelativePathFilename, TRDescriptionList& outDescriptionList); + static bool ReadDescriptions(strstream& trstream, TRDescriptionList& outDescriptionList); static bool WriteDescriptions(const string& inRelativePathFilename, const TRDescriptionList& inDescriptionList, const string& inHeader); private: - static bool ReadDescription(fstream& infile, TRDescription& outDescription); + static bool ReadDescription(strstream& infile, TRDescription& outDescription); static bool WriteDescription(fstream& outfile, const TRDescription& inDescription); static bool charIsWhiteSpace(char inChar); diff --git a/releases/valve/source/ui/UIHud.cpp b/releases/valve/source/ui/UIHud.cpp index 1a8af985..2cda085d 100644 --- a/releases/valve/source/ui/UIHud.cpp +++ b/releases/valve/source/ui/UIHud.cpp @@ -2,6 +2,9 @@ #include "textrep/TRFactory.h" #include "cl_dll/cl_util.h" #include "cl_dll/hud.h" +#include "cl_dll/wrect.h" +#include "cl_dll/cl_dll.h" +#include "dlls/extdll.h" #include "vgui_Scheme.h" #include "vgui_Panel.h" #include "mod/AvHClientVariables.h" @@ -39,15 +42,24 @@ UIHud::UIHud(const string& inFilename, UIFactory* inFactory) : CHud(), mFilename // Init cursor variables this->mArrowBitmap = NULL; this->mArrowCursor = NULL; + // Open file specified by relative path name + char *pbuffer = NULL; + int len; + // Read them in from proper file + pbuffer = (char *)gEngfuncs.COM_LoadFile( (char *)inFilename.c_str(), 5, &len ); // Use malloc - if(TRFactory::ReadDescriptions(mFilename, this->mDescriptionList)) - { - } - else - { - // TODO: Emit error - } + if ( pbuffer ) { + strstream trstream(pbuffer, len); + if(TRFactory::ReadDescriptions(trstream, this->mDescriptionList)) + { + } + else + { + // TODO: Emit error + } + gEngfuncs.COM_FreeFile(pbuffer); + } this->mSchemeManager = NULL; }