Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function parse()
- {
- // https://github.com/stijnherfst/HiveWE/wiki/war3map.w3i---Map-Information (before version 28)
- $this->data->version = $this->readLong();
- $this->data->saves = $this->readLong();
- $this->data->editorVersion = $this->readLong();
- if ($this->data->version >= 28) {
- // If the 16 bytes in the W3I you're talking about are the ones after the editor version, those represent the patch version: major, minor, patch, build
- // All integers
- $this->data->realVersion = $this->readTypedArray('long', 4);
- }
- $this->data->name = $this->readString();
- $this->data->author = $this->readString();
- $this->data->info = $this->readString();
- $this->data->suggestedPlayers = $this->readString();
- // camera_bounds
- $unusedBounds = $this->readTypedArray('float', 8);
- // camera_bounds_complements
- list($a, $b, $c, $d) = $this->readTypedArray('long', 4);
- $playableWidth = $this->readLong();
- $playableHeight = $this->readLong();
- $this->data->fullWidth = $a + $playableWidth + $b;
- $this->data->fullHeight = $c + $playableHeight + $d;
- $this->data->playableWidth = $playableWidth;
- $this->data->playableHeight = $playableHeight;
- $flags = $this->readLong(4);
- $this->data->flags = new \stdClass();
- $this->data->flags->hideMiniMap = (bool) ($flags & 0x0001);
- $this->data->flags->modifyAllyPriorities = (bool) ($flags & 0x0002);
- $this->data->flags->meleeMap = (bool) ($flags & 0x0004);
- $this->data->flags->playableMapSizeWasLarge = (bool) ($flags & 0x0008);
- $this->data->flags->maskedAreaArePartiallyVisible = (bool) ($flags & 0x0010);
- $this->data->flags->fixedPlayerSettingForCustomForces = (bool) ($flags & 0x0020);
- $this->data->flags->useCustomForces = (bool) ($flags & 0x0040);
- $this->data->flags->useCustomTechtree = (bool) ($flags & 0x0080);
- $this->data->flags->useCustomAbilities = (bool) ($flags & 0x0100);
- $this->data->flags->useCustomUpgrades = (bool) ($flags & 0x0200);
- $this->data->flags->mapPropertiesMenuOpened = (bool) ($flags & 0x0400);
- $this->data->flags->showWaterWavesOnCliffShores = (bool) ($flags & 0x0800);
- $this->data->flags->showWaterWavesOnRollingShores = (bool) ($flags & 0x1000);
- $this->data->tileset = $this->readRaw(1);
- $this->data->loadingScreenNumber = $this->readLong();
- if ($this->data->version >= 25) {
- $this->data->loadingScreenModel = $this->readString();
- }
- $this->data->loadingScreenText = $this->readString();
- $this->data->loadingScreenTitle = $this->readString();
- $this->data->loadingScreenSubtitle = $this->readString();
- $this->data->gameDataSet = $this->readLong();
- if ($this->data->version >= 25) {
- $this->data->prologueScreenModel = $this->readString();
- }
- $this->data->prologueText = $this->readString();
- $this->data->prologueTitle = $this->readString();
- $this->data->prologueSubtitle = $this->readString();
- if ($this->data->version >= 25) {
- $this->data->usesFog = $this->readLong();
- $this->data->fogStartZHeight = $this->readFloat();
- $this->data->fogEndZHeight = $this->readFloat();
- $this->data->fogDensity = $this->readFloat();
- $this->data->fogColorRed = $this->readRaw(1);
- $this->data->fogColorGreen = $this->readRaw(1);
- $this->data->fogColorBlue = $this->readRaw(1);
- $this->data->fogColorAlpha = $this->readRaw(1);
- $this->data->weatherID = $this->readLong();
- $this->data->customSoundEnvironment = $this->readString();
- $this->data->customLightTileset = $this->readRaw(1);
- $this->data->waterColorRed = $this->readRaw(1);
- $this->data->waterColorGreen = $this->readRaw(1);
- $this->data->waterColorBlue = $this->readRaw(1);
- $this->data->waterColorAlpha = $this->readRaw(1);
- }
- if ($this->data->version >= 28) {
- $this->data->isLua = $this->readLong();
- }
- $this->data->players = $this->readLong();
- // And more...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement