Enjoy the classic broodwar game with improved mechanics, new units, upgrades, abilities, and lot of changes that will improve the gameplay and open new strategies and compositions to fight with.

Forum Thread
  Posts  
Map Reveal at the start of the match (Games : StarCraft : Mods : SC Revolution Mod : Forum : Plugin Sources and implementations : Map Reveal at the start of the match) Locked
Thread Options
May 30 2016 Anchor

This code is pretty simple
We need to reveal each tile of the map and also reveal every mineral field and and gas geyser. So we can do it like this:

     void exploreMap(){ 
		for(int x = 0; x < mapTileSize->width; x++) { 
			for(int y = 0; y < mapTileSize->height; y++) { 
				ActiveTile *currentTile = &(*activeTileArray)[(x) + mapTileSize->width * (y)]; 
				currentTile->exploredFlags = 0; 					
			} 
		} 
		//if vespene geyser or a mineral field, reveal it to all players
		for (CUnit *unit = *firstVisibleUnit; unit; unit = unit->link.next) {
			if (unit->id==188 || (unit->id >= 176 && unit->id <= 178)){
				unit->sprite->visibilityFlags=0xFF; 
			}
		}
	}

And we call the exploreMap() function on the block that execute at the start of every match in game_hooks

if (*elapsedTimeFrames == 0) {
    if(*GAME_TYPE != GameType::UseMapSettings) { //not an UMS map
	exploreMap();
    }
}




Edited by: RavenWolf

Jun 2 2016 Anchor

Is there any difference between

unit->sprite->visibilityFlags = 127; 

and

unit->sprite->visibilityFlags = 0xFF; 

????

Jun 2 2016 Anchor

Yeah 0xFF (or 255) is the correct value. i dont know why i use 127 (probably i assume that the first bit was for neutral, but there are 8 bits so one for each player)
Thanks for pointing that out.

Edited by: RavenWolf

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.