Changed the way the STI file for CTH indicator is loaded to prevent the game from constantly loading and unloading the graphics file from the disk every time the function gets called. Now it's only done once per the lifetime of the game. (by Asdow)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8881 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-08-12 11:54:12 +00:00
parent ecf4e42fac
commit 2cdf1b2f0a
+14 -12
View File
@@ -2690,16 +2690,18 @@ BOOLEAN DrawCTHIndicator()
INT16 curY = 0;
/////////////////////////////////////////
// Load image STI
UINT32 guiCTHImage;
VOBJECT_DESC VObjectDesc;
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if(UsingNewCTHSystem() == true)
FilenameForBPP("CURSORS\\CUR_CTH_NCTH.sti", VObjectDesc.ImageFile);
else
FilenameForBPP("CURSORS\\CUR_CTH.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiCTHImage));
// Load image STI for CTH indicator only once during gameplay. This prevents us from constantly loading and unloading the file from disk.
static UINT32 guiCTHImage{ 0 };
if (guiCTHImage == 0)
{
VOBJECT_DESC VObjectDesc;
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
if(UsingNewCTHSystem() == true)
FilenameForBPP("CURSORS\\CUR_CTH_NCTH.sti", VObjectDesc.ImageFile);
else
FilenameForBPP("CURSORS\\CUR_CTH.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiCTHImage));
}
/////////////// AP COST FOR CURRENT SHOT
// sevenfm: only if in turnbased!
@@ -3237,8 +3239,8 @@ BOOLEAN DrawCTHIndicator()
}
// Delete CTH indicator STIs from memory.
DeleteVideoObjectFromIndex( guiCTHImage );
// Delete CTH indicator STIs from memory. Commented out so we don't keep loading the graphics for it from disk.
//DeleteVideoObjectFromIndex( guiCTHImage );
///////////////////////////////////////////////////////////////////////////////////////
// HEADROCK HAM 4: Drawing the CTH indicator to the Frame Buffer