Skip to content

Commit

Permalink
Rework D2Ptrs -> ExPtrs to get rid of optimization errors. Now it com…
Browse files Browse the repository at this point in the history
…piles successfully on VS 2013

[WIP] Glide support for ExMultiRes
  • Loading branch information
jankowskib committed Feb 5, 2014
1 parent 3adea9b commit e034e3c
Show file tree
Hide file tree
Showing 70 changed files with 5,952 additions and 2,788 deletions.
2 changes: 1 addition & 1 deletion Build.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define __BUILDNO__ 4889
#define __BUILDNO__ 4975
24 changes: 12 additions & 12 deletions CollisionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -308,7 +308,7 @@ BOOL CCollisionMap::DumpMap(LPCSTR lpszFilePath, const vector<COORDS> 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++)
Expand All @@ -323,7 +323,7 @@ BOOL CCollisionMap::DumpMap(LPCSTR lpszFilePath, const vector<COORDS> cPath) co
for(vector<COORDS>::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);

Expand Down Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit e034e3c

Please sign in to comment.