/** * * @author OLiver */ unsigned PreviewMinimap::CalcPixelColor(const void * param, const MapCoord x, const MapCoord y, const unsigned t) { const glArchivItem_Map& s2map = *static_cast<const glArchivItem_Map*>(param); unsigned color = 0; // Baum an dieser Stelle? unsigned char landscape_obj = s2map.GetMapDataAt(MAP_TYPE, x, y); if(landscape_obj >= 0xC4 && landscape_obj <= 0xC6) color = VaryBrightness(TREE_COLOR,VARY_TREE_COLOR); // Granit an dieser Stelle? else if(landscape_obj == 0xCC || landscape_obj == 0xCD) color = VaryBrightness(GRANITE_COLOR,VARY_GRANITE_COLOR); // Ansonsten die jeweilige Terrainfarbe nehmen else { color = TERRAIN_COLORS[s2map.getHeader().getGfxSet()] [TERRAIN_INDIZES[s2map.GetMapDataAt(MapLayer(MAP_TERRAIN1+t),x,y)]]; // Schattierung int r = GetRed(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40; int g = GetGreen(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40; int b = GetBlue(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40; if(r < 0) r = 0; if(r > 255) r = 255; if(g < 0) g = 0; if(g > 255) g = 255; if(b < 0) b = 0; if(b > 255) b = 255; color = MakeColor(0xFF,unsigned(r),unsigned(g),unsigned(b)); } return color; }
MapLayer EditorMap::addLayer(std::string layerName, I32 index) { MapLayer temp = MapLayer((mWidth * mHeight), layerName); if (mLayers.size() >= MAX_LAYERS) return temp; mLayers.insert(mLayers.begin() + index, temp); setWorkingLayer(mLayers[index].getName()); std::cout << "size: " << mLayers.size() << std::endl; std::cout << "capacity: " << mLayers.capacity() << std::endl; mIsSaved = false; return temp; }