@@ -139,9 +139,9 @@ bool setblendmaporigin(BlendMapCache *cache, const ivec &o, int size)
139139 BlendMapBranch *bm = blendmap.branch ;
140140 int bmscale = worldscale-BM_SCALE, bmsize = 1 <<bmscale,
141141 x = o.x >>BM_SCALE, y = o.y >>BM_SCALE,
142- x1 = max (x- 1 , 0 ), y1 = max (y- 1 , 0 ),
143- x2 = min (((o.x + size + (1 <<BM_SCALE)-1 )>>BM_SCALE) + 1 , bmsize),
144- y2 = min (((o.y + size + (1 <<BM_SCALE)-1 )>>BM_SCALE) + 1 , bmsize),
142+ x1 = std:: max (x - 1 , 0 ), y1 = std:: max (y - 1 , 0 ),
143+ x2 = std:: min (((o.x + size + (1 <<BM_SCALE)-1 )>>BM_SCALE) + 1 , bmsize),
144+ y2 = std:: min (((o.y + size + (1 <<BM_SCALE)-1 )>>BM_SCALE) + 1 , bmsize),
145145 diff = (x1^x2)|(y1^y2);
146146 if (diff < bmsize) while (!(diff&(1 <<(bmscale-1 ))))
147147 {
@@ -206,7 +206,7 @@ uchar lookupblendmap(BlendMapCache *cache, const vec &pos)
206206
207207static void fillblendmap (uchar &type, BlendMapNode &node, int size, uchar val, int x1, int y1, int x2, int y2)
208208{
209- if (max (x1, y1) <= 0 && min (x2, y2) >= size)
209+ if (std:: max (x1, y1) <= 0 && std:: min (x2, y2) >= size)
210210 {
211211 node.cleanup (type);
212212 type = BM_SOLID;
@@ -220,16 +220,16 @@ static void fillblendmap(uchar &type, BlendMapNode &node, int size, uchar val, i
220220 if (y1 < size)
221221 {
222222 if (x1 < size) fillblendmap (node.branch ->type [0 ], node.branch ->children [0 ], size, val,
223- x1, y1, min (x2, size), min (y2, size));
223+ x1, y1, std:: min (x2, size), std:: min (y2, size));
224224 if (x2 > size) fillblendmap (node.branch ->type [1 ], node.branch ->children [1 ], size, val,
225- max (x1-size, 0 ), y1, x2-size, min (y2, size));
225+ std:: max (x1-size, 0 ), y1, x2-size, std:: min (y2, size));
226226 }
227227 if (y2 > size)
228228 {
229229 if (x1 < size) fillblendmap (node.branch ->type [2 ], node.branch ->children [2 ], size, val,
230- x1, max (y1-size, 0 ), min (x2, size), y2-size);
230+ x1, std:: max (y1-size, 0 ), std:: min (x2, size), y2-size);
231231 if (x2 > size) fillblendmap (node.branch ->type [3 ], node.branch ->children [3 ], size, val,
232- max (x1-size, 0 ), max (y1-size, 0 ), x2-size, y2-size);
232+ std:: max (x1-size, 0 ), std:: max (y1-size, 0 ), x2-size, y2-size);
233233 }
234234 loopi (4 ) if (node.branch ->type [i]!=BM_SOLID || node.branch ->children [i].solid ->val !=val) return ;
235235 node.cleanup (type);
@@ -269,7 +269,7 @@ void fillblendmap(int x, int y, int w, int h, uchar val)
269269 y1 = clamp (y, 0 , bmsize),
270270 x2 = clamp (x+w, 0 , bmsize),
271271 y2 = clamp (y+h, 0 , bmsize);
272- if (max (x1, y1) >= bmsize || min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
272+ if (std:: max (x1, y1) >= bmsize || std:: min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
273273 fillblendmap (blendmap.type , blendmap, bmsize, val, x1, y1, x2, y2);
274274}
275275
@@ -281,16 +281,16 @@ static void invertblendmap(uchar &type, BlendMapNode &node, int size, int x1, in
281281 if (y1 < size)
282282 {
283283 if (x1 < size) invertblendmap (node.branch ->type [0 ], node.branch ->children [0 ], size,
284- x1, y1, min (x2, size), min (y2, size));
284+ x1, y1, std:: min (x2, size), std:: min (y2, size));
285285 if (x2 > size) invertblendmap (node.branch ->type [1 ], node.branch ->children [1 ], size,
286- max (x1-size, 0 ), y1, x2-size, min (y2, size));
286+ std:: max (x1-size, 0 ), y1, x2-size, std:: min (y2, size));
287287 }
288288 if (y2 > size)
289289 {
290290 if (x1 < size) invertblendmap (node.branch ->type [2 ], node.branch ->children [2 ], size,
291- x1, max (y1-size, 0 ), min (x2, size), y2-size);
291+ x1, std:: max (y1-size, 0 ), std:: min (x2, size), y2-size);
292292 if (x2 > size) invertblendmap (node.branch ->type [3 ], node.branch ->children [3 ], size,
293- max (x1-size, 0 ), max (y1-size, 0 ), x2-size, y2-size);
293+ std:: max (x1-size, 0 ), std:: max (y1-size, 0 ), x2-size, y2-size);
294294 }
295295 return ;
296296 }
@@ -316,7 +316,7 @@ void invertblendmap(int x, int y, int w, int h)
316316 y1 = clamp (y, 0 , bmsize),
317317 x2 = clamp (x+w, 0 , bmsize),
318318 y2 = clamp (y+h, 0 , bmsize);
319- if (max (x1, y1) >= bmsize || min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
319+ if (std:: max (x1, y1) >= bmsize || std:: min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
320320 invertblendmap (blendmap.type , blendmap, bmsize, x1, y1, x2, y2);
321321}
322322
@@ -395,7 +395,7 @@ static void blitblendmap(uchar &type, BlendMapNode &node, int bmx, int bmy, int
395395 int x1 = clamp (sx - bmx, 0 , bmsize), y1 = clamp (sy - bmy, 0 , bmsize),
396396 x2 = clamp (sx+sw - bmx, 0 , bmsize), y2 = clamp (sy+sh - bmy, 0 , bmsize);
397397 uchar *dst = &node.image ->data [y1*BM_IMAGE_SIZE + x1];
398- src += max (bmy - sy, 0 )*sw + max (bmx - sx, 0 );
398+ src += std:: max (bmy - sy, 0 )*sw + std:: max (bmx - sx, 0 );
399399 loopi (y2-y1)
400400 {
401401 switch (blendpaintmode)
@@ -405,19 +405,19 @@ static void blitblendmap(uchar &type, BlendMapNode &node, int bmx, int bmy, int
405405 break ;
406406
407407 case 2 :
408- loopi (x2 - x1) dst[i] = min (dst[i], src[i]);
408+ loopi (x2 - x1) dst[i] = std:: min (dst[i], src[i]);
409409 break ;
410410
411411 case 3 :
412- loopi (x2 - x1) dst[i] = max (dst[i], src[i]);
412+ loopi (x2 - x1) dst[i] = std:: max (dst[i], src[i]);
413413 break ;
414414
415415 case 4 :
416- loopi (x2 - x1) dst[i] = min (dst[i], uchar (0xFF - src[i]));
416+ loopi (x2 - x1) dst[i] = std:: min (dst[i], uchar (0xFF - src[i]));
417417 break ;
418418
419419 case 5 :
420- loopi (x2 - x1) dst[i] = max (dst[i], uchar (0xFF - src[i]));
420+ loopi (x2 - x1) dst[i] = std:: max (dst[i], uchar (0xFF - src[i]));
421421 break ;
422422 }
423423 dst += BM_IMAGE_SIZE;
@@ -428,7 +428,7 @@ static void blitblendmap(uchar &type, BlendMapNode &node, int bmx, int bmy, int
428428void blitblendmap (uchar *src, int sx, int sy, int sw, int sh)
429429{
430430 int bmsize = hdr.worldsize >>BM_SCALE;
431- if (max (sx, sy) >= bmsize || min (sx+sw, sy+sh) <= 0 || min (sw, sh) <= 0 ) return ;
431+ if (std:: max (sx, sy) >= bmsize || std:: min (sx+sw, sy+sh) <= 0 || std:: min (sw, sh) <= 0 ) return ;
432432 blitblendmap (blendmap.type , blendmap, 0 , 0 , bmsize, src, sx, sy, sw, sh);
433433}
434434
@@ -554,7 +554,7 @@ void addblendbrush(const char *name, const char *imgname)
554554
555555 ImageData s;
556556 if (!loadimage (imgname, s)) { conoutf (" \f rcould not load blend brush image %s" , imgname); return ; }
557- if (max (s.w , s.h ) > (1 <<12 ))
557+ if (std:: max (s.w , s.h ) > (1 <<12 ))
558558 {
559559 conoutf (" \f rblend brush image size exceeded %dx%d pixels: %s" , 1 <<12 , 1 <<12 , imgname);
560560 return ;
@@ -738,7 +738,7 @@ void renderblendbrush()
738738 x2 = x1 + (brush->w << BM_SCALE),
739739 y2 = y1 + (brush->h << BM_SCALE);
740740
741- if (max (x1, y1) >= hdr.worldsize || min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
741+ if (std:: max (x1, y1) >= hdr.worldsize || std:: min (x2, y2) <= 0 || x1>=x2 || y1>=y2) return ;
742742
743743 if (!brush->tex ) brush->gentex ();
744744 renderblendbrush (brush->tex , x1, y1, x2 - x1, y2 - y1);
0 commit comments