CMap :: CMap( CGHost *nGHost ) { CONSOLE_Print( "[MAP] using hardcoded Emerald Gardens map data for Warcraft 3 version 1.24 & 1.24b" ); m_GHost = nGHost; m_Valid = true; m_MapPath = "Maps\\FrozenThrone\\(12)EmeraldGardens.w3x"; m_MapSize = UTIL_ExtractNumbers( "174 221 4 0", 4 ); m_MapInfo = UTIL_ExtractNumbers( "251 57 68 98", 4 ); m_MapCRC = UTIL_ExtractNumbers( "108 250 204 59", 4 ); m_MapSHA1 = UTIL_ExtractNumbers( "35 81 104 182 223 63 204 215 1 17 87 234 220 66 3 185 82 99 6 13", 20 ); m_MapSpeed = MAPSPEED_FAST; m_MapVisibility = MAPVIS_DEFAULT; m_MapObservers = MAPOBS_NONE; m_MapFlags = MAPFLAG_TEAMSTOGETHER | MAPFLAG_FIXEDTEAMS; m_MapFilterMaker = MAPFILTER_MAKER_BLIZZARD; m_MapFilterType = MAPFILTER_TYPE_MELEE; m_MapFilterSize = MAPFILTER_SIZE_LARGE; m_MapFilterObs = MAPFILTER_OBS_NONE; m_MapOptions = MAPOPT_MELEE; m_MapWidth = UTIL_ExtractNumbers( "172 0", 2 ); m_MapHeight = UTIL_ExtractNumbers( "172 0", 2 ); m_MapLoadInGame = false; m_MapNumPlayers = 12; m_MapNumTeams = 12; m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 0, 0, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 1, 1, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 2, 2, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 3, 3, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 4, 4, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 5, 5, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 6, 6, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 7, 7, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 8, 8, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 9, 9, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 10, 10, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 11, 11, SLOTRACE_RANDOM | SLOTRACE_SELECTABLE ) ); }
void CSaveGame :: ParseSaveGame( ) { m_MapPath.clear( ); m_GameName.clear( ); m_NumSlots = 0; m_Slots.clear( ); m_RandomSeed = 0; m_MagicNumber.clear( ); m_EnforcePlayers.clear(); if( m_Flags != 0 ) { CONSOLE_Print( "[SAVEGAME] invalid replay (flags mismatch)" ); m_Valid = false; return; } istringstream ISS( m_Decompressed ); // savegame format figured out by Varlock: // string -> map path // 0 (string?) -> ??? (no idea what this is) // string -> game name // 0 (string?) -> ??? (maybe original game password) // string -> stat string // 4 bytes -> ??? (seems to be # of slots) // 4 bytes -> ??? (seems to be 0x01 0x28 0x49 0x00 on both of the savegames examined) // 2 bytes -> ??? (no idea what this is) // slot structure // 4 bytes -> magic number unsigned char Garbage1; uint16_t Garbage2; uint32_t Garbage4; string GarbageString; string idString; uint32_t MagicNumber; READSTR( ISS, m_MapPath ); // map path READSTR( ISS, idString ); // ??? , mark for custom save game file READSTR( ISS, m_GameName ); // game name READSTR( ISS, GarbageString ); // ??? READSTR( ISS, GarbageString ); // stat string READB( ISS, &Garbage4, 4 ); // ??? READB( ISS, &Garbage4, 4 ); // ??? READB( ISS, &Garbage2, 2 ); // ??? READB( ISS, &m_NumSlots, 1 ); // number of slots if( m_NumSlots > 12 ) { CONSOLE_Print( "[SAVEGAME] invalid savegame (too many slots)" ); m_Valid = false; return; } for( unsigned char i = 0; i < m_NumSlots; i++ ) { unsigned char SlotData[9]; READB( ISS, SlotData, 9 ); // slot data m_Slots.push_back( CGameSlot( SlotData[0], SlotData[1], SlotData[2], SlotData[3], SlotData[4], SlotData[5], SlotData[6], SlotData[7], SlotData[8] ) ); } READB( ISS, &m_RandomSeed, 4 ); // random seed READB( ISS, &Garbage1, 1 ); // GameType READB( ISS, &Garbage1, 1 ); // number of player slots (non observer) READB( ISS, &MagicNumber, 4 ); // magic number if( ISS.eof( ) || ISS.fail( ) ) { CONSOLE_Print( "[SAVEGAME] failed to parse savegame header" ); m_Valid = false; return; } m_MagicNumber = UTIL_CreateByteArray( MagicNumber, false ); if (idString == customMarkFileType) { unsigned char nPIDsize; READB( ISS, &nPIDsize, 1 ); m_EnforcePlayers.resize( nPIDsize ); for ( unsigned char i = 0; i < nPIDsize; ++i) { unsigned char PID; string playerName; READB( ISS, &PID, 1 ); READSTR( ISS, playerName ); m_EnforcePlayers[i] = PIDPlayer(PID, playerName); } } m_Valid = true; }
CMap :: CMap( CGHost *nGHost ) { CONSOLE_Print( "[MAP] using hardcoded Emerald Gardens map data for Warcraft 3 version 1.24 & 1.24b" ); m_GHost = nGHost; m_Valid = true; m_MapPath = "Maps\\FrozenThrone\\(12)EmeraldGardens.w3x"; m_MapSize = UTIL_ExtractNumbers( "174 221 4 0", 4 ); m_MapInfo = UTIL_ExtractNumbers( "251 57 68 98", 4 ); m_MapCRC = UTIL_ExtractNumbers( "108 250 204 59", 4 ); m_MapSHA1 = UTIL_ExtractNumbers( "35 81 104 182 223 63 204 215 1 17 87 234 220 66 3 185 82 99 6 13", 20 ); if (m_GHost->m_LANWar3Version == 23) { m_MapCRC = UTIL_ExtractNumbers( "112 185 65 97", 4 ); m_MapSHA1 = UTIL_ExtractNumbers( "187 28 143 4 97 223 210 52 218 28 95 52 217 203 121 202 24 120 59 213", 20 ); } m_MapSpeed = MAPSPEED_FAST; m_MapVisibility = MAPVIS_DEFAULT; m_MapObservers = MAPOBS_NONE; m_MapFlags = MAPFLAG_TEAMSTOGETHER | MAPFLAG_FIXEDTEAMS; m_MapGameType = 9; m_MapWidth = UTIL_ExtractNumbers( "172 0", 2 ); m_MapHeight = UTIL_ExtractNumbers( "172 0", 2 ); m_MapLoadInGame = false; m_MapNumPlayers = 12; m_MapNumTeams = 12; m_MapOnlyAutoWarnIfMoreThanXPlayers = 0; m_AutoWarnMarks.push_back( 0 ); m_LogAll = false; m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 0, 0, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 1, 1, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 2, 2, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 3, 3, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 4, 4, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 5, 5, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 6, 6, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 7, 7, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 8, 8, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 9, 9, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 10, 10, SLOTRACE_RANDOM ) ); m_Slots.push_back( CGameSlot( 0, 255, SLOTSTATUS_OPEN, 0, 11, 11, SLOTRACE_RANDOM ) ); }