#include "CMapWorldInfo.hpp" #include "GameGlobalObjects.hpp" #include "CMemoryCardSys.hpp" namespace urde { CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, ResId mlvlId) { const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId); x4_visitedAreas.reserve((worldMem.GetAreaCount() + 31) / 32); for (int i=0 ; iGetSaveWorldMemory(mlvlId); for (int i=0 ; i x0_visitedAreasAllocated) { const_cast(*this).x4_visitedAreas.resize((aid + 32) / 32); const_cast(*this).x0_visitedAreasAllocated = aid + 1; } return (x4_visitedAreas[aid / 32] >> (aid % 32)) & 0x1; } void CMapWorldInfo::SetAreaVisited(TAreaId aid, bool visited) { if (aid + 1 > x0_visitedAreasAllocated) { x4_visitedAreas.resize((aid + 32) / 32); x0_visitedAreasAllocated = aid + 1; } if (visited) x4_visitedAreas[aid / 32] |= 1 << (aid % 32); else x4_visitedAreas[aid / 32] &= ~(1 << (aid % 32)); } bool CMapWorldInfo::IsMapped(TAreaId aid) const { if (aid + 1 > x14_mappedAreasAllocated) { const_cast(*this).x18_mappedAreas.resize((aid + 32) / 32); const_cast(*this).x14_mappedAreasAllocated = aid + 1; } return (x18_mappedAreas[aid / 32] >> (aid % 32)) & 0x1; } void CMapWorldInfo::SetIsMapped(TAreaId aid, bool mapped) { if (aid + 1 > x14_mappedAreasAllocated) { x18_mappedAreas.resize((aid + 32) / 32); x14_mappedAreasAllocated = aid + 1; } if (mapped) x18_mappedAreas[aid / 32] |= 1 << (aid % 32); else x18_mappedAreas[aid / 32] &= ~(1 << (aid % 32)); } bool CMapWorldInfo::IsWorldVisible(TAreaId aid) const { return x38_mapStationUsed || IsMapped(aid); } bool CMapWorldInfo::IsAreaVisible(TAreaId aid) const { if (IsAreaVisted(aid) || IsMapped(aid)) return true; return false; } bool CMapWorldInfo::IsAnythingSet() const { for (int i=0 ; i