diff --git a/BH/D2Ptrs.h b/BH/D2Ptrs.h index 5ff21c4..321a69a 100644 --- a/BH/D2Ptrs.h +++ b/BH/D2Ptrs.h @@ -492,6 +492,7 @@ VARPTR(D2LAUNCH, BnData, BnetData *, 0x25ABC, 0x25B30) FUNCPTR(D2WIN, DrawSprites, void __fastcall, (void), 0x18750, 0xEAA0) FUNCPTR(D2WIN, LoadCellFile, CellFile* __fastcall, (const char* szFile, int Type), -10111, -10023) +FUNCPTR(D2WIN, UnloadCellFile, void __fastcall, (CellFile* pCellFile), -10126, -10189) FUNCPTR(D2WIN, DrawCellFile, void __fastcall, (CellFile * pCellFile, int xPos, int yPos, int div, int trans, int Color), -10138, -10172) diff --git a/BH/Modules/ScreenInfo/ScreenInfo.cpp b/BH/Modules/ScreenInfo/ScreenInfo.cpp index c88da77..cffef08 100644 --- a/BH/Modules/ScreenInfo/ScreenInfo.cpp +++ b/BH/Modules/ScreenInfo/ScreenInfo.cpp @@ -20,8 +20,14 @@ map ScreenInfo::Toggles; void ScreenInfo::OnLoad() { LoadConfig(); + //buffs + buffs = { STATE_QUICKNESS,STATE_FADE,STATE_CLOAKED,STATE_VENOMCLAWS,STATE_SHOUT,STATE_BATTLEORDERS,STATE_BATTLECOMMAND,STATE_OAKSAGE,STATE_CYCLONEARMOR,STATE_HURRICANE,STATE_BONEARMOR,STATE_HOLYSHIELD,STATE_FROZENARMOR,STATE_SHIVERARMOR,STATE_CHILLINGARMOR,STATE_ENCHANT,STATE_ENERGYSHIELD,STATE_THUNDERSTORM, + //auras + STATE_MIGHT, STATE_PRAYER, STATE_RESISTFIRE, STATE_HOLYFIRE, STATE_THORNS, STATE_DEFIANCE, STATE_RESISTCOLD, STATE_BLESSEDAIM, STATE_STAMINA, STATE_RESISTLIGHT, STATE_CONCENTRATION, STATE_HOLYWIND, STATE_CLEANSING, STATE_HOLYSHOCK, STATE_SANCTUARY, STATE_MEDITATION, STATE_FANATICISM, STATE_REDEMPTION, STATE_CONVICTION, STATE_RESISTALL, + //debuffs + STATE_AMPLIFYDAMAGE, STATE_WEAKEN, STATE_DECREPIFY, STATE_LOWERRESIST }; //popupPatch->Install(); - + bhText = new Texthook(OutOfGame, 795, 6, BH_VERSION " (planqi Resurgence/Slash branch)"); bhText->SetAlignment(Right); bhText->SetColor(Gold); @@ -48,19 +54,6 @@ void ScreenInfo::OnLoad() { automap["LASTXPPERSEC"] = szLastXpPerSec; automap["LASTGAMETIME"] = szLastGameTime; automap["SESSIONGAMECOUNT"] = to_string(nTotalGames); - - mpqH = D2WIN_LoadMpq(5000, "BH.dll", "buffs.mpq", "buffs", 0, 0); - if (mpqH) { - cf = D2WIN_LoadCellFile("data\\global\\ui\\spells\\buffs24", 0); - //buffs - buffs = { STATE_QUICKNESS,STATE_FADE,STATE_CLOAKED,STATE_VENOMCLAWS,STATE_SHOUT,STATE_BATTLEORDERS,STATE_BATTLECOMMAND,STATE_OAKSAGE,STATE_CYCLONEARMOR,STATE_HURRICANE,STATE_BONEARMOR,STATE_HOLYSHIELD,STATE_FROZENARMOR,STATE_SHIVERARMOR,STATE_CHILLINGARMOR,STATE_ENCHANT,STATE_ENERGYSHIELD,STATE_THUNDERSTORM, - //auras - STATE_MIGHT, STATE_PRAYER, STATE_RESISTFIRE, STATE_HOLYFIRE, STATE_THORNS, STATE_DEFIANCE, STATE_RESISTCOLD, STATE_BLESSEDAIM, STATE_STAMINA, STATE_RESISTLIGHT, STATE_CONCENTRATION, STATE_HOLYWIND, STATE_CLEANSING, STATE_HOLYSHOCK, STATE_SANCTUARY, STATE_MEDITATION, STATE_FANATICISM, STATE_REDEMPTION, STATE_CONVICTION, STATE_RESISTALL, - //debuffs - STATE_AMPLIFYDAMAGE, STATE_WEAKEN, STATE_DECREPIFY, STATE_LOWERRESIST }; - manageConv = false; - manageBuffs = true; - } } void ScreenInfo::LoadConfig() { @@ -116,7 +109,11 @@ void ScreenInfo::OnGameJoin() { if (!SetWindowText(D2GFX_GetHwnd(), title.c_str())) { printf("Failed setting window text, error: %d\n\n", GetLastError()); } - } + } + manageConv = false; + manageBuffs = true; + //} + activeBuffs = {}; if (bFailedToWrite) { bFailedToWrite = false; @@ -192,8 +189,7 @@ void ScreenInfo::OnGameJoin() { } runs[runname]++; */ - runcounter[runname]++; - activeBuffs = {}; + runcounter[runname]++; if (!Toggles["Run Details On Join"].state) { return; @@ -316,6 +312,13 @@ void ScreenInfo::OnDraw() { if (!pData || !quests) { return; } + if (mpqH == NULL) { + mpqH = D2WIN_LoadMpq(5000, "BH.dll", "buffs.mpq", "buffs", 0, 0); + } + if (!cellLoaded) { + cf = D2WIN_LoadCellFile("data\\global\\ui\\spells\\buffs24", 0); + cellLoaded = true; + } ULONGLONG ticks = BHGetTickCount(); ULONGLONG ms = ticks - packetTicks; @@ -512,6 +515,13 @@ void ScreenInfo::OnDraw() { } +void ScreenInfo::OnOOGDraw() { + if (cellLoaded) { + D2WIN_UnloadCellFile(cf); + cellLoaded = false; + } +} + void ScreenInfo::FormattedXPPerSec(char* buffer, double xpPerSec) { char* unit = ""; if (xpPerSec > 1E9) { diff --git a/BH/Modules/ScreenInfo/ScreenInfo.h b/BH/Modules/ScreenInfo/ScreenInfo.h index 9bc5b43..df76c5c 100644 --- a/BH/Modules/ScreenInfo/ScreenInfo.h +++ b/BH/Modules/ScreenInfo/ScreenInfo.h @@ -84,6 +84,7 @@ class ScreenInfo : public Module { BOOL manageBuffs; BOOL manageConv; int resTracker; + BOOL cellLoaded; std::vector activeBuffs; std::vector buffs; public: @@ -92,7 +93,7 @@ class ScreenInfo : public Module { ScreenInfo() : Module("Screen Info"), warningTicks(BHGetTickCount()), packetRequests(0), MephistoBlocked(false), DiabloBlocked(false), BaalBlocked(false), ReceivedQuestPacket(false), - startExperience(0), startLevel(0) {}; + startExperience(0), startLevel(0), mpqH(NULL), cf(NULL), cellLoaded(false) {}; void OnLoad(); void LoadConfig(); @@ -103,6 +104,7 @@ class ScreenInfo : public Module { void OnRightClick(bool up, int x, int y, bool* block); void OnDraw(); + void OnOOGDraw(); void OnAutomapDraw(); void OnGamePacketRecv(BYTE* packet, bool *block); diff --git a/Release/BH.dll b/Release/BH.dll index b3225d7..8f85c23 100644 Binary files a/Release/BH.dll and b/Release/BH.dll differ