diff --git a/Build.h b/Build.h index 0d53bbf..a78dc0d 100644 --- a/Build.h +++ b/Build.h @@ -1 +1 @@ -#define __BUILDNO__ 4889 \ No newline at end of file +#define __BUILDNO__ 4975 \ No newline at end of file diff --git a/CollisionMap.cpp b/CollisionMap.cpp index d50567d..3ea5ffc 100644 --- a/CollisionMap.cpp +++ b/CollisionMap.cpp @@ -21,11 +21,11 @@ DWORD GetTileLevelNo(Room2* lpRoom2, DWORD dwTileNo) Level* GetLevel(DWORD dwLevelNo) { - for(Level* pLevel = D2Funcs::D2CLIENT_GetPlayer()->pAct->pMisc->pLevelFirst; pLevel; pLevel = pLevel->pNextLevel) + for(Level* pLevel = D2Funcs.D2CLIENT_GetPlayer()->pAct->pMisc->pLevelFirst; pLevel; pLevel = pLevel->pNextLevel) if(pLevel->dwLevelNo == dwLevelNo) return pLevel; - return D2Funcs::D2COMMON_GetLevel(D2Funcs::D2CLIENT_GetPlayer()->pAct->pMisc, dwLevelNo); + return D2Funcs.D2COMMON_GetLevel(D2Funcs.D2CLIENT_GetPlayer()->pAct->pMisc, dwLevelNo); } CCollisionMap::CCollisionMap() @@ -113,7 +113,7 @@ BOOL CCollisionMap::BuildMapData(DWORD AreaId) if (m_map.IsCreated()) return TRUE; - UnitAny* pPlayer = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer = D2Funcs.D2CLIENT_GetPlayer(); if(!pPlayer) return FALSE; Level* pLevel = GetLevel(AreaId); @@ -225,14 +225,14 @@ void CCollisionMap::Search(Room2 *ro, UnitAny* ptPlayer, DwordArray &aSkip, DWOR if (aSkip.Find((DWORD)ro) != -1) return; - UnitAny* pPlayer = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer = D2Funcs.D2CLIENT_GetPlayer(); if (!pPlayer) return; BOOL add_room=FALSE; if(!ro->pRoom1) { add_room=TRUE; - D2Funcs::D2COMMON_AddRoomData(pPlayer->pAct, ro->pLevel->dwLevelNo, ro->dwPosX, ro->dwPosY, pPlayer->pPath->pRoom1); + D2Funcs.D2COMMON_AddRoomData(pPlayer->pAct, ro->pLevel->dwLevelNo, ro->dwPosX, ro->dwPosY, pPlayer->pPath->pRoom1); } aSkip.Add((DWORD)ro); @@ -253,7 +253,7 @@ void CCollisionMap::Search(Room2 *ro, UnitAny* ptPlayer, DwordArray &aSkip, DWOR if(add_room) { - D2Funcs::D2COMMON_RemoveRoomData(pPlayer->pAct,ro->pLevel->dwLevelNo, ro->dwPosX, ro->dwPosY, pPlayer->pPath->pRoom1); + D2Funcs.D2COMMON_RemoveRoomData(pPlayer->pAct,ro->pLevel->dwLevelNo, ro->dwPosX, ro->dwPosY, pPlayer->pPath->pRoom1); } } @@ -308,7 +308,7 @@ BOOL CCollisionMap::DumpMap(LPCSTR lpszFilePath, const vector cPath) co return FALSE; //m_map.Lock(); - wchar_t* szMapName = D2Funcs::D2CLIENT_GetLevelName(dwLevelId); + wchar_t* szMapName = D2ASMFuncs::D2CLIENT_GetLevelName(dwLevelId); fwprintf(fp, L"%s (Size: %d * %d)\nKnown Collision Types: ", szMapName, m_map.GetCX(), m_map.GetCY()); for (int i = 0; i < m_aCollisionTypes.GetSize(); i++) @@ -323,7 +323,7 @@ BOOL CCollisionMap::DumpMap(LPCSTR lpszFilePath, const vector cPath) co for(vector::iterator it = v_Path.begin(); it!=v_Path.end(); ++it) AbsToRelative(*it); - UnitAny* Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* Me = D2Funcs.D2CLIENT_GetPlayer(); POINT ptPlayer = {Me->pPath->xPos,Me->pPath->yPos}; AbsToRelative(ptPlayer); @@ -563,7 +563,7 @@ INT CCollisionMap::GetLevelExits(LPLevelExit* lpLevel) POINT ptExitPoints[0x40][2]; INT nTotalPoints = 0, nCurrentExit = 0; INT nMaxExits = 0x40; - UnitAny* Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* Me = D2Funcs.D2CLIENT_GetPlayer(); for(INT i = 0; i < m_map.GetCX(); i++) { @@ -723,7 +723,7 @@ INT CCollisionMap::GetLevelExits(LPLevelExit* lpLevel) if(!pRoom->pRoom1) { - D2Funcs::D2COMMON_AddRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); + D2Funcs.D2COMMON_AddRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); bAdded = TRUE; } @@ -733,7 +733,7 @@ INT CCollisionMap::GetLevelExits(LPLevelExit* lpLevel) if(nCurrentExit >= nMaxExits) { if(bAdded) - D2Funcs::D2COMMON_RemoveRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); + D2Funcs.D2COMMON_RemoveRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); // LeaveCriticalSection(&CriticalSection); return FALSE; } @@ -768,7 +768,7 @@ INT CCollisionMap::GetLevelExits(LPLevelExit* lpLevel) } if(bAdded) - D2Funcs::D2COMMON_RemoveRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); + D2Funcs.D2COMMON_RemoveRoomData(Me->pAct, pRoom->pLevel->dwLevelNo, pRoom->dwPosX, pRoom->dwPosY, Me->pPath->pRoom1); } // LeaveCriticalSection(&CriticalSection); diff --git a/D2Ex2.cpp b/D2Ex2.cpp index 53a574a..8a86928 100644 --- a/D2Ex2.cpp +++ b/D2Ex2.cpp @@ -1,18 +1,26 @@ #include "stdafx.h" -#define _DEFINE_PTRS +//-Must be +#include "Vars.h" +#define __DEFINE_VARS +#include "Vars.h" + +//#define _DEFINE_PTRS +//#ifdef VER_113D +//#include "D2Ptrs_113D.h" +//#elif defined VER_111B +//#include "D2Ptrs_111B.h" +//#endif + +#define __DEFINE_EXPTRS #ifdef VER_113D -#include "D2Ptrs_113D.h" -#elif defined VER_111B -#include "D2Ptrs_111B.h" +#include "D2ExPointers_113D.h" +#else +#include "D2ExPointers_111B.h" #endif #include "D2Ex2.h" -//-Must be -#include "Vars.h" -#define __DEFINE_VARS -#include "Vars.h" //--Structs #include "Misc.h" @@ -43,361 +51,365 @@ static HMODULE gModule; void LoadItemConfig() { -char szConfig[200]; -for(int aNumber = 1;;aNumber++) -{ -ostringstream szNumber; -szNumber<< aNumber; + char szConfig[200]; -GetPrivateProfileString("Item Config",szNumber.str().c_str(),"",szConfig,200,ConfigIni.c_str()); -if(szConfig[0] == '\0') { Misc::Log("%d item configuration entries have been loaded", aNumber -1); break;} + for(int aNumber = 1;;aNumber++) + { + ostringstream szNumber; + szNumber<< aNumber; -string Config(szConfig); + GetPrivateProfileString("Item Config",szNumber.str().c_str(),"",szConfig,200,ConfigIni.c_str()); + if(szConfig[0] == '\0') { Misc::Log("%d item configuration entries have been loaded", aNumber -1); break;} -string::size_type i = Config.find(','); -if(i== string::npos) { Misc::Log("Error in configuration at line: %d",aNumber); continue; } -string ItemCode(Config.substr(0,i)); + string Config(szConfig); -string::size_type i2 = Config.find(',',i+1); -if(i2== string::npos) { Misc::Log("Error in configuration at line: %d",aNumber); continue; } -string ItemQuality(Config.substr(i+1,i2-i-1)); + string::size_type i = Config.find(','); + if(i== string::npos) { Misc::Log("Error in configuration at line: %d",aNumber); continue; } + string ItemCode(Config.substr(0,i)); -string ItemColor(Config.substr(i2+1)); + string::size_type i2 = Config.find(',',i+1); + if(i2== string::npos) { Misc::Log("Error in configuration at line: %d",aNumber); continue; } + string ItemQuality(Config.substr(i+1,i2-i-1)); + string ItemColor(Config.substr(i2+1)); -boost::trim(ItemCode); -boost::trim(ItemQuality); -boost::trim(ItemColor); -boost::to_lower(ItemCode); -boost::to_lower(ItemQuality); -boost::to_lower(ItemColor); + boost::trim(ItemCode);boost::trim(ItemQuality);boost::trim(ItemColor); + boost::to_lower(ItemCode);boost::to_lower(ItemQuality);boost::to_lower(ItemColor); -ItemConfig hConfig; -hConfig.Code = Misc::TransCode(ItemCode.c_str()); -hConfig.Quality = Misc::TransQuality(ItemQuality.c_str()); -hConfig.Color = Misc::TransColor(ItemColor.c_str()); -//Misc::Log("%x, %d, %d",hConfig.Code,hConfig.Quality,hConfig.Color); -ItemArray.push_back(hConfig); -} + ItemConfig hConfig; + hConfig.Code = Misc::TransCode(ItemCode.c_str()); + hConfig.Quality = Misc::TransQuality(ItemQuality.c_str()); + hConfig.Color = Misc::TransColor(ItemColor.c_str()); + //Misc::Log("%x, %d, %d",hConfig.Code,hConfig.Quality,hConfig.Color); + ItemArray.push_back(hConfig); + } } unsigned __stdcall Thread(void * Args) { -//Load config... -HANDLE hEvent = *((HANDLE*)Args); -Misc::Log("Defining offsets..."); -DefineOffsets(); -//system("del bncache*.dat"); -Misc::Log("Loading config..."); -char filename[MAX_PATH]; -GetModuleFileName(gModule,filename,MAX_PATH); -D2ExDir.assign(filename,strrchr(filename,'\\')+1); - -ConfigIni = (D2ExDir + "\\D2Ex.ini"); -ClansIni = (D2ExDir + "\\Clans.ini"); - -bLagometer=GetPrivateProfileInt("D2Ex","Lagometer",0,ConfigIni.c_str()); -HideCrap=GetPrivateProfileInt("D2Ex","HideCrap",0,ConfigIni.c_str()); -HideGold=GetPrivateProfileInt("D2Ex","HideGold",0,ConfigIni.c_str()); -Maphack=GetPrivateProfileInt("D2Ex","Maphack",1,ConfigIni.c_str()); -BlobType=GetPrivateProfileInt("D2Ex","BlobType",3,ConfigIni.c_str()); -EnteringFont=GetPrivateProfileInt("D2Ex","EnteringFont",3,ConfigIni.c_str()); -int MaxPlayers =GetPrivateProfileInt("D2Ex","MaxPlayers",16,ConfigIni.c_str()); -if(MaxPlayers==0 || MaxPlayers>100) MaxPlayers = 8; -Port =GetPrivateProfileInt("D2Ex","ServerPort",6212,ConfigIni.c_str()); -int UseExMem = GetPrivateProfileInt("D2Ex","ExMemory",0,ConfigIni.c_str()); -PermShowLife = GetPrivateProfileInt("D2Ex","PermShowLife",1,ConfigIni.c_str()); -PermShowMana = GetPrivateProfileInt("D2Ex","PermShowMana",1,ConfigIni.c_str()); -AutoShowMap = GetPrivateProfileInt("D2Ex","AutoShowMap",0,ConfigIni.c_str()); -PVMStuff = GetPrivateProfileInt("D2Ex","PVMStuff",0,ConfigIni.c_str()); -FullVisibility = GetPrivateProfileInt("D2Ex","FullVisibility",0,ConfigIni.c_str()); -BuffsEnabled = GetPrivateProfileInt("D2Ex","BuffsEnabled",1,ConfigIni.c_str()); -BOLvl = GetPrivateProfileInt("D2Ex", "BOLvl", 42, ConfigIni.c_str()); -BCLvl = GetPrivateProfileInt("D2Ex", "BCLvl", 12, ConfigIni.c_str()); -ShoutLvl = GetPrivateProfileInt("D2Ex", "ShoutLvl", 34, ConfigIni.c_str()); -EnchLvl = GetPrivateProfileInt("D2Ex", "EnchLvl", 42, ConfigIni.c_str()); -AmpLvl = GetPrivateProfileInt("D2Ex", "AmpLvl", 40, ConfigIni.c_str()); -LRLvl = GetPrivateProfileInt("D2Ex", "LRLvl", 12, ConfigIni.c_str()); -SMLvl = GetPrivateProfileInt("D2Ex", "SMLvl", 12, ConfigIni.c_str()); -char sRes[50]; -string strRes; -GetPrivateProfileString("D2Ex", "Resolution", "800x600", sRes, 50, ConfigIni.c_str()); -strRes = sRes; - -int x = strRes.find("x"); -if (x == string::npos) -{ - cResModeX = 800; - cResModeY = 600; -} -else -{ - cResModeX = boost::lexical_cast(strRes.substr(0, x)); - cResModeY = boost::lexical_cast(strRes.substr(++x)); -} - -#ifdef D2EX_SCRAP_HACKS -StillSwitch = GetPrivateProfileInt("D2Ex","StillWSG",1,ConfigIni.c_str()); -#endif - -LoadItemConfig(); - -#ifdef D2EX_MULTIRES -ExMultiRes::EnumDisplayModes(); -#endif - -//BEFORE START... -#define CALL 0xE8 -#define JUMP 0xE9 -#define RET 0xC3 -#define CUSTOM 0 -#ifdef VER_111B -//PATCHES---TYPE-DEST_ADDRESS---------------WHAT_PATCH-------------------------SIZE---DESC----- -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66D9C),(DWORD)D2Stubs::D2CLIENT_ScreenHook,5,"Screen Hook"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66AB1),(DWORD)ExEntryText::Draw,5,"Entry Text Fix"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x7F709),(DWORD)ExPrecast::Do,5,"Trasmute button"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x91CA5),(DWORD)ExInput::GameInput_STUB,5,"Chat Input Wrapper"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x910F3),(DWORD)ExInput::RealmInput,5,"Realm Input Wrapper"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x76B66),(DWORD)D2Stubs::D2CLIENT_OnGetItemName,9,"Item Name Wrapper"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66C11),(DWORD)ExScreen::DrawLifeManaTxt,5,"Life Mana Txt"); -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x2280C),(DWORD)D2Stubs::D2CLIENT_Properties,6,"New Properties"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x35ED7),(DWORD)D2Stubs::D2CLIENT_Lighting_STUB,6,"Lighting Patch"); -//!!!!!!!!!!!!!!!!!! CODE UNSAFE FOR WARDEN !!!!!!!!!!!!!!!!!!!!!! -//Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBDFB1),(DWORD)ExInput::PacketInput_STUB,5,"Realm Input Wrapper"); -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Misc::Patch(CUSTOM,GetDllOffset("D2Gfx.dll",0x8571),0xCA,1,"Minimalize Box"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB6D1B),(DWORD)D2Stubs::D2CLIENT_FixHostilePic,5,"Move Hostile Button"); -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x4E0AC),0x26,1,"RandTrans.dat Fix"); -Misc::Patch(0x68,GetDllOffset("D2Client.dll",0x5E7CD),1,5,"TCP/IP Delay fix"); -//Misc::Patch(0x00,GetDllOffset("D2Client.dll",0x31EFE),0x03E8FE81,6,"Fail To Join Fix"); - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66A4F),(DWORD)ExOptions::DrawMenuRecon,5,"Menu Draw"); -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x52B9E),(DWORD)ExScreen::DrawAutoMapInfo,5,"AutoMap Info Draw"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x52B73),(DWORD)ExScreen::DrawAutoMapVer,5,"AutoMap Version Draw"); - -//Misc::Patch(JUMP,GetDllOffset("D2Win.dll",-10111),(DWORD)ExScreen::GetTextWidth,6,"GetTextWidth Fix"); - -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x4F620),(DWORD)D2Stubs::D2CLIENT_BlobHook,6,"Blob Hook"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x50EA8),(DWORD)D2Stubs::D2CLIENT_BlobHook2,59,"Blob Hook2"); - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x89895),(DWORD)D2Stubs::D2CLIENT_CharInfoHook,5,"Dmg Info Hook"); -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x8A0B6),(DWORD)D2Stubs::D2CLIENT_CharInfoTipHook,10,"Tooltip Char Info Hook"); - -//6FB15BF5 06  -Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0xBC890),0,5,"Party Draw"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x653F8),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Destroy"); -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x64E1B),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Show"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x8F98D),(DWORD)ExParty::ShowHide,5,"UI Minibar fix"); -Misc::Patch(0x5B,GetDllOffset("D2Client.dll",0x8F992),0x90909090,5,"UI Minibar fix"); -Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0x8F997),0,1,"UI Minibar fix"); - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB95E1),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept I"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x4845B),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept II"); -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x4686D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept III"); -Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x41B6D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept IV"); -Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x418DC),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept V"); -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x5D9FA),(DWORD)D2Stubs::D2CLIENT_HideItem_STUB,6,"ALT Draw Intercept"); - -//Misc::Patch(CALL,GetDllOffset("D2Client.dll", 0x4D707), (DWORD)D2Stubs::D2CLIENT_GetRoomByXY_STUB, 5, "Get Room XY Test"); -//Misc::Patch(JUMP,GetDllOffset("D2Client.dll", 0x64510),(DWORD)ExLoading::Draw,5,"Loading Draw Hook"); -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x11C40),MaxPlayers+1,1,"Player Count Set I"); -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x1310A),MaxPlayers,1,"Player Count Set II"); -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A7D),MaxPlayers,1,"Player Count Set III"); -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A8D),MaxPlayers,1,"Player Count Set IV"); -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A91),MaxPlayers,1,"Player Count Set V"); - -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x1D2CB),MaxPlayers,1,"Player Count Set VI"); -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0xBC948),MaxPlayers,1,"Player Count Set VII"); - -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x254C0),0x135A,4,"Extend Sound.Txt I"); -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x532B2),0x135A,4,"Extend Sound.Txt II"); -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x6E63C),0x135A,4,"Extend Sound.Txt III"); - -Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xBFC9),Port,4,"Change default B.net port I"); -Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xD55F),Port,4,"Change default B.net port II"); -Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xD589),Port,4,"Change default B.net port III"); - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x337B0),(DWORD)D2Stubs::D2CLIENT_SendJoinGame_STUB,5,"Join Game Override"); -//Misc::Patch(JUMP,GetDllOffset("BNClient.dll",0xB3A0),(DWORD)D2Stubs::BNCLIENT_OverrideVersion_STUB,6,"Override version"); - -//Misc::Patch(JUMP,GetDllOffset("D2Launch.dll",0x17999),(DWORD)D2Stubs::D2LAUNCH_OnMainMenuCreate,7,"Add Main Menu Controls"); -//Memory managament -//#ifndef _DEBUG -//if(UseExMem) -//{ -//Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1D380),(DWORD)ExMemory::Alloc_STUB,5,"Mem Alloc Override"); -//Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1CEE0),(DWORD)ExMemory::Free_STUB,5,"Mem Free Override"); -//Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1DBF0),(DWORD)ExMemory::Realloc,5,"Mem Realloc Override"); -//} -//#endif -Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x36FE0), (DWORD)ExMultiRes::D2CLIENT_SetResolution, 5, "Set Resolution Mode"); -Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x1C4B0), (DWORD)D2Stubs::D2CLIENT_D2CLIENT_ResizeView_STUB, 6, "Resize View"); -Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10029), (DWORD)D2Stubs::D2GFX_D2GFX_SetResolutionMode_STUB, 5, "D2GFX_D2GFX_SetResolutionMode"); -#elif defined VER_113D -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D78C),(DWORD)D2Stubs::D2CLIENT_ScreenHook,5,"Screen Hook"); // k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D4A1),(DWORD)ExEntryText::Draw,5,"Entry Text Fix"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x9F5A9),(DWORD)ExPrecast::Do,5,"Trasmute button"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB293D),(DWORD)ExInput::GameInput_STUB,5,"Chat Input Wrapper"); // k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB1283),(DWORD)ExInput::RealmInput,5,"Realm Input Wrapper"); // k - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x96736),(DWORD)D2Stubs::D2CLIENT_OnGetItemName,9,"Item Name Wrapper"); //k -// <- Removed Life/Mana patch cause 1.13d supports it natively -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x2E3FC),(DWORD)D2Stubs::D2CLIENT_Properties,6,"New Properties"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x233A7),(DWORD)D2Stubs::D2CLIENT_Lighting_STUB,6,"Lighting Patch"); //k -//!!!!!!!!!!!!!!!!!! CODE UNSAFE FOR WARDEN !!!!!!!!!!!!!!!!!!!!!! -//Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBDFB1),(DWORD)ExInput::PacketInput_STUB,5,"Realm Input Wrapper"); // still 1.11b -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// <- Removed Minimalize button patch cause 1.13d supports it natively -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x6E91B),(DWORD)D2Stubs::D2CLIENT_FixHostilePic,5,"Move Hostile Button"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x6415C),0x26,1,"RandTrans.dat Fix"); //k -Misc::Patch(0x68,GetDllOffset("D2Client.dll",0xB6B7D),1,5,"TCP/IP Delay fix"); //k - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D43F),(DWORD)ExOptions::DrawMenuRecon,5,"Menu Draw"); //k -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x7349E),(DWORD)ExScreen::DrawAutoMapInfo,5,"AutoMap Info Draw"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x73473),(DWORD)ExScreen::DrawAutoMapVer,5,"AutoMap Version Draw"); //k - -//Misc::Patch(JUMP,GetDllOffset("D2Win.dll",-10148),(DWORD)ExScreen::GetTextWidth,6,"GetTextWidth Fix"); //k - -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x6FED0),(DWORD)D2Stubs::D2CLIENT_BlobHook,6,"Blob Hook"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x71758),(DWORD)D2Stubs::D2CLIENT_BlobHook2,59,"Blob Hook2"); //k - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBFB95),(DWORD)D2Stubs::D2CLIENT_CharInfoHook,5,"Dmg Info Hook"); //k -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0xC03B6),(DWORD)D2Stubs::D2CLIENT_CharInfoTipHook,10,"Tooltip Char Info Hook"); //k - -Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0x88900),0,5,"Party Draw"); // k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1BEF8),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Destroy"); //k -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x1B91B),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Show"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xC444D),(DWORD)ExParty::ShowHide,5,"UI Minibar fix"); //k -Misc::Patch(0x5B,GetDllOffset("D2Client.dll",0xC444D +5),0x90909090,5,"UI Minibar fix"); //k -Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0xC444D +10),0,1,"UI Minibar fix"); //k - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xACA11),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept I"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x61011),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept II"); //k -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x5F54D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept III"); //k -Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x3AC6C),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept IV"); //k -Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x3ADCD),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept V"); //k -Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x4E61A),(DWORD)D2Stubs::D2CLIENT_HideItem_STUB,6,"ALT Draw Intercept"); // k - -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x83B0),MaxPlayers+1,1,"Player Count Set I"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x8A7A),MaxPlayers,1,"Player Count Set II"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA14D),MaxPlayers,1,"Player Count Set III"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA15D),MaxPlayers,1,"Player Count Set IV"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA161),MaxPlayers,1,"Player Count Set V"); //k - -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x286FB),MaxPlayers,1,"Player Count Set VI"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x889B8),MaxPlayers,1,"Player Count Set VII"); //k - -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0xB40D0),0x135A,4,"Extend Sound.Txt I"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x25342),0x135A,4,"Extend Sound.Txt II"); //k -Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x1F47C),0x135A,4,"Extend Sound.Txt III"); //k - -Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x460C0),(DWORD)D2Stubs::D2CLIENT_SendJoinGame_STUB,5,"Join Game Override"); //k - -Misc::Patch(CUSTOM, GetDllOffset("D2Gfx.dll", 0xB6B0),0x45EB, 2, "Allow mutli window"); -Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF494),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix"); -Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF7E4),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix"); - -#ifdef D2EX_MULTIRES -//Res stuff -Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x2C220), (DWORD)D2Stubs::D2CLIENT_SetResolution_STUB, 5, "Set Resolution Mode"); -Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x5C4F0), (DWORD)D2Stubs::D2CLIENT_ResizeView_STUB, 6, "Resize View"); -Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10069), (DWORD)D2Stubs::D2GFX_SetResolutionMode_STUB, 5, "D2GFX_SetResolutionMode"); -Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10064), (DWORD)D2Stubs::D2GFX_GetModeParams_STUB, 7, "D2GFX_GetModeParams"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x95EA), (DWORD)D2Stubs::D2GFX_LookUpFix_I_STUB, 7, "LookUpYFix_I"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA257), (DWORD)D2Stubs::D2GFX_LookUpFix_II_STUB, 7, "LookUpYFix_II"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x90BC), (DWORD)D2Stubs::D2GFX_LookUpFix_III_STUB, 7, "LookUpYFix_III"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x93E9), (DWORD)D2Stubs::D2GFX_LookUpFix_IV_STUB, 7, "LookUpYFix_IV"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA680), (DWORD)D2Stubs::D2GFX_LookUpFix_V_STUB, 7, "LookUpYFix_V"); -Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA4F7), (DWORD)D2Stubs::D2GFX_LookUpFix_VI_STUB, 6, "LookUpYFix_VI"); - -//Res UI fixups -Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10689), (DWORD)ExMultiRes::GetBeltPos, 7, "D2COMMON_GetBeltPos"); -Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10370), (DWORD)ExMultiRes::GetBeltsTxtRecord, 10, "D2COMMON_GetBeltsTxtRecord"); -Misc::WriteDword((DWORD*)&((GFXHelpers*)GetDllOffset("D2Gfx.dll", 0x10BFC))->D2GFX_FillYBufferTable, (DWORD)&ExMultiRes::D2GFX_FillYBufferTable); -#endif - -#else -ShowWindow(D2Funcs::D2GFX_GetHwnd(),SW_HIDE); -MessageBoxA(0,"Version is not supported!","D2Ex",0); -exit(-1); -#endif - -ExMpq::LoadMPQ(); - -#ifdef D2EX_MULTIRES -Misc::Log("Loading MultiRes resources..."); -if (!ExMultiRes::InitImages()) -{ - D2EXERROR("One or more D2Ex resources weren't loaded. Check if your D2Ex2.MPQ is valid!"); -} -#endif - -//END PATCHES----------------------------------------------------------------------------------- -//KEYBOARD CALL TREE -//D2Vars::D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN]=(int)&ExParty::ShowHide; -//D2Vars::D2CLIENT_UIModesCallTree[UICall::ESCMENU]=(int)&ExOptions::ShowHide; -//D2Vars::D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN]=(int)&ExParty::ClearScreenHandle; - -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN], (DWORD)&ExParty::ShowHide); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::ESCMENU], (DWORD)&ExOptions::ShowHide); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN], (DWORD)&ExParty::ClearScreenHandle); - - -//PACKET HANDLERS -//D2Vars::D2CLIENT_PacketHandler[0x26].CallBack=&ExChat::OnMessage; -//D2Vars::D2CLIENT_PacketHandler[0x5A].CallBack=&ExEvents::OnEvent; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x26].CallBack, (DWORD)&ExChat::OnMessage); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x5A].CallBack, (DWORD)&ExEvents::OnEvent); - -#ifdef D2EX_EXAIM_ENABLED -D2Vars::D2CLIENT_PacketHandler[0x4D].CallBack2=&ExAim::OnUnitSpellCast; -D2Vars::D2CLIENT_PacketHandler[0x0A].CallBack=&ExAim::OnRemoveObject; - -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x4D].CallBack2, (DWORD)&ExAim::OnUnitSpellCast); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x0A].CallBack, (DWORD)&ExAim::OnRemoveObject); -#endif + Sleep(1000); // Delay loading because on my computer somethings works too fast :( + //Load config... + HANDLE hEvent = *((HANDLE*)Args); + Misc::Log("Defining offsets..."); + SetupD2Vars(); + SetupD2Pointers(); + SetupD2Funcs(); + + //system("del bncache*.dat"); + Misc::Log("Loading config..."); + char filename[MAX_PATH]; + GetModuleFileName(gModule,filename,MAX_PATH); + D2ExDir.assign(filename,strrchr(filename,'\\')+1); + + ConfigIni = (D2ExDir + "D2Ex.ini"); + ClansIni = (D2ExDir + "Clans.ini"); + + bLagometer=GetPrivateProfileInt("D2Ex","Lagometer",0,ConfigIni.c_str()); + HideCrap=GetPrivateProfileInt("D2Ex","HideCrap",0,ConfigIni.c_str()); + HideGold=GetPrivateProfileInt("D2Ex","HideGold",0,ConfigIni.c_str()); + Maphack=GetPrivateProfileInt("D2Ex","Maphack",1,ConfigIni.c_str()); + BlobType=GetPrivateProfileInt("D2Ex","BlobType",3,ConfigIni.c_str()); + EnteringFont=GetPrivateProfileInt("D2Ex","EnteringFont",3,ConfigIni.c_str()); + int MaxPlayers =GetPrivateProfileInt("D2Ex","MaxPlayers",16,ConfigIni.c_str()); + if(MaxPlayers==0 || MaxPlayers>100) MaxPlayers = 8; + Port =GetPrivateProfileInt("D2Ex","ServerPort",6212,ConfigIni.c_str()); + int UseExMem = GetPrivateProfileInt("D2Ex","ExMemory",0,ConfigIni.c_str()); + PermShowLife = GetPrivateProfileInt("D2Ex","PermShowLife",1,ConfigIni.c_str()); + PermShowMana = GetPrivateProfileInt("D2Ex","PermShowMana",1,ConfigIni.c_str()); + AutoShowMap = GetPrivateProfileInt("D2Ex","AutoShowMap",0,ConfigIni.c_str()); + PVMStuff = GetPrivateProfileInt("D2Ex","PVMStuff",0,ConfigIni.c_str()); + FullVisibility = GetPrivateProfileInt("D2Ex","FullVisibility",0,ConfigIni.c_str()); + BuffsEnabled = GetPrivateProfileInt("D2Ex","BuffsEnabled",1,ConfigIni.c_str()); + BOLvl = GetPrivateProfileInt("D2Ex", "BOLvl", 42, ConfigIni.c_str()); + BCLvl = GetPrivateProfileInt("D2Ex", "BCLvl", 12, ConfigIni.c_str()); + ShoutLvl = GetPrivateProfileInt("D2Ex", "ShoutLvl", 34, ConfigIni.c_str()); + EnchLvl = GetPrivateProfileInt("D2Ex", "EnchLvl", 42, ConfigIni.c_str()); + AmpLvl = GetPrivateProfileInt("D2Ex", "AmpLvl", 40, ConfigIni.c_str()); + LRLvl = GetPrivateProfileInt("D2Ex", "LRLvl", 12, ConfigIni.c_str()); + SMLvl = GetPrivateProfileInt("D2Ex", "SMLvl", 12, ConfigIni.c_str()); + char sRes[50]; + string strRes; + GetPrivateProfileString("D2Ex", "Resolution", "800x600", sRes, 50, ConfigIni.c_str()); + strRes = sRes; + + int x = strRes.find("x"); + if (x == string::npos) + { + cResModeX = 800; + cResModeY = 600; + } + else + { + cResModeX = boost::lexical_cast(strRes.substr(0, x)); + cResModeY = boost::lexical_cast(strRes.substr(++x)); + } -//D2Vars::D2CLIENT_PacketHandler[0x65].CallBack=&ExParty::GetKillCount; -//D2Vars::D2CLIENT_PacketHandler[0x66].CallBack=&ExParty::GetRoster; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x66].CallBack, (DWORD)&ExParty::GetRoster); - -//D2Vars::D2CLIENT_PacketHandler[0xA8].CallBack=&ExBuffs::OnSetState; -//D2Vars::D2CLIENT_PacketHandler[0xA9].CallBack=&ExBuffs::OnRemoveState; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA8].CallBack, (DWORD)&ExBuffs::OnSetState); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA9].CallBack, (DWORD)&ExBuffs::OnRemoveState); - -//D2Vars::D2CLIENT_PacketHandler[0x8B].CallBack=&ExParty::OnPartyUpdate2; -//D2Vars::D2CLIENT_PacketHandler[0x8C].CallBack=&ExParty::OnPartyUpdate; -//D2Vars::D2CLIENT_PacketHandler[0x8D].CallBack=&ExParty::OnPartyUpdate3; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8B].CallBack, (DWORD)&ExParty::OnPartyUpdate2); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8C].CallBack, (DWORD)&ExParty::OnPartyUpdate); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8D].CallBack, (DWORD)&ExParty::OnPartyUpdate3); - -// for location on party screeen -unused- -//D2Vars::D2CLIENT_PacketHandler[0x7F].CallBack=&ExParty::OnLocationUpdate; - -//D2Vars::D2CLIENT_PacketHandler[0x77].CallBack=&ExScreen::OnTradeButton; -//D2Vars::D2CLIENT_PacketHandler[0x78].CallBack=&ExScreen::OnTradeData; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x77].CallBack, (DWORD)&ExScreen::OnTradeButton); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x78].CallBack, (DWORD)&ExScreen::OnTradeData); - -//ExEvents -//D2Vars::D2CLIENT_PacketHandler[0xA6].CallBack = &ExEvents::OnTextEvent; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA6].CallBack, (DWORD)&ExEvents::OnTextEvent); -//ExSpectator -//D2Vars::D2CLIENT_PacketHandler[0x7E].CallBack = &ExSpec::OnMousePacket; -//D2Vars::D2CLIENT_PacketHandler[0x8F].CallBack = &ExLagometer::OnPong; -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x7E].CallBack, (DWORD)&ExSpec::OnMousePacket); -Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8F].CallBack, (DWORD)&ExLagometer::OnPong); - -//D2Vars::D2NET_SrvPacketLenTable[0x2C]=18; -Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); + #ifdef D2EX_SCRAP_HACKS + StillSwitch = GetPrivateProfileInt("D2Ex","StillWSG",1,ConfigIni.c_str()); + #endif + + LoadItemConfig(); + + #ifdef D2EX_MULTIRES + ExMultiRes::EnumDisplayModes(); + #endif + + //BEFORE START... + #define CALL 0xE8 + #define JUMP 0xE9 + #define RET 0xC3 + #define CUSTOM 0 + #ifdef VER_111B + //PATCHES---TYPE-DEST_ADDRESS---------------WHAT_PATCH-------------------------SIZE---DESC----- + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66D9C),(DWORD)D2Stubs::D2CLIENT_ScreenHook,5,"Screen Hook"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66AB1),(DWORD)ExEntryText::Draw,5,"Entry Text Fix"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x7F709),(DWORD)ExPrecast::Do,5,"Trasmute button"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x91CA5),(DWORD)ExInput::GameInput_STUB,5,"Chat Input Wrapper"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x910F3),(DWORD)ExInput::RealmInput,5,"Realm Input Wrapper"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x76B66),(DWORD)D2Stubs::D2CLIENT_OnGetItemName,9,"Item Name Wrapper"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66C11),(DWORD)ExScreen::DrawLifeManaTxt,5,"Life Mana Txt"); + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x2280C),(DWORD)D2Stubs::D2CLIENT_Properties,6,"New Properties"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x35ED7),(DWORD)D2Stubs::D2CLIENT_Lighting_STUB,6,"Lighting Patch"); + //!!!!!!!!!!!!!!!!!! CODE UNSAFE FOR WARDEN !!!!!!!!!!!!!!!!!!!!!! + //Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBDFB1),(DWORD)ExInput::PacketInput_STUB,5,"Realm Input Wrapper"); + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + Misc::Patch(CUSTOM,GetDllOffset("D2Gfx.dll",0x8571),0xCA,1,"Minimalize Box"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB6D1B),(DWORD)D2Stubs::D2CLIENT_FixHostilePic,5,"Move Hostile Button"); + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x4E0AC),0x26,1,"RandTrans.dat Fix"); + Misc::Patch(0x68,GetDllOffset("D2Client.dll",0x5E7CD),1,5,"TCP/IP Delay fix"); + //Misc::Patch(0x00,GetDllOffset("D2Client.dll",0x31EFE),0x03E8FE81,6,"Fail To Join Fix"); + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x66A4F),(DWORD)ExOptions::DrawMenuRecon,5,"Menu Draw"); + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x52B9E),(DWORD)ExScreen::DrawAutoMapInfo,5,"AutoMap Info Draw"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x52B73),(DWORD)ExScreen::DrawAutoMapVer,5,"AutoMap Version Draw"); + + //Misc::Patch(JUMP,GetDllOffset("D2Win.dll",-10111),(DWORD)ExScreen::GetTextWidth,6,"GetTextWidth Fix"); + + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x4F620),(DWORD)D2Stubs::D2CLIENT_BlobHook,6,"Blob Hook"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x50EA8),(DWORD)D2Stubs::D2CLIENT_BlobHook2,59,"Blob Hook2"); + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x89895),(DWORD)D2Stubs::D2CLIENT_CharInfoHook,5,"Dmg Info Hook"); + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x8A0B6),(DWORD)D2Stubs::D2CLIENT_CharInfoTipHook,10,"Tooltip Char Info Hook"); + + //6FB15BF5 06  + Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0xBC890),0,5,"Party Draw"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x653F8),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Destroy"); + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x64E1B),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Show"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x8F98D),(DWORD)ExParty::ShowHide,5,"UI Minibar fix"); + Misc::Patch(0x5B,GetDllOffset("D2Client.dll",0x8F992),0x90909090,5,"UI Minibar fix"); + Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0x8F997),0,1,"UI Minibar fix"); + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB95E1),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept I"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x4845B),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept II"); + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x4686D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept III"); + Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x41B6D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept IV"); + Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x418DC),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept V"); + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x5D9FA),(DWORD)D2Stubs::D2CLIENT_HideItem_STUB,6,"ALT Draw Intercept"); + + //Misc::Patch(CALL,GetDllOffset("D2Client.dll", 0x4D707), (DWORD)D2Stubs::D2CLIENT_GetRoomByXY_STUB, 5, "Get Room XY Test"); + //Misc::Patch(JUMP,GetDllOffset("D2Client.dll", 0x64510),(DWORD)ExLoading::Draw,5,"Loading Draw Hook"); + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x11C40),MaxPlayers+1,1,"Player Count Set I"); + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x1310A),MaxPlayers,1,"Player Count Set II"); + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A7D),MaxPlayers,1,"Player Count Set III"); + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A8D),MaxPlayers,1,"Player Count Set IV"); + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x13A91),MaxPlayers,1,"Player Count Set V"); + + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x1D2CB),MaxPlayers,1,"Player Count Set VI"); + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0xBC948),MaxPlayers,1,"Player Count Set VII"); + + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x254C0),0x135A,4,"Extend Sound.Txt I"); + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x532B2),0x135A,4,"Extend Sound.Txt II"); + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x6E63C),0x135A,4,"Extend Sound.Txt III"); + + Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xBFC9),Port,4,"Change default B.net port I"); + Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xD55F),Port,4,"Change default B.net port II"); + Misc::Patch(CUSTOM,GetDllOffset("BNClient.dll",0xD589),Port,4,"Change default B.net port III"); + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x337B0),(DWORD)D2Stubs::D2CLIENT_SendJoinGame_STUB,5,"Join Game Override"); + //Misc::Patch(JUMP,GetDllOffset("BNClient.dll",0xB3A0),(DWORD)D2Stubs::BNCLIENT_OverrideVersion_STUB,6,"Override version"); + + //Misc::Patch(JUMP,GetDllOffset("D2Launch.dll",0x17999),(DWORD)D2Stubs::D2LAUNCH_OnMainMenuCreate,7,"Add Main Menu Controls"); + //Memory managament + //#ifndef _DEBUG + //if(UseExMem) + //{ + //Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1D380),(DWORD)ExMemory::Alloc_STUB,5,"Mem Alloc Override"); + //Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1CEE0),(DWORD)ExMemory::Free_STUB,5,"Mem Free Override"); + //Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1DBF0),(DWORD)ExMemory::Realloc,5,"Mem Realloc Override"); + //} + //#endif + #ifdef D2EX_MULTIRES + Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x36FE0), (DWORD)ExMultiRes::D2CLIENT_SetResolution, 5, "Set Resolution Mode"); + Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x1C4B0), (DWORD)D2Stubs::D2CLIENT_ResizeView_STUB, 6, "Resize View"); + Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10029), (DWORD)D2Stubs::D2GFX_SetResolutionMode_STUB, 5, "D2GFX_D2GFX_SetResolutionMode"); + //@TODO: Port the rest + #endif + + #elif defined VER_113D + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D78C),(DWORD)D2Stubs::D2CLIENT_ScreenHook,5,"Screen Hook"); // k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D4A1),(DWORD)ExEntryText::Draw,5,"Entry Text Fix"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x9F5A9),(DWORD)ExPrecast::Do,5,"Trasmute button"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB293D),(DWORD)ExInput::GameInput_STUB,5,"Chat Input Wrapper"); // k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xB1283),(DWORD)ExInput::RealmInput,5,"Realm Input Wrapper"); // k + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x96736),(DWORD)D2Stubs::D2CLIENT_OnGetItemName,9,"Item Name Wrapper"); //k + // <- Removed Life/Mana patch cause 1.13d supports it natively + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x2E3FC),(DWORD)D2Stubs::D2CLIENT_Properties,6,"New Properties"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x233A7),(DWORD)D2Stubs::D2CLIENT_Lighting_STUB,6,"Lighting Patch"); //k + //!!!!!!!!!!!!!!!!!! CODE UNSAFE FOR WARDEN !!!!!!!!!!!!!!!!!!!!!! + //Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBDFB1),(DWORD)ExInput::PacketInput_STUB,5,"Realm Input Wrapper"); // still 1.11b + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // <- Removed Minimalize button patch cause 1.13d supports it natively + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x6E91B),(DWORD)D2Stubs::D2CLIENT_FixHostilePic,5,"Move Hostile Button"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x6415C),0x26,1,"RandTrans.dat Fix"); //k + Misc::Patch(0x68,GetDllOffset("D2Client.dll",0xB6B7D),1,5,"TCP/IP Delay fix"); //k + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D43F),(DWORD)ExOptions::DrawMenuRecon,5,"Menu Draw"); //k + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x7349E),(DWORD)ExScreen::DrawAutoMapInfo,5,"AutoMap Info Draw"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x73473),(DWORD)ExScreen::DrawAutoMapVer,5,"AutoMap Version Draw"); //k + + //Misc::Patch(JUMP,GetDllOffset("D2Win.dll",-10148),(DWORD)ExScreen::GetTextWidth,6,"GetTextWidth Fix"); //k + + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x6FED0),(DWORD)D2Stubs::D2CLIENT_BlobHook,6,"Blob Hook"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x71758),(DWORD)D2Stubs::D2CLIENT_BlobHook2,59,"Blob Hook2"); //k + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xBFB95),(DWORD)D2Stubs::D2CLIENT_CharInfoHook,5,"Dmg Info Hook"); //k + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0xC03B6),(DWORD)D2Stubs::D2CLIENT_CharInfoTipHook,10,"Tooltip Char Info Hook"); //k + + Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0x88900),0,5,"Party Draw"); // k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1BEF8),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Destroy"); //k + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x1B91B),(DWORD)ExParty::ShowHide,5,"UI Party Fix On Show"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xC444D),(DWORD)ExParty::ShowHide,5,"UI Minibar fix"); //k + Misc::Patch(0x5B,GetDllOffset("D2Client.dll",0xC444D +5),0x90909090,5,"UI Minibar fix"); //k + Misc::Patch(0xC3,GetDllOffset("D2Client.dll",0xC444D +10),0,1,"UI Minibar fix"); //k + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0xACA11),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept I"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x61011),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept II"); //k + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x5F54D),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept III"); //k + Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x3AC6C),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept IV"); //k + Misc::Patch(CALL,GetDllOffset("D2Common.dll",0x3ADCD),(DWORD)ExScreen::DrawItem,5,"Colour Item Intercept V"); //k + Misc::Patch(JUMP,GetDllOffset("D2Client.dll",0x4E61A),(DWORD)D2Stubs::D2CLIENT_HideItem_STUB,6,"ALT Draw Intercept"); // k + + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x83B0),MaxPlayers+1,1,"Player Count Set I"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0x8A7A),MaxPlayers,1,"Player Count Set II"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA14D),MaxPlayers,1,"Player Count Set III"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA15D),MaxPlayers,1,"Player Count Set IV"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Multi.dll",0xA161),MaxPlayers,1,"Player Count Set V"); //k + + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x286FB),MaxPlayers,1,"Player Count Set VI"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x889B8),MaxPlayers,1,"Player Count Set VII"); //k + + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0xB40D0),0x135A,4,"Extend Sound.Txt I"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x25342),0x135A,4,"Extend Sound.Txt II"); //k + Misc::Patch(CUSTOM,GetDllOffset("D2Client.dll",0x1F47C),0x135A,4,"Extend Sound.Txt III"); //k + + Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x460C0),(DWORD)D2Stubs::D2CLIENT_SendJoinGame_STUB,5,"Join Game Override"); //k + + Misc::Patch(CUSTOM, GetDllOffset("D2Gfx.dll", 0xB6B0),0x45EB, 2, "Allow multi window"); + Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF494),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix"); + Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF7E4),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix"); + + #ifdef D2EX_MULTIRES + //Res stuff + Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x2C220), (DWORD)D2Stubs::D2CLIENT_SetResolution_STUB, 5, "Set Resolution Mode"); + Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x5C4F0), (DWORD)D2Stubs::D2CLIENT_ResizeView_STUB, 6, "Resize View"); + Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10069), (DWORD)D2Stubs::D2GFX_SetResolutionMode_STUB, 5, "D2GFX_SetResolutionMode"); + Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10064), (DWORD)D2Stubs::D2GFX_GetModeParams_STUB, 7, "D2GFX_GetModeParams"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x95EA), (DWORD)D2Stubs::D2GFX_LookUpFix_I_STUB, 7, "LookUpYFix_I"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA257), (DWORD)D2Stubs::D2GFX_LookUpFix_II_STUB, 7, "LookUpYFix_II"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x90BC), (DWORD)D2Stubs::D2GFX_LookUpFix_III_STUB, 7, "LookUpYFix_III"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0x93E9), (DWORD)D2Stubs::D2GFX_LookUpFix_IV_STUB, 7, "LookUpYFix_IV"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA680), (DWORD)D2Stubs::D2GFX_LookUpFix_V_STUB, 7, "LookUpYFix_V"); + Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA4F7), (DWORD)D2Stubs::D2GFX_LookUpFix_VI_STUB, 6, "LookUpYFix_VI"); + + //Res UI fixups + Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10689), (DWORD)ExMultiRes::GetBeltPos, 7, "D2COMMON_GetBeltPos"); + Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10370), (DWORD)ExMultiRes::GetBeltsTxtRecord, 10, "D2COMMON_GetBeltsTxtRecord"); + Misc::WriteDword((DWORD*)&((GFXHelpers*)GetDllOffset("D2Gfx.dll", 0x10BFC))->D2GFX_FillYBufferTable, (DWORD)&ExMultiRes::D2GFX_FillYBufferTable); + #endif + + #else + ShowWindow(D2Funcs.D2GFX_GetHwnd(),SW_HIDE); + MessageBoxA(0,"Version is not supported!","D2Ex",0); + exit(-1); + #endif + + ExMpq::LoadMPQ(); + + #ifdef D2EX_MULTIRES + Misc::Log("Loading MultiRes resources..."); + if (!ExMultiRes::InitImages()) + { + D2EXERROR("One or more D2Ex resources weren't loaded. Check if your D2Ex2.MPQ is valid!"); + } + #endif + + //END PATCHES----------------------------------------------------------------------------------- + //KEYBOARD CALL TREE + //D2Vars.D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN]=(int)&ExParty::ShowHide; + //D2Vars.D2CLIENT_UIModesCallTree[UICall::ESCMENU]=(int)&ExOptions::ShowHide; + //D2Vars.D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN]=(int)&ExParty::ClearScreenHandle; + + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN], (DWORD)&ExParty::ShowHide); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_UIModesCallTree[UICall::ESCMENU], (DWORD)&ExOptions::ShowHide); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN], (DWORD)&ExParty::ClearScreenHandle); + + + //PACKET HANDLERS + //D2Vars.D2CLIENT_PacketHandler[0x26].CallBack=&ExChat::OnMessage; + //D2Vars.D2CLIENT_PacketHandler[0x5A].CallBack=&ExEvents::OnEvent; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x26].CallBack, (DWORD)&ExChat::OnMessage); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x5A].CallBack, (DWORD)&ExEvents::OnEvent); + + #ifdef D2EX_EXAIM_ENABLED + D2Vars.D2CLIENT_PacketHandler[0x4D].CallBack2=&ExAim::OnUnitSpellCast; + D2Vars.D2CLIENT_PacketHandler[0x0A].CallBack=&ExAim::OnRemoveObject; + + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x4D].CallBack2, (DWORD)&ExAim::OnUnitSpellCast); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x0A].CallBack, (DWORD)&ExAim::OnRemoveObject); + #endif + + //D2Vars.D2CLIENT_PacketHandler[0x65].CallBack=&ExParty::GetKillCount; + //D2Vars.D2CLIENT_PacketHandler[0x66].CallBack=&ExParty::GetRoster; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x66].CallBack, (DWORD)&ExParty::GetRoster); + + //D2Vars.D2CLIENT_PacketHandler[0xA8].CallBack=&ExBuffs::OnSetState; + //D2Vars.D2CLIENT_PacketHandler[0xA9].CallBack=&ExBuffs::OnRemoveState; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0xA8].CallBack, (DWORD)&ExBuffs::OnSetState); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0xA9].CallBack, (DWORD)&ExBuffs::OnRemoveState); + + //D2Vars.D2CLIENT_PacketHandler[0x8B].CallBack=&ExParty::OnPartyUpdate2; + //D2Vars.D2CLIENT_PacketHandler[0x8C].CallBack=&ExParty::OnPartyUpdate; + //D2Vars.D2CLIENT_PacketHandler[0x8D].CallBack=&ExParty::OnPartyUpdate3; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x8B].CallBack, (DWORD)&ExParty::OnPartyUpdate2); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x8C].CallBack, (DWORD)&ExParty::OnPartyUpdate); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x8D].CallBack, (DWORD)&ExParty::OnPartyUpdate3); + + // for location on party screeen -unused- + //D2Vars.D2CLIENT_PacketHandler[0x7F].CallBack=&ExParty::OnLocationUpdate; + + //D2Vars.D2CLIENT_PacketHandler[0x77].CallBack=&ExScreen::OnTradeButton; + //D2Vars.D2CLIENT_PacketHandler[0x78].CallBack=&ExScreen::OnTradeData; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x77].CallBack, (DWORD)&ExScreen::OnTradeButton); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x78].CallBack, (DWORD)&ExScreen::OnTradeData); + + //ExEvents + //D2Vars.D2CLIENT_PacketHandler[0xA6].CallBack = &ExEvents::OnTextEvent; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0xA6].CallBack, (DWORD)&ExEvents::OnTextEvent); + //ExSpectator + //D2Vars.D2CLIENT_PacketHandler[0x7E].CallBack = &ExSpec::OnMousePacket; + //D2Vars.D2CLIENT_PacketHandler[0x8F].CallBack = &ExLagometer::OnPong; + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x7E].CallBack, (DWORD)&ExSpec::OnMousePacket); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_PacketHandler[0x8F].CallBack, (DWORD)&ExLagometer::OnPong); + + //D2Vars.D2NET_SrvPacketLenTable[0x2C]=18; + Misc::WriteDword((DWORD*)&D2Vars.D2NET_SrvPacketLenTable[0x2C], 18); for(int i = 1; i<38; ++i) { if(i == UI_PARTY) continue; - int** Colls = D2Vars::D2CLIENT_UICollisions; + int** Colls = D2Vars.D2CLIENT_UICollisions; Colls[i][UI_PARTY] = UICOLL_CLOSEOTHER; } static int PartyCollMap[38] = {UICOLL_NONE, UICOLL_CLOSEOTHER, UICOLL_CLOSEOTHER, UICOLL_NONE, UICOLL_CLOSEOTHER, UICOLL_NONE,//UNK, INV, CHAR, MINISKI, SKILL, CHAT @@ -408,14 +420,14 @@ Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); UICOLL_CLOSEOTHER, UICOLL_NONE, UICOLL_CLOSEOTHER, UICOLL_CLOSEOTHER, UICOLL_NONE, UICOLL_NONE, UICOLL_CLOSEOTHER, UICOLL_CLOSEOTHER }; - D2Vars::D2CLIENT_UICollisions[UI_PARTY] = PartyCollMap; + D2Vars.D2CLIENT_UICollisions[UI_PARTY] = PartyCollMap; //MENU RECON - change callbacks - Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[0].fnCallBack,(DWORD)ExOptions::m_LBUTTONDOWN); - Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[1].fnCallBack,(DWORD)ExOptions::m_LBUTTONUP); - Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[6].fnCallBack,(DWORD)ExOptions::m_OnEnter); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_MenuMsgs[0].fnCallBack,(DWORD)ExOptions::m_LBUTTONDOWN); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_MenuMsgs[1].fnCallBack,(DWORD)ExOptions::m_LBUTTONUP); + Misc::WriteDword((DWORD*)&D2Vars.D2CLIENT_MenuMsgs[6].fnCallBack,(DWORD)ExOptions::m_OnEnter); #ifdef D2EX_MULTIRES - DEBUGMSG("Game has been patched, sending event!"); + DEBUGMSG("Game has been patched, sending an event!"); SetEvent(hPointersReadyEvent); #endif //----------------------- @@ -428,10 +440,10 @@ Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); { if(!OldWNDPROC) { - if (D2Funcs::D2GFX_GetHwnd()) + if (D2Funcs.D2GFX_GetHwnd()) { - OldWNDPROC=(WNDPROC)GetWindowLong(D2Funcs::D2GFX_GetHwnd(),GWL_WNDPROC); - SetWindowLong(D2Funcs::D2GFX_GetHwnd(),GWL_WNDPROC,(LONG)ExInput::GameWindowEvent); + OldWNDPROC=(WNDPROC)GetWindowLong(D2Funcs.D2GFX_GetHwnd(),GWL_WNDPROC); + SetWindowLong(D2Funcs.D2GFX_GetHwnd(),GWL_WNDPROC,(LONG)ExInput::GameWindowEvent); } } if(ExParty::GetPlayerArea()) @@ -449,9 +461,9 @@ Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); hAim = (HANDLE)_beginthreadex(0,0,&ExAim::WatchThread,&hAimEvent,0,0); #endif if(!lagometer && bLagometer) lagometer = new ExLagometer(273,571); - ExpAtJoin = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(),STAT_EXPERIENCE,0); + ExpAtJoin = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(),STAT_EXPERIENCE,0); TickAtJoin = GetTickCount(); - if(AutoShowMap) {D2Funcs::D2CLIENT_SetUiVar(UI_AUTOMAP,0,1); D2Vars::D2CLIENT_UIModes[UI_AUTOMAP] = 1;} + if(AutoShowMap) {D2Funcs.D2CLIENT_SetUiVar(UI_AUTOMAP,0,1); D2Vars.D2CLIENT_UIModes[UI_AUTOMAP] = 1;} ExInput::DefineBindings(); while(ExParty::GetPlayerArea()) { @@ -459,7 +471,7 @@ Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); if (BNQuene.size()>0) { EnterCriticalSection(&EX_CRITSECT); - D2Funcs::BNCLIENT_SendBNMessage(BNQuene.front().c_str()); + D2Funcs.BNCLIENT_SendBNMessage(BNQuene.front().c_str()); // Misc::Log("Sending : %s, size %d",BNQuene.front().c_str(),BNQuene.size()); LeaveCriticalSection(&EX_CRITSECT); Sleep(2 * 1000); //2 sec test @@ -474,7 +486,7 @@ Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18); GoldBox = 0; } if(ExDownload::isOpen()) ExDownload::ShowHide(); - if(!D2Funcs::D2CLIENT_GetPlayer()) ExBuff::Clear(); + if(!D2Funcs.D2CLIENT_GetPlayer()) ExBuff::Clear(); #ifdef D2EX_EXAIM_ENABLED SetEvent(hAimEvent); #endif @@ -499,7 +511,8 @@ DWORD WINAPI DllMain(HMODULE hModule, int dwReason, void* lpReserved) { case DLL_PROCESS_ATTACH: { - if(!Handle) { + if(!Handle) + { hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); ASSERT(hEvent); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); @@ -524,7 +537,7 @@ DWORD WINAPI DllMain(HMODULE hModule, int dwReason, void* lpReserved) case DLL_PROCESS_DETACH: { ExBuff::Clear(); - for(auto i = 0; i < Controls.size(); ++i) delete Controls.at(i); + for(auto i = 0; (unsigned int)i < Controls.size(); ++i) delete Controls.at(i); //ExMultiRes::FreeImages(); ExMpq::UnloadMPQ(); diff --git a/D2Ex2.sln b/D2Ex2.sln index ca5130e..f693924 100644 --- a/D2Ex2.sln +++ b/D2Ex2.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2012 for Windows Desktop +# Visual Studio 2013 +VisualStudioVersion = 12.0.30110.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D2Ex2", "D2Ex2.vcxproj", "{E2C5AAFC-5631-4849-89B2-73FD4AAEF510}" EndProject Global @@ -9,10 +11,10 @@ Global Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Debug|Win32.ActiveCfg = Debug|Win32 - {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Debug|Win32.Build.0 = Debug|Win32 - {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Release|Win32.ActiveCfg = Release|Win32 - {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Release|Win32.Build.0 = Release|Win32 + {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Debug|Win32.ActiveCfg = Debug 1.11b|Win32 + {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Debug|Win32.Build.0 = Debug 1.11b|Win32 + {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Release|Win32.ActiveCfg = Release 1.13d|Win32 + {E2C5AAFC-5631-4849-89B2-73FD4AAEF510}.Release|Win32.Build.0 = Release 1.13d|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/D2Ex2.v12.suo b/D2Ex2.v12.suo index 56a2050..db2f438 100644 Binary files a/D2Ex2.v12.suo and b/D2Ex2.v12.suo differ diff --git a/D2Ex2.vcproj b/D2Ex2.vcproj deleted file mode 100644 index b353322..0000000 --- a/D2Ex2.vcproj +++ /dev/null @@ -1,554 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/D2Ex2.vcxproj b/D2Ex2.vcxproj index 742d2e3..9f35387 100644 --- a/D2Ex2.vcxproj +++ b/D2Ex2.vcxproj @@ -1,12 +1,20 @@  - - Debug + + Debug 1.11b Win32 - - Release + + Debug 1.13d + Win32 + + + Release 1.11b + Win32 + + + Release 1.13d Win32 @@ -16,13 +24,24 @@ Win32Proj - + DynamicLibrary - v100 + v120_xp MultiByte true - + + DynamicLibrary + v120_xp + MultiByte + true + + + DynamicLibrary + v120_xp + MultiByte + + DynamicLibrary v100 MultiByte @@ -30,17 +49,23 @@ - + - + + + + + + + <_ProjectFileVersion>12.0.21005.1 - + $(SolutionDir)$(Configuration)\ $(Configuration)\ false @@ -48,17 +73,32 @@ $(ReferencePath) $(LibraryPath);$(ProjectDir)\glide3x - - $(SolutionDir)files\ + + $(SolutionDir)$(Configuration)\ $(Configuration)\ false C:\boost_1_55_0;$(ProjectDir)\glide3x;$(IncludePath) + $(ReferencePath) $(LibraryPath);$(ProjectDir)\glide3x - + + $(SolutionDir)files\1.13d\ + $(Configuration)\ + false + C:\boost_1_55_0;$(ProjectDir)\glide3x;$(IncludePath) + $(LibraryPath);$(ProjectDir)\glide3x + + + $(SolutionDir)files\1.11b\ + $(Configuration)\ + false + C:\boost_1_55_0;$(ProjectDir)\glide3x;$(IncludePath) + $(LibraryPath);$(ProjectDir)\glide3x + + Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) + VER_113D;WIN32;_DEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) false true EnableFastChecks @@ -67,9 +107,11 @@ Level3 ProgramDatabase 4Bytes + Cdecl - 1 + + true Windows @@ -77,7 +119,8 @@ - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;;oleaut32.lib;uuid.lib;%(AdditionalDependencies) + kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;shell32.lib;%(AdditionalDependencies) + false copy /y "$(TargetPath)" "D:\Gry\Diablo II\" @@ -89,30 +132,105 @@ Updating build number... - + Disabled + VER_111B;WIN32;_DEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) + false + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + 4Bytes + Cdecl + + + + + + + true + Windows + MachineX86 + + + + + kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;shell32.lib;%(AdditionalDependencies) + false + + + copy /y "$(TargetPath)" "D:\Gry\Diablo II (1.11b)\" + + + sed -i -r 's/^(.*) ([0-9]*)$/echo "\1" \%24((\2+1))/ge' $(MSBuildProjectDirectory)\Build.h + + + Updating build number... + + + + + Full false Speed false true - WIN32;NDEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) + VER_113D;WIN32;NDEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) true - MultiThreaded + MultiThreadedDLL true - NotSet - + StreamingSIMDExtensions2 + Use Level3 + OnlyExplicitInline + Cdecl - true + false + Windows + true + true + MachineX86 + false + false + kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;shell32.lib;%(AdditionalDependencies) + + + + + Full + false + Speed + false + true + VER_111B;WIN32;NDEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + StreamingSIMDExtensions2 + Use + Level3 + + + OnlyExplicitInline + Cdecl + + + + + false Windows true true MachineX86 false + true + kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;shell32.lib;%(AdditionalDependencies) @@ -138,8 +256,12 @@ - Create - Disabled + Create + Create + Disabled + Disabled + Create + Create @@ -160,8 +282,8 @@ - - + + diff --git a/D2Ex2.vcxproj.filters b/D2Ex2.vcxproj.filters index feb26f1..ed21f38 100644 --- a/D2Ex2.vcxproj.filters +++ b/D2Ex2.vcxproj.filters @@ -274,12 +274,6 @@ Header Files - - Header Files\D2 Internals - - - Header Files\D2 Internals - Header Files\D2 Internals @@ -292,5 +286,11 @@ Header Files\D2 Internals + + Header Files\D2 Internals + + + Header Files\D2 Internals + \ No newline at end of file diff --git a/D2ExPointers_111B.h b/D2ExPointers_111B.h new file mode 100644 index 0000000..52d6706 --- /dev/null +++ b/D2ExPointers_111B.h @@ -0,0 +1,394 @@ +#include "Offset.h" + +#ifndef __DEFINE_EXPTRS + +#define EXFUNCPTR(d1,v1,t1,t2,t3, o1) t1 (t2 *d1##_##v1)t3; +#define EXASMPTR(d1,v1,o1) DWORD d1##_##v1; +#define EXVARPTR(d1,v1,t1,o1) t1 *d1##_##v1; + +#else +enum { DDLL_D2CLIENT, DDLL_D2COMMON, DDLL_D2GFX, DDLL_D2LANG, DDLL_D2WIN, DDLL_D2NET, DDLL_D2GAME, DDLL_D2LAUNCH, DDLL_FOG, DDLL_BNCLIENT, DDLL_STORM, DDLL_D2CMP, DDLL_D2MULTI, DDLL_D2SOUND, DDLL_D2GDI, DDLL_D2DDRAW, DDLL_D2DIRECT3D, DDLL_D2GLIDE }; + +#define DLLOFFSET(a1,b1) ((DDLL_##a1)|((b1)<<8)) + +#define EXFUNCPTR(d1,v1,t1,t2,t3, o1) typedef t1 t2 d1##_##v1##_t t3; D2Funcs.##d1##_##v1 = (d1##_##v1##_t *)GetDllOffset(DLLOFFSET(d1,o1)); +#define EXASMPTR(d1,v1,o1) D2Ptrs.##d1##_##v1 = GetDllOffset(DLLOFFSET(d1,o1)); +#define EXVARPTR(d1,v1,t1,o1) D2Vars.##d1##_##v1 = (t1*)GetDllOffset(DLLOFFSET(d1,o1)); +#endif + +#ifndef __DEFINE_EXPTRS +struct _d2f { +#else +_d2f D2Funcs = { 0 }; void SetupD2Funcs() { +#endif + EXFUNCPTR(D2CLIENT, PrintGameString, void, __stdcall, (const wchar_t* wMessage, int nColor), 0x16780) + EXFUNCPTR(D2CLIENT, PrintPartyString, void, __stdcall, (const wchar_t* wMessage, int nColor), 0x16540) + EXFUNCPTR(D2CLIENT, GetPlayer, UnitAny*, __stdcall, (void), 0x4B350) + EXFUNCPTR(D2CLIENT, GetSelectedUnit, UnitAny*, __stdcall, (void), 0x2F950) + EXFUNCPTR(D2CLIENT, GetUnitById, UnitAny*, __fastcall, (DWORD UnitID, DWORD UnitType), 0x4C060) + EXFUNCPTR(D2CLIENT, ClearScreen, int, __stdcall, (void), 0x6AB90) + EXFUNCPTR(D2CLIENT, ClearScreen2, void, __stdcall, (void), 0x31FA0) + EXFUNCPTR(D2CLIENT, ClearScreen3, BOOL, __stdcall, (BOOL bUnk, BOOL bClearScreen), 0x61D50) + EXFUNCPTR(D2CLIENT, SetUiVar, int, __fastcall, (int UIMode, BOOL HowSet, int bClearScreen), 0x65690) + + EXFUNCPTR(D2CLIENT, CreateSpell, UnitAny*, __fastcall, (DWORD nType, UnitAny* pUnit, SpellStrc* pSpellData, BOOL bOverrideStun), 0x6D7B0) + + EXFUNCPTR(D2CLIENT, RevealAutomapRoom, void, __stdcall, (Room1* pRoom1, DWORD dwClipFlag, AutoMapLayer* aLayer), 0x52A20) + EXFUNCPTR(D2CLIENT, NewAutomapCell, AutoMapCell*, __fastcall, (void), 0x4FB10) + EXFUNCPTR(D2CLIENT, AddAutomapCell, void, __fastcall, (AutoMapCell* aCell, AutoMapCell** node), 0x515F0) + + + EXFUNCPTR(D2CLIENT, LoadWarpTiles, void, __stdcall, (int ActNo), 0x301B0) + EXFUNCPTR(D2CLIENT, LoadActPal, void, __stdcall, (int Unk, char* path), 0x44600) + + EXFUNCPTR(D2CLIENT, InitD2Menu, int, __stdcall, (D2Menu * ptD2Menu, D2MenuEntry *ptD2MenuEntry), 0x8DBC0) + EXFUNCPTR(D2CLIENT, D2MenuChange, int, __fastcall, (int MouseX, int aNull, int MouseY), 0x8E660) + EXFUNCPTR(D2CLIENT, D2DrawBar, void, __fastcall, (int MenuPosY, int aNull, D2MenuEntry *Entry, int nTransLvl, bool isCellFile), 0x8CB20) + + EXFUNCPTR(D2CLIENT, GetCursorItem, UnitAny*, __fastcall, (void), 0x27F30) + EXFUNCPTR(D2CLIENT, GetItemEleDmg, BOOL, __stdcall, (UnitAny *ptUnit, int *MinDmg, int *MaxDmg, int *aCol, Skill *ptSkill), 0x3EF90) + + EXFUNCPTR(D2CLIENT, UpdateAutoMap, void, __fastcall, (BOOL bUpdate), 0x51710) + EXFUNCPTR(D2CLIENT, ClearScreen4, void, __fastcall, (), 0x65F90) + + //D2COMMON + //Skill Funcs + EXFUNCPTR(D2COMMON, GetSkillById, Skill*, __fastcall, (UnitAny *ptUnit, int SkillId, int SkillFlags), -10704) + EXFUNCPTR(D2COMMON, GetSkillLevel, int, __stdcall, (UnitAny* ptUnit, Skill* ptSkill, int aType), -10109) + EXFUNCPTR(D2COMMON, GetSkillType, int, __stdcall, (UnitAny* ptUnit, Skill* ptSkill), -10010) + EXFUNCPTR(D2COMMON, GetSkillId, int, __stdcall, (Skill* ptSkill, char* szFile, int aLine), -10170) + + EXFUNCPTR(D2COMMON, GetSkillDmgBonus, int, __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl), -10447) + EXFUNCPTR(D2COMMON, GetPhysMinDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aZero), -10706) + EXFUNCPTR(D2COMMON, GetPhysMaxDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aZero), -10533) + EXFUNCPTR(D2COMMON, GetEleDmgDuration, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -10777) + EXFUNCPTR(D2COMMON, GetEleMinDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -10482) + EXFUNCPTR(D2COMMON, GetEleMaxDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -11145) + EXFUNCPTR(D2COMMON, EvaluateSkill, int, __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl), -10074) + + EXFUNCPTR(D2COMMON, GetLeftSkill, Skill*, __stdcall, (UnitAny* ptUnit), -10064) + EXFUNCPTR(D2COMMON, GetRightSkill, Skill*, __stdcall, (UnitAny* ptUnit), -11036) + + //Map Funcs + EXFUNCPTR(D2COMMON, GetLevelNoByRoom, int, __stdcall, (Room1* ptRoom), -11021) + EXFUNCPTR(D2COMMON, GetActNoByLevelNo, int, __stdcall, (int dwLevelNo), -10026) + EXFUNCPTR(D2COMMON, GetTownLevel, int, __stdcall, (int dwActNo), -10394) + EXFUNCPTR(D2COMMON, AddRoomData, void, __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10787) + EXFUNCPTR(D2COMMON, RemoveRoomData, void, __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10672) + EXFUNCPTR(D2COMMON, GetLevel, Level*, __fastcall, (ActMisc* pMisc, int dwLevelNo), -11058) + EXFUNCPTR(D2COMMON, GetLayer, AutoMapLayer2*, __fastcall, (DWORD dwLevelNo), -10641) + EXFUNCPTR(D2COMMON, GetObjectTxt, ObjectTxt*, __stdcall, (DWORD objno), -10916) + EXFUNCPTR(D2COMMON, LoadAct, Act*, __stdcall, (DWORD ActNumber, DWORD InitSeed, DWORD Unk0, Game *pGame, DWORD DiffLvl, DWORD* pMemPool, DWORD TownLevelId, DWORD* pfAutomap, DWORD* pfTownAutomap), -10669) + EXFUNCPTR(D2COMMON, UnloadAct, Act*, __stdcall, (Act* pAct), -10651) + EXFUNCPTR(D2COMMON, SetActCallback, void, __stdcall, (Act *pAct, DWORD* pFnCallback), -11102) + EXFUNCPTR(D2COMMON, GetRoomXYByLevel, Room1*, __stdcall, (Act* ptAct, int LevelNo, int Unk0, int* xPos, int* yPos, int UnitAlign), -10743) // Player Align = 2 + EXFUNCPTR(D2COMMON, GetRoomByXY, Room1*, __stdcall, (Act* ptAct, int nX, int nY), -10674) + EXFUNCPTR(D2COMMON, MapToAbsScreen, void, __stdcall, (long *pX, long *pY), -11157) + EXFUNCPTR(D2COMMON, AbsScreenToMap, void, __stdcall, (long *mX, long *mY), -10208) + EXFUNCPTR(D2COMMON, GetUnitXOffset, int, __stdcall, (UnitAny* pUnit), -10289) + EXFUNCPTR(D2COMMON, GetUnitYOffset, int, __stdcall, (UnitAny* pUnit), -10125) + //Stat funcs + EXFUNCPTR(D2COMMON, SetStat, int, __stdcall, (UnitAny *ptUnit, int nStat, int nValue, int nLayer), -10590) + EXFUNCPTR(D2COMMON, GetStatSigned, int, __stdcall, (UnitAny *ptUnit, int nStat, int nLayer), -10061) + EXFUNCPTR(D2COMMON, GetBaseStatSigned, int, __stdcall, (UnitAny *ptUnit, int nStat, int nLayer), -10550) + EXFUNCPTR(D2COMMON, GetUnitState, int, __stdcall, (UnitAny *ptUnit, DWORD dwStateNo), -10604) + EXFUNCPTR(D2COMMON, GetStateStatList, StatList*, __stdcall, (UnitAny* ptUnit, int StateNo), -10219) + EXFUNCPTR(D2COMMON, GetUnitMaxLife, unsigned int, __stdcall, (UnitAny *ptUnit), -10983) + EXFUNCPTR(D2COMMON, GetUnitMaxMana, unsigned int, __stdcall, (UnitAny *ptUnit), -10042) + EXFUNCPTR(D2COMMON, GetUnitRoom, Room1*, __stdcall, (UnitAny *ptUnit), -10933) + EXFUNCPTR(D2COMMON, SetGfxState, void, __stdcall, (UnitAny *ptUnit, int StateNo, int HowSet), -10702) + EXFUNCPTR(D2COMMON, GetExpToAchiveLvl, int, __stdcall, (int ClassId, int ExpLvl), -10152) + //Item Related + EXFUNCPTR(D2COMMON, GetItemText, ItemsTxt*, __stdcall, (int ItemNo), 0x42F60) + EXFUNCPTR(D2COMMON, GetItemByBodyLoc, UnitAny*, __stdcall, (Inventory * pInventory, int aLoc), -11003) + EXFUNCPTR(D2COMMON, GetItemFlag, BOOL, __stdcall, (UnitAny *item, DWORD flagmask, DWORD lineno, char *filename), -10303) + EXFUNCPTR(D2COMMON, GetItemColor, BYTE*, __stdcall, (UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4), -11106) + //D2NET + EXFUNCPTR(D2NET, SendPacket, bool, __stdcall, (int PacketLen, int _1, BYTE *aPacket), -10020) + EXFUNCPTR(D2NET, ReceivePacket, void, __fastcall, (int* eLen, BYTE* aPacket, int aLen), 0x6350) + + //BNCLIENT + EXFUNCPTR(BNCLIENT, SendBNMessage, void, __fastcall, (const char* szMsg), 0x14070) + + //D2GFX + EXFUNCPTR(D2GFX, DrawRectangle, void, __stdcall, (int X1, int Y1, int X2, int Y2, int dwColor, int dwTrans), -10000) + EXFUNCPTR(D2GFX, DrawLine, void, __stdcall, (int X1, int Y1, int X2, int Y2, BYTE Col, BYTE Unk), -10001) + + EXFUNCPTR(D2GFX, GetHwnd, HWND, __stdcall, (void), -10022)//0x80D0) + EXFUNCPTR(D2GFX, DrawCellContext, void, __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE *Pal255), -10044) + EXFUNCPTR(D2GFX, DrawCellContextEx, void, __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE Color), -10068) + + EXFUNCPTR(D2GFX, GetResolutionMode, int, __stdcall, (), -10063) + EXFUNCPTR(D2GFX, D2GFX_SetResolutionMode, BOOL, __stdcall, (int nMode, int bUpdate), -10029) + EXFUNCPTR(D2GFX, SetScreenShift, void, __fastcall, (int nShift), -10073) + + + EXFUNCPTR(D2GFX, 10015, int, __stdcall, (), -10015) + EXFUNCPTR(D2GFX, 10030, void, __stdcall, (long x1, long y1, int a96, long* x2, long* y2, BOOL a6), -10030) + EXFUNCPTR(D2GFX, 10036, int, __stdcall, (DWORD a1, DWORD a2, DWORD a3, DWORD a4), -10036) + EXFUNCPTR(D2GFX, 10037, void, __stdcall, (DWORD a1), -10037) + //D2WIN + EXFUNCPTR(D2WIN, ResizeWindow, BOOL, __stdcall, (int nMode), -10157) + EXFUNCPTR(D2WIN, LoadCellFile, CellFile*, __fastcall, (const char* szFile, int Type), -10004) + EXFUNCPTR(D2WIN, DrawCellFile, void, __fastcall, (CellFile * pCellFile, int xPos, int yPos, int div, int trans, int Color), -10140) + //Text--- + EXFUNCPTR(D2WIN, DrawText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10064) + EXFUNCPTR(D2WIN, DrawTextEx, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered, int TransLvl), -10043) + EXFUNCPTR(D2WIN, DrawFilledText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int dwAlign, int FilledXSize), -10023) + EXFUNCPTR(D2WIN, DrawFramedText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10039) + EXFUNCPTR(D2WIN, DrawRectangledText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nRectColor, int nRectTrans, int nColor), -10103) + EXFUNCPTR(D2WIN, GetFontHeight, short, __fastcall, (void), -10138) + EXFUNCPTR(D2WIN, GetTextWidth, int, __fastcall, (const wchar_t * wStr), -10128) + EXFUNCPTR(D2WIN, GetTextWidthAndFont, int, __fastcall, (const wchar_t * wStr, int * nWidth, int *nFont), -10183) + EXFUNCPTR(D2WIN, SetTextSize, int, __fastcall, (int dwSize), -10170) + //Controls-- + EXFUNCPTR(D2WIN, Fadeout, void, __stdcall, (Control* pControl, int HowSet), -10000) + EXFUNCPTR(D2WIN, SetControlFadeout, void, __stdcall, (Control* pControl, int HowSet), -10199) + EXFUNCPTR(D2WIN, DeleteControl, BOOL, __stdcall, (Control** pControl), -10020) + + EXFUNCPTR(D2WIN, CreateEditBox, EditBox*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int LeftOffset, int TopOffset, CellFile *ptCellFile, BOOL(__stdcall *AcceptHandle)(char*), BOOL(__stdcall *OnClick)(Control *), DWORD EditBoxFlags, cStylePrefs * ptPrefs), -10112) + EXFUNCPTR(D2WIN, SetEditBoxText, EditBox*, __fastcall, (EditBox* pControl, const wchar_t* wText), -10149) + EXFUNCPTR(D2WIN, SetEditBoxFocus, BOOL, __stdcall, (EditBox* pControl), -10088) + EXFUNCPTR(D2WIN, DeleteEditBox, BOOL, __fastcall, (EditBox* pControl), -10085) + + EXFUNCPTR(D2WIN, CreateTextBox, TextBox*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int nLeftOffset, int nTopOffset, CellFile *ptCellFile, BOOL(__stdcall *OnClick)(Control *), DWORD dwTextFlags, cStylePrefs *ptPrefs, cTextPrefs *ptScrollPrefs), -10054) + EXFUNCPTR(D2WIN, SetTextBoxText, BOOL, __fastcall, (TextBox *pTextBox, const wchar_t *wText), -10042) + + EXFUNCPTR(D2WIN, CreateButton, Button*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *ptCellFile, BOOL(__stdcall *OnClick)(Control *), DWORD dwVKHotKey, DWORD CellFrame, DWORD ButtonFlags, DWORD TblTextNo, BOOL(__stdcall *OnHoverHandle)(Control *)), -10134) + + EXFUNCPTR(D2WIN, CreateImage, Image*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *pCellFile, BOOL(__stdcall *OnClick)(Control *), void *a7, BOOL(__stdcall *KeyHandle)(Control *)), -10005) + //Other-- + EXFUNCPTR(D2WIN, GetPalette, BYTE*, __fastcall, (int nPal), -10200) + EXFUNCPTR(D2WIN, MixRGB, BYTE, __stdcall, (BYTE Red, BYTE Green, BYTE Blue), -10070) + + EXFUNCPTR(D2WIN, 10021, int, __stdcall, (), -10021) + + //D2CMP + EXFUNCPTR(D2CMP, DeleteCellFile, void, __stdcall, (CellFile* cf), -10014) + EXFUNCPTR(D2CMP, MixPalette, BYTE*, __stdcall, (int TransLvl, int ColorNo), -10071) + + //STORM + EXFUNCPTR(STORM, CloseArchive, BOOL, __stdcall, (HANDLE hArchive), -252) + + EXFUNCPTR(STORM, RegisterCommand, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -414) + EXFUNCPTR(STORM, RegisterKeyDown, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -415) + EXFUNCPTR(STORM, RegisterKeyUp, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -416) + EXFUNCPTR(STORM, RegisterMsg, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -417) + + EXFUNCPTR(STORM, UnregisterCommand, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -512) + EXFUNCPTR(STORM, UnregisterKeyDown, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -513) + EXFUNCPTR(STORM, UnregisterKeyUp, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -514) + EXFUNCPTR(STORM, UnregisterMsg, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -515) + + EXFUNCPTR(STORM, ResetMsgQuene, BOOL, __stdcall, (StormMsg * psMsg), -511) + + //FOG + EXFUNCPTR(FOG, AllocMemory, void*, __fastcall, (int MemSize, char* szFile, int Line, int aNull), -10042) + EXFUNCPTR(FOG, FreeMemory, void, __fastcall, (void* MemPool, char* szFile, int Line, int aNull), -10043) + EXFUNCPTR(FOG, AllocServerMemory, void*, __fastcall, (void* pMemPool, int MemSize, char* szFile, int Line, int aNull), -10045) + EXFUNCPTR(FOG, FreeServerMemory, void, __fastcall, (void* pMemPool, void* Memory, char* szFile, int Line, int aNull), -10046) + EXFUNCPTR(FOG, Error, void, __cdecl, (const char* File, void* Addr, int Line), -10024) + EXFUNCPTR(FOG, GetErrorData, void*, __cdecl, (), -10265) + EXFUNCPTR(FOG, isExpansion, BOOL, __cdecl, (), -10227) + EXFUNCPTR(FOG, InitBitBuffer, void, __stdcall, (BitBuffer* ptBitBuffer, void * ptBuffer, int nSize), -10126) + EXFUNCPTR(FOG, ReadBitsSigned, signed int, __stdcall, (BitBuffer* ptBitBuffer, int nBits), -10129) + EXFUNCPTR(FOG, ReadBits, unsigned int, __stdcall, (BitBuffer* ptBitBuffer, int nBits), -10130) + + //D2SOUND + EXFUNCPTR(D2SOUND, PlaySound, void, __fastcall, (const char * szFileName), -10029) + + //D2LANG + EXFUNCPTR(D2LANG, GetLocaleText, wchar_t*, __fastcall, (short nLocaleTxtNo), -10000) + EXFUNCPTR(D2LANG, GetLocaleId, int, __fastcall, (), -10013) + + EXFUNCPTR(D2CLIENT, SetState_I, BOOL, __fastcall, (BYTE* aPacket), 0xBF190) + EXFUNCPTR(D2CLIENT, RemoveState_I, BOOL, __fastcall, (BYTE* aPacket), 0xBF150) + EXFUNCPTR(D2CLIENT, EventMsg_I, BOOL, __fastcall, (BYTE* aPacket), 0xBE9B0) + EXFUNCPTR(D2CLIENT, PartyUpdate_I, BOOL, __fastcall, (BYTE* aPacket), 0xBEA30) + EXFUNCPTR(D2CLIENT, PartyUpdate_II, BOOL, __fastcall, (BYTE* aPacket), 0xBEA80) + EXFUNCPTR(D2CLIENT, PartyUpdate_III, BOOL, __fastcall, (BYTE* aPacket), 0xBEAA0) + EXFUNCPTR(D2CLIENT, PartyUpdate_IV, BOOL, __fastcall, (BYTE* aPacket), 0xBEA00) + EXFUNCPTR(D2CLIENT, TradeData_I, BOOL, __fastcall, (BYTE* aPacket), 0xBDA50) + EXFUNCPTR(D2CLIENT, TradeButton_I, BOOL, __fastcall, (BYTE* aPacket), 0xC0AA0) + EXFUNCPTR(D2CLIENT, GameChat_I, BOOL, __fastcall, (BYTE* aPacket), 0xC0B30) + EXFUNCPTR(D2CLIENT, Pong_I, BOOL, __fastcall, (BYTE* aPacket), 0xBD260) // 0x8F + + EXFUNCPTR(D2CLIENT, RemoveObject_I, BOOL, __fastcall, (BYTE* aPacket), 0xBDDE0) // k 0x0A + EXFUNCPTR(D2CLIENT, UnitCastedXY_I, BOOL, __fastcall, (UnitAny* pUnit, BYTE* aPacket), 0xC04E0) //0x4D + +#ifndef __DEFINE_EXPTRS +}; +extern _d2f D2Funcs; +struct _d2p { +#else +} +_d2p D2Ptrs = { 0 }; +void SetupD2Pointers() { +#endif + EXASMPTR(D2NET, ReceivePacket_I, -10034) + EXASMPTR(D2WIN, FontNon13, 0xE710) + EXASMPTR(D2WIN, Font13, 0xE690) + + EXASMPTR(D2CLIENT, DifuseStat_I, 0xB53A0) + EXASMPTR(D2CLIENT, SetView_I, 0x927A0) + EXASMPTR(D2CLIENT, PlaySoundNo_I, 0x54210) + EXASMPTR(D2CLIENT, GetLevelName_I, 0x61AA0) + EXASMPTR(D2WIN, GetTextWidth_I, 0xE4F0) + EXASMPTR(D2CLIENT, DrawGZBOX_I, 0x61440) + EXASMPTR(D2CLIENT, Screen_Call, 0x17E50) + EXASMPTR(D2CLIENT, ChatInput_I, 0x5E4E0) + EXASMPTR(D2CLIENT, TestPvpFlag_I, 0x1A980) + EXASMPTR(D2WIN, LoadMpq_I, 0x7D80) + EXASMPTR(D2CLIENT, MenuFunc_I, 0x8D600) + EXASMPTR(D2CLIENT, CharInfo_I, 0x88DD0) + EXASMPTR(D2CLIENT, GetSkillsTxt_I, 0x17A0) + EXASMPTR(D2CLIENT, GetMeleeDmg_I, 0x3F380) + EXASMPTR(D2CLIENT, IsMuted_I, 0x2E690) + EXASMPTR(D2CLIENT, IsSquelched_I, 0x2E6E0) + EXASMPTR(D2CLIENT, ActMapFunc1, 0x52F40) + EXASMPTR(D2CLIENT, ActMapFunc2, 0x52C00) + EXASMPTR(D2CLIENT, ActMapFunc3, 0x36030) + EXASMPTR(D2CLIENT, SkipAltDraw_J, 0x5DD89) + EXASMPTR(D2CLIENT, DontSkipAltDraw_J, 0x5DA00) + EXASMPTR(D2CLIENT, InitAutomapLayer_I, 0x52BB0) // IT MUST BE ON THE END + +#ifndef __DEFINE_EXPTRS +}; +extern _d2p D2Ptrs; +struct _d2v { +#else +} +_d2v D2Vars = { 0 }; +void SetupD2Vars() { +#endif + + EXVARPTR(D2LAUNCH, BnData, BnetData*, 0x25AAC) + EXVARPTR(BNCLIENT, BnSocket, DWORD*, 0x1D83C) + EXVARPTR(BNCLIENT, BnIp, char*, 0x1D330) + EXVARPTR(D2CLIENT, PlayerUnit, UnitAny*, 0x11C1E0) + EXVARPTR(D2CLIENT, SelectedItem, UnitAny* ,0x11BBDC) + EXVARPTR(D2CLIENT, Act, Act*, 0x11C2D0) + EXVARPTR(D2CLIENT, Ping, int, 0x11A2A4) + EXVARPTR(D2CLIENT, FPS, int, 0x11C1EC) + EXVARPTR(D2CLIENT, UIModes, int, 0x1040C0) //0x6FBB40C0 + EXVARPTR(D2CLIENT, UICollisions, int*, 0xEF1B8) + EXVARPTR(D2CLIENT, MouseClick, BOOL, 0x11BE3C) + EXVARPTR(D2CLIENT, Roster, RosterUnit*, 0x11C33C) + EXVARPTR(D2CLIENT, MouseX, int, 0x11B418) + EXVARPTR(D2CLIENT, MouseY, int, 0x11B414) + EXVARPTR(D2CLIENT, Offset, POINT, 0x11C188) + EXVARPTR(D2CLIENT, Divisior, DWORD, 0xF13F0) + EXVARPTR(D2CLIENT, PlayerX, int, 0x11B678) + EXVARPTR(D2CLIENT, PlayerY, int, 0x11B674) + EXVARPTR(D2CLIENT, ScreenXShift, int, 0x11C3E8) + EXVARPTR(D2CLIENT, AutomapInfoY, int, 0x11C1AC) + EXVARPTR(D2CLIENT, TempMessage, wchar_t, 0x11D590) //unused + EXVARPTR(D2CLIENT, pCellBorders, CellFile*, 0x104098) //unused + EXVARPTR(D2CLIENT, BlockScreen, BOOL, 0x11C338) + EXVARPTR(D2CLIENT, BlockedRect, RECT, 0x11A3FC) + EXVARPTR(D2CLIENT, UIModesCallTree, int, 0xED5E0) + EXVARPTR(D2CLIENT, isWeaponSwitch, int, 0x11BC38) + EXVARPTR(D2CLIENT, MapType, int, 0x11C140) + EXVARPTR(D2COMMON, sgptDataTables, sgptDataTable*, -11170) + EXVARPTR(D2CLIENT, AutomapLayer, AutoMapLayer*, 0x11C154) + EXVARPTR(D2WIN, CurrentFont, DWORD, 0x1ED14) + EXVARPTR(D2WIN, GetCharSize, DWORD*, 0x204DC) + EXVARPTR(D2CLIENT, PetBarColorGreen, BYTE, 0x11BED8) + EXVARPTR(D2CLIENT, PetBarColorYellow, BYTE, 0x11BED9) + EXVARPTR(D2CLIENT, PetBarColorRed, BYTE, 0x11BEDA) + EXVARPTR(D2CLIENT, ServerDifficulty, int, 0x11C2A8) + //-----Paket things + EXVARPTR(D2NET, PacketLenTable, int, 0xA900) + EXVARPTR(D2NET, SrvPacketLenTable, int, 0xABD8) + EXVARPTR(D2CLIENT, PacketHandler, D2PacketTable, 0xDBC30) + EXVARPTR(D2CLIENT, SentBytes, int, 0x11C3B8) + EXVARPTR(D2CLIENT, SentPackets, int, 0x11C3C0) + EXVARPTR(D2CLIENT, ServerFlags, DWORD, 0xF1874) + EXVARPTR(D2CLIENT, CurrentName, char*, 0x11A3C8) + EXVARPTR(D2CLIENT, BNCurrentClass, BYTE, 0xF1878) + EXVARPTR(D2CLIENT, OpenCurrentClass, BYTE, 0x11A3BC) + + //-----Menu Things + EXVARPTR(D2CLIENT, D2Menu, D2Menu*, 0x11BB48) + EXVARPTR(D2CLIENT, D2MenuEntries, D2MenuEntry*, 0x11BB4C) + EXVARPTR(D2CLIENT, OldMenu, D2MenuEntry, 0xDDBE8) + EXVARPTR(D2CLIENT, OptionsMenu, D2MenuEntry, 0xDEBF0) + EXVARPTR(D2CLIENT, SndOptionsMenu, D2MenuEntry, 0xE0698) + EXVARPTR(D2CLIENT, VidOptionsMenu, D2MenuEntry, 0xE5678) + EXVARPTR(D2CLIENT, MapOptionsMenu, D2MenuEntry, 0xEA108) + EXVARPTR(D2CLIENT, SelectedMenu, int, 0x11BB44) + EXVARPTR(D2CLIENT, PrevMouseX, int, 0x123414) + EXVARPTR(D2CLIENT, PrevMouseY, int, 0x123410) + EXVARPTR(D2CLIENT, isMenuClick, BOOL, 0x11BB54) + EXVARPTR(D2CLIENT, MenuPent, CellFile*, 0x11BF18) + EXVARPTR(D2CLIENT, MenuBar, CellFile*, 0x11BB5C) + EXVARPTR(D2CLIENT, MenuBar2, CellFile*, 0x11BB60) + EXVARPTR(D2CLIENT, MenuBarSlider, CellFile*, 0x11BB64) + EXVARPTR(D2CLIENT, WidestMenu, int, 0x11BB68) + EXVARPTR(D2CLIENT, MenuMsgs, sMsg, 0xD1258) //k + EXVARPTR(D2CLIENT, UI_Unk1, DWORD, 0x11C2F4)//k + EXVARPTR(D2CLIENT, UI_Unk2, DWORD, 0x11C2F8)//k + EXVARPTR(D2CLIENT, UI_Unk7, DWORD, 0xF1DC4) //k + EXVARPTR(D2CLIENT, UI_Unk8, DWORD, 0xF1DC8) //k + + // MultiRes stuff + EXVARPTR(D2CLIENT, ScreenHeight, int, 0xF4FC8) + EXVARPTR(D2CLIENT, ScreenWidth, int, 0xF4FC4) + EXVARPTR(D2CLIENT, ScreenMode, int, 0x11C3D0) + EXVARPTR(D2CLIENT, ScreenViewHeight, int, 0x123390) + EXVARPTR(D2CLIENT, ScreenViewWidth, int, 0x123394) + EXVARPTR(D2CLIENT, ScreenWidthUnk, int, 0xF4FCC) + EXVARPTR(D2CLIENT, GameView, GameView*, 0x11C2DC) + EXVARPTR(D2CLIENT, UiCover, int, 0x11C3E4) + EXVARPTR(D2CLIENT, UiUnk1, int, 0x11C2F4) + EXVARPTR(D2CLIENT, UiUnk2, int, 0x11C2F8) + EXVARPTR(D2CLIENT, UiUnk3, int, 0x11C310) + EXVARPTR(D2CLIENT, UiUnk4, int, 0x11C314) + EXVARPTR(D2GFX, GfxMode, int, 0x1488C) + EXVARPTR(D2GFX, WindowMode, BOOL, 0x14888) // didn't check + + // Key Config + EXVARPTR(D2CLIENT, KeyBindings, KeyBinding, 0x103C00) //k + EXVARPTR(D2CLIENT, KeyEntries, KeyConfigEntry*, 0xF46D8) // k Pointer to Config Menu Entries + EXVARPTR(D2CLIENT, KeyClassicEntries, KeyConfigEntry, 0xF44D8) // k List of non expansion entries ( 51 ) + EXVARPTR(D2CLIENT, KeyEntriesNo, int, 0x11C35C) // k + EXVARPTR(D2CLIENT, KeyThumbSize, int, 0x11C360) // k + EXVARPTR(D2CLIENT, KeyThumbYDrag, int, 0x11C364) // k + EXVARPTR(D2CLIENT, isExpansion, BOOL, 0x11A2F4) // k + + // OOG Controls + EXVARPTR(D2WIN, FirstControl, Control*, 0x20488) //0x6F900488 + EXVARPTR(D2LAUNCH, ControlArray, Control*, 0x25400) + EXVARPTR(D2LAUNCH, ControlCount, int, 0x25E20) + EXVARPTR(D2MULTI, GameName, EditBox*, 0x39CD4); + EXVARPTR(D2MULTI, GamePass, EditBox*, 0x39CD8); + EXVARPTR(D2MULTI, GamePlayers, EditBox*, 0x39D38) + EXVARPTR(D2CLIENT, InGame, DWORD, 0xF18C0) // 1 - ingame 0 - oog + + + //Game loading override + EXVARPTR(D2CLIENT, Loading_1, DWORD, 0x11C2B8) + EXVARPTR(D2CLIENT, Loading_2, DWORD, 0x11C2C0) + EXVARPTR(D2CLIENT, Difficulty, DWORD, 0x11C2A8) + EXVARPTR(D2CLIENT, Load_Draw, DWORD, 0xF1DCC) + EXVARPTR(D2CLIENT, Load_struct, DWORD*, 0x11C2D4) + EXVARPTR(D2CLIENT, ActPals, char*, 0xFA2FC) + EXVARPTR(D2CLIENT, ActPal, DWORD*, 0x10C4D0) + EXVARPTR(D2CLIENT, CurrentAct, DWORD, 0x11BF2C) + EXVARPTR(D2CLIENT, ActUnk, DWORD, 0x11C318) + EXVARPTR(D2CLIENT, ActTick, DWORD, 0x11A2BC) + EXVARPTR(D2CLIENT, ColorTbl, char, 0x11C1A0) + EXVARPTR(D2CLIENT, ColorTbl2, char, 0x103658) + +#ifndef __DEFINE_EXPTRS +}; +extern _d2v D2Vars; +#else +} +#endif + +#undef DLLOFFSET +#undef __DEFINE_EXPTRS +#undef EXFUNCPTR +#undef EXVARPTR +#undef EXASMPTR diff --git a/D2ExPointers_113D.h b/D2ExPointers_113D.h new file mode 100644 index 0000000..89c7f4a --- /dev/null +++ b/D2ExPointers_113D.h @@ -0,0 +1,398 @@ +#include "Offset.h" + +#ifndef __DEFINE_EXPTRS + +#define EXFUNCPTR(d1,v1,t1,t2,t3, o1) t1 (t2 *d1##_##v1)t3; +#define EXASMPTR(d1,v1,o1) DWORD d1##_##v1; +#define EXVARPTR(d1,v1,t1,o1) t1 *d1##_##v1; + +#else +enum { DDLL_D2CLIENT, DDLL_D2COMMON, DDLL_D2GFX, DDLL_D2LANG, DDLL_D2WIN, DDLL_D2NET, DDLL_D2GAME, DDLL_D2LAUNCH, DDLL_FOG, DDLL_BNCLIENT, DDLL_STORM, DDLL_D2CMP, DDLL_D2MULTI, DDLL_D2SOUND, DDLL_D2GDI, DDLL_D2DDRAW, DDLL_D2DIRECT3D, DDLL_D2GLIDE }; + +#define DLLOFFSET(a1,b1) ((DDLL_##a1)|((b1)<<8)) + +#define EXFUNCPTR(d1,v1,t1,t2,t3, o1) typedef t1 t2 d1##_##v1##_t t3; D2Funcs.##d1##_##v1 = (d1##_##v1##_t *)GetDllOffset(DLLOFFSET(d1,o1)); +#define EXASMPTR(d1,v1,o1) D2Ptrs.##d1##_##v1 = GetDllOffset(DLLOFFSET(d1,o1)); +#define EXVARPTR(d1,v1,t1,o1) D2Vars.##d1##_##v1 = (t1*)GetDllOffset(DLLOFFSET(d1,o1)); +#endif + +#ifndef __DEFINE_EXPTRS +struct _d2f { +#else +_d2f D2Funcs = {0}; void SetupD2Funcs() { +#endif + EXFUNCPTR(D2CLIENT, PrintGameString, void, __stdcall, (const wchar_t* wMessage, int nColor), 0x75EB0) // ns + EXFUNCPTR(D2CLIENT, PrintPartyString, void, __stdcall, (const wchar_t* wMessage, int nColor), 0x75C70) //ns + EXFUNCPTR(D2CLIENT, GetPlayer, UnitAny*, __stdcall, (void), 0x613C0) //ns + EXFUNCPTR(D2CLIENT, GetSelectedUnit, UnitAny*, __stdcall, (void), 0x17280) //k + EXFUNCPTR(D2CLIENT, GetUnitById, UnitAny*, __fastcall, (DWORD UnitID, DWORD UnitType), 0x620D0) //k + EXFUNCPTR(D2CLIENT, ClearScreen, int, __stdcall, (void), 0x3E630) //k + EXFUNCPTR(D2CLIENT, ClearScreen2, void, __stdcall, (void), 0x44980) //k + EXFUNCPTR(D2CLIENT, ClearScreen3, BOOL, __stdcall, (BOOL bUnk, BOOL bClearScreen), 0x18500) + EXFUNCPTR(D2CLIENT, SetUiVar, int, __fastcall, (int UIMode, BOOL HowSet, int bClearScreen), 0x1C190) + + EXFUNCPTR(D2CLIENT, CreateSpell, UnitAny*, __fastcall, (DWORD nType, UnitAny* pUnit, SpellStrc* pSpellData, BOOL bOverrideStun), 0x49A90) + + EXFUNCPTR(D2CLIENT, RevealAutomapRoom, void, __stdcall, (Room1* pRoom1, DWORD dwClipFlag, AutoMapLayer* aLayer), 0x73160) //ns + EXFUNCPTR(D2CLIENT, NewAutomapCell, AutoMapCell*, __fastcall, (void), 0x703C0) // ns + EXFUNCPTR(D2CLIENT, AddAutomapCell, void, __fastcall, (AutoMapCell* aCell, AutoMapCell** node), 0x71EA0) //ns + + EXFUNCPTR(D2CLIENT, D2MenuChange, int, __fastcall, (int MouseX, int aNull, int MouseY), 0xC3190) //k + EXFUNCPTR(D2CLIENT, D2DrawBar, void, __fastcall, (int MenuPosY, int aNull, D2MenuEntry *Entry, int nTransLvl, bool isCellFile), 0xC1740) //k + + EXFUNCPTR(D2CLIENT, GetCursorItem, UnitAny*, __fastcall, (void), 0x144A0) //ns + EXFUNCPTR(D2CLIENT, GetItemEleDmg, BOOL, __stdcall, (UnitAny *ptUnit, int *MinDmg, int *MaxDmg, int *aCol, Skill *ptSkill), 0x35E10) //k + + EXFUNCPTR(D2CLIENT, UpdateAutoMap, void, __fastcall, (BOOL bUpdate), 0x71FC0) + EXFUNCPTR(D2CLIENT, ClearScreen4, void, __fastcall, (), 0x1CA90) + + //D2COMMON + //Skill Funcs + EXFUNCPTR(D2COMMON, GetSkillById, Skill*, __fastcall, (UnitAny *ptUnit, int SkillId, int SkillFlags), -10984) //k + EXFUNCPTR(D2COMMON, GetSkillLevel, int, __stdcall, (UnitAny* ptUnit, Skill* ptSkill, int aType), -10007) //k + EXFUNCPTR(D2COMMON, GetSkillType, int, __stdcall, (UnitAny* ptUnit, Skill* ptSkill), -10274) //k + EXFUNCPTR(D2COMMON, GetSkillId, int, __stdcall, (Skill* ptSkill, char* szFile, int aLine), -11151) //k + + EXFUNCPTR(D2COMMON, GetSkillDmgBonus, int, __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl), -10586) // k + EXFUNCPTR(D2COMMON, GetPhysMinDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aZero), -10687) //k + EXFUNCPTR(D2COMMON, GetPhysMaxDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aZero), -10196) //k + EXFUNCPTR(D2COMMON, GetEleDmgDuration, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -11154) //k + EXFUNCPTR(D2COMMON, GetEleMinDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -10728) //k + EXFUNCPTR(D2COMMON, GetEleMaxDmg, int, __stdcall, (UnitAny* ptUnit, int SkillId, int SkillLvl, int aOne), -10662) //k + EXFUNCPTR(D2COMMON, EvaluateSkill, int, __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl), -11081) //k + + EXFUNCPTR(D2COMMON, GetLeftSkill, Skill*, __stdcall, (UnitAny* ptUnit), -10909) //k + EXFUNCPTR(D2COMMON, GetRightSkill, Skill*, __stdcall, (UnitAny* ptUnit), -10942) //k + + //Map Funcs + EXFUNCPTR(D2COMMON, GetLevelNoByRoom, int, __stdcall, (Room1* ptRoom), -10691) // k + EXFUNCPTR(D2COMMON, GetActNoByLevelNo, int, __stdcall, (int dwLevelNo), -10864) //k + EXFUNCPTR(D2COMMON, GetTownLevel, int, __stdcall, (int dwActNo), -10353) //k + EXFUNCPTR(D2COMMON, AddRoomData, void, __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10890) //k + EXFUNCPTR(D2COMMON, RemoveRoomData, void, __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10208) //k + EXFUNCPTR(D2COMMON, GetLevel, Level*, __fastcall, (ActMisc* pMisc, int dwLevelNo), -10283) //k + EXFUNCPTR(D2COMMON, GetLayer, AutoMapLayer2*, __fastcall, (DWORD dwLevelNo), -10087) //k + EXFUNCPTR(D2COMMON, GetObjectTxt, ObjectTxt*, __stdcall, (DWORD objno), -10319) //k + EXFUNCPTR(D2COMMON, GetRoomXYByLevel, Room1*, __stdcall, (Act* ptAct, int LevelNo, int Unk0, int* xPos, int* yPos, int UnitAlign), -10632) //k // Player Align = 2 + EXFUNCPTR(D2COMMON, GetRoomByXY, Room1*, __stdcall, (Act* ptAct, int nX, int nY), -11056) // k + EXFUNCPTR(D2COMMON, CheckXYType, BOOL, __stdcall, (UnitAny *pUnit, int pX, int pY, int Type), -10841) + EXFUNCPTR(D2COMMON, MapToAbsScreen, void, __stdcall, (long *pX, long *pY), -10582) //k + EXFUNCPTR(D2COMMON, AbsScreenToMap, void, __stdcall, (long *mX, long *mY), -10720) //k + EXFUNCPTR(D2COMMON, GetUnitXOffset, int, __stdcall, (UnitAny* pUnit), -10641) //k + EXFUNCPTR(D2COMMON, GetUnitYOffset, int, __stdcall, (UnitAny* pUnit), -10057) //k + + //Stat funcs + EXFUNCPTR(D2COMMON, SetStat, void, __stdcall, (UnitAny *ptUnit, int nStat, int nValue, int nLayer), -10590) // 1.13d + EXFUNCPTR(D2COMMON, GetStatSigned, int, __stdcall, (UnitAny *ptUnit, int nStat, int nLayer), -10550) // 1.13d + EXFUNCPTR(D2COMMON, GetBaseStatSigned, int, __stdcall, (UnitAny *ptUnit, int nStat, int nLayer), -10216) // 1.13d + EXFUNCPTR(D2COMMON, GetUnitState, int, __stdcall, (UnitAny *ptUnit, DWORD dwStateNo), -10706) //k + EXFUNCPTR(D2COMMON, GetUnitMaxLife, unsigned int, __stdcall, (UnitAny *ptUnit), -10574) //k + EXFUNCPTR(D2COMMON, GetUnitMaxMana, unsigned int, __stdcall, (UnitAny *ptUnit), -10084) //k + EXFUNCPTR(D2COMMON, GetUnitRoom, Room1*, __stdcall, (UnitAny *ptUnit), -10846) //k + EXFUNCPTR(D2COMMON, GetExpToAchiveLvl, int, __stdcall, (int ClassId, int ExpLvl), -10949) //k + + //Item Related + EXFUNCPTR(D2COMMON, GetItemText, ItemsTxt*, __stdcall, (int RecordNo), -10994) //k + EXFUNCPTR(D2COMMON, GetItemByBodyLoc, UnitAny*, __stdcall, (Inventory * pInventory, int aLoc), -10292) //k + EXFUNCPTR(D2COMMON, GetItemFlag, BOOL, __stdcall, (UnitAny *item, DWORD flagmask, DWORD lineno, char *filename), -10458) //k + EXFUNCPTR(D2COMMON, GetItemColor, BYTE*, __stdcall, (UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4), -11062) //k + + //D2NET + EXFUNCPTR(D2NET, SendPacket, bool, __stdcall, (int PacketLen, int _1, BYTE *aPacket), -10015) // k + EXFUNCPTR(D2NET, ReceivePacket, void, __fastcall, (int *eLen, BYTE* aPacket, int aLen), 0x7450) //k + + //BNCLIENT + EXFUNCPTR(BNCLIENT, SendBNMessage, void, __fastcall, (const char* szMsg), 0x13050) // ns + + //D2GFX + EXFUNCPTR(D2GFX, DrawRectangle, void, __stdcall, (int X1, int Y1, int X2, int Y2, int dwColor, int dwTrans), -10028) // k + EXFUNCPTR(D2GFX, DrawLine, void, __stdcall, (int X1, int Y1, int X2, int Y2, BYTE Col, BYTE Unk), -10013) //k + + EXFUNCPTR(D2GFX, GetHwnd, HWND, __stdcall, (void), -10007) // k + EXFUNCPTR(D2GFX, DrawCellContext, void, __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE *Pal255), -10042) // k + EXFUNCPTR(D2GFX, DrawCellContextEx, void, __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE Color), -10067) //k + EXFUNCPTR(D2GFX, GetResolutionMode, int, __stdcall, (), -10012) + EXFUNCPTR(D2GFX, SetResolutionMode, BOOL, __stdcall, (int nMode, BOOL bUpdate), -10069) + EXFUNCPTR(D2GFX, SetScreenShift, void, __fastcall, (int nShift), -10047) + + //D2GDI + EXFUNCPTR(D2GDI, GetCallbacks, fnRendererCallbacks*, __fastcall, (), -10000) // Same oridinal for every patch and GFX driver (GDI, D2D, D3D, GLIDE). Used directly but left just in case. + + //D2GLIDE + + EXFUNCPTR(D2GLIDE, AllocCache, BOOL, __stdcall, (), 0xD180) + + //D2WIN + EXFUNCPTR(D2WIN, ResizeWindow, BOOL, __stdcall, (int nMode), -10037) + + EXFUNCPTR(D2WIN, LoadCellFile, CellFile*, __fastcall, (const char* szFile, int Type), -10023) //k + EXFUNCPTR(D2WIN, DrawCellFile, void, __fastcall, (CellFile * pCellFile, int xPos, int yPos, int div, int trans, int Color), -10172) //k + //Text--- + EXFUNCPTR(D2WIN, DrawText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10076) //k + EXFUNCPTR(D2WIN, DrawTextEx, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered, int TransLvl), -10084) //k + EXFUNCPTR(D2WIN, DrawFramedText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10137) //k + EXFUNCPTR(D2WIN, DrawRectangledText, void, __fastcall, (const wchar_t * wStr, int X, int Y, int nRectColor, int nRectTrans, int nColor), -10078) + EXFUNCPTR(D2WIN, GetFontHeight, short, __fastcall, (void), -10088) //k + EXFUNCPTR(D2WIN, GetTextWidth, int, __fastcall, (const wchar_t * wStr), -10150) // k + EXFUNCPTR(D2WIN, SetTextSize, int, __fastcall, (int dwSize), -10047) //k + //Controls-- + EXFUNCPTR(D2WIN, Fadeout, void, __stdcall, (Control* pControl, int HowSet), -10000) + EXFUNCPTR(D2WIN, SetControlFadeout, void, __stdcall, (Control* pControl, int HowSet), -10070) //k + EXFUNCPTR(D2WIN, DeleteControl, BOOL, __stdcall, (Control** pControl), -10123) //k + EXFUNCPTR(D2WIN, CreateEditBox, EditBox*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int LeftOffset, int TopOffset, CellFile *ptCellFile, BOOL(__stdcall *AcceptHandle)(char*), BOOL(__stdcall *OnClick)(Control *), DWORD EditBoxFlags, cStylePrefs * ptPrefs), -10033) //k + EXFUNCPTR(D2WIN, SetEditBoxText, EditBox*, __fastcall, (EditBox* pControl, const wchar_t* wText), -10007) //k + EXFUNCPTR(D2WIN, SetEditBoxFocus, BOOL, __stdcall, (EditBox* pControl), -10039) //k + EXFUNCPTR(D2WIN, DeleteEditBox, BOOL, __fastcall, (EditBox* pControl), -10062) //k + EXFUNCPTR(D2WIN, CreateTextBox, TextBox*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int nLeftOffset, int nTopOffset, CellFile *ptCellFile, BOOL(__stdcall *OnClick)(Control *), DWORD dwTextFlags, cStylePrefs *ptPrefs, cTextPrefs *ptScrollPrefs), -10151) //k + EXFUNCPTR(D2WIN, SetTextBoxText, BOOL, __fastcall, (TextBox *pTextBox, const wchar_t *wText), -10090) //k + EXFUNCPTR(D2WIN, CreateButton, Button*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *ptCellFile, BOOL(__stdcall *OnClick)(Control *), DWORD dwVKHotKey, DWORD CellFrame, DWORD ButtonFlags, DWORD TblTextNo, BOOL(__stdcall *OnHoverHandle)(Control *)), -10192) //k + EXFUNCPTR(D2WIN, CreateImage, Image*, __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *pCellFile, BOOL(__stdcall *OnClick)(Control *), void *a7, BOOL(__stdcall *KeyHandle)(Control *)), -10203) //k + + EXFUNCPTR(D2WIN, MixRGB, BYTE, __stdcall, (BYTE Red, BYTE Green, BYTE Blue), -10069) //k + + //D2CMP + EXFUNCPTR(D2CMP, DeleteCellFile, void, __stdcall, (CellFile* cf), -10020) //k + EXFUNCPTR(D2CMP, MixPalette, BYTE*, __stdcall, (int TransLvl, int ColorNo), -10009) //k + + //FOG + EXFUNCPTR(FOG, AllocMemory, void*, __fastcall, (int MemSize, char* szFile, int Line, int aNull), -10042) + EXFUNCPTR(FOG, FreeMemory, void, __fastcall, (void* MemPool, char* szFile, int Line, int aNull), -10043) + EXFUNCPTR(FOG, AllocServerMemory, void*, __fastcall, (void* pMemPool, int MemSize, char* szFile, int Line, int aNull), -10045) + EXFUNCPTR(FOG, FreeServerMemory, void, __fastcall, (void* pMemPool, void* Memory, char* szFile, int Line, int aNull), -10046) + EXFUNCPTR(FOG, Error, void, __cdecl, (const char* File, void* Addr, int Line), -10024) + EXFUNCPTR(FOG, GetErrorData, void*, __cdecl, (), -10265) + EXFUNCPTR(FOG, isExpansion, BOOL, __cdecl, (), -10227) + EXFUNCPTR(FOG, InitBitBuffer, void, __stdcall, (BitBuffer *pBitBuffer, void *Source, int Size), -10126) + EXFUNCPTR(FOG, ReadBits, unsigned int, __stdcall, (BitBuffer* pBuffer, int nBits), -10130) + EXFUNCPTR(FOG, ReadBitsSigned, signed int, __stdcall, (BitBuffer* pBuffer, int nBits), -10129) + + //STORM + EXFUNCPTR(STORM, CloseArchive, BOOL, __stdcall, (HANDLE hArchive), -252) + + EXFUNCPTR(STORM, RegisterCommand, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -414) + EXFUNCPTR(STORM, RegisterKeyDown, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -415) + EXFUNCPTR(STORM, RegisterKeyUp, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -416) + EXFUNCPTR(STORM, RegisterMsg, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -417) + + EXFUNCPTR(STORM, UnregisterCommand, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -512) + EXFUNCPTR(STORM, UnregisterKeyDown, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -513) + EXFUNCPTR(STORM, UnregisterKeyUp, BOOL, __stdcall, (HANDLE hWnd, DWORD vKey, void(__stdcall *fnCallBack)(StormMsg *)), -514) + EXFUNCPTR(STORM, UnregisterMsg, BOOL, __stdcall, (HANDLE hWnd, WPARAM wParam, void(__stdcall *fnCallBack)(StormMsg *)), -515) + + EXFUNCPTR(STORM, ResetMsgQuene, BOOL, __stdcall, (StormMsg * psMsg), -511) + + + EXFUNCPTR(D2CLIENT, RemoveObject_I, BOOL, __fastcall, (BYTE* aPacket), 0x83730) // k 0x0A + EXFUNCPTR(D2CLIENT, GameChat_I, BOOL, __fastcall, (BYTE* aPacket), 0x85E80) // k 0x26 + EXFUNCPTR(D2CLIENT, UnitCastedXY_I, BOOL, __fastcall, (UnitAny* pUnit, BYTE* aPacket), 0x85660) //0x4D + EXFUNCPTR(D2CLIENT, EventMsg_I, BOOL, __fastcall, (BYTE* aPacket), 0x83BD0) // k 0x5A + EXFUNCPTR(D2CLIENT, PartyUpdate_III, BOOL, __fastcall, (BYTE* aPacket), 0x83D20) // k 0x7F + EXFUNCPTR(D2CLIENT, PartyUpdate_II, BOOL, __fastcall, (BYTE* aPacket), 0x83D00) // k 0x8B + EXFUNCPTR(D2CLIENT, PartyUpdate_I, BOOL, __fastcall, (BYTE* aPacket), 0x83CB0) //k 0x8C + EXFUNCPTR(D2CLIENT, PartyUpdate_IV, BOOL, __fastcall, (BYTE* aPacket), 0x83C80) // k 0x8D + EXFUNCPTR(D2CLIENT, TradeData_I, BOOL, __fastcall, (BYTE* aPacket), 0x82470) // k 0x78 + EXFUNCPTR(D2CLIENT, TradeButton_I, BOOL, __fastcall, (BYTE* aPacket), 0x85DF0) // k 0x77 + EXFUNCPTR(D2CLIENT, SetState_I, BOOL, __fastcall, (BYTE* aPacket), 0x84250) // k 0xA8 + EXFUNCPTR(D2CLIENT, RemoveState_I, BOOL, __fastcall, (BYTE* aPacket), 0x84210) // k 0xA9 + EXFUNCPTR(D2CLIENT, Pong_I, BOOL, __fastcall, (BYTE* aPacket), 0x82440) // 0x8F + + + //D2LANG + EXFUNCPTR(D2LANG, GetLocaleText, wchar_t*, __fastcall, (short nLocaleTxtNo), -10004) //k + EXFUNCPTR(D2LANG, GetLocaleId, int, __fastcall, (), -10001) //k //ns + +#ifndef __DEFINE_EXPTRS +}; +extern _d2f D2Funcs; +struct _d2p { +#else +} +_d2p D2Ptrs = { 0 }; +void SetupD2Pointers() { +#endif + + EXASMPTR(D2CLIENT, InitAutomapLayer_I, 0x733D0) + + EXASMPTR(D2NET, ReceivePacket_I, -10001) // k [isPacketCorrect] + EXASMPTR(D2GAME, FindFreeCoords_I, 0xE0000) + EXASMPTR(D2GAME, CheckXYOccupy_I, 0x1340) + EXASMPTR(D2CLIENT, PlaySoundNo_I, 0x26270) // k + EXASMPTR(D2CLIENT, GetLevelName_I, 0x18250) //k + EXASMPTR(D2CLIENT, DrawGZBOX_I, 0x17D10) // k + EXASMPTR(D2CLIENT, Screen_Call, 0x77810) // 1.13d + EXASMPTR(D2CLIENT, TestPvpFlag_I, 0x6A720) // k + EXASMPTR(D2WIN, LoadMpq_I, 0x7E50) //k + EXASMPTR(D2CLIENT, MenuFunc_I, 0xC2480) // k + EXASMPTR(D2CLIENT, CharInfo_I, 0xBF090) //k + EXASMPTR(D2CLIENT, GetSkillsTxt_I, 0x19F0) // SkillDesc actually // k + EXASMPTR(D2CLIENT, GetMeleeDmg_I, 0x36200) // k + EXASMPTR(D2CLIENT, IsMuted_I, 0xA1DF0) //k + EXASMPTR(D2CLIENT, IsSquelched_I, 0xA1E40) //k + EXASMPTR(D2CLIENT, SkipAltDraw_J, 0x4E9A9) //k + EXASMPTR(D2CLIENT, DontSkipAltDraw_J, 0x4E620) //k + EXASMPTR(D2CLIENT, ChatInput_I, 0xB1CE0) //1.13d + EXASMPTR(D2CLIENT, DifuseStat_I, 0x6CC10) // k + EXASMPTR(D2CLIENT, SetView_I, 0xB5330) // k + EXASMPTR(D2WIN, FontNon13, 0x12D60) //k + EXASMPTR(D2WIN, Font13, 0x12CE0) //k + + //D2MultiRes + EXASMPTR(D2GFX, Resize, 0x8300) // k + +#ifndef __DEFINE_EXPTRS +}; +extern _d2p D2Ptrs; +struct _d2v { +#else +} +_d2v D2Vars = { 0 }; +void SetupD2Vars() { +#endif + + EXVARPTR(D2LAUNCH, BnData, BnetData*, 0x25B30) //k + EXVARPTR(BNCLIENT, BnSocket, DWORD*, 0x1F878) //k + EXVARPTR(D2CLIENT, PlayerUnit, UnitAny*, 0x11D050) // k ? + EXVARPTR(D2CLIENT, SelectedItem, UnitAny*, 0x11CB28) //k + EXVARPTR(D2CLIENT, Act, Act*, 0x11D200) // k + EXVARPTR(D2CLIENT, Ping, int, 0x108764) // ns + EXVARPTR(D2CLIENT, FPS, int, 0x11CE10) // ns + EXVARPTR(D2CLIENT, UIModes, int, 0x11C890) //1.13d + EXVARPTR(D2CLIENT, UICollisions, int*, 0xF9878) + EXVARPTR(D2CLIENT, Roster, RosterUnit*, 0x11CB04) // k + EXVARPTR(D2CLIENT, MouseX, int, 0x11C950) //k + EXVARPTR(D2CLIENT, MouseY, int, 0x11C94C) //k + EXVARPTR(D2CLIENT, Offset, POINT, 0x11CF5C) // ns + EXVARPTR(D2CLIENT, Divisior, DWORD, 0xF34F8) //ns + EXVARPTR(D2CLIENT, PlayerX, int, 0x106844) //k + EXVARPTR(D2CLIENT, PlayerY, int, 0x106840) //k + EXVARPTR(D2CLIENT, ScreenXShift, int, 0x11D074) //k + EXVARPTR(D2CLIENT, AutomapInfoY, int, 0x11CF80) //k + EXVARPTR(D2CLIENT, ServerDifficulty, int, 0x11D1D8) + EXVARPTR(D2CLIENT, isWeaponSwitch, int, 0x11CB84) //k + EXVARPTR(D2CLIENT, BlockScreen, BOOL, 0x11D580) //k + EXVARPTR(D2CLIENT, BlockedRect, RECT, 0x11C92C) //k + + EXVARPTR(D2CLIENT, UIModesCallTree, int, 0xF6A80) //k + EXVARPTR(D2CLIENT, MapType, int, 0x11CF14) // k + //EXVARPTR(D2CLIENT, sgptDataTables, sgptDataTable*, 0xCF474) // k + EXVARPTR(D2COMMON, sgptDataTables, sgptDataTable*, 0xA33F0) // eon + EXVARPTR(D2CLIENT, AutomapLayer, AutoMapLayer*, 0x11CF28) //ns + EXVARPTR(D2WIN, CurrentFont, DWORD, 0x1FBA8) //k + EXVARPTR(D2WIN, GetCharSize, DWORD*, 0x8D9F8) //k + EXVARPTR(D2CLIENT, PetBarColorGreen, BYTE, 0x11CE38) + EXVARPTR(D2CLIENT, PetBarColorYellow, BYTE, 0x11CE39) + EXVARPTR(D2CLIENT, PetBarColorRed, BYTE, 0x11CE3A) + EXVARPTR(D2CLIENT, ServerFlags, DWORD, 0xF7B34) // k + EXVARPTR(D2CLIENT, CurrentName, char*, 0x108888) //k + EXVARPTR(D2CLIENT, BNCurrentClass, BYTE, 0xF7B38) //k + EXVARPTR(D2CLIENT, OpenCurrentClass, BYTE, 0x10887C) //k + + //-----Packets things + EXVARPTR(D2CLIENT, PacketHandler, D2PacketTable, 0xEF4B0) //k + EXVARPTR(D2CLIENT, SentBytes, int, 0x11D594) //k + EXVARPTR(D2CLIENT, SentPackets, int, 0x11D59C) //k + EXVARPTR(D2NET, SrvPacketLenTable, int, 0xABD8) //k <- Same as in 1.11b + + //-----Menu Things + EXVARPTR(D2CLIENT, D2Menu, D2Menu*, 0x11C9EC) //k + EXVARPTR(D2CLIENT, D2MenuEntries, D2MenuEntry*, 0x11C9F0) //k + EXVARPTR(D2CLIENT, OldMenu, D2MenuEntry, 0xDCE40) //k + EXVARPTR(D2CLIENT, OptionsMenu, D2MenuEntry, 0xDDE48) //k + EXVARPTR(D2CLIENT, SndOptionsMenu, D2MenuEntry, 0xDF8F0) //k + EXVARPTR(D2CLIENT, VidOptionsMenu, D2MenuEntry, 0xE48D0) //k + EXVARPTR(D2CLIENT, MapOptionsMenu, D2MenuEntry, 0xE9360) //k + EXVARPTR(D2CLIENT, SelectedMenu, int, 0x11C9E8) //k + EXVARPTR(D2CLIENT, PrevMouseX, int, 0x124468)//k + EXVARPTR(D2CLIENT, PrevMouseY, int, 0x124464) //k + EXVARPTR(D2CLIENT, isMenuClick, BOOL, 0x11C9F8) //k + EXVARPTR(D2CLIENT, isMenuValueClick, BOOL, 0x11C9FC) + EXVARPTR(D2CLIENT, MenuPent, CellFile*, 0x11D374) //k + EXVARPTR(D2CLIENT, MenuBar, CellFile*, 0x11CA00) //k + EXVARPTR(D2CLIENT, MenuBar2, CellFile*, 0x11CA04) //k + EXVARPTR(D2CLIENT, MenuBarSlider, CellFile*, 0x11CA08) //k + EXVARPTR(D2CLIENT, MenuMsgs, sMsg, 0xD3D20) + EXVARPTR(D2CLIENT, UI_Unk1, DWORD, 0x11D578) + EXVARPTR(D2CLIENT, UI_Unk2, DWORD, 0x11D57C) + EXVARPTR(D2CLIENT, UI_Unk7, DWORD, 0xF624C) + EXVARPTR(D2CLIENT, UI_Unk8, DWORD, 0xF6250) + + //D2MultiRes stuff + EXVARPTR(D2CLIENT, ScreenHeight, int, 0xF7038) //k + EXVARPTR(D2CLIENT, ScreenWidth, int, 0xF7034) // k + EXVARPTR(D2CLIENT, ScreenMode, int, 0x11D2B4) + EXVARPTR(D2CLIENT, ScreenViewHeight, int, 0x123D60) + EXVARPTR(D2CLIENT, ScreenViewWidth, int, 0x123D64) + EXVARPTR(D2CLIENT, ScreenWidthUnk, int, 0xF703C) // This var seems be unused, mby it is by other module didn't check deeply + EXVARPTR(D2CLIENT, GameView, GameView*, 0x11D20C) + EXVARPTR(D2CLIENT, UiCover, int, 0x11D070) + EXVARPTR(D2CLIENT, UiUnk1, int, 0x11D224) + EXVARPTR(D2CLIENT, UiUnk2, int, 0x11D228) + EXVARPTR(D2CLIENT, UiUnk3, int, 0x11D240) + EXVARPTR(D2CLIENT, UiUnk4, int, 0x11D244) + + EXVARPTR(D2GFX, pfnDriverCallback, fnRendererCallbacks*, 0x14A48) + EXVARPTR(D2GFX, GfxMode, int, 0x14A40) + EXVARPTR(D2GFX, WindowMode, BOOL, 0x14A3C) + EXVARPTR(D2GFX, DriverType, int, 0x14A38) + EXVARPTR(D2GFX, gpbBuffer, void*, 0x14320) + EXVARPTR(D2GFX, Width, int, 0x14324) + EXVARPTR(D2GFX, Height, int, 0x14328) + EXVARPTR(D2GFX, ScreenShift, int, 0x14A50) + EXVARPTR(D2GFX, fnHelpers, GFXHelpers, 0x10BFC) // table of 7 functions + EXVARPTR(D2GFX, Settings, GFXSettings, 0x10BE4) + EXVARPTR(D2GFX, hInstance, HINSTANCE, 0x14A30) + EXVARPTR(D2GFX, hDriverModHandle, HMODULE, 0x14A4C) + EXVARPTR(D2GFX, bPerspective, BOOL, 0x10BE8) + EXVARPTR(D2GFX, GammaValue, int, 0x10BF0) + + EXVARPTR(D2GDI, WindowWidth, int, 0xCA98) + EXVARPTR(D2GDI, BitmapHeight, int, 0xC980) + EXVARPTR(D2GDI, BitmapWidth, int, 0xC970) + EXVARPTR(D2GDI, gpbBuffer, void*, 0xCA9C) + EXVARPTR(D2GDI, DIB, HBITMAP, 0xC97C) + EXVARPTR(D2GDI, hWnd, HANDLE, 0xC568) + EXVARPTR(D2GDI, PaletteEntries, PALETTEENTRY*, 0xC570) + EXVARPTR(D2GDI, Palette, HPALETTE, 0xC974) + EXVARPTR(D2GDI, hFont, HFONT, 0xC988) + EXVARPTR(D2GDI, Unk, int, 0xCA94) + EXVARPTR(D2GDI, csPause, CRITICAL_SECTION*, 0xCAA4) + + EXVARPTR(D2GLIDE, bIsWindowOpen, BOOL, 0x17B2C) + EXVARPTR(D2GLIDE, Width, int, 0x15A78) + EXVARPTR(D2GLIDE, Height, int, 0x15B14) + EXVARPTR(D2GLIDE, Context, GrContext_t, 0x15AA0) + EXVARPTR(D2GLIDE, TMUCount, FxI32, 0x17B18) + EXVARPTR(D2GLIDE, TextureAlign, FxI32, 0x17B20) + EXVARPTR(D2GLIDE, bUMAAvailable, BOOL, 0x17B1C) + EXVARPTR(D2GLIDE, hWnd, HANDLE, 0x15A74) + + //Key Config + EXVARPTR(D2CLIENT, KeyBindings, KeyBinding, 0x108D90) // ArraySize = 114 + EXVARPTR(D2CLIENT, KeyEntries, KeyConfigEntry*, 0xF0154) // Pointer to Config Menu Entries + EXVARPTR(D2CLIENT, KeyClassicEntries, KeyConfigEntry, 0xEFCE8) // List of non expansion entries ( 51 ) + EXVARPTR(D2CLIENT, KeyEntriesNo, int, 0x11CE90) + EXVARPTR(D2CLIENT, KeyThumbSize, int, 0x11CE94) + EXVARPTR(D2CLIENT, KeyThumbYDrag, int, 0x11CE98) + EXVARPTR(D2CLIENT, isExpansion, BOOL, 0x1087B4) + + // OOG Controls + EXVARPTR(D2WIN, FirstControl, Control*, 0x8DB34) //k + EXVARPTR(D2LAUNCH, ControlArray, Control*, 0x25828) //k + EXVARPTR(D2LAUNCH, ControlCount, int, 0x25EA0) //k + EXVARPTR(D2MULTI, GameName, EditBox*, 0x3A004) //k + EXVARPTR(D2MULTI, GamePass, EditBox*, 0x3A008) //k + EXVARPTR(D2CLIENT, InGame, DWORD, 0xF79E0) // // k 1 - ingame 0 - oog + +#ifndef __DEFINE_EXPTRS +}; +extern _d2v D2Vars; +#else +} +#endif + +#undef DLLOFFSET +#undef __DEFINE_EXPTRS +#undef EXFUNCPTR +#undef EXVARPTR +#undef EXASMPTR + diff --git a/D2Ptrs_111B.h b/D2Ptrs_111B.h deleted file mode 100644 index 1857abe..0000000 --- a/D2Ptrs_111B.h +++ /dev/null @@ -1,376 +0,0 @@ -#pragma optimize ( "", off ) -#include "Misc.h" -#ifdef _DEFINE_PTRS -enum {DLLNO_D2CLIENT, DLLNO_D2COMMON, DLLNO_D2GFX, DLLNO_D2LANG, DLLNO_D2WIN, DLLNO_D2NET, DLLNO_D2GAME, DLLNO_D2LAUNCH, DLLNO_FOG, DLLNO_BNCLIENT, DLLNO_STORM, DLLNO_D2CMP, DLLNO_D2MULTI, DLLNO_D2SOUND, DLLNO_D2GDI, DLLNO_D2DDRAW, DLLNO_D2DIRECT3D, DLLNO_D2GLIDE}; - -#define DLLOFFSET(a1,b1) ((DLLNO_##a1)|((b1)<<8)) -#define D2FUNCPTR(d1,v1,t1,t2,o1) typedef t1 d1##_##v1##_t t2; d1##_##v1##_t *d1##_##v1 = (d1##_##v1##_t *)DLLOFFSET(d1,o1); -#define D2VARPTR(d1,v1,t1,o1) typedef t1 d1##_##v1##_t; d1##_##v1##_t *d1##_##v1 = (d1##_##v1##_t *)DLLOFFSET(d1,o1); -#define D2ASMPTR(d1,v1,o1) DWORD d1##_##v1 = DLLOFFSET(d1,o1); - -#else - -#define D2FUNCPTR(d1,v1,t1,t2,o1) typedef t1 d1##_##v1##_t t2; extern d1##_##v1##_t *d1##_##v1; -#define D2VARPTR(d1,v1,t1,o1) typedef t1 d1##_##v1##_t; extern d1##_##v1##_t *d1##_##v1; -#define D2ASMPTR(d1,v1,o1) extern DWORD d1##_##v1; - -#endif - -#define _D2PTRS_START D2Funcs::D2CLIENT_PrintGameString - -namespace D2Funcs -{ -//D2CLIENT -D2FUNCPTR(D2CLIENT, PrintGameString, void __stdcall, (const wchar_t* wMessage, int nColor), 0x16780) -D2FUNCPTR(D2CLIENT, PrintPartyString, void __stdcall, (const wchar_t* wMessage, int nColor), 0x16540) -D2FUNCPTR(D2CLIENT, GetPlayer, UnitAny* __stdcall, (void), 0x4B350) -D2FUNCPTR(D2CLIENT, GetSelectedUnit, UnitAny* __stdcall, (void), 0x2F950) -D2FUNCPTR(D2CLIENT, GetUnitById, UnitAny* __fastcall, (DWORD UnitID, DWORD UnitType),0x4C060) -D2FUNCPTR(D2CLIENT, ClearScreen, int __stdcall, (void), 0x6AB90) -D2FUNCPTR(D2CLIENT, ClearScreen2, void __stdcall, (void), 0x31FA0) -D2FUNCPTR(D2CLIENT, ClearScreen3, BOOL __stdcall, (BOOL bUnk, BOOL bClearScreen), 0x61D50) -D2FUNCPTR(D2CLIENT, SetUiVar, int __fastcall, (int UIMode, BOOL HowSet, int bClearScreen), 0x65690) - -D2FUNCPTR(D2CLIENT, CreateSpell, UnitAny* __fastcall, (DWORD nType, UnitAny* pUnit, SpellStrc* pSpellData, BOOL bOverrideStun), 0x6D7B0) - -D2FUNCPTR(D2CLIENT, RevealAutomapRoom, void __stdcall, (Room1* pRoom1, DWORD dwClipFlag, AutoMapLayer* aLayer), 0x52A20) -D2FUNCPTR(D2CLIENT, NewAutomapCell, AutoMapCell* __fastcall, (void), 0x4FB10) -D2FUNCPTR(D2CLIENT, AddAutomapCell, void __fastcall, (AutoMapCell* aCell, AutoMapCell** node), 0x515F0) - - -D2FUNCPTR(D2CLIENT, LoadWarpTiles, void __stdcall, (int ActNo), 0x301B0) -D2FUNCPTR(D2CLIENT, LoadActPal, void __stdcall, (int Unk, char* path), 0x44600) - -D2FUNCPTR(D2CLIENT, InitD2Menu, int __stdcall, (D2Menu * ptD2Menu, D2MenuEntry *ptD2MenuEntry),0x8DBC0) -D2FUNCPTR(D2CLIENT, D2MenuChange, int __fastcall, (int MouseX, int aNull, int MouseY),0x8E660) -D2FUNCPTR(D2CLIENT, D2DrawBar, void __fastcall, (int MenuPosY, int aNull, D2MenuEntry *Entry, int nTransLvl, bool isCellFile), 0x8CB20) - -D2FUNCPTR(D2CLIENT, GetCursorItem, UnitAny* __fastcall, (void), 0x27F30) -D2FUNCPTR(D2CLIENT, GetItemEleDmg, BOOL __stdcall, (UnitAny *ptUnit, int *MinDmg, int *MaxDmg, int *aCol, Skill *ptSkill), 0x3EF90) - -D2FUNCPTR(D2CLIENT, UpdateAutoMap, void __fastcall, (BOOL bUpdate), 0x51710) -D2FUNCPTR(D2CLIENT, ClearScreen4, void __fastcall, (), 0x65F90) - -//D2COMMON -//Skill Funcs -D2FUNCPTR(D2COMMON, GetSkillById, Skill* __fastcall, (UnitAny *ptUnit, int SkillId, int SkillFlags), -10704) -D2FUNCPTR(D2COMMON, GetSkillLevel, int __stdcall, (UnitAny* ptUnit, Skill* ptSkill, int aType),-10109) -D2FUNCPTR(D2COMMON, GetSkillType, int __stdcall, (UnitAny* ptUnit, Skill* ptSkill), -10010) -D2FUNCPTR(D2COMMON, GetSkillId, int __stdcall, (Skill* ptSkill, char* szFile, int aLine), -10170) - -D2FUNCPTR(D2COMMON, GetSkillDmgBonus, int __stdcall, (UnitAny* ptUnit,int FormulaNo, int SkillId, int SkillLvl), -10447) -D2FUNCPTR(D2COMMON, GetPhysMinDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aZero), -10706) -D2FUNCPTR(D2COMMON, GetPhysMaxDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aZero), -10533) -D2FUNCPTR(D2COMMON, GetEleDmgDuration, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -10777) -D2FUNCPTR(D2COMMON, GetEleMinDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -10482) -D2FUNCPTR(D2COMMON, GetEleMaxDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -11145) -D2FUNCPTR(D2COMMON, EvaluateSkill, int __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl),-10074) - -D2FUNCPTR(D2COMMON, GetLeftSkill, Skill* __stdcall, (UnitAny* ptUnit), -10064) -D2FUNCPTR(D2COMMON, GetRightSkill, Skill* __stdcall, (UnitAny* ptUnit), -11036) - -//Map Funcs -D2FUNCPTR(D2COMMON, GetLevelNoByRoom, int __stdcall, (Room1* ptRoom), -11021) -D2FUNCPTR(D2COMMON, GetActNoByLevelNo, int __stdcall, (int dwLevelNo), -10026) -D2FUNCPTR(D2COMMON, GetTownLevel, int __stdcall, (int dwActNo), -10394) -D2FUNCPTR(D2COMMON, AddRoomData, void __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10787) -D2FUNCPTR(D2COMMON, RemoveRoomData, void __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10672) -D2FUNCPTR(D2COMMON, GetLevel, Level* __fastcall, (ActMisc* pMisc, int dwLevelNo), -11058) -D2FUNCPTR(D2COMMON, GetLayer, AutoMapLayer2* __fastcall, (DWORD dwLevelNo), -10641) -D2FUNCPTR(D2COMMON, GetObjectTxt, ObjectTxt* __stdcall, (DWORD objno), -10916) -D2FUNCPTR(D2COMMON, LoadAct, Act* __stdcall, (DWORD ActNumber, DWORD InitSeed, DWORD Unk0, Game *pGame, DWORD DiffLvl, DWORD* pMemPool, DWORD TownLevelId, DWORD* pfAutomap, DWORD* pfTownAutomap), -10669) -D2FUNCPTR(D2COMMON, UnloadAct, Act* __stdcall, (Act* pAct), -10651) -D2FUNCPTR(D2COMMON, SetActCallback, void __stdcall, (Act *pAct, DWORD* pFnCallback), -11102) -D2FUNCPTR(D2COMMON, GetRoomXYByLevel, Room1* __stdcall, (Act* ptAct, int LevelNo, int Unk0, int* xPos, int* yPos, int UnitAlign), -10743) // Player Align = 2 -D2FUNCPTR(D2COMMON, GetRoomByXY, Room1* __stdcall, (Act* ptAct, int nX, int nY), -10674) -D2FUNCPTR(D2COMMON, MapToAbsScreen, void __stdcall, (long *pX, long *pY), -11157) -D2FUNCPTR(D2COMMON, AbsScreenToMap, void __stdcall, (long *mX, long *mY), -10208) -D2FUNCPTR(D2COMMON, GetUnitXOffset, int __stdcall, (UnitAny* pUnit), -10289) -D2FUNCPTR(D2COMMON, GetUnitYOffset, int __stdcall, (UnitAny* pUnit), -10125) -//Stat funcs -D2FUNCPTR(D2COMMON, SetStat, int __stdcall, (UnitAny *ptUnit, int nStat, int nValue, int nLayer),-10590) -D2FUNCPTR(D2COMMON, GetStatSigned, int __stdcall, (UnitAny *ptUnit, int nStat, int nLayer),-10061) -D2FUNCPTR(D2COMMON, GetBaseStatSigned, int __stdcall, (UnitAny *ptUnit, int nStat, int nLayer),-10550) -D2FUNCPTR(D2COMMON, GetUnitState, int __stdcall, (UnitAny *ptUnit, DWORD dwStateNo), -10604) -D2FUNCPTR(D2COMMON, GetStateStatList, StatList* __stdcall, (UnitAny* ptUnit, int StateNo), -10219) -D2FUNCPTR(D2COMMON, GetUnitMaxLife, unsigned int __stdcall, (UnitAny *ptUnit),-10983) -D2FUNCPTR(D2COMMON, GetUnitMaxMana, unsigned int __stdcall, (UnitAny *ptUnit),-10042) -D2FUNCPTR(D2COMMON, GetUnitRoom, Room1* __stdcall, (UnitAny *ptUnit), -10933) -D2FUNCPTR(D2COMMON, SetGfxState, void __stdcall, (UnitAny *ptUnit, int StateNo, int HowSet), -10702) -D2FUNCPTR(D2COMMON, GetExpToAchiveLvl, int __stdcall, (int ClassId, int ExpLvl), -10152) -//Item Related -D2FUNCPTR(D2COMMON, GetItemText, ItemsTxt* __stdcall, (int ItemNo), 0x42F60) -D2FUNCPTR(D2COMMON, GetItemByBodyLoc, UnitAny* __stdcall, (Inventory * pInventory, int aLoc), -11003) -D2FUNCPTR(D2COMMON, GetItemFlag, BOOL __stdcall, (UnitAny *item, DWORD flagmask, DWORD lineno, char *filename), -10303) -D2FUNCPTR(D2COMMON, GetItemColor, BYTE* __stdcall, (UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4), -11106) -//D2NET -D2FUNCPTR(D2NET, SendPacket, bool __stdcall, (int PacketLen, int _1, BYTE *aPacket),-10020) -D2FUNCPTR(D2NET, ReceivePacket, void __fastcall, (int* eLen, BYTE* aPacket, int aLen), 0x6350) - -//BNCLIENT -D2FUNCPTR(BNCLIENT, SendBNMessage, void __fastcall, (const char* szMsg), 0x14070) - -//D2GFX -D2FUNCPTR(D2GFX, DrawRectangle, void __stdcall, (int X1, int Y1, int X2, int Y2, int dwColor, int dwTrans), -10000) -D2FUNCPTR(D2GFX, DrawLine, void __stdcall, (int X1, int Y1, int X2, int Y2, BYTE Col, BYTE Unk), -10001) - -D2FUNCPTR(D2GFX, GetHwnd, HWND __stdcall, (void), -10022)//0x80D0) -D2FUNCPTR(D2GFX, DrawCellContext, void __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE *Pal255), -10044) -D2FUNCPTR(D2GFX, DrawCellContextEx, void __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE Color), -10068) - -D2FUNCPTR(D2GFX, GetResolutionMode, int __stdcall, (), -10063) -D2FUNCPTR(D2GFX, D2GFX_SetResolutionMode, BOOL __stdcall, (int nMode, int bUpdate), -10029) -D2FUNCPTR(D2GFX, SetScreenShift, void __fastcall, (int nShift), -10073) - - -D2FUNCPTR(D2GFX, 10015, int __stdcall, (), -10015) -D2FUNCPTR(D2GFX, 10030, void __stdcall, (long x1, long y1, int a96, long* x2, long* y2, BOOL a6), -10030) -D2FUNCPTR(D2GFX, 10036, int __stdcall, (DWORD a1,DWORD a2,DWORD a3,DWORD a4), -10036) -D2FUNCPTR(D2GFX, 10037, void __stdcall, (DWORD a1), -10037) -//D2WIN -D2FUNCPTR(D2WIN, ResizeWindow, BOOL __stdcall, (int nMode), -10157) -D2FUNCPTR(D2WIN, LoadCellFile, CellFile* __fastcall, (const char* szFile, int Type), -10004) -D2FUNCPTR(D2WIN, DrawCellFile, void __fastcall, (CellFile * pCellFile,int xPos,int yPos,int div,int trans,int Color),-10140) -//Text--- -D2FUNCPTR(D2WIN, DrawText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered),-10064) -D2FUNCPTR(D2WIN, DrawTextEx, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered, int TransLvl),-10043) -D2FUNCPTR(D2WIN, DrawFilledText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int dwAlign, int FilledXSize),-10023) -D2FUNCPTR(D2WIN, DrawFramedText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10039) -D2FUNCPTR(D2WIN, DrawRectangledText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nRectColor, int nRectTrans, int nColor), -10103) -D2FUNCPTR(D2WIN, GetFontHeight, short __fastcall, (void), -10138) -D2FUNCPTR(D2WIN, GetTextWidth, int __fastcall, (const wchar_t * wStr), -10128) -D2FUNCPTR(D2WIN, GetTextWidthAndFont, int __fastcall, (const wchar_t * wStr, int * nWidth, int *nFont), -10183) -D2FUNCPTR(D2WIN, SetTextSize, int __fastcall, (int dwSize), -10170) -//Controls-- -D2FUNCPTR(D2WIN, Fadeout, void __stdcall, (Control* pControl, int HowSet), -10000) -D2FUNCPTR(D2WIN, SetControlFadeout, void __stdcall, (Control* pControl, int HowSet), -10199) -D2FUNCPTR(D2WIN, DeleteControl, BOOL __stdcall, (Control** pControl), -10020) - -D2FUNCPTR(D2WIN, CreateEditBox, EditBox* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int LeftOffset, int TopOffset, CellFile *ptCellFile, BOOL (__stdcall *AcceptHandle)(char*), BOOL (__stdcall *OnClick)(Control *), DWORD EditBoxFlags, cStylePrefs * ptPrefs), -10112) -D2FUNCPTR(D2WIN, SetEditBoxText, EditBox* __fastcall, (EditBox* pControl, const wchar_t* wText), -10149) -D2FUNCPTR(D2WIN, SetEditBoxFocus, BOOL __stdcall, (EditBox* pControl), -10088) -D2FUNCPTR(D2WIN, DeleteEditBox, BOOL __fastcall, (EditBox* pControl), -10085) - -D2FUNCPTR(D2WIN, CreateTextBox, TextBox* __fastcall, (int xPos,int yPos, int SizeX, int SizeY, int nLeftOffset, int nTopOffset, CellFile *ptCellFile, BOOL (__stdcall *OnClick)(Control *), DWORD dwTextFlags, cStylePrefs *ptPrefs, cTextPrefs *ptScrollPrefs), -10054) -D2FUNCPTR(D2WIN, SetTextBoxText, BOOL __fastcall, (TextBox *pTextBox, const wchar_t *wText), -10042) - -D2FUNCPTR(D2WIN, CreateButton, Button* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *ptCellFile, BOOL (__stdcall *OnClick)(Control *), DWORD dwVKHotKey, DWORD CellFrame, DWORD ButtonFlags, DWORD TblTextNo, BOOL (__stdcall *OnHoverHandle)(Control *)), -10134) - -D2FUNCPTR(D2WIN, CreateImage, Image* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *pCellFile, BOOL (__stdcall *OnClick)(Control *), void *a7, BOOL (__stdcall *KeyHandle)(Control *)), -10005) -//Other-- -D2FUNCPTR(D2WIN, GetPalette, BYTE* __fastcall, (int nPal), -10200) -D2FUNCPTR(D2WIN, MixRGB, BYTE __stdcall, (BYTE Red, BYTE Green, BYTE Blue), -10070) - -D2FUNCPTR(D2WIN, 10021, int __stdcall, (), -10021) - -//D2CMP -D2FUNCPTR(D2CMP, DeleteCellFile, void __stdcall, (CellFile* cf), -10014) -D2FUNCPTR(D2CMP, MixPalette, BYTE* __stdcall,(int TransLvl, int ColorNo), -10071) - -//STORM -D2FUNCPTR(STORM, CloseArchive, BOOL __stdcall, (HANDLE hArchive), -252) - -D2FUNCPTR(STORM, RegisterCommand, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -414) -D2FUNCPTR(STORM, RegisterKeyDown, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -415) -D2FUNCPTR(STORM, RegisterKeyUp, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -416) -D2FUNCPTR(STORM, RegisterMsg, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -417) - -D2FUNCPTR(STORM, UnregisterCommand, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -512) -D2FUNCPTR(STORM, UnregisterKeyDown, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -513) -D2FUNCPTR(STORM, UnregisterKeyUp, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -514) -D2FUNCPTR(STORM, UnregisterMsg, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -515) - -D2FUNCPTR(STORM, ResetMsgQuene, BOOL __stdcall, (StormMsg * psMsg), -511) - -//FOG -D2FUNCPTR(FOG, AllocMemory, void* __fastcall, (int MemSize, char* szFile, int Line, int aNull), -10042) -D2FUNCPTR(FOG, FreeMemory, void __fastcall, (void* MemPool, char* szFile, int Line, int aNull), -10043) -D2FUNCPTR(FOG, AllocServerMemory, void* __fastcall, (void* pMemPool, int MemSize, char* szFile, int Line, int aNull), -10045) -D2FUNCPTR(FOG, FreeServerMemory, void __fastcall, (void* pMemPool, void* Memory, char* szFile, int Line, int aNull), -10046) -D2FUNCPTR(FOG, Error, void __cdecl, (const char* File ,void* Addr ,int Line), -10024) -D2FUNCPTR(FOG, GetErrorData, void* __cdecl, (), -10265) -D2FUNCPTR(FOG, isExpansion, BOOL __cdecl, (), -10227) -D2FUNCPTR(FOG, InitBitBuffer, void __stdcall, (BitBuffer* ptBitBuffer, void * ptBuffer, int nSize), -10126) -D2FUNCPTR(FOG, ReadBitsSigned, signed int __stdcall, (BitBuffer* ptBitBuffer, int nBits), -10129) -D2FUNCPTR(FOG, ReadBits, unsigned int __stdcall, (BitBuffer* ptBitBuffer, int nBits), -10130) - -//D2SOUND -D2FUNCPTR(D2SOUND, PlaySound, void __fastcall, (const char * szFileName), -10029) - -//D2LANG -D2FUNCPTR(D2LANG, GetLocaleText, wchar_t* __fastcall, (short nLocaleTxtNo), -10000) -D2FUNCPTR(D2LANG, GetLocaleId, int __fastcall, (), -10013) -} - -namespace D2Vars -{ -D2VARPTR(D2LAUNCH, BnData, BnetData*, 0x25AAC) -D2VARPTR(BNCLIENT, BnSocket, DWORD*,0x1D83C) -D2VARPTR(BNCLIENT, BnIp, char*, 0x1D330) -D2VARPTR(D2CLIENT, PlayerUnit, UnitAny* , 0x11C1E0) -D2VARPTR(D2CLIENT, SelectedItem, UnitAny* ,0x11BBDC) -D2VARPTR(D2CLIENT, Act, Act*, 0x11C2D0) -D2VARPTR(D2CLIENT, Ping, int, 0x11A2A4) -D2VARPTR(D2CLIENT, FPS, int, 0x11C1EC) -D2VARPTR(D2CLIENT, UIModes, int, 0x1040C0) //0x6FBB40C0 -D2VARPTR(D2CLIENT, UICollisions, int*, 0xEF1B8) -D2VARPTR(D2CLIENT, MouseClick, BOOL, 0x11BE3C) -D2VARPTR(D2CLIENT, Roster, RosterUnit* , 0x11C33C) -D2VARPTR(D2CLIENT, MouseX, int, 0x11B418) -D2VARPTR(D2CLIENT, MouseY, int, 0x11B414) -D2VARPTR(D2CLIENT, Offset, POINT, 0x11C188) -D2VARPTR(D2CLIENT, Divisior, DWORD, 0xF13F0) -D2VARPTR(D2CLIENT, PlayerX, int, 0x11B678) -D2VARPTR(D2CLIENT, PlayerY, int, 0x11B674) -D2VARPTR(D2CLIENT, ScreenXShift, int,0x11C3E8) -D2VARPTR(D2CLIENT, AutomapInfoY, int, 0x11C1AC) -D2VARPTR(D2CLIENT, TempMessage, wchar_t, 0x11D590) //unused -D2VARPTR(D2CLIENT, pCellBorders, CellFile*, 0x104098) //unused -D2VARPTR(D2CLIENT, BlockScreen, BOOL, 0x11C338) -D2VARPTR(D2CLIENT, BlockedRect, RECT, 0x11A3FC) -D2VARPTR(D2CLIENT, UIModesCallTree, int, 0xED5E0) -D2VARPTR(D2CLIENT, isWeaponSwitch, int, 0x11BC38) -D2VARPTR(D2CLIENT, MapType, int, 0x11C140) -D2VARPTR(D2COMMON, sgptDataTables, sgptDataTable*, -11170) -D2VARPTR(D2CLIENT, AutomapLayer, AutoMapLayer* , 0x11C154) -D2VARPTR(D2WIN, CurrentFont, DWORD, 0x1ED14) -D2VARPTR(D2WIN, GetCharSize, DWORD*,0x204DC) -D2VARPTR(D2CLIENT, PetBarColorGreen, BYTE, 0x11BED8) -D2VARPTR(D2CLIENT, PetBarColorYellow, BYTE, 0x11BED9) -D2VARPTR(D2CLIENT, PetBarColorRed, BYTE, 0x11BEDA) -D2VARPTR(D2CLIENT, isExpansion, BOOL, 0x11A2F4) -D2VARPTR(D2CLIENT, ServerDifficulty, int, 0x11C2A8) -//-----Paket things -D2VARPTR(D2NET, PacketLenTable, int, 0xA900) -D2VARPTR(D2NET, SrvPacketLenTable, int ,0xABD8) -D2VARPTR(D2CLIENT, PacketHandler, D2PacketTable, 0xDBC30) -D2VARPTR(D2CLIENT, SentBytes, int, 0x11C3B8) -D2VARPTR(D2CLIENT, SentPackets, int, 0x11C3C0) -D2VARPTR(D2CLIENT, ServerFlags, DWORD, 0xF1874) -D2VARPTR(D2CLIENT, CurrentName, char*, 0x11A3C8) -D2VARPTR(D2CLIENT, BNCurrentClass, BYTE, 0xF1878) -D2VARPTR(D2CLIENT, OpenCurrentClass, BYTE, 0x11A3BC) - -//-----Menu Things -D2VARPTR(D2CLIENT, D2Menu, D2Menu*, 0x11BB48) -D2VARPTR(D2CLIENT, D2MenuEntries, D2MenuEntry*, 0x11BB4C) -D2VARPTR(D2CLIENT, OldMenu, D2MenuEntry, 0xDDBE8) -D2VARPTR(D2CLIENT, OptionsMenu, D2MenuEntry, 0xDEBF0) -D2VARPTR(D2CLIENT, SndOptionsMenu, D2MenuEntry, 0xE0698) -D2VARPTR(D2CLIENT, VidOptionsMenu, D2MenuEntry, 0xE5678) -D2VARPTR(D2CLIENT, MapOptionsMenu, D2MenuEntry, 0xEA108) -D2VARPTR(D2CLIENT, SelectedMenu, int, 0x11BB44) -D2VARPTR(D2CLIENT, PrevMouseX, int , 0x123414) -D2VARPTR(D2CLIENT, PrevMouseY, int , 0x123410) -D2VARPTR(D2CLIENT, isMenuClick, BOOL, 0x11BB54) -D2VARPTR(D2CLIENT, MenuPent, CellFile*,0x11BF18) -D2VARPTR(D2CLIENT, MenuBar, CellFile*,0x11BB5C) -D2VARPTR(D2CLIENT, MenuBar2, CellFile*,0x11BB60) -D2VARPTR(D2CLIENT, MenuBarSlider, CellFile*,0x11BB64) -D2VARPTR(D2CLIENT, WidestMenu, int , 0x11BB68) - -D2VARPTR(D2CLIENT, MenuMsgs, sMsg, 0xD1258) //k -D2VARPTR(D2CLIENT, UI_Unk5, DWORD, 0x11C2F4)//k -D2VARPTR(D2CLIENT, UI_Unk6, DWORD, 0x11C2F8)//k -D2VARPTR(D2CLIENT, UI_Unk7, DWORD, 0xF1DC4) //k -D2VARPTR(D2CLIENT, UI_Unk8, DWORD, 0xF1DC8) //k - -// MultiRes stuff -D2VARPTR(D2CLIENT, ScreenHeight, int, 0xF4FC8) -D2VARPTR(D2CLIENT, ScreenWidth, int, 0xF4FC4) -D2VARPTR(D2CLIENT, ScreenMode, int, 0x11C3D0) -D2VARPTR(D2CLIENT, ScreenViewHeight, int, 0x123390) -D2VARPTR(D2CLIENT, ScreenViewWidth, int, 0x123394) -D2VARPTR(D2CLIENT, ScreenWidthUnk, int, 0xF4FCC) -D2VARPTR(D2CLIENT, GameView, GameView*, 0x11C2DC) -D2VARPTR(D2CLIENT, UiCover, int, 0x11C3E4) -D2VARPTR(D2CLIENT, UiUnk1, int, 0x11C2F4) -D2VARPTR(D2CLIENT, UiUnk2, int, 0x11C2F8) -D2VARPTR(D2CLIENT, UiUnk3, int, 0x11C310) -D2VARPTR(D2CLIENT, UiUnk4, int, 0x11C314) -D2VARPTR(D2GFX, GfxMode, int, 0x1488C) -D2VARPTR(D2GFX, WindowMode, BOOL, 0x14888) // didn't check - -// OOG Controls -D2VARPTR(D2WIN, FirstControl, Control* , 0x20488) //0x6F900488 -D2VARPTR(D2LAUNCH, ControlArray, Control*, 0x25400) -D2VARPTR(D2LAUNCH, ControlCount, int, 0x25E20) -D2VARPTR(D2MULTI, GameName, EditBox*, 0x39CD4); -D2VARPTR(D2MULTI, GamePass, EditBox*, 0x39CD8); -D2VARPTR(D2MULTI, GamePlayers, EditBox*, 0x39D38) -D2VARPTR(D2CLIENT, InGame, DWORD, 0xF18C0) // 1 - ingame 0 - oog - - -//Game loading override -D2VARPTR(D2CLIENT, Loading_1, DWORD, 0x11C2B8) -D2VARPTR(D2CLIENT, Loading_2, DWORD, 0x11C2C0) -D2VARPTR(D2CLIENT, Difficulty, DWORD, 0x11C2A8) -D2VARPTR(D2CLIENT, Load_Draw, DWORD, 0xF1DCC) -D2VARPTR(D2CLIENT, Load_struct, DWORD*, 0x11C2D4) -D2VARPTR(D2CLIENT, ActPals, char*, 0xFA2FC) -D2VARPTR(D2CLIENT, ActPal, DWORD*, 0x10C4D0) -D2VARPTR(D2CLIENT, CurrentAct, DWORD, 0x11BF2C) -D2VARPTR(D2CLIENT, ActUnk, DWORD, 0x11C318) -D2VARPTR(D2CLIENT, ActTick, DWORD, 0x11A2BC) -D2VARPTR(D2CLIENT, ColorTbl, char, 0x11C1A0) -D2VARPTR(D2CLIENT, ColorTbl2, char, 0x103658) -} - -//6FAF67A0 <- pamietaj inv draw -//6FB69500 <- items draw -//0xDBC30 + 3*4* - -//6FB41CA5 |. E8 36C8FCFF CALL D2Client.6FB0E4E0 - -namespace D2Ptrs -{ -D2FUNCPTR(D2NET, ReceivePacket_I, void __stdcall, (BYTE* aPacket, int aLen), -10034) -D2FUNCPTR(D2CLIENT, SetState_I, BOOL __fastcall, (BYTE* aPacket), 0xBF190) -D2FUNCPTR(D2CLIENT, RemoveState_I, BOOL __fastcall, (BYTE* aPacket), 0xBF150) -D2FUNCPTR(D2CLIENT, EventMsg_I, BOOL __fastcall, (BYTE* aPacket),0xBE9B0) -D2FUNCPTR(D2CLIENT, PartyUpdate_I, BOOL __fastcall, (BYTE* aPacket),0xBEA30) -D2FUNCPTR(D2CLIENT, PartyUpdate_II, BOOL __fastcall, (BYTE* aPacket),0xBEA80) -D2FUNCPTR(D2CLIENT, PartyUpdate_III, BOOL __fastcall, (BYTE* aPacket),0xBEAA0) -D2FUNCPTR(D2CLIENT, PartyUpdate_IV, BOOL __fastcall, (BYTE* aPacket),0xBEA00) -D2FUNCPTR(D2CLIENT, TradeData_I, BOOL __fastcall, (BYTE* aPacket), 0xBDA50) -D2FUNCPTR(D2CLIENT, TradeButton_I, BOOL __fastcall, (BYTE* aPacket), 0xC0AA0) -D2FUNCPTR(D2CLIENT, GameChat_I, BOOL __fastcall, (BYTE* aPacket),0xC0B30) -D2FUNCPTR(D2CLIENT, Pong_I, BOOL __fastcall, (BYTE* aPacket), 0xBD260) // 0x8F - -D2FUNCPTR(D2CLIENT, RemoveObject_I, BOOL __fastcall, (BYTE* aPacket),0xBDDE0) // k 0x0A -D2FUNCPTR(D2CLIENT, UnitCastedXY_I, BOOL __fastcall, (UnitAny* pUnit, BYTE* aPacket), 0xC04E0) //0x4D - -D2ASMPTR(D2WIN, FontNon13, 0xE710) -D2ASMPTR(D2WIN, Font13, 0xE690) - -D2ASMPTR(D2CLIENT, DifuseStat_I, 0xB53A0) -D2ASMPTR(D2CLIENT, SetView_I,0x927A0) -D2ASMPTR(D2CLIENT, PlaySoundNo_I,0x54210) -D2ASMPTR(D2CLIENT, GetLevelName_I,0x61AA0) -D2ASMPTR(D2WIN,GetTextWidth_I,0xE4F0) -D2ASMPTR(D2CLIENT,DrawGZBOX_I,0x61440) -D2ASMPTR(D2CLIENT,Screen_Call,0x17E50) -D2ASMPTR(D2CLIENT,ChatInput_I,0x5E4E0) -D2ASMPTR(D2CLIENT, TestPvpFlag_I, 0x1A980) -D2ASMPTR(D2WIN, LoadMpq_I,0x7D80) -D2ASMPTR(D2CLIENT,MenuFunc_I,0x8D600) -D2ASMPTR(D2CLIENT, CharInfo_I,0x88DD0) -D2ASMPTR(D2CLIENT, GetSkillsTxt_I,0x17A0) -D2ASMPTR(D2CLIENT, GetMeleeDmg_I,0x3F380) -D2ASMPTR(D2CLIENT, IsMuted_I,0x2E690) -D2ASMPTR(D2CLIENT, IsSquelched_I,0x2E6E0) -D2ASMPTR(D2CLIENT, ActMapFunc1, 0x52F40) -D2ASMPTR(D2CLIENT, ActMapFunc2, 0x52C00) -D2ASMPTR(D2CLIENT, ActMapFunc3, 0x36030) -D2ASMPTR(D2CLIENT, SkipAltDraw_J,0x5DD89) -D2ASMPTR(D2CLIENT, DontSkipAltDraw_J,0x5DA00) -D2ASMPTR(D2CLIENT, InitAutomapLayer_I, 0x52BB0) // IT MUST BE ON THE END -} - -#define _D2PTRS_END D2Ptrs::D2CLIENT_InitAutomapLayer_I - -#undef D2FUNCPTR -#undef D2ASMPTR -#undef D2VARPTR - -#pragma optimize ( "", on ) \ No newline at end of file diff --git a/D2Ptrs_113D.h b/D2Ptrs_113D.h deleted file mode 100644 index aa2ca6f..0000000 --- a/D2Ptrs_113D.h +++ /dev/null @@ -1,387 +0,0 @@ -#pragma optimize ( "", off ) -#include "Misc.h" -#include - -#ifdef _DEFINE_PTRS -enum {DLLNO_D2CLIENT, DLLNO_D2COMMON, DLLNO_D2GFX, DLLNO_D2LANG, DLLNO_D2WIN, DLLNO_D2NET, DLLNO_D2GAME, DLLNO_D2LAUNCH, DLLNO_FOG, DLLNO_BNCLIENT, DLLNO_STORM, DLLNO_D2CMP, DLLNO_D2MULTI, DLLNO_D2SOUND, DLLNO_D2GDI, DLLNO_D2DDRAW, DLLNO_D2DIRECT3D, DLLNO_D2GLIDE}; - -#define DLLOFFSET(a1,b1) ((DLLNO_##a1)|((b1)<<8)) -#define D2FUNCPTR(d1,v1,t1,t2,o1) typedef t1 d1##_##v1##_t t2; d1##_##v1##_t *d1##_##v1 = (d1##_##v1##_t *)DLLOFFSET(d1,o1); -#define D2VARPTR(d1,v1,t1,o1) typedef t1 d1##_##v1##_t; d1##_##v1##_t *d1##_##v1 = (d1##_##v1##_t *)DLLOFFSET(d1,o1); -#define D2ASMPTR(d1,v1,o1) DWORD d1##_##v1 = DLLOFFSET(d1,o1); - -#else - -#define D2FUNCPTR(d1,v1,t1,t2,o1) typedef t1 d1##_##v1##_t t2; extern d1##_##v1##_t *d1##_##v1; -#define D2VARPTR(d1,v1,t1,o1) typedef t1 d1##_##v1##_t; extern d1##_##v1##_t *d1##_##v1; -#define D2ASMPTR(d1,v1,o1) extern DWORD d1##_##v1; - -#endif - - -#define _D2PTRS_START D2Funcs::D2CLIENT_PrintGameString - -namespace D2Funcs -{ -//D2CLIENT -D2FUNCPTR(D2CLIENT, PrintGameString, void __stdcall, (const wchar_t* wMessage, int nColor), 0x75EB0) // ns -D2FUNCPTR(D2CLIENT, PrintPartyString, void __stdcall, (const wchar_t* wMessage, int nColor), 0x75C70) //ns -D2FUNCPTR(D2CLIENT, GetPlayer, UnitAny* __stdcall, (void), 0x613C0) //ns -D2FUNCPTR(D2CLIENT, GetSelectedUnit, UnitAny* __stdcall, (void), 0x17280) //k -D2FUNCPTR(D2CLIENT, GetUnitById, UnitAny* __fastcall, (DWORD UnitID, DWORD UnitType),0x620D0) //k -D2FUNCPTR(D2CLIENT, ClearScreen, int __stdcall, (void), 0x3E630) //k -D2FUNCPTR(D2CLIENT, ClearScreen2, void __stdcall, (void), 0x44980) //k -D2FUNCPTR(D2CLIENT, ClearScreen3, BOOL __stdcall, (BOOL bUnk, BOOL bClearScreen), 0x18500) -D2FUNCPTR(D2CLIENT, SetUiVar, int __fastcall, (int UIMode, BOOL HowSet, int bClearScreen), 0x1C190) - -D2FUNCPTR(D2CLIENT, CreateSpell, UnitAny* __fastcall, (DWORD nType, UnitAny* pUnit, SpellStrc* pSpellData, BOOL bOverrideStun), 0x49A90) - -D2FUNCPTR(D2CLIENT, RevealAutomapRoom, void __stdcall, (Room1* pRoom1, DWORD dwClipFlag, AutoMapLayer* aLayer), 0x73160) //ns -D2FUNCPTR(D2CLIENT, NewAutomapCell, AutoMapCell* __fastcall, (void), 0x703C0) // ns -D2FUNCPTR(D2CLIENT, AddAutomapCell, void __fastcall, (AutoMapCell* aCell, AutoMapCell** node), 0x71EA0) //ns - -D2FUNCPTR(D2CLIENT, D2MenuChange, int __fastcall, (int MouseX, int aNull, int MouseY),0xC3190) //k -D2FUNCPTR(D2CLIENT, D2DrawBar, void __fastcall, (int MenuPosY, int aNull, D2MenuEntry *Entry, int nTransLvl, bool isCellFile), 0xC1740) //k - -D2FUNCPTR(D2CLIENT, GetCursorItem, UnitAny* __fastcall, (void), 0x144A0) //ns -D2FUNCPTR(D2CLIENT, GetItemEleDmg, BOOL __stdcall, (UnitAny *ptUnit, int *MinDmg, int *MaxDmg, int *aCol, Skill *ptSkill), 0x35E10) //k - -D2FUNCPTR(D2CLIENT, UpdateAutoMap, void __fastcall, (BOOL bUpdate), 0x71FC0) -D2FUNCPTR(D2CLIENT, ClearScreen4, void __fastcall, (), 0x1CA90) - -//D2COMMON -//Skill Funcs -D2FUNCPTR(D2COMMON, GetSkillById, Skill* __fastcall, (UnitAny *ptUnit, int SkillId, int SkillFlags), -10984) //k -D2FUNCPTR(D2COMMON, GetSkillLevel, int __stdcall, (UnitAny* ptUnit, Skill* ptSkill, int aType),-10007) //k -D2FUNCPTR(D2COMMON, GetSkillType, int __stdcall, (UnitAny* ptUnit, Skill* ptSkill), -10274) //k -D2FUNCPTR(D2COMMON, GetSkillId, int __stdcall, (Skill* ptSkill, char* szFile, int aLine), -11151) //k - -D2FUNCPTR(D2COMMON, GetSkillDmgBonus, int __stdcall, (UnitAny* ptUnit,int FormulaNo, int SkillId, int SkillLvl), -10586) // k -D2FUNCPTR(D2COMMON, GetPhysMinDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aZero), -10687) //k -D2FUNCPTR(D2COMMON, GetPhysMaxDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aZero), -10196) //k -D2FUNCPTR(D2COMMON, GetEleDmgDuration, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -11154) //k -D2FUNCPTR(D2COMMON, GetEleMinDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -10728) //k -D2FUNCPTR(D2COMMON, GetEleMaxDmg, int __stdcall, (UnitAny* ptUnit,int SkillId, int SkillLvl, int aOne), -10662) //k -D2FUNCPTR(D2COMMON, EvaluateSkill, int __stdcall, (UnitAny* ptUnit, int FormulaNo, int SkillId, int SkillLvl),-11081) //k - -D2FUNCPTR(D2COMMON, GetLeftSkill, Skill* __stdcall, (UnitAny* ptUnit), -10909) //k -D2FUNCPTR(D2COMMON, GetRightSkill, Skill* __stdcall, (UnitAny* ptUnit), -10942) //k - -//Map Funcs -D2FUNCPTR(D2COMMON, GetLevelNoByRoom, int __stdcall, (Room1* ptRoom), -10691) // k -D2FUNCPTR(D2COMMON, GetActNoByLevelNo, int __stdcall, (int dwLevelNo), -10864) //k -D2FUNCPTR(D2COMMON, GetTownLevel, int __stdcall, (int dwActNo), -10353) //k -D2FUNCPTR(D2COMMON, AddRoomData, void __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10890) //k -D2FUNCPTR(D2COMMON, RemoveRoomData, void __stdcall, (Act* ptAct, int LevelId, int Xpos, int Ypos, Room1* pRoom), -10208) //k -D2FUNCPTR(D2COMMON, GetLevel, Level* __fastcall, (ActMisc* pMisc, int dwLevelNo), -10283) //k -D2FUNCPTR(D2COMMON, GetLayer, AutoMapLayer2* __fastcall, (DWORD dwLevelNo), -10087) //k -D2FUNCPTR(D2COMMON, GetObjectTxt, ObjectTxt* __stdcall, (DWORD objno), -10319) //k -D2FUNCPTR(D2COMMON, GetRoomXYByLevel, Room1* __stdcall, (Act* ptAct, int LevelNo, int Unk0, int* xPos, int* yPos, int UnitAlign), -10632) //k // Player Align = 2 -D2FUNCPTR(D2COMMON, GetRoomByXY, Room1* __stdcall, (Act* ptAct, int nX, int nY), -11056) // k -D2FUNCPTR(D2COMMON, CheckXYType, BOOL __stdcall,(UnitAny *pUnit, int pX, int pY, int Type), -10841) -D2FUNCPTR(D2COMMON, MapToAbsScreen, void __stdcall, (long *pX, long *pY), -10582) //k -D2FUNCPTR(D2COMMON, AbsScreenToMap, void __stdcall, (long *mX, long *mY), -10720) //k -D2FUNCPTR(D2COMMON, GetUnitXOffset, int __stdcall, (UnitAny* pUnit), -10641) //k -D2FUNCPTR(D2COMMON, GetUnitYOffset, int __stdcall, (UnitAny* pUnit), -10057) //k - -//Stat funcs -D2FUNCPTR(D2COMMON, SetStat, void __stdcall, (UnitAny *ptUnit, int nStat, int nValue, int nLayer),-10590) // 1.13d -D2FUNCPTR(D2COMMON, GetStatSigned, int __stdcall, (UnitAny *ptUnit, int nStat, int nLayer),-10550) // 1.13d -D2FUNCPTR(D2COMMON, GetBaseStatSigned, int __stdcall, (UnitAny *ptUnit, int nStat, int nLayer),-10216) // 1.13d -D2FUNCPTR(D2COMMON, GetUnitState, int __stdcall, (UnitAny *ptUnit, DWORD dwStateNo), -10706) //k -D2FUNCPTR(D2COMMON, GetUnitMaxLife, unsigned int __stdcall, (UnitAny *ptUnit),-10574) //k -D2FUNCPTR(D2COMMON, GetUnitMaxMana, unsigned int __stdcall, (UnitAny *ptUnit),-10084) //k -D2FUNCPTR(D2COMMON, GetUnitRoom, Room1* __stdcall, (UnitAny *ptUnit), -10846) //k -D2FUNCPTR(D2COMMON, GetExpToAchiveLvl, int __stdcall, (int ClassId, int ExpLvl), -10949) //k - -//Item Related -D2FUNCPTR(D2COMMON, GetItemText, ItemsTxt* __stdcall, (int RecordNo), -10994) //k -D2FUNCPTR(D2COMMON, GetItemByBodyLoc, UnitAny* __stdcall, (Inventory * pInventory, int aLoc), -10292) //k -D2FUNCPTR(D2COMMON, GetItemFlag, BOOL __stdcall, (UnitAny *item, DWORD flagmask, DWORD lineno, char *filename), -10458) //k -D2FUNCPTR(D2COMMON, GetItemColor, BYTE* __stdcall, (UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4), -11062) //k - -//D2NET -D2FUNCPTR(D2NET, SendPacket, bool __stdcall, (int PacketLen, int _1, BYTE *aPacket),-10015) // k -D2FUNCPTR(D2NET, ReceivePacket, void __fastcall, (int *eLen, BYTE* aPacket, int aLen), 0x7450) //k - -//BNCLIENT -D2FUNCPTR(BNCLIENT, SendBNMessage, void __fastcall, (const char* szMsg), 0x13050) // ns - -//D2GFX -D2FUNCPTR(D2GFX, DrawRectangle, void __stdcall, (int X1, int Y1, int X2, int Y2, int dwColor, int dwTrans), -10028) // k -D2FUNCPTR(D2GFX, DrawLine, void __stdcall, (int X1, int Y1, int X2, int Y2, BYTE Col, BYTE Unk), -10013) //k - -D2FUNCPTR(D2GFX, GetHwnd, HWND __stdcall, (void), -10007) // k -D2FUNCPTR(D2GFX, DrawCellContext, void __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE *Pal255), -10042) // k -D2FUNCPTR(D2GFX, DrawCellContextEx, void __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE Color), -10067) //k -D2FUNCPTR(D2GFX, GetResolutionMode, int __stdcall, (), -10012) -D2FUNCPTR(D2GFX, SetResolutionMode, BOOL __stdcall, (int nMode, BOOL bUpdate), -10069) -D2FUNCPTR(D2GFX, SetScreenShift, void __fastcall, (int nShift), -10047) - -//D2GDI -D2FUNCPTR(D2GDI, GetCallbacks, fnRendererCallbacks* __fastcall, (), -10000) // Same oridinal for every patch and GFX driver (GDI, D2D, D3D, GLIDE). Used directly but left just in case. - -//D2GLIDE - -D2FUNCPTR(D2GLIDE, AllocCache, BOOL __stdcall, (), 0xD180) - -//D2WIN -D2FUNCPTR(D2WIN, ResizeWindow, BOOL __stdcall, (int nMode), -10037) - -D2FUNCPTR(D2WIN, LoadCellFile, CellFile* __fastcall, (const char* szFile, int Type), -10023) //k -D2FUNCPTR(D2WIN, DrawCellFile, void __fastcall, (CellFile * pCellFile,int xPos,int yPos,int div,int trans,int Color),-10172) //k -//Text--- -D2FUNCPTR(D2WIN, DrawText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered),-10076) //k -D2FUNCPTR(D2WIN, DrawTextEx, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered, int TransLvl),-10084) //k -D2FUNCPTR(D2WIN, DrawFramedText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nColor, int Centered), -10137) //k -D2FUNCPTR(D2WIN, DrawRectangledText, void __fastcall, (const wchar_t * wStr, int X, int Y, int nRectColor, int nRectTrans, int nColor), -10078) -D2FUNCPTR(D2WIN, GetFontHeight, short __fastcall, (void), -10088) //k -D2FUNCPTR(D2WIN, GetTextWidth, int __fastcall, (const wchar_t * wStr), -10150) // k -D2FUNCPTR(D2WIN, SetTextSize, int __fastcall, (int dwSize), -10047) //k -//Controls-- -D2FUNCPTR(D2WIN, Fadeout, void __stdcall, (Control* pControl, int HowSet), -10000) -D2FUNCPTR(D2WIN, SetControlFadeout, void __stdcall, (Control* pControl, int HowSet), -10070) //k -D2FUNCPTR(D2WIN, DeleteControl, BOOL __stdcall, (Control** pControl), -10123) //k -D2FUNCPTR(D2WIN, CreateEditBox, EditBox* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, int LeftOffset, int TopOffset, CellFile *ptCellFile, BOOL (__stdcall *AcceptHandle)(char*), BOOL (__stdcall *OnClick)(Control *), DWORD EditBoxFlags, cStylePrefs * ptPrefs), -10033) //k -D2FUNCPTR(D2WIN, SetEditBoxText, EditBox* __fastcall, (EditBox* pControl, const wchar_t* wText), -10007) //k -D2FUNCPTR(D2WIN, SetEditBoxFocus, BOOL __stdcall, (EditBox* pControl), -10039) //k -D2FUNCPTR(D2WIN, DeleteEditBox, BOOL __fastcall, (EditBox* pControl), -10062) //k -D2FUNCPTR(D2WIN, CreateTextBox, TextBox* __fastcall, (int xPos,int yPos, int SizeX, int SizeY, int nLeftOffset, int nTopOffset, CellFile *ptCellFile, BOOL (__stdcall *OnClick)(Control *), DWORD dwTextFlags, cStylePrefs *ptPrefs, cTextPrefs *ptScrollPrefs), -10151) //k -D2FUNCPTR(D2WIN, SetTextBoxText, BOOL __fastcall, (TextBox *pTextBox, const wchar_t *wText), -10090) //k -D2FUNCPTR(D2WIN, CreateButton, Button* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *ptCellFile, BOOL (__stdcall *OnClick)(Control *), DWORD dwVKHotKey, DWORD CellFrame, DWORD ButtonFlags, DWORD TblTextNo, BOOL (__stdcall *OnHoverHandle)(Control *)), -10192) //k -D2FUNCPTR(D2WIN, CreateImage, Image* __fastcall, (int xPos, int yPos, int SizeX, int SizeY, CellFile *pCellFile, BOOL (__stdcall *OnClick)(Control *), void *a7, BOOL (__stdcall *KeyHandle)(Control *)), -10203) //k - -D2FUNCPTR(D2WIN, MixRGB, BYTE __stdcall, (BYTE Red, BYTE Green, BYTE Blue), -10069) //k - -//D2CMP -D2FUNCPTR(D2CMP, DeleteCellFile, void __stdcall, (CellFile* cf), -10020) //k -D2FUNCPTR(D2CMP, MixPalette, BYTE* __stdcall,(int TransLvl, int ColorNo), -10009) //k - -//FOG -D2FUNCPTR(FOG, AllocMemory, void* __fastcall, (int MemSize, char* szFile, int Line, int aNull), -10042) -D2FUNCPTR(FOG, FreeMemory, void __fastcall, (void* MemPool, char* szFile, int Line, int aNull), -10043) -D2FUNCPTR(FOG, AllocServerMemory, void* __fastcall, (void* pMemPool, int MemSize, char* szFile, int Line, int aNull), -10045) -D2FUNCPTR(FOG, FreeServerMemory, void __fastcall, (void* pMemPool, void* Memory, char* szFile, int Line, int aNull), -10046) -D2FUNCPTR(FOG, Error, void __cdecl, (const char* File ,void* Addr ,int Line), -10024) -D2FUNCPTR(FOG, GetErrorData, void* __cdecl, (), -10265) -D2FUNCPTR(FOG, isExpansion, BOOL __cdecl, (), -10227) -D2FUNCPTR(FOG, InitBitBuffer, void __stdcall, (BitBuffer *pBitBuffer, void *Source, int Size), -10126) -D2FUNCPTR(FOG, ReadBits, unsigned int __stdcall, (BitBuffer* pBuffer, int nBits), -10130) -D2FUNCPTR(FOG, ReadBitsSigned, signed int __stdcall, (BitBuffer* pBuffer, int nBits), -10129) - -//STORM -D2FUNCPTR(STORM, CloseArchive, BOOL __stdcall, (HANDLE hArchive), -252) - -D2FUNCPTR(STORM, RegisterCommand, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -414) -D2FUNCPTR(STORM, RegisterKeyDown, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -415) -D2FUNCPTR(STORM, RegisterKeyUp, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -416) -D2FUNCPTR(STORM, RegisterMsg, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -417) - -D2FUNCPTR(STORM, UnregisterCommand, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -512) -D2FUNCPTR(STORM, UnregisterKeyDown, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -513) -D2FUNCPTR(STORM, UnregisterKeyUp, BOOL __stdcall, (HANDLE hWnd, DWORD vKey, void (__stdcall *fnCallBack)(StormMsg *)), -514) -D2FUNCPTR(STORM, UnregisterMsg, BOOL __stdcall, (HANDLE hWnd, WPARAM wParam, void (__stdcall *fnCallBack)(StormMsg *)), -515) - -D2FUNCPTR(STORM, ResetMsgQuene, BOOL __stdcall, (StormMsg * psMsg), -511) - -//D2LANG -D2FUNCPTR(D2LANG, GetLocaleText, wchar_t* __fastcall, (short nLocaleTxtNo), -10004) //k -D2FUNCPTR(D2LANG, GetLocaleId, int __fastcall, (), -10001) //k -} - -namespace D2Vars -{ -D2VARPTR(D2LAUNCH, BnData, BnetData*, 0x25B30) //k -D2VARPTR(BNCLIENT, BnSocket, DWORD*,0x1F878) //k -D2VARPTR(D2CLIENT, PlayerUnit, UnitAny* , 0x11D050) // k ? -D2VARPTR(D2CLIENT, SelectedItem, UnitAny* ,0x11CB28) //k -D2VARPTR(D2CLIENT, Act, Act*, 0x11D200) // k -D2VARPTR(D2CLIENT, Ping, int, 0x108764) // ns -D2VARPTR(D2CLIENT, FPS, int, 0x11CE10) // ns -D2VARPTR(D2CLIENT, UIModes, int, 0x11C890) //1.13d -D2VARPTR(D2CLIENT, UICollisions, int*, 0xF9878) -D2VARPTR(D2CLIENT, Roster, RosterUnit* , 0x11CB04) // k -D2VARPTR(D2CLIENT, MouseX, int, 0x11C950) //k -D2VARPTR(D2CLIENT, MouseY, int, 0x11C94C) //k -D2VARPTR(D2CLIENT, Offset, POINT, 0x11CF5C) // ns -D2VARPTR(D2CLIENT, Divisior, DWORD, 0xF34F8) //ns -D2VARPTR(D2CLIENT, PlayerX, int, 0x106844) //k -D2VARPTR(D2CLIENT, PlayerY, int, 0x106840) //k -D2VARPTR(D2CLIENT, ScreenXShift, int,0x11D074) //k -D2VARPTR(D2CLIENT, AutomapInfoY, int, 0x11CF80) //k -D2VARPTR(D2CLIENT, ServerDifficulty, int, 0x11D1D8) -D2VARPTR(D2CLIENT, isWeaponSwitch, int, 0x11CB84) //k -D2VARPTR(D2CLIENT, BlockScreen, BOOL, 0x11D580) //k -D2VARPTR(D2CLIENT, BlockedRect, RECT, 0x11C92C) //k - -D2VARPTR(D2CLIENT, UIModesCallTree, int, 0xF6A80) //k -D2VARPTR(D2CLIENT, MapType, int, 0x11CF14) // k -//D2VARPTR(D2CLIENT, sgptDataTables, sgptDataTable*, 0xCF474) // k -D2VARPTR(D2COMMON, sgptDataTables, sgptDataTable*, 0xA33F0) // eon -D2VARPTR(D2CLIENT, AutomapLayer, AutoMapLayer* , 0x11CF28) //ns -D2VARPTR(D2WIN, CurrentFont, DWORD, 0x1FBA8) //k -D2VARPTR(D2WIN, GetCharSize, DWORD*,0x8D9F8) //k -D2VARPTR(D2CLIENT, PetBarColorGreen, BYTE, 0x11CE38) -D2VARPTR(D2CLIENT, PetBarColorYellow, BYTE, 0x11CE39) -D2VARPTR(D2CLIENT, PetBarColorRed, BYTE, 0x11CE3A) -D2VARPTR(D2CLIENT, ServerFlags, DWORD, 0xF7B34) // k -D2VARPTR(D2CLIENT, CurrentName, char*, 0x108888) //k -D2VARPTR(D2CLIENT, BNCurrentClass, BYTE, 0xF7B38) //k -D2VARPTR(D2CLIENT, OpenCurrentClass, BYTE, 0x10887C) //k - -//-----Packets things -D2VARPTR(D2CLIENT, PacketHandler, D2PacketTable, 0xEF4B0) //k -D2VARPTR(D2CLIENT, SentBytes, int, 0x11D594) //k -D2VARPTR(D2CLIENT, SentPackets, int, 0x11D59C) //k -D2VARPTR(D2NET, SrvPacketLenTable, int, 0xABD8) //k <- Same as in 1.11b - -//-----Menu Things -D2VARPTR(D2CLIENT, D2Menu, D2Menu*, 0x11C9EC) //k -D2VARPTR(D2CLIENT, D2MenuEntries, D2MenuEntry*, 0x11C9F0) //k -D2VARPTR(D2CLIENT, OldMenu, D2MenuEntry, 0xDCE40) //k -D2VARPTR(D2CLIENT, OptionsMenu, D2MenuEntry, 0xDDE48) //k -D2VARPTR(D2CLIENT, SndOptionsMenu, D2MenuEntry, 0xDF8F0) //k -D2VARPTR(D2CLIENT, VidOptionsMenu, D2MenuEntry, 0xE48D0) //k -D2VARPTR(D2CLIENT, MapOptionsMenu, D2MenuEntry, 0xE9360) //k -D2VARPTR(D2CLIENT, SelectedMenu, int, 0x11C9E8) //k -D2VARPTR(D2CLIENT, PrevMouseX, int , 0x124468)//k -D2VARPTR(D2CLIENT, PrevMouseY, int , 0x124464) //k -D2VARPTR(D2CLIENT, isMenuClick, BOOL, 0x11C9F8) //k -D2VARPTR(D2CLIENT, isMenuValueClick, BOOL, 0x11C9FC) -D2VARPTR(D2CLIENT, MenuPent, CellFile*,0x11D374) //k -D2VARPTR(D2CLIENT, MenuBar, CellFile*,0x11CA00) //k -D2VARPTR(D2CLIENT, MenuBar2, CellFile*,0x11CA04) //k -D2VARPTR(D2CLIENT, MenuBarSlider, CellFile*,0x11CA08) //k -D2VARPTR(D2CLIENT, MenuMsgs, sMsg, 0xD3D20) -D2VARPTR(D2CLIENT, UI_Unk1, DWORD, 0x11D578) -D2VARPTR(D2CLIENT, UI_Unk2, DWORD, 0x11D57C) -D2VARPTR(D2CLIENT, UI_Unk7, DWORD, 0xF624C) -D2VARPTR(D2CLIENT, UI_Unk8, DWORD, 0xF6250) - -//D2MultiRes stuff -D2VARPTR(D2CLIENT, ScreenHeight, int, 0xF7038) //k -D2VARPTR(D2CLIENT, ScreenWidth, int, 0xF7034) // k -D2VARPTR(D2CLIENT, ScreenMode, int, 0x11D2B4) -D2VARPTR(D2CLIENT, ScreenViewHeight, int, 0x123D60) -D2VARPTR(D2CLIENT, ScreenViewWidth, int, 0x123D64) -D2VARPTR(D2CLIENT, ScreenWidthUnk, int, 0xF703C) // This var seems be unused, mby it is by other module didn't check deeply -D2VARPTR(D2CLIENT, GameView, GameView*, 0x11D20C) -D2VARPTR(D2CLIENT, UiCover, int, 0x11D070) -D2VARPTR(D2CLIENT, UiUnk1, int, 0x11D224) -D2VARPTR(D2CLIENT, UiUnk2, int, 0x11D228) -D2VARPTR(D2CLIENT, UiUnk3, int, 0x11D240) -D2VARPTR(D2CLIENT, UiUnk4, int, 0x11D244) - -D2VARPTR(D2GFX, pfnDriverCallback, fnRendererCallbacks*, 0x14A48) -D2VARPTR(D2GFX, GfxMode, int, 0x14A40) -D2VARPTR(D2GFX, WindowMode, BOOL, 0x14A3C) -D2VARPTR(D2GFX, DriverType, int, 0x14A38) -D2VARPTR(D2GFX, gpbBuffer, void*, 0x14320) -D2VARPTR(D2GFX, Width, int, 0x14324) -D2VARPTR(D2GFX, Height, int, 0x14328) -D2VARPTR(D2GFX, ScreenShift, int, 0x14A50) -D2VARPTR(D2GFX, fnHelpers, GFXHelpers, 0x10BFC) // table of 7 functions -D2VARPTR(D2GFX, Settings, GFXSettings, 0x10BE4) -D2VARPTR(D2GFX, hInstance, HINSTANCE, 0x14A30) -D2VARPTR(D2GFX, hDriverModHandle, HMODULE, 0x14A4C) -D2VARPTR(D2GFX, bPerspective, BOOL, 0x10BE8) -D2VARPTR(D2GFX, GammaValue, int, 0x10BF0) - -D2VARPTR(D2GDI, WindowWidth, int, 0xCA98) -D2VARPTR(D2GDI, BitmapHeight, int, 0xC980) -D2VARPTR(D2GDI, BitmapWidth, int, 0xC970) -D2VARPTR(D2GDI, gpbBuffer, void*, 0xCA9C) -D2VARPTR(D2GDI, DIB, HBITMAP, 0xC97C) -D2VARPTR(D2GDI, hWnd, HANDLE, 0xC568) -D2VARPTR(D2GDI, PaletteEntries, PALETTEENTRY*, 0xC570) -D2VARPTR(D2GDI, Palette, HPALETTE, 0xC974) -D2VARPTR(D2GDI, hFont, HFONT, 0xC988) -D2VARPTR(D2GDI, Unk, int, 0xCA94) -D2VARPTR(D2GDI, csPause, CRITICAL_SECTION*, 0xCAA4) - -D2VARPTR(D2GLIDE, bIsWindowOpen, BOOL, 0x17B2C) -D2VARPTR(D2GLIDE, Width, int, 0x15A78) -D2VARPTR(D2GLIDE, Height, int, 0x15B14) -D2VARPTR(D2GLIDE, Context, GrContext_t, 0x15AA0) -D2VARPTR(D2GLIDE, TMUCount, FxI32, 0x17B18) -D2VARPTR(D2GLIDE, TextureAlign, FxI32, 0x17B20) -D2VARPTR(D2GLIDE, bUMAAvailable, BOOL, 0x17B1C) -D2VARPTR(D2GLIDE, hWnd, HANDLE, 0x15A74) - -//Key Config -D2VARPTR(D2CLIENT, KeyBindings, KeyBinding, 0x108D90) // ArraySize = 114 -D2VARPTR(D2CLIENT, KeyEntries, KeyConfigEntry*, 0xF0154) // Pointer to Config Menu Entries -D2VARPTR(D2CLIENT, KeyClassicEntries, KeyConfigEntry, 0xEFCE8) // List of non expansion entries ( 51 ) -D2VARPTR(D2CLIENT, KeyEntriesNo, int, 0x11CE90) -D2VARPTR(D2CLIENT, KeyThumbSize, int, 0x11CE94) -D2VARPTR(D2CLIENT, KeyThumbYDrag, int, 0x11CE98) -D2VARPTR(D2CLIENT, isExpansion, BOOL, 0x1087B4) - -// OOG Controls -D2VARPTR(D2WIN, FirstControl, Control* , 0x8DB34) //k -D2VARPTR(D2LAUNCH, ControlArray, Control*, 0x25828) //k -D2VARPTR(D2LAUNCH, ControlCount, int, 0x25EA0) //k -D2VARPTR(D2MULTI, GameName, EditBox*, 0x3A004) //k -D2VARPTR(D2MULTI, GamePass, EditBox*, 0x3A008) //k -D2VARPTR(D2CLIENT, InGame, DWORD, 0xF79E0) // // k 1 - ingame 0 - oog - -} - -//6FAF67A0 <- pamietaj inv draw -//6FB69500 <- items draw -//0xDBC30 + 3*4* - -//6FB41CA5 |. E8 36C8FCFF CALL D2Client.6FB0E4E0 - -namespace D2Ptrs -{ -D2ASMPTR(D2NET, ReceivePacket_I, -10001) // k [isPacketCorrect] -//Packet overriders -D2FUNCPTR(D2CLIENT, RemoveObject_I, BOOL __fastcall, (BYTE* aPacket),0x83730) // k 0x0A -D2FUNCPTR(D2CLIENT, GameChat_I, BOOL __fastcall, (BYTE* aPacket),0x85E80) // k 0x26 -D2FUNCPTR(D2CLIENT, UnitCastedXY_I, BOOL __fastcall, (UnitAny* pUnit, BYTE* aPacket), 0x85660) //0x4D -D2FUNCPTR(D2CLIENT, EventMsg_I, BOOL __fastcall, (BYTE* aPacket),0x83BD0) // k 0x5A -D2FUNCPTR(D2CLIENT, PartyUpdate_III, BOOL __fastcall, (BYTE* aPacket),0x83D20) // k 0x7F -D2FUNCPTR(D2CLIENT, PartyUpdate_II, BOOL __fastcall, (BYTE* aPacket),0x83D00) // k 0x8B -D2FUNCPTR(D2CLIENT, PartyUpdate_I, BOOL __fastcall, (BYTE* aPacket),0x83CB0) //k 0x8C -D2FUNCPTR(D2CLIENT, PartyUpdate_IV, BOOL __fastcall, (BYTE* aPacket),0x83C80) // k 0x8D -D2FUNCPTR(D2CLIENT, TradeData_I, BOOL __fastcall, (BYTE* aPacket), 0x82470) // k 0x78 -D2FUNCPTR(D2CLIENT, TradeButton_I, BOOL __fastcall, (BYTE* aPacket), 0x85DF0) // k 0x77 -D2FUNCPTR(D2CLIENT, SetState_I, BOOL __fastcall, (BYTE* aPacket), 0x84250) // k 0xA8 -D2FUNCPTR(D2CLIENT, RemoveState_I, BOOL __fastcall, (BYTE* aPacket), 0x84210) // k 0xA9 -D2FUNCPTR(D2CLIENT, Pong_I, BOOL __fastcall, (BYTE* aPacket), 0x82440) // 0x8F - -D2ASMPTR(D2GAME, FindFreeCoords_I,0xE0000) -D2ASMPTR(D2GAME, CheckXYOccupy_I,0x1340) -D2ASMPTR(D2CLIENT, PlaySoundNo_I,0x26270) // k -D2ASMPTR(D2CLIENT, GetLevelName_I,0x18250) //k -D2ASMPTR(D2CLIENT, DrawGZBOX_I,0x17D10) // k -D2ASMPTR(D2CLIENT, Screen_Call,0x77810) // 1.13d -D2ASMPTR(D2CLIENT, TestPvpFlag_I, 0x6A720) // k -D2ASMPTR(D2WIN, LoadMpq_I,0x7E50) //k -D2ASMPTR(D2CLIENT, MenuFunc_I,0xC2480) // k -D2ASMPTR(D2CLIENT, CharInfo_I,0xBF090) //k -D2ASMPTR(D2CLIENT, GetSkillsTxt_I,0x19F0) // SkillDesc actually // k -D2ASMPTR(D2CLIENT, GetMeleeDmg_I,0x36200) // k -D2ASMPTR(D2CLIENT, IsMuted_I,0xA1DF0) //k -D2ASMPTR(D2CLIENT, IsSquelched_I,0xA1E40) //k -D2ASMPTR(D2CLIENT, SkipAltDraw_J,0x4E9A9) //k -D2ASMPTR(D2CLIENT, DontSkipAltDraw_J,0x4E620) //k -D2ASMPTR(D2CLIENT, ChatInput_I,0xB1CE0) //1.13d -D2ASMPTR(D2CLIENT, DifuseStat_I, 0x6CC10) // k -D2ASMPTR(D2CLIENT, SetView_I,0xB5330) // k -D2ASMPTR(D2WIN, FontNon13, 0x12D60) //k -D2ASMPTR(D2WIN, Font13, 0x12CE0) //k - -//D2MultiRes -D2ASMPTR(D2GFX, Resize, 0x8300) // k - -D2ASMPTR(D2CLIENT, InitAutomapLayer_I, 0x733D0) // kk IT MUST BE ON THE END -} -#define _D2PTRS_END D2Ptrs::D2CLIENT_InitAutomapLayer_I - -#undef D2FUNCPTR -#undef D2ASMPTR -#undef D2VARPTR - -#pragma optimize ( "", on ) diff --git a/D2Structs_111B.h b/D2Structs_111B.h index fd11e01..ed23ce2 100644 --- a/D2Structs_111B.h +++ b/D2Structs_111B.h @@ -2,7 +2,6 @@ #define D2STRUCTS_H__ #include "D2DataTables.h" - struct UnitAny; struct ClientInfo; struct PlayerData; @@ -40,6 +39,9 @@ struct ScrollBar; struct Button; struct List; struct Arena; +struct pMsg; +struct QuestFlags; +struct CollMap; struct CellContext; diff --git a/D2Stubs.cpp b/D2Stubs.cpp index f1b9e82..19b376e 100644 --- a/D2Stubs.cpp +++ b/D2Stubs.cpp @@ -5,16 +5,16 @@ #include "ExMultiRes.h" -__declspec(naked) int __fastcall D2Funcs::D2CLIENT_DiffuseStat(int nStat) +__declspec(naked) int __fastcall D2ASMFuncs::D2CLIENT_DiffuseStat(int nStat) { __asm { mov eax, ecx - jmp D2Ptrs::D2CLIENT_DifuseStat_I + jmp D2Ptrs.D2CLIENT_DifuseStat_I } } -__declspec(naked) void __fastcall D2Funcs::D2CLIENT_SetView(int xLeft, int xRight, int yTop, int yBottom, GameView *pGameView) +__declspec(naked) void __fastcall D2ASMFuncs::D2CLIENT_SetView(int xLeft, int xRight, int yTop, int yBottom, GameView *pGameView) //(int xLeft, int xRight, int yTop, int yBottom, GameView *pGameView) { __asm @@ -28,7 +28,7 @@ __declspec(naked) void __fastcall D2Funcs::D2CLIENT_SetView(int xLeft, int xRigh mov eax, [esp+12+4] //yBottom mov esi, [esp+16+4] // pGameView - call D2Ptrs::D2CLIENT_SetView_I + call D2Ptrs.D2CLIENT_SetView_I pop esi @@ -37,22 +37,22 @@ __declspec(naked) void __fastcall D2Funcs::D2CLIENT_SetView(int xLeft, int xRigh } -__declspec(naked) BOOL __fastcall D2Funcs::D2CLIENT_IsSquelched(RosterUnit* pRoster) +__declspec(naked) BOOL __fastcall D2ASMFuncs::D2CLIENT_IsSquelched(RosterUnit* pRoster) { __asm { mov eax, ecx - call D2Ptrs::D2CLIENT_IsSquelched_I + call D2Ptrs.D2CLIENT_IsSquelched_I ret } } -__declspec(naked) BOOL __fastcall D2Funcs::D2CLIENT_IsMuted(RosterUnit* pRoster) +__declspec(naked) BOOL __fastcall D2ASMFuncs::D2CLIENT_IsMuted(RosterUnit* pRoster) { __asm { mov eax, ecx - call D2Ptrs::D2CLIENT_IsMuted_I + call D2Ptrs.D2CLIENT_IsMuted_I ret } } @@ -61,7 +61,7 @@ __declspec(naked) void D2Stubs::D2CLIENT_FixHostilePic() { __asm { - mov edi, [D2Vars::D2CLIENT_AutomapInfoY] + mov edi, [D2Vars.D2CLIENT_AutomapInfoY] mov edi, [edi] ret } @@ -111,11 +111,11 @@ __declspec(naked) void D2Stubs::D2CLIENT_HideItem_STUB() test eax, eax popad je skip - jmp D2Ptrs::D2CLIENT_DontSkipAltDraw_J + jmp D2Ptrs.D2CLIENT_DontSkipAltDraw_J skip: - jmp D2Ptrs::D2CLIENT_SkipAltDraw_J + jmp D2Ptrs.D2CLIENT_SkipAltDraw_J } } @@ -139,7 +139,7 @@ __declspec(naked) void D2Stubs::D2CLIENT_Lighting_STUB() lightold: //original code push esi - call D2Funcs::D2COMMON_GetLevelNoByRoom + call D2Funcs.D2COMMON_GetLevelNoByRoom ret } } @@ -225,7 +225,7 @@ void __declspec(naked) __fastcall D2Stubs::D2CLIENT_BlobHook2() } } -__declspec(naked) void* __stdcall D2Funcs::D2WIN_LoadMpq(DWORD OrderFlag, const char* szDllFile, const char* szMpqFile, const char* szName, DWORD _1, BOOL(__stdcall *fnMPQMissing)()) +__declspec(naked) void* __stdcall D2ASMFuncs::D2WIN_LoadMpq(DWORD OrderFlag, const char* szDllFile, const char* szMpqFile, const char* szName, DWORD _1, BOOL(__stdcall *fnMPQMissing)()) { __asm { @@ -235,7 +235,7 @@ __declspec(naked) void* __stdcall D2Funcs::D2WIN_LoadMpq(DWORD OrderFlag, const push [esp+0x18] push [esp+0x18] mov eax,[esp+0x18] - call D2Ptrs::D2WIN_LoadMpq_I + call D2Ptrs.D2WIN_LoadMpq_I ret 0x18 } } @@ -247,7 +247,7 @@ __declspec(naked) void __fastcall D2Stubs::D2CLIENT_ScreenHook() pushad call ExScreen::Display popad - jmp D2Ptrs::D2CLIENT_Screen_Call + jmp D2Ptrs.D2CLIENT_Screen_Call ret } } @@ -261,7 +261,7 @@ static DWORD Rtn = 0; call ExScreen::DrawBreakpoints pop eax pop Rtn - call D2Ptrs::D2CLIENT_CharInfo_I + call D2Ptrs.D2CLIENT_CharInfo_I push Rtn ret } @@ -281,6 +281,7 @@ __declspec(naked) void D2Stubs::D2CLIENT_CharInfoTipHook() } } +#ifdef D2EX_MULTIRES __declspec(naked) void D2Stubs::D2CLIENT_SetResolution_STUB() { @@ -377,7 +378,7 @@ __declspec(naked) void D2Stubs::D2GFX_LookUpFix_VI_STUB() { push eax push ecx - mov eax, [D2Vars::D2GFX_Height] + mov eax, [D2Vars.D2GFX_Height] mov eax, [eax] mov ecx, [ExMultiRes::gptBufferXLookUpTable] @@ -388,28 +389,32 @@ __declspec(naked) void D2Stubs::D2GFX_LookUpFix_VI_STUB() retn } } + + // -- Funcs -__declspec(naked) void __fastcall D2Funcs::D2GFX_UpdateResizeVars(int nWidth, int nHeight) +__declspec(naked) void __fastcall D2ASMFuncs::D2GFX_UpdateResizeVars(int nWidth, int nHeight) { __asm { mov eax, ecx - jmp D2Ptrs::D2GFX_Resize + jmp D2Ptrs.D2GFX_Resize } } -__declspec(naked) BYTE* __fastcall D2Funcs::D2CLIENT_GetSkillsTxt(int SkillId) +#endif + +__declspec(naked) BYTE* __fastcall D2ASMFuncs::D2CLIENT_GetSkillsTxt(int SkillId) { __asm { mov eax, ecx - call D2Ptrs::D2CLIENT_GetSkillsTxt_I + call D2Ptrs.D2CLIENT_GetSkillsTxt_I ret } } -__declspec(naked) BOOL __fastcall D2Funcs::D2CLIENT_GetMeleeDmg(UnitAny* ptUnit, int SkillMinBonus, int* OutMin, int* OutMax, int* OutCol, int SkillMaxBonus, Skill* ptSkill, int a128, int a9, int a10) +__declspec(naked) BOOL __fastcall D2ASMFuncs::D2CLIENT_GetMeleeDmg(UnitAny* ptUnit, int SkillMinBonus, int* OutMin, int* OutMax, int* OutCol, int SkillMaxBonus, Skill* ptSkill, int a128, int a9, int a10) { __asm { @@ -422,12 +427,12 @@ __asm push [esp+0x20] //6 push [esp+0x20] //7 push [esp+0x20] //8 - call D2Ptrs::D2CLIENT_GetMeleeDmg_I + call D2Ptrs.D2CLIENT_GetMeleeDmg_I ret 0x20 } } -__declspec(naked) DWORD __fastcall D2Funcs::D2CLIENT_TestPvpFlag(DWORD dwUnitId1, DWORD dwUnitId2, DWORD dwFlagMask) +__declspec(naked) DWORD __fastcall D2ASMFuncs::D2CLIENT_TestPvpFlag(DWORD dwUnitId1, DWORD dwUnitId2, DWORD dwFlagMask) { __asm { @@ -435,24 +440,24 @@ __declspec(naked) DWORD __fastcall D2Funcs::D2CLIENT_TestPvpFlag(DWORD dwUnitId1 push [esp + 8]; mov esi, edx; mov edx, ecx; - call D2Ptrs::D2CLIENT_TestPvpFlag_I + call D2Ptrs.D2CLIENT_TestPvpFlag_I pop esi; ret 4; } } -__declspec(naked) wchar_t* __fastcall D2Funcs::D2CLIENT_GetLevelName(int LevelNo) +__declspec(naked) wchar_t* __fastcall D2ASMFuncs::D2CLIENT_GetLevelName(int LevelNo) { __asm { push esi mov esi,ecx - call D2Ptrs::D2CLIENT_GetLevelName_I + call D2Ptrs.D2CLIENT_GetLevelName_I pop esi ret } } -void __stdcall D2Funcs::D2CLIENT_DrawGZBox(int X1, int Y1, int X2, int Y2) +void __stdcall D2ASMFuncs::D2CLIENT_DrawGZBox(int X1, int Y1, int X2, int Y2) { RECT * r = new RECT; r->left=X1; @@ -462,7 +467,7 @@ void __stdcall D2Funcs::D2CLIENT_DrawGZBox(int X1, int Y1, int X2, int Y2) __asm { mov eax, [r] - call D2Ptrs::D2CLIENT_DrawGZBOX_I + call D2Ptrs.D2CLIENT_DrawGZBOX_I } delete r; } @@ -472,12 +477,12 @@ void __stdcall D2Funcs::D2CLIENT_DrawGZBox(int X1, int Y1, int X2, int Y2) //__asm // { // mov eax, ecx -// call D2Ptrs::D2WIN_GetTextWidth_I +// call D2Ptrs.D2WIN_GetTextWidth_I // ret // } //} -__declspec(naked) void __fastcall D2Funcs::D2CLIENT_PlaySound(int SoundNo) +__declspec(naked) void __fastcall D2ASMFuncs::D2CLIENT_PlaySound(int SoundNo) { __asm { @@ -487,30 +492,30 @@ __declspec(naked) void __fastcall D2Funcs::D2CLIENT_PlaySound(int SoundNo) push 0 push 0 push 0 - call D2Ptrs::D2CLIENT_PlaySoundNo_I + call D2Ptrs.D2CLIENT_PlaySoundNo_I pop ebx; ret } } -__declspec(naked) int __fastcall D2Funcs::D2CLIENT_GetSelectedMenu(int MouseY) +__declspec(naked) int __fastcall D2ASMFuncs::D2CLIENT_GetSelectedMenu(int MouseY) { __asm { push ebx mov ebx, ecx - call D2Ptrs::D2CLIENT_MenuFunc_I + call D2Ptrs.D2CLIENT_MenuFunc_I pop ebx ret } } -__declspec(naked) AutoMapLayer* __fastcall D2Funcs::D2CLIENT_InitAutomapLayer(DWORD dwLayer) +__declspec(naked) AutoMapLayer* __fastcall D2ASMFuncs::D2CLIENT_InitAutomapLayer(DWORD dwLayer) { __asm { mov eax, ecx; - call D2Ptrs::D2CLIENT_InitAutomapLayer_I; + call D2Ptrs.D2CLIENT_InitAutomapLayer_I; ret; } } diff --git a/D2Stubs.h b/D2Stubs.h index 89db11c..df0fee8 100644 --- a/D2Stubs.h +++ b/D2Stubs.h @@ -2,7 +2,7 @@ #define __D2STUBS_H -namespace D2Funcs +namespace D2ASMFuncs { void __fastcall D2GFX_UpdateResizeVars(int nWidth, int nHeight); int __fastcall D2CLIENT_DiffuseStat(int nStat); diff --git a/Debug 1.11b/D2Ex2.dll b/Debug 1.11b/D2Ex2.dll new file mode 100644 index 0000000..4fd91f5 Binary files /dev/null and b/Debug 1.11b/D2Ex2.dll differ diff --git a/ExAim.cpp b/ExAim.cpp index 47d8d2e..8a09512 100644 --- a/ExAim.cpp +++ b/ExAim.cpp @@ -25,7 +25,7 @@ if(!AimTarget) LeaveCriticalSection(&TELE_CRITSECT); } -return D2Ptrs::D2CLIENT_RemoveObject_I(aPacket); +return D2Funcs.D2CLIENT_RemoveObject_I(aPacket); } BOOL __fastcall ExAim::OnUnitSpellCast (UnitAny* pUnit, BYTE* aPacket) @@ -66,7 +66,7 @@ if(pUnit->dwType == UNIT_PLAYER) } SpellStrc hSpell = {pData->SkillId, -1, pData->tX, pData->tY, pData->_2, 0, 0}; -return (BOOL)D2Funcs::D2CLIENT_CreateSpell(21,pUnit,&hSpell,1); +return (BOOL)D2Funcs.D2CLIENT_CreateSpell(21,pUnit,&hSpell,1); } @@ -95,11 +95,11 @@ unsigned __stdcall ExAim::WatchThread(void * Args) void __stdcall ExAim::b_Aim(StormMsg * Msg) { if((Msg->lParam & 0x40000000)) return; - if(D2Vars::D2CLIENT_UIModes[UI_CHAT]) return; + if(D2Vars.D2CLIENT_UIModes[UI_CHAT]) return; DoAttack(); Msg->_2 = 1; Msg->_3 = 0; - D2Funcs::STORM_ResetMsgQuene(Msg); + D2Funcs.STORM_ResetMsgQuene(Msg); } @@ -107,12 +107,12 @@ bool ExAim::DoPredictAttack(bool left) { if(!ExParty::isTownLvl()) { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; UnitAny* pTarget = 0; if(AimTarget) { - pTarget = D2Funcs::D2CLIENT_GetUnitById(AimTarget,UNIT_PLAYER); + pTarget = D2Funcs.D2CLIENT_GetUnitById(AimTarget,UNIT_PLAYER); if(!pTarget) return false; if(!(ExParty::GetPvpFlags(pTarget->dwUnitId) & PVP_HOSTILED_BY_YOU)) return false; if(pTarget->dwMode == PLAYER_MODE_DEAD || pTarget->dwMode == PLAYER_MODE_DEATH) return false; @@ -130,14 +130,14 @@ bool ExAim::DoPredictAttack(bool left) short dis1 = CalculateDistance(HistoryPos.at(0),HistoryPos.at(1)); short ang = CalculateAngle(HistoryPos.at(0),HistoryPos.at(1)); //if(pTarget->pPath->xTarget) - // { D2Funcs::D2CLIENT_PrintPartyString(L"Using Target.TargetPos",COL_RED); TargetPos.x = pTarget->pPath->xTarget; TargetPos.y = pTarget->pPath->yTarget; TargetPos = CalculatePointOnTrack(TargetPos,dis2,ang);} + // { D2Funcs.D2CLIENT_PrintPartyString(L"Using Target.TargetPos",COL_RED); TargetPos.x = pTarget->pPath->xTarget; TargetPos.y = pTarget->pPath->yTarget; TargetPos = CalculatePointOnTrack(TargetPos,dis2,ang);} //else TargetPos = CalculatePointOnTrack(TargetPos,dis1,ang); if(CalculateDistance(MyPos,TargetPos)>35) return false; } else if(pTarget->dwMode != PLAYER_MODE_RUN) return false; - Skill* pSkill = left ? D2Funcs::D2COMMON_GetLeftSkill(pMe) : D2Funcs::D2COMMON_GetRightSkill(pMe); + Skill* pSkill = left ? D2Funcs.D2COMMON_GetLeftSkill(pMe) : D2Funcs.D2COMMON_GetRightSkill(pMe); if(pSkill) { bool ret = CastSpell(pMe,(WORD)pSkill->pSkillsTxt->wSkillId,left,TargetPos.x,TargetPos.y); //Cast the attack skill @@ -153,12 +153,12 @@ bool ExAim::DoAttack(bool left) { if(!ExParty::isTownLvl()) { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; UnitAny* pTarget = 0; if(AimTarget) { - pTarget = D2Funcs::D2CLIENT_GetUnitById(AimTarget,UNIT_PLAYER); + pTarget = D2Funcs.D2CLIENT_GetUnitById(AimTarget,UNIT_PLAYER); if(!pTarget) return false; if(!(ExParty::GetPvpFlags(pTarget->dwUnitId) & PVP_HOSTILED_BY_YOU)) return false; if(pTarget->dwMode == PLAYER_MODE_DEAD || pTarget->dwMode == PLAYER_MODE_DEATH) return false; @@ -169,7 +169,7 @@ bool ExAim::DoAttack(bool left) if(!pTarget) return false; } - Skill* pSkill = left ? D2Funcs::D2COMMON_GetLeftSkill(pMe) : D2Funcs::D2COMMON_GetRightSkill(pMe); + Skill* pSkill = left ? D2Funcs.D2COMMON_GetLeftSkill(pMe) : D2Funcs.D2COMMON_GetRightSkill(pMe); if(pSkill) { DoQuickAttack(pTarget->dwUnitId,0x2F,0,left); // bool ret = CastSpell(pMe,pSkill->pSkillsTxt->wSkillId,left,pTarget); //Cast the attack skill @@ -192,10 +192,10 @@ EnterCriticalSection(&TELE_CRITSECT); //Clear our teleport path g_Stop = false; LeaveCriticalSection(&TELE_CRITSECT); -UnitAny* pTarget = D2Funcs::D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER); +UnitAny* pTarget = D2Funcs.D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER); if(!pTarget && HistoryPos.size() == 2) { -UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); +UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(pMe); // This should NEVER happen, unless you stole my code short ang = CalculateAngle(HistoryPos.at(0),HistoryPos.at(1)); COORDS MyPos = {pMe->pPath->xPos, pMe->pPath->yPos }; @@ -211,14 +211,14 @@ if(!FindTeleportPath(unkTargetPos)) {ExScreen::PrintTextEx(COL_RED,L"PREDICT: Fi if(!Teleport(TelePath.front())) continue; for(int i = 0; (i<15 && ExParty::GetPlayerArea()); i++) { if(PtInCircle(pMe->pPath->xPos, pMe->pPath->yPos,TelePath.front().x,TelePath.front().y,2)) break; - Sleep(*D2Vars::D2CLIENT_Ping + 5); + Sleep(*D2Vars.D2CLIENT_Ping + 5); if(i==14) return false; } EnterCriticalSection(&TELE_CRITSECT); TelePath.erase(TelePath.begin()); LeaveCriticalSection(&TELE_CRITSECT); - if(pTarget = D2Funcs::D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER), pTarget) return false; - Sleep(*D2Vars::D2CLIENT_Ping+80); + if(pTarget = D2Funcs.D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER), pTarget) return false; + Sleep(*D2Vars.D2CLIENT_Ping+80); } return true; } @@ -227,7 +227,7 @@ if(pTarget->dwMode == PLAYER_MODE_DEATH || pTarget->dwMode == PLAYER_MODE_DEAD) if(!LeftSkillId && !RightSkillId) return false; -UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); +UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(pMe); if(pMe->dwUnitId == pTarget->dwUnitId) return false; // Stop if our target is me @@ -245,9 +245,9 @@ if(bPredict) { //Very basic ideas atm if(abs(dis1-dis2)<=1) { short ang = CalculateAngle(HistoryPos.at(1),TargetPos); wostringstream wstr; wstr << L"Distance:" << dis2 << L", angle : " << ang; - D2Funcs::D2CLIENT_PrintPartyString(wstr.str().c_str(),COL_RED); + D2Funcs.D2CLIENT_PrintPartyString(wstr.str().c_str(),COL_RED); if(pTarget->pPath->xTarget) - { D2Funcs::D2CLIENT_PrintPartyString(L"Using Target.TargetPos",COL_RED); TargetPos.x = pTarget->pPath->xTarget; TargetPos.y = pTarget->pPath->yTarget; TargetPos = CalculatePointOnTrack(TargetPos,dis2,ang);} + { D2Funcs.D2CLIENT_PrintPartyString(L"Using Target.TargetPos",COL_RED); TargetPos.x = pTarget->pPath->xTarget; TargetPos.y = pTarget->pPath->yTarget; TargetPos = CalculatePointOnTrack(TargetPos,dis2,ang);} else TargetPos = CalculatePointOnTrack(TargetPos,dis2*2,ang); } @@ -280,7 +280,7 @@ if(!PtInCircle(pMe->pPath->xPos, pMe->pPath->yPos,TargetPos.x,TargetPos.y,2)) { if(!Teleport(TelePath.front())) continue; for(int i = 0; (i<34 && ExParty::GetPlayerArea()); i++) { if(PtInCircle(pMe->pPath->xPos, pMe->pPath->yPos,TelePath.front().x,TelePath.front().y,2)) break; - Sleep(*D2Vars::D2CLIENT_Ping + 20); + Sleep(*D2Vars.D2CLIENT_Ping + 20); if(i==34) return false; } EnterCriticalSection(&TELE_CRITSECT); @@ -288,35 +288,35 @@ if(!PtInCircle(pMe->pPath->xPos, pMe->pPath->yPos,TargetPos.x,TargetPos.y,2)) { LeaveCriticalSection(&TELE_CRITSECT); if(!g_Stop) if(permTargetPos.x != pTarget->pPath->xPos || permTargetPos.y != pTarget->pPath->yPos) return false; - Sleep(*D2Vars::D2CLIENT_Ping+80); + Sleep(*D2Vars.D2CLIENT_Ping+80); } } -if(pTarget = D2Funcs::D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER), !pTarget) return false; +if(pTarget = D2Funcs.D2CLIENT_GetUnitById(UnitId,UNIT_PLAYER), !pTarget) return false; //Set the proper skills if(LeftSkillId) if(!SetSkill(LeftSkillId,true)) return false; if(RightSkillId) if(!SetSkill(RightSkillId,false)) return false; -Sleep(*D2Vars::D2CLIENT_Ping+50); +Sleep(*D2Vars.D2CLIENT_Ping+50); CastSpell(pMe,left ? LeftSkillId : RightSkillId,left,pTarget); //Cast the attack skill -Sleep(*D2Vars::D2CLIENT_Ping+200); +Sleep(*D2Vars.D2CLIENT_Ping+200); return true; } UnitAny* ExAim::GetNearestTarget() { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; int nDist = 100; UnitAny* pReturn = 0; - for(RosterUnit* pRoster = *D2Vars::D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) + for(RosterUnit* pRoster = *D2Vars.D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) { if(pRoster->dwUnitId == pMe->dwUnitId) continue; - UnitAny* pTarget = D2Funcs::D2CLIENT_GetUnitById(pRoster->dwUnitId,UNIT_PLAYER); + UnitAny* pTarget = D2Funcs.D2CLIENT_GetUnitById(pRoster->dwUnitId,UNIT_PLAYER); if(!pTarget) continue; if(!(ExParty::GetPvpFlags(pTarget->dwUnitId) & PVP_HOSTILED_BY_YOU)) continue; if(pTarget->dwMode == PLAYER_MODE_DEAD || pTarget->dwMode == PLAYER_MODE_DEATH) continue; @@ -330,7 +330,7 @@ UnitAny* ExAim::GetNearestTarget() UnitAny* ExAim::FindUnitInRoom(DWORD UnitType, DWORD FileIdx, char* szOwner) { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; int nDist = 100; @@ -354,11 +354,11 @@ return pReturn; bool ExAim::Teleport(const COORDS TargetPos) { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; if(!SetSkill(0x36,false)) return false;//Set Teleport - Sleep(*D2Vars::D2CLIENT_Ping+100); + Sleep(*D2Vars.D2CLIENT_Ping+100); return CastSpell(pMe,0x36,false,TargetPos.x,TargetPos.y); //CAST TELE ON TARGET XY } @@ -367,7 +367,7 @@ bool ExAim::FindTeleportPath(const COORDS TargetPos) { static CCollisionMap hMap; -UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); +UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; EnterCriticalSection(&TELE_CRITSECT); @@ -443,7 +443,7 @@ WORD ExAim::GetUnitY(UnitAny* pUnit) bool ExAim::GetSkill(WORD SkillId) // Taken from D2BS { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; for(Skill* pSkill = pMe->pInfo->pFirstSkill; pSkill; pSkill = pSkill->pNextSkill) if(pSkill->pSkillsTxt->wSkillId == SkillId) return true; @@ -452,7 +452,7 @@ bool ExAim::GetSkill(WORD SkillId) // Taken from D2BS bool ExAim::SetSkill(WORD SkillId, bool left) // Taken from D2BS, but modified a bit :) { - UnitAny* pMe = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pMe = D2Funcs.D2CLIENT_GetPlayer(); if(!pMe) return false; if(GetSkill(SkillId)) { @@ -467,9 +467,9 @@ bool ExAim::SetSkill(WORD SkillId, bool left) // Taken from D2BS, but modified a if(left) aPacket[4] = 0x80; *(DWORD*)&aPacket[5]= -1; //dwOwnerItemId - D2Funcs::D2NET_SendPacket(9, 1, aPacket); - *D2Vars::D2CLIENT_SentBytes+=9; - *D2Vars::D2CLIENT_SentPackets++; + D2Funcs.D2NET_SendPacket(9, 1, aPacket); + *D2Vars.D2CLIENT_SentBytes+=9; + *D2Vars.D2CLIENT_SentPackets++; for(int i = 0; (i<10 && ExParty::GetPlayerArea()); i++) { Skill* pSkill = (left ? pMe->pInfo->pLeftSkill : pMe->pInfo->pRightSkill); @@ -490,9 +490,9 @@ void ExAim::UseSkillOnXY(WORD x, WORD y, bool left) *(LPWORD)&aPacket[1] = x; *(LPWORD)&aPacket[3] = y; - D2Funcs::D2NET_SendPacket(5, 1, aPacket); - *D2Vars::D2CLIENT_SentBytes+=5; - *D2Vars::D2CLIENT_SentPackets++; + D2Funcs.D2NET_SendPacket(5, 1, aPacket); + *D2Vars.D2CLIENT_SentBytes+=5; + *D2Vars.D2CLIENT_SentPackets++; } void ExAim::UseSkillOnId(DWORD UnitId, DWORD UnitType, bool left) @@ -501,18 +501,18 @@ void ExAim::UseSkillOnId(DWORD UnitId, DWORD UnitType, bool left) aPacket[0] = left ? 0x0A : 0x0D; *(DWORD*)&aPacket[1] = UnitType; *(DWORD*)&aPacket[5] = UnitId; - D2Funcs::D2NET_SendPacket(9, 1, aPacket); - *D2Vars::D2CLIENT_SentBytes+=9; - *D2Vars::D2CLIENT_SentPackets++; + D2Funcs.D2NET_SendPacket(9, 1, aPacket); + *D2Vars.D2CLIENT_SentBytes+=9; + *D2Vars.D2CLIENT_SentPackets++; } bool ExAim::CastSpell(UnitAny* pCaster, WORD SkillId, bool left, WORD xPos, WORD yPos) { SpellStrc hSpell = {SkillId, -1, xPos, yPos, 0, 0, 0}; -if(!D2Funcs::D2CLIENT_CreateSpell(21,pCaster,&hSpell,1)) return false; -int nPierceIdx = D2Funcs::D2COMMON_GetBaseStatSigned(pCaster,328,0); -D2Funcs::D2COMMON_SetStat(pCaster, 328, nPierceIdx + 1,0); +if(!D2Funcs.D2CLIENT_CreateSpell(21,pCaster,&hSpell,1)) return false; +int nPierceIdx = D2Funcs.D2COMMON_GetBaseStatSigned(pCaster,328,0); +D2Funcs.D2COMMON_SetStat(pCaster, 328, nPierceIdx + 1,0); UseSkillOnXY(xPos, yPos, left); if(pCaster->dwType == UNIT_PLAYER) if(pCaster->pPlayerData) // Didnt check what exacly are those values, but better leave them @@ -529,9 +529,9 @@ return true; bool ExAim::CastSpell(UnitAny* pCaster, WORD SkillId, bool left, UnitAny* pTarget) { SpellStrc hSpell = {SkillId, -1, pTarget->dwType, pTarget->dwUnitId, 0, 0, 0}; -if(!D2Funcs::D2CLIENT_CreateSpell(22,pCaster,&hSpell,1)) return false; -int nPierceIdx = D2Funcs::D2COMMON_GetBaseStatSigned(pCaster,328,0); -D2Funcs::D2COMMON_SetStat(pCaster, 328, nPierceIdx + 1,0); +if(!D2Funcs.D2CLIENT_CreateSpell(22,pCaster,&hSpell,1)) return false; +int nPierceIdx = D2Funcs.D2COMMON_GetBaseStatSigned(pCaster,328,0); +D2Funcs.D2COMMON_SetStat(pCaster, 328, nPierceIdx + 1,0); UseSkillOnId(pTarget->dwUnitId, pTarget->dwType, left); if(pCaster->dwType == UNIT_PLAYER) if(pCaster->pPlayerData) // Didnt check what exacly are those values @@ -564,7 +564,7 @@ struct p0x4C p0x4C aPacket = {0x4C,UnitType,UnitId,SkillId,1,0,TargetId,0}; static int eLen = 0; - D2Funcs::D2NET_ReceivePacket(&eLen, (BYTE*)&aPacket, sizeof(p0x4C)); + D2Funcs.D2NET_ReceivePacket(&eLen, (BYTE*)&aPacket, sizeof(p0x4C)); } diff --git a/ExBox.cpp b/ExBox.cpp index 5cde9d3..1cba347 100644 --- a/ExBox.cpp +++ b/ExBox.cpp @@ -16,8 +16,8 @@ void ExBox::Draw() { if(cState!=INVISIBLE) { - D2Funcs::D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,aColor,aTransLvl); - D2Funcs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+cHeight); + D2Funcs.D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,aColor,aTransLvl); + D2ASMFuncs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+cHeight); } } diff --git a/ExBuffs.cpp b/ExBuffs.cpp index 1ee4336..ece69ca 100644 --- a/ExBuffs.cpp +++ b/ExBuffs.cpp @@ -6,9 +6,9 @@ typedef boost::shared_ptr pExBuff; static map Buffs; -ExBuff::ExBuff(WORD SkillNo, WORD StateNo, ExBuffsImgs ImageId, short DefaultLvl, BuffType aType, bool isTimed) : ExControl((24*Buffs.size()) + 115, *D2Vars::D2CLIENT_ScreenViewHeight-10, 24, 24, 0) +ExBuff::ExBuff(WORD SkillNo, WORD StateNo, ExBuffsImgs ImageId, short DefaultLvl, BuffType aType, bool isTimed) : ExControl((24*Buffs.size()) + 115, *D2Vars.D2CLIENT_ScreenViewHeight-10, 24, 24, 0) { - UnitAny* pPlayer = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer = D2Funcs.D2CLIENT_GetPlayer(); Skill* pSkill = 0; DWORD ATMTime = GetTickCount(); int SkillTime = 0; @@ -18,12 +18,12 @@ ExBuff::ExBuff(WORD SkillNo, WORD StateNo, ExBuffsImgs ImageId, short DefaultLvl if(SkillId) { - pSkill = D2Funcs::D2COMMON_GetSkillById(pPlayer,SkillId,-1); - if(pSkill) SkillLvl = D2Funcs::D2COMMON_GetSkillLevel(pPlayer,pSkill,1); - SkillsTxt *pTxt = &(*D2Vars::D2COMMON_sgptDataTables)->pSkillsTxt[SkillId]; + pSkill = D2Funcs.D2COMMON_GetSkillById(pPlayer,SkillId,-1); + if(pSkill) SkillLvl = D2Funcs.D2COMMON_GetSkillLevel(pPlayer,pSkill,1); + SkillsTxt *pTxt = &(*D2Vars.D2COMMON_sgptDataTables)->pSkillsTxt[SkillId]; if(!pTxt) isTimed = false; else - SkillTime = isTimed ? (D2Funcs::D2COMMON_EvaluateSkill(pPlayer, pTxt->dwAuraLenCalc,SkillId,SkillLvl) / 25) : 0; + SkillTime = isTimed ? (D2Funcs.D2COMMON_EvaluateSkill(pPlayer, pTxt->dwAuraLenCalc,SkillId,SkillLvl) / 25) : 0; } if(isTimed) @@ -82,22 +82,22 @@ void ExBuff::Draw() wchar_t* ExBuffs::GetSkillName(unsigned short SkillId) { -BYTE* Tbl = (*D2Vars::D2COMMON_sgptDataTables)->pSkillDescTxt; -if(SkillId> (*D2Vars::D2COMMON_sgptDataTables)->dwSkillsRecs) return L"?"; -SkillsTxt* pTxt = (*D2Vars::D2COMMON_sgptDataTables)->pSkillsTxt; +BYTE* Tbl = (*D2Vars.D2COMMON_sgptDataTables)->pSkillDescTxt; +if(SkillId> (*D2Vars.D2COMMON_sgptDataTables)->dwSkillsRecs) return L"?"; +SkillsTxt* pTxt = (*D2Vars.D2COMMON_sgptDataTables)->pSkillsTxt; int nRow = pTxt[SkillId].wSkillDesc; if(!nRow) return L"?"; Tbl+= (nRow*0x120); WORD LocId = *(WORD*)(Tbl+8); -return D2Funcs::D2LANG_GetLocaleText(LocId); +return D2Funcs.D2LANG_GetLocaleText(LocId); } int GetSkillLvlByStat(short SkillNo, int nStat, int nValue) { -UnitAny* pPlayer= D2Funcs::D2CLIENT_GetPlayer(); +UnitAny* pPlayer= D2Funcs.D2CLIENT_GetPlayer(); ASSERT(pPlayer) -SkillsTxt *pTxt = &(*D2Vars::D2COMMON_sgptDataTables)->pSkillsTxt[SkillNo]; +SkillsTxt *pTxt = &(*D2Vars.D2COMMON_sgptDataTables)->pSkillsTxt[SkillNo]; ASSERT(pTxt) DWORD CalcId = 0; @@ -109,7 +109,7 @@ else if (pTxt->wAuraStat5 == nStat) CalcId = pTxt->dwAuraStatCalc5; else if (pTxt->wAuraStat6 == nStat) CalcId = pTxt->dwAuraStatCalc6; for(int i = 1; i<55; i++) { - int val = D2Funcs::D2COMMON_EvaluateSkill(pPlayer,CalcId,SkillNo,i); + int val = D2Funcs.D2COMMON_EvaluateSkill(pPlayer,CalcId,SkillNo,i); //Misc::Log("Skill Lvl %d, Value %d, desired %d",i,val,nValue); if(val == nValue) return i; } @@ -120,27 +120,27 @@ int GetStateStatValue(int nStatNo, BYTE* StateData, int PacketLen) { //Stat Reading BitBuffer pBitBuffer = {0}; -D2Funcs::FOG_InitBitBuffer(&pBitBuffer,StateData,PacketLen-8); -for(unsigned short nStat = D2Funcs::FOG_ReadBits(&pBitBuffer, 9); nStat>=0; nStat = D2Funcs::FOG_ReadBits(&pBitBuffer, 9)) +D2Funcs.FOG_InitBitBuffer(&pBitBuffer,StateData,PacketLen-8); +for(unsigned short nStat = D2Funcs.FOG_ReadBits(&pBitBuffer, 9); nStat>=0; nStat = D2Funcs.FOG_ReadBits(&pBitBuffer, 9)) { signed short nParam = 0; signed int nValue = 0; if (nStat >= 511) break; -if (nStat >= (*D2Vars::D2COMMON_sgptDataTables)->dwItemStatCostRecs) +if (nStat >= (*D2Vars.D2COMMON_sgptDataTables)->dwItemStatCostRecs) break; -ItemStatCostTxt * pTxt = &(*D2Vars::D2COMMON_sgptDataTables)->pItemStatCostTxt[nStat]; +ItemStatCostTxt * pTxt = &(*D2Vars.D2COMMON_sgptDataTables)->pItemStatCostTxt[nStat]; BYTE SendBits = pTxt->bSendBits; BYTE SendParam = pTxt->bSendParamBits; if(SendBits == 0) break; if(SendParam) - nParam = D2Funcs::FOG_ReadBitsSigned(&pBitBuffer, SendParam); + nParam = D2Funcs.FOG_ReadBitsSigned(&pBitBuffer, SendParam); if(SendBits <= 32) if(pTxt->bItemStatFlags.bSigned) - nValue = D2Funcs::FOG_ReadBitsSigned(&pBitBuffer, SendBits); + nValue = D2Funcs.FOG_ReadBitsSigned(&pBitBuffer, SendBits); else - nValue = D2Funcs::FOG_ReadBits(&pBitBuffer, SendBits); + nValue = D2Funcs.FOG_ReadBits(&pBitBuffer, SendBits); if(nStat == nStatNo) return nValue; } @@ -165,7 +165,7 @@ BOOL __fastcall ExBuffs::OnSetState(BYTE* aPacket) if (BuffsEnabled) { p0xa8 *pSetState = (p0xa8*)aPacket; - UnitAny* pPlayer = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(pPlayer); int UnitType = pSetState->UnitType; @@ -175,30 +175,30 @@ BOOL __fastcall ExBuffs::OnSetState(BYTE* aPacket) if (UnitType == UNIT_PLAYER && UnitID == pPlayer->dwUnitId) { BitBuffer pBitBuffer = { 0 }; - D2Funcs::FOG_InitBitBuffer(&pBitBuffer, pSetState->Data, pSetState->PacketLen - 8); - //for(unsigned short nStat = D2Funcs::FOG_ReadBits(&pBitBuffer, 9); nStat>=0; nStat = D2Funcs::FOG_ReadBits(&pBitBuffer, 9)) + D2Funcs.FOG_InitBitBuffer(&pBitBuffer, pSetState->Data, pSetState->PacketLen - 8); + //for(unsigned short nStat = D2Funcs.FOG_ReadBits(&pBitBuffer, 9); nStat>=0; nStat = D2Funcs.FOG_ReadBits(&pBitBuffer, 9)) //{ //signed short nParam = 0; //signed int nValue = 0; //if (nStat >= 511) break; - //if (nStat >= (*D2Vars::D2COMMON_sgptDataTables)->dwItemStatCostRecs) break; - //ItemStatCostTxt * pTxt = &(*D2Vars::D2COMMON_sgptDataTables)->pItemStatCostTxt[nStat]; + //if (nStat >= (*D2Vars.D2COMMON_sgptDataTables)->dwItemStatCostRecs) break; + //ItemStatCostTxt * pTxt = &(*D2Vars.D2COMMON_sgptDataTables)->pItemStatCostTxt[nStat]; //BYTE SendBits = pTxt->bSendBits; //BYTE SendParam = pTxt->bSendParamBits; //if(SendBits == 0) break; - //if(SendParam) nParam = D2Funcs::FOG_ReadBitsSigned(&pBitBuffer, SendParam); + //if(SendParam) nParam = D2Funcs.FOG_ReadBitsSigned(&pBitBuffer, SendParam); //if(SendBits <= 32) //if(pTxt->bItemStatFlags.bSigned) - // nValue = D2Funcs::FOG_ReadBitsSigned(&pBitBuffer, SendBits); + // nValue = D2Funcs.FOG_ReadBitsSigned(&pBitBuffer, SendBits); //else - // nValue = D2Funcs::FOG_ReadBits(&pBitBuffer, SendBits); + // nValue = D2Funcs.FOG_ReadBits(&pBitBuffer, SendBits); //wstring wStatName; //if(nStat == 351) //wStatName = L"Skill Level"; //else if(nStat == 350) //wStatName = ExBuffs::GetSkillName(nValue); //else - //wStatName = D2Funcs::D2LANG_GetLocaleText(pTxt->wDescStrPos); + //wStatName = D2Funcs.D2LANG_GetLocaleText(pTxt->wDescStrPos); // //Misc::Log(L"[%d] Stat : '%s' (%d) +%d, Param %d",StateNo,wStatName.c_str(),nStat,nValue,nParam); //} @@ -303,7 +303,7 @@ BOOL __fastcall ExBuffs::OnSetState(BYTE* aPacket) } } - return D2Ptrs::D2CLIENT_SetState_I(aPacket); + return D2Funcs.D2CLIENT_SetState_I(aPacket); } @@ -311,13 +311,13 @@ BOOL __fastcall ExBuffs::OnRemoveState(BYTE* aPacket) { if (BuffsEnabled) { - UnitAny* pPlayer= D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer= D2Funcs.D2CLIENT_GetPlayer(); int UnitType = *(BYTE*)(aPacket + 1); int UnitId = *(DWORD*)(aPacket + 2); int StateNo = *(BYTE*)(aPacket + 6); if(UnitType == UNIT_PLAYER && UnitId==pPlayer->dwUnitId){ EnterCriticalSection(&BUFF_CRITSECT); Buffs.erase(StateNo); LeaveCriticalSection(&BUFF_CRITSECT); } } - return D2Ptrs::D2CLIENT_RemoveState_I(aPacket); + return D2Funcs.D2CLIENT_RemoveState_I(aPacket); } @@ -326,7 +326,7 @@ void ExBuff::UpdateYPos() EnterCriticalSection(&BUFF_CRITSECT); for (auto it = Buffs.begin(); it != Buffs.end(); ++it) { - it->second->SetY(*D2Vars::D2CLIENT_ScreenViewHeight - 10); + it->second->SetY(*D2Vars.D2CLIENT_ScreenViewHeight - 10); if (it->second->Buff) it->second->Buff->SetY(it->second->GetY()); if (it->second->BuffTime) it->second->BuffTime->SetY(it->second->GetY() - it->second->GetHeight()); if (it->second->BuffInfo) it->second->BuffInfo->SetY(it->second->GetY()); @@ -336,7 +336,7 @@ void ExBuff::UpdateYPos() void ExBuff::Check() { - static int LocId = D2Funcs::D2LANG_GetLocaleId(); + static int LocId = D2Funcs.D2LANG_GetLocaleId(); int i = 0; EnterCriticalSection(&BUFF_CRITSECT); for(map::iterator it= Buffs.begin() ; it!=Buffs.end(); ++it, ++i) diff --git a/ExButton.cpp b/ExButton.cpp index 86aaafd..dc33354 100644 --- a/ExButton.cpp +++ b/ExButton.cpp @@ -70,16 +70,16 @@ void ExButton::Draw() aCellFile->Get()->nCellNo = aFrame; if (aTextBox) FixText(); } - D2Funcs::D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, 5, cState == VISIBLE ? Color : COL_RED); + D2Funcs.D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, 5, cState == VISIBLE ? Color : COL_RED); if (bLongButton) { int aWid = aCellFile->Get()->pCellFile->cells[aFrame]->width; aCellFile->Get()->nCellNo++; - D2Funcs::D2GFX_DrawCellContextEx(aCellFile->Get(), cX + aWid, cY, -1, 5, cState == VISIBLE ? Color : COL_RED); + D2Funcs.D2GFX_DrawCellContextEx(aCellFile->Get(), cX + aWid, cY, -1, 5, cState == VISIBLE ? Color : COL_RED); } if (Hoover.empty()) return; if (!bBeingSelected) return; - D2Funcs::D2WIN_DrawFramedText(Hoover.c_str(), cX, cY - cHeight - 10, 0, 0); + D2Funcs.D2WIN_DrawFramedText(Hoover.c_str(), cX, cY - cHeight - 10, 0, 0); } void ExButton::SetColor(D2Colors nColor) @@ -114,7 +114,7 @@ bool ExButton::isPressed(unsigned int Sender, WPARAM wParam) { case WM_LBUTTONDOWN: if (cState == DISABLED) return false; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { bBeingPressed = true; return true; @@ -122,21 +122,21 @@ bool ExButton::isPressed(unsigned int Sender, WPARAM wParam) break; case WM_LBUTTONUP: if (cState == DISABLED) return false; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { - if (cState == VISIBLE && event_onClick) { D2Funcs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); event_onClick(this); } + if (cState == VISIBLE && event_onClick) { D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); event_onClick(this); } bBeingPressed = false; return true; } break; case WM_MOUSEMOVE: - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY >= cY - cHeight && *D2Vars::D2CLIENT_MouseY <= cY) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY >= cY - cHeight && *D2Vars.D2CLIENT_MouseY <= cY) bBeingSelected = true; else bBeingSelected = false; if (cState == DISABLED) return false; if (!(Sender == WM_MOUSEMOVE && wParam & (MK_LBUTTON))) break; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY - cHeight && *D2Vars::D2CLIENT_MouseY >= cY) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY - cHeight && *D2Vars.D2CLIENT_MouseY >= cY) bBeingPressed = true; else bBeingPressed = false; diff --git a/ExCellFile.cpp b/ExCellFile.cpp index 6487f68..c75fdab 100644 --- a/ExCellFile.cpp +++ b/ExCellFile.cpp @@ -10,7 +10,7 @@ */ ExCellFile::ExCellFile(string szCellFile) : FileName(szCellFile) { - ptCellFile = D2Funcs::D2WIN_LoadCellFile(szCellFile.c_str(), 0); + ptCellFile = D2Funcs.D2WIN_LoadCellFile(szCellFile.c_str(), 0); if (!ptCellFile || (DWORD)ptCellFile == 1) // 26.01.2014 <-- fixed error when cell file fails to load { Misc::Log("ExCellFile: Cannot load CellFile %s", FileName.c_str()); @@ -65,8 +65,8 @@ ExCellFile::~ExCellFile(void) { //DEBUGMSG("Trying to free cell file %s", FileName.c_str()); if (!ptCellFile) return; - D2Funcs::D2CMP_DeleteCellFile(ptCellFile); - D2Funcs::FOG_FreeMemory(ptCellFile, __FILE__, __LINE__, 0); + D2Funcs.D2CMP_DeleteCellFile(ptCellFile); + D2Funcs.FOG_FreeMemory(ptCellFile, __FILE__, __LINE__, 0); ptCellFile = 0; if (!ptCellContext) return; delete ptCellContext; diff --git a/ExChat.cpp b/ExChat.cpp index 796219f..7de4144 100644 --- a/ExChat.cpp +++ b/ExChat.cpp @@ -26,7 +26,7 @@ BOOL __fastcall ExChat::OnMessage(BYTE* aPacket) string szMsg = pMsg->CharName+CharLen+1; Misc::Log("<%s> : %s",szCharName.c_str(),szMsg.c_str()); //if(aChat && !szMsg.empty()) aChat->AddMsg(szMsg,szCharName,pMsg->MsgColor); -return D2Ptrs::D2CLIENT_GameChat_I(aPacket); +return D2Funcs.D2CLIENT_GameChat_I(aPacket); } /*ExMsgs::ExMsgs() diff --git a/ExControl.cpp b/ExControl.cpp index cffc064..57d6213 100644 --- a/ExControl.cpp +++ b/ExControl.cpp @@ -64,10 +64,10 @@ void ExControl::Relocate() //- Set control align else if(hAlign == RIGHT) cY=ptParent->GetY()+ptParent->GetHeight()-cHeight; } else { - if(wAlign == CENTER) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth)/2; - else if(wAlign == RIGHT) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth); - if(hAlign == CENTER) cY=(*D2Vars::D2CLIENT_ScreenHeight-cHeight)/2; - else if(hAlign == RIGHT) cY=*D2Vars::D2CLIENT_ScreenHeight-cHeight; + if(wAlign == CENTER) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth)/2; + else if(wAlign == RIGHT) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth); + if(hAlign == CENTER) cY=(*D2Vars.D2CLIENT_ScreenHeight-cHeight)/2; + else if(hAlign == RIGHT) cY=*D2Vars.D2CLIENT_ScreenHeight-cHeight; } } @@ -113,9 +113,9 @@ void ExControl::Draw() { if(cState!=INVISIBLE) { - D2Funcs::D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,0xFF,5); - D2Funcs::D2WIN_SetTextSize(aFont); - D2Funcs::D2WIN_DrawText(L"",cX,cY,11,0); // THIS NEVER HAPPEN + D2Funcs.D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,0xFF,5); + D2Funcs.D2WIN_SetTextSize(aFont); + D2Funcs.D2WIN_DrawText(L"",cX,cY,11,0); // THIS NEVER HAPPEN } } bool ExControl::isPressed(unsigned int Sender, WPARAM wParam) @@ -123,14 +123,14 @@ bool ExControl::isPressed(unsigned int Sender, WPARAM wParam) switch(Sender) { case WM_LBUTTONDOWN: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) { bBeingPressed=true; return true; } break; case WM_LBUTTONUP: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) { if(cState==VISIBLE && event_onClick) event_onClick(this); bBeingPressed=false; @@ -138,12 +138,12 @@ return true; } break; case WM_MOUSEMOVE: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) bBeingSelected=true; else bBeingSelected=false; if(!(Sender==WM_MOUSEMOVE && wParam & (MK_LBUTTON))) break; -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) bBeingPressed=true; else bBeingPressed=false; diff --git a/ExDownload.cpp b/ExDownload.cpp index d37afbb..06e1899 100644 --- a/ExDownload.cpp +++ b/ExDownload.cpp @@ -140,7 +140,7 @@ Abort = true; void ExDownload::ShowHide() { -static wstring CancelStr = D2Funcs::D2LANG_GetLocaleText(3765); +static wstring CancelStr = D2Funcs.D2LANG_GetLocaleText(3765); static ExBox * Bckg; if(!DownScreen) diff --git a/ExEditBox.cpp b/ExEditBox.cpp index fc749f0..0204082 100644 --- a/ExEditBox.cpp +++ b/ExEditBox.cpp @@ -57,8 +57,8 @@ void ExEditBox::SetChangeEvent(void(*event_Change)(ExEditBox*)) void ExEditBox::Draw() { if (cState == INVISIBLE) return; - D2Funcs::D2WIN_SetTextSize(aFont); - D2Funcs::D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, 5, cState == VISIBLE ? 0 : 1); + D2Funcs.D2WIN_SetTextSize(aFont); + D2Funcs.D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, 5, cState == VISIBLE ? 0 : 1); int TextWid = 0; if (!Text.empty()) { @@ -73,13 +73,13 @@ void ExEditBox::Draw() Buffer.erase(Buffer.length()); } if (isHashed) Buffer.assign(Buffer.length(), L'*'); - D2Funcs::D2WIN_DrawText(Buffer.c_str(), cX + TextX, cY - TextY, Color, 0); + D2Funcs.D2WIN_DrawText(Buffer.c_str(), cX + TextX, cY - TextY, Color, 0); TextWid = ExScreen::GetTextWidth(Buffer.substr(0, CursorPos).c_str()); } if (!isFocused) return; - if (GetTickCount() % 50 == 0) D2Funcs::D2GFX_DrawLine(TextWid + cX + TextX, cY - TextY, TextWid + cX + TextX + 5, cY - TextY, 255, 0); + if (GetTickCount() % 50 == 0) D2Funcs.D2GFX_DrawLine(TextWid + cX + TextX, cY - TextY, TextWid + cX + TextX + 5, cY - TextY, 255, 0); } @@ -90,7 +90,7 @@ bool ExEditBox::isPressed(unsigned int Sender, WPARAM wParam) { case WM_LBUTTONDOWN: if (cState == DISABLED) return false; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { bBeingPressed = true; return true; @@ -98,10 +98,10 @@ bool ExEditBox::isPressed(unsigned int Sender, WPARAM wParam) break; case WM_LBUTTONUP: if (cState == DISABLED) return false; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { if (cState == VISIBLE) { - D2Funcs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); isFocused = true; + D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); isFocused = true; } bBeingPressed = false; return true; diff --git a/ExEntryText.cpp b/ExEntryText.cpp index 7e9fac6..f5f2081 100644 --- a/ExEntryText.cpp +++ b/ExEntryText.cpp @@ -13,18 +13,18 @@ void ExEntryText::Draw() static int Timer; static int LevelId; const int TransTable[] = {0,1,2,5}; - Room1* pRoom = D2Funcs::D2COMMON_GetUnitRoom(D2Funcs::D2CLIENT_GetPlayer()); - static int LocId = D2Funcs::D2LANG_GetLocaleId(); + Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(D2Funcs.D2CLIENT_GetPlayer()); + static int LocId = D2Funcs.D2LANG_GetLocaleId(); if (pRoom == 0) return; - int lvlNo = D2Funcs::D2COMMON_GetLevelNoByRoom(pRoom); + int lvlNo = D2Funcs.D2COMMON_GetLevelNoByRoom(pRoom); if (LevelId!= lvlNo) { - *D2Vars::D2CLIENT_PetBarColorGreen = D2Funcs::D2WIN_MixRGB(0,128,0); - *D2Vars::D2CLIENT_PetBarColorYellow = D2Funcs::D2WIN_MixRGB(192,192,0); - *D2Vars::D2CLIENT_PetBarColorRed = D2Funcs::D2WIN_MixRGB(255,0,0); + *D2Vars.D2CLIENT_PetBarColorGreen = D2Funcs.D2WIN_MixRGB(0,128,0); + *D2Vars.D2CLIENT_PetBarColorYellow = D2Funcs.D2WIN_MixRGB(192,192,0); + *D2Vars.D2CLIENT_PetBarColorRed = D2Funcs.D2WIN_MixRGB(255,0,0); LevelId = lvlNo; Timer = 120; ExParty::Update(); @@ -34,16 +34,16 @@ void ExEntryText::Draw() if (Timer > 0) { int Trans = (Timer <= 30 ? TransTable[Timer/8] : 7 ); - wstring szLevelName = D2Funcs::D2CLIENT_GetLevelName(LevelId); + wstring szLevelName = D2ASMFuncs::D2CLIENT_GetLevelName(LevelId); wstring szNameBuffer = (LocId ==10 ? L"Wchodzisz do: " : L"Entering: ") + szLevelName ; - int old = D2Funcs::D2WIN_SetTextSize(EnteringFont); + int old = D2Funcs.D2WIN_SetTextSize(EnteringFont); - int x = *D2Vars::D2CLIENT_ScreenWidth / 2 - ExScreen::GetTextWidth(szNameBuffer.c_str()) / 2; - int y = *D2Vars::D2CLIENT_ScreenHeight / 2 - 140; + int x = *D2Vars.D2CLIENT_ScreenWidth / 2 - ExScreen::GetTextWidth(szNameBuffer.c_str()) / 2; + int y = *D2Vars.D2CLIENT_ScreenHeight / 2 - 140; - D2Funcs::D2WIN_DrawTextEx(szNameBuffer.c_str(),x,y,1,0,Trans); - D2Funcs::D2WIN_SetTextSize(old); + D2Funcs.D2WIN_DrawTextEx(szNameBuffer.c_str(),x,y,1,0,Trans); + D2Funcs.D2WIN_SetTextSize(old); Timer--; } diff --git a/ExEvents.cpp b/ExEvents.cpp index c065968..eb2ab56 100644 --- a/ExEvents.cpp +++ b/ExEvents.cpp @@ -52,7 +52,7 @@ break; { if(!Dane->UnitId) break; if(Dane->Color>15) break; - if(!D2Funcs::D2CLIENT_GetUnitById(Dane->UnitId,UNIT_PLAYER)) break; + if(!D2Funcs.D2CLIENT_GetUnitById(Dane->UnitId,UNIT_PLAYER)) break; string str = Dane->szMsg; if(str.empty()) break; @@ -111,22 +111,22 @@ ExParty::AddAccount(Dane->Name1, Dane->Name2); ExParty::Refresh(); break; //case 6: //"%Name1 was Slain by %Name2" -//if(!Dane->Param2 && !strcmp(Dane->Name2,D2Funcs::D2CLIENT_GetPlayer()->pPlayerData->szName)) // DEATH MSG +//if(!Dane->Param2 && !strcmp(Dane->Name2,D2Funcs.D2CLIENT_GetPlayer()->pPlayerData->szName)) // DEATH MSG //{ // KillCount++; // if(!TH) TH = CreateThread(0,0,&ExEvents::KillCountEvent,0,0,0); // // if(!ExParty::isPlayerNear(Dane->Name1)) // { -// if(Text) return D2Ptrs::D2CLIENT_EventMsg_I(aPacket); +// if(Text) return D2Ptrs.D2CLIENT_EventMsg_I(aPacket); // Text = new ExTextBox(-1,150,1,3,L"INVISIBLE KILL!",0,0); -// D2Funcs::D2CLIENT_PlaySound(ExSounds::D2EX_IMPRESSIVE); +// D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::D2EX_IMPRESSIVE); // CreateThread(0,0,&ExEvents::TextFadeThread,Text,0,0); // } //} //break; } -return D2Ptrs::D2CLIENT_EventMsg_I(aPacket); +return D2Funcs.D2CLIENT_EventMsg_I(aPacket); } @@ -139,17 +139,17 @@ return D2Ptrs::D2CLIENT_EventMsg_I(aPacket); // { // case 2: // Text = new ExTextBox(-1,150,1,3,L"DOUBLE KILL!",0,0); -// D2Funcs::D2CLIENT_PlaySound(ExSounds::D2EX_DOUBLEKILL); +// D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::D2EX_DOUBLEKILL); // CreateThread(0,0,&ExEvents::TextFadeThread,Text,0,0); // break; // case 3: // Text = new ExTextBox(-1,150,1,3,L"TRIPPLE KILL!",0,0); -// D2Funcs::D2CLIENT_PlaySound(ExSounds::D2EX_TRIPLEKILL); +// D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::D2EX_TRIPLEKILL); // CreateThread(0,0,&ExEvents::TextFadeThread,Text,0,0); // break; // case 4: // Text = new ExTextBox(-1,150,1,3,L"MONSTER KILL!",0,0); -// D2Funcs::D2CLIENT_PlaySound(ExSounds::D2EX_MONSTERKILL); +// D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::D2EX_MONSTERKILL); // CreateThread(0,0,&ExEvents::TextFadeThread,Text,0,0); // break; // } @@ -164,7 +164,7 @@ DWORD WINAPI ExEvents::TextFadeThread(void* Params) while(!TextQuene.empty()) { const int TransTable[] = {0,1,2,5}; - D2Funcs::D2CLIENT_PlaySound(TextQuene.front().SoundId); + D2ASMFuncs::D2CLIENT_PlaySound(TextQuene.front().SoundId); TextQuene.front().Text->SetState(TextQuene.front().Text->VISIBLE); for(int Timer = 120;Timer;Timer--) { @@ -195,13 +195,13 @@ Image->SetState(Image->VISIBLE); for(int Timer = 120;Timer;Timer--) { -UnitAny * pUnit = D2Funcs::D2CLIENT_GetUnitById(UnitId, 0); +UnitAny * pUnit = D2Funcs.D2CLIENT_GetUnitById(UnitId, 0); if(!pUnit) break; -POINT pPos = {D2Funcs::D2COMMON_GetUnitXOffset(pUnit),D2Funcs::D2COMMON_GetUnitYOffset(pUnit)}; +POINT pPos = {D2Funcs.D2COMMON_GetUnitXOffset(pUnit),D2Funcs.D2COMMON_GetUnitYOffset(pUnit)}; -pPos.x -= *D2Vars::D2CLIENT_PlayerX - *D2Vars::D2CLIENT_ScreenXShift + 15; -pPos.y -= *D2Vars::D2CLIENT_PlayerY + 70; +pPos.x -= *D2Vars.D2CLIENT_PlayerX - *D2Vars.D2CLIENT_ScreenXShift + 15; +pPos.y -= *D2Vars.D2CLIENT_PlayerY + 70; Image->SetX(pPos.x); Image->SetY(pPos.y); Image->SetTransLvl(Timer <= 30 ? TransTable[Timer/8] : 7 ); diff --git a/ExImage.cpp b/ExImage.cpp index 2b0fb15..3cbb145 100644 --- a/ExImage.cpp +++ b/ExImage.cpp @@ -49,10 +49,10 @@ void ExImage::Relocate() //- Set control align else if (hAlign == RIGHT) cY = ptParent->GetY() + ptParent->GetHeight(); } else { - if (wAlign == CENTER) cX = (*D2Vars::D2CLIENT_ScreenWidth - cWidth) / 2; - else if (wAlign == RIGHT) cX = (*D2Vars::D2CLIENT_ScreenWidth - cWidth); - if (hAlign == CENTER) cY = (*D2Vars::D2CLIENT_ScreenHeight + cHeight) / 2; - else if (hAlign == RIGHT) cY = *D2Vars::D2CLIENT_ScreenHeight; + if (wAlign == CENTER) cX = (*D2Vars.D2CLIENT_ScreenWidth - cWidth) / 2; + else if (wAlign == RIGHT) cX = (*D2Vars.D2CLIENT_ScreenWidth - cWidth); + if (hAlign == CENTER) cY = (*D2Vars.D2CLIENT_ScreenHeight + cHeight) / 2; + else if (hAlign == RIGHT) cY = *D2Vars.D2CLIENT_ScreenHeight; } } @@ -62,15 +62,15 @@ void ExImage::Draw() if (MultiFrame) { //TODO: IMPROVE IT, ITS UNSTABLE ATM - //D2Funcs::D2WIN_DrawCellFile(aCellFile->GetCF(),cX,cY,0,TransLvl,ColorShift); - //D2Funcs::D2WIN_DrawCellFile(aCellFile->GetCF(),cX+177,cY+256,1,TransLvl,ColorShift); - //D2Funcs::D2WIN_DrawCellFile(aCellFile->GetCF(),cX,cY+(256*2),8,TransLvl,ColorShift); + //D2Funcs.D2WIN_DrawCellFile(aCellFile->GetCF(),cX,cY,0,TransLvl,ColorShift); + //D2Funcs.D2WIN_DrawCellFile(aCellFile->GetCF(),cX+177,cY+256,1,TransLvl,ColorShift); + //D2Funcs.D2WIN_DrawCellFile(aCellFile->GetCF(),cX,cY+(256*2),8,TransLvl,ColorShift); } else - D2Funcs::D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, TransLvl, ColorShift); + D2Funcs.D2GFX_DrawCellContextEx(aCellFile->Get(), cX, cY, -1, TransLvl, ColorShift); if (Hoover.empty() || !bBeingSelected) return; - D2Funcs::D2WIN_DrawFramedText(Hoover.c_str(), cX, cY - cHeight - 10, 0, 0); + D2Funcs.D2WIN_DrawFramedText(Hoover.c_str(), cX, cY - cHeight - 10, 0, 0); } ExImage::~ExImage(void) @@ -85,14 +85,14 @@ bool ExImage::isPressed(unsigned int Sender, WPARAM wParam) switch (Sender) { case WM_LBUTTONDOWN: - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { bBeingPressed = true; return true; } break; case WM_LBUTTONUP: - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY && *D2Vars::D2CLIENT_MouseY >= cY - cHeight) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY && *D2Vars.D2CLIENT_MouseY >= cY - cHeight) { if (cState == VISIBLE && event_onClick) event_onClick(this); bBeingPressed = false; @@ -100,12 +100,12 @@ bool ExImage::isPressed(unsigned int Sender, WPARAM wParam) } break; case WM_MOUSEMOVE: - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY >= cY - cHeight && *D2Vars::D2CLIENT_MouseY <= cY) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY >= cY - cHeight && *D2Vars.D2CLIENT_MouseY <= cY) bBeingSelected = true; else bBeingSelected = false; if (!(Sender == WM_MOUSEMOVE && wParam & (MK_LBUTTON))) break; - if (*D2Vars::D2CLIENT_MouseX >= cX && *D2Vars::D2CLIENT_MouseX <= cX + cWidth && *D2Vars::D2CLIENT_MouseY <= cY - cHeight && *D2Vars::D2CLIENT_MouseY >= cY) + if (*D2Vars.D2CLIENT_MouseX >= cX && *D2Vars.D2CLIENT_MouseX <= cX + cWidth && *D2Vars.D2CLIENT_MouseY <= cY - cHeight && *D2Vars.D2CLIENT_MouseY >= cY) bBeingPressed = true; else bBeingPressed = false; diff --git a/ExInput.cpp b/ExInput.cpp index 147cfb6..83f3422 100644 --- a/ExInput.cpp +++ b/ExInput.cpp @@ -7,34 +7,34 @@ // IMPORT FROM SCRAP Project void ExInput::DefineBindings() { -//D2Funcs::STORM_RegisterKeyDown(D2Funcs::D2GFX_GetHwnd(),VK_Aim,&ExAim::b_Aim); -//D2Funcs::STORM_RegisterKeyDown(D2Funcs::D2GFX_GetHwnd(),VK_FastTP,&ExChicken::b_FastTP); +//D2Funcs.STORM_RegisterKeyDown(D2Funcs.D2GFX_GetHwnd(),VK_Aim,&ExAim::b_Aim); +//D2Funcs.STORM_RegisterKeyDown(D2Funcs.D2GFX_GetHwnd(),VK_FastTP,&ExChicken::b_FastTP); } void ExInput::UndefineBindings() { -//D2Funcs::STORM_UnregisterKeyDown(D2Funcs::D2GFX_GetHwnd(),VK_Aim,&ExAim::b_Aim); -//D2Funcs::STORM_UnregisterKeyDown(D2Funcs::D2GFX_GetHwnd(),VK_FastTP,&ExChicken::b_FastTP); +//D2Funcs.STORM_UnregisterKeyDown(D2Funcs.D2GFX_GetHwnd(),VK_Aim,&ExAim::b_Aim); +//D2Funcs.STORM_UnregisterKeyDown(D2Funcs.D2GFX_GetHwnd(),VK_FastTP,&ExChicken::b_FastTP); } void ExInput::RegisterMsgs(sMsg* pMsgList, int nCount) { - HWND hWnd = D2Funcs::D2GFX_GetHwnd(); + HWND hWnd = D2Funcs.D2GFX_GetHwnd(); ASSERT(hWnd) for(int i = 0; i 0) + if (*D2Vars.D2GFX_GfxMode > 0) { EnterCriticalSection(&CON_CRITSECT); int x, y; - ExMultiRes::D2GFX_GetModeParams(*D2Vars::D2GFX_GfxMode - 1, &x, &y); + ExMultiRes::D2GFX_GetModeParams(*D2Vars.D2GFX_GfxMode - 1, &x, &y); DEBUGMSG("Changing resolution to %dx%d", x, y); - ExMultiRes::D2CLIENT_SetResolution((*D2Vars::D2GFX_GfxMode) - 1); + ExMultiRes::D2CLIENT_SetResolution((*D2Vars.D2GFX_GfxMode) - 1); LeaveCriticalSection(&CON_CRITSECT); } } else if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) { - if (*D2Vars::D2GFX_GfxMode < ExMultiRes::lResModes.size() + 2) + if (*D2Vars.D2GFX_GfxMode (unsigned int)< ExMultiRes::lResModes.size() + 2) { EnterCriticalSection(&CON_CRITSECT); int x, y; - ExMultiRes::D2GFX_GetModeParams(*D2Vars::D2GFX_GfxMode + 1, &x, &y); + ExMultiRes::D2GFX_GetModeParams(*D2Vars.D2GFX_GfxMode + 1, &x, &y); DEBUGMSG("Changing resolution to %dx%d", x, y); - ExMultiRes::D2CLIENT_SetResolution((*D2Vars::D2GFX_GfxMode) + 1); + ExMultiRes::D2CLIENT_SetResolution((*D2Vars.D2GFX_GfxMode) + 1); LeaveCriticalSection(&CON_CRITSECT); } } return 0; } - +#endif if(uMsg == WM_KEYDOWN) { if(wParam == 'V') { if(GetKeyState(VK_CONTROL)<0){ - if((D2Vars::D2CLIENT_UIModes[UI_CHAT]) && OpenClipboard(0)) + if((D2Vars.D2CLIENT_UIModes[UI_CHAT]) && OpenClipboard(0)) { INPUT inp[2]; memset(inp,0,sizeof(INPUT)); @@ -344,10 +347,10 @@ LONG WINAPI ExInput::GameWindowEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM return 0; }} } - // if(wParam == VK_INSERT && D2Vars::D2CLIENT_UIModes[UI_CHAT] ==0 ) {ExAim::DoAttack(); return 0; } + // if(wParam == VK_INSERT && D2Vars.D2CLIENT_UIModes[UI_CHAT] ==0 ) {ExAim::DoAttack(); return 0; } #ifdef D2EX_SCRAP_HACKS if(StillSwitch) { - if(D2Funcs::D2CLIENT_GetPlayer() && !D2Vars::D2CLIENT_UIModes[UI_CHAT]) { + if(D2Funcs.D2CLIENT_GetPlayer() && !D2Vars.D2CLIENT_UIModes[UI_CHAT]) { WORD vKey = GetKeyBind(44,false); // Fast Switch WORD vKey2 = GetKeyBind(44, true); //Alternative HotKey if(wParam == vKey || wParam == vKey2) { @@ -377,7 +380,7 @@ void ExInput::Say(const char* Msg,...) *(WORD*)&aPacket[1] = 0x01; memcpy(aPacket + 3, text, strlen(text)); - D2Funcs::D2NET_SendPacket(strlen(text) + 6, 1, aPacket); + D2Funcs.D2NET_SendPacket(strlen(text) + 6, 1, aPacket); delete[] text; delete[] aPacket; @@ -386,7 +389,7 @@ void ExInput::Say(const char* Msg,...) WORD ExInput::GetKeyBind(int nEntry, BOOL bPrimary) { int i = 0; - for(KeyBinding* k = D2Vars::D2CLIENT_KeyBindings; i<114; ++k, ++i) { + for(KeyBinding* k = D2Vars.D2CLIENT_KeyBindings; i<114; ++k, ++i) { if(k->bPrimary == bPrimary && k->nHotkey == nEntry) return k->wKey; } @@ -401,193 +404,193 @@ wchar_t* ExInput::GetNameOfKey(WORD vKey) // pure copy&pasta switch(vKey) { case 1u: - return D2Funcs::D2LANG_GetLocaleText(3763); + return D2Funcs.D2LANG_GetLocaleText(3763); case 2u: - return D2Funcs::D2LANG_GetLocaleText(3764); + return D2Funcs.D2LANG_GetLocaleText(3764); case 3u: - return D2Funcs::D2LANG_GetLocaleText(3765); + return D2Funcs.D2LANG_GetLocaleText(3765); case 4u: - return D2Funcs::D2LANG_GetLocaleText(3766); + return D2Funcs.D2LANG_GetLocaleText(3766); case 0x15u: - return D2Funcs::D2LANG_GetLocaleText(3771); + return D2Funcs.D2LANG_GetLocaleText(3771); case 0x17u: - return D2Funcs::D2LANG_GetLocaleText(3772); + return D2Funcs.D2LANG_GetLocaleText(3772); case 0x18u: - return D2Funcs::D2LANG_GetLocaleText(3773); + return D2Funcs.D2LANG_GetLocaleText(3773); case 0x19u: - return D2Funcs::D2LANG_GetLocaleText(3774); + return D2Funcs.D2LANG_GetLocaleText(3774); case 0x1Bu: - return D2Funcs::D2LANG_GetLocaleText(3775); + return D2Funcs.D2LANG_GetLocaleText(3775); case 0x1Cu: - return D2Funcs::D2LANG_GetLocaleText(3776); + return D2Funcs.D2LANG_GetLocaleText(3776); case 0x1Du: - return D2Funcs::D2LANG_GetLocaleText(3777); + return D2Funcs.D2LANG_GetLocaleText(3777); case 0x1Eu: - return D2Funcs::D2LANG_GetLocaleText(3778); + return D2Funcs.D2LANG_GetLocaleText(3778); case 0x1Fu: - return D2Funcs::D2LANG_GetLocaleText(3779); + return D2Funcs.D2LANG_GetLocaleText(3779); case 0x25u: - return D2Funcs::D2LANG_GetLocaleText(3780); + return D2Funcs.D2LANG_GetLocaleText(3780); case 0x26u: - return D2Funcs::D2LANG_GetLocaleText(3781); + return D2Funcs.D2LANG_GetLocaleText(3781); case 0x27u: - return D2Funcs::D2LANG_GetLocaleText(3782); + return D2Funcs.D2LANG_GetLocaleText(3782); case 0x28u: - return D2Funcs::D2LANG_GetLocaleText(3783); + return D2Funcs.D2LANG_GetLocaleText(3783); case 0x29u: - return D2Funcs::D2LANG_GetLocaleText(3784); + return D2Funcs.D2LANG_GetLocaleText(3784); case 0x2Bu: - return D2Funcs::D2LANG_GetLocaleText(3785); + return D2Funcs.D2LANG_GetLocaleText(3785); case 0x5Bu: - return D2Funcs::D2LANG_GetLocaleText(3786); + return D2Funcs.D2LANG_GetLocaleText(3786); case 0x5Cu: - return D2Funcs::D2LANG_GetLocaleText(3787); + return D2Funcs.D2LANG_GetLocaleText(3787); case 0x5Du: - return D2Funcs::D2LANG_GetLocaleText(3788); + return D2Funcs.D2LANG_GetLocaleText(3788); case 0x90u: - return D2Funcs::D2LANG_GetLocaleText(3789); + return D2Funcs.D2LANG_GetLocaleText(3789); case 8u: - return D2Funcs::D2LANG_GetLocaleText(3790); + return D2Funcs.D2LANG_GetLocaleText(3790); case 9u: - return D2Funcs::D2LANG_GetLocaleText(3791); + return D2Funcs.D2LANG_GetLocaleText(3791); case 0xCu: - return D2Funcs::D2LANG_GetLocaleText(3792); + return D2Funcs.D2LANG_GetLocaleText(3792); case 0xDu: - return D2Funcs::D2LANG_GetLocaleText(3793); + return D2Funcs.D2LANG_GetLocaleText(3793); case 0x10u: - return D2Funcs::D2LANG_GetLocaleText(3794); + return D2Funcs.D2LANG_GetLocaleText(3794); case 0x11u: - return D2Funcs::D2LANG_GetLocaleText(3795); + return D2Funcs.D2LANG_GetLocaleText(3795); case 0x12u: - return D2Funcs::D2LANG_GetLocaleText(3796); + return D2Funcs.D2LANG_GetLocaleText(3796); case 0x13u: - return D2Funcs::D2LANG_GetLocaleText(3797); + return D2Funcs.D2LANG_GetLocaleText(3797); case 0x14u: - return D2Funcs::D2LANG_GetLocaleText(3798); + return D2Funcs.D2LANG_GetLocaleText(3798); case 0x20u: - return D2Funcs::D2LANG_GetLocaleText(3799); + return D2Funcs.D2LANG_GetLocaleText(3799); case 0x21u: - return D2Funcs::D2LANG_GetLocaleText(3800); + return D2Funcs.D2LANG_GetLocaleText(3800); case 0x22u: - return D2Funcs::D2LANG_GetLocaleText(3801); + return D2Funcs.D2LANG_GetLocaleText(3801); case 0x23u: - return D2Funcs::D2LANG_GetLocaleText(3802); + return D2Funcs.D2LANG_GetLocaleText(3802); case 0x24u: - return D2Funcs::D2LANG_GetLocaleText(3803); + return D2Funcs.D2LANG_GetLocaleText(3803); case 0x2Au: - return D2Funcs::D2LANG_GetLocaleText(3804); + return D2Funcs.D2LANG_GetLocaleText(3804); case 0x2Cu: - return D2Funcs::D2LANG_GetLocaleText(3805); + return D2Funcs.D2LANG_GetLocaleText(3805); case 0x2Du: - return D2Funcs::D2LANG_GetLocaleText(3806); + return D2Funcs.D2LANG_GetLocaleText(3806); case 0x2Eu: - return D2Funcs::D2LANG_GetLocaleText(3807); + return D2Funcs.D2LANG_GetLocaleText(3807); case 0x2Fu: - return D2Funcs::D2LANG_GetLocaleText(3808); + return D2Funcs.D2LANG_GetLocaleText(3808); case 0x60u: - return D2Funcs::D2LANG_GetLocaleText(3809); + return D2Funcs.D2LANG_GetLocaleText(3809); case 0x61u: - return D2Funcs::D2LANG_GetLocaleText(3810); + return D2Funcs.D2LANG_GetLocaleText(3810); case 0x62u: - return D2Funcs::D2LANG_GetLocaleText(3811); + return D2Funcs.D2LANG_GetLocaleText(3811); case 0x63u: - return D2Funcs::D2LANG_GetLocaleText(3812); + return D2Funcs.D2LANG_GetLocaleText(3812); case 0x64u: - return D2Funcs::D2LANG_GetLocaleText(3813); + return D2Funcs.D2LANG_GetLocaleText(3813); case 0x65u: - return D2Funcs::D2LANG_GetLocaleText(3814); + return D2Funcs.D2LANG_GetLocaleText(3814); case 0x66u: - return D2Funcs::D2LANG_GetLocaleText(3815); + return D2Funcs.D2LANG_GetLocaleText(3815); case 0x67u: - return D2Funcs::D2LANG_GetLocaleText(3816); + return D2Funcs.D2LANG_GetLocaleText(3816); case 0x68u: - return D2Funcs::D2LANG_GetLocaleText(3817); + return D2Funcs.D2LANG_GetLocaleText(3817); case 0x69u: - return D2Funcs::D2LANG_GetLocaleText(3818); + return D2Funcs.D2LANG_GetLocaleText(3818); case 0x6Au: - return D2Funcs::D2LANG_GetLocaleText(3819); + return D2Funcs.D2LANG_GetLocaleText(3819); case 0x6Bu: - return D2Funcs::D2LANG_GetLocaleText(3820); + return D2Funcs.D2LANG_GetLocaleText(3820); case 0x6Cu: - return D2Funcs::D2LANG_GetLocaleText(3821); + return D2Funcs.D2LANG_GetLocaleText(3821); case 0x6Du: - return D2Funcs::D2LANG_GetLocaleText(3822); + return D2Funcs.D2LANG_GetLocaleText(3822); case 0x6Eu: - return D2Funcs::D2LANG_GetLocaleText(3823); + return D2Funcs.D2LANG_GetLocaleText(3823); case 0x6Fu: - return D2Funcs::D2LANG_GetLocaleText(3824); + return D2Funcs.D2LANG_GetLocaleText(3824); case 0x70u: - return D2Funcs::D2LANG_GetLocaleText(3825); + return D2Funcs.D2LANG_GetLocaleText(3825); case 0x71u: - return D2Funcs::D2LANG_GetLocaleText(3826); + return D2Funcs.D2LANG_GetLocaleText(3826); case 0x72u: - return D2Funcs::D2LANG_GetLocaleText(3827); + return D2Funcs.D2LANG_GetLocaleText(3827); case 0x73u: - return D2Funcs::D2LANG_GetLocaleText(3828); + return D2Funcs.D2LANG_GetLocaleText(3828); case 0x74u: - return D2Funcs::D2LANG_GetLocaleText(3829); + return D2Funcs.D2LANG_GetLocaleText(3829); case 0x75u: - return D2Funcs::D2LANG_GetLocaleText(3830); + return D2Funcs.D2LANG_GetLocaleText(3830); case 0x76u: - return D2Funcs::D2LANG_GetLocaleText(3831); + return D2Funcs.D2LANG_GetLocaleText(3831); case 0x77u: - return D2Funcs::D2LANG_GetLocaleText(3832); + return D2Funcs.D2LANG_GetLocaleText(3832); case 0x78u: - return D2Funcs::D2LANG_GetLocaleText(3833); + return D2Funcs.D2LANG_GetLocaleText(3833); case 0x79u: - return D2Funcs::D2LANG_GetLocaleText(3834); + return D2Funcs.D2LANG_GetLocaleText(3834); case 0x7Au: - return D2Funcs::D2LANG_GetLocaleText(3835); + return D2Funcs.D2LANG_GetLocaleText(3835); case 0x7Bu: - return D2Funcs::D2LANG_GetLocaleText(3836); + return D2Funcs.D2LANG_GetLocaleText(3836); case 0x7Cu: - return D2Funcs::D2LANG_GetLocaleText(3837); + return D2Funcs.D2LANG_GetLocaleText(3837); case 0x7Du: - return D2Funcs::D2LANG_GetLocaleText(3838); + return D2Funcs.D2LANG_GetLocaleText(3838); case 0x7Eu: - return D2Funcs::D2LANG_GetLocaleText(3839); + return D2Funcs.D2LANG_GetLocaleText(3839); case 0x7Fu: - return D2Funcs::D2LANG_GetLocaleText(3840); + return D2Funcs.D2LANG_GetLocaleText(3840); case 0x80u: - return D2Funcs::D2LANG_GetLocaleText(3841); + return D2Funcs.D2LANG_GetLocaleText(3841); case 0x81u: - return D2Funcs::D2LANG_GetLocaleText(3842); + return D2Funcs.D2LANG_GetLocaleText(3842); case 0x82u: - return D2Funcs::D2LANG_GetLocaleText(3843); + return D2Funcs.D2LANG_GetLocaleText(3843); case 0x83u: - return D2Funcs::D2LANG_GetLocaleText(3844); + return D2Funcs.D2LANG_GetLocaleText(3844); case 0x84u: - return D2Funcs::D2LANG_GetLocaleText(3845); + return D2Funcs.D2LANG_GetLocaleText(3845); case 0x85u: - return D2Funcs::D2LANG_GetLocaleText(3846); + return D2Funcs.D2LANG_GetLocaleText(3846); case 0x86u: - return D2Funcs::D2LANG_GetLocaleText(3847); + return D2Funcs.D2LANG_GetLocaleText(3847); case 0x87u: - return D2Funcs::D2LANG_GetLocaleText(3848); + return D2Funcs.D2LANG_GetLocaleText(3848); case 0x91u: - return D2Funcs::D2LANG_GetLocaleText(3849); + return D2Funcs.D2LANG_GetLocaleText(3849); case 0xBAu: - return D2Funcs::D2LANG_GetLocaleText(3850); + return D2Funcs.D2LANG_GetLocaleText(3850); case 0xBBu: - return D2Funcs::D2LANG_GetLocaleText(3851); + return D2Funcs.D2LANG_GetLocaleText(3851); case 0xBCu: - return D2Funcs::D2LANG_GetLocaleText(3852); + return D2Funcs.D2LANG_GetLocaleText(3852); case 0xBDu: - return D2Funcs::D2LANG_GetLocaleText(3853); + return D2Funcs.D2LANG_GetLocaleText(3853); case 0xBEu: - return D2Funcs::D2LANG_GetLocaleText(3854); + return D2Funcs.D2LANG_GetLocaleText(3854); case 0xBFu: - return D2Funcs::D2LANG_GetLocaleText(3855); + return D2Funcs.D2LANG_GetLocaleText(3855); case 0xC0u: - return D2Funcs::D2LANG_GetLocaleText(3856); + return D2Funcs.D2LANG_GetLocaleText(3856); case 0xDBu: - return D2Funcs::D2LANG_GetLocaleText(3857); + return D2Funcs.D2LANG_GetLocaleText(3857); case 0xDCu: - return D2Funcs::D2LANG_GetLocaleText(3858); + return D2Funcs.D2LANG_GetLocaleText(3858); case 0xDDu: - return D2Funcs::D2LANG_GetLocaleText(3859); + return D2Funcs.D2LANG_GetLocaleText(3859); case 0xDEu: - return D2Funcs::D2LANG_GetLocaleText(3860); + return D2Funcs.D2LANG_GetLocaleText(3860); } } @@ -596,15 +599,15 @@ else switch(vKey) { case 0x100u: - return D2Funcs::D2LANG_GetLocaleText(3766); + return D2Funcs.D2LANG_GetLocaleText(3766); case 0x101u: - return D2Funcs::D2LANG_GetLocaleText(3767); + return D2Funcs.D2LANG_GetLocaleText(3767); case 0x102u: - return D2Funcs::D2LANG_GetLocaleText(3768); + return D2Funcs.D2LANG_GetLocaleText(3768); case 0x103u: - return D2Funcs::D2LANG_GetLocaleText(3769); + return D2Funcs.D2LANG_GetLocaleText(3769); case 0x104u: - return D2Funcs::D2LANG_GetLocaleText(3770); + return D2Funcs.D2LANG_GetLocaleText(3770); } } static wchar_t tmp; diff --git a/ExLagometer.cpp b/ExLagometer.cpp index b2a1ab5..46cd6db 100644 --- a/ExLagometer.cpp +++ b/ExLagometer.cpp @@ -5,9 +5,9 @@ BOOL __fastcall ExLagometer::OnPong(BYTE* aPacket) { -BOOL ret = D2Ptrs::D2CLIENT_Pong_I(aPacket); +BOOL ret = D2Funcs.D2CLIENT_Pong_I(aPacket); if(lagometer) - lagometer->Update(*D2Vars::D2CLIENT_Ping); + lagometer->Update(*D2Vars.D2CLIENT_Ping); return ret; } @@ -23,14 +23,14 @@ ExLagometer::ExLagometer(int X, int Y) : ExControl(X, Y, LAGOMETER_HISTORY, 18, void ExLagometer::Draw() { - D2Funcs::D2GFX_DrawRectangle(cX, cY,cX+cWidth,cY+cHeight,D2Funcs::D2WIN_MixRGB(0,40,5),5); - D2Funcs::D2CLIENT_DrawGZBox(cX-1,cY-1,cX+cWidth+1, cY+cHeight+1); + D2Funcs.D2GFX_DrawRectangle(cX, cY,cX+cWidth,cY+cHeight,D2Funcs.D2WIN_MixRGB(0,40,5),5); + D2ASMFuncs::D2CLIENT_DrawGZBox(cX-1,cY-1,cX+cWidth+1, cY+cHeight+1); for (int x=0; x 16 #endif - Packet.Unk1 = (D2Funcs::FOG_isExpansion() != 0) ? 0xED5DCC50 : 0x2185EDD6; + Packet.Unk1 = (D2Funcs.FOG_isExpansion() != 0) ? 0xED5DCC50 : 0x2185EDD6; Packet.Unk2 = 0x91A519B6; - Packet.LocaleId = D2Funcs::D2LANG_GetLocaleId(); - strcpy_s(Packet.szCharName, 16, (const char*)D2Vars::D2CLIENT_CurrentName); + Packet.LocaleId = D2Funcs.D2LANG_GetLocaleId(); + strcpy_s(Packet.szCharName, 16, (const char*)D2Vars.D2CLIENT_CurrentName); - D2Funcs::D2NET_SendPacket(37, 0, (BYTE*)&Packet); + D2Funcs.D2NET_SendPacket(37, 0, (BYTE*)&Packet); - *D2Vars::D2CLIENT_SentBytes += 37; - *D2Vars::D2CLIENT_SentPackets++; + *D2Vars.D2CLIENT_SentBytes += 37; + *D2Vars.D2CLIENT_SentPackets++; } @@ -134,9 +134,9 @@ Room1* __fastcall ExLoading::GetRoomByXY(unsigned int xPos, unsigned int yPos) Room1* cRoom = 0 ; if(xPos && yPos) { - ASSERT(D2Funcs::D2CLIENT_GetPlayer()) - if(D2Funcs::D2CLIENT_GetPlayer()->pPath->pRoom1) { - cRoom = D2Funcs::D2CLIENT_GetPlayer()->pPath->pRoom1; + ASSERT(D2Funcs.D2CLIENT_GetPlayer()) + if(D2Funcs.D2CLIENT_GetPlayer()->pPath->pRoom1) { + cRoom = D2Funcs.D2CLIENT_GetPlayer()->pPath->pRoom1; if(xPos < cRoom->dwXStart || xPos > (cRoom->dwXStart + cRoom->dwXSize) || yPos < cRoom->dwYStart || yPos > (cRoom->dwYStart + cRoom->dwYSize)) { @@ -160,10 +160,10 @@ Room1* cRoom = 0 ; else return cRoom; } - cRoom = D2Funcs::D2COMMON_GetRoomByXY(*D2Vars::D2CLIENT_Act,xPos,yPos); + cRoom = D2Funcs.D2COMMON_GetRoomByXY(*D2Vars.D2CLIENT_Act,xPos,yPos); if(!cRoom) { - Misc::Log("Nie znalazlem miejsca na obiekt (%d, %d, Act =%d)",xPos,yPos,(*D2Vars::D2CLIENT_Act)->dwAct + 1); + Misc::Log("Nie znalazlem miejsca na obiekt (%d, %d, Act =%d)",xPos,yPos,(*D2Vars.D2CLIENT_Act)->dwAct + 1); } } return cRoom; @@ -178,7 +178,7 @@ Room1* cRoom = 0 ; //{ //// Misc::Log("Game loading started (0x00)"); // BYTE Packet[5] = {0x0B,1,0,0,0}; -// D2Funcs::D2NET_SendPacket(5,0,Packet); +// D2Funcs.D2NET_SendPacket(5,0,Packet); // // return 0; //} @@ -200,65 +200,65 @@ Room1* cRoom = 0 ; //BOOL __fastcall ExLoading::OnActLoadStart(BYTE *aPacket) //{ //px03 pPacket; -//Misc::Log("Packet: %d, %X, %d, %X, *D2Vars::D2CLIENT_CurrentAct = %d",*(BYTE*)&aPacket[1], *(DWORD*)&aPacket[2], *(WORD*)&aPacket[6],*(DWORD*)&aPacket[8], *D2Vars::D2CLIENT_CurrentAct); +//Misc::Log("Packet: %d, %X, %d, %X, *D2Vars.D2CLIENT_CurrentAct = %d",*(BYTE*)&aPacket[1], *(DWORD*)&aPacket[2], *(WORD*)&aPacket[6],*(DWORD*)&aPacket[8], *D2Vars.D2CLIENT_CurrentAct); //pPacket.ActNo=*(BYTE*)&aPacket[1]; //pPacket.MapId=*(DWORD*)&aPacket[2]; //pPacket.LevelId=*(WORD*)&aPacket[6]; //pPacket.HighSeed=*(DWORD*)&aPacket[8]; // -//D2Funcs::D2CLIENT_LoadWarpTiles(pPacket.ActNo); +//D2Funcs.D2CLIENT_LoadWarpTiles(pPacket.ActNo); // -//if(*D2Vars::D2CLIENT_Act) D2Funcs::D2COMMON_UnloadAct(*D2Vars::D2CLIENT_Act); -//*D2Vars::D2CLIENT_Act= D2Funcs::D2COMMON_LoadAct(pPacket.ActNo,pPacket.MapId,1,0,*D2Vars::D2CLIENT_Difficulty,0,pPacket.LevelId,(DWORD*)D2Ptrs::D2CLIENT_ActMapFunc1,(DWORD*)D2Ptrs::D2CLIENT_ActMapFunc2); +//if(*D2Vars.D2CLIENT_Act) D2Funcs.D2COMMON_UnloadAct(*D2Vars.D2CLIENT_Act); +//*D2Vars.D2CLIENT_Act= D2Funcs.D2COMMON_LoadAct(pPacket.ActNo,pPacket.MapId,1,0,*D2Vars.D2CLIENT_Difficulty,0,pPacket.LevelId,(DWORD*)D2Ptrs.D2CLIENT_ActMapFunc1,(DWORD*)D2Ptrs.D2CLIENT_ActMapFunc2); //Misc::Log("Loaded Act '%d', map id '%d', lvl id '%d'",pPacket.ActNo+1,pPacket.MapId,pPacket.LevelId); //ExLoading::Draw(0); -//if(*D2Vars::D2CLIENT_ActUnk && pPacket.ActNo == 1) +//if(*D2Vars.D2CLIENT_ActUnk && pPacket.ActNo == 1) //{ -// if(*D2Vars::D2CLIENT_Act) +// if(*D2Vars.D2CLIENT_Act) // { // } //} // -//*D2Vars::D2CLIENT_ActUnk = 0; -//*D2Vars::D2CLIENT_CurrentAct = pPacket.ActNo; +//*D2Vars.D2CLIENT_ActUnk = 0; +//*D2Vars.D2CLIENT_CurrentAct = pPacket.ActNo; // -//Seed * ldst = (Seed*)*D2Vars::D2CLIENT_Load_struct; +//Seed * ldst = (Seed*)*D2Vars.D2CLIENT_Load_struct; // //ldst->Low= pPacket.MapId; //ldst->High= pPacket.HighSeed; // // -//D2Vars::D2CLIENT_ColorTbl[0] = D2Funcs::D2WIN_MixRGB(0,0,255); -//D2Vars::D2CLIENT_ColorTbl[1] = D2Funcs::D2WIN_MixRGB(255,0,0); -//D2Vars::D2CLIENT_ColorTbl[2] = D2Funcs::D2WIN_MixRGB(255,0,255); -//D2Vars::D2CLIENT_ColorTbl[3] = D2Funcs::D2WIN_MixRGB(0,255,0); -//D2Vars::D2CLIENT_ColorTbl[4] = D2Funcs::D2WIN_MixRGB(68,112,116); -//D2Vars::D2CLIENT_ColorTbl[5] = D2Funcs::D2WIN_MixRGB(72,160,52); -//D2Vars::D2CLIENT_ColorTbl[6] = D2Funcs::D2WIN_MixRGB(244,244,244); -//D2Vars::D2CLIENT_ColorTbl[7] = D2Funcs::D2WIN_MixRGB(128,128,128); -//D2Vars::D2CLIENT_ColorTbl[8] = D2Funcs::D2WIN_MixRGB(244,244,0); -//D2Vars::D2CLIENT_ColorTbl[9] = D2Funcs::D2WIN_MixRGB(0,0,255); -//D2Vars::D2CLIENT_ColorTbl[10] = D2Funcs::D2WIN_MixRGB(0,255,0); +//D2Vars.D2CLIENT_ColorTbl[0] = D2Funcs.D2WIN_MixRGB(0,0,255); +//D2Vars.D2CLIENT_ColorTbl[1] = D2Funcs.D2WIN_MixRGB(255,0,0); +//D2Vars.D2CLIENT_ColorTbl[2] = D2Funcs.D2WIN_MixRGB(255,0,255); +//D2Vars.D2CLIENT_ColorTbl[3] = D2Funcs.D2WIN_MixRGB(0,255,0); +//D2Vars.D2CLIENT_ColorTbl[4] = D2Funcs.D2WIN_MixRGB(68,112,116); +//D2Vars.D2CLIENT_ColorTbl[5] = D2Funcs.D2WIN_MixRGB(72,160,52); +//D2Vars.D2CLIENT_ColorTbl[6] = D2Funcs.D2WIN_MixRGB(244,244,244); +//D2Vars.D2CLIENT_ColorTbl[7] = D2Funcs.D2WIN_MixRGB(128,128,128); +//D2Vars.D2CLIENT_ColorTbl[8] = D2Funcs.D2WIN_MixRGB(244,244,0); +//D2Vars.D2CLIENT_ColorTbl[9] = D2Funcs.D2WIN_MixRGB(0,0,255); +//D2Vars.D2CLIENT_ColorTbl[10] = D2Funcs.D2WIN_MixRGB(0,255,0); // -//D2Funcs::D2COMMON_SetActCallback(*D2Vars::D2CLIENT_Act,(DWORD*)D2Ptrs::D2CLIENT_ActMapFunc3); +//D2Funcs.D2COMMON_SetActCallback(*D2Vars.D2CLIENT_Act,(DWORD*)D2Ptrs.D2CLIENT_ActMapFunc3); // -//D2Vars::D2CLIENT_ColorTbl2[0] = D2Funcs::D2WIN_MixRGB(128,0,0); -//D2Vars::D2CLIENT_ColorTbl2[1] = D2Funcs::D2WIN_MixRGB(0,128,0); -//D2Vars::D2CLIENT_ColorTbl2[2] = D2Funcs::D2WIN_MixRGB(0,0,128); -//D2Vars::D2CLIENT_ColorTbl2[3] = D2Funcs::D2WIN_MixRGB(128,128,0); -//D2Vars::D2CLIENT_ColorTbl2[4] = D2Funcs::D2WIN_MixRGB(128,64,64); +//D2Vars.D2CLIENT_ColorTbl2[0] = D2Funcs.D2WIN_MixRGB(128,0,0); +//D2Vars.D2CLIENT_ColorTbl2[1] = D2Funcs.D2WIN_MixRGB(0,128,0); +//D2Vars.D2CLIENT_ColorTbl2[2] = D2Funcs.D2WIN_MixRGB(0,0,128); +//D2Vars.D2CLIENT_ColorTbl2[3] = D2Funcs.D2WIN_MixRGB(128,128,0); +//D2Vars.D2CLIENT_ColorTbl2[4] = D2Funcs.D2WIN_MixRGB(128,64,64); // //char path[500] = {0}; // -//sprintf_s(path,500,"%s\\%s", "DATA\\GLOBAL", D2Vars::D2CLIENT_ActPals[pPacket.ActNo]); -//D2Funcs::D2CLIENT_LoadActPal((DWORD)D2Vars::D2CLIENT_ActPal,path); +//sprintf_s(path,500,"%s\\%s", "DATA\\GLOBAL", D2Vars.D2CLIENT_ActPals[pPacket.ActNo]); +//D2Funcs.D2CLIENT_LoadActPal((DWORD)D2Vars.D2CLIENT_ActPal,path); // -//*D2Vars::D2CLIENT_Load_Draw=1; +//*D2Vars.D2CLIENT_Load_Draw=1; // //DWORD tick = GetTickCount() + 20000; // -//if(tick>*D2Vars::D2CLIENT_ActTick) -// *D2Vars::D2CLIENT_ActTick = tick; +//if(tick>*D2Vars.D2CLIENT_ActTick) +// *D2Vars.D2CLIENT_ActTick = tick; // //return 0; //} @@ -266,13 +266,13 @@ Room1* cRoom = 0 ; //BOOL __fastcall ExLoading::OnActLoadEnd(BYTE *aPacket) //{ -//*D2Vars::D2CLIENT_Loading_1=1; -//*D2Vars::D2CLIENT_Loading_2=0; +//*D2Vars.D2CLIENT_Loading_1=1; +//*D2Vars.D2CLIENT_Loading_2=0; // -//ASSERT(D2Funcs::D2CLIENT_GetPlayer()) +//ASSERT(D2Funcs.D2CLIENT_GetPlayer()) // // BYTE Packet[5] = {0x0B,1,0,0,0}; -// D2Funcs::D2NET_SendPacket(5,0,Packet); +// D2Funcs.D2NET_SendPacket(5,0,Packet); // ////Misc::Log("Loading complete (0x04)"); // diff --git a/ExMPQ.cpp b/ExMPQ.cpp index c052c9c..1bc1834 100644 --- a/ExMPQ.cpp +++ b/ExMPQ.cpp @@ -6,11 +6,11 @@ void ExMpq::LoadMPQ() { string MpqPath = D2ExDir + "D2Ex.MPQ"; - MPQHandle = D2Funcs::D2WIN_LoadMpq(5000,"D2Ex2.dll",MpqPath.c_str(),"D2EX",0,0); + MPQHandle = D2ASMFuncs::D2WIN_LoadMpq(5000,"D2Ex2.dll",MpqPath.c_str(),"D2EX",0,0); if(!MPQHandle) { Misc::Log("Failed to load D2Ex.MPQ!"); - D2Funcs::FOG_Error(__FILE__,0,__LINE__); + D2Funcs.FOG_Error(__FILE__,0,__LINE__); ExitProcess(-1); } #ifdef _DEBUG @@ -20,13 +20,12 @@ Misc::Log("Loaded D2Ex.MPQ file..."); void ExMpq::UnloadMPQ() { -#ifdef VER_113D //Skipping this function because archive is already closed when don't use D2Loader. + //Seems the same things appears on 1.11b return; -#endif if (MPQHandle) { - D2Funcs::STORM_CloseArchive((DWORD *)MPQHandle); - D2Funcs::FOG_FreeMemory(MPQHandle, __FILE__, __LINE__, 0); + D2Funcs.STORM_CloseArchive((DWORD *)MPQHandle); + D2Funcs.FOG_FreeMemory(MPQHandle, __FILE__, __LINE__, 0); MPQHandle = 0; } #ifdef _DEBUG diff --git a/ExMapReveal.cpp b/ExMapReveal.cpp index b9fb319..18c7b9b 100644 --- a/ExMapReveal.cpp +++ b/ExMapReveal.cpp @@ -12,18 +12,18 @@ Level* GetLevelPointer(ActMisc *pActMisc, int nLevel) if ((pLevel->dwLevelNo == nLevel) && (pLevel->dwSizeX > 0)) return pLevel; } - return D2Funcs::D2COMMON_GetLevel(pActMisc, nLevel); + return D2Funcs.D2COMMON_GetLevel(pActMisc, nLevel); } AutoMapLayer* InitAutomapLayer(int nLevel) { - AutoMapLayer2* pLayer = D2Funcs::D2COMMON_GetLayer(nLevel); - return D2Funcs::D2CLIENT_InitAutomapLayer(pLayer->nLayerNo); + AutoMapLayer2* pLayer = D2Funcs.D2COMMON_GetLayer(nLevel); + return D2ASMFuncs::D2CLIENT_InitAutomapLayer(pLayer->nLayerNo); } void AddRoomCell(int xPos, int yPos, int nCell, Room2* pRoom) { - AutoMapCell* pCell = D2Funcs::D2CLIENT_NewAutomapCell(); + AutoMapCell* pCell = D2Funcs.D2CLIENT_NewAutomapCell(); xPos += pRoom->dwPosX * 5; yPos += pRoom->dwPosY * 5; @@ -31,7 +31,7 @@ void AddRoomCell(int xPos, int yPos, int nCell, Room2* pRoom) pCell->nCellNo = nCell; pCell->xPixel = (((xPos - yPos) * 16) / 10) + 1; pCell->yPixel = (((xPos + yPos) * 8) / 10) - 3; - D2Funcs::D2CLIENT_AddAutomapCell(pCell, &((*D2Vars::D2CLIENT_AutomapLayer)->pObjects)); + D2Funcs.D2CLIENT_AddAutomapCell(pCell, &((*D2Vars.D2CLIENT_AutomapLayer)->pObjects)); } int GetUnitCellNumber(DWORD dwClassId, DWORD dwLevelNo) @@ -43,7 +43,7 @@ int GetUnitCellNumber(DWORD dwClassId, DWORD dwLevelNo) if(dwClassId == 152) return 300; if(dwClassId == 460) return 1468; - ObjectTxt* pTxt = D2Funcs::D2COMMON_GetObjectTxt(dwClassId); + ObjectTxt* pTxt = D2Funcs.D2COMMON_GetObjectTxt(dwClassId); if(pTxt->nAutoMap == 310) return (pTxt->nSubClass & 1) ? 310 : 0; @@ -52,7 +52,7 @@ int GetUnitCellNumber(DWORD dwClassId, DWORD dwLevelNo) void RevealRoom1(Room2* pRoom) { - D2Funcs::D2CLIENT_RevealAutomapRoom(pRoom->pRoom1, TRUE, (*D2Vars::D2CLIENT_AutomapLayer)); + D2Funcs.D2CLIENT_RevealAutomapRoom(pRoom->pRoom1, TRUE, (*D2Vars.D2CLIENT_AutomapLayer)); for(PresetUnit* pUnit = pRoom->pPreset; pUnit; pUnit = pUnit->pPresetNext) { @@ -79,10 +79,10 @@ void RevealRoom1(Room2* pRoom) void ExMapReveal::RevealLevel(int LvlId) { - Level* pLevel = GetLevelPointer((*D2Vars::D2CLIENT_Act)->pMisc,LvlId); + Level* pLevel = GetLevelPointer((*D2Vars.D2CLIENT_Act)->pMisc,LvlId); InitAutomapLayer(pLevel->dwLevelNo); - UnitAny *pUnit = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny *pUnit = D2Funcs.D2CLIENT_GetPlayer(); for (Room2 *pRoom2 = pLevel->pRoom2First; pRoom2; pRoom2 = pRoom2->pRoom2Next) { @@ -90,7 +90,7 @@ void ExMapReveal::RevealLevel(int LvlId) if (!pRoom2->pRoom1) { - D2Funcs::D2COMMON_AddRoomData(pLevel->pMisc->pAct,pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, pUnit->pPath->pRoom1); + D2Funcs.D2COMMON_AddRoomData(pLevel->pMisc->pAct,pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, pUnit->pPath->pRoom1); nAdded = true; } @@ -100,7 +100,7 @@ void ExMapReveal::RevealLevel(int LvlId) RevealRoom1(pRoom2); if (nAdded) - D2Funcs::D2COMMON_RemoveRoomData(pLevel->pMisc->pAct, pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, pUnit->pPath->pRoom1); + D2Funcs.D2COMMON_RemoveRoomData(pLevel->pMisc->pAct, pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, pUnit->pPath->pRoom1); } } \ No newline at end of file diff --git a/ExMultiRes.cpp b/ExMultiRes.cpp index 0df9ef1..f0e04ce 100644 --- a/ExMultiRes.cpp +++ b/ExMultiRes.cpp @@ -1,6 +1,5 @@ - - #include "stdafx.h" +#ifdef D2EX_MULTIRES #include "ExMultiRes.h" #include "ExCellFile.h" #include "ExBuffs.h" @@ -57,14 +56,14 @@ namespace ExMultiRes DWORD t = GetTickCount(); WaitForSingleObject(hPointersReadyEvent, 10000); DEBUGMSG("Waited %.2f sec!", (float)(GetTickCount() - t) / 1000); - *D2Vars::D2GFX_hInstance = hInstance; + *D2Vars.D2GFX_hInstance = hInstance; //WndClass.cbSize = sizeof(WNDCLASSEX); WndClass.lpfnWndProc = pWndProc; WndClass.style = 0; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; - WndClass.hIcon = (HICON)LoadImage(hInstance, (LPCSTR)(D2Funcs::FOG_isExpansion() ? 103 : 102), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); + WndClass.hIcon = (HICON)LoadImage(hInstance, (LPCSTR)(D2Funcs.FOG_isExpansion() ? 103 : 102), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); WndClass.hCursor = LoadCursor(0, (LPCSTR)0x7F00); WndClass.hbrBackground = (HBRUSH)GetStockObject(COLOR_DESKTOP); WndClass.lpszMenuName = NULL; @@ -78,12 +77,12 @@ namespace ExMultiRes return FALSE; } // TODO:sub_6FA89750(); - *D2Vars::D2GFX_gpbBuffer = 0; + *D2Vars.D2GFX_gpbBuffer = 0; // TODO: atexit(sub_6FA8AB60); - *D2Vars::D2GFX_DriverType = nRenderMode; - *D2Vars::D2GFX_WindowMode = bWindowed; - *D2Vars::D2GFX_hDriverModHandle = LoadLibrary(szDriverDLLs[nRenderMode]); - if (!*D2Vars::D2GFX_hDriverModHandle) + *D2Vars.D2GFX_DriverType = nRenderMode; + *D2Vars.D2GFX_WindowMode = bWindowed; + *D2Vars.D2GFX_hDriverModHandle = LoadLibrary(szDriverDLLs[nRenderMode]); + if (!*D2Vars.D2GFX_hDriverModHandle) { D2EXERROR("Cannot renderer load library: %s", szDriverDLLs[nRenderMode]) } @@ -92,7 +91,7 @@ namespace ExMultiRes ASSERT(GetCallbacks) fnRendererCallbacks * fns = GetCallbacks(); ASSERT(fns) - *D2Vars::D2GFX_pfnDriverCallback = fns; + *D2Vars.D2GFX_pfnDriverCallback = fns; switch (nRenderMode) { @@ -126,9 +125,9 @@ namespace ExMultiRes D2EXERROR("Cannot initialize GFX driver. Please run D2VidTest and try again"); } if (nRenderMode < VIDEO_MODE_GLIDE) - *D2Vars::D2GFX_bPerspective = FALSE; + *D2Vars.D2GFX_bPerspective = FALSE; - return fns->InitPerspective((GFXSettings*)&(*D2Vars::D2GFX_Settings), (GFXHelpers*)&(*D2Vars::D2GFX_fnHelpers)); + return fns->InitPerspective((GFXSettings*)&(*D2Vars.D2GFX_Settings), (GFXHelpers*)&(*D2Vars.D2GFX_fnHelpers)); } bool enterFullscreen() @@ -137,22 +136,22 @@ namespace ExMultiRes bool isChangeSuccessful; EnumDisplaySettings(NULL, 0, &fs); - fs.dmPelsWidth = *D2Vars::D2GFX_Width; - fs.dmPelsHeight = *D2Vars::D2GFX_Height; + fs.dmPelsWidth = *D2Vars.D2GFX_Width; + fs.dmPelsHeight = *D2Vars.D2GFX_Height; fs.dmBitsPerPel = 8; fs.dmSize = sizeof(DEVMODE); fs.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; - SetWindowLongPtr(D2Funcs::D2GFX_GetHwnd(), GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST); - SetWindowLongPtr(D2Funcs::D2GFX_GetHwnd(), GWL_STYLE, WS_POPUP | WS_VISIBLE); - SetWindowPos(D2Funcs::D2GFX_GetHwnd(), HWND_TOPMOST, 0, 0, *D2Vars::D2GFX_Width, *D2Vars::D2GFX_Height, SWP_SHOWWINDOW); + SetWindowLongPtr(D2Funcs.D2GFX_GetHwnd(), GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST); + SetWindowLongPtr(D2Funcs.D2GFX_GetHwnd(), GWL_STYLE, WS_POPUP | WS_VISIBLE); + SetWindowPos(D2Funcs.D2GFX_GetHwnd(), HWND_TOPMOST, 0, 0, *D2Vars.D2GFX_Width, *D2Vars.D2GFX_Height, SWP_SHOWWINDOW); isChangeSuccessful = ChangeDisplaySettings(&fs, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL; - ShowWindow(D2Funcs::D2GFX_GetHwnd(), SW_MAXIMIZE); + ShowWindow(D2Funcs.D2GFX_GetHwnd(), SW_MAXIMIZE); - (*D2Vars::D2LAUNCH_BnData)->bWindowMode = 0; - *D2Vars::D2GFX_WindowMode = 0; + (*D2Vars.D2LAUNCH_BnData)->bWindowMode = 0; + *D2Vars.D2GFX_WindowMode = 0; return isChangeSuccessful; } @@ -193,20 +192,20 @@ namespace ExMultiRes BOOL __stdcall D2GFX_SetResolutionMode(int nMode, BOOL bUpdate) // Wrapper on D2Gfx.10069 { - ASSERT(*D2Vars::D2GFX_pfnDriverCallback) + ASSERT(*D2Vars.D2GFX_pfnDriverCallback) - if (bUpdate || nMode != *D2Vars::D2GFX_GfxMode) + if (bUpdate || nMode != *D2Vars.D2GFX_GfxMode) { - *D2Vars::D2GFX_GfxMode = nMode; - if (*D2Vars::D2GFX_WindowMode == TRUE) + *D2Vars.D2GFX_GfxMode = nMode; + if (*D2Vars.D2GFX_WindowMode == TRUE) { RECT r = { 0 }; D2GFX_GetModeParams(nMode, (int*)&r.right, (int*)&r.bottom); AdjustWindowRectEx(&r, 0xCB0000, 0, 0x40000); - SetWindowPos(D2Funcs::D2GFX_GetHwnd(), (HWND)-2, 0, 0, r.right - r.left, r.bottom - r.top, 0x16); + SetWindowPos(D2Funcs.D2GFX_GetHwnd(), (HWND)-2, 0, 0, r.right - r.left, r.bottom - r.top, 0x16); } D2GFX_SetStoredGammaAndContrast(); - return (*D2Vars::D2GFX_pfnDriverCallback)->ResizeWin(D2Funcs::D2GFX_GetHwnd(), nMode); + return (*D2Vars.D2GFX_pfnDriverCallback)->ResizeWin(D2Funcs.D2GFX_GetHwnd(), nMode); } return TRUE; } @@ -215,30 +214,30 @@ namespace ExMultiRes { int c = Misc::RegReadDword("SOFTWARE\\Blizzard Entertainment\\Diablo II", "Constrast", 100); int g = Misc::RegReadDword("SOFTWARE\\Blizzard Entertainment\\Diablo II", "Gamma", 155); - (*D2Vars::D2GFX_pfnDriverCallback)->SetOption(11, c); - (*D2Vars::D2GFX_pfnDriverCallback)->SetGamma(g); - *D2Vars::D2GFX_GammaValue = g; + (*D2Vars.D2GFX_pfnDriverCallback)->SetOption(11, c); + (*D2Vars.D2GFX_pfnDriverCallback)->SetGamma(g); + *D2Vars.D2GFX_GammaValue = g; } void __fastcall D2CLIENT_SetResolution(int nMode) // Wrapper on D2CLIENT.0x2C220 { DEBUGMSG("Changing window resolution to %d mode", nMode); - if (D2Funcs::D2GFX_GetResolutionMode() == nMode) + if (D2Funcs.D2GFX_GetResolutionMode() == nMode) return; //nMode = 3; - D2GFX_GetModeParams(nMode, D2Vars::D2CLIENT_ScreenWidth, D2Vars::D2CLIENT_ScreenHeight); - *D2Vars::D2CLIENT_ScreenMode = (nMode == 2 ? 1 : nMode); + D2GFX_GetModeParams(nMode, D2Vars.D2CLIENT_ScreenWidth, D2Vars.D2CLIENT_ScreenHeight); + *D2Vars.D2CLIENT_ScreenMode = (nMode == 2 ? 1 : nMode); - *D2Vars::D2CLIENT_ScreenViewWidth = *D2Vars::D2CLIENT_ScreenWidth; - *D2Vars::D2CLIENT_ScreenViewHeight = *D2Vars::D2CLIENT_ScreenHeight - 40; - *D2Vars::D2CLIENT_ScreenWidthUnk = *D2Vars::D2CLIENT_ScreenWidth; + *D2Vars.D2CLIENT_ScreenViewWidth = *D2Vars.D2CLIENT_ScreenWidth; + *D2Vars.D2CLIENT_ScreenViewHeight = *D2Vars.D2CLIENT_ScreenHeight - 40; + *D2Vars.D2CLIENT_ScreenWidthUnk = *D2Vars.D2CLIENT_ScreenWidth; - D2Funcs::D2WIN_ResizeWindow(nMode); - D2CLIENT_ResizeView(*D2Vars::D2CLIENT_UiCover); - D2Funcs::D2CLIENT_UpdateAutoMap(TRUE); - D2Funcs::D2CLIENT_ClearScreen4(); + D2Funcs.D2WIN_ResizeWindow(nMode); + D2CLIENT_ResizeView(*D2Vars.D2CLIENT_UiCover); + D2Funcs.D2CLIENT_UpdateAutoMap(TRUE); + D2Funcs.D2CLIENT_ClearScreen4(); ExBuff::UpdateYPos(); } @@ -248,35 +247,35 @@ namespace ExMultiRes { case COVER_NONE: { - *D2Vars::D2CLIENT_ScreenXShift = 0; - D2Funcs::D2CLIENT_SetView(0, *D2Vars::D2CLIENT_ScreenViewWidth, 0, *D2Vars::D2CLIENT_ScreenViewHeight, *D2Vars::D2CLIENT_GameView); + *D2Vars.D2CLIENT_ScreenXShift = 0; + D2ASMFuncs::D2CLIENT_SetView(0, *D2Vars.D2CLIENT_ScreenViewWidth, 0, *D2Vars.D2CLIENT_ScreenViewHeight, *D2Vars.D2CLIENT_GameView); } break; case COVER_BOTH: { - *D2Vars::D2CLIENT_ScreenXShift = 0; - D2Funcs::D2CLIENT_SetView(0, *D2Vars::D2CLIENT_ScreenViewWidth, 0, *D2Vars::D2CLIENT_ScreenViewHeight, *D2Vars::D2CLIENT_GameView); - *D2Vars::D2CLIENT_UiUnk1 = 0; - *D2Vars::D2CLIENT_UiUnk2 = 0; - *D2Vars::D2CLIENT_UiUnk3 = 0; - *D2Vars::D2CLIENT_UiUnk4 = 0; + *D2Vars.D2CLIENT_ScreenXShift = 0; + D2ASMFuncs::D2CLIENT_SetView(0, *D2Vars.D2CLIENT_ScreenViewWidth, 0, *D2Vars.D2CLIENT_ScreenViewHeight, *D2Vars.D2CLIENT_GameView); + *D2Vars.D2CLIENT_UiUnk1 = 0; + *D2Vars.D2CLIENT_UiUnk2 = 0; + *D2Vars.D2CLIENT_UiUnk3 = 0; + *D2Vars.D2CLIENT_UiUnk4 = 0; } break; case COVER_LEFT: { - *D2Vars::D2CLIENT_ScreenXShift = *D2Vars::D2CLIENT_ScreenWidth / -4; - D2Funcs::D2CLIENT_SetView(*D2Vars::D2CLIENT_ScreenViewWidth / -4, *D2Vars::D2CLIENT_ScreenViewWidth - (*D2Vars::D2CLIENT_ScreenViewWidth / 4), 0, *D2Vars::D2CLIENT_ScreenViewHeight, *D2Vars::D2CLIENT_GameView); + *D2Vars.D2CLIENT_ScreenXShift = *D2Vars.D2CLIENT_ScreenWidth / -4; + D2ASMFuncs::D2CLIENT_SetView(*D2Vars.D2CLIENT_ScreenViewWidth / -4, *D2Vars.D2CLIENT_ScreenViewWidth - (*D2Vars.D2CLIENT_ScreenViewWidth / 4), 0, *D2Vars.D2CLIENT_ScreenViewHeight, *D2Vars.D2CLIENT_GameView); } break; case COVER_RIGHT: { - *D2Vars::D2CLIENT_ScreenXShift = *D2Vars::D2CLIENT_ScreenWidth / 4; - D2Funcs::D2CLIENT_SetView(*D2Vars::D2CLIENT_ScreenViewWidth / 4, *D2Vars::D2CLIENT_ScreenViewWidth + (*D2Vars::D2CLIENT_ScreenViewWidth / 4), 0, *D2Vars::D2CLIENT_ScreenViewHeight, *D2Vars::D2CLIENT_GameView); + *D2Vars.D2CLIENT_ScreenXShift = *D2Vars.D2CLIENT_ScreenWidth / 4; + D2ASMFuncs::D2CLIENT_SetView(*D2Vars.D2CLIENT_ScreenViewWidth / 4, *D2Vars.D2CLIENT_ScreenViewWidth + (*D2Vars.D2CLIENT_ScreenViewWidth / 4), 0, *D2Vars.D2CLIENT_ScreenViewHeight, *D2Vars.D2CLIENT_GameView); } break; } - *D2Vars::D2CLIENT_UiCover = UiCover; - D2Funcs::D2GFX_SetScreenShift(*D2Vars::D2CLIENT_ScreenXShift); + *D2Vars.D2CLIENT_UiCover = UiCover; + D2Funcs.D2GFX_SetScreenShift(*D2Vars.D2CLIENT_ScreenXShift); } @@ -285,10 +284,10 @@ namespace ExMultiRes // static int LastWidth; // DEBUGMSG("FillYBuffer(), %dx%d, %d", nWidth, nHeight, aZero) - // *D2Vars::D2GFX_gpbBuffer = ppvBits; + // *D2Vars.D2GFX_gpbBuffer = ppvBits; // //dword_6FA9432C = aZero; - // *D2Vars::D2GFX_Width = nWidth; - // *D2Vars::D2GFX_Height = nHeight; + // *D2Vars.D2GFX_Width = nWidth; + // *D2Vars.D2GFX_Height = nHeight; // if (nWidth != LastWidth) // { // LastWidth = nWidth; @@ -298,10 +297,10 @@ namespace ExMultiRes // *pEntry = YStartOffset; // } // } - // if (*D2Vars::D2GFX_ScreenShift != -1) + // if (*D2Vars.D2GFX_ScreenShift != -1) // { - // D2Funcs::D2GFX_UpdateResizeVars(nWidth, nHeight); - // gBufferXLookUpTable[nHeight] = *D2Vars::D2GFX_ScreenShift == 2 ? (nWidth / 2) : 0; + // D2ASMFuncs::D2GFX_UpdateResizeVars(nWidth, nHeight); + // gBufferXLookUpTable[nHeight] = *D2Vars.D2GFX_ScreenShift == 2 ? (nWidth / 2) : 0; // } //} @@ -311,9 +310,9 @@ namespace ExMultiRes static int LastWidth, LastHeight; DEBUGMSG("FillYBuffer(), %dx%d, %d", nWidth, nHeight, aZero) - *D2Vars::D2GFX_gpbBuffer = ppvBits; - *D2Vars::D2GFX_Width = nWidth; - *D2Vars::D2GFX_Height = nHeight; + *D2Vars.D2GFX_gpbBuffer = ppvBits; + *D2Vars.D2GFX_Width = nWidth; + *D2Vars.D2GFX_Height = nHeight; if (gptBufferXLookUpTable && (nHeight == 0 || nHeight != LastHeight)) { @@ -356,10 +355,10 @@ namespace ExMultiRes LastHeight = nHeight; LastWidth = nWidth; - if (*D2Vars::D2GFX_ScreenShift != -1 && gptBufferXLookUpTable) + if (*D2Vars.D2GFX_ScreenShift != -1 && gptBufferXLookUpTable) { - D2Funcs::D2GFX_UpdateResizeVars(nWidth, nHeight); - gptBufferXLookUpTable[nHeight + 32] = *D2Vars::D2GFX_ScreenShift == 2 ? (nWidth / 2) : 0; + D2ASMFuncs::D2GFX_UpdateResizeVars(nWidth, nHeight); + gptBufferXLookUpTable[nHeight + 32] = *D2Vars.D2GFX_ScreenShift == 2 ? (nWidth / 2) : 0; } } } @@ -373,32 +372,32 @@ namespace ExMultiRes RGBQUAD bmiColors[256]; }; - ASSERT(!*D2Vars::D2GDI_gpbBuffer) + ASSERT(!*D2Vars.D2GDI_gpbBuffer) - D2GFX_GetModeParams(nMode, D2Vars::D2GDI_BitmapWidth, D2Vars::D2GDI_BitmapHeight); + D2GFX_GetModeParams(nMode, D2Vars.D2GDI_BitmapWidth, D2Vars.D2GDI_BitmapHeight); D2BITMAPINFO bm = { 0 }; bm.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bm.bmiHeader.biWidth = *D2Vars::D2GDI_BitmapWidth; - bm.bmiHeader.biHeight = -(*D2Vars::D2GDI_BitmapHeight); + bm.bmiHeader.biWidth = *D2Vars.D2GDI_BitmapWidth; + bm.bmiHeader.biHeight = -(*D2Vars.D2GDI_BitmapHeight); bm.bmiHeader.biPlanes = 1; bm.bmiHeader.biBitCount = 8; bm.bmiHeader.biCompression = BI_RGB; bm.bmiHeader.biClrUsed = 256; HDC hdc = GetDC(NULL); - DEBUGMSG("Initing %dx%d bitmap buffer...", *D2Vars::D2GDI_BitmapWidth, *D2Vars::D2GDI_BitmapHeight) + DEBUGMSG("Initing %dx%d bitmap buffer...", *D2Vars.D2GDI_BitmapWidth, *D2Vars.D2GDI_BitmapHeight) - *D2Vars::D2GDI_DIB = CreateDIBSection(hdc, (BITMAPINFO*)&bm, DIB_PAL_COLORS, D2Vars::D2GDI_gpbBuffer, NULL, NULL); + *D2Vars.D2GDI_DIB = CreateDIBSection(hdc, (BITMAPINFO*)&bm, DIB_PAL_COLORS, D2Vars.D2GDI_gpbBuffer, NULL, NULL); ReleaseDC(NULL, hdc); - D2GFX_FillYBufferTable(*D2Vars::D2GDI_gpbBuffer, *D2Vars::D2GDI_BitmapWidth, *D2Vars::D2GDI_BitmapHeight, 0); + D2GFX_FillYBufferTable(*D2Vars.D2GDI_gpbBuffer, *D2Vars.D2GDI_BitmapWidth, *D2Vars.D2GDI_BitmapHeight, 0); } BOOL __fastcall GDI_Init(HANDLE hWND, int nMode) // Wrapper on D2GDI.6F877F90, pfnDriverCallback->Init { DEBUGMSG("D2GDI->Init()") - *D2Vars::D2GDI_hWnd = hWND; + *D2Vars.D2GDI_hWnd = hWND; GDI_CreateDIBSection(nMode); struct D2LOGPALETTE @@ -408,7 +407,7 @@ namespace ExMultiRes PALETTEENTRY palPalEntry[256]; }; - memset(D2Vars::D2GDI_PaletteEntries, 0, 1024); + memset(D2Vars.D2GDI_PaletteEntries, 0, 1024); DEBUGMSG("D2LOGPALETTE size = %d", sizeof(D2LOGPALETTE)) D2LOGPALETTE plpal = { 0 }; @@ -416,28 +415,28 @@ namespace ExMultiRes plpal.palNumEntries = 256; - *D2Vars::D2GDI_Palette = CreatePalette((LOGPALETTE*)&plpal); - *D2Vars::D2GDI_hFont = CreateFont(12, 0, 0, 0, FW_LIGHT, NULL, NULL, NULL, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Droid Sans"); - if (!*D2Vars::D2GDI_hFont) // if my cool font isn't present on your PC :| - *D2Vars::D2GDI_hFont = CreateFont(12, 0, 0, 0, FW_LIGHT, NULL, NULL, NULL, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Arial"); - *D2Vars::D2GDI_Unk = 0; + *D2Vars.D2GDI_Palette = CreatePalette((LOGPALETTE*)&plpal); + *D2Vars.D2GDI_hFont = CreateFont(12, 0, 0, 0, FW_LIGHT, NULL, NULL, NULL, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Droid Sans"); + if (!*D2Vars.D2GDI_hFont) // if my cool font isn't present on your PC :| + *D2Vars.D2GDI_hFont = CreateFont(12, 0, 0, 0, FW_LIGHT, NULL, NULL, NULL, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Arial"); + *D2Vars.D2GDI_Unk = 0; - D2GFX_GetModeParams(nMode, D2Vars::D2GDI_WindowWidth, 0); + D2GFX_GetModeParams(nMode, D2Vars.D2GDI_WindowWidth, 0); return TRUE; } BOOL __fastcall GDI_ResizeWindow(HANDLE HWND, int nMode) // Wrapper on D2GDI.6F877E60, pfnDriverCallback->ResizeWin { - DeleteObject(*D2Vars::D2GDI_DIB); - *D2Vars::D2GDI_DIB = 0; - *D2Vars::D2GDI_gpbBuffer = 0; + DeleteObject(*D2Vars.D2GDI_DIB); + *D2Vars.D2GDI_DIB = 0; + *D2Vars.D2GDI_gpbBuffer = 0; D2GFX_FillYBufferTable(0, 0, 0, 0); GDI_CreateDIBSection(nMode); - *D2Vars::D2GDI_Unk = 0; + *D2Vars.D2GDI_Unk = 0; - D2GFX_GetModeParams(nMode, D2Vars::D2GDI_WindowWidth, 0); + D2GFX_GetModeParams(nMode, D2Vars.D2GDI_WindowWidth, 0); return TRUE; } @@ -446,11 +445,11 @@ namespace ExMultiRes BOOL __fastcall GDI_Release() { DEBUGMSG("GDI->Release()") - if (*D2Vars::D2GDI_csPause) + if (*D2Vars.D2GDI_csPause) { - DeleteCriticalSection(*D2Vars::D2GDI_csPause); - D2Funcs::FOG_FreeMemory(*D2Vars::D2GDI_csPause, __FILE__, __LINE__, 0); - *D2Vars::D2GDI_csPause = 0; + DeleteCriticalSection(*D2Vars.D2GDI_csPause); + D2Funcs.FOG_FreeMemory(*D2Vars.D2GDI_csPause, __FILE__, __LINE__, 0); + *D2Vars.D2GDI_csPause = 0; } if (gptBufferXLookUpTable) { @@ -468,23 +467,23 @@ namespace ExMultiRes static FxI32 nTexSize, nTexAspectRatio, nFB, nTMU; static bool bHardwareChecked; - if (*D2Vars::D2GLIDE_bIsWindowOpen) + if (*D2Vars.D2GLIDE_bIsWindowOpen) { D2EXERROR("Failed to initialize GLIDE Renderer (Window is already open!)"); } D2GFX_GetModeParams(nMode, &w, &h); - *D2Vars::D2GLIDE_Width = w; - *D2Vars::D2GLIDE_Height = h; - *D2Vars::D2GLIDE_hWnd = hWND; + *D2Vars.D2GLIDE_Width = w; + *D2Vars.D2GLIDE_Height = h; + *D2Vars.D2GLIDE_hWnd = hWND; DEBUGMSG("Opening Glide window @ %dx%d", w, h); - *D2Vars::D2GLIDE_Context = grSstWinOpen((FxU32)hWND, GR_RESOLUTION_MAX, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 0); - if (!*D2Vars::D2GLIDE_Context) + *D2Vars.D2GLIDE_Context = grSstWinOpen((FxU32)hWND, GR_RESOLUTION_MAX, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 0); + if (!*D2Vars.D2GLIDE_Context) { D2EXERROR("Failed to open GLIDE WINDOW!"); } - *D2Vars::D2GLIDE_bIsWindowOpen = TRUE; + *D2Vars.D2GLIDE_bIsWindowOpen = TRUE; if (!bHardwareChecked) { FxI32 nMemUma; @@ -499,14 +498,14 @@ namespace ExMultiRes if (nTMU > 3) nTMU = 3; - *D2Vars::D2GLIDE_TMUCount = nTMU; + *D2Vars.D2GLIDE_TMUCount = nTMU; grGet(GR_MAX_TEXTURE_SIZE, sizeof(FxI32), &nTexSize); grGet(GR_MAX_TEXTURE_ASPECT_RATIO, sizeof(FxI32), &nTexAspectRatio); grGet(GR_NUM_FB, sizeof(FxI32), &nFB); - grGet(GR_TEXTURE_ALIGN, sizeof(FxI32), D2Vars::D2GLIDE_TextureAlign); + grGet(GR_TEXTURE_ALIGN, sizeof(FxI32), D2Vars.D2GLIDE_TextureAlign); grGet(GR_MEMORY_UMA, sizeof(FxI32),&nMemUma); - if (nMemUma) *D2Vars::D2GLIDE_bUMAAvailable = TRUE; + if (nMemUma) *D2Vars.D2GLIDE_bUMAAvailable = TRUE; bHardwareChecked = true; } @@ -535,7 +534,7 @@ namespace ExMultiRes grTexCombine(1, 1, 0, 1, 0, 0, 0); } grChromakeyValue(255); - if (D2Funcs::D2GLIDE_AllocCache()) + if (D2Funcs.D2GLIDE_AllocCache()) return TRUE; return FALSE; @@ -543,7 +542,7 @@ namespace ExMultiRes BOOL __fastcall GLIDE_ResizeWindow(HANDLE HWND, int nMode) // Wrapper on D2GDI.6F877E60, pfnDriverCallback->ResizeWin { - (*D2Vars::D2GFX_pfnDriverCallback)->Shutdown(); + (*D2Vars.D2GFX_pfnDriverCallback)->Shutdown(); grGlideShutdown(); grGlideInit(); @@ -554,7 +553,7 @@ namespace ExMultiRes grBufferClear(0, 0, 0); - if (D2Vars::D2GFX_Settings->bVSync) + if (D2Vars.D2GFX_Settings->bVSync) grBufferSwap(1); else grBufferSwap(0); @@ -564,13 +563,13 @@ namespace ExMultiRes BOOL __fastcall GLIDE_Init(HANDLE hWND, int nMode) // Wrapper on D2GLIDE.6F85D870, pfnDriverCallback->Init { DEBUGMSG("D2GLIDE->Init()") - if (*D2Vars::D2GLIDE_bIsWindowOpen) + if (*D2Vars.D2GLIDE_bIsWindowOpen) return TRUE; if (!GLIDE_SetRes(hWND, nMode)) return FALSE; grBufferClear(0, 0, 0); - if (D2Vars::D2GFX_Settings->bVSync) + if (D2Vars.D2GFX_Settings->bVSync) grBufferSwap(1); else grBufferSwap(0); @@ -611,7 +610,7 @@ namespace ExMultiRes out->dwNumBoxes = nBeltBoxesTbl[nIndex % 7]; - for (int i = 0; i < out->dwNumBoxes; ++i) + for (int i = 0; (unsigned int) i < out->dwNumBoxes; ++i) { GetBeltPos(nIndex, nMode, &out->hBox[i], i); } @@ -753,3 +752,6 @@ namespace ExMultiRes } } + + +#endif \ No newline at end of file diff --git a/ExOOG.cpp b/ExOOG.cpp index 7e4bc2b..f7b8ca5 100644 --- a/ExOOG.cpp +++ b/ExOOG.cpp @@ -18,16 +18,16 @@ return FALSE; BOOL __stdcall AcceptCB(Control *pControl) { -D2Funcs::D2WIN_Fadeout(pPortPopup, 0); +D2Funcs.D2WIN_Fadeout(pPortPopup, 0); wstring Conf(pPortBox->wText); string sConf; Misc::WideToChar(sConf,Conf); WritePrivateProfileString("D2Ex","ServerPort",sConf.c_str(),ConfigIni.c_str()); Port = atoi(sConf.c_str()); -D2Funcs::D2WIN_DeleteControl((Control**)&pPortPopup); -D2Funcs::D2WIN_DeleteControl((Control**)&pPortText); -D2Funcs::D2WIN_DeleteControl((Control**)&pPortBox); -D2Funcs::D2WIN_DeleteControl((Control**)&pPortOK); +D2Funcs.D2WIN_DeleteControl((Control**)&pPortPopup); +D2Funcs.D2WIN_DeleteControl((Control**)&pPortText); +D2Funcs.D2WIN_DeleteControl((Control**)&pPortBox); +D2Funcs.D2WIN_DeleteControl((Control**)&pPortOK); return TRUE; } @@ -43,18 +43,18 @@ BOOL __stdcall PortAccept(Control* pButton) int ih = CellPopup.GetCF()->cells[0]->height; int iw = CellPopup.GetCF()->cells[0]->width+CellPopup.GetCF()->cells[1]->width; -pPortPopup = D2Funcs::D2WIN_CreateImage((800-iw)/2,(600+ih)/2,iw,ih,CellPopup.GetCF(),NULL,0,NULL); -pPortText = D2Funcs::D2WIN_CreateTextBox((800-iw)/2,(600+ih)/2,iw,ih,10,10, NULL, NULL, 2, &Prefs2, NULL); -pPortBox = D2Funcs::D2WIN_CreateEditBox((800-69)/2, 300, 69, 26, 10,0,CellBox->GetCF(),(BOOL (__stdcall *)(char *))&AcceptCB, NULL , 0, &Prefs); -pPortOK = D2Funcs::D2WIN_CreateButton((800-96)/2,370,96,32, CellButton->GetCF(), &AcceptCB, NULL, 0, 0, 0, 0); +pPortPopup = D2Funcs.D2WIN_CreateImage((800-iw)/2,(600+ih)/2,iw,ih,CellPopup.GetCF(),NULL,0,NULL); +pPortText = D2Funcs.D2WIN_CreateTextBox((800-iw)/2,(600+ih)/2,iw,ih,10,10, NULL, NULL, 2, &Prefs2, NULL); +pPortBox = D2Funcs.D2WIN_CreateEditBox((800-69)/2, 300, 69, 26, 10,0,CellBox->GetCF(),(BOOL (__stdcall *)(char *))&AcceptCB, NULL , 0, &Prefs); +pPortOK = D2Funcs.D2WIN_CreateButton((800-96)/2,370,96,32, CellButton->GetCF(), &AcceptCB, NULL, 0, 0, 0, 0); wcscpy_s(pPortOK->wText,256,L"OK"); -int LocId = D2Funcs::D2LANG_GetLocaleId(); +int LocId = D2Funcs.D2LANG_GetLocaleId(); -D2Funcs::D2WIN_SetTextBoxText(pPortText,LocId == 10 ? L"Zmien port Battle.Net :" : L"Change Battle.Net Port :"); +D2Funcs.D2WIN_SetTextBoxText(pPortText,LocId == 10 ? L"Zmien port Battle.Net :" : L"Change Battle.Net Port :"); pPortBox->dwMaxLength=5; wostringstream wPort; wPort << Port; -D2Funcs::D2WIN_SetEditBoxText(pPortBox,wPort.str().c_str()); +D2Funcs.D2WIN_SetEditBoxText(pPortBox,wPort.str().c_str()); pPortBox->InputHandle = (BOOL (__stdcall *)(Control *,DWORD,char *))PortBoxCheck; #ifdef VER_111B @@ -63,12 +63,12 @@ Misc::Patch(0,GetDllOffset("BNClient.dll",0xD55F),Port,4,"Change default B.net p Misc::Patch(0,GetDllOffset("BNClient.dll",0xD589),Port,4,"Change default B.net port III"); #endif -D2Funcs::D2WIN_Fadeout(pPortPopup, 1); -D2Funcs::D2WIN_SetControlFadeout(pPortText, 1); -D2Funcs::D2WIN_SetControlFadeout(pPortBox, 1); -D2Funcs::D2WIN_SetControlFadeout(pPortOK, 1); +D2Funcs.D2WIN_Fadeout(pPortPopup, 1); +D2Funcs.D2WIN_SetControlFadeout(pPortText, 1); +D2Funcs.D2WIN_SetControlFadeout(pPortBox, 1); +D2Funcs.D2WIN_SetControlFadeout(pPortOK, 1); -D2Funcs::D2WIN_SetEditBoxFocus(pPortBox); +D2Funcs.D2WIN_SetEditBoxFocus(pPortBox); return TRUE; } @@ -76,16 +76,16 @@ return TRUE; void ExOOG::CreateMainMenuEx() { if(!CellButton) CellButton = new ExCellFile(CellFiles::SMALLBUTTON); - Button* pButton = D2Funcs::D2WIN_CreateButton(700,590,96,32, CellButton->GetCF(), &PortAccept, NULL, 0, 0, 0, 0); + Button* pButton = D2Funcs.D2WIN_CreateButton(700,590,96,32, CellButton->GetCF(), &PortAccept, NULL, 0, 0, 0, 0); wcscpy_s(pButton->wText,256,L"PORT"); - D2Vars::D2LAUNCH_ControlArray[*D2Vars::D2LAUNCH_ControlCount] = pButton; - *D2Vars::D2LAUNCH_ControlCount= *D2Vars::D2LAUNCH_ControlCount + 1; + D2Vars.D2LAUNCH_ControlArray[*D2Vars.D2LAUNCH_ControlCount] = pButton; + *D2Vars.D2LAUNCH_ControlCount= *D2Vars.D2LAUNCH_ControlCount + 1; } void ExOOG::LeaveGame() { - *D2Vars::D2CLIENT_InGame=0; - SendMessage(D2Funcs::D2GFX_GetHwnd(),WM_CLOSE,0,0); + *D2Vars.D2CLIENT_InGame=0; + SendMessage(D2Funcs.D2GFX_GetHwnd(),WM_CLOSE,0,0); } DWORD WINAPI ExOOG::Rejoin(void * Argz) @@ -95,23 +95,23 @@ DWORD WINAPI ExOOG::Rejoin(void * Argz) if(Argz) szName = (char*)Argz; wstring GN; - Misc::CharToWide(GN,(*D2Vars::D2LAUNCH_BnData)->szGameName); + Misc::CharToWide(GN,(*D2Vars.D2LAUNCH_BnData)->szGameName); wstring GP; - Misc::CharToWide(GP,(*D2Vars::D2LAUNCH_BnData)->szGamePass); + Misc::CharToWide(GP,(*D2Vars.D2LAUNCH_BnData)->szGamePass); - if(!szName.empty()) strcpy_s((*D2Vars::D2LAUNCH_BnData)->szPlayerName,16,szName.c_str()); + if(!szName.empty()) strcpy_s((*D2Vars.D2LAUNCH_BnData)->szPlayerName,16,szName.c_str()); ExOOG::LeaveGame(); - while(D2Funcs::D2CLIENT_GetPlayer() && !(*D2Vars::D2WIN_FirstControl)) Sleep(50); + while(D2Funcs.D2CLIENT_GetPlayer() && !(*D2Vars.D2WIN_FirstControl)) Sleep(50); Control * p1 = 0; Control * p2 = 0; while(!(p1 = ExOOG::FindControl(6,652,469))) Sleep(50); Sleep(500); p1->OnPress(p1); - EditBox * cGame = *D2Vars::D2MULTI_GameName; - EditBox * cPass = *D2Vars::D2MULTI_GamePass; + EditBox * cGame = *D2Vars.D2MULTI_GameName; + EditBox * cPass = *D2Vars.D2MULTI_GamePass; while(!cGame || !cPass) Sleep(50); @@ -131,7 +131,7 @@ return 0; Control* ExOOG::FindControl(int Type, wchar_t* Text) { if(!Type) return 0; - for(Control* pControl = *D2Vars::D2WIN_FirstControl; pControl; pControl = pControl->pNext) + for(Control* pControl = *D2Vars.D2WIN_FirstControl; pControl; pControl = pControl->pNext) { if(Text && pControl->dwType == 0x06) { @@ -148,14 +148,14 @@ Control* ExOOG::FindControl(int Type, int LocId) { if(!Type) return 0; char* sLoc = {0}; - return ExOOG::FindControl(Type,D2Funcs::D2LANG_GetLocaleText((short)LocId)); + return ExOOG::FindControl(Type,D2Funcs.D2LANG_GetLocaleText((short)LocId)); } Control* ExOOG::FindControl(int Type, int cX, int cY) { if(!Type) return 0; char* sLoc = {0}; - for(Control* pControl = *D2Vars::D2WIN_FirstControl; pControl; pControl = pControl->pNext) + for(Control* pControl = *D2Vars.D2WIN_FirstControl; pControl; pControl = pControl->pNext) { if(pControl->dwPosX==cX && pControl->dwPosY==cY) return pControl; } diff --git a/ExOptions.cpp b/ExOptions.cpp index 6b1aed3..55a87c2 100644 --- a/ExOptions.cpp +++ b/ExOptions.cpp @@ -13,28 +13,28 @@ static DWORD MenuKeyClicked; void ExOptions::ShowHide() { static bool wasAutoMap; - if(D2Vars::D2CLIENT_UIModes[UI_MAINMENU]) { - D2Vars::D2CLIENT_UIModes[UI_MAINMENU] = 0; - sMsg* pMsgs = &D2Vars::D2CLIENT_MenuMsgs[0]; + if(D2Vars.D2CLIENT_UIModes[UI_MAINMENU]) { + D2Vars.D2CLIENT_UIModes[UI_MAINMENU] = 0; + sMsg* pMsgs = &D2Vars.D2CLIENT_MenuMsgs[0]; ExInput::UnregisterMsgs(pMsgs,7); ExInput::DefineBindings(); - *D2Vars::D2CLIENT_UI_Unk2 = 0; - if(wasAutoMap) D2Vars::D2CLIENT_UIModes[UI_AUTOMAP] = 1; + *D2Vars.D2CLIENT_UI_Unk2 = 0; + if(wasAutoMap) D2Vars.D2CLIENT_UIModes[UI_AUTOMAP] = 1; } else { if(ExParty::isOpen()) { ExParty::ShowHide(); return;} - if(!D2Funcs::D2CLIENT_ClearScreen3(0,1)) { - if(D2Vars::D2CLIENT_UIModes[UI_AUTOMAP]) wasAutoMap = true; else wasAutoMap = false; - if(D2Vars::D2CLIENT_UIModes[UI_NPCMENU]) return; - D2Funcs::D2CLIENT_ClearScreen(); - if(D2Funcs::D2CLIENT_GetPlayer()->dwMode == PLAYER_MODE_DEAD || D2Funcs::D2CLIENT_GetPlayer()->dwMode == PLAYER_MODE_DEATH) return; - D2Vars::D2CLIENT_UIModes[UI_MAINMENU] = 1; + if(!D2Funcs.D2CLIENT_ClearScreen3(0,1)) { + if(D2Vars.D2CLIENT_UIModes[UI_AUTOMAP]) wasAutoMap = true; else wasAutoMap = false; + if(D2Vars.D2CLIENT_UIModes[UI_NPCMENU]) return; + D2Funcs.D2CLIENT_ClearScreen(); + if(D2Funcs.D2CLIENT_GetPlayer()->dwMode == PLAYER_MODE_DEAD || D2Funcs.D2CLIENT_GetPlayer()->dwMode == PLAYER_MODE_DEATH) return; + D2Vars.D2CLIENT_UIModes[UI_MAINMENU] = 1; ExInput::UndefineBindings(); - sMsg* pMsgs = &D2Vars::D2CLIENT_MenuMsgs[0]; + sMsg* pMsgs = &D2Vars.D2CLIENT_MenuMsgs[0]; ExInput::RegisterMsgs(pMsgs,7); - *D2Vars::D2CLIENT_UI_Unk2 = 1; - *D2Vars::D2CLIENT_UI_Unk1 = 0; + *D2Vars.D2CLIENT_UI_Unk2 = 1; + *D2Vars.D2CLIENT_UI_Unk1 = 0; ExOptions::MainMenu(0,0); } @@ -43,8 +43,8 @@ static bool wasAutoMap; void ExOptions::OnClick(StormMsg * Msg) { -int nMenu = *D2Vars::D2CLIENT_SelectedMenu; -D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; +int nMenu = *D2Vars.D2CLIENT_SelectedMenu; +D2MenuEntry * Entries = *D2Vars.D2CLIENT_D2MenuEntries; if(Entries[nMenu].EnableCheck) if(!Entries[nMenu].EnableCheck(&Entries[nMenu],nMenu)) return; @@ -56,24 +56,24 @@ D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; Entries[nMenu].dwCurrentSwitch = 0; if(Entries[nMenu].OnPress) Entries[nMenu].OnPress(&Entries[nMenu],Msg); - D2Funcs::D2CLIENT_PlaySound(1); + D2ASMFuncs::D2CLIENT_PlaySound(1); } break; case D2MENU_NORMAL: { if(Entries[nMenu].OnPress) Entries[nMenu].OnPress(&Entries[nMenu],Msg); - D2Funcs::D2CLIENT_PlaySound(2); + D2ASMFuncs::D2CLIENT_PlaySound(2); } break; case D2MENU_KEY: { if(MenuKeyClicked) { - D2Funcs::STORM_UnregisterMsg(D2Funcs::D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); + D2Funcs.STORM_UnregisterMsg(D2Funcs.D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); MenuKeyClicked = 0; } else { - D2Funcs::STORM_RegisterMsg(D2Funcs::D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); + D2Funcs.STORM_RegisterMsg(D2Funcs.D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); MenuKeyClicked = nMenu; } } @@ -84,7 +84,7 @@ D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; void __stdcall ExOptions::m_OnGetKey(StormMsg * Msg) { if(MenuKeyClicked && Msg->wParam != VK_ESCAPE) { - D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; + D2MenuEntry * Entries = *D2Vars.D2CLIENT_D2MenuEntries; // ExInput::UndefineBindings(); *Entries[MenuKeyClicked].Bind = Msg->wParam; // ExInput::DefineBindings(); @@ -92,43 +92,43 @@ void __stdcall ExOptions::m_OnGetKey(StormMsg * Msg) MenuKeyClicked = 0; Msg->_2 = 1; Msg->_3 = 0; - D2Funcs::STORM_ResetMsgQuene(Msg); - D2Funcs::STORM_UnregisterMsg(D2Funcs::D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); + D2Funcs.STORM_ResetMsgQuene(Msg); + D2Funcs.STORM_UnregisterMsg(D2Funcs.D2GFX_GetHwnd(),WM_KEYDOWN,&m_OnGetKey); } void __stdcall ExOptions::m_LBUTTONDOWN(StormMsg * Msg) { WORD mX = LOWORD(Msg->lParam); WORD mY = HIWORD(Msg->lParam); - int nMenu = D2Funcs::D2CLIENT_GetSelectedMenu(mY); + int nMenu = D2ASMFuncs::D2CLIENT_GetSelectedMenu(mY); if ( nMenu != -1 ) - *D2Vars::D2CLIENT_SelectedMenu = nMenu; + *D2Vars.D2CLIENT_SelectedMenu = nMenu; MenuUpdate(mX,mY); isMenuClicked = 1; Msg->_2 = 1; Msg->_3 = 0; - D2Funcs::STORM_ResetMsgQuene(Msg); + D2Funcs.STORM_ResetMsgQuene(Msg); } void __stdcall ExOptions::m_LBUTTONUP(StormMsg * Msg) { WORD mY = HIWORD(Msg->lParam); - if(isMenuClicked && D2Funcs::D2CLIENT_GetSelectedMenu(mY) == *D2Vars::D2CLIENT_SelectedMenu) OnClick(Msg); + if(isMenuClicked && D2ASMFuncs::D2CLIENT_GetSelectedMenu(mY) == *D2Vars.D2CLIENT_SelectedMenu) OnClick(Msg); //CBA to check what exacly those vars are, but they were in the original code... - *D2Vars::D2CLIENT_UI_Unk1 = 0; - *D2Vars::D2CLIENT_UI_Unk2 = 0; - *D2Vars::D2CLIENT_UiUnk1 = 0; - *D2Vars::D2CLIENT_UiUnk2 = 0; - *D2Vars::D2CLIENT_UiUnk3 = 0; - *D2Vars::D2CLIENT_UiUnk4 = 0; - *D2Vars::D2CLIENT_UI_Unk7 = 16; - *D2Vars::D2CLIENT_UI_Unk8 = 16; + *D2Vars.D2CLIENT_UI_Unk1 = 0; + *D2Vars.D2CLIENT_UI_Unk2 = 0; + *D2Vars.D2CLIENT_UiUnk1 = 0; + *D2Vars.D2CLIENT_UiUnk2 = 0; + *D2Vars.D2CLIENT_UiUnk3 = 0; + *D2Vars.D2CLIENT_UiUnk4 = 0; + *D2Vars.D2CLIENT_UI_Unk7 = 16; + *D2Vars.D2CLIENT_UI_Unk8 = 16; isMenuClicked = 0; MenuValueClicked = 0; Msg->_2 = 1; Msg->_3 = 0; - D2Funcs::STORM_ResetMsgQuene(Msg); + D2Funcs.STORM_ResetMsgQuene(Msg); } void __stdcall ExOptions::m_OnEnter(StormMsg * Msg) // 28.12 -> resolved @@ -136,15 +136,15 @@ void __stdcall ExOptions::m_OnEnter(StormMsg * Msg) // 28.12 -> resolved OnClick(Msg); Msg->_2 = 1; Msg->_3 = 0; - D2Funcs::STORM_ResetMsgQuene(Msg); + D2Funcs.STORM_ResetMsgQuene(Msg); } void ExOptions::MenuUpdate(int mX, int mY) { - int nMenu = *D2Vars::D2CLIENT_SelectedMenu; - if(nMenu != D2Funcs::D2CLIENT_GetSelectedMenu(mY) && !MenuValueClicked) return; + int nMenu = *D2Vars.D2CLIENT_SelectedMenu; + if(nMenu != D2ASMFuncs::D2CLIENT_GetSelectedMenu(mY) && !MenuValueClicked) return; - D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; + D2MenuEntry * Entries = *D2Vars.D2CLIENT_D2MenuEntries; int nValue = Entries[nMenu].dwCurrentValue; @@ -156,18 +156,18 @@ void ExOptions::MenuUpdate(int mX, int mY) { int CheckX, CheckX2; if(!Entries[nMenu].ptCellFile && !Entries[nMenu].wItemName[0]) { - CheckX = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 144; - CheckX2 = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 145; + CheckX = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 144; + CheckX2 = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 145; } else if(Entries[nMenu].ptCellFile) { - CheckX = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 59; - CheckX2 = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 60; + CheckX = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 59; + CheckX2 = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 60; } else { - CheckX = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 59; - CheckX2 = (*D2Vars::D2CLIENT_ScreenWidth / 2) - 60; + CheckX = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 59; + CheckX2 = (*D2Vars.D2CLIENT_ScreenWidth / 2) - 60; } if(MenuValueClicked || mX> CheckX && mX < CheckX + 289) { if(mX >= CheckX2 + 12) { @@ -186,35 +186,35 @@ void ExOptions::MenuUpdate(int mX, int mY) if(nValue != Entries[nMenu].dwCurrentValue) { if(Entries[nMenu].OnPress) Entries[nMenu].OnPress(&Entries[nMenu],0); - D2Funcs::D2CLIENT_PlaySound(1); + D2ASMFuncs::D2CLIENT_PlaySound(1); } } void ExOptions::DrawMenuBar(int BarPosX, int BarPosY, D2Menu * Menu, D2MenuEntry *Entry, int nTransLvl) { - D2Funcs::D2GFX_DrawRectangle(BarPosX,BarPosY,BarPosX+144,BarPosY+30,0,(Entry->dwBarType == 0) + 1); - CellFile * cfBar = Entry->dwBarType ? *D2Vars::D2CLIENT_MenuBar2 : *D2Vars::D2CLIENT_MenuBar2; - D2Funcs::D2WIN_DrawCellFile(cfBar,400+230,BarPosY,2,nTransLvl,-1); - D2Funcs::D2WIN_DrawCellFile(*D2Vars::D2CLIENT_MenuBarSlider,400+250,BarPosY,2,nTransLvl,-1); + D2Funcs.D2GFX_DrawRectangle(BarPosX,BarPosY,BarPosX+144,BarPosY+30,0,(Entry->dwBarType == 0) + 1); + CellFile * cfBar = Entry->dwBarType ? *D2Vars.D2CLIENT_MenuBar2 : *D2Vars.D2CLIENT_MenuBar2; + D2Funcs.D2WIN_DrawCellFile(cfBar,400+230,BarPosY,2,nTransLvl,-1); + D2Funcs.D2WIN_DrawCellFile(*D2Vars.D2CLIENT_MenuBarSlider,400+250,BarPosY,2,nTransLvl,-1); } void ExOptions::DrawMenuRecon() { - ASSERT(*D2Vars::D2CLIENT_D2Menu); - ASSERT(*D2Vars::D2CLIENT_D2MenuEntries); + ASSERT(*D2Vars.D2CLIENT_D2Menu); + ASSERT(*D2Vars.D2CLIENT_D2MenuEntries); - D2Menu * Menu = *D2Vars::D2CLIENT_D2Menu; - D2MenuEntry * Entries = *D2Vars::D2CLIENT_D2MenuEntries; + D2Menu * Menu = *D2Vars.D2CLIENT_D2Menu; + D2MenuEntry * Entries = *D2Vars.D2CLIENT_D2MenuEntries; static CellContext Pent = {0}; - Pent.pCellFile = *D2Vars::D2CLIENT_MenuPent; + Pent.pCellFile = *D2Vars.D2CLIENT_MenuPent; Pent.nCellNo = 0; static DWORD LastTick = 0; static DWORD PentFrame = 0; - D2Funcs::D2WIN_SetTextSize(6); + D2Funcs.D2WIN_SetTextSize(6); ExScreen::DrawTextEx(2,10,5,0,5,"D2Ex2/Build %s.%d.%s.%s.%s,", #ifdef D2EX_CLOSED_BNET "PVP.BNET" @@ -229,19 +229,19 @@ void ExOptions::DrawMenuRecon() #endif ); - int MenuStartY = (*D2Vars::D2CLIENT_ScreenHeight - 80) /2 - (Menu->dwEntriesNo * Menu->dwInterline) / 2; + int MenuStartY = (*D2Vars.D2CLIENT_ScreenHeight - 80) /2 - (Menu->dwEntriesNo * Menu->dwInterline) / 2; - if(*D2Vars::D2CLIENT_PrevMouseY != *D2Vars::D2CLIENT_MouseY || *D2Vars::D2CLIENT_PrevMouseX != *D2Vars::D2CLIENT_MouseX) + if(*D2Vars.D2CLIENT_PrevMouseY != *D2Vars.D2CLIENT_MouseY || *D2Vars.D2CLIENT_PrevMouseX != *D2Vars.D2CLIENT_MouseX) { - *D2Vars::D2CLIENT_PrevMouseY = *D2Vars::D2CLIENT_MouseY; - *D2Vars::D2CLIENT_PrevMouseX = *D2Vars::D2CLIENT_MouseX; + *D2Vars.D2CLIENT_PrevMouseY = *D2Vars.D2CLIENT_MouseY; + *D2Vars.D2CLIENT_PrevMouseX = *D2Vars.D2CLIENT_MouseX; if(isMenuClicked) - MenuUpdate(*D2Vars::D2CLIENT_MouseX,*D2Vars::D2CLIENT_MouseY); - // D2Funcs::D2CLIENT_D2MenuChange(*D2Vars::D2CLIENT_MouseY,0,*D2Vars::D2CLIENT_MouseX); + MenuUpdate(*D2Vars.D2CLIENT_MouseX,*D2Vars.D2CLIENT_MouseY); + // D2Funcs.D2CLIENT_D2MenuChange(*D2Vars.D2CLIENT_MouseY,0,*D2Vars.D2CLIENT_MouseX); else { - int SelMenu = D2Funcs::D2CLIENT_GetSelectedMenu(*D2Vars::D2CLIENT_MouseY); - if(SelMenu != -1) *D2Vars::D2CLIENT_SelectedMenu=SelMenu; + int SelMenu = D2ASMFuncs::D2CLIENT_GetSelectedMenu(*D2Vars.D2CLIENT_MouseY); + if(SelMenu != -1) *D2Vars.D2CLIENT_SelectedMenu=SelMenu; } } @@ -249,7 +249,7 @@ void ExOptions::DrawMenuRecon() { Entries[eNo].dwYOffset = 0; int dwTrans = 0; - if( !Entries[eNo].dwExpansion || D2Funcs::FOG_isExpansion()) + if( !Entries[eNo].dwExpansion || D2Funcs.FOG_isExpansion()) { if(!Entries[eNo].EnableCheck || (dwTrans = Entries[eNo].EnableCheck(&Entries[eNo],eNo)) != 0 ) dwTrans = 1; dwTrans = (4* dwTrans) + 1; @@ -262,67 +262,67 @@ void ExOptions::DrawMenuRecon() case D2MENU_STATIC: // Static entry case D2MENU_NORMAL: // Normal entry if(Entries[eNo].ptCellFile) - D2Funcs::D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars::D2CLIENT_ScreenWidth / 2, MenuTextY, 1, dwTrans, -1); + D2Funcs.D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars.D2CLIENT_ScreenWidth / 2, MenuTextY, 1, dwTrans, -1); else if(Entries[eNo].wItemName[0]) { - D2Funcs::D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 3); - int Tw = D2Funcs::D2WIN_GetTextWidth(Entries[eNo].wItemName); - D2Funcs::D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars::D2CLIENT_ScreenWidth - Tw) /2, MenuTextY,Entries[eNo].dwColor,0,dwTrans); + D2Funcs.D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 3); + int Tw = D2Funcs.D2WIN_GetTextWidth(Entries[eNo].wItemName); + D2Funcs.D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars.D2CLIENT_ScreenWidth - Tw) /2, MenuTextY,Entries[eNo].dwColor,0,dwTrans); } break; case D2MENU_SWITCH: // Switch Entry if(Entries[eNo].ptCellFile) - D2Funcs::D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars::D2CLIENT_ScreenWidth / 2 - 230, MenuTextY, 0, dwTrans, -1); + D2Funcs.D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars.D2CLIENT_ScreenWidth / 2 - 230, MenuTextY, 0, dwTrans, -1); else if(Entries[eNo].wItemName[0]) { - D2Funcs::D2WIN_SetTextSize(2); - int Tw = D2Funcs::D2WIN_GetTextWidth(Entries[eNo].wItemName); - D2Funcs::D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars::D2CLIENT_ScreenWidth) /2 - 250, MenuTextY,0,0,dwTrans); + D2Funcs.D2WIN_SetTextSize(2); + int Tw = D2Funcs.D2WIN_GetTextWidth(Entries[eNo].wItemName); + D2Funcs.D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars.D2CLIENT_ScreenWidth) /2 - 250, MenuTextY,0,0,dwTrans); } if(Entries[eNo].ptSwitchCellFile[Entries[eNo].dwCurrentValue]) - D2Funcs::D2WIN_DrawCellFile(Entries[eNo].ptSwitchCellFile[Entries[eNo].dwCurrentValue],*D2Vars::D2CLIENT_ScreenWidth / 2 + 230, MenuTextY, 2, dwTrans, -1); + D2Funcs.D2WIN_DrawCellFile(Entries[eNo].ptSwitchCellFile[Entries[eNo].dwCurrentValue],*D2Vars.D2CLIENT_ScreenWidth / 2 + 230, MenuTextY, 2, dwTrans, -1); else if(Entries[eNo].wItemName[0]) { - D2Funcs::D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 2); - int Tw = D2Funcs::D2WIN_GetTextWidth(Entries[eNo].wSwitchItemName[Entries[eNo].dwCurrentValue]); - D2Funcs::D2WIN_DrawTextEx(Entries[eNo].wSwitchItemName[Entries[eNo].dwCurrentValue],(*D2Vars::D2CLIENT_ScreenWidth - Tw) /2 + 230, MenuTextY,0,0,dwTrans); + D2Funcs.D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 2); + int Tw = D2Funcs.D2WIN_GetTextWidth(Entries[eNo].wSwitchItemName[Entries[eNo].dwCurrentValue]); + D2Funcs.D2WIN_DrawTextEx(Entries[eNo].wSwitchItemName[Entries[eNo].dwCurrentValue],(*D2Vars.D2CLIENT_ScreenWidth - Tw) /2 + 230, MenuTextY,0,0,dwTrans); } break; case D2MENU_BAR: // Bar Entry if(Entries[eNo].ptCellFile) { - D2Funcs::D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars::D2CLIENT_ScreenWidth / 2 - 230, MenuTextY, 0, dwTrans, -1); - D2Funcs::D2CLIENT_D2DrawBar(MenuPosY,0,&Entries[eNo],dwTrans,Entries[eNo].ptCellFile == 0); + D2Funcs.D2WIN_DrawCellFile(Entries[eNo].ptCellFile,*D2Vars.D2CLIENT_ScreenWidth / 2 - 230, MenuTextY, 0, dwTrans, -1); + D2Funcs.D2CLIENT_D2DrawBar(MenuPosY,0,&Entries[eNo],dwTrans,Entries[eNo].ptCellFile == 0); } else if(Entries[eNo].wItemName[0]) { - D2Funcs::D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 7); - int Tw = D2Funcs::D2WIN_GetTextWidth(Entries[eNo].wItemName); - D2Funcs::D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars::D2CLIENT_ScreenWidth - Tw) /2 - 230, MenuTextY,7,0,dwTrans); - D2Funcs::D2CLIENT_D2DrawBar(MenuPosY+ 7,0,&Entries[eNo],dwTrans,0); + D2Funcs.D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 7); + int Tw = D2Funcs.D2WIN_GetTextWidth(Entries[eNo].wItemName); + D2Funcs.D2WIN_DrawTextEx(Entries[eNo].wItemName,(*D2Vars.D2CLIENT_ScreenWidth - Tw) /2 - 230, MenuTextY,7,0,dwTrans); + D2Funcs.D2CLIENT_D2DrawBar(MenuPosY+ 7,0,&Entries[eNo],dwTrans,0); } break; case D2MENU_KEY: // Key Config if(Entries[eNo].wItemName[0]) { - D2Funcs::D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 8); - D2Funcs::D2WIN_DrawTextEx(Entries[eNo].wItemName, 130, MenuTextY,COL_ORANGE,0,dwTrans); + D2Funcs.D2WIN_SetTextSize(Entries[eNo].dwFontType ? Entries[eNo].dwFontType : 8); + D2Funcs.D2WIN_DrawTextEx(Entries[eNo].wItemName, 130, MenuTextY,COL_ORANGE,0,dwTrans); if(Entries[eNo].Bind) { wchar_t* szKey = ExInput::GetNameOfKey((WORD)*Entries[eNo].Bind); - int Tw2 = D2Funcs::D2WIN_GetTextWidth(szKey); - D2Funcs::D2WIN_DrawTextEx(szKey,(*D2Vars::D2CLIENT_ScreenWidth - Tw2) /2 + 230, MenuTextY,MenuKeyClicked == eNo ? COL_RED : COL_WHITE ,0,dwTrans); + int Tw2 = D2Funcs.D2WIN_GetTextWidth(szKey); + D2Funcs.D2WIN_DrawTextEx(szKey,(*D2Vars.D2CLIENT_ScreenWidth - Tw2) /2 + 230, MenuTextY,MenuKeyClicked == eNo ? COL_RED : COL_WHITE ,0,dwTrans); } } break; } } } - if(PentFrame == 0) Pent.nCellNo = 0; //*D2Vars::D2CLIENT_WidestMenu + if(PentFrame == 0) Pent.nCellNo = 0; //*D2Vars.D2CLIENT_WidestMenu else Pent.nCellNo = 8 - PentFrame; - int PentY = Menu->dwMenuOffset + Entries[*D2Vars::D2CLIENT_SelectedMenu].dwYOffset; - D2Funcs::D2GFX_DrawCellContext(&Pent,(int)(*D2Vars::D2CLIENT_ScreenWidth * 0.9), PentY, -1 , 5 , 0); + int PentY = Menu->dwMenuOffset + Entries[*D2Vars.D2CLIENT_SelectedMenu].dwYOffset; + D2Funcs.D2GFX_DrawCellContext(&Pent,(int)(*D2Vars.D2CLIENT_ScreenWidth * 0.9), PentY, -1 , 5 , 0); Pent.nCellNo = PentFrame; - D2Funcs::D2GFX_DrawCellContext(&Pent,(int)(*D2Vars::D2CLIENT_ScreenWidth * 0.02), PentY, -1 , 5 , 0); + D2Funcs.D2GFX_DrawCellContext(&Pent,(int)(*D2Vars.D2CLIENT_ScreenWidth * 0.02), PentY, -1 , 5 , 0); int Tick = GetTickCount(); if(Tick - LastTick > 50) @@ -335,10 +335,10 @@ void ExOptions::DrawMenuRecon() BOOL __fastcall ExOptions::GiveUpCheck(D2MenuEntry* ptEntry, DWORD ItemNo) { - Room1* aRoom =D2Funcs::D2COMMON_GetUnitRoom(D2Funcs::D2CLIENT_GetPlayer()); - int aLvl = D2Funcs::D2COMMON_GetLevelNoByRoom(aRoom); - int aAct = D2Funcs::D2COMMON_GetActNoByLevelNo(aLvl); - if(aLvl!=D2Funcs::D2COMMON_GetTownLevel(aAct)) + Room1* aRoom =D2Funcs.D2COMMON_GetUnitRoom(D2Funcs.D2CLIENT_GetPlayer()); + int aLvl = D2Funcs.D2COMMON_GetLevelNoByRoom(aRoom); + int aAct = D2Funcs.D2COMMON_GetActNoByLevelNo(aLvl); + if(aLvl!=D2Funcs.D2COMMON_GetTownLevel(aAct)) return true; return false; } @@ -351,18 +351,18 @@ BOOL __fastcall ExOptions::GiveUpCB(D2MenuEntry* ptEntry, StormMsg* pMsg) aPacket[0] = 0x15; *(WORD*)&aPacket[1] = 1; memcpy(aPacket + 3, szBuffer, strlen(szBuffer)); - D2Funcs::D2NET_SendPacket(strlen(szBuffer) + 6,1,aPacket); + D2Funcs.D2NET_SendPacket(strlen(szBuffer) + 6,1,aPacket); delete[] aPacket; -D2Funcs::D2CLIENT_ClearScreen(); +D2Funcs.D2CLIENT_ClearScreen(); return true; } BOOL __fastcall ExOptions::ChangeHandle(D2MenuEntry* ptEntry, StormMsg* pMsg) { wstring tmp = L"You set "+ boost::lexical_cast(ptEntry->dwCurrentValue); -D2Funcs::D2CLIENT_PrintPartyString(tmp.c_str(),COL_WHITE); +D2Funcs.D2CLIENT_PrintPartyString(tmp.c_str(),COL_WHITE); wcscpy_s((wchar_t*)ptEntry->szCellFile,130,boost::lexical_cast(ptEntry->dwCurrentValue).c_str()); -switch(*D2Vars::D2CLIENT_SelectedMenu) +switch(*D2Vars.D2CLIENT_SelectedMenu) { case 0: BOLvl=ptEntry->dwCurrentValue; @@ -424,7 +424,7 @@ int SkillId = 1; SkillId=0x11; break; } - if(!*D2Vars::D2CLIENT_isMenuClick && *D2Vars::D2CLIENT_SelectedMenu==ItemNo) { + if(!*D2Vars.D2CLIENT_isMenuClick && *D2Vars.D2CLIENT_SelectedMenu==ItemNo) { wcscpy_s((wchar_t*)ptEntry->szCellFile,130,ExBuffs::GetSkillName(SkillId)); } @@ -444,7 +444,7 @@ BOOL __fastcall ExOptions::Buffs(D2MenuEntry* ptEntry, StormMsg *pMsg) NewMenu.dwMenuOffset=51; NewMenu.dwBarHeight=36; } - int LocId = D2Funcs::D2LANG_GetLocaleId(); + int LocId = D2Funcs.D2LANG_GetLocaleId(); wcscpy_s((wchar_t*)&NewEntries[0].szCellFile,130,ExBuffs::GetSkillName(0x95)); @@ -457,7 +457,7 @@ BOOL __fastcall ExOptions::Buffs(D2MenuEntry* ptEntry, StormMsg *pMsg) wcscpy_s((wchar_t*)&NewEntries[7].szCellFile,130, LocId == 10 ? L"W�ACZ EFEKTY" : L"ENABLE BUFF DISPLAY"); wcscpy_s((wchar_t*)&NewEntries[7].szSwitchCellFiles[0], 130, LocId == 10 ? L"WY�." : L"OFF"); wcscpy_s((wchar_t*)&NewEntries[7].szSwitchCellFiles[1], 130, LocId == 10 ? L"W�." : L"ON"); - wcscpy_s((wchar_t*)&NewEntries[8].szCellFile,130,D2Funcs::D2LANG_GetLocaleText(3409)); + wcscpy_s((wchar_t*)&NewEntries[8].szCellFile,130,D2Funcs.D2LANG_GetLocaleText(3409)); NewEntries[8].OnPress = &ExOptions::Options; NewEntries[7].OnPress = &ExOptions::BuffsOpt; @@ -486,9 +486,9 @@ BOOL __fastcall ExOptions::Buffs(D2MenuEntry* ptEntry, StormMsg *pMsg) - *D2Vars::D2CLIENT_SelectedMenu=0; - *D2Vars::D2CLIENT_D2Menu=&NewMenu; - *D2Vars::D2CLIENT_D2MenuEntries=&NewEntries[0]; + *D2Vars.D2CLIENT_SelectedMenu=0; + *D2Vars.D2CLIENT_D2Menu=&NewMenu; + *D2Vars.D2CLIENT_D2MenuEntries=&NewEntries[0]; return true; } @@ -585,7 +585,7 @@ return false; BOOL __fastcall ExOptions::EntECheck(D2MenuEntry* ptEntry, DWORD ItemNo) { - if(!*D2Vars::D2CLIENT_isMenuClick && *D2Vars::D2CLIENT_SelectedMenu==ItemNo) + if(!*D2Vars.D2CLIENT_isMenuClick && *D2Vars.D2CLIENT_SelectedMenu==ItemNo) ptEntry->dwBarType=0; return true; @@ -645,7 +645,7 @@ NewEntries[9].OnPress=&ExOptions::LagOpt; NewEntries[10].OnPress=&ExOptions::Options; -int LocId = D2Funcs::D2LANG_GetLocaleId(); +int LocId = D2Funcs.D2LANG_GetLocaleId(); wcscpy_s((wchar_t*)&NewEntries[0].szCellFile,130,LocId == 10 ? L"WSKA�NIK AUTOMAPY": L"AUTOMAP BLOB"); wcscpy_s((wchar_t*)&NewEntries[0].szSwitchCellFiles[0],130,LocId == 10 ? L"KROPKA" : L"DOT"); @@ -683,9 +683,9 @@ wcscpy_s((wchar_t*)&NewEntries[10].szCellFile,130,LocId == 10 ? L"POPRZEDNIE MEN } -*D2Vars::D2CLIENT_SelectedMenu=0; -*D2Vars::D2CLIENT_D2Menu=&NewMenu; -*D2Vars::D2CLIENT_D2MenuEntries=&NewEntries[0]; +*D2Vars.D2CLIENT_SelectedMenu=0; +*D2Vars.D2CLIENT_D2Menu=&NewMenu; +*D2Vars.D2CLIENT_D2MenuEntries=&NewEntries[0]; return TRUE; } @@ -693,7 +693,7 @@ return TRUE; // Import from Scrap BOOL __fastcall ExOptions::KeyConfig(D2MenuEntry* ptEntry, StormMsg* pMsg) { - static int LocId = D2Funcs::D2LANG_GetLocaleId(); + static int LocId = D2Funcs.D2LANG_GetLocaleId(); static D2Menu NewMenu = {6, 18, 20, 37, 0, 0}; static D2MenuEntry NewEntries[6] = {0}; @@ -715,9 +715,9 @@ BOOL __fastcall ExOptions::KeyConfig(D2MenuEntry* ptEntry, StormMsg* pMsg) } - *D2Vars::D2CLIENT_SelectedMenu=0; - *D2Vars::D2CLIENT_D2Menu=&NewMenu; - *D2Vars::D2CLIENT_D2MenuEntries=&NewEntries[0]; + *D2Vars.D2CLIENT_SelectedMenu=0; + *D2Vars.D2CLIENT_D2Menu=&NewMenu; + *D2Vars.D2CLIENT_D2MenuEntries=&NewEntries[0]; return true; } @@ -738,15 +738,15 @@ NewMenu.dwInterline=48; NewMenu.dwTextHeight=45; NewMenu.dwMenuOffset=51; -D2Vars::D2CLIENT_SndOptionsMenu[7].OnPress=&ExOptions::Options; -D2Vars::D2CLIENT_VidOptionsMenu[7].OnPress=&ExOptions::Options; -D2Vars::D2CLIENT_MapOptionsMenu[6].OnPress=&ExOptions::Options; +D2Vars.D2CLIENT_SndOptionsMenu[7].OnPress=&ExOptions::Options; +D2Vars.D2CLIENT_VidOptionsMenu[7].OnPress=&ExOptions::Options; +D2Vars.D2CLIENT_MapOptionsMenu[6].OnPress=&ExOptions::Options; -int LocId = D2Funcs::D2LANG_GetLocaleId(); +int LocId = D2Funcs.D2LANG_GetLocaleId(); -memcpy(NewEntries,(const void*)*&D2Vars::D2CLIENT_OptionsMenu,sizeof(D2MenuEntry)*4); -memcpy(&NewEntries[6],(const void*)&D2Vars::D2CLIENT_OptionsMenu[4],sizeof(D2MenuEntry)); +memcpy(NewEntries,(const void*)*&D2Vars.D2CLIENT_OptionsMenu,sizeof(D2MenuEntry)*4); +memcpy(&NewEntries[6],(const void*)&D2Vars.D2CLIENT_OptionsMenu[4],sizeof(D2MenuEntry)); wcscpy_s((wchar_t*)&NewEntries[0].szCellFile,130,LocId == 10 ? L"OPCJE D�WI�KOWE" : L"SOUND OPTIONS"); wcscpy_s((wchar_t*)&NewEntries[1].szCellFile,130,LocId == 10 ? L"OPCJE GRAFICZNE" : L"VIDEO OPTIONS"); @@ -765,9 +765,9 @@ NewEntries[5].dwCurrentValue = COL_ORANGE; NewEntries[5].OnPress = &ExOptions::Buffs; } -*D2Vars::D2CLIENT_SelectedMenu=0; -*D2Vars::D2CLIENT_D2Menu=&NewMenu; -*D2Vars::D2CLIENT_D2MenuEntries=&NewEntries[0]; +*D2Vars.D2CLIENT_SelectedMenu=0; +*D2Vars.D2CLIENT_D2Menu=&NewMenu; +*D2Vars.D2CLIENT_D2MenuEntries=&NewEntries[0]; return TRUE; } @@ -791,18 +791,18 @@ NewMenu.dwTextHeight=45; NewMenu.dwMenuOffset=51; -memcpy(NewEntries,(const void*)*&D2Vars::D2CLIENT_OldMenu,sizeof(D2MenuEntry)); +memcpy(NewEntries,(const void*)*&D2Vars.D2CLIENT_OldMenu,sizeof(D2MenuEntry)); #ifndef D2EX_CLOSED_BNET -memcpy(&NewEntries[2],(const void*)&D2Vars::D2CLIENT_OldMenu[1],sizeof(D2MenuEntry)*2); +memcpy(&NewEntries[2],(const void*)&D2Vars.D2CLIENT_OldMenu[1],sizeof(D2MenuEntry)*2); NewEntries[1].OnPress = &ExOptions::GiveUpCB; NewEntries[1].EnableCheck = &ExOptions::GiveUpCheck; #else -memcpy(&NewEntries[1],(const void*)&D2Vars::D2CLIENT_OldMenu[1],sizeof(D2MenuEntry)*2); +memcpy(&NewEntries[1],(const void*)&D2Vars.D2CLIENT_OldMenu[1],sizeof(D2MenuEntry)*2); #endif NewEntries[0].OnPress=&ExOptions::Options; NewEntries[0].ptCellFile=NewEntries[2].ptCellFile=NewEntries[3].ptCellFile=0; -int LocId = D2Funcs::D2LANG_GetLocaleId(); +int LocId = D2Funcs.D2LANG_GetLocaleId(); int i = 0; wcscpy_s((wchar_t*)&NewEntries[i].szCellFile,130,LocId == 10 ? L"OPCJE" : L"OPTIONS"); #ifndef D2EX_CLOSED_BNET @@ -812,9 +812,9 @@ wcscpy_s((wchar_t*)&NewEntries[i].szCellFile,130,LocId == 10 ? L"OPCJE" : L"OPTI wcscpy_s((wchar_t*)&NewEntries[++i].szCellFile,130,LocId == 10 ? L"POWR�T DO GRY" : L"RETURN TO GAME"); } -*D2Vars::D2CLIENT_SelectedMenu=1; -*D2Vars::D2CLIENT_D2Menu=&NewMenu; -*D2Vars::D2CLIENT_D2MenuEntries=&NewEntries[0]; +*D2Vars.D2CLIENT_SelectedMenu=1; +*D2Vars.D2CLIENT_D2Menu=&NewMenu; +*D2Vars.D2CLIENT_D2MenuEntries=&NewEntries[0]; return true; } diff --git a/ExParty.cpp b/ExParty.cpp index aa84fe2..4c733bd 100644 --- a/ExParty.cpp +++ b/ExParty.cpp @@ -59,21 +59,21 @@ static ExScrollBar * Scroll; void ExParty::ClearScreenHandle() { if(ExParty::isOpen()) { ExParty::ShowHide(); return;} -D2Funcs::D2CLIENT_ClearScreen2(); +D2Funcs.D2CLIENT_ClearScreen2(); } void ExParty::ClearScreen() { -if(D2Vars::D2CLIENT_UIModes[UI_CHARACTER] || - D2Vars::D2CLIENT_UIModes[UI_INVENTORY] || - D2Vars::D2CLIENT_UIModes[UI_MAINMENU] || - D2Vars::D2CLIENT_UIModes[UI_CUBE] || - D2Vars::D2CLIENT_UIModes[UI_QUEST] || - D2Vars::D2CLIENT_UIModes[UI_HELP] || - D2Vars::D2CLIENT_UIModes[UI_WPMENU] || - D2Vars::D2CLIENT_UIModes[UI_MSGS] || - D2Vars::D2CLIENT_UIModes[UI_MERC]) -D2Funcs::D2CLIENT_ClearScreen2(); +if(D2Vars.D2CLIENT_UIModes[UI_CHARACTER] || + D2Vars.D2CLIENT_UIModes[UI_INVENTORY] || + D2Vars.D2CLIENT_UIModes[UI_MAINMENU] || + D2Vars.D2CLIENT_UIModes[UI_CUBE] || + D2Vars.D2CLIENT_UIModes[UI_QUEST] || + D2Vars.D2CLIENT_UIModes[UI_HELP] || + D2Vars.D2CLIENT_UIModes[UI_WPMENU] || + D2Vars.D2CLIENT_UIModes[UI_MSGS] || + D2Vars.D2CLIENT_UIModes[UI_MERC]) +D2Funcs.D2CLIENT_ClearScreen2(); } void ExParty::OnScroll(ExControl* ptControl) @@ -95,7 +95,7 @@ void ExParty::Squelch(ExControl* ptControl) RosterUnit * ptRoster = ExParty::GetRosterById(PlayerId); if(!ptRoster){ ExParty::Update(); return;} - for(RosterInfo* pInfo = *(*D2Vars::D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) + for(RosterInfo* pInfo = *(*D2Vars.D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) { if(PlayerId==pInfo->dwUnitId) {Flaga = pInfo->dwPartyFlags; break;} } @@ -106,7 +106,7 @@ void ExParty::Squelch(ExControl* ptControl) aPacket[1] = 0x03; aPacket[2] = 0x00; //Disallow Sq *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } else { @@ -115,10 +115,10 @@ void ExParty::Squelch(ExControl* ptControl) aPacket[1] = 0x03; aPacket[2] = 0x01; //Allow Sq *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } - *D2Vars::D2CLIENT_SentBytes+=7; - *D2Vars::D2CLIENT_SentPackets++; + *D2Vars.D2CLIENT_SentBytes+=7; + *D2Vars.D2CLIENT_SentPackets++; } void ExParty::Loot(ExControl* ptControl) @@ -135,7 +135,7 @@ void ExParty::Loot(ExControl* ptControl) RosterUnit * ptRoster = ExParty::GetRosterById(PlayerId); if(!ptRoster){ ExParty::Update(); return;} - for(RosterInfo* pInfo = *(*D2Vars::D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) + for(RosterInfo* pInfo = *(*D2Vars.D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) { if(PlayerId==pInfo->dwUnitId) {Flaga = pInfo->dwPartyFlags; break;} } @@ -147,7 +147,7 @@ void ExParty::Loot(ExControl* ptControl) aPacket[1] = 0x01; aPacket[2] = 0x00; //Disallow Loot *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } else { @@ -156,15 +156,15 @@ void ExParty::Loot(ExControl* ptControl) aPacket[1] = 0x01; aPacket[2] = 0x01; //Allow Loot *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } - *D2Vars::D2CLIENT_SentBytes+=7; - *D2Vars::D2CLIENT_SentPackets++; + *D2Vars.D2CLIENT_SentBytes+=7; + *D2Vars.D2CLIENT_SentPackets++; } void ExParty::Host(ExControl* ptControl) { - static wstring wStrTown = D2Funcs::D2LANG_GetLocaleText(4121); + static wstring wStrTown = D2Funcs.D2LANG_GetLocaleText(4121); list::iterator Player = PlayerList.end(); DWORD PlayerId = 0; @@ -186,7 +186,7 @@ void ExParty::Host(ExControl* ptControl) aPacket[1] = 0x04; aPacket[2] = 0x01; *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } else { @@ -195,12 +195,12 @@ void ExParty::Host(ExControl* ptControl) aPacket[1] = 0x04; aPacket[2] = 0x00; *(DWORD*)&aPacket[3] = PlayerId; - D2Funcs::D2NET_SendPacket(7, 1, aPacket); + D2Funcs.D2NET_SendPacket(7, 1, aPacket); } - *D2Vars::D2CLIENT_SentBytes+=7; - *D2Vars::D2CLIENT_SentPackets++; + *D2Vars.D2CLIENT_SentBytes+=7; + *D2Vars.D2CLIENT_SentPackets++; } - else D2Funcs::D2CLIENT_PrintPartyString(wStrTown.c_str(),1); + else D2Funcs.D2CLIENT_PrintPartyString(wStrTown.c_str(),1); } @@ -223,7 +223,7 @@ void ExParty::Invite(ExControl* ptControl) aPacket[0] = 0x5E; aPacket[1] = 0x06; *(DWORD*)&aPacket[2] = PlayerId; - D2Funcs::D2NET_SendPacket(6, 1, aPacket); + D2Funcs.D2NET_SendPacket(6, 1, aPacket); } else if(Flaga & PVP_INVITED_BY_YOU) { @@ -231,7 +231,7 @@ void ExParty::Invite(ExControl* ptControl) aPacket[0] = 0x5E; aPacket[1] = 0x07; *(DWORD*)&aPacket[2] = PlayerId; - D2Funcs::D2NET_SendPacket(6, 1, aPacket); + D2Funcs.D2NET_SendPacket(6, 1, aPacket); } else if(Flaga & PVP_INVITED_YOU) { @@ -239,10 +239,10 @@ void ExParty::Invite(ExControl* ptControl) aPacket[0] = 0x5E; aPacket[1] = 0x08; *(DWORD*)&aPacket[2] = PlayerId; - D2Funcs::D2NET_SendPacket(6, 1, aPacket); + D2Funcs.D2NET_SendPacket(6, 1, aPacket); } - *D2Vars::D2CLIENT_SentBytes+=6; - *D2Vars::D2CLIENT_SentPackets++; + *D2Vars.D2CLIENT_SentBytes+=6; + *D2Vars.D2CLIENT_SentPackets++; } int ExParty::GetPlayerArea(UnitAny* ptUnit) @@ -260,14 +260,14 @@ int ExParty::GetPlayerArea(UnitAny* ptUnit) bool ExParty::isTownLvl(UnitAny* ptUnit) { if(!ptUnit) return false; - if(ExParty::GetPlayerArea(ptUnit) == D2Funcs::D2COMMON_GetTownLevel(ptUnit->dwAct)) return true; + if(ExParty::GetPlayerArea(ptUnit) == D2Funcs.D2COMMON_GetTownLevel(ptUnit->dwAct)) return true; return false; } void ExParty::SharePing(ExControl * tt) { - int LocId = D2Funcs::D2LANG_GetLocaleId(); - ExInput::Say(LocId == 10 ? "Moj ping : %d ms / %d fps" : "My ping : %d ms / %d fps",*D2Vars::D2CLIENT_Ping,*D2Vars::D2CLIENT_FPS); + int LocId = D2Funcs.D2LANG_GetLocaleId(); + ExInput::Say(LocId == 10 ? "Moj ping : %d ms / %d fps" : "My ping : %d ms / %d fps",*D2Vars.D2CLIENT_Ping,*D2Vars.D2CLIENT_FPS); } void ExParty::Leave(ExControl * tt) @@ -275,18 +275,18 @@ void ExParty::Leave(ExControl * tt) BYTE aPacket[6]; aPacket[0] = 0x5E; aPacket[1] = 0x09; - *(DWORD*)&aPacket[2] = D2Funcs::D2CLIENT_GetPlayer()->dwUnitId; - D2Funcs::D2NET_SendPacket(6,1,aPacket); - *D2Vars::D2CLIENT_SentBytes+=6; - *D2Vars::D2CLIENT_SentPackets++; - (*D2Vars::D2CLIENT_Roster)->wPartyId=-1; + *(DWORD*)&aPacket[2] = D2Funcs.D2CLIENT_GetPlayer()->dwUnitId; + D2Funcs.D2NET_SendPacket(6,1,aPacket); + *D2Vars.D2CLIENT_SentBytes+=6; + *D2Vars.D2CLIENT_SentPackets++; + (*D2Vars.D2CLIENT_Roster)->wPartyId=-1; ExParty::Refresh(); } RosterUnit * ExParty::GetRosterById(DWORD dwUnitId) { - for(RosterUnit* pRoster = *D2Vars::D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) + for(RosterUnit* pRoster = *D2Vars.D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) { if(pRoster->dwUnitId==dwUnitId) return pRoster; } @@ -295,7 +295,7 @@ return 0; RosterUnit * ExParty::GetRosterByName(const char* szName) { -for(RosterUnit* pRoster = *D2Vars::D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) +for(RosterUnit* pRoster = *D2Vars.D2CLIENT_Roster; pRoster; pRoster = pRoster->pNext) { if(!strcmp(pRoster->szName,szName)) return pRoster; } @@ -314,7 +314,7 @@ list::iterator ExParty::GetPartyListEntry(DWORD UnitID) BOOL __fastcall ExParty::OnPartyUpdate(BYTE *aPacket) //0x8C Relationship update { - D2Ptrs::D2CLIENT_PartyUpdate_I(aPacket); + D2Funcs.D2CLIENT_PartyUpdate_I(aPacket); if(!isOpen()) return 0; ExParty::Resort(); @@ -324,7 +324,7 @@ BOOL __fastcall ExParty::OnPartyUpdate(BYTE *aPacket) //0x8C Relationship update BOOL __fastcall ExParty::OnPartyUpdate2(BYTE *aPacket) //0x8b Player Relationship (Wants to party etc) { - D2Ptrs::D2CLIENT_PartyUpdate_II(aPacket); + D2Funcs.D2CLIENT_PartyUpdate_II(aPacket); if(!isOpen()) return 0; ExParty::Update(); return 0; @@ -332,7 +332,7 @@ BOOL __fastcall ExParty::OnPartyUpdate2(BYTE *aPacket) //0x8b Player Relationshi BOOL __fastcall ExParty::OnPartyUpdate3(BYTE *aPacket) //0x8D Assign To Party { - D2Ptrs::D2CLIENT_PartyUpdate_IV(aPacket); + D2Funcs.D2CLIENT_PartyUpdate_IV(aPacket); if(!isOpen()) return 0; ExParty::Resort(); @@ -345,7 +345,7 @@ BOOL __fastcall ExParty::OnPartyUpdate3(BYTE *aPacket) //0x8D Assign To Party //DWORD UnitId = *(DWORD*)(aPacket + 1); //WORD aCount = *(WORD*)(aPacket + 5); //RosterUnit * ptRoster = ExParty::GetRosterById(UnitId); -//if(!ptRoster) {D2Funcs::D2CLIENT_PrintGameString(L"Strange Error : Didn't find an unit!",2); return 0; } +//if(!ptRoster) {D2Funcs.D2CLIENT_PrintGameString(L"Strange Error : Didn't find an unit!",2); return 0; } //string szName = ptRoster->szName; // //for(list::iterator i = AccBase.begin() ; i != AccBase.end() ; i++) @@ -385,7 +385,7 @@ return 0; wstring GetLvlNameEx(int LvlNo, int strlen) { if(LvlNo == 0) return L"N/A"; -wstring wTxt = D2Funcs::D2CLIENT_GetLevelName(LvlNo); +wstring wTxt = D2ASMFuncs::D2CLIENT_GetLevelName(LvlNo); int alen =0; do { alen = ExScreen::GetTextWidth(wTxt.c_str()); @@ -410,7 +410,7 @@ return wTxt; // WORD Location; //}; // -//D2Ptrs::D2CLIENT_PartyUpdate_III(aPacket); +//D2Ptrs.D2CLIENT_PartyUpdate_III(aPacket); // //if(!isOpen()) return 0; // @@ -479,9 +479,9 @@ AccBase.unique(&AccUnique); void ExParty::RequestAccount(string szName) { -if(!*D2Vars::BNCLIENT_BnSocket) return; -if(D2Funcs::D2CLIENT_GetPlayer()) - if(szName == D2Funcs::D2CLIENT_GetPlayer()->pPlayerData->szName) return; +if(!*D2Vars.BNCLIENT_BnSocket) return; +if(D2Funcs.D2CLIENT_GetPlayer()) + if(szName == D2Funcs.D2CLIENT_GetPlayer()->pPlayerData->szName) return; string sReq = "/whois " + szName; #ifdef D2EX_CLOSED_BNET @@ -490,7 +490,7 @@ if(BNQuene.size()<8) BNQuene.push_back(sReq); LeaveCriticalSection(&EX_CRITSECT); #else Request++; -D2Funcs::BNCLIENT_SendBNMessage(sReq.c_str()); +D2Funcs.BNCLIENT_SendBNMessage(sReq.c_str()); #endif } @@ -570,9 +570,9 @@ void ExParty::Clear() UnitAny* ExParty::GetUnitByName(const char* szName) { - for(RosterUnit* pUnit = *D2Vars::D2CLIENT_Roster;pUnit;pUnit = pUnit->pNext) + for(RosterUnit* pUnit = *D2Vars.D2CLIENT_Roster;pUnit;pUnit = pUnit->pNext) { - if(strcmp(pUnit->szName,szName)==0) return D2Funcs::D2CLIENT_GetUnitById(pUnit->dwUnitId,0); + if(strcmp(pUnit->szName,szName)==0) return D2Funcs.D2CLIENT_GetUnitById(pUnit->dwUnitId,0); } return 0; } @@ -589,7 +589,7 @@ return true; int ExParty::GetPlayerCount() { int i = 0; -for (RosterUnit * pRoster = *D2Vars::D2CLIENT_Roster ;pRoster;pRoster = pRoster->pNext) i++; +for (RosterUnit * pRoster = *D2Vars.D2CLIENT_Roster ;pRoster;pRoster = pRoster->pNext) i++; return i; } @@ -597,7 +597,7 @@ DWORD ExParty::GetPvpFlags(DWORD dwUnitId) { DWORD dwFlags = 0; RosterUnit* ptPlayer = ExParty::GetRosterById(dwUnitId); - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); if(!ptPlayer) return 0; if(!Me) return 0; @@ -608,10 +608,10 @@ DWORD ExParty::GetPvpFlags(DWORD dwUnitId) dwFlags |= PVP_ALLIED_WITH_YOU; return dwFlags; } - if(D2Funcs::D2CLIENT_TestPvpFlag(dwUnitId, Me->dwUnitId, 8)) + if(D2ASMFuncs::D2CLIENT_TestPvpFlag(dwUnitId, Me->dwUnitId, 8)) dwFlags |= PVP_HOSTILED_YOU; - if(D2Funcs::D2CLIENT_TestPvpFlag(Me->dwUnitId, dwUnitId, 8)) + if(D2ASMFuncs::D2CLIENT_TestPvpFlag(Me->dwUnitId, dwUnitId, 8)) dwFlags |= PVP_HOSTILED_BY_YOU; if(ptPlayer->dwPartyFlags & 2) @@ -652,13 +652,13 @@ wstring ExParty::GetClassById(int ClassId) switch (ClassId) { -case 0: return D2Funcs::D2LANG_GetLocaleText(4011); -case 1: return D2Funcs::D2LANG_GetLocaleText(4010); -case 2: return D2Funcs::D2LANG_GetLocaleText(4009); -case 3: return D2Funcs::D2LANG_GetLocaleText(4008); -case 4: return D2Funcs::D2LANG_GetLocaleText(4007); -case 5: return D2Funcs::D2LANG_GetLocaleText(4012); -case 6: return D2Funcs::D2LANG_GetLocaleText(4013); +case 0: return D2Funcs.D2LANG_GetLocaleText(4011); +case 1: return D2Funcs.D2LANG_GetLocaleText(4010); +case 2: return D2Funcs.D2LANG_GetLocaleText(4009); +case 3: return D2Funcs.D2LANG_GetLocaleText(4008); +case 4: return D2Funcs.D2LANG_GetLocaleText(4007); +case 5: return D2Funcs.D2LANG_GetLocaleText(4012); +case 6: return D2Funcs.D2LANG_GetLocaleText(4013); } return L"???"; } @@ -666,7 +666,7 @@ case 6: return D2Funcs::D2LANG_GetLocaleText(4013); wstring ExParty::GetPingFps(ExTextBox* pTextBox) { wostringstream wPingFpsStr; -wPingFpsStr << *D2Vars::D2CLIENT_FPS << L" fps, " << *D2Vars::D2CLIENT_Ping << L" ms"; +wPingFpsStr << *D2Vars.D2CLIENT_FPS << L" fps, " << *D2Vars.D2CLIENT_Ping << L" ms"; return wPingFpsStr.str(); } @@ -688,20 +688,20 @@ void ExParty::Update() { if(!PartyScreen) return; //=====================Strings part=============================== - static wstring wStrHost1 = D2Funcs::D2LANG_GetLocaleText(4106); - static wstring wStrHost2 = D2Funcs::D2LANG_GetLocaleText(4108); + static wstring wStrHost1 = D2Funcs.D2LANG_GetLocaleText(4106); + static wstring wStrHost2 = D2Funcs.D2LANG_GetLocaleText(4108); - static wstring wStrInv1 = D2Funcs::D2LANG_GetLocaleText(4100); //Invite - static wstring wStrInv2 = D2Funcs::D2LANG_GetLocaleText(4104); //Cancel invite + static wstring wStrInv1 = D2Funcs.D2LANG_GetLocaleText(4100); //Invite + static wstring wStrInv2 = D2Funcs.D2LANG_GetLocaleText(4104); //Cancel invite static wstring wStrInv3; - if(wStrInv3.empty()) {wStrInv3 = D2Funcs::D2LANG_GetLocaleText(4102);wStrInv3+= D2Funcs::D2LANG_GetLocaleText(4103);} + if(wStrInv3.empty()) {wStrInv3 = D2Funcs.D2LANG_GetLocaleText(4102);wStrInv3+= D2Funcs.D2LANG_GetLocaleText(4103);} static wstring wStrLoot1; //Click To Allow Loot - if(wStrLoot1.empty()) {wStrLoot1 = D2Funcs::D2LANG_GetLocaleText(4110);wStrLoot1+=L" ";wStrLoot1+=D2Funcs::D2LANG_GetLocaleText(4111);} + if(wStrLoot1.empty()) {wStrLoot1 = D2Funcs.D2LANG_GetLocaleText(4110);wStrLoot1+=L" ";wStrLoot1+=D2Funcs.D2LANG_GetLocaleText(4111);} static wstring wStrLoot2; //Click To Disallow Loot - if(wStrLoot2.empty()) {wStrLoot2 = D2Funcs::D2LANG_GetLocaleText(4112);wStrLoot2+=L" ";wStrLoot2+=D2Funcs::D2LANG_GetLocaleText(4113);} + if(wStrLoot2.empty()) {wStrLoot2 = D2Funcs.D2LANG_GetLocaleText(4112);wStrLoot2+=L" ";wStrLoot2+=D2Funcs.D2LANG_GetLocaleText(4113);} - static wstring wStrSquelch1 = D2Funcs::D2LANG_GetLocaleText(4118); - static wstring wStrSquelch2 = D2Funcs::D2LANG_GetLocaleText(4119); + static wstring wStrSquelch1 = D2Funcs.D2LANG_GetLocaleText(4118); + static wstring wStrSquelch2 = D2Funcs.D2LANG_GetLocaleText(4119); //================================================================ for(list::iterator i = PlayerList.begin() ; i != PlayerList.end() ; i++) @@ -713,21 +713,21 @@ if(!PartyScreen) return; i->Level->SetText(boost::lexical_cast(ptRoster->wLevel)); i->Clan->SetText(boost::lexical_cast(ExParty::FindClan(ptRoster->szName).c_str())); i->Acc->SetText(ExParty::FindAccount(ptRoster->szName)); - // i->Location->SetText(GetLvlNameEx(ptRoster->dwUnitId==D2Funcs::D2CLIENT_GetPlayer()->dwUnitId ? ExParty::GetPlayerArea() : ptRoster->dwLevelId,145)); + // i->Location->SetText(GetLvlNameEx(ptRoster->dwUnitId==D2Funcs.D2CLIENT_GetPlayer()->dwUnitId ? ExParty::GetPlayerArea() : ptRoster->dwLevelId,145)); i->Kills->SetText(boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,1))); i->Deaths->SetText(boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,2))); i->Assists->SetText(boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,3))); DWORD Flaga = ExParty::GetPvpFlags(ptRoster->dwUnitId); // Class Hover Info wostringstream Info; - Info << D2Funcs::D2LANG_GetLocaleText(3368) << L' ' << ptRoster->wLevel << '\n'; + Info << D2Funcs.D2LANG_GetLocaleText(3368) << L' ' << ptRoster->wLevel << '\n'; if(Flaga & PVP_ALLIED_WITH_YOU) { - if(ptRoster->dwUnitId==D2Funcs::D2CLIENT_GetPlayer()->dwUnitId) - Info << D2Funcs::D2CLIENT_GetLevelName(ExParty::GetPlayerArea()); + if(ptRoster->dwUnitId==D2Funcs.D2CLIENT_GetPlayer()->dwUnitId) + Info << D2ASMFuncs::D2CLIENT_GetLevelName(ExParty::GetPlayerArea()); else - Info << D2Funcs::D2CLIENT_GetLevelName(ptRoster->dwLevelId); + Info << D2ASMFuncs::D2CLIENT_GetLevelName(ptRoster->dwLevelId); Info << '\n'; } @@ -752,7 +752,7 @@ if(!PartyScreen) return; if(i->Loot) { - for(RosterInfo* pInfo = *(*D2Vars::D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) + for(RosterInfo* pInfo = *(*D2Vars.D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) { if(ptRoster->dwUnitId==pInfo->dwUnitId) {Flaga = pInfo->dwPartyFlags; break;} } @@ -762,7 +762,7 @@ if(!PartyScreen) return; if(i->Squelch) { - for(RosterInfo* pInfo = *(*D2Vars::D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) + for(RosterInfo* pInfo = *(*D2Vars.D2CLIENT_Roster)->ptInfo ; pInfo ; pInfo = pInfo->ptNext) { if(ptRoster->dwUnitId==pInfo->dwUnitId) {Flaga = pInfo->dwPartyFlags; break;} } @@ -773,7 +773,7 @@ if(!PartyScreen) return; } if(LeaveB) { - if(ExParty::GetRosterById(D2Funcs::D2CLIENT_GetPlayer()->dwUnitId)->wPartyId==0xFFFF) + if(ExParty::GetRosterById(D2Funcs.D2CLIENT_GetPlayer()->dwUnitId)->wPartyId==0xFFFF) LeaveB->SetState(LeaveB->INVISIBLE); else LeaveB->SetState(LeaveB->VISIBLE); @@ -855,17 +855,17 @@ void ExParty::Resort(char *szSkip) TeamOffset+=20; wstring TeamId; wchar_t tt = (int)(64 + (TeamOffset/20)); - if(LastTeamId!=0xFFFF) {TeamId= D2Funcs::D2LANG_GetLocaleText(4016); TeamId.erase(TeamId.length()-1); TeamId+=tt;} - else TeamId = D2Funcs::D2LANG_GetLocaleText(4015); + if(LastTeamId!=0xFFFF) {TeamId= D2Funcs.D2LANG_GetLocaleText(4016); TeamId.erase(TeamId.length()-1); TeamId+=tt;} + else TeamId = D2Funcs.D2LANG_GetLocaleText(4015); ExTextBox * ptGrp = new ExTextBox(i->Frame->GetX() + 5, 80 + (z * 25) + TeamOffset, 0, 0, TeamId, 0, 0); PartyScreen->AddChild(ptGrp); Group.push_back(ptGrp); } - D2Funcs::D2WIN_SetTextSize(TextFont); + D2Funcs.D2WIN_SetTextSize(TextFont); int yPos = 100+(z*25) + TeamOffset; - int TextPos = ((yPos*2)-20 + D2Funcs::D2WIN_GetFontHeight()) / 2; + int TextPos = ((yPos*2)-20 + D2Funcs.D2WIN_GetFontHeight()) / 2; i->Frame->SetY(yPos-20); i->Level->SetY(TextPos); @@ -907,7 +907,7 @@ void ExParty::Fill(char *szSkip) // int off = 0; string szName(szSkip ? szSkip : ""); - for(RosterUnit *ptRoster = *D2Vars::D2CLIENT_Roster; ptRoster; ptRoster = ptRoster->pNext, ++i) + for(RosterUnit *ptRoster = *D2Vars.D2CLIENT_Roster; ptRoster; ptRoster = ptRoster->pNext, ++i) { if(szName == ptRoster->szName) {--i; continue;} // if(i == 17) break; @@ -915,9 +915,9 @@ void ExParty::Fill(char *szSkip) PlayerTable Tbl = {0}; int TextFont = 0; - D2Funcs::D2WIN_SetTextSize(TextFont); + D2Funcs.D2WIN_SetTextSize(TextFont); int yPos = 100+(i*25); - int TextPos = ((yPos*2)-20 + D2Funcs::D2WIN_GetFontHeight()) / 2; + int TextPos = ((yPos*2)-20 + D2Funcs.D2WIN_GetFontHeight()) / 2; Tbl.UnitId = ptRoster->dwUnitId; Tbl.Frame = new ExBox(0,yPos,480,22,ExParty::GetFrameColor(ptRoster->dwUnitId),2);Tbl.Frame->SetAlign(Tbl.Frame->CENTER,Tbl.Frame->NONE); @@ -927,7 +927,7 @@ void ExParty::Fill(char *szSkip) Tbl.Level = new ExTextBox(Tbl.Frame->GetX()+175,TextPos,9,TextFont,boost::lexical_cast(ptRoster->wLevel),0,0); Tbl.Clan = new ExTextBox(Tbl.Frame->GetX()+195,TextPos,0,TextFont,boost::lexical_cast(ExParty::FindClan(ptRoster->szName).c_str()),0,0); Tbl.Acc = new ExTextBox(Tbl.Frame->GetX()+230,TextPos,0,TextFont,ExParty::FindAccount(ptRoster->szName),0,0); -// Tbl.Location = new ExTextBox(Tbl.Frame->GetX()+337,TextPos,COL_YELLOW,TextFont,GetLvlNameEx(ptRoster->dwUnitId==D2Funcs::D2CLIENT_GetPlayer()->dwUnitId ? ExParty::GetPlayerArea() : ptRoster->dwLevelId,145),0,0); +// Tbl.Location = new ExTextBox(Tbl.Frame->GetX()+337,TextPos,COL_YELLOW,TextFont,GetLvlNameEx(ptRoster->dwUnitId==D2Funcs.D2CLIENT_GetPlayer()->dwUnitId ? ExParty::GetPlayerArea() : ptRoster->dwLevelId,145),0,0); Tbl.Kills = new ExTextBox(Tbl.Frame->GetX()+337,TextPos,COL_WHITE,TextFont,boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,1)),0,0); Tbl.Assists = new ExTextBox(Tbl.Frame->GetX()+357,TextPos,COL_WHITE,TextFont,boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,3)),0,0); Tbl.Deaths = new ExTextBox(Tbl.Frame->GetX()+377,TextPos,COL_WHITE,TextFont,boost::lexical_cast(ExParty::FindRoster(ptRoster->szName,2)),0,0); @@ -940,13 +940,13 @@ void ExParty::Fill(char *szSkip) PartyScreen->AddChild(Tbl.Kills); PartyScreen->AddChild(Tbl.Assists); PartyScreen->AddChild(Tbl.Deaths); - if(ptRoster->dwUnitId!=D2Funcs::D2CLIENT_GetPlayer()->dwUnitId) + if(ptRoster->dwUnitId!=D2Funcs.D2CLIENT_GetPlayer()->dwUnitId) { Tbl.Invite = new ExButton(Tbl.Frame->GetX()+397,yPos,0,18,L"",CellFiles::PARTY,&ExParty::Invite,0); Tbl.Host = new ExButton(Tbl.Frame->GetX()+420,yPos,0,6,L"",CellFiles::PARTY,&ExParty::Host,0); PartyScreen->AddChild(Tbl.Invite); PartyScreen->AddChild(Tbl.Host); - if((*D2Vars::D2LAUNCH_BnData)->CharFlags & 4) { + if((*D2Vars.D2LAUNCH_BnData)->CharFlags & 4) { Tbl.Loot = new ExButton(Tbl.Frame->GetX()+440,yPos,0,14,L"",CellFiles::PARTY,&ExParty::Loot,0); PartyScreen->AddChild(Tbl.Loot); } @@ -982,11 +982,11 @@ pOffset = 0; ExParty::ClearScreen(); //Load Strings static wstring wPartyStr, wClassStr, wCharStr, wAccStr; -int LocId = D2Funcs::D2LANG_GetLocaleId(); -if(!wPartyStr.length()) wPartyStr = D2Funcs::D2LANG_GetLocaleText(3926); -if(!wClassStr.length()) wClassStr = D2Funcs::D2LANG_GetLocaleText(5322); -if(!wCharStr.length()) wCharStr = D2Funcs::D2LANG_GetLocaleText(5287); -if(!wAccStr.length()) wAccStr = D2Funcs::D2LANG_GetLocaleText(5224); +int LocId = D2Funcs.D2LANG_GetLocaleId(); +if(!wPartyStr.length()) wPartyStr = D2Funcs.D2LANG_GetLocaleText(3926); +if(!wClassStr.length()) wClassStr = D2Funcs.D2LANG_GetLocaleText(5322); +if(!wCharStr.length()) wCharStr = D2Funcs.D2LANG_GetLocaleText(5287); +if(!wAccStr.length()) wAccStr = D2Funcs.D2LANG_GetLocaleText(5224); PartyScreen = new ExWindow(0,50,510,85+(ExParty::GetPlayerCount()*25)+TeamOffset,false,wPartyStr);PartyScreen->SetAlign(PartyScreen->CENTER,PartyScreen->NONE); PlayerCount = new ExTextBox(PartyScreen->GetX()+5,101,11,0,&ExParty::GetPartyCount,0,0); @@ -999,8 +999,8 @@ Acc = new ExTextBox(PartyScreen->GetX()+237,105,0,0,wAccStr,0,0); Assists = new ExImage(PartyScreen->GetX()+366,105,5,2,CellFiles::MONINDICATOR); Assists->Hoover = LocId == 10 ? L"Asysty" : L"Assists"; Deaths = new ExImage(PartyScreen->GetX()+386,105,5,0,CellFiles::MONINDICATOR); Deaths->Hoover = LocId == 10 ? L"�mierci" : L"Deaths"; Ping = new ExTextBox(PartyScreen->GetX()+10,64,0,0,&ExParty::GetPingFps,&ExParty::SharePing,0);Ping->SetHoverable(false); -LeaveB = new ExButton(PartyScreen->GetX()+440,105,2,0,D2Funcs::D2LANG_GetLocaleText(4152),CellFiles::PARTYBUTTON,&ExParty::Leave,0); -if(ExParty::GetRosterById(D2Funcs::D2CLIENT_GetPlayer()->dwUnitId)->wPartyId==0xFFFF) LeaveB->SetState(LeaveB->INVISIBLE); +LeaveB = new ExButton(PartyScreen->GetX()+440,105,2,0,D2Funcs.D2LANG_GetLocaleText(4152),CellFiles::PARTYBUTTON,&ExParty::Leave,0); +if(ExParty::GetRosterById(D2Funcs.D2CLIENT_GetPlayer()->dwUnitId)->wPartyId==0xFFFF) LeaveB->SetState(LeaveB->INVISIBLE); Scroll = new ExScrollBar(PartyScreen->GetX()+510,PartyScreen->GetY(),0,GetPlayerCount() - 15,PartyScreen->GetHeight(),&pOffset,&ExParty::OnScroll); if(GetPlayerCount()<15) Scroll->SetState(Scroll->INVISIBLE); PartyScreen->AddChild(PlayerCount); @@ -1039,7 +1039,7 @@ LeaveB = 0; //LeaveCriticalSection(&EX_CRITSECT); } -D2Vars::D2CLIENT_UIModes[UI_PARTY]=PartyScreen ? 1 : 0; -//D2Funcs::D2GFX_10073(); -//D2Funcs::D2CLIENT_SetView(0,*D2Vars::D2CLIENT_ScreenWidth,0,(*D2Vars::D2CLIENT_ScreenHeight)-40,(void*)*D2Vars::D2CLIENT_GameView); +D2Vars.D2CLIENT_UIModes[UI_PARTY]=PartyScreen ? 1 : 0; +//D2Funcs.D2GFX_10073(); +//D2ASMFuncs::D2CLIENT_SetView(0,*D2Vars.D2CLIENT_ScreenWidth,0,(*D2Vars.D2CLIENT_ScreenHeight)-40,(void*)*D2Vars.D2CLIENT_GameView); } diff --git a/ExParty.h b/ExParty.h index cace22f..67a33ca 100644 --- a/ExParty.h +++ b/ExParty.h @@ -19,8 +19,8 @@ namespace ExParty void Host(ExControl* ptControl); void Invite(ExControl* ptControl); void OnScroll(ExControl* ptControl); - int GetPlayerArea(UnitAny* ptUnit = D2Funcs::D2CLIENT_GetPlayer()); - bool isTownLvl(UnitAny* ptUnit = D2Funcs::D2CLIENT_GetPlayer()); + int GetPlayerArea(UnitAny* ptUnit = D2Funcs.D2CLIENT_GetPlayer()); + bool isTownLvl(UnitAny* ptUnit = D2Funcs.D2CLIENT_GetPlayer()); wstring GetPingFps(ExTextBox* pTextBox); wstring GetPartyCount(ExTextBox* pTextBox); bool isOpen(); diff --git a/ExPrecast.cpp b/ExPrecast.cpp index 7342307..159fc72 100644 --- a/ExPrecast.cpp +++ b/ExPrecast.cpp @@ -19,7 +19,7 @@ UnitAny* Weap1 = 0; UnitAny* Weap2 = 0; UnitAny* Armor = 0; - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) { @@ -58,7 +58,7 @@ UnitAny* Weap1 = 0; UnitAny* Weap2 = 0; UnitAny* Armor = 0; - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) { @@ -87,11 +87,11 @@ UnitAny* Armor = 0; unsigned __stdcall PrecastThread(void* Args) { - UnitAny* pPlayer = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* pPlayer = D2Funcs.D2CLIENT_GetPlayer(); if(pPlayer) if(pPlayer->dwClassId == PLAYER_BARBARIAN) { - if(*D2Vars::D2CLIENT_isWeaponSwitch) BOSetup(); + if(*D2Vars.D2CLIENT_isWeaponSwitch) BOSetup(); else PrevSetup(); } @@ -113,29 +113,29 @@ unsigned __stdcall PrecastThread(void* Args) bool ExPrecast::CubeToBody(UnitAny* ptItem, int Loc) { if(!ptItem || !Loc ) return false; - if(D2Funcs::D2CLIENT_GetCursorItem()) return false; + if(D2Funcs.D2CLIENT_GetCursorItem()) return false; ExPrecast::RemoveFromBuffer(ptItem->dwUnitId); int Time = GetTickCount(); while(GetTickCount()-Time<1500) { Sleep(50); - if(D2Funcs::D2CLIENT_GetCursorItem()) - if(ptItem->dwUnitId==D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId) break; + if(D2Funcs.D2CLIENT_GetCursorItem()) + if(ptItem->dwUnitId==D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId) break; } ExPrecast::CursorToBody(ptItem->dwUnitId,Loc); //Swap Cur with body Time = GetTickCount(); while(GetTickCount()-Time<1500) { Sleep(50); - if(D2Funcs::D2CLIENT_GetCursorItem()) - if(D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId!=ptItem->dwUnitId) break; + if(D2Funcs.D2CLIENT_GetCursorItem()) + if(D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId!=ptItem->dwUnitId) break; } - ExPrecast::ItemToCube(D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId); + ExPrecast::ItemToCube(D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId); Time = GetTickCount(); while(GetTickCount()-Time<1500) { Sleep(50); - if(!D2Funcs::D2CLIENT_GetCursorItem()) return true; + if(!D2Funcs.D2CLIENT_GetCursorItem()) return true; } return false; } @@ -152,30 +152,30 @@ if(!ptItem || !Loc ) return false; //GC 321: 9 1a 64 00 00 00 06 00 00 00 //*/ //if(!ptItem) return false; -// if(D2Funcs::D2CLIENT_GetCursorItem()) return false; +// if(D2Funcs.D2CLIENT_GetCursorItem()) return false; // int Loc = ptItem->pItemData->BodyLoc; // ExPrecast::RemoveFromBody(Loc); // int Time = GetTickCount(); // while(GetTickCount()-Time<1500) // { // Sleep(50); -// if(D2Funcs::D2CLIENT_GetCursorItem()) -// if(ptItem->dwUnitId==D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId) break; +// if(D2Funcs.D2CLIENT_GetCursorItem()) +// if(ptItem->dwUnitId==D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId) break; // } // ExPrecast::ItemToCube(ptItem->dwUnitId); //Swap Cur with body // Time = GetTickCount(); // while(GetTickCount()-Time<1500) // { // Sleep(50); -// if(D2Funcs::D2CLIENT_GetCursorItem()) -// if(D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId!=ptItem->dwUnitId) break; +// if(D2Funcs.D2CLIENT_GetCursorItem()) +// if(D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId!=ptItem->dwUnitId) break; // } -// ExPrecast::CursorToBody(D2Funcs::D2CLIENT_GetCursorItem()->dwUnitId,Loc); +// ExPrecast::CursorToBody(D2Funcs.D2CLIENT_GetCursorItem()->dwUnitId,Loc); // Time = GetTickCount(); // while(GetTickCount()-Time<1500) // { // Sleep(50); -// if(!D2Funcs::D2CLIENT_GetCursorItem()) return true; +// if(!D2Funcs.D2CLIENT_GetCursorItem()) return true; // } // return false; //} @@ -184,14 +184,14 @@ if(!ptItem || !Loc ) return false; UnitAny* ExPrecast::FindItemEx(string ItemCode, int Loc, int Idx) { - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) { if(ExPrecast::GetItemLocation(pItem) == Loc) { //wstring a = boost::lexical_cast(pItem->pItemData->FileIndex); - //D2Funcs::D2CLIENT_PrintGameString(a.c_str(),1); + //D2Funcs.D2CLIENT_PrintGameString(a.c_str(),1); string szTemp = GetItemCode(pItem); if(szTemp.empty()) continue; if(szTemp.compare(0,3,ItemCode)==0 && pItem->pItemData->FileIndex==Idx) return pItem; @@ -203,7 +203,7 @@ UnitAny* ExPrecast::FindItemEx(string ItemCode, int Loc, int Idx) UnitAny* ExPrecast::FindItem(string ItemCode, int Loc) { - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) { @@ -249,14 +249,14 @@ string ExPrecast::GetItemCode(UnitAny* ptItem) { if(!ptItem) return 0; - ItemsTxt* pTxt = D2Funcs::D2COMMON_GetItemText(ptItem->dwClassId); + ItemsTxt* pTxt = D2Funcs.D2COMMON_GetItemText(ptItem->dwClassId); return pTxt->szcode; } UnitAny* ExPrecast::FindEquipItem(int nLoc) { - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) if(ExPrecast::GetItemLocation(pItem) == STORAGE_EQUIP) @@ -270,7 +270,7 @@ UnitAny* ExPrecast::FindEquipItem(int nLoc) void ExPrecast::Switch() { BYTE aPacket = 0x60; - D2Funcs::D2NET_SendPacket(1,1,&aPacket); + D2Funcs.D2NET_SendPacket(1,1,&aPacket); } void ExPrecast::DropItem(int ItemID) @@ -281,7 +281,7 @@ void ExPrecast::DropItem(int ItemID) ::memset(&aPacket,0,5); aPacket[0] = 0x17; *(DWORD*)&aPacket[1] = ItemID; - D2Funcs::D2NET_SendPacket(5, 1, aPacket); + D2Funcs.D2NET_SendPacket(5, 1, aPacket); } @@ -294,7 +294,7 @@ void ExPrecast::EquipItem(int ItemID, int Loc) aPacket[0] = 0x1A; *(DWORD*)&aPacket[1] = ItemID; *(DWORD*)&aPacket[5] = Loc; - D2Funcs::D2NET_SendPacket(9, 1, aPacket); + D2Funcs.D2NET_SendPacket(9, 1, aPacket); } //void ExPrecast::SwapItem(int ItemID, int Loc) @@ -306,7 +306,7 @@ void ExPrecast::EquipItem(int ItemID, int Loc) // aPacket[0] = 0x1F; // *(DWORD*)&aPacket[1] = ItemID; // *(DWORD*)&aPacket[5] = Loc; -// D2Funcs::D2NET_SendPacket(9, 1, aPacket); +// D2Funcs.D2NET_SendPacket(9, 1, aPacket); //} void ExPrecast::ItemToBuffer(int ItemID, int Buffer) @@ -318,7 +318,7 @@ void ExPrecast::ItemToBuffer(int ItemID, int Buffer) aPacket[0] = 0x18; *(DWORD*)&aPacket[1] = ItemID; *(DWORD*)&aPacket[13] = Buffer; - D2Funcs::D2NET_SendPacket(17, 1, aPacket); + D2Funcs.D2NET_SendPacket(17, 1, aPacket); } void ExPrecast::RemoveFromBuffer(int ItemID) @@ -329,7 +329,7 @@ void ExPrecast::RemoveFromBuffer(int ItemID) ::memset(&aPacket,0,5); aPacket[0] = 0x19; *(DWORD*)&aPacket[1] = ItemID; - D2Funcs::D2NET_SendPacket(5, 1, aPacket); + D2Funcs.D2NET_SendPacket(5, 1, aPacket); } @@ -339,7 +339,7 @@ void ExPrecast::RemoveFromBody(int aLoc) ::memset(&aPacket,0,3); aPacket[0] = 0x1C; *(WORD*)&aPacket[1] = aLoc; - D2Funcs::D2NET_SendPacket(3, 1, aPacket); + D2Funcs.D2NET_SendPacket(3, 1, aPacket); } @@ -347,7 +347,7 @@ void ExPrecast::ItemToCube(int ItemID) { if(!ItemID) return; - UnitAny * Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * Me = D2Funcs.D2CLIENT_GetPlayer(); int CubeID = 0; for(UnitAny* pItem = Me->pInventory->pFirstItem; pItem; pItem = pItem->pItemData->pNextItem) { @@ -362,7 +362,7 @@ void ExPrecast::ItemToCube(int ItemID) aPacket[0] = 0x2A; *(DWORD*)&aPacket[1] = ItemID; *(DWORD*)&aPacket[5] = CubeID; - D2Funcs::D2NET_SendPacket(9, 1, aPacket); + D2Funcs.D2NET_SendPacket(9, 1, aPacket); } void ExPrecast::CursorToBody(int ItemID, int nLoc) @@ -374,6 +374,6 @@ void ExPrecast::CursorToBody(int ItemID, int nLoc) aPacket[0] = 0x1D; *(DWORD*)&aPacket[1] = ItemID; *(DWORD*)&aPacket[5] = nLoc; - D2Funcs::D2NET_SendPacket(9, 1, aPacket); + D2Funcs.D2NET_SendPacket(9, 1, aPacket); } diff --git a/ExRectangle.cpp b/ExRectangle.cpp index b36253b..135e5a2 100644 --- a/ExRectangle.cpp +++ b/ExRectangle.cpp @@ -16,7 +16,7 @@ LeaveCriticalSection(&CON_CRITSECT); void ExRectangle::Draw() { -if(cState!=INVISIBLE) D2Funcs::D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,aColor,aTransLvl); +if(cState!=INVISIBLE) D2Funcs.D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,aColor,aTransLvl); } ExRectangle::~ExRectangle() diff --git a/ExScreen.cpp b/ExScreen.cpp index 0c3afde..58e8dc3 100644 --- a/ExScreen.cpp +++ b/ExScreen.cpp @@ -15,9 +15,9 @@ void ExScreen::ScreenToAutomap(POINT* ptPos, int x, int y) //BHHack, converts Real path XY to AutoMap { x *= 32; y *= 32; - ptPos->x = ((x - y)/2/(*(INT*)D2Vars::D2CLIENT_Divisior))-(*D2Vars::D2CLIENT_Offset).x+8; - ptPos->y = ((x + y)/4/(*(INT*)D2Vars::D2CLIENT_Divisior))-(*D2Vars::D2CLIENT_Offset).y-8; - if(*D2Vars::D2CLIENT_MapType) { + ptPos->x = ((x - y)/2/(*(INT*)D2Vars.D2CLIENT_Divisior))-(*D2Vars.D2CLIENT_Offset).x+8; + ptPos->y = ((x + y)/4/(*(INT*)D2Vars.D2CLIENT_Divisior))-(*D2Vars.D2CLIENT_Offset).y-8; + if(*D2Vars.D2CLIENT_MapType) { --ptPos->x; ptPos->y += 5; } @@ -26,14 +26,14 @@ void ExScreen::ScreenToAutomap(POINT* ptPos, int x, int y) //BHHack, converts R void ExScreen::AutomapToScreen(POINT* ptPos, int x, int y) //BHHack, converts AutoMap XY to Screen XY { ptPos->x = x; ptPos->y = y; - D2Funcs::D2COMMON_MapToAbsScreen(&ptPos->x, &ptPos->y); + D2Funcs.D2COMMON_MapToAbsScreen(&ptPos->x, &ptPos->y); } int ExScreen::GetTextWidth(const wchar_t *wText) { int Len = wcslen(wText); typedef int (__fastcall *pGetSize)(wchar_t); -pGetSize fGetSize = *D2Vars::D2WIN_CurrentFont == 13 ? (pGetSize)D2Ptrs::D2WIN_Font13 : (pGetSize)D2Ptrs::D2WIN_FontNon13; +pGetSize fGetSize = *D2Vars.D2WIN_CurrentFont == 13 ? (pGetSize)D2Ptrs.D2WIN_Font13 : (pGetSize)D2Ptrs.D2WIN_FontNon13; int TextWid = 0; int z = 0; @@ -62,7 +62,7 @@ void ExScreen::PrintTextEx(int Color, char* Msg,...) wchar_t* wtext = new wchar_t[len]; Misc::CharToWide(text,len,wtext,len); - D2Funcs::D2CLIENT_PrintGameString(wtext,Color); + D2Funcs.D2CLIENT_PrintGameString(wtext,Color); delete[] text; delete[] wtext; @@ -80,7 +80,7 @@ void ExScreen::PrintTextEx(int Color, wchar_t* Msg,...) vswprintf_s(text,len,Msg,arguments); va_end(arguments); - D2Funcs::D2CLIENT_PrintGameString(text,Color); + D2Funcs.D2CLIENT_PrintGameString(text,Color); delete[] text; @@ -96,7 +96,7 @@ void ExScreen::DrawTextEx(int X, int Y, int Color, int Cent, int TransLvl, wchar vswprintf_s(text,len,Msg,arguments); va_end(arguments); - D2Funcs::D2WIN_DrawTextEx(text,X,Y,Color,Cent,TransLvl); + D2Funcs.D2WIN_DrawTextEx(text,X,Y,Color,Cent,TransLvl); delete[] text; } @@ -113,7 +113,7 @@ void ExScreen::DrawTextEx(int X, int Y, int Color, int Cent, int TransLvl, char* wchar_t* wtext = new wchar_t[len]; Misc::CharToWide(text,len,wtext,len); - D2Funcs::D2WIN_DrawTextEx(wtext,X,Y,Color,Cent,TransLvl); + D2Funcs.D2WIN_DrawTextEx(wtext,X,Y,Color,Cent,TransLvl); delete[] text; delete[] wtext; @@ -123,35 +123,35 @@ void __stdcall ExScreen::Display() { #ifdef _DEBUG wostringstream wStr; - wStr << "X: " << *D2Vars::D2CLIENT_MouseX << " Y:" << *D2Vars::D2CLIENT_MouseY; - if(D2Funcs::D2CLIENT_GetSelectedUnit()) + wStr << "X: " << *D2Vars.D2CLIENT_MouseX << " Y:" << *D2Vars.D2CLIENT_MouseY; + if(D2Funcs.D2CLIENT_GetSelectedUnit()) { - wStr << " UnitId: " << hex << D2Funcs::D2CLIENT_GetSelectedUnit()->dwUnitId; - wStr << " ClassId: " << hex << D2Funcs::D2CLIENT_GetSelectedUnit()->dwClassId; - wStr << " [" << dec << ExAim::GetUnitX(D2Funcs::D2CLIENT_GetSelectedUnit()) << "," << dec << ExAim::GetUnitY(D2Funcs::D2CLIENT_GetSelectedUnit()) << "]"; + wStr << " UnitId: " << hex << D2Funcs.D2CLIENT_GetSelectedUnit()->dwUnitId; + wStr << " ClassId: " << hex << D2Funcs.D2CLIENT_GetSelectedUnit()->dwClassId; + wStr << " [" << dec << ExAim::GetUnitX(D2Funcs.D2CLIENT_GetSelectedUnit()) << "," << dec << ExAim::GetUnitY(D2Funcs.D2CLIENT_GetSelectedUnit()) << "]"; } int aLen =ExScreen::GetTextWidth(wStr.str().c_str()); - D2Funcs::D2WIN_DrawText(wStr.str().c_str(), *D2Vars::D2CLIENT_ScreenWidth - aLen - 10, *D2Vars::D2CLIENT_ScreenHeight - 10, 11, 0); + D2Funcs.D2WIN_DrawText(wStr.str().c_str(), *D2Vars.D2CLIENT_ScreenWidth - aLen - 10, *D2Vars.D2CLIENT_ScreenHeight - 10, 11, 0); /*wstring wPool = L"Pools: " + boost::lexical_cast(ExMemory::GetPoolsCount()); wPool+=L" Mem taken:" + boost::lexical_cast(ExMemory::GetMemUsage() /1024 / 1024); wPool+=L" mb"; - D2Funcs::D2WIN_DrawText(wPool.c_str(),10,20,11,0);*/ + D2Funcs.D2WIN_DrawText(wPool.c_str(),10,20,11,0);*/ #endif -// D2Funcs::D2WIN_SetTextSize(3); -// D2Funcs::D2WIN_DrawText(D2Vars::D2CLIENT_TempMessage,0,40,0,0); +// D2Funcs.D2WIN_SetTextSize(3); +// D2Funcs.D2WIN_DrawText(D2Vars.D2CLIENT_TempMessage,0,40,0,0); EnterCriticalSection(&CON_CRITSECT); for(auto i = Controls.cbegin(); i!=Controls.cend(); ++i) (*i)->Draw(); LeaveCriticalSection(&CON_CRITSECT); - D2Funcs::D2WIN_SetTextSize(1); + D2Funcs.D2WIN_SetTextSize(1); } __forceinline wstring ExScreen::GetColorCode(int ColNo) { //wchar_t Result[4]; -wchar_t* pCol = D2Funcs::D2LANG_GetLocaleText(3994); +wchar_t* pCol = D2Funcs.D2LANG_GetLocaleText(3994); if(!pCol) OutputDebugString("Get Col code fail!"); //if(!pCol) return L""; //swprintf_s(Result,4,L"%s%c",pCol, (char)(ColNo + '0')); @@ -170,17 +170,17 @@ if(pControl->Text.length()>16) return; Misc::WideToChar(aPass,pControl->Text.c_str()); strcpy_s((char*)&Packet[1],16,aPass.c_str()); Packet[17] = 0; -D2Funcs::D2NET_SendPacket(18, 0, (BYTE*)&Packet); +D2Funcs.D2NET_SendPacket(18, 0, (BYTE*)&Packet); } BOOL __fastcall ExScreen::OnTradeData(BYTE* aPacket) { if(GoldBox) {delete GoldBox; GoldBox = 0; } - GoldBox = new ExEditBox(100,475,5,5,16,0,D2Funcs::D2LANG_GetLocaleId() == 10 ? L"Podaj has�o AR Gold" : L"Enter AR Gold Password :",CellFiles::EDITBOX); + GoldBox = new ExEditBox(100,475,5,5,16,0,D2Funcs.D2LANG_GetLocaleId() == 10 ? L"Podaj has�o AR Gold" : L"Enter AR Gold Password :",CellFiles::EDITBOX); GoldBox->SetHashed(true); GoldBox->SetChangeEvent(&OnGoldChange); - return D2Ptrs::D2CLIENT_TradeData_I(aPacket); + return D2Funcs.D2CLIENT_TradeData_I(aPacket); } @@ -189,72 +189,74 @@ BOOL __fastcall ExScreen::OnTradeButton(BYTE* aPacket) if(aPacket[1] == UPDATE_CLOSE_TRADE || aPacket[1] == UPDATE_TRADE_DONE) if(GoldBox) {delete GoldBox; GoldBox = 0; } - return D2Ptrs::D2CLIENT_TradeButton_I(aPacket); + return D2Funcs.D2CLIENT_TradeButton_I(aPacket); } void ExScreen::DrawLifeManaTxt() { wchar_t szText[100] = L""; - int mX = *D2Vars::D2CLIENT_MouseX; - int mY = *D2Vars::D2CLIENT_MouseY; - int sW = *D2Vars::D2CLIENT_ScreenWidth; - int sH = *D2Vars::D2CLIENT_ScreenHeight; + int mX = *D2Vars.D2CLIENT_MouseX; + int mY = *D2Vars.D2CLIENT_MouseY; + int sW = *D2Vars.D2CLIENT_ScreenWidth; + int sH = *D2Vars.D2CLIENT_ScreenHeight; if((mX > 30 && mX < 110 && mY >= sH - 75 && mY <= sH - 15) || PermShowLife) { - wchar_t* szLife = D2Funcs::D2LANG_GetLocaleText(4165); - //int Life = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(),STAT_HITPOINTS,0) >> 8; - int Life = D2Funcs::D2CLIENT_DiffuseStat(STAT_HITPOINTS) >> 8; - int MaxLife = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(),STAT_MAXHP,0) >> 8; + wchar_t* szLife = D2Funcs.D2LANG_GetLocaleText(4165); + //int Life = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(),STAT_HITPOINTS,0) >> 8; + int Life = D2ASMFuncs::D2CLIENT_DiffuseStat(STAT_HITPOINTS) >> 8; + int MaxLife = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(),STAT_MAXHP,0) >> 8; swprintf_s(szText,100,szLife,Life,MaxLife); int cSize = ExScreen::GetTextWidth(szText); - D2Funcs::D2WIN_DrawText(szText,65 - cSize / 2, sH - 95, 0, 0); + D2Funcs.D2WIN_DrawText(szText,65 - cSize / 2, sH - 95, 0, 0); } if((mX >= sW - 111 && mX <= sW - 31 && mY >= sH - 75 && mY <= sH - 15) || PermShowMana) { - wchar_t* szMana = D2Funcs::D2LANG_GetLocaleText(4166); - //int Mana = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(),STAT_MANA,0) >> 8; - int Mana = D2Funcs::D2CLIENT_DiffuseStat(STAT_MANA) >> 8; - int MaxMana = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(),STAT_MAXMANA,0) >> 8; + wchar_t* szMana = D2Funcs.D2LANG_GetLocaleText(4166); + //int Mana = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(),STAT_MANA,0) >> 8; + int Mana = D2ASMFuncs::D2CLIENT_DiffuseStat(STAT_MANA) >> 8; + int MaxMana = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(),STAT_MAXMANA,0) >> 8; swprintf_s(szText,100,szMana,Mana,MaxMana); int cSize = ExScreen::GetTextWidth(szText); - D2Funcs::D2WIN_DrawText(szText,sW- cSize / 2 - 70, sH - 95, 0, 0); + D2Funcs.D2WIN_DrawText(szText,sW- cSize / 2 - 70, sH - 95, 0, 0); } } void ExScreen::DrawAutoMapVer() { wostringstream wPatch, wRes; - int x, y; - int LocId = D2Funcs::D2LANG_GetLocaleId(); + int LocId = D2Funcs.D2LANG_GetLocaleId(); wPatch << L"Patch: " << GetColorCode(COL_YELLOW) #ifdef VER_111B - << L"1.11D"; + << L"1.11B"; #else << L"1.13D"; #endif static int cSize = ExScreen::GetTextWidth(wPatch.str().c_str()); - D2Funcs::D2WIN_DrawText(wPatch.str().c_str(), *D2Vars::D2CLIENT_ScreenWidth - cSize - 16, *D2Vars::D2CLIENT_AutomapInfoY, 4, 0); - *D2Vars::D2CLIENT_AutomapInfoY+=16; + D2Funcs.D2WIN_DrawText(wPatch.str().c_str(), *D2Vars.D2CLIENT_ScreenWidth - cSize - 16, *D2Vars.D2CLIENT_AutomapInfoY, 4, 0); + *D2Vars.D2CLIENT_AutomapInfoY+=16; - ExMultiRes::D2GFX_GetModeParams(*D2Vars::D2GFX_GfxMode, &x, &y); +#ifdef D2EX_MULTIRES + int x, y; + ExMultiRes::D2GFX_GetModeParams(*D2Vars.D2GFX_GfxMode, &x, &y); if (x > 800 && y > 600) { wRes << (LocId == LOCALE_ENG ? L"Resolution: " : L"Rozdzielczo��: ") << GetColorCode(COL_YELLOW) << x << L"x" << y; int cSize2 = ExScreen::GetTextWidth(wRes.str().c_str()); - D2Funcs::D2WIN_DrawText(wRes.str().c_str(), *D2Vars::D2CLIENT_ScreenWidth - cSize2 - 16, *D2Vars::D2CLIENT_AutomapInfoY, 4, 0); - *D2Vars::D2CLIENT_AutomapInfoY += 16; + D2Funcs.D2WIN_DrawText(wRes.str().c_str(), *D2Vars.D2CLIENT_ScreenWidth - cSize2 - 16, *D2Vars.D2CLIENT_AutomapInfoY, 4, 0); + *D2Vars.D2CLIENT_AutomapInfoY += 16; } +#endif } void OnMapDraw() { - UnitAny* Me = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny* Me = D2Funcs.D2CLIENT_GetPlayer(); if(!Me) return; EnterCriticalSection(&TELE_CRITSECT); @@ -265,11 +267,11 @@ void OnMapDraw() static POINT hPos3; if(it == TelePath.begin()) { ExScreen::ScreenToAutomap(&hPos3, Me->pPath->xPos,Me->pPath->yPos); - D2Funcs::D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x9B,0); + D2Funcs.D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x9B,0); } if(it+1 != TelePath.end()) { ExScreen::ScreenToAutomap(&hPos3, (it+1)->x, (it+1)->y); - D2Funcs::D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x9B,0); + D2Funcs.D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x9B,0); } } @@ -281,7 +283,7 @@ for(deque::const_iterator it = HistoryPos.begin(); it!=HistoryPos.end(); if(it+1 != HistoryPos.end()) { ExScreen::ScreenToAutomap(&hPos3, (it+1)->x, (it+1)->y); - D2Funcs::D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x84,0); + D2Funcs.D2GFX_DrawLine(hPos2.x,hPos2.y,hPos3.x,hPos3.y,0x84,0); } } LeaveCriticalSection(&TELE_CRITSECT); @@ -296,44 +298,44 @@ void __fastcall ExScreen::DrawAutoMapInfo(int OldTextSize) if (PVMStuff) { - int LocId = D2Funcs::D2LANG_GetLocaleId(); - unsigned int CExp = D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(), STAT_EXPERIENCE, 0); + int LocId = D2Funcs.D2LANG_GetLocaleId(); + unsigned int CExp = D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(), STAT_EXPERIENCE, 0); wchar_t wExp[100] = { 0 }; int ExpGained = CExp - ExpAtJoin; Misc::ConvertIntegers(ExpGained, wExp); wchar_t wExp2[100] = { 0 }; swprintf_s(wExp2, 100, LocId == LOCALE_POL ? L"Do�wiadczenie: %s%s" : L"Experience: %s%s", GetColorCode(COL_YELLOW).c_str(), wExp); int wSize = ExScreen::GetTextWidth(wExp2); - D2Funcs::D2WIN_DrawText(wExp2, *D2Vars::D2CLIENT_ScreenWidth - wSize - 16, *D2Vars::D2CLIENT_AutomapInfoY, 4, 0); - *D2Vars::D2CLIENT_AutomapInfoY += 16; + D2Funcs.D2WIN_DrawText(wExp2, *D2Vars.D2CLIENT_ScreenWidth - wSize - 16, *D2Vars.D2CLIENT_AutomapInfoY, 4, 0); + *D2Vars.D2CLIENT_AutomapInfoY += 16; - int DExp = D2Funcs::D2COMMON_GetExpToAchiveLvl(0, D2Funcs::D2COMMON_GetStatSigned(D2Funcs::D2CLIENT_GetPlayer(), STAT_LEVEL, 0)) - ExpAtJoin; + int DExp = D2Funcs.D2COMMON_GetExpToAchiveLvl(0, D2Funcs.D2COMMON_GetStatSigned(D2Funcs.D2CLIENT_GetPlayer(), STAT_LEVEL, 0)) - ExpAtJoin; int GExp = 0; if (ExpGained) GExp = Misc::round(DExp / (float)ExpGained); wchar_t wGames[70] = { 0 }; swprintf_s(wGames, 70, LocId == LOCALE_POL ? L"Gier do poziomu %s%d" : L"Games To Level: %s%d", GetColorCode(COL_YELLOW).c_str(), GExp); int wSize2 = ExScreen::GetTextWidth(wGames); - D2Funcs::D2WIN_DrawText(wGames, *D2Vars::D2CLIENT_ScreenWidth - wSize2 - 16, *D2Vars::D2CLIENT_AutomapInfoY, 4, 0); - *D2Vars::D2CLIENT_AutomapInfoY += 16; + D2Funcs.D2WIN_DrawText(wGames, *D2Vars.D2CLIENT_ScreenWidth - wSize2 - 16, *D2Vars.D2CLIENT_AutomapInfoY, 4, 0); + *D2Vars.D2CLIENT_AutomapInfoY += 16; } int secs = TickAtJoin ? (GetTickCount() - TickAtJoin ) / 1000 : 0; wostringstream wTime; wTime << setfill(L'0') << setw(2) << secs/3600 << L':' << setfill(L'0') << setw(2) << (secs/60)%60 << L':' << setfill(L'0') << setw(2) << secs%60; int wSize3 = ExScreen::GetTextWidth(wTime.str().c_str()); - D2Funcs::D2WIN_DrawText(wTime.str().c_str(), *D2Vars::D2CLIENT_ScreenWidth - wSize3 - 16, *D2Vars::D2CLIENT_AutomapInfoY, 4, 0); - *D2Vars::D2CLIENT_AutomapInfoY+=16; - D2Funcs::D2WIN_SetTextSize(OldTextSize); + D2Funcs.D2WIN_DrawText(wTime.str().c_str(), *D2Vars.D2CLIENT_ScreenWidth - wSize3 - 16, *D2Vars.D2CLIENT_AutomapInfoY, 4, 0); + *D2Vars.D2CLIENT_AutomapInfoY+=16; + D2Funcs.D2WIN_SetTextSize(OldTextSize); } void __fastcall ExScreen::ColorItems(wchar_t* szName, UnitAny* ptItem) { static wchar_t iTxt[64] = L""; - ItemsTxt* pTxt = D2Funcs::D2COMMON_GetItemText(ptItem->dwClassId); - wchar_t* wName = szName;// D2Funcs::D2LANG_GetLocaleText(pTxt->wnamestr); + ItemsTxt* pTxt = D2Funcs.D2COMMON_GetItemText(ptItem->dwClassId); + wchar_t* wName = szName;// D2Funcs.D2LANG_GetLocaleText(pTxt->wnamestr); BYTE ColNo = 0; - int SockNo = D2Funcs::D2COMMON_GetItemFlag(ptItem,ITEMFLAG_SOCKETED,__LINE__,__FILE__) ? D2Funcs::D2COMMON_GetStatSigned(ptItem, STAT_ITEM_NUMSOCKETS, 0) : 0 ; + int SockNo = D2Funcs.D2COMMON_GetItemFlag(ptItem,ITEMFLAG_SOCKETED,__LINE__,__FILE__) ? D2Funcs.D2COMMON_GetStatSigned(ptItem, STAT_ITEM_NUMSOCKETS, 0) : 0 ; switch(ptItem->pItemData->QualityNo) { case ITEM_LOW: @@ -364,7 +366,7 @@ void __fastcall ExScreen::ColorItems(wchar_t* szName, UnitAny* ptItem) if(pTxt->wtype==74) ColNo = 8; // 74 = RUNE, 82, 84 = GC/ SC if(pTxt->bquest) ColNo = COL_DARK_GOLD; - BOOL isEth = D2Funcs::D2COMMON_GetItemFlag(ptItem,ITEMFLAG_ETHEREAL,__LINE__,__FILE__); + BOOL isEth = D2Funcs.D2COMMON_GetItemFlag(ptItem,ITEMFLAG_ETHEREAL,__LINE__,__FILE__); for(vector::iterator i = ItemArray.begin(); i!=ItemArray.end(); i++) { @@ -389,14 +391,14 @@ void __fastcall ExScreen::ColorItems(wchar_t* szName, UnitAny* ptItem) wchar_t* GetMonsterName(unsigned int MonIdx) { - sgptDataTable* Tbl = *D2Vars::D2COMMON_sgptDataTables; + sgptDataTable* Tbl = *D2Vars.D2COMMON_sgptDataTables; if(MonIdx>(unsigned int)Tbl->dwMonStatsRecs) return L"N/A"; - else return D2Funcs::D2LANG_GetLocaleText(Tbl->pMonStatsTxt[MonIdx].wNameStr); + else return D2Funcs.D2LANG_GetLocaleText(Tbl->pMonStatsTxt[MonIdx].wNameStr); } wchar_t* GetDyeCol(int Col) { -int LocId = D2Funcs::D2LANG_GetLocaleId(); +int LocId = D2Funcs.D2LANG_GetLocaleId(); if(LocId==10) { switch(Col) @@ -447,13 +449,13 @@ return 0; void __stdcall ExScreen::DrawProperties(wchar_t *wTxt) { - int LocId = D2Funcs::D2LANG_GetLocaleId(); - UnitAny* ptItem = *D2Vars::D2CLIENT_SelectedItem; + int LocId = D2Funcs.D2LANG_GetLocaleId(); + UnitAny* ptItem = *D2Vars.D2CLIENT_SelectedItem; if(!ptItem) return; //if(ptItem->pItemData->QualityNo == ItemQ::Set) return; int iLvl = ptItem->pItemData->ItemLevel; int aLen = 0; - int aCol = D2Funcs::D2COMMON_GetStatSigned(ptItem,183,0); + int aCol = D2Funcs.D2COMMON_GetStatSigned(ptItem,183,0); if(aCol) { aLen = wcslen(wTxt); @@ -465,7 +467,7 @@ void __stdcall ExScreen::DrawProperties(wchar_t *wTxt) swprintf_s(wTxt+aLen,1024-aLen,L"%sColor: %s\n",GetColorCode(COL_PURPLE).c_str(),GetDyeCol(aCol)); } } - int aLvl = D2Funcs::D2COMMON_GetStatSigned(ptItem,184,0); + int aLvl = D2Funcs.D2COMMON_GetStatSigned(ptItem,184,0); if(aLvl) { aLen = wcslen(wTxt); @@ -493,121 +495,121 @@ void __stdcall ExScreen::DrawProperties(wchar_t *wTxt) void ExScreen::DrawResInfo() { - UnitAny * ptUnit = D2Funcs::D2CLIENT_GetPlayer(); + UnitAny * ptUnit = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(ptUnit) - int mX = *D2Vars::D2CLIENT_MouseX; - int mY = *D2Vars::D2CLIENT_MouseY; + int mX = *D2Vars.D2CLIENT_MouseX; + int mY = *D2Vars.D2CLIENT_MouseY; signed int nRes = 0; - static int LocId = D2Funcs::D2LANG_GetLocaleId(); - if(!*D2Vars::D2CLIENT_isExpansion) { //Classic handle - if(*D2Vars::D2CLIENT_ServerDifficulty == 1) nRes = -20; - else if(*D2Vars::D2CLIENT_ServerDifficulty == 2) nRes = -50; + static int LocId = D2Funcs.D2LANG_GetLocaleId(); + if(!*D2Vars.D2CLIENT_isExpansion) { //Classic handle + if(*D2Vars.D2CLIENT_ServerDifficulty == 1) nRes = -20; + else if(*D2Vars.D2CLIENT_ServerDifficulty == 2) nRes = -50; } else { - if(*D2Vars::D2CLIENT_ServerDifficulty == 1) nRes = -40; - else if(*D2Vars::D2CLIENT_ServerDifficulty == 2) nRes = -100; + if(*D2Vars.D2CLIENT_ServerDifficulty == 1) nRes = -40; + else if(*D2Vars.D2CLIENT_ServerDifficulty == 2) nRes = -100; } if(mX>256 && mX<391 && mY>395 && mY<412) //Fire Res { - nRes+= D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_FIRERESIST,0); + nRes+= D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_FIRERESIST,0); wostringstream wInfo; wInfo << (LocId == 10? L"Ca�kowita odporno��: " : L"Stacked resistance: ") << GetColorCode(COL_RED) << nRes ; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); } else if(mX>256 && mX<391 && mY>418 && mY<435) //Cold Res { - nRes+= D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_COLDRESIST,0); + nRes+= D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_COLDRESIST,0); wostringstream wInfo; wInfo << (LocId == 10? L"Ca�kowita odporno��: " : L"Stacked resistance: ") << GetColorCode(COL_BLUE) << nRes ; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); } else if(mX>256 && mX<391 && mY>442 && mY<460) //Light Res { - nRes+= D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_LIGHTRESIST,0); + nRes+= D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_LIGHTRESIST,0); wostringstream wInfo; wInfo << (LocId == 10? L"Ca�kowita odporno��: " : L"Stacked resistance: ") << GetColorCode(COL_YELLOW) << nRes ; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); } else if(mX>256 && mX<391 && mY>465 && mY<482) //Poison Res { - nRes+= D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_POISONRESIST,0); + nRes+= D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_POISONRESIST,0); wostringstream wInfo; wInfo << (LocId == 10? L"Ca�kowita odporno��: " : L"Stacked resistance: ") << GetColorCode(COL_LIGHTGREEN) << nRes ; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(),252,390,0,2,COL_WHITE); } ExScreen::DrawDmg(); } void ExScreen::DrawBreakpoints() { - int mX = *D2Vars::D2CLIENT_MouseX; - int mY = *D2Vars::D2CLIENT_MouseY; - UnitAny * ptUnit = D2Funcs::D2CLIENT_GetPlayer(); + int mX = *D2Vars.D2CLIENT_MouseX; + int mY = *D2Vars.D2CLIENT_MouseY; + UnitAny * ptUnit = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(ptUnit) - D2Funcs::D2WIN_SetTextSize(6); - ExScreen::DrawTextEx(116, *D2Vars::D2CLIENT_ScreenHeight - 193, COL_WHITE, 0, 5, L"FCR"); - ExScreen::DrawTextEx(116, *D2Vars::D2CLIENT_ScreenHeight - 169, COL_WHITE, 0, 5, L"FHR"); - ExScreen::DrawTextEx(115, *D2Vars::D2CLIENT_ScreenHeight - 145, COL_WHITE, 0, 5, L"FRW"); - ExScreen::DrawTextEx(118, *D2Vars::D2CLIENT_ScreenHeight - 121, COL_WHITE, 0, 5, L"IAS"); + D2Funcs.D2WIN_SetTextSize(6); + ExScreen::DrawTextEx(116, *D2Vars.D2CLIENT_ScreenHeight - 193, COL_WHITE, 0, 5, L"FCR"); + ExScreen::DrawTextEx(116, *D2Vars.D2CLIENT_ScreenHeight - 169, COL_WHITE, 0, 5, L"FHR"); + ExScreen::DrawTextEx(115, *D2Vars.D2CLIENT_ScreenHeight - 145, COL_WHITE, 0, 5, L"FRW"); + ExScreen::DrawTextEx(118, *D2Vars.D2CLIENT_ScreenHeight - 121, COL_WHITE, 0, 5, L"IAS"); - int nFCR = D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERCASTRATE,0); - int nFHR = D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERGETHITRATE,0); - int nFRW = D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERMOVEVELOCITY,0); - int nIAS = D2Funcs::D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERATTACKRATE,0); + int nFCR = D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERCASTRATE,0); + int nFHR = D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERGETHITRATE,0); + int nFRW = D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERMOVEVELOCITY,0); + int nIAS = D2Funcs.D2COMMON_GetStatSigned(ptUnit,STAT_ITEM_FASTERATTACKRATE,0); - D2Funcs::D2WIN_SetTextSize(1); + D2Funcs.D2WIN_SetTextSize(1); wostringstream wTxt; wTxt << nFCR; int nLen = ExScreen::GetTextWidth(wTxt.str().c_str()); int xPos = 177 - (nLen /2); - D2Funcs::D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars::D2CLIENT_ScreenHeight - 192, COL_DARK_GOLD, 0); + D2Funcs.D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars.D2CLIENT_ScreenHeight - 192, COL_DARK_GOLD, 0); wTxt.str(L""); wTxt << nFHR; nLen = ExScreen::GetTextWidth(wTxt.str().c_str()); xPos = 177 - (nLen /2); - D2Funcs::D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars::D2CLIENT_ScreenHeight - 168, COL_DARK_GOLD, 0); + D2Funcs.D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars.D2CLIENT_ScreenHeight - 168, COL_DARK_GOLD, 0); wTxt.str(L""); wTxt << nFRW; nLen = ExScreen::GetTextWidth(wTxt.str().c_str()); xPos = 177 - (nLen /2); - D2Funcs::D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars::D2CLIENT_ScreenHeight - 144, COL_DARK_GOLD, 0); + D2Funcs.D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars.D2CLIENT_ScreenHeight - 144, COL_DARK_GOLD, 0); wTxt.str(L""); wTxt << nIAS; nLen = ExScreen::GetTextWidth(wTxt.str().c_str()); xPos = 177 - (nLen /2); - D2Funcs::D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars::D2CLIENT_ScreenHeight - 120, COL_DARK_GOLD, 0); - D2Funcs::D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawText(wTxt.str().c_str(), xPos, *D2Vars.D2CLIENT_ScreenHeight - 120, COL_DARK_GOLD, 0); + D2Funcs.D2WIN_SetTextSize(0); } void ExScreen::DrawDmg() { - int mX = *D2Vars::D2CLIENT_MouseX; - int mY = *D2Vars::D2CLIENT_MouseY; - UnitAny * ptUnit = D2Funcs::D2CLIENT_GetPlayer(); + int mX = *D2Vars.D2CLIENT_MouseX; + int mY = *D2Vars.D2CLIENT_MouseY; + UnitAny * ptUnit = D2Funcs.D2CLIENT_GetPlayer(); ASSERT(ptUnit) - static int LocId = D2Funcs::D2LANG_GetLocaleId(); - if (mX > 240 && mX < 394 && mY > (*D2Vars::D2CLIENT_ScreenHeight - 455) && mY < (*D2Vars::D2CLIENT_ScreenHeight - 435)) + static int LocId = D2Funcs.D2LANG_GetLocaleId(); + if (mX > 240 && mX < 394 && mY > (*D2Vars.D2CLIENT_ScreenHeight - 455) && mY < (*D2Vars.D2CLIENT_ScreenHeight - 435)) { - Skill * ptSkill = D2Funcs::D2COMMON_GetLeftSkill(ptUnit); + Skill * ptSkill = D2Funcs.D2COMMON_GetLeftSkill(ptUnit); ASSERT(ptSkill) - BYTE * pSkillTxt = D2Funcs::D2CLIENT_GetSkillsTxt(ptSkill->pSkillsTxt->wSkillId); + BYTE * pSkillTxt = D2ASMFuncs::D2CLIENT_GetSkillsTxt(ptSkill->pSkillsTxt->wSkillId); ASSERT(pSkillTxt) - int sId = D2Funcs::D2COMMON_GetSkillId(ptSkill,__FILE__,__LINE__); - int sLvl = D2Funcs::D2COMMON_GetSkillLevel(ptUnit,ptSkill,1); - int sBonus = D2Funcs::D2COMMON_GetSkillDmgBonus(ptUnit,*((DWORD*)pSkillTxt+6),sId,sLvl); + int sId = D2Funcs.D2COMMON_GetSkillId(ptSkill,__FILE__,__LINE__); + int sLvl = D2Funcs.D2COMMON_GetSkillLevel(ptUnit,ptSkill,1); + int sBonus = D2Funcs.D2COMMON_GetSkillDmgBonus(ptUnit,*((DWORD*)pSkillTxt+6),sId,sLvl); int sBonusMax = 0; int MinDmg = 0; @@ -615,16 +617,16 @@ void ExScreen::DrawDmg() int Col = 0; if(sId==0 || sId==22 || sId ==10 || sId == 151 || sId == 152 || sId == 144) { - D2Funcs::D2CLIENT_GetMeleeDmg(ptUnit,sBonus,&MinDmg,&MaxDmg,&Col,0,ptSkill,0,0,0); - D2Funcs::D2CLIENT_GetItemEleDmg(ptUnit,&MinDmg,&MaxDmg,&Col,ptSkill); + D2ASMFuncs::D2CLIENT_GetMeleeDmg(ptUnit,sBonus,&MinDmg,&MaxDmg,&Col,0,ptSkill,0,0,0); + D2Funcs.D2CLIENT_GetItemEleDmg(ptUnit,&MinDmg,&MaxDmg,&Col,ptSkill); } else { - MinDmg = D2Funcs::D2COMMON_GetPhysMinDmg(ptUnit,sId,sLvl,0) >> 8; - MaxDmg = D2Funcs::D2COMMON_GetPhysMaxDmg(ptUnit,sId,sLvl,0) >> 8; + MinDmg = D2Funcs.D2COMMON_GetPhysMinDmg(ptUnit,sId,sLvl,0) >> 8; + MaxDmg = D2Funcs.D2COMMON_GetPhysMaxDmg(ptUnit,sId,sLvl,0) >> 8; - int pEleMin = D2Funcs::D2COMMON_GetEleMinDmg(ptUnit,sId,sLvl,1) >>8; - int pEleMax = D2Funcs::D2COMMON_GetEleMaxDmg(ptUnit,sId,sLvl,1) >>8; + int pEleMin = D2Funcs.D2COMMON_GetEleMinDmg(ptUnit,sId,sLvl,1) >>8; + int pEleMax = D2Funcs.D2COMMON_GetEleMaxDmg(ptUnit,sId,sLvl,1) >>8; MinDmg+=pEleMin; MaxDmg+=pEleMax; @@ -638,20 +640,20 @@ void ExScreen::DrawDmg() { wostringstream wInfo; wInfo << (LocId == 10? L"�rednie Obra�enia: " :L"Average Damage: ") << GetColorCode(COL_YELLOW) << AvgDmg; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(), 242, *D2Vars::D2CLIENT_ScreenHeight - 458, 0, 2, COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(), 242, *D2Vars.D2CLIENT_ScreenHeight - 458, 0, 2, COL_WHITE); } } - else if (mX>240 && mX<394 && mY>(*D2Vars::D2CLIENT_ScreenHeight - 430) && mY<(*D2Vars::D2CLIENT_ScreenHeight - 410)) + else if (mX>240 && mX<394 && mY>(*D2Vars.D2CLIENT_ScreenHeight - 430) && mY<(*D2Vars.D2CLIENT_ScreenHeight - 410)) { - Skill * ptSkill = D2Funcs::D2COMMON_GetRightSkill(ptUnit); + Skill * ptSkill = D2Funcs.D2COMMON_GetRightSkill(ptUnit); ASSERT(ptSkill) - BYTE * pSkillTxt = D2Funcs::D2CLIENT_GetSkillsTxt(ptSkill->pSkillsTxt->wSkillId); + BYTE * pSkillTxt = D2ASMFuncs::D2CLIENT_GetSkillsTxt(ptSkill->pSkillsTxt->wSkillId); ASSERT(pSkillTxt) - int sId = D2Funcs::D2COMMON_GetSkillId(ptSkill,__FILE__,__LINE__); - int sLvl = D2Funcs::D2COMMON_GetSkillLevel(ptUnit,ptSkill,1); - int sBonus = D2Funcs::D2COMMON_GetSkillDmgBonus(ptUnit,*((DWORD*)pSkillTxt+6),sId,sLvl); + int sId = D2Funcs.D2COMMON_GetSkillId(ptSkill,__FILE__,__LINE__); + int sLvl = D2Funcs.D2COMMON_GetSkillLevel(ptUnit,ptSkill,1); + int sBonus = D2Funcs.D2COMMON_GetSkillDmgBonus(ptUnit,*((DWORD*)pSkillTxt+6),sId,sLvl); int sBonusMax = 0; int MinDmg = 0; @@ -659,16 +661,16 @@ void ExScreen::DrawDmg() int Col = 0; if(sId==0 || sId==22 || sId ==10 || sId == 151 || sId == 152 || sId == 144) { - D2Funcs::D2CLIENT_GetMeleeDmg(ptUnit,sBonus,&MinDmg,&MaxDmg,&Col,0,ptSkill,0,0,0); - D2Funcs::D2CLIENT_GetItemEleDmg(ptUnit,&MinDmg,&MaxDmg,&Col,ptSkill); + D2ASMFuncs::D2CLIENT_GetMeleeDmg(ptUnit,sBonus,&MinDmg,&MaxDmg,&Col,0,ptSkill,0,0,0); + D2Funcs.D2CLIENT_GetItemEleDmg(ptUnit,&MinDmg,&MaxDmg,&Col,ptSkill); } else { - MinDmg = D2Funcs::D2COMMON_GetPhysMinDmg(ptUnit,sId,sLvl,0) >> 8; - MaxDmg = D2Funcs::D2COMMON_GetPhysMaxDmg(ptUnit,sId,sLvl,0) >> 8; + MinDmg = D2Funcs.D2COMMON_GetPhysMinDmg(ptUnit,sId,sLvl,0) >> 8; + MaxDmg = D2Funcs.D2COMMON_GetPhysMaxDmg(ptUnit,sId,sLvl,0) >> 8; - int pEleMin = D2Funcs::D2COMMON_GetEleMinDmg(ptUnit,sId,sLvl,1) >>8; - int pEleMax = D2Funcs::D2COMMON_GetEleMaxDmg(ptUnit,sId,sLvl,1) >>8; + int pEleMin = D2Funcs.D2COMMON_GetEleMinDmg(ptUnit,sId,sLvl,1) >>8; + int pEleMax = D2Funcs.D2COMMON_GetEleMaxDmg(ptUnit,sId,sLvl,1) >>8; MinDmg+=pEleMin; MaxDmg+=pEleMax; @@ -682,8 +684,8 @@ void ExScreen::DrawDmg() { wostringstream wInfo; wInfo << (LocId == 10? L"�rednie Obra�enia: " :L"Average Damage: ") << GetColorCode(COL_YELLOW) << AvgDmg; - D2Funcs::D2WIN_SetTextSize(0); - D2Funcs::D2WIN_DrawRectangledText(wInfo.str().c_str(), 242, *D2Vars::D2CLIENT_ScreenHeight - 437, 0, 2, COL_WHITE); + D2Funcs.D2WIN_SetTextSize(0); + D2Funcs.D2WIN_DrawRectangledText(wInfo.str().c_str(), 242, *D2Vars.D2CLIENT_ScreenHeight - 437, 0, 2, COL_WHITE); } } } @@ -696,10 +698,10 @@ void DrawCircle(int x0, int y0, int radius, int Color) int x = 0; int y = radius; - D2Funcs::D2GFX_DrawLine(x0, y0 + radius,x0, y0 - radius,Color,-1); - //D2Funcs::D2GFX_DrawLine(x0, y0 - radius,x0, y0 - radius,Color,-1); - D2Funcs::D2GFX_DrawLine(x0 + radius, y0, x0 - radius, y0, Color, -1); - // D2Funcs::D2GFX_DrawLine(x0 - radius, y0, x0 - radius, y0, Color, -1); + D2Funcs.D2GFX_DrawLine(x0, y0 + radius,x0, y0 - radius,Color,-1); + //D2Funcs.D2GFX_DrawLine(x0, y0 - radius,x0, y0 - radius,Color,-1); + D2Funcs.D2GFX_DrawLine(x0 + radius, y0, x0 - radius, y0, Color, -1); + // D2Funcs.D2GFX_DrawLine(x0 - radius, y0, x0 - radius, y0, Color, -1); while(x < y) { @@ -715,14 +717,14 @@ void DrawCircle(int x0, int y0, int radius, int Color) x++; ddF_x += 2; f += ddF_x; - D2Funcs::D2GFX_DrawLine(x0 + x, y0 + y,x0 - x, y0 + y, Color,-1); - //D2Funcs::D2GFX_DrawLine(x0 - x, y0 + y,x0 - x, y0 + y, Color,-1); - D2Funcs::D2GFX_DrawLine(x0 + x, y0 - y,x0 - x, y0 - y, Color,-1); - //D2Funcs::D2GFX_DrawLine(x0 - x, y0 - y,x0 - x, y0 - y, Color,-1); - D2Funcs::D2GFX_DrawLine(x0 + y, y0 + x,x0 - y, y0 + x, Color,-1); - //D2Funcs::D2GFX_DrawLine(x0 - y, y0 + x,x0 - y, y0 + x, Color,-1); - D2Funcs::D2GFX_DrawLine(x0 + y, y0 - x,x0 - y, y0 - x, Color,-1); - //D2Funcs::D2GFX_DrawLine(x0 - y, y0 - x,x0 - y, y0 - x, Color,-1); + D2Funcs.D2GFX_DrawLine(x0 + x, y0 + y,x0 - x, y0 + y, Color,-1); + //D2Funcs.D2GFX_DrawLine(x0 - x, y0 + y,x0 - x, y0 + y, Color,-1); + D2Funcs.D2GFX_DrawLine(x0 + x, y0 - y,x0 - x, y0 - y, Color,-1); + //D2Funcs.D2GFX_DrawLine(x0 - x, y0 - y,x0 - x, y0 - y, Color,-1); + D2Funcs.D2GFX_DrawLine(x0 + y, y0 + x,x0 - y, y0 + x, Color,-1); + //D2Funcs.D2GFX_DrawLine(x0 - y, y0 + x,x0 - y, y0 + x, Color,-1); + D2Funcs.D2GFX_DrawLine(x0 + y, y0 - x,x0 - y, y0 - x, Color,-1); + //D2Funcs.D2GFX_DrawLine(x0 - y, y0 - x,x0 - y, y0 - x, Color,-1); } } @@ -735,7 +737,7 @@ static int R = 2*h/3; char szLines[][2] = {0,-2, 4,-4, 8,-2, 4,0, 8,2, 4,4, 0,2, -4,4, -8,2, -4,0, -8,-2, -4,-4, 0,-2}; - if(*D2Vars::D2CLIENT_MapType==1) // if SMALLMAP + if(*D2Vars.D2CLIENT_MapType==1) // if SMALLMAP { X--; Y+=5; @@ -744,40 +746,40 @@ char szLines[][2] = {0,-2, 4,-4, 8,-2, 4,0, 8,2, 4,4, 0,2, -4,4, -8,2, -4,0, -8, switch(BlobType) { case 0: - D2Funcs::D2GFX_DrawRectangle(X-1,Y-1,X+1,Y+1,Color,5); + D2Funcs.D2GFX_DrawRectangle(X-1,Y-1,X+1,Y+1,Color,5); break; case 1: DrawCircle(X,Y, 2, Color); break; default: -for(int x = 0; x < 12; x++) D2Funcs::D2GFX_DrawLine(X + szLines[x][0], Y + szLines[x][1], X + szLines[x+1][0], Y + szLines[x+1][1], Color, -1); +for(int x = 0; x < 12; x++) D2Funcs.D2GFX_DrawLine(X + szLines[x][0], Y + szLines[x][1], X + szLines[x+1][0], Y + szLines[x+1][1], Color, -1); break; } } BYTE * __stdcall ExScreen::DrawItem(UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4) { - int col = D2Funcs::D2COMMON_GetStatSigned(ptItem,183,0); + int col = D2Funcs.D2COMMON_GetStatSigned(ptItem,183,0); if(col) { - ItemsTxt* pTxt = D2Funcs::D2COMMON_GetItemText(ptItem->dwClassId); + ItemsTxt* pTxt = D2Funcs.D2COMMON_GetItemText(ptItem->dwClassId); *out= GetDyeRealCol(col); - return D2Funcs::D2CMP_MixPalette(a4 ? pTxt->bInvTrans : pTxt->bTransform,GetDyeRealCol(col)); + return D2Funcs.D2CMP_MixPalette(a4 ? pTxt->bInvTrans : pTxt->bTransform,GetDyeRealCol(col)); } - //ItemsTxt* pTxt = D2Funcs::D2COMMON_GetItemText(ptItem->dwClassId); + //ItemsTxt* pTxt = D2Funcs.D2COMMON_GetItemText(ptItem->dwClassId); //wostringstream str; - //str << D2Funcs::D2LANG_GetLocaleText(pTxt->wnamestr); + //str << D2Funcs.D2LANG_GetLocaleText(pTxt->wnamestr); //Misc::Log(L"Przedmiot %s \t Quality %d \t Trans %d \t InvTrans %d",str.str().c_str(),ptItem->pItemData->QualityNo,pTxt->bTransform,pTxt->bInvTrans); - return D2Funcs::D2COMMON_GetItemColor(ptPlayer,ptItem,out,a4); + return D2Funcs.D2COMMON_GetItemColor(ptPlayer,ptItem,out,a4); } BOOL __stdcall ExScreen::OnALTDraw(UnitAny *ptItem) { - ItemsTxt* pTxt = D2Funcs::D2COMMON_GetItemText(ptItem->dwClassId); + ItemsTxt* pTxt = D2Funcs.D2COMMON_GetItemText(ptItem->dwClassId); int dwCode = pTxt->dwcode; - if(HideGold && dwCode == ' dlg' && D2Funcs::D2COMMON_GetStatSigned(ptItem,STAT_GOLD,0)>10000) return TRUE; + if(HideGold && dwCode == ' dlg' && D2Funcs.D2COMMON_GetStatSigned(ptItem,STAT_GOLD,0)>10000) return TRUE; if(!HideGold && dwCode == ' dlg') return TRUE; if(HideGold && dwCode == ' dlg') return FALSE; if(pTxt->wtype == 74) return TRUE; diff --git a/ExScrollBar.cpp b/ExScrollBar.cpp index 53f9d58..b6f7fcb 100644 --- a/ExScrollBar.cpp +++ b/ExScrollBar.cpp @@ -90,7 +90,7 @@ void ExScrollBar::Draw() if (cState == INVISIBLE) return; for (int ty = cY + 22; ty < cY + cHeight; ty += 12) { - D2Funcs::D2GFX_DrawCellContextEx(aCellFile->Get(), cX, ty, -1, 5, 0); + D2Funcs.D2GFX_DrawCellContextEx(aCellFile->Get(), cX, ty, -1, 5, 0); } } diff --git a/ExSpectator.cpp b/ExSpectator.cpp index 24531ee..eeea370 100644 --- a/ExSpectator.cpp +++ b/ExSpectator.cpp @@ -13,7 +13,7 @@ if(!mX && !mY) return 0; inp.mi.dx=p->Coords.x; inp.mi.dy=p->Coords.y; SendInput(1, &inp, sizeof(INPUT));*/ -*D2Vars::D2CLIENT_MouseX=mX; -*D2Vars::D2CLIENT_MouseY=mY; +*D2Vars.D2CLIENT_MouseX=mX; +*D2Vars.D2CLIENT_MouseY=mY; return 0; } \ No newline at end of file diff --git a/ExTextBox.cpp b/ExTextBox.cpp index faec2c8..e3fb4b9 100644 --- a/ExTextBox.cpp +++ b/ExTextBox.cpp @@ -94,23 +94,23 @@ EnterCriticalSection(&CON_CRITSECT); bool erased = false; wstring szLabel = sLabel; -int OldFont = *D2Vars::D2WIN_CurrentFont; -D2Funcs::D2WIN_SetTextSize(aFont); +int OldFont = *D2Vars.D2WIN_CurrentFont; +D2Funcs.D2WIN_SetTextSize(aFont); for(wstring::iterator temp = szLabel.end(); temp!=szLabel.begin(); --temp) { cWidth = ExScreen::GetTextWidth(szLabel.c_str()); -if(cWidth<=(ptParent ? ptParent->GetWidth() : *D2Vars::D2CLIENT_ScreenWidth)) break; +if(cWidth<=(ptParent ? ptParent->GetWidth() : *D2Vars.D2CLIENT_ScreenWidth)) break; szLabel.erase(temp); erased = true; } if(erased) {szLabel.erase(szLabel.length()-3); szLabel+=L"..."; cWidth = ExScreen::GetTextWidth(szLabel.c_str());} -cHeight = D2Funcs::D2WIN_GetFontHeight(); +cHeight = D2Funcs.D2WIN_GetFontHeight(); Relocate(); Label = szLabel; -D2Funcs::D2WIN_SetTextSize(OldFont); +D2Funcs.D2WIN_SetTextSize(OldFont); LeaveCriticalSection(&CON_CRITSECT); } @@ -146,10 +146,10 @@ void ExTextBox::Relocate() //- Set control align else if(hAlign == RIGHT) cY=ptParent->GetY()+ptParent->GetHeight(); } else { - if(wAlign == CENTER) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth)/2; - else if(wAlign == RIGHT) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth); - if(hAlign == CENTER) cY=(*D2Vars::D2CLIENT_ScreenHeight+cHeight)/2; - else if(hAlign == RIGHT) cY=*D2Vars::D2CLIENT_ScreenHeight; + if(wAlign == CENTER) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth)/2; + else if(wAlign == RIGHT) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth); + if(hAlign == CENTER) cY=(*D2Vars.D2CLIENT_ScreenHeight+cHeight)/2; + else if(hAlign == RIGHT) cY=*D2Vars.D2CLIENT_ScreenHeight; } } @@ -183,18 +183,18 @@ if(cfLabel) SetText(cfLabel(this)); else if (cfsLabel) SetText(cfsLabel(this)); if(Label.empty()) return; -D2Funcs::D2WIN_SetTextSize(aFont); +D2Funcs.D2WIN_SetTextSize(aFont); if(cState==VISIBLE) { -D2Funcs::D2WIN_DrawTextEx(Label.c_str(),cX,cY,bBeingPressed ? bBeingSelected ? COL_RED : COL_WHITE : (TextColor - (bHoverable ? bBeingSelected ? COL_RED : COL_WHITE : COL_WHITE)) ,0,TransLvl); +D2Funcs.D2WIN_DrawTextEx(Label.c_str(),cX,cY,bBeingPressed ? bBeingSelected ? COL_RED : COL_WHITE : (TextColor - (bHoverable ? bBeingSelected ? COL_RED : COL_WHITE : COL_WHITE)) ,0,TransLvl); if(Hoover.empty()) return; if(!bBeingSelected) return; -D2Funcs::D2WIN_DrawFramedText(Hoover.c_str(),cX,cY-cHeight-10,0,0); +D2Funcs.D2WIN_DrawFramedText(Hoover.c_str(),cX,cY-cHeight-10,0,0); } else if(cState==DISABLED) { -D2Funcs::D2WIN_DrawTextEx(Label.c_str(),cX,cY,5,0,TransLvl); +D2Funcs.D2WIN_DrawTextEx(Label.c_str(),cX,cY,5,0,TransLvl); } } @@ -205,7 +205,7 @@ if(cState==VISIBLE) switch(Sender) { case WM_MOUSEMOVE: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars::D2CLIENT_MouseY<=cY && *D2Vars::D2CLIENT_MouseY>=(cY-cHeight)) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars.D2CLIENT_MouseY<=cY && *D2Vars.D2CLIENT_MouseY>=(cY-cHeight)) { if(event_onClick) { @@ -220,17 +220,17 @@ bBeingSelected=false; } break; case WM_LBUTTONDOWN: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars::D2CLIENT_MouseY<=cY && *D2Vars::D2CLIENT_MouseY>=(cY-cHeight)) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars.D2CLIENT_MouseY<=cY && *D2Vars.D2CLIENT_MouseY>=(cY-cHeight)) { if(event_onClick) -{D2Funcs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); +{D2ASMFuncs::D2CLIENT_PlaySound(ExSounds::STAND_CLICK); bBeingPressed=true; } return true; } break; case WM_LBUTTONUP: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars::D2CLIENT_MouseY<=cY && *D2Vars::D2CLIENT_MouseY>=(cY-cHeight)) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=(cX+cWidth) && *D2Vars.D2CLIENT_MouseY<=cY && *D2Vars.D2CLIENT_MouseY>=(cY-cHeight)) { if(event_onClick) {event_onClick(this); diff --git a/ExWindow.cpp b/ExWindow.cpp index bb0ccb3..b87df7e 100644 --- a/ExWindow.cpp +++ b/ExWindow.cpp @@ -16,21 +16,21 @@ if(bisTopBar) bMoveable=true; if(!Label.empty()) { for (int i = 0;i<10; i++) { - D2Funcs::D2WIN_SetTextSize(FontTable[i]); + D2Funcs.D2WIN_SetTextSize(FontTable[i]); TextWidth = ExScreen::GetTextWidth(Label.c_str()); aFont = FontTable[i]; - if(aFont==3) TextHeight = 35; else if(aFont==6) TextHeight = 12; else TextHeight = D2Funcs::D2WIN_GetFontHeight(); + if(aFont==3) TextHeight = 35; else if(aFont==6) TextHeight = 12; else TextHeight = D2Funcs.D2WIN_GetFontHeight(); if(cX+TextWidth < (cX+cWidth) && (cY+TextHeight) < (isTopBar ? cY+15 : (cY+cHeight)) ) break; if(i==9){ bDrawText=false; break;} } } else bDrawText=false; -D2Vars::D2CLIENT_BlockedRect->left=cX; -D2Vars::D2CLIENT_BlockedRect->top=cY; -D2Vars::D2CLIENT_BlockedRect->right=cX+cWidth; -D2Vars::D2CLIENT_BlockedRect->bottom=cY+cHeight; -*D2Vars::D2CLIENT_BlockScreen=true; +D2Vars.D2CLIENT_BlockedRect->left=cX; +D2Vars.D2CLIENT_BlockedRect->top=cY; +D2Vars.D2CLIENT_BlockedRect->right=cX+cWidth; +D2Vars.D2CLIENT_BlockedRect->bottom=cY+cHeight; +*D2Vars.D2CLIENT_BlockScreen=true; //#ifdef _DEBUG //Misc::Log(L"-->Stworzylem nowa klase ExWindow '%s'",Label.c_str()); //#endif @@ -43,19 +43,19 @@ if(cState==VISIBLE || cState==DISABLED) { int aColor = cState==1 ? bBeingPressed ? 0x11 : wBarColor : 4; int aColorText = cState==1 ? bBeingPressed ? bisTopBar ? 9 : wTextColor : wTextColor : 15; - D2Funcs::D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,0xF,1); - D2Funcs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+cHeight); + D2Funcs.D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+cHeight,0xF,1); + D2ASMFuncs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+cHeight); if(bisTopBar) { -D2Funcs::D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+15,aColor,2); -D2Funcs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+15); +D2Funcs.D2GFX_DrawRectangle(cX,cY,cX+cWidth,cY+15,aColor,2); +D2ASMFuncs::D2CLIENT_DrawGZBox(cX,cY,cX+cWidth,cY+15); } if(bDrawText) { int TextX=((cX+cX+cWidth)-TextWidth)/2; int TextY=bisTopBar ? ((cY+cY+15)+TextHeight)/2 : cY+TextHeight; - D2Funcs::D2WIN_SetTextSize(aFont); - if(!Label.empty()) D2Funcs::D2WIN_DrawText(Label.c_str(),TextX,TextY,aColorText,0); + D2Funcs.D2WIN_SetTextSize(aFont); + if(!Label.empty()) D2Funcs.D2WIN_DrawText(Label.c_str(),TextX,TextY,aColorText,0); } } } @@ -72,22 +72,22 @@ void ExWindow::SetAlign(Align xAlign, Align yAlign) void ExWindow::Relocate() //- Set control align { - if(wAlign == CENTER) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth)/2; - else if(wAlign == RIGHT) cX=(*D2Vars::D2CLIENT_ScreenWidth-cWidth); - if(hAlign == CENTER) cY=(*D2Vars::D2CLIENT_ScreenHeight-cHeight)/2; - else if(hAlign == RIGHT) cY=*D2Vars::D2CLIENT_ScreenHeight-cHeight; + if(wAlign == CENTER) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth)/2; + else if(wAlign == RIGHT) cX=(*D2Vars.D2CLIENT_ScreenWidth-cWidth); + if(hAlign == CENTER) cY=(*D2Vars.D2CLIENT_ScreenHeight-cHeight)/2; + else if(hAlign == RIGHT) cY=*D2Vars.D2CLIENT_ScreenHeight-cHeight; -D2Vars::D2CLIENT_BlockedRect->left=cX; -D2Vars::D2CLIENT_BlockedRect->top=cY; -D2Vars::D2CLIENT_BlockedRect->right=cX+cWidth; -D2Vars::D2CLIENT_BlockedRect->bottom=cY+cHeight; +D2Vars.D2CLIENT_BlockedRect->left=cX; +D2Vars.D2CLIENT_BlockedRect->top=cY; +D2Vars.D2CLIENT_BlockedRect->right=cX+cWidth; +D2Vars.D2CLIENT_BlockedRect->bottom=cY+cHeight; } void ExWindow::Resize(int NewWidth, int NewHeight) { -D2Vars::D2CLIENT_BlockedRect->right=cX+NewWidth; -D2Vars::D2CLIENT_BlockedRect->bottom=cY+NewHeight; +D2Vars.D2CLIENT_BlockedRect->right=cX+NewWidth; +D2Vars.D2CLIENT_BlockedRect->bottom=cY+NewHeight; cHeight = NewHeight; cWidth = NewWidth; } @@ -115,14 +115,14 @@ if(cState==INVISIBLE) return false; switch(Sender) { case WM_LBUTTONDOWN: -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) { bBeingPressed=true; -if(*D2Vars::D2CLIENT_MouseY<=cY+15) +if(*D2Vars.D2CLIENT_MouseY<=cY+15) { if(!bMoveable) return true; - DragX=*D2Vars::D2CLIENT_MouseX; - DragY=*D2Vars::D2CLIENT_MouseY; + DragX=*D2Vars.D2CLIENT_MouseX; + DragY=*D2Vars.D2CLIENT_MouseY; OldX=cX; OldY=cY; for(vector::size_type i=0 ; i=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) { //if(cX<0 || cWidth>800) {cX=OldX;cWidth=OldX2;} //if(cY<0 || cHeight>600) {cY=OldY;cHeight=OldY2;} -D2Vars::D2CLIENT_BlockedRect->left=cX; -D2Vars::D2CLIENT_BlockedRect->top=cY; -D2Vars::D2CLIENT_BlockedRect->right=cX+cWidth; -D2Vars::D2CLIENT_BlockedRect->bottom=cY+cHeight; +D2Vars.D2CLIENT_BlockedRect->left=cX; +D2Vars.D2CLIENT_BlockedRect->top=cY; +D2Vars.D2CLIENT_BlockedRect->right=cX+cWidth; +D2Vars.D2CLIENT_BlockedRect->bottom=cY+cHeight; bBeingPressed=false; return true; } break; case WM_MOUSEMOVE: if(!(wParam & (MK_LBUTTON | MK_CONTROL))) break; -if(*D2Vars::D2CLIENT_MouseX>=cX && *D2Vars::D2CLIENT_MouseX<=cX+cWidth && *D2Vars::D2CLIENT_MouseY>=cY && *D2Vars::D2CLIENT_MouseY<=cY+cHeight) +if(*D2Vars.D2CLIENT_MouseX>=cX && *D2Vars.D2CLIENT_MouseX<=cX+cWidth && *D2Vars.D2CLIENT_MouseY>=cY && *D2Vars.D2CLIENT_MouseY<=cY+cHeight) { if(wParam & MK_LBUTTON) bBeingPressed=true; -if(bBeingPressed && *D2Vars::D2CLIENT_MouseY<=cY+15 && (wParam & MK_CONTROL) && bMoveable && DragX) +if(bBeingPressed && *D2Vars.D2CLIENT_MouseY<=cY+15 && (wParam & MK_CONTROL) && bMoveable && DragX) { -signed int xOffset = (*D2Vars::D2CLIENT_MouseX - DragX); -signed int yOffset = (*D2Vars::D2CLIENT_MouseY - DragY); +signed int xOffset = (*D2Vars.D2CLIENT_MouseX - DragX); +signed int yOffset = (*D2Vars.D2CLIENT_MouseY - DragY); cX=OldX+xOffset; cY=OldY+yOffset; //cWidth=OldX2+xOffset; @@ -181,7 +181,7 @@ return false; ExWindow::~ExWindow(void) { EnterCriticalSection(&CON_CRITSECT); -*D2Vars::D2CLIENT_BlockScreen=false; +*D2Vars.D2CLIENT_BlockScreen=false; DEBUGMSG(L"-->Zniszczylem ExWindow '%s'",Label.c_str()); } diff --git a/Offset.cpp b/Offset.cpp index a8272a9..d2e216c 100644 --- a/Offset.cpp +++ b/Offset.cpp @@ -18,16 +18,6 @@ DWORD GetDllOffset(const char *dll, int offset) } DWORD GetDllOffset(int num) -{ - DWORD tmp = GetDllOffset(dlls[num&0xff], num>>8); -// Misc::Log("%s : 0x%x", dlls[num&0xff], tmp); - return tmp; +{ + return GetDllOffset(dlls[num & 0xff], num >> 8); } - -void DefineOffsets() -{ - Misc::Log("Defining %d pointers...", ((DWORD*)&_D2PTRS_END - (DWORD*)&_D2PTRS_START) / 4); - DWORD *p = (DWORD *)&_D2PTRS_START; - do *p = GetDllOffset(*p); - while(++p <= (DWORD *)&_D2PTRS_END); -} \ No newline at end of file diff --git a/Offset.h b/Offset.h index 3b3477e..efb6eed 100644 --- a/Offset.h +++ b/Offset.h @@ -1,7 +1,6 @@ #ifndef _OFFSETS_H #define _OFFSETS_H -void DefineOffsets(); DWORD GetDllOffset(int num); DWORD GetDllOffset(const char *dll, int offset); diff --git a/README.md b/README.md index bcbcf8a..0ed01b4 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,16 @@ Features - Created a lot of custom controls, you can use them to create your GUI (ie new party screen) - Supports both 1.11b & 1.13d (set version in stdafx.h) - ExBuffs module let see you states, auras and remaining time -- High resolution support for GDI / GLIDE video modes. +- [WIP] High resolution support for GDI / GLIDE video modes. -Installations +Installation ------------- -Compile Release build using Visual Studio 2008+, (2012 is supported if you select xp vcl libs in project setup) -Visual Studio 2013 is not supported because it's messing with function order and pointers are not defined correctly even without optimizations. -Copy everything to Diablo II directory, D2Win.dll is a loader for D2Ex2.dll +Compile Release build (select configuration for your version) using Visual Studio 2008+, ~~(2012 is supported if you select xp vcl libs in project setup)~~ +~~Visual Studio 2013 is not supported because it's messing with function order and pointers are not defined correctly even without optimizations.~~ <- Now compiles correctly on VS 2013 too :) + +or + +Copy everything from files directory to your Diablo II directory, D2Win.dll is a loader for D2Ex2.dll. If you use prebuild D2Ex2.dll, then you need to install this: http://www.microsoft.com/en-us/download/details.aspx?id=40784 Thanks to ---------- diff --git a/files/D2Ex.ini b/files/1.11b/D2Ex.ini similarity index 100% rename from files/D2Ex.ini rename to files/1.11b/D2Ex.ini diff --git a/files/D2Ex.mpq b/files/1.11b/D2Ex.mpq similarity index 100% rename from files/D2Ex.mpq rename to files/1.11b/D2Ex.mpq diff --git a/files/1.11b/D2Ex2.dll b/files/1.11b/D2Ex2.dll new file mode 100644 index 0000000..d94e39e Binary files /dev/null and b/files/1.11b/D2Ex2.dll differ diff --git a/files/D2Win.dll b/files/1.11b/D2Win.dll similarity index 100% rename from files/D2Win.dll rename to files/1.11b/D2Win.dll diff --git a/files/Patch_D2.mpq b/files/1.11b/Patch_D2.mpq similarity index 100% rename from files/Patch_D2.mpq rename to files/1.11b/Patch_D2.mpq diff --git a/files/1.13d/D2Ex.ini b/files/1.13d/D2Ex.ini new file mode 100644 index 0000000..7b2ceef --- /dev/null +++ b/files/1.13d/D2Ex.ini @@ -0,0 +1,60 @@ +[D2Ex] +BlobType=2 +EnteringFont=7 +MaxPlayers=64 +ServerPort=6112 +PermShowLife=1 +PermShowMana=0 +AutoShowMap=1 +FullVisibility=1 +Maphack=1 +Lagometer=0 +HideGold=1 +HideCrap=1 +BuffsEnabled=1 +BCLvl=18 +BOLvl=30 +SMLvl=15 + +; Colors +; WHITE = 0 +; RED = 1 +; LIGHTGREEN = 2 +; BLUE = 3 +; DARKGOLD = 4 +; GREY = 5 +; BLACK = 6 +; GOLD = 7 +; ORANGE = 8 +; YELLOW = 9 +; DARKGREEN = 10 +; PURPLE = 11 +; GREEN = 12 +; WHITE2 = 13 +; BLACK2 = 14 +; DARKWHITE = 15 + +;Item quality +; WHATEVER = 0 +; LOW = 1 +; NORMAL = 2 +; SUPERIOR = 3 +; MAGIC = 4 +; SET = 5 +; RARE = 6 +; UNIQUE = 7 +; CRAFTED = 8 +; TEMPERED = 9 + + +; Usage : Number = item code, quality, color +; Item codes : http://diablo.antikrist.org/item-codes/ +[Item Config] +1 = dy1, whatever, purple +2 = dy2, whatever, purple +3 = dy3, whatever, purple +4 = dy4, whatever, purple +5 = dy5, whatever, purple +6 = dy6, whatever, purple +7 = dy7, whatever, purple +8 = dy8, whatever, purple diff --git a/files/1.13d/D2Ex.mpq b/files/1.13d/D2Ex.mpq new file mode 100644 index 0000000..266a3b2 Binary files /dev/null and b/files/1.13d/D2Ex.mpq differ diff --git a/files/1.13d/D2Ex2.dll b/files/1.13d/D2Ex2.dll new file mode 100644 index 0000000..a6efa86 Binary files /dev/null and b/files/1.13d/D2Ex2.dll differ diff --git a/files/D2Win_113d.dll b/files/1.13d/D2Win.dll similarity index 100% rename from files/D2Win_113d.dll rename to files/1.13d/D2Win.dll diff --git a/files/1.13d/Patch_D2.mpq b/files/1.13d/Patch_D2.mpq new file mode 100644 index 0000000..5d94107 Binary files /dev/null and b/files/1.13d/Patch_D2.mpq differ diff --git a/files/D2Ex2.dll b/files/D2Ex2.dll deleted file mode 100644 index c3b94ed..0000000 Binary files a/files/D2Ex2.dll and /dev/null differ diff --git a/glide3x/3DFX.H b/glide3x/3DFX.H new file mode 100644 index 0000000..9a7b4f2 --- /dev/null +++ b/glide3x/3DFX.H @@ -0,0 +1,121 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Revision: 9 $ +** $Date: 12/23/97 9:57a $ +*/ +#ifndef __3DFX_H__ +#define __3DFX_H__ + +/* +** basic data types +*/ +typedef unsigned char FxU8; +typedef signed char FxI8; +typedef unsigned short FxU16; +typedef signed short FxI16; +typedef signed long FxI32; +typedef unsigned long FxU32; +typedef int FxBool; +typedef float FxFloat; +typedef double FxDouble; + +/* +** color types +*/ +typedef unsigned long FxColor_t; +typedef struct { float r, g, b, a; } FxColor4; + +/* +** fundamental types +*/ +#define FXTRUE 1 +#define FXFALSE 0 + +/* +** helper macros +*/ +#define FXUNUSED( a ) ((void)(a)) +#define FXBIT( i ) ( 1L << (i) ) + +/* +** export macros +*/ + +#if defined(__MSC__) +# if defined (MSVC16) +# define FX_ENTRY +# define FX_CALL +# else +# define FX_ENTRY extern +# define FX_CALL __stdcall +# endif +#elif defined(__WATCOMC__) +# define FX_ENTRY extern +# define FX_CALL __stdcall +#elif defined (__IBMC__) || defined (__IBMCPP__) + /* IBM Visual Age C/C++: */ +# define FX_ENTRY extern +# define FX_CALL __stdcall +#elif defined(__DJGPP__) +# define FX_ENTRY extern +# define FX_CALL +#elif defined(__unix__) +# define FX_ENTRY extern +# define FX_CALL +#elif defined(__MWERKS__) +# if macintosh +# define FX_ENTRY extern +# define FX_CALL +# else /* !macintosh */ +# error "Unknown MetroWerks target platform" +# endif /* !macintosh */ +#elif defined(_MSC_BUILD) +#define FX_ENTRY extern +#define FX_CALL __stdcall +#else +# warning define FX_ENTRY & FX_CALL for your compiler +# define FX_ENTRY extern +# define FX_CALL +#endif + +/* +** x86 compiler specific stuff +*/ +#if defined(__BORLANDC_) +# define REALMODE + +# define REGW( a, b ) ((a).x.b) +# define REGB( a, b ) ((a).h.b) +# define INT86( a, b, c ) int86(a,b,c) +# define INT86X( a, b, c, d ) int86x(a,b,c,d) + +# define RM_SEG( a ) FP_SEG( a ) +# define RM_OFF( a ) FP_OFF( a ) +#elif defined(__WATCOMC__) +# undef FP_SEG +# undef FP_OFF + +# define REGW( a, b ) ((a).w.b) +# define REGB( a, b ) ((a).h.b) +# define INT86( a, b, c ) int386(a,b,c) +# define INT86X( a, b, c, d ) int386x(a,b,c,d) + +# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 ) +# define RM_OFF( a ) ( ( FxU16 ) (a) ) +#endif + +#endif /* !__3DFX_H__ */ diff --git a/glide3x/FXDLL.H b/glide3x/FXDLL.H new file mode 100644 index 0000000..ebe424d --- /dev/null +++ b/glide3x/FXDLL.H @@ -0,0 +1,125 @@ +/* +** Copyright (c) 1995, 1996, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Revision: 9 $ +** $Date: 7/24/98 1:37p $ +*/ +/* preprocessor defines for libraries to support DLL creation */ + +/* in header file, use FX_ENTRY return-type FX_CALL function-name ( ... ) */ +/* in source file, use FX_EXPORT return-type FX_CSTYLE function-name (... ) */ + +/* in source file, set FX_DLL_DEFINITION, include this file, then include + header file for library. */ + +/* we need to use two macros per declaration/definition because MSVC + requires __stdcall and __declspec( dllexport ) be in different parts + of the prototype! */ + +/* I use two sets in case we need to control declarations and definitions + differently. If it turns out we don't, it should be easy to do a search + and replace to eliminate one set */ + +/* NOTE: this header file may be included more than once, and FX_DLL_DEFINITION + may have changed, so we do not protect this with an #fndef __FXDLL_H__ + statement like we normally would. */ + + +#ifdef FX_ENTRY +#undef FX_ENTRY +#endif + +#ifdef FX_CALL +#undef FX_CALL +#endif + +#ifdef FX_EXPORT +#undef FX_EXPORT +#endif + +#ifdef FX_CSTYLE +#undef FX_CSTYLE +#endif + +#if defined(FX_DLL_DEFINITION) + #if defined(FX_DLL_ENABLE) + #if defined(__MSC__) + #ifndef KERNEL + #define FX_ENTRY __declspec( dllexport ) + #define FX_EXPORT __declspec( dllexport ) + #else + #define FX_ENTRY + #define FX_EXPORT + #endif /* #ifndef KERNEL */ + #define FX_CALL __stdcall + #define FX_CSTYLE __stdcall + + #elif defined(__WATCOMC__) + #define FX_ENTRY + #define FX_CALL __stdcall __export + + #define FX_EXPORT + #define FX_CSTYLE __stdcall __export + + #else /* compiler */ + #error define FX_ENTRY,FX_CALL & FX_EXPORT,FX_CSTYLE for your compiler + #endif /* compiler */ + + #else /* FX_DLL_ENABLE */ + #define FX_ENTRY + #define FX_CALL __stdcall + + #define FX_EXPORT + #define FX_CSTYLE __stdcall + #endif /* FX_DLL_ENABLE */ + +#else /* FX_DLL_DEFINITION */ + #define FX_ENTRY extern + #define FX_CALL __stdcall +#endif /* FX_DLL_DEFINITION */ + +/* + * We don't want any of this DLL junk for DJGPP or UNIX + * so undo what is done above. + */ +#if defined(__DJGPP__) || defined(__unix__) + #ifdef FX_CALL + #undef FX_CALL + #endif + + #ifdef FX_CSTYLE + #undef FX_CSTYLE + #endif + + #ifdef FX_EXPORT + #undef FX_EXPORT + #endif + + #ifdef FX_ENTRY + #undef FX_ENTRY + #endif + + #define FX_CALL + #define FX_CSTYLE + #define FX_EXPORT + #define FX_ENTRY +#endif + +#if defined (MSVC16) + #undef FX_CALL + #define FX_CALL +#endif + diff --git a/glide3x/FXGLOB.H b/glide3x/FXGLOB.H new file mode 100644 index 0000000..ac22982 --- /dev/null +++ b/glide3x/FXGLOB.H @@ -0,0 +1,30 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $ Revision: $ +** $ Date: $ +** +*/ + + +#ifndef _FXGLOB_H_ +#define _FXGLOB_H_ + + +void fxGlobify( int *argc, char ***argv ); + + +#endif diff --git a/glide3x/FXOS.H b/glide3x/FXOS.H new file mode 100644 index 0000000..a19c0fb --- /dev/null +++ b/glide3x/FXOS.H @@ -0,0 +1,50 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $ Revision: $ +** $ Date: $ +** +*/ + + +#ifndef _FXOS_H_ +#define _FXOS_H_ + +#include + +# ifdef __cplusplus +extern "C" { +# endif + +# ifdef WIN32 +void sleep(int secs); +#define gethostname fxGethostname + +int gethostname(char *name, int namelen); + +# endif + +float fxTime(void); +float timer(int flag); + +FILE *fxFopenPath(const char *filename, const char *mode, + const char *path, const char **pprefix); + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/glide3x/SST1VID.H b/glide3x/SST1VID.H new file mode 100644 index 0000000..be65c31 --- /dev/null +++ b/glide3x/SST1VID.H @@ -0,0 +1,111 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Header: /devel/cvg/incsrc/SST1VID.H 6 7/24/98 1:41p Hohn $ +** $Log: /devel/cvg/incsrc/SST1VID.H $ +** +** 6 7/24/98 1:41p Hohn +** +** 5 3/10/98 2:33p Psmith +** separating cvg tree from h3/h4 trees + * + * 4 9/09/97 7:35p Sellers + * Added 400x300 resolution + * + * 3 8/24/97 9:31a Sellers + * moved new video timing to sst1vid.h + * redefined 1600x1280 to be 1600x1200 + * + * 2 6/05/97 11:14p Pgj + * + * 5 7/24/96 3:43p Sellers + * added 512x384 @ 60 Hz for arcade monitors + * added 512x256 @ 60 Hz for arcade monitors + * + * 4 7/18/96 10:58a Sellers + * fixed FT and TF clock delay values for lower frequencies with + * .5/.5 combos + * + * 3 6/18/96 6:54p Sellers + * added sst1InitShutdownSli() to fix Glide Splash screen problems with + * SLI + * + * 2 6/13/96 7:45p Sellers + * added "voodoo.ini" support + * added DirectX support + * misc cleanup + * + * 2 6/11/96 1:43p Sellers + * added support for 60, 75, 85, and 120 Hz refresh rates for "most" + * resolutions + * + * 1 5/08/96 5:43p Paik + * Video definitions +*/ +#ifndef __SST1VID_H__ +#define __SST1VID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Video defines */ + +typedef FxI32 GrScreenRefresh_t; +#define GR_REFRESH_60Hz 0x0 +#define GR_REFRESH_70Hz 0x1 +#define GR_REFRESH_72Hz 0x2 +#define GR_REFRESH_75Hz 0x3 +#define GR_REFRESH_80Hz 0x4 +#define GR_REFRESH_90Hz 0x5 +#define GR_REFRESH_100Hz 0x6 +#define GR_REFRESH_85Hz 0x7 +#define GR_REFRESH_120Hz 0x8 +#define GR_REFRESH_NONE 0xff + +typedef FxI32 GrScreenResolution_t; +#define GR_RESOLUTION_320x200 0x0 +#define GR_RESOLUTION_320x240 0x1 +#define GR_RESOLUTION_400x256 0x2 +#define GR_RESOLUTION_512x384 0x3 +#define GR_RESOLUTION_640x200 0x4 +#define GR_RESOLUTION_640x350 0x5 +#define GR_RESOLUTION_640x400 0x6 +#define GR_RESOLUTION_640x480 0x7 +#define GR_RESOLUTION_800x600 0x8 +#define GR_RESOLUTION_960x720 0x9 +#define GR_RESOLUTION_856x480 0xa +#define GR_RESOLUTION_512x256 0xb +#define GR_RESOLUTION_1024x768 0xC +#define GR_RESOLUTION_1280x1024 0xD +#define GR_RESOLUTION_1600x1200 0xE +#define GR_RESOLUTION_400x300 0xF +#define GR_RESOLUTION_NONE 0xff + +#ifdef GR_RESOLUTION_MAX +#undef GR_RESOLUTION_MAX +#endif +#ifdef GR_RESOLUTION_MIN +#undef GR_RESOLUTION_MIN +#endif +#define GR_RESOLUTION_MIN GR_RESOLUTION_320x200 +#define GR_RESOLUTION_MAX GR_RESOLUTION_1600x1200 + +#ifdef __cplusplus +} +#endif + +#endif /* __SST1VID_H__ */ diff --git a/glide3x/glide.h b/glide3x/glide.h new file mode 100644 index 0000000..eb3e1b2 --- /dev/null +++ b/glide3x/glide.h @@ -0,0 +1,917 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +*/ + +/* +** GLIDE.H +** +** The following #defines are relevant when using Glide: +** +** One of the following "platform constants" must be defined during +** compilation: +** +** __DOS__ Defined for 32-bit DOS applications +** __WIN32__ Defined for 32-bit Windows applications +** __sparc__ Defined for Sun Solaris/SunOS +** __linux__ Defined for Linux applications +** __IRIX__ Defined for SGI Irix applications +** +*/ +#ifndef __GLIDE_H__ +#define __GLIDE_H__ + +#include <3dfx.h> +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** ----------------------------------------------------------------------- +** TYPE DEFINITIONS +** ----------------------------------------------------------------------- +*/ +typedef FxU32 GrColor_t; +typedef FxU8 GrAlpha_t; +typedef FxU32 GrMipMapId_t; +typedef FxU8 GrFog_t; +typedef FxU32 GrContext_t; +typedef int (__stdcall *GrProc)(); + +/* +** ----------------------------------------------------------------------- +** CONSTANTS AND TYPES +** ----------------------------------------------------------------------- +*/ +#define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1) + +#define GR_MIPMAPLEVELMASK_EVEN FXBIT(0) +#define GR_MIPMAPLEVELMASK_ODD FXBIT(1) +#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD ) + +#define GR_LODBIAS_BILINEAR 0.5 +#define GR_LODBIAS_TRILINEAR 0.0 + +typedef FxI32 GrChipID_t; +#define GR_TMU0 0x0 +#define GR_TMU1 0x1 +#define GR_TMU2 0x2 + +#define GR_FBI 0x0 + +typedef FxI32 GrCombineFunction_t; +#define GR_COMBINE_FUNCTION_ZERO 0x0 +#define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO +#define GR_COMBINE_FUNCTION_LOCAL 0x1 +#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2 +#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3 +#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER +#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6 +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7 +#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL +#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8 +#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9 +#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL +#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10 + +typedef FxI32 GrCombineFactor_t; +#define GR_COMBINE_FACTOR_ZERO 0x0 +#define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO +#define GR_COMBINE_FACTOR_LOCAL 0x1 +#define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2 +#define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3 +#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4 +#define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5 +#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA +#define GR_COMBINE_FACTOR_LOD_FRACTION 0x5 +#define GR_COMBINE_FACTOR_ONE 0x8 +#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9 +#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa +#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb +#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc +#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA +#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd + + +typedef FxI32 GrCombineLocal_t; +#define GR_COMBINE_LOCAL_ITERATED 0x0 +#define GR_COMBINE_LOCAL_CONSTANT 0x1 +#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT +#define GR_COMBINE_LOCAL_DEPTH 0x2 + +typedef FxI32 GrCombineOther_t; +#define GR_COMBINE_OTHER_ITERATED 0x0 +#define GR_COMBINE_OTHER_TEXTURE 0x1 +#define GR_COMBINE_OTHER_CONSTANT 0x2 +#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT + + +typedef FxI32 GrAlphaSource_t; +#define GR_ALPHASOURCE_CC_ALPHA 0x0 +#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1 +#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2 +#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3 + + +typedef FxI32 GrColorCombineFnc_t; +#define GR_COLORCOMBINE_ZERO 0x0 +#define GR_COLORCOMBINE_CCRGB 0x1 +#define GR_COLORCOMBINE_ITRGB 0x2 +#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3 +#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4 +#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9 +#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa +#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb +#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc +#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd +#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe +#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf +#define GR_COLORCOMBINE_ONE 0x10 + +typedef FxI32 GrAlphaBlendFnc_t; +#define GR_BLEND_ZERO 0x0 +#define GR_BLEND_SRC_ALPHA 0x1 +#define GR_BLEND_SRC_COLOR 0x2 +#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR +#define GR_BLEND_DST_ALPHA 0x3 +#define GR_BLEND_ONE 0x4 +#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5 +#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6 +#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR +#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7 +#define GR_BLEND_RESERVED_8 0x8 +#define GR_BLEND_RESERVED_9 0x9 +#define GR_BLEND_RESERVED_A 0xa +#define GR_BLEND_RESERVED_B 0xb +#define GR_BLEND_RESERVED_C 0xc +#define GR_BLEND_RESERVED_D 0xd +#define GR_BLEND_RESERVED_E 0xe +#define GR_BLEND_ALPHA_SATURATE 0xf +#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE + +typedef FxI32 GrAspectRatio_t; +#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */ +#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */ +#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */ +#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */ +#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */ +#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */ +#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */ + +typedef FxI32 GrBuffer_t; +#define GR_BUFFER_FRONTBUFFER 0x0 +#define GR_BUFFER_BACKBUFFER 0x1 +#define GR_BUFFER_AUXBUFFER 0x2 +#define GR_BUFFER_DEPTHBUFFER 0x3 +#define GR_BUFFER_ALPHABUFFER 0x4 +#define GR_BUFFER_TRIPLEBUFFER 0x5 + +typedef FxI32 GrChromakeyMode_t; +#define GR_CHROMAKEY_DISABLE 0x0 +#define GR_CHROMAKEY_ENABLE 0x1 + +typedef FxI32 GrChromaRangeMode_t; +#define GR_CHROMARANGE_RGB_ALL_EXT 0x0 + +#define GR_CHROMARANGE_DISABLE_EXT 0x00 +#define GR_CHROMARANGE_ENABLE_EXT 0x01 + +typedef FxI32 GrTexChromakeyMode_t; +#define GR_TEXCHROMA_DISABLE_EXT 0x0 +#define GR_TEXCHROMA_ENABLE_EXT 0x1 + +#define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0 + +typedef FxI32 GrCmpFnc_t; +#define GR_CMP_NEVER 0x0 +#define GR_CMP_LESS 0x1 +#define GR_CMP_EQUAL 0x2 +#define GR_CMP_LEQUAL 0x3 +#define GR_CMP_GREATER 0x4 +#define GR_CMP_NOTEQUAL 0x5 +#define GR_CMP_GEQUAL 0x6 +#define GR_CMP_ALWAYS 0x7 + +typedef FxI32 GrColorFormat_t; +#define GR_COLORFORMAT_ARGB 0x0 +#define GR_COLORFORMAT_ABGR 0x1 + +#define GR_COLORFORMAT_RGBA 0x2 +#define GR_COLORFORMAT_BGRA 0x3 + +typedef FxI32 GrCullMode_t; +#define GR_CULL_DISABLE 0x0 +#define GR_CULL_NEGATIVE 0x1 +#define GR_CULL_POSITIVE 0x2 + +typedef FxI32 GrDepthBufferMode_t; +#define GR_DEPTHBUFFER_DISABLE 0x0 +#define GR_DEPTHBUFFER_ZBUFFER 0x1 +#define GR_DEPTHBUFFER_WBUFFER 0x2 +#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3 +#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4 + +typedef FxI32 GrDitherMode_t; +#define GR_DITHER_DISABLE 0x0 +#define GR_DITHER_2x2 0x1 +#define GR_DITHER_4x4 0x2 + +typedef FxI32 GrFogMode_t; +#define GR_FOG_DISABLE 0x0 +#define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1 +#define GR_FOG_WITH_TABLE_ON_Q 0x2 +#define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q +#define GR_FOG_WITH_ITERATED_Z 0x3 +#define GR_FOG_MULT2 0x100 +#define GR_FOG_ADD2 0x200 + +typedef FxU32 GrLock_t; +#define GR_LFB_READ_ONLY 0x00 +#define GR_LFB_WRITE_ONLY 0x01 +#define GR_LFB_IDLE 0x00 +#define GR_LFB_NOIDLE 0x10 + +typedef FxI32 GrLfbBypassMode_t; +#define GR_LFBBYPASS_DISABLE 0x0 +#define GR_LFBBYPASS_ENABLE 0x1 + +typedef FxI32 GrLfbWriteMode_t; +#define GR_LFBWRITEMODE_565 0x0 /* RGB:RGB */ +#define GR_LFBWRITEMODE_555 0x1 /* RGB:RGB */ +#define GR_LFBWRITEMODE_1555 0x2 /* ARGB:ARGB */ +#define GR_LFBWRITEMODE_RESERVED1 0x3 +#define GR_LFBWRITEMODE_888 0x4 /* RGB */ +#define GR_LFBWRITEMODE_8888 0x5 /* ARGB */ +#define GR_LFBWRITEMODE_RESERVED2 0x6 +#define GR_LFBWRITEMODE_RESERVED3 0x7 +#define GR_LFBWRITEMODE_RESERVED4 0x8 +#define GR_LFBWRITEMODE_RESERVED5 0x9 +#define GR_LFBWRITEMODE_RESERVED6 0xa +#define GR_LFBWRITEMODE_RESERVED7 0xb +#define GR_LFBWRITEMODE_565_DEPTH 0xc /* RGB:DEPTH */ +#define GR_LFBWRITEMODE_555_DEPTH 0xd /* RGB:DEPTH */ +#define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */ +#define GR_LFBWRITEMODE_ZA16 0xf /* DEPTH:DEPTH */ +#define GR_LFBWRITEMODE_ANY 0xFF + + +typedef FxI32 GrOriginLocation_t; +#define GR_ORIGIN_UPPER_LEFT 0x0 +#define GR_ORIGIN_LOWER_LEFT 0x1 +#define GR_ORIGIN_ANY 0xFF + +typedef struct { + int size; + void *lfbPtr; + FxU32 strideInBytes; + GrLfbWriteMode_t writeMode; + GrOriginLocation_t origin; +} GrLfbInfo_t; + +typedef FxI32 GrLOD_t; +#define GR_LOD_LOG2_256 0x8 +#define GR_LOD_LOG2_128 0x7 +#define GR_LOD_LOG2_64 0x6 +#define GR_LOD_LOG2_32 0x5 +#define GR_LOD_LOG2_16 0x4 +#define GR_LOD_LOG2_8 0x3 +#define GR_LOD_LOG2_4 0x2 +#define GR_LOD_LOG2_2 0x1 +#define GR_LOD_LOG2_1 0x0 + +typedef FxI32 GrMipMapMode_t; +#define GR_MIPMAP_DISABLE 0x0 /* no mip mapping */ +#define GR_MIPMAP_NEAREST 0x1 /* use nearest mipmap */ +#define GR_MIPMAP_NEAREST_DITHER 0x2 /* GR_MIPMAP_NEAREST + LOD dith */ + +typedef FxI32 GrSmoothingMode_t; +#define GR_SMOOTHING_DISABLE 0x0 +#define GR_SMOOTHING_ENABLE 0x1 + +typedef FxI32 GrTextureClampMode_t; +#define GR_TEXTURECLAMP_WRAP 0x0 +#define GR_TEXTURECLAMP_CLAMP 0x1 +#define GR_TEXTURECLAMP_MIRROR_EXT 0x2 + +typedef FxI32 GrTextureCombineFnc_t; +#define GR_TEXTURECOMBINE_ZERO 0x0 /* texout = 0 */ +#define GR_TEXTURECOMBINE_DECAL 0x1 /* texout = texthis */ +#define GR_TEXTURECOMBINE_OTHER 0x2 /* this TMU in passthru mode */ +#define GR_TEXTURECOMBINE_ADD 0x3 /* tout = tthis + t(this+1) */ +#define GR_TEXTURECOMBINE_MULTIPLY 0x4 /* texout = tthis * t(this+1) */ +#define GR_TEXTURECOMBINE_SUBTRACT 0x5 /* Sutract from upstream TMU */ +#define GR_TEXTURECOMBINE_DETAIL 0x6 /* detail--detail on tthis */ +#define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7 /* detail--detail on tthis+1 */ +#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8 /* trilinear--odd levels tthis*/ +#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9 /*trilinear--even levels tthis*/ +#define GR_TEXTURECOMBINE_ONE 0xa /* texout = 0xFFFFFFFF */ + +typedef FxI32 GrTextureFilterMode_t; +#define GR_TEXTUREFILTER_POINT_SAMPLED 0x0 +#define GR_TEXTUREFILTER_BILINEAR 0x1 + +typedef FxI32 GrTextureFormat_t; +#define GR_TEXFMT_8BIT 0x0 +#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT +#define GR_TEXFMT_YIQ_422 0x1 +#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */ +#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */ +#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4 +#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */ +#define GR_TEXFMT_RSVD0 0x6 +#define GR_TEXFMT_RSVD1 0x7 +#define GR_TEXFMT_16BIT 0x8 +#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT +#define GR_TEXFMT_AYIQ_8422 0x9 +#define GR_TEXFMT_RGB_565 0xa +#define GR_TEXFMT_ARGB_1555 0xb +#define GR_TEXFMT_ARGB_4444 0xc +#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd +#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */ +#define GR_TEXFMT_RSVD2 0xf + +typedef FxU32 GrTexTable_t; +#define GR_TEXTABLE_NCC0 0x0 +#define GR_TEXTABLE_NCC1 0x1 +#define GR_TEXTABLE_PALETTE 0x2 +#define GR_TEXTABLE_PALETTE_6666_EXT 0x3 + +typedef FxU32 GrNCCTable_t; +#define GR_NCCTABLE_NCC0 0x0 +#define GR_NCCTABLE_NCC1 0x1 + +typedef FxU32 GrTexBaseRange_t; +#define GR_TEXBASE_256 0x3 +#define GR_TEXBASE_128 0x2 +#define GR_TEXBASE_64 0x1 +#define GR_TEXBASE_32_TO_1 0x0 + + +typedef FxU32 GrEnableMode_t; +#define GR_MODE_DISABLE 0x0 +#define GR_MODE_ENABLE 0x1 + +#define GR_AA_ORDERED 0x01 +#define GR_ALLOW_MIPMAP_DITHER 0x02 +#define GR_PASSTHRU 0x03 +#define GR_SHAMELESS_PLUG 0x04 +#define GR_VIDEO_SMOOTHING 0x05 + +typedef FxU32 GrCoordinateSpaceMode_t; +#define GR_WINDOW_COORDS 0x00 +#define GR_CLIP_COORDS 0x01 + +/* Types of data in strips */ +#define GR_FLOAT 0 +#define GR_U8 1 + +/* Parameters for strips */ +#define GR_PARAM_XY 0x01 +#define GR_PARAM_Z 0x02 +#define GR_PARAM_W 0x03 +#define GR_PARAM_Q 0x04 +#define GR_PARAM_FOG_EXT 0x05 + +#define GR_PARAM_A 0x10 + +#define GR_PARAM_RGB 0x20 + +#define GR_PARAM_PARGB 0x30 + +#define GR_PARAM_ST0 0x40 +#define GR_PARAM_ST1 GR_PARAM_ST0+1 +#define GR_PARAM_ST2 GR_PARAM_ST0+2 + +#define GR_PARAM_Q0 0x50 +#define GR_PARAM_Q1 GR_PARAM_Q0+1 +#define GR_PARAM_Q2 GR_PARAM_Q0+2 + +#define GR_PARAM_DISABLE 0x00 +#define GR_PARAM_ENABLE 0x01 + +/* +** grDrawVertexArray/grDrawVertexArrayContiguous primitive type +*/ +#define GR_POINTS 0 +#define GR_LINE_STRIP 1 +#define GR_LINES 2 +#define GR_POLYGON 3 +#define GR_TRIANGLE_STRIP 4 +#define GR_TRIANGLE_FAN 5 +#define GR_TRIANGLES 6 +#define GR_TRIANGLE_STRIP_CONTINUE 7 +#define GR_TRIANGLE_FAN_CONTINUE 8 + +/* +** grGet/grReset types +*/ +#define GR_BITS_DEPTH 0x01 +#define GR_BITS_RGBA 0x02 +#define GR_FIFO_FULLNESS 0x03 +#define GR_FOG_TABLE_ENTRIES 0x04 +#define GR_GAMMA_TABLE_ENTRIES 0x05 +#define GR_GLIDE_STATE_SIZE 0x06 +#define GR_GLIDE_VERTEXLAYOUT_SIZE 0x07 +#define GR_IS_BUSY 0x08 +#define GR_LFB_PIXEL_PIPE 0x09 +#define GR_MAX_TEXTURE_SIZE 0x0a +#define GR_MAX_TEXTURE_ASPECT_RATIO 0x0b +#define GR_MEMORY_FB 0x0c +#define GR_MEMORY_TMU 0x0d +#define GR_MEMORY_UMA 0x0e +#define GR_NUM_BOARDS 0x0f +#define GR_NON_POWER_OF_TWO_TEXTURES 0x10 +#define GR_NUM_FB 0x11 +#define GR_NUM_SWAP_HISTORY_BUFFER 0x12 +#define GR_NUM_TMU 0x13 +#define GR_PENDING_BUFFERSWAPS 0x14 +#define GR_REVISION_FB 0x15 +#define GR_REVISION_TMU 0x16 +#define GR_STATS_LINES 0x17 /* grGet/grReset */ +#define GR_STATS_PIXELS_AFUNC_FAIL 0x18 +#define GR_STATS_PIXELS_CHROMA_FAIL 0x19 +#define GR_STATS_PIXELS_DEPTHFUNC_FAIL 0x1a +#define GR_STATS_PIXELS_IN 0x1b +#define GR_STATS_PIXELS_OUT 0x1c +#define GR_STATS_PIXELS 0x1d /* grReset */ +#define GR_STATS_POINTS 0x1e /* grGet/grReset */ +#define GR_STATS_TRIANGLES_IN 0x1f +#define GR_STATS_TRIANGLES_OUT 0x20 +#define GR_STATS_TRIANGLES 0x21 /* grReset */ +#define GR_SWAP_HISTORY 0x22 +#define GR_SUPPORTS_PASSTHRU 0x23 +#define GR_TEXTURE_ALIGN 0x24 +#define GR_VIDEO_POSITION 0x25 +#define GR_VIEWPORT 0x26 +#define GR_WDEPTH_MIN_MAX 0x27 +#define GR_ZDEPTH_MIN_MAX 0x28 +#define GR_VERTEX_PARAMETER 0x29 +#define GR_BITS_GAMMA 0x2a + +/* +** grGetString types +*/ +#define GR_EXTENSION 0xa0 +#define GR_HARDWARE 0xa1 +#define GR_RENDERER 0xa2 +#define GR_VENDOR 0xa3 +#define GR_VERSION 0xa4 + +/* +** ----------------------------------------------------------------------- +** STRUCTURES +** ----------------------------------------------------------------------- +*/ + +typedef struct { + GrLOD_t smallLodLog2; + GrLOD_t largeLodLog2; + GrAspectRatio_t aspectRatioLog2; + GrTextureFormat_t format; + void *data; +} GrTexInfo; + +typedef struct GrSstPerfStats_s { + FxU32 pixelsIn; /* # pixels processed (minus buffer clears) */ + FxU32 chromaFail; /* # pixels not drawn due to chroma key */ + FxU32 zFuncFail; /* # pixels not drawn due to Z comparison */ + FxU32 aFuncFail; /* # pixels not drawn due to alpha comparison */ + FxU32 pixelsOut; /* # pixels drawn (including buffer clears) */ +} GrSstPerfStats_t; + +typedef struct { + GrScreenResolution_t resolution; + GrScreenRefresh_t refresh; + int numColorBuffers; + int numAuxBuffers; +} GrResolution; + +typedef GrResolution GlideResolution; + +#define GR_QUERY_ANY ((FxU32)(~0)) + +typedef FxU32 GrLfbSrcFmt_t; +#define GR_LFB_SRC_FMT_565 0x00 +#define GR_LFB_SRC_FMT_555 0x01 +#define GR_LFB_SRC_FMT_1555 0x02 +#define GR_LFB_SRC_FMT_888 0x04 +#define GR_LFB_SRC_FMT_8888 0x05 +#define GR_LFB_SRC_FMT_565_DEPTH 0x0c +#define GR_LFB_SRC_FMT_555_DEPTH 0x0d +#define GR_LFB_SRC_FMT_1555_DEPTH 0x0e +#define GR_LFB_SRC_FMT_ZA16 0x0f +#define GR_LFB_SRC_FMT_RLE16 0x80 + +#ifdef H3D +#define GR_HINT_H3DENABLE 4 +#undef GR_HINTTYPE_MAX +#define GR_HINTTYPE_MAX 4 +#endif + +/* +** ----------------------------------------------------------------------- +** FUNCTION PROTOTYPES +** ----------------------------------------------------------------------- +*/ +#ifndef FX_GLIDE_NO_FUNC_PROTO +/* +** rendering functions +*/ +FX_ENTRY void FX_CALL +grDrawPoint( const void *pt ); + +FX_ENTRY void FX_CALL +grDrawLine( const void *v1, const void *v2 ); + +FX_ENTRY void FX_CALL +grDrawTriangle( const void *a, const void *b, const void *c ); + +FX_ENTRY void FX_CALL +grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode); + +FX_ENTRY void FX_CALL +grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers); + +FX_ENTRY void FX_CALL +grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride); + +/* +** Antialiasing Functions +*/ + +FX_ENTRY void FX_CALL +grAADrawTriangle( + const void *a, const void *b, const void *c, + FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias + ); + +/* +** buffer management +*/ +FX_ENTRY void FX_CALL +grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU32 depth ); + +FX_ENTRY void FX_CALL +grBufferSwap( FxU32 swap_interval ); + +FX_ENTRY void FX_CALL +grRenderBuffer( GrBuffer_t buffer ); + +/* +** error management +*/ +typedef void (*GrErrorCallbackFnc_t)( const char *string, FxBool fatal ); + +FX_ENTRY void FX_CALL +grErrorSetCallback( GrErrorCallbackFnc_t fnc ); + +/* +** SST routines +*/ +FX_ENTRY void FX_CALL +grFinish(void); + +FX_ENTRY void FX_CALL +grFlush(void); + +FX_ENTRY GrContext_t FX_CALL +grSstWinOpen( + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, + int nAuxBuffers); + +FX_ENTRY FxBool FX_CALL +grSstWinClose( GrContext_t context ); + +FX_ENTRY FxBool FX_CALL +grSelectContext( GrContext_t context ); + +FX_ENTRY void FX_CALL +grSstOrigin(GrOriginLocation_t origin); + +FX_ENTRY void FX_CALL +grSstSelect( int which_sst ); + +/* +** Glide configuration and special effect maintenance functions +*/ +FX_ENTRY void FX_CALL +grAlphaBlendFunction( + GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, + GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df + ); + +FX_ENTRY void FX_CALL +grAlphaCombine( + GrCombineFunction_t function, GrCombineFactor_t factor, + GrCombineLocal_t local, GrCombineOther_t other, + FxBool invert + ); + +FX_ENTRY void FX_CALL +grAlphaControlsITRGBLighting( FxBool enable ); + +FX_ENTRY void FX_CALL +grAlphaTestFunction( GrCmpFnc_t function ); + +FX_ENTRY void FX_CALL +grAlphaTestReferenceValue( GrAlpha_t value ); + +FX_ENTRY void FX_CALL +grChromakeyMode( GrChromakeyMode_t mode ); + +FX_ENTRY void FX_CALL +grChromakeyValue( GrColor_t value ); + +FX_ENTRY void FX_CALL +grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy ); + +FX_ENTRY void FX_CALL +grColorCombine( + GrCombineFunction_t function, GrCombineFactor_t factor, + GrCombineLocal_t local, GrCombineOther_t other, + FxBool invert ); + +FX_ENTRY void FX_CALL +grColorMask( FxBool rgb, FxBool a ); + +FX_ENTRY void FX_CALL +grCullMode( GrCullMode_t mode ); + +FX_ENTRY void FX_CALL +grConstantColorValue( GrColor_t value ); + +FX_ENTRY void FX_CALL +grDepthBiasLevel( FxI32 level ); + +FX_ENTRY void FX_CALL +grDepthBufferFunction( GrCmpFnc_t function ); + +FX_ENTRY void FX_CALL +grDepthBufferMode( GrDepthBufferMode_t mode ); + +FX_ENTRY void FX_CALL +grDepthMask( FxBool mask ); + +FX_ENTRY void FX_CALL +grDisableAllEffects( void ); + +FX_ENTRY void FX_CALL +grDitherMode( GrDitherMode_t mode ); + +FX_ENTRY void FX_CALL +grFogColorValue( GrColor_t fogcolor ); + +FX_ENTRY void FX_CALL +grFogMode( GrFogMode_t mode ); + +FX_ENTRY void FX_CALL +grFogTable( const GrFog_t ft[] ); + +FX_ENTRY void FX_CALL +grLoadGammaTable( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue); + +FX_ENTRY void FX_CALL +grSplash(float x, float y, float width, float height, FxU32 frame); + +FX_ENTRY FxU32 FX_CALL +grGet( FxU32 pname, FxU32 plength, FxI32 *params ); + +FX_ENTRY const char * FX_CALL +grGetString( FxU32 pname ); + +FX_ENTRY FxI32 FX_CALL +grQueryResolutions( const GrResolution *resTemplate, GrResolution *output ); + +FX_ENTRY FxBool FX_CALL +grReset( FxU32 what ); + +FX_ENTRY GrProc FX_CALL +grGetProcAddress( char *procName ); + +FX_ENTRY void FX_CALL +grEnable( GrEnableMode_t mode ); + +FX_ENTRY void FX_CALL +grDisable( GrEnableMode_t mode ); + +FX_ENTRY void FX_CALL +grCoordinateSpace( GrCoordinateSpaceMode_t mode ); + +FX_ENTRY void FX_CALL +grDepthRange( FxFloat n, FxFloat f ); + +FX_ENTRY void FX_CALL +grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height ); + +/* +** texture mapping control functions +*/ +FX_ENTRY FxU32 FX_CALL +grTexCalcMemRequired( + GrLOD_t lodmin, GrLOD_t lodmax, + GrAspectRatio_t aspect, GrTextureFormat_t fmt); + +FX_ENTRY FxU32 FX_CALL +grTexTextureMemRequired( FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY FxU32 FX_CALL +grTexMinAddress( GrChipID_t tmu ); + +FX_ENTRY FxU32 FX_CALL +grTexMaxAddress( GrChipID_t tmu ); + +FX_ENTRY void FX_CALL +grTexNCCTable( GrNCCTable_t table ); + +FX_ENTRY void FX_CALL +grTexSource( GrChipID_t tmu, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY void FX_CALL +grTexClampMode( + GrChipID_t tmu, + GrTextureClampMode_t s_clampmode, + GrTextureClampMode_t t_clampmode + ); + +FX_ENTRY void FX_CALL +grTexCombine( + GrChipID_t tmu, + GrCombineFunction_t rgb_function, + GrCombineFactor_t rgb_factor, + GrCombineFunction_t alpha_function, + GrCombineFactor_t alpha_factor, + FxBool rgb_invert, + FxBool alpha_invert + ); + +FX_ENTRY void FX_CALL +grTexDetailControl( + GrChipID_t tmu, + int lod_bias, + FxU8 detail_scale, + float detail_max + ); + +FX_ENTRY void FX_CALL +grTexFilterMode( + GrChipID_t tmu, + GrTextureFilterMode_t minfilter_mode, + GrTextureFilterMode_t magfilter_mode + ); + + +FX_ENTRY void FX_CALL +grTexLodBiasValue(GrChipID_t tmu, float bias ); + +FX_ENTRY void FX_CALL +grTexDownloadMipMap( GrChipID_t tmu, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +FX_ENTRY void FX_CALL +grTexDownloadMipMapLevel( GrChipID_t tmu, + FxU32 startAddress, + GrLOD_t thisLod, + GrLOD_t largeLod, + GrAspectRatio_t aspectRatio, + GrTextureFormat_t format, + FxU32 evenOdd, + void *data ); + +FX_ENTRY FxBool FX_CALL +grTexDownloadMipMapLevelPartial( GrChipID_t tmu, + FxU32 startAddress, + GrLOD_t thisLod, + GrLOD_t largeLod, + GrAspectRatio_t aspectRatio, + GrTextureFormat_t format, + FxU32 evenOdd, + void *data, + int start, + int end ); + +FX_ENTRY void FX_CALL +grTexDownloadTable( GrTexTable_t type, + void *data ); + +FX_ENTRY void FX_CALL +grTexDownloadTablePartial( GrTexTable_t type, + void *data, + int start, + int end ); + +FX_ENTRY void FX_CALL +grTexMipMapMode( GrChipID_t tmu, + GrMipMapMode_t mode, + FxBool lodBlend ); + +FX_ENTRY void FX_CALL +grTexMultibase( GrChipID_t tmu, + FxBool enable ); + +FX_ENTRY void FX_CALL +grTexMultibaseAddress( GrChipID_t tmu, + GrTexBaseRange_t range, + FxU32 startAddress, + FxU32 evenOdd, + GrTexInfo *info ); + +/* +** linear frame buffer functions +*/ + +FX_ENTRY FxBool FX_CALL +grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, + GrOriginLocation_t origin, FxBool pixelPipeline, + GrLfbInfo_t *info ); + +FX_ENTRY FxBool FX_CALL +grLfbUnlock( GrLock_t type, GrBuffer_t buffer ); + +FX_ENTRY void FX_CALL +grLfbConstantAlpha( GrAlpha_t alpha ); + +FX_ENTRY void FX_CALL +grLfbConstantDepth( FxU32 depth ); + +FX_ENTRY void FX_CALL +grLfbWriteColorSwizzle(FxBool swizzleBytes, FxBool swapWords); + +FX_ENTRY void FX_CALL +grLfbWriteColorFormat(GrColorFormat_t colorFormat); + +FX_ENTRY FxBool FX_CALL +grLfbWriteRegion( GrBuffer_t dst_buffer, + FxU32 dst_x, FxU32 dst_y, + GrLfbSrcFmt_t src_format, + FxU32 src_width, FxU32 src_height, + FxBool pixelPipeline, + FxI32 src_stride, void *src_data ); + +FX_ENTRY FxBool FX_CALL +grLfbReadRegion( GrBuffer_t src_buffer, + FxU32 src_x, FxU32 src_y, + FxU32 src_width, FxU32 src_height, + FxU32 dst_stride, void *dst_data ); + +/* +** glide management functions +*/ +FX_ENTRY void FX_CALL +grGlideInit( void ); + +FX_ENTRY void FX_CALL +grGlideShutdown( void ); + +FX_ENTRY void FX_CALL +grGlideGetState( void *state ); + +FX_ENTRY void FX_CALL +grGlideSetState( const void *state ); + +FX_ENTRY void FX_CALL +grGlideGetVertexLayout( void *layout ); + +FX_ENTRY void FX_CALL +grGlideSetVertexLayout( const void *layout ); + +#endif /* FX_GLIDE_NO_FUNC_PROTO */ + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* __GLIDE_H__ */ diff --git a/glide3x/glide3x.lib b/glide3x/glide3x.lib new file mode 100644 index 0000000..60d950f Binary files /dev/null and b/glide3x/glide3x.lib differ diff --git a/glide3x/glidesys.h b/glide3x/glidesys.h new file mode 100644 index 0000000..bb66d3c --- /dev/null +++ b/glide3x/glidesys.h @@ -0,0 +1,146 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +n** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Header: /devel/cvg/glide3/src/glidesys.h 3 7/24/98 1:41p Hohn $ +** $Log: /devel/cvg/glide3/src/glidesys.h $ +** +** 3 7/24/98 1:41p Hohn +** +** 2 6/15/98 10:50a Peter +** made csim compile time option + * + * 1 1/16/98 4:29p Atai + * create glide 3 src + * + * 10 12/09/97 12:20p Peter + * mac glide port + * + * 9 11/04/97 4:00p Dow + * Banshee Mods + * + * 8 8/18/97 3:52p Peter + * pre-hw arrival fixes/cleanup + * + * 7 6/02/97 4:09p Peter + * Compile w/ gcc for Dural + * + * 6 5/27/97 1:16p Peter + * Basic cvg, w/o cmd fifo stuff. + * + * 5 5/21/97 6:05a Peter +*/ +#ifndef __GLIDESYS_H__ +#define __GLIDESYS_H__ + +/* +n** ----------------------------------------------------------------------- +** COMPILER/ENVIRONMENT CONFIGURATION +** ----------------------------------------------------------------------- +*/ + +/* Endianness is stored in bits [30:31] */ +#define GLIDE_ENDIAN_SHIFT 30 +#define GLIDE_ENDIAN_LITTLE (0x1 << GLIDE_ENDIAN_SHIFT) +#define GLIDE_ENDIAN_BIG (0x2 << GLIDE_ENDIAN_SHIFT) + +/* OS is stored in bits [0:6] */ +#define GLIDE_OS_SHIFT 0 +#define GLIDE_OS_UNIX 0x1 +#define GLIDE_OS_DOS32 0x2 +#define GLIDE_OS_WIN32 0x4 +#define GLIDE_OS_MACOS 0x8 +#define GLIDE_OS_OS2 0x10 +#define GLIDE_OS_OTHER 0x40 /* For Proprietary Arcade HW */ + +/* Sim vs. Hardware is stored in bits [7:8] */ +#define GLIDE_SST_SHIFT 7 +#define GLIDE_SST_SIM (0x1 << GLIDE_SST_SHIFT) +#define GLIDE_SST_HW (0x2 << GLIDE_SST_SHIFT) + +/* Hardware Type is stored in bits [9:13] */ +#define GLIDE_HW_SHIFT 9 +#define GLIDE_HW_SST1 (0x1 << GLIDE_HW_SHIFT) +#define GLIDE_HW_SST96 (0x2 << GLIDE_HW_SHIFT) +#define GLIDE_HW_H3 (0x4 << GLIDE_HW_SHIFT) +#define GLIDE_HW_SST2 (0x8 << GLIDE_HW_SHIFT) +#define GLIDE_HW_CVG (0x10 << GLIDE_HW_SHIFT) + +/* +** Make sure we handle all instances of WIN32 +*/ +#ifndef __WIN32__ +# if defined (_WIN32) || defined (WIN32) || defined(__NT__) +# define __WIN32__ +# endif +#endif + +/* We need two checks on the OS: one for endian, the other for OS */ +/* Check for endianness */ +#if defined(__IRIX__) || defined(__sparc__) || defined(MACOS) +# define GLIDE_ENDIAN GLIDE_ENDIAN_BIG +#else +# define GLIDE_ENDIAN GLIDE_ENDIAN_LITTLE +#endif + +/* Check for OS */ +#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) +# define GLIDE_OS GLIDE_OS_UNIX +#elif defined(__DOS__) +# define GLIDE_OS GLIDE_OS_DOS32 +#elif defined(__WIN32__) +# define GLIDE_OS GLIDE_OS_WIN32 +#elif defined(macintosh) +# define GLIDE_OS GLIDE_OS_MACOS +#else +#error "Unknown OS" +#endif + +/* Check for Simulator vs. Hardware */ +#if HAL_CSIM || HWC_CSIM +# define GLIDE_SST GLIDE_SST_SIM +#else +# define GLIDE_SST GLIDE_SST_HW +#endif + +/* Check for type of hardware */ +#ifdef SST96 +# define GLIDE_HW GLIDE_HW_SST96 +#elif defined(H3) +# define GLIDE_HW GLIDE_HW_H3 +#elif defined(SST2) +# define GLIDE_HW GLIDE_HW_SST2 +#elif defined(CVG) +# define GLIDE_HW GLIDE_HW_CVG +#else /* Default to SST1 */ +# define GLIDE_HW GLIDE_HW_SST1 +#endif + + +#define GLIDE_PLATFORM (GLIDE_ENDIAN | GLIDE_OS | GLIDE_SST | GLIDE_HW) + +/* +** Control the number of TMUs +*/ +#ifndef GLIDE_NUM_TMU +# define GLIDE_NUM_TMU 2 +#endif + + +#if ((GLIDE_NUM_TMU < 0) && (GLIDE_NUM_TMU > 3)) +# error "GLIDE_NUM_TMU set to an invalid value" +#endif + +#endif /* __GLIDESYS_H__ */ diff --git a/glide3x/glideutl.h b/glide3x/glideutl.h new file mode 100644 index 0000000..2eb1682 --- /dev/null +++ b/glide3x/glideutl.h @@ -0,0 +1,143 @@ +/* +** Copyright (c) 1995, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Header: /devel/cvg/glide3/src/glideutl.h 4 7/24/98 1:41p Hohn $ +** $Log: /devel/cvg/glide3/src/glideutl.h $ +** +** 4 7/24/98 1:41p Hohn +** +** 3 1/30/98 4:27p Atai +** gufog* prototype +** +** 1 1/29/98 4:00p Atai + * + * 1 1/16/98 4:29p Atai + * create glide 3 src + * + * 11 1/07/98 11:18a Atai + * remove GrMipMapInfo and GrGC.mm_table in glide3 + * + * 10 1/06/98 6:47p Atai + * undo grSplash and remove gu routines + * + * 9 1/05/98 6:04p Atai + * move 3df gu related data structure from glide.h to glideutl.h + * + * 8 12/18/97 2:13p Peter + * fogTable cataclysm + * + * 7 12/15/97 5:52p Atai + * disable obsolete glide2 api for glide3 + * + * 6 8/14/97 5:32p Pgj + * remove dead code per GMT + * + * 5 6/12/97 5:19p Pgj + * Fix bug 578 + * + * 4 3/05/97 9:36p Jdt + * Removed guFbWriteRegion added guEncodeRLE16 + * + * 3 1/16/97 3:45p Dow + * Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO +*/ + +/* Glide Utility routines */ + +#ifndef __GLIDEUTL_H__ +#define __GLIDEUTL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** 3DF texture file structs +*/ + +typedef struct +{ + FxU32 width, height; + int small_lod, large_lod; + GrAspectRatio_t aspect_ratio; + GrTextureFormat_t format; +} Gu3dfHeader; + +typedef struct +{ + FxU8 yRGB[16]; + FxI16 iRGB[4][3]; + FxI16 qRGB[4][3]; + FxU32 packed_data[12]; +} GuNccTable; + +typedef struct { + FxU32 data[256]; +} GuTexPalette; + +typedef union { + GuNccTable nccTable; + GuTexPalette palette; +} GuTexTable; + +typedef struct +{ + Gu3dfHeader header; + GuTexTable table; + void *data; + FxU32 mem_required; /* memory required for mip map in bytes. */ +} Gu3dfInfo; + +#ifndef FX_GLIDE_NO_FUNC_PROTO +/* +** Gamma functions +*/ + +FX_ENTRY void FX_CALL +guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue ); + +/* +** fog stuff +*/ +FX_ENTRY float FX_CALL +guFogTableIndexToW( int i ); + +FX_ENTRY void FX_CALL +guFogGenerateExp( GrFog_t *fogtable, float density ); + +FX_ENTRY void FX_CALL +guFogGenerateExp2( GrFog_t *fogtable, float density ); + +FX_ENTRY void FX_CALL +guFogGenerateLinear(GrFog_t *fogtable, + float nearZ, float farZ ); + +/* +** hi-level texture manipulation tools. +*/ +FX_ENTRY FxBool FX_CALL +gu3dfGetInfo( const char *filename, Gu3dfInfo *info ); + +FX_ENTRY FxBool FX_CALL +gu3dfLoad( const char *filename, Gu3dfInfo *data ); + +#endif /* FX_GLIDE_NO_FUNC_PROTO */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GLIDEUTL_H__ */ diff --git a/glide3x/sst1init.h b/glide3x/sst1init.h new file mode 100644 index 0000000..d7c15b2 --- /dev/null +++ b/glide3x/sst1init.h @@ -0,0 +1,1840 @@ +/*-*-c++-*-*/ +/* +** Copyright (c) 1997, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** +** $Revision: 62 $ +** $Date: 7/24/98 1:38p $ +** +*/ + +#ifndef __SST1INIT_H__ +#define __SST1INIT_H__ + +/* +** Copyright (c) 1996, 3Dfx Interactive, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of 3Dfx Interactive, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** $Revision: 62 $ +** $Date: 7/24/98 1:38p $ +** +** SST-1 Initialization routine protypes +** +** If all initialization routines are called, it is assumed they are called +** in the following order: +** 1. sst1InitMapBoard(); +** 2. sst1InitRegisters(); +** 3. sst1InitGamma(); +** 4. sst1InitVideoBuffers(); +** 5. sst1InitSli(); [Optional] +** 6. sst1InitCmdFifo(); +** +** sst1InitShutdown() is called at the end of an application to turn off +** the SST-1 graphics subsystem +** +*/ + +/* sst1init.h assumes "glide.h" and "sst.h" are already included */ + +/* Init code debug print routine */ +#ifdef INIT_DOS /* Glide version... */ +#define INIT_OUTPUT +#define INIT_PRINTF(a) sst1InitPrintf a +#define INIT_INFO(A) +#endif + +#ifndef DIRECTX +#undef GETENV +#undef ATOI +#undef ATOF +#undef SSCANF +#undef POW +#define GETENV(A) sst1InitGetenv(A) +#define ATOI(A) atoi(A) +#define ATOF(A) atof(A) +#define SSCANF( A, B, C ) sscanf( A, B, C ) +#define POW( A, B ) pow( A, B ) +#define FTOL( X ) ((FxU32)(X)) + +// Video resolution declarations +#include "sst1vid.h" + +// Info Structure declaration +#include "cvginfo.h" + +#else /* DIRECTX */ +#include "ddglobal.h" +#pragma optimize ("",off) /* ddglobal.h tuns this on for retail builds */ +#undef INIT_PRINTF +#undef INIT_INFO +#undef GETENV +#undef ATOI +#undef ATOF +#undef FTOL +#undef ITOF_INV +#undef SSCANF +#undef POW +/* #define INIT_PRINTF(a) */ +#ifdef FXTRACE + #define INIT_PRINTF DDPRINTF +#else + #define INIT_PRINTF 1 ? (void) 0 : (void) +#endif +#define INIT_INFO(A) +#define GETENV(A) ddgetenv(A) +#define ATOI(A) ddatoi(A) +#define ATOF(A) ddatof(A) +#define FTOL(A) ddftol(A) +#define ITOF_INV(A) dd_itof_inv(A) +#define SSCANF( A, B, C ) ddsscanf( A, B, C ) +#define POW( A, B ) ddpow( A, B ) + +#endif /* DIRECTX */ + +/* Defines to writing to/reading from SST-1 */ +#if 0 +#define IGET(A) A +#define ISET(A,D) A = (D) +#else +#define IGET(A) sst1InitRead32((FxU32 *) &(A)) +#define ISET(A,D) sst1InitWrite32((FxU32 *) &(A), D) +#endif + +/* +** P6 Fence +** +** Here's the stuff to do P6 Fencing. This is required for the +** certain things on the P6 +*/ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SST1INIT_ALLOCATE + FxU32 p6FenceVar; +#else + extern FxU32 p6FenceVar; +#endif + +#if defined(__WATCOMC__) +void +p6Fence(void); +# pragma aux p6Fence = \ + "xchg eax, p6FenceVar" \ + modify [eax]; +# define P6FENCE p6Fence() +#elif defined(__MSC__) +# define P6FENCE {_asm xchg eax, p6FenceVar} +#elif defined(macintosh) && __POWERPC__ && defined(__MWERKS__) +# define P6FENCE __eieio() +#else +# error "P6 Fencing in-line assembler code needs to be added for this compiler" +#endif + +#ifdef __cplusplus +} +#endif + +#ifndef _FXPCI_H_ +#include +#endif +#include + +/*--------------------------------------------------------*/ +/* Following defines need to go in "cvgdefs.h" eventually */ +#define SST_CMDFIFO_ADDR BIT(21) + +/*--------- SST PCI Configuration Command bits --------------*/ +#define SST_PCIMEM_ACCESS_EN BIT(1) + +/*------- SST PCI Configuration Register defaults -----------*/ +#define SST_PCI_INIT_ENABLE_DEFAULT 0x0 +#define SST_PCI_BUS_SNOOP_DEFAULT 0x0 + +/*--- SST PCI Init Enable Configuration Register defaults ---*/ +#define SST_SLI_OWNPCI SST_SCANLINE_SLV_OWNPCI +#define SST_SLI_MASTER_OWNPCI 0x0 +#define SST_SLI_SLAVE_OWNPCI SST_SCANLINE_SLV_OWNPCI +#define SST_CHUCK_REVISION_ID_SHIFT 12 +#define SST_CHUCK_REVISION_ID (0xF< +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SST1INIT_ALLOCATE +FILE *sst1InitMsgFile = stdout; +#else +extern FILE *sst1InitMsgFile; +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/* Maximum number of SST-1 boards supported in system */ +#define SST1INIT_MAX_BOARDS 16 + +/* Maximum number of read pushes in "voodoo.ini" file */ +#define DACRDWR_MAX_PUSH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SST1INIT_ALLOCATE + static char headersIdent[] = "@#%Voodoo2 InitHeaders $Revision: 62 $"; + FxBool sst1InitUseVoodooFile = FXFALSE; + sst1InitEnvVarStruct *envVarsBase = (sst1InitEnvVarStruct *) NULL; + sst1InitDacStruct *dacStructBase = (sst1InitDacStruct *) NULL; + sst1InitDacStruct *iniDac = (sst1InitDacStruct *) NULL; + sst1InitDacSetVideoStruct *iniVideo = (sst1InitDacSetVideoStruct *) NULL; + sst1InitDacSetMemClkStruct *iniMemClk = (sst1InitDacSetMemClkStruct *) NULL; + FxU32 iniStack[DACRDWR_MAX_PUSH]; + int iniStackPtr = 0; + sst1DeviceInfoStruct *sst1CurrentBoard; + FxU32 sst1InitDeviceNumber; + sst1DeviceInfoStruct sst1BoardInfo[SST1INIT_MAX_BOARDS]; + FxU32 boardsInSystem; + FxU32 boardsInSystemReally; + FxU32 initIdleEnabled = 1; + + + const PciRegister SST1_PCI_CFG_SCRATCH = { 0x50, 4, READ_WRITE }; + const PciRegister SST1_PCI_SIPROCESS = { 0x54, 4, READ_WRITE }; +#else + extern FxBool sst1InitUseVoodooFile; + extern sst1InitEnvVarStruct *envVarsBase; + extern sst1InitDacStruct *dacStructBase; + extern sst1InitDacStruct *iniDac; + extern sst1InitDacSetVideoStruct *iniVideo; + extern sst1InitDacSetMemClkStruct *iniMemClk; + extern FxU32 iniStack[]; + extern int iniStackPtr; + extern sst1DeviceInfoStruct *sst1CurrentBoard; + extern FxU32 sst1InitDeviceNumber; + extern sst1DeviceInfoStruct sst1BoardInfo[SST1INIT_MAX_BOARDS]; + extern FxU32 boardsInSystem; + extern FxU32 boardsInSystemReally; + extern FxU32 initIdleEnabled; + + extern PciRegister SST1_PCI_CFG_SCRATCH; + extern PciRegister SST1_PCI_SIPROCESS; +#endif /* SST1INIT_ALLOCATE */ + +#ifdef __3Dfx_PCI_CFG__ +/* This is really ugly, but it makes us happy w/ the top of the tree + * pci library which is happier than Gary's library. + */ +#define SST1_PCI_INIT_ENABLE PCI_SST1_INIT_ENABLE +#define SST1_PCI_BUS_SNOOP0 PCI_SST1_BUS_SNOOP_0 +#define SST1_PCI_BUS_SNOOP1 PCI_SST1_BUS_SNOOP_1 +#define SST1_PCI_CFG_STATUS PCI_SST1_CFG_STATUS +#else /* !__3Dfx_PCI_CFG__ */ +#define SST1_PCI_BUS_SNOOP0 SST1_PCI_BUS_SNOOP_0 +#define SST1_PCI_BUS_SNOOP1 SST1_PCI_BUS_SNOOP_1 +#endif /* !__3Dfx_PCI_CFG__ */ + +#ifdef __cplusplus +} +#endif + +#ifdef SST1INIT_VIDEO_ALLOCATE +/* SST1INIT_VIDEO_ALLOCATE is only #defined in video.c + + Define useful clock and video timings + Clocks generated are follows: + Clock Freq. (MHz) = + [14.318 * (clkTiming_M+2)] / [(clkTiming_N+2) * (2^clkTiming_P)] + + Solving for clkTiming_M yields: + clkTiming_M = + [ [(Clock Freq (Mhz)) * (clkTiming_N+2) * (2^clkTiming_P)] / 14.318 ] - 2 + + NOTE: [14.318 * (clkTiming_M+2)] / (clkTiming_N+2) should be between + 120 and 240 + NOTE: Max. M is 127 + NOTE: Max. N is 31 + NOTE: Max. P is 3 + NOTE: Max. L is 15 + NOTE: Max. IB is 15 +*/ + + +/* H3D video timing structures */ +#ifdef H3D +/* This guy's not used anywhere */ +sst1VideoTimingStruct SST_VREZ_640X502_60 = { + 96, /* hSyncOn */ + 704, /* hSyncOff */ + 2, /* vSyncOn */ + 523, /* vSyncOff */ + 38, /* hBackPorch */ + 15, /* vBackPorch */ + 640, /* xDimension */ + 502, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 160, /* memOffset */ + 20, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 25.175F, /* clkFreq16bpp */ + 50.350F /* clkFreq24bpp */ +}; + + +/* Line doubled 640x480...line doubling done externally */ +sst1VideoTimingStruct SST_VREZ_640X960LD_60 = { + 45, /* hSyncOn */ + 785, /* hSyncOff */ + 3, /* vSyncOn */ + 1044, /* vSyncOff */ + 100, /* hBackPorch */ + 18, /* vBackPorch */ + 640, /* xDimension */ + 502, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 160, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 50.82F, /* clkFreq16bpp */ + 101.64F /* clkFreq24bpp */ +}; + + +/* Full resolution 640x480... */ +sst1VideoTimingStruct SST_VREZ_640X960_60 = { + 45, /* hSyncOn */ + 785, /* hSyncOff */ + 3, /* vSyncOn */ + 1044, /* vSyncOff */ + 100, /* hBackPorch */ + 18, /* vBackPorch */ + 640, /* xDimension */ + 1004, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 320, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 50.82F, /* clkFreq16bpp */ + 101.64F /* clkFreq24bpp */ +}; + + +/* Line doubled 800x600...line doubling done externally */ +sst1VideoTimingStruct SST_VREZ_800X1200LD_45 = { + 63, /* hSyncOn */ + 983, /* hSyncOff */ + 3, /* vSyncOn */ + 1242, /* vSyncOff */ + 150, /* hBackPorch */ + 27, /* vBackPorch */ + 800, /* xDimension */ + 608, /* yDimension */ + 42, /* refreshRate */ + 0, /* miscCtrl */ + 247, /* memOffset */ + 26, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 56.25F, /* clkFreq16bpp */ + 112.5F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_800X630_60 = { + 127, /* hSyncOn */ + 927, /* hSyncOff */ + 4, /* vSyncOn */ + 656, /* vSyncOff */ + 86, /* hBackPorch */ + 23, /* vBackPorch */ + 800, /* xDimension */ + 630, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 260, /* memOffset */ + 26, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 40.0F, /* clkFreq16bpp */ + 80.0F /* clkFreq24bpp */ +}; + + +/* Full res 800x600...so far, ain't nobody got enough memory */ +sst1VideoTimingStruct SST_VREZ_800X1200_45 = { + 63, /* hSyncOn */ + 983, /* hSyncOff */ + 3, /* vSyncOn */ + 1244, /* vSyncOff */ + 150, /* hBackPorch */ + 27, /* vBackPorch */ + 800, /* xDimension */ + 1216, /* yDimension */ + 42, /* refreshRate */ + 0, /* miscCtrl */ + 494, /* memOffset */ + 26, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 56.25F, /* clkFreq16bpp */ + 112.5F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_960X742_60 = { + 103, /* hSyncOn */ + 1151, /* hSyncOff */ + 3, /* vSyncOn */ + 765, /* vSyncOff */ + 142, /* hBackPorch */ + 22, /* vBackPorch */ + 960, /* xDimension */ + 742, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 360, /* memOffset */ + 30, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 56.219F, /* clkFreq16bpp */ + 112.437F /* clkFreq24bpp */ +}; + +#endif + + +sst1VideoTimingStruct SST_VREZ_320X200_70 = { + 96, /* hSyncOn */ + 704, /* hSyncOff */ + 2, /* vSyncOn */ + 447, /* vSyncOff */ + 48, /* hBackPorch */ + 35, /* vBackPorch */ + 320, /* xDimension */ + 200, /* yDimension */ + 70, /* refreshRate */ + 0x3, /* miscCtrl */ + 35, /* memOffset */ + 10, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 25.175F, /* clkFreq16bpp */ + 50.350F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X200_75 = { + 99, /* hSyncOn */ + 733, /* hSyncOff */ + 3, /* vSyncOn */ + 429, /* vSyncOff */ + 52, /* hBackPorch */ + 25, /* vBackPorch */ + 320, /* xDimension */ + 200, /* yDimension */ + 75, /* refreshRate */ + 0x3, /* miscCtrl */ + 35, /* memOffset */ + 10, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 27.0F, /* clkFreq16bpp */ + 54.0F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X200_85 = { + 63, /* hSyncOn */ + 767, /* hSyncOff */ + 3, /* vSyncOn */ + 442, /* vSyncOff */ + 94, /* hBackPorch */ + 41, /* vBackPorch */ + 320, /* xDimension */ + 200, /* yDimension */ + 85, /* refreshRate */ + 0x3, /* miscCtrl */ + 35, /* memOffset */ + 10, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 31.5F, /* clkFreq16bpp */ + 63.0F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X200_120 = { + 67, /* hSyncOn */ + 798, /* hSyncOff */ + 3, /* vSyncOn */ + 424, /* vSyncOff */ + 94, /* hBackPorch */ + 16, /* vBackPorch */ + 320, /* xDimension */ + 200, /* yDimension */ + 120, /* refreshRate */ + 0x3, /* miscCtrl */ + 35, /* memOffset */ + 10, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 44.47F, /* clkFreq16bpp */ + 88.94F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X240_60 = { + 96, /* hSyncOn */ + 704, /* hSyncOff */ + 2, /* vSyncOn */ + 523, /* vSyncOff */ + 38, /* hBackPorch */ + 25, /* vBackPorch */ + 320, /* xDimension */ + 240, /* yDimension */ + 60, /* refreshRate */ + 0x3, /* miscCtrl */ + 40, /* memOffset */ + 10, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 25.175F, /* clkFreq16bpp */ + 50.350F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X240_75 = { + 63, /* hSyncOn */ + 775, /* hSyncOff */ + 3, /* vSyncOn */ + 497, /* vSyncOff */ + 118, /* hBackPorch */ + 16, /* vBackPorch */ + 320, /* xDimension */ + 240, /* yDimension */ + 75, /* refreshRate */ + 0x3, /* miscCtrl */ + 40, /* memOffset */ + 10, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 31.5F, /* clkFreq16bpp */ + 63.0F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X240_85 = { + 55, /* hSyncOn */ + 776, /* hSyncOff */ + 3, /* vSyncOn */ + 506, /* vSyncOff */ + 78, /* hBackPorch */ + 25, /* vBackPorch */ + 320, /* xDimension */ + 240, /* yDimension */ + 85, /* refreshRate */ + 0x3, /* miscCtrl */ + 40, /* memOffset */ + 10, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 36.0F, /* clkFreq16bpp */ + 72.0F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_320X240_120 = { + 45, /* hSyncOn */ + 785, /* hSyncOff */ + 3, /* vSyncOn */ + 506, /* vSyncOff */ + 100, /* hBackPorch */ + 18, /* vBackPorch */ + 320, /* xDimension */ + 240, /* yDimension */ + 120, /* refreshRate */ + 0x3, /* miscCtrl */ + 40, /* memOffset */ + 10, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 50.82F, /* clkFreq16bpp */ + 101.64F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_400X300_60 = { + 39, /* hSyncOn */ + 471, /* hSyncOff */ + 3, /* vSyncOn */ + 619, /* vSyncOff */ + 54, /* hBackPorch */ + 18, /* vBackPorch */ + 400, /* xDimension */ + 300, /* yDimension */ + 60, /* refreshRate */ + 0x2, /* miscCtrl */ + 70, /* memOffset */ + 14, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 19.108F, /* clkFreq16bpp */ + 38.216F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_400X300_75 = { + 39, /* hSyncOn */ + 487, /* hSyncOff */ + 3, /* vSyncOn */ + 624, /* vSyncOff */ + 62, /* hBackPorch */ + 23, /* vBackPorch */ + 400, /* xDimension */ + 300, /* yDimension */ + 75, /* refreshRate */ + 0x2, /* miscCtrl */ + 70, /* memOffset */ + 14, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 24.829F, /* clkFreq16bpp */ + 49.658F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_400X300_85 = { + 39, /* hSyncOn */ + 487, /* hSyncOff */ + 3, /* vSyncOn */ + 627, /* vSyncOff */ + 62, /* hBackPorch */ + 26, /* vBackPorch */ + 400, /* xDimension */ + 300, /* yDimension */ + 85, /* refreshRate */ + 0x2, /* miscCtrl */ + 70, /* memOffset */ + 14, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 28.274F, /* clkFreq16bpp */ + 56.548F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_400X300_120 = { + 39, /* hSyncOn */ + 503, /* hSyncOff */ + 3, /* vSyncOn */ + 640, /* vSyncOff */ + 70, /* hBackPorch */ + 39, /* vBackPorch */ + 400, /* xDimension */ + 300, /* yDimension */ + 120, /* refreshRate */ + 0x2, /* miscCtrl */ + 70, /* memOffset */ + 14, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 41.975F, /* clkFreq16bpp */ + 83.950F /* clkFreq24bpp */ +}; + +/* 512x256@60 only syncs to Arcade-style monitors */ +sst1VideoTimingStruct SST_VREZ_512X256_60 = { + 41, /* hSyncOn */ + 626, /* hSyncOff */ + 4, /* vSyncOn */ + 286, /* vSyncOff */ + 65, /* hBackPorch */ + 24, /* vBackPorch */ + 512, /* xDimension */ + 256, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 64, /* memOffset */ + 16, /* tilesInX */ + 25, /* vFifoThreshold */ + FXFALSE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 23.334F, /* clkFreq16bpp */ + 23.334F /* clkFreq24bpp */ +}; + +#if 0 +// For Arcade monitors... +sst1VideoTimingStruct SST_VREZ_512X384_60 = { + 23, /* hSyncOn */ + 640, /* hSyncOff */ + 3, /* vSyncOn */ + 411, /* vSyncOff */ + 90, /* hBackPorch */ + 24, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXFALSE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 33.0F, /* clkFreq16bpp */ + 33.0F /* clkFreq24bpp */ +}; +#else +// For PC monitors... +sst1VideoTimingStruct SST_VREZ_512X384_60 = { + 55, /* hSyncOn */ + 615, /* hSyncOff */ + 3, /* vSyncOn */ + 792, /* vSyncOff */ + 78, /* hBackPorch */ + 23, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 60, /* refreshRate */ + 0x2, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 32.054F, /* clkFreq16bpp */ + 64.108F /* clkFreq24bpp */ +}; +#endif + +sst1VideoTimingStruct SST_VREZ_512X384_72 = { + 51, /* hSyncOn */ + 591, /* hSyncOff */ + 3, /* vSyncOn */ + 430, /* vSyncOff */ + 55, /* hBackPorch */ + 25, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 72, /* refreshRate */ + 0, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 20.093F, /* clkFreq16bpp */ + 40.186F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_512X384_75 = { + 55, /* hSyncOn */ + 631, /* hSyncOff */ + 3, /* vSyncOn */ + 799, /* vSyncOff */ + 86, /* hBackPorch */ + 30, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 75, /* refreshRate */ + 0x2, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 41.383F, /* clkFreq16bpp */ + 82.766F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_512X384_75_NOSCANDOUBLE = { + 47, /* hSyncOn */ + 591, /* hSyncOff */ + 3, /* vSyncOn */ + 399, /* vSyncOff */ + 62, /* hBackPorch */ + 14, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 19.296F, /* clkFreq16bpp */ + 38.592F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_512X384_85 = { + 55, /* hSyncOn */ + 631, /* hSyncOff */ + 3, /* vSyncOn */ + 804, /* vSyncOff */ + 86, /* hBackPorch */ + 35, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 85, /* refreshRate */ + 0x2, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 47.193F, /* clkFreq16bpp */ + 94.386F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_512X384_85_NOSCANDOUBLE = { + 55, /* hSyncOn */ + 599, /* hSyncOff */ + 3, /* vSyncOn */ + 401, /* vSyncOff */ + 70, /* hBackPorch */ + 16, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 22.527F, /* clkFreq16bpp */ + 45.054F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_512X384_120 = { + 25, /* hSyncOn */ + 650, /* hSyncOff */ + 3, /* vSyncOn */ + 409, /* vSyncOff */ + 110, /* hBackPorch */ + 25, /* vBackPorch */ + 512, /* xDimension */ + 384, /* yDimension */ + 120, /* refreshRate */ + 0, /* miscCtrl */ + 96, /* memOffset */ + 16, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 33.5F, /* clkFreq16bpp */ + 67.0F /* clkFreq24bpp */ +}; + +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X400_70 = { + 96, /* hSyncOn */ + 704, /* hSyncOff */ + 2, /* vSyncOn */ + 447, /* vSyncOff */ + 48, /* hBackPorch */ + 35, /* vBackPorch */ + 640, /* xDimension */ + 400, /* yDimension */ + 70, /* refreshRate */ + 0, /* miscCtrl */ + 130, /* memOffset */ + 20, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 25.175F, /* clkFreq16bpp */ + 50.350F /* clkFreq24bpp */ +}; + +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X400_75 = { + 99, /* hSyncOn */ + 733, /* hSyncOff */ + 3, /* vSyncOn */ + 429, /* vSyncOff */ + 52, /* hBackPorch */ + 25, /* vBackPorch */ + 640, /* xDimension */ + 400, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 130, /* memOffset */ + 20, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 27.0F, /* clkFreq16bpp */ + 54.0F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X400_85 = { + 63, /* hSyncOn */ + 767, /* hSyncOff */ + 3, /* vSyncOn */ + 442, /* vSyncOff */ + 94, /* hBackPorch */ + 41, /* vBackPorch */ + 640, /* xDimension */ + 400, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 130, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 31.5F, /* clkFreq16bpp */ + 63.0F /* clkFreq24bpp */ +}; + +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X400_120 = { + 67, /* hSyncOn */ + 798, /* hSyncOff */ + 3, /* vSyncOn */ + 424, /* vSyncOff */ + 94, /* hBackPorch */ + 16, /* vBackPorch */ + 640, /* xDimension */ + 400, /* yDimension */ + 120, /* refreshRate */ + 0, /* miscCtrl */ + 130, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 44.47F, /* clkFreq16bpp */ + 88.94F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X480_60 = { + 96, /* hSyncOn */ + + 704, /* hSyncOff */ + 2, /* vSyncOn */ + 523, /* vSyncOff */ + 38, /* hBackPorch */ + 25, /* vBackPorch */ + 640, /* xDimension */ + 480, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 150, /* memOffset */ + 20, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 25.175F, /* clkFreq16bpp */ + 50.350F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X480_75 = { + 63, /* hSyncOn */ + 775, /* hSyncOff */ + 3, /* vSyncOn */ + 497, /* vSyncOff */ + 118, /* hBackPorch */ + 16, /* vBackPorch */ + 640, /* xDimension */ + 480, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 150, /* memOffset */ + 20, /* tilesInX */ + 25, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 31.5F, /* clkFreq16bpp */ + 63.0F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X480_85 = { + 55, /* hSyncOn */ + 776, /* hSyncOff */ + 3, /* vSyncOn */ + 506, /* vSyncOff */ + 78, /* hBackPorch */ + 25, /* vBackPorch */ + 640, /* xDimension */ + 480, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 150, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 36.0F, /* clkFreq16bpp */ + 72.0F /* clkFreq24bpp */ +}; + +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_640X480_120 = { + 45, /* hSyncOn */ + 785, /* hSyncOff */ + 3, /* vSyncOn */ + 506, /* vSyncOff */ + 100, /* hBackPorch */ + 18, /* vBackPorch */ + 640, /* xDimension */ + 480, /* yDimension */ + 120, /* refreshRate */ + 0, /* miscCtrl */ + 150, /* memOffset */ + 20, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 50.82F, /* clkFreq16bpp */ + 101.64F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +// 800x600 requires 832x608 amount of memory usage... +sst1VideoTimingStruct SST_VREZ_800X600_60 = { + 127, /* hSyncOn */ + 927, /* hSyncOff */ + 4, /* vSyncOn */ + 624, /* vSyncOff */ + 86, /* hBackPorch */ + 23, /* vBackPorch */ + 800, /* xDimension */ + 600, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 247, /* memOffset */ + 26, /* tilesInX */ + 23, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 40.0F, /* clkFreq16bpp */ + 80.0F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_800X600_75 = { + 79, /* hSyncOn */ + 975, /* hSyncOff */ + 3, /* vSyncOn */ + 622, /* vSyncOff */ + 158, /* hBackPorch */ + 21, /* vBackPorch */ + 800, /* xDimension */ + 600, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 247, /* memOffset */ + 26, /* tilesInX */ + 21, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 49.5F, /* clkFreq16bpp */ + 99.0F /* clkFreq24bpp */ +}; + +/* VESA Standard */ +/* Verified 10/21/96 */ +sst1VideoTimingStruct SST_VREZ_800X600_85 = { + 63, /* hSyncOn */ + 983, /* hSyncOff */ + 3, /* vSyncOn */ + 628, /* vSyncOff */ + 150, /* hBackPorch */ + 27, /* vBackPorch */ + 800, /* xDimension */ + 600, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 247, /* memOffset */ + 26, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 56.25F, /* clkFreq16bpp */ + 112.5F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_800X600_120 = { + 87, /* hSyncOn */ + 999, /* hSyncOff */ + 3, /* vSyncOn */ + 640, /* vSyncOff */ + 142, /* hBackPorch */ + 39, /* vBackPorch */ + 800, /* xDimension */ + 600, /* yDimension */ + 120, /* refreshRate */ + 0, /* miscCtrl */ + 247, /* memOffset */ + 26, /* tilesInX */ + 17, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 83.950F, /* clkFreq16bpp */ + 83.950F /* clkFreq24bpp -- unsupported */ +}; + +// 856x480 requires 896x480 amount of memory usage... +sst1VideoTimingStruct SST_VREZ_856X480_60 = { + 136, /* hSyncOn */ + 1008, /* hSyncOff */ + 2, /* vSyncOn */ + 523, /* vSyncOff */ + 100, /* hBackPorch */ + 23, /* vBackPorch */ + 856, /* xDimension */ + 480, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 210, /* memOffset */ + 28, /* tilesInX */ + 16, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 36.0F, /* clkFreq16bpp */ + 72.0F /* clkFreq24bpp */ +}; + +// 960x720 requires 960x736 amount of memory usage... +sst1VideoTimingStruct SST_VREZ_960X720_60 = { + 103, /* hSyncOn */ + 1151, /* hSyncOff */ + 3, /* vSyncOn */ + 743, /* vSyncOff */ + 142, /* hBackPorch */ + 22, /* vBackPorch */ + 960, /* xDimension */ + 720, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 345, /* memOffset */ + 30, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXTRUE, /* video24BPPIsOK */ + 56.219F, /* clkFreq16bpp */ + 112.437F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_960X720_75 = { + 103, /* hSyncOn */ + 1183, /* hSyncOff */ + 3, /* vSyncOn */ + 749, /* vSyncOff */ + 158, /* hBackPorch */ + 28, /* vBackPorch */ + 960, /* xDimension */ + 720, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 345, /* memOffset */ + 30, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 72.643F, /* clkFreq16bpp */ + 72.643F /* clkFreq24bpp -- unsupported */ +}; + +sst1VideoTimingStruct SST_VREZ_960X720_85 = { + 103, /* hSyncOn */ + 1199, /* hSyncOff */ + 3, /* vSyncOn */ + 753, /* vSyncOff */ + 166, /* hBackPorch */ + 32, /* vBackPorch */ + 960, /* xDimension */ + 720, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 345, /* memOffset */ + 30, /* tilesInX */ + 19, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 83.795F, /* clkFreq16bpp */ + 83.795F /* clkFreq24bpp -- unsupported */ +}; + +sst1VideoTimingStruct SST_VREZ_1024X768_60 = { + 136, /* hSyncOn */ + 1208, /* hSyncOff */ + 6, /* vSyncOn */ + 800, /* vSyncOff */ + 160, /* hBackPorch */ + 29, /* vBackPorch */ + 1024, /* xDimension */ + 768, /* yDimension */ + 60, /* refreshRate */ + 0, /* miscCtrl */ + 384, /* memOffset */ + 32, /* tilesInX */ + 16, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 65.0F, /* clkFreq16bpp */ + 130.0F /* clkFreq24bpp */ +}; + +sst1VideoTimingStruct SST_VREZ_1024X768_75 = { + 96, /* hSyncOn */ + 1216, /* hSyncOff */ + 3, /* vSyncOn */ + 797, /* vSyncOff */ + 176, /* hBackPorch */ + 28, /* vBackPorch */ + 1024, /* xDimension */ + 768, /* yDimension */ + 75, /* refreshRate */ + 0, /* miscCtrl */ + 384, /* memOffset */ + 32, /* tilesInX */ + 16, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 78.75F, /* clkFreq16bpp */ + 78.75F /* clkFreq24bpp -- unsupported */ +}; + +sst1VideoTimingStruct SST_VREZ_1024X768_85 = { + 96, /* hSyncOn */ + 1280, /* hSyncOff */ + 3, /* vSyncOn */ + 805, /* vSyncOff */ + 208, /* hBackPorch */ + 36, /* vBackPorch */ + 1024, /* xDimension */ + 768, /* yDimension */ + 85, /* refreshRate */ + 0, /* miscCtrl */ + 384, /* memOffset */ + 32, /* tilesInX */ + 16, /* vFifoThreshold */ + FXTRUE, /* video16BPPIsOK */ + FXFALSE, /* video24BPPIsOK */ + 94.5F, /* clkFreq16bpp */ + 94.5F /* clkFreq24bpp -- unsupported */ +}; + +#else /* SST1INIT_VIDEO_ALLOCATE */ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern sst1VideoTimingStruct SST_VREZ_640X480_60; +extern sst1VideoTimingStruct SST_VREZ_800X600_60; + +#ifdef __cplusplus +} +#endif + +#endif /* SST1INIT_VIDEO_ALLOCATE */ + +#endif /* !__SST1INIT_H__ */ diff --git a/stdAfx.h b/stdAfx.h index 2e2111b..583fd61 100644 --- a/stdAfx.h +++ b/stdAfx.h @@ -1,20 +1,24 @@ #define WIN32_LEAN_AND_MEAN -//******** SET HERE WORKING VERSION ********* -#define VER_113D //#define D2EX_CLOSED_BNET // Copy&Paste from SCRAP, didn't test yet //#define D2EX_SCRAP_HACKS // - || - +//#define D2EX_MULTIRES // Enables high resolution settings //******************************************* + +#if defined VER_111B && defined VER_113D +#error "Only one version can be defined at once!" +#endif + #include #include "Constants.h" - #include "CommonStructs.h" +#include #ifdef VER_113D #include "D2Structs_113D.h" -#include "D2Ptrs_113D.h" +#include "D2ExPointers_113D.h" #elif defined VER_111B #include "D2Structs_111B.h" -#include "D2Ptrs_111B.h" +#include "D2ExPointers_111B.h" #endif @@ -29,6 +33,6 @@ #endif -#define ASSERT(e) if (e == 0) { ShowWindow(D2Funcs::D2GFX_GetHwnd(),SW_HIDE);Misc::Log("Error at line %d in file '%s' , function: '%s'",__LINE__,__FILE__,__FUNCTION__); MessageBoxA(0,"An error occured. Check D2Ex.log, and send error\ncode to *LOLET!","D2Ex",0); exit(-1); } -#define D2EXERROR(format, ...) { ShowWindow(D2Funcs::D2GFX_GetHwnd(),SW_HIDE); Misc::ShowMsgBox(format, ##__VA_ARGS__); exit(-1); } +#define ASSERT(e) if (e == 0) { ShowWindow(D2Funcs.D2GFX_GetHwnd(),SW_HIDE);Misc::Log("Error at line %d in file '%s' , function: '%s'",__LINE__,__FILE__,__FUNCTION__); MessageBoxA(0,"An error occured. Check D2Ex.log, and send error\ncode to *LOLET!","D2Ex",0); exit(-1); } +#define D2EXERROR(format, ...) { ShowWindow(D2Funcs.D2GFX_GetHwnd(),SW_HIDE); Misc::ShowMsgBox(format, ##__VA_ARGS__); exit(-1); } #define INFO(e) { Misc::Log("Info: '%s' at line %d in file '%s' , function: '%s'",e,__LINE__,__FILE__,__FUNCTION__);} \ No newline at end of file