mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Use std::min and std::max instead of min and max macros.
git-svn-id: https://svn.eduke32.com/eduke32@7078 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e77325f2a4
commit
9613bbac33
21 changed files with 105 additions and 101 deletions
|
@ -47,7 +47,7 @@ static playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
|
|||
|
||||
voice->sound = voice->NextBlock;
|
||||
voice->position -= voice->length;
|
||||
voice->length = min(voice->BlockLength, 0x8000);
|
||||
voice->length = min(voice->BlockLength, 0x8000u);
|
||||
voice->NextBlock += voice->length * (voice->channels * voice->bits / 8);
|
||||
voice->BlockLength -= voice->length;
|
||||
voice->length <<= 16;
|
||||
|
@ -57,18 +57,18 @@ static playbackstatus MV_GetNextWAVBlock(VoiceNode *voice)
|
|||
|
||||
static playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
|
||||
{
|
||||
size_t blocklength = 0;
|
||||
uint32_t samplespeed = 0; // XXX: compiler-happy on synthesis
|
||||
uint32_t tc = 0;
|
||||
unsigned BitsPerSample;
|
||||
unsigned Channels;
|
||||
unsigned Format;
|
||||
size_t blocklength = 0;
|
||||
uint32_t samplespeed = 0; // XXX: compiler-happy on synthesis
|
||||
uint32_t tc = 0;
|
||||
unsigned BitsPerSample;
|
||||
unsigned Channels;
|
||||
unsigned Format;
|
||||
|
||||
if (voice->BlockLength > 0)
|
||||
{
|
||||
voice->position -= voice->length;
|
||||
voice->sound += (voice->length >> 16) * (voice->channels * voice->bits / 8);
|
||||
voice->length = min(voice->BlockLength, 0x8000);
|
||||
voice->length = min(voice->BlockLength, 0x8000u);
|
||||
voice->BlockLength -= voice->length;
|
||||
voice->length <<= 16;
|
||||
return KeepPlaying;
|
||||
|
@ -295,7 +295,7 @@ end_of_data:
|
|||
blocklength /= 2;
|
||||
|
||||
voice->position = 0;
|
||||
voice->length = min(blocklength, 0x8000);
|
||||
voice->length = min(blocklength, 0x8000ull);
|
||||
voice->BlockLength = blocklength - voice->length;
|
||||
voice->length <<= 16;
|
||||
|
||||
|
|
|
@ -412,6 +412,8 @@ defined __x86_64__ || defined __amd64__ || defined _M_X64 || defined _M_IA64 ||
|
|||
|
||||
#ifdef __cplusplus
|
||||
# if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800)
|
||||
# include <algorithm>
|
||||
# include <functional>
|
||||
# include <type_traits>
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1011,27 +1013,29 @@ static FORCE_INLINE uint64_t B_UNBUF64(void const * const vbuf)
|
|||
|
||||
////////// Abstract data operations //////////
|
||||
|
||||
#define ABSTRACT_DECL static FORCE_INLINE WARN_UNUSED_RESULT
|
||||
|
||||
#ifdef __cplusplus
|
||||
template <typename T, typename X, typename Y> ABSTRACT_DECL T clamp(T in, X min, Y max) { return in <= (T) min ? (T) min : (in >= (T) max ? (T) max : in); }
|
||||
template <typename T, typename X, typename Y> ABSTRACT_DECL T clamp2(T in, X min, Y max) { return in >= (T) max ? (T) max : (in <= (T) min ? (T) min : in); }
|
||||
using std::min;
|
||||
using std::max;
|
||||
# define fclamp clamp
|
||||
# define fclamp2 clamp2
|
||||
#else
|
||||
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
|
||||
ABSTRACT_DECL int32_t clamp(int32_t in, int32_t min, int32_t max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
ABSTRACT_DECL float fclamp(float in, float min, float max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
// Clamp <in> to [<min>..<max>]. The case in >= max is handled first.
|
||||
ABSTRACT_DECL int32_t clamp2(int32_t in, int32_t min, int32_t max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
ABSTRACT_DECL float fclamp2(float in, float min, float max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
|
||||
#ifndef min
|
||||
# define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
# define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define CLAMP_DECL static FORCE_INLINE WARN_UNUSED_RESULT
|
||||
|
||||
#ifdef __cplusplus
|
||||
template <typename T, typename X, typename Y> CLAMP_DECL T clamp(T in, X min, Y max) { return in <= (T) min ? (T) min : (in >= (T) max ? (T) max : in); }
|
||||
template <typename T, typename X, typename Y> CLAMP_DECL T clamp2(T in, X min, Y max) { return in >= (T) max ? (T) max : (in <= (T) min ? (T) min : in); }
|
||||
# define fclamp clamp
|
||||
# define fclamp2 clamp2
|
||||
#else
|
||||
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
|
||||
CLAMP_DECL int32_t clamp(int32_t in, int32_t min, int32_t max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
CLAMP_DECL float fclamp(float in, float min, float max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
// Clamp <in> to [<min>..<max>]. The case in >= max is handled first.
|
||||
CLAMP_DECL int32_t clamp2(int32_t in, int32_t min, int32_t max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
CLAMP_DECL float fclamp2(float in, float min, float max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
#endif
|
||||
|
||||
////////// Mathematical operations //////////
|
||||
|
|
|
@ -1074,8 +1074,8 @@ static void handle_sprite_in_clipboard(int32_t i)
|
|||
sprite[i].shade = tempshade;
|
||||
sprite[i].blend = tempblend;
|
||||
sprite[i].pal = temppal;
|
||||
sprite[i].xrepeat = max(tempxrepeat, 1);
|
||||
sprite[i].yrepeat = max(tempyrepeat, 1);
|
||||
sprite[i].xrepeat = max(tempxrepeat, 1u);
|
||||
sprite[i].yrepeat = max(tempyrepeat, 1u);
|
||||
sprite[i].cstat = tempcstat;
|
||||
}
|
||||
}
|
||||
|
@ -1976,7 +1976,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal)
|
|||
}
|
||||
|
||||
|
||||
static int32_t newnumwalls=-1;
|
||||
static int16_t newnumwalls=-1;
|
||||
|
||||
void ovh_whiteoutgrab(int32_t restoreredwalls)
|
||||
{
|
||||
|
@ -2071,10 +2071,10 @@ static void duplicate_selected_sectors(void)
|
|||
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
|
||||
checksectorpointer(j, highlightsector[i]);
|
||||
|
||||
minx = min(minx, wall[j].x);
|
||||
maxx = max(maxx, wall[j].x);
|
||||
miny = min(miny, wall[j].y);
|
||||
maxy = max(maxy, wall[j].y);
|
||||
minx = min(minx, TrackerCast(wall[j].x));
|
||||
maxx = max(maxx, TrackerCast(wall[j].x));
|
||||
miny = min(miny, TrackerCast(wall[j].y));
|
||||
maxy = max(maxy, TrackerCast(wall[j].y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2232,7 +2232,7 @@ void update_highlightsector(void)
|
|||
if (hlsectorbitmap[i>>3]&(1<<(i&7)))
|
||||
{
|
||||
highlightsector[highlightsectorcnt++] = i;
|
||||
minhlsectorfloorz = min(minhlsectorfloorz, sector[i].floorz);
|
||||
minhlsectorfloorz = min(minhlsectorfloorz, TrackerCast(sector[i].floorz));
|
||||
numhlsecwalls += sector[i].wallnum;
|
||||
}
|
||||
|
||||
|
@ -2964,7 +2964,7 @@ static void M32_MarkPointInsertion(int32_t thewall)
|
|||
// 1 if inserted point on a plain white or 2 points on a plain red wall.
|
||||
// N >= 2 if inserted N points on TROR-constrained wall.
|
||||
// N|(EXPECTED<<16) if inserted N points but EXPECTED walls were expected.
|
||||
static int32_t M32_InsertPoint(int32_t thewall, int32_t dax, int32_t day, int32_t onewnumwalls, int32_t *mapwallnum)
|
||||
static int32_t M32_InsertPoint(int32_t thewall, int32_t dax, int32_t day, int16_t onewnumwalls, int32_t *mapwallnum)
|
||||
{
|
||||
#ifdef YAX_ENABLE
|
||||
int32_t nextw = wall[thewall].nextwall;
|
||||
|
@ -7818,7 +7818,7 @@ end_batch_insert_points:
|
|||
duplicate_selected_sprites();
|
||||
else if (linehighlight2 >= 0)
|
||||
{
|
||||
int32_t onewnumwalls = newnumwalls;
|
||||
int16_t onewnumwalls = newnumwalls;
|
||||
int32_t wallis2sided = (wall[linehighlight2].nextwall>=0);
|
||||
|
||||
int32_t err = backup_drawn_walls(0);
|
||||
|
@ -7827,7 +7827,7 @@ end_batch_insert_points:
|
|||
{
|
||||
message("Error backing up drawn walls (code %d)!", err);
|
||||
}
|
||||
else if (max(numwalls,onewnumwalls) >= MAXWALLS-wallis2sided)
|
||||
else if (max(numwalls, onewnumwalls) >= MAXWALLS-wallis2sided)
|
||||
{
|
||||
printmessage16("Inserting point would exceed wall limit.");
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ int32_t findfrompath(const char *fn, char **where)
|
|||
|
||||
Bcorrectfilename(ffn,0); // compress relative paths
|
||||
|
||||
int32_t allocsiz = max(maxsearchpathlen, 2); // "./" (aka. curdir)
|
||||
int32_t allocsiz = max<int>(maxsearchpathlen, 2); // "./" (aka. curdir)
|
||||
allocsiz += strlen(ffn);
|
||||
allocsiz += 1; // a nul
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ uint32_t Bgetsysmemsize(void)
|
|||
MEMORYSTATUSEX memst;
|
||||
memst.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
if (aGlobalMemoryStatusEx(&memst))
|
||||
siz = (uint32_t)min(UINT32_MAX, memst.ullTotalPhys);
|
||||
siz = min<uint32_t>(UINT32_MAX, memst.ullTotalPhys);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -246,8 +246,8 @@ void yax_updategrays(int32_t posze)
|
|||
int32_t keep = ((cb<0 || sector[i].ceilingz < posze) && (fb<0 || posze <= sector[i].floorz));
|
||||
if (autogray && (cb>=0 || fb>=0) && (sector[i].ceilingz <= posze && posze <= sector[i].floorz))
|
||||
{
|
||||
mingoodz = min(mingoodz, sector[i].ceilingz);
|
||||
maxgoodz = max(maxgoodz, sector[i].floorz);
|
||||
mingoodz = min(mingoodz, TrackerCast(sector[i].ceilingz));
|
||||
maxgoodz = max(maxgoodz, TrackerCast(sector[i].floorz));
|
||||
}
|
||||
#endif
|
||||
// update grayouts due to editorzrange
|
||||
|
@ -1856,7 +1856,7 @@ static WSHELPER_DECL void calc_vplcinc_sprite(uint32_t *vplc, int32_t *vinc, int
|
|||
|
||||
*vinc = tmpvinc;
|
||||
// Clamp the vertical texture coordinate!
|
||||
*vplc = min(max(0, tmpvplc), UINT32_MAX);
|
||||
*vplc = min(max<uint32_t>(0, tmpvplc), UINT32_MAX);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1923,8 +1923,8 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc)
|
|||
#ifdef MULTI_COLUMN_VLINE
|
||||
for (; (x<=x2)&&(p&3); x++,p++)
|
||||
{
|
||||
y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
y1ve[0] = max<int>(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min<int>(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
if (y2ve[0] <= y1ve[0]) continue;
|
||||
|
||||
palookupoffse[0] = fpalookup + getpalookupsh(mulscale16(swall[x],globvis));
|
||||
|
@ -1940,8 +1940,8 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc)
|
|||
|
||||
for (bssize_t z=3,dax=x+3; z>=0; z--,dax--)
|
||||
{
|
||||
y1ve[z] = max(uwall[dax],startumost[dax+windowxy1.x]-windowxy1.y);
|
||||
y2ve[z] = min(dwall[dax],startdmost[dax+windowxy1.x]-windowxy1.y)-1;
|
||||
y1ve[z] = max<int>(uwall[dax],startumost[dax+windowxy1.x]-windowxy1.y);
|
||||
y2ve[z] = min<int>(dwall[dax],startdmost[dax+windowxy1.x]-windowxy1.y)-1;
|
||||
if (y2ve[z] < y1ve[z]) { bad += pow2char[z]; continue; }
|
||||
|
||||
calc_bufplc(&bufplce[z], lwall[dax], tsiz);
|
||||
|
@ -1996,8 +1996,8 @@ do_mvlineasm1:
|
|||
#endif
|
||||
for (; x<=x2; x++,p++)
|
||||
{
|
||||
y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
y1ve[0] = max<int>(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min<int>(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
if (y2ve[0] <= y1ve[0]) continue;
|
||||
|
||||
palookupoffse[0] = fpalookup + getpalookupsh(mulscale16(swall[x],globvis));
|
||||
|
@ -3038,8 +3038,8 @@ static void transmaskvline(int32_t x)
|
|||
{
|
||||
if ((unsigned)x >= (unsigned)xdimen) return;
|
||||
|
||||
int32_t const y1v = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
int32_t const y2v = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y) - 1;
|
||||
int32_t const y1v = max<int>(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
int32_t const y2v = min<int>(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y) - 1;
|
||||
|
||||
if (y2v < y1v) return;
|
||||
|
||||
|
@ -3075,11 +3075,11 @@ static void transmaskvline2(int32_t x)
|
|||
int32_t y1ve[2], y2ve[2];
|
||||
int32_t x2 = x+1;
|
||||
|
||||
y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y)-1;
|
||||
y1ve[0] = max<int>(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
y2ve[0] = min<int>(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y)-1;
|
||||
if (y2ve[0] < y1ve[0]) { transmaskvline(x2); return; }
|
||||
y1ve[1] = max(uwall[x2],startumost[x2+windowxy1.x]-windowxy1.y);
|
||||
y2ve[1] = min(dwall[x2],startdmost[x2+windowxy1.x]-windowxy1.y)-1;
|
||||
y1ve[1] = max<int>(uwall[x2],startumost[x2+windowxy1.x]-windowxy1.y);
|
||||
y2ve[1] = min<int>(dwall[x2],startdmost[x2+windowxy1.x]-windowxy1.y)-1;
|
||||
if (y2ve[1] < y1ve[1]) { transmaskvline(x); return; }
|
||||
|
||||
palookupoffse[0] = FP_OFF(palookup[globalpal]) + getpalookupsh(mulscale16(swall[x],globvis));
|
||||
|
@ -4876,21 +4876,21 @@ draw_as_face_sprite:
|
|||
#ifdef CLASSIC_SLICE_BY_4
|
||||
for (; x<=rx-4; x+=4)
|
||||
{
|
||||
uwall[x] = max(startumost[windowxy1.x+x]-windowxy1.y, (int16_t) startum);
|
||||
uwall[x+1] = max(startumost[windowxy1.x+x+1]-windowxy1.y, (int16_t) startum);
|
||||
uwall[x+2] = max(startumost[windowxy1.x+x+2]-windowxy1.y, (int16_t) startum);
|
||||
uwall[x+3] = max(startumost[windowxy1.x+x+3]-windowxy1.y, (int16_t) startum);
|
||||
uwall[x] = max<int>(startumost[windowxy1.x+x]-windowxy1.y, startum);
|
||||
uwall[x+1] = max<int>(startumost[windowxy1.x+x+1]-windowxy1.y, startum);
|
||||
uwall[x+2] = max<int>(startumost[windowxy1.x+x+2]-windowxy1.y, startum);
|
||||
uwall[x+3] = max<int>(startumost[windowxy1.x+x+3]-windowxy1.y, startum);
|
||||
|
||||
dwall[x] = min(startdmost[windowxy1.x+x]-windowxy1.y, (int16_t) startdm);
|
||||
dwall[x+1] = min(startdmost[windowxy1.x+x+1]-windowxy1.y, (int16_t) startdm);
|
||||
dwall[x+2] = min(startdmost[windowxy1.x+x+2]-windowxy1.y, (int16_t) startdm);
|
||||
dwall[x+3] = min(startdmost[windowxy1.x+x+3]-windowxy1.y, (int16_t) startdm);
|
||||
dwall[x] = min<int>(startdmost[windowxy1.x+x]-windowxy1.y, startdm);
|
||||
dwall[x+1] = min<int>(startdmost[windowxy1.x+x+1]-windowxy1.y, startdm);
|
||||
dwall[x+2] = min<int>(startdmost[windowxy1.x+x+2]-windowxy1.y, startdm);
|
||||
dwall[x+3] = min<int>(startdmost[windowxy1.x+x+3]-windowxy1.y, startdm);
|
||||
}
|
||||
#endif
|
||||
for (; x<=rx; x++)
|
||||
{
|
||||
uwall[x] = max(startumost[windowxy1.x+x]-windowxy1.y,(int16_t)startum);
|
||||
dwall[x] = min(startdmost[windowxy1.x+x]-windowxy1.y,(int16_t)startdm);
|
||||
uwall[x] = max<int>(startumost[windowxy1.x+x]-windowxy1.y,startum);
|
||||
dwall[x] = min<int>(startdmost[windowxy1.x+x]-windowxy1.y,startdm);
|
||||
}
|
||||
|
||||
int32_t daclip = 0;
|
||||
|
@ -5507,8 +5507,8 @@ draw_as_face_sprite:
|
|||
|
||||
for (x=lx; x<=rx; x++)
|
||||
{
|
||||
uwall[x] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
dwall[x] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
uwall[x] = max<int>(uwall[x],startumost[x+windowxy1.x]-windowxy1.y);
|
||||
dwall[x] = min<int>(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y);
|
||||
}
|
||||
|
||||
//Additional uwall/dwall clipping goes here
|
||||
|
@ -8768,7 +8768,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
|
||||
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||
globalbufplc = waloff[globalpicnum];
|
||||
globalshade = max(min(sec->floorshade,numshades-1),0);
|
||||
globalshade = max(min<int>(sec->floorshade,numshades-1),0);
|
||||
globvis = globalhisibility;
|
||||
if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16));
|
||||
globalpolytype = 0;
|
||||
|
|
|
@ -192,9 +192,8 @@ static void suckbitsnextblock()
|
|||
if (zipfilmode)
|
||||
{
|
||||
//NOTE: should only read bytes inside compsize, not 64K!!! :/
|
||||
int32_t n;
|
||||
B_BUF32(&olinbuf[0], B_UNBUF32(&olinbuf[sizeof(olinbuf)-4]));
|
||||
n = min((unsigned) (kzfs.compleng-kzfs.comptell), sizeof(olinbuf)-4);
|
||||
uint32_t n = min<uint32_t>(kzfs.compleng-kzfs.comptell, sizeof(olinbuf)-4);
|
||||
fread(&olinbuf[4], n, 1, kzfs.fil);
|
||||
kzfs.comptell += n;
|
||||
bitpos -= ((sizeof(olinbuf)-4)<<3);
|
||||
|
@ -2855,7 +2854,7 @@ int32_t kzread(void *buffer, int32_t leng)
|
|||
kzfs.jmpplc = 0;
|
||||
|
||||
//Initialize for suckbits/peekbits/getbits
|
||||
kzfs.comptell = min((unsigned)kzfs.compleng,sizeof(olinbuf));
|
||||
kzfs.comptell = min<int32_t>(kzfs.compleng,sizeof(olinbuf));
|
||||
fread(&olinbuf[0],kzfs.comptell,1,kzfs.fil);
|
||||
//Make it re-load when there are < 32 bits left in FIFO
|
||||
bitpos = -(((int32_t)sizeof(olinbuf)-4)<<3);
|
||||
|
|
|
@ -2221,7 +2221,7 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// tinting
|
||||
pc[0] = pc[1] = pc[2] = ((float)(numshades-min(max((globalshade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades);
|
||||
pc[0] = pc[1] = pc[2] = ((float)numshades - min(max((globalshade * shadescale) + m->shadeoff, 0.f), (float)numshades)) / (float)numshades;
|
||||
polytintflags_t const tintflags = hictinting[globalpal].f;
|
||||
if (!(tintflags & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
|
|
|
@ -488,7 +488,7 @@ static int32_t osdfunc_listsymbols(osdfuncparm_t const * const parm)
|
|||
|
||||
for (i=symbols; i!=NULL; i=i->next)
|
||||
if (i->func != OSD_UNALIASED)
|
||||
maxwidth = max((unsigned)maxwidth,Bstrlen(i->name));
|
||||
maxwidth = max<int>(maxwidth, Bstrlen(i->name));
|
||||
|
||||
if (maxwidth > 0)
|
||||
{
|
||||
|
@ -1004,7 +1004,7 @@ int32_t OSD_HandleChar(char ch)
|
|||
commonsize = diffpt;
|
||||
}
|
||||
|
||||
maxwidth = max((unsigned)maxwidth, Bstrlen(symb->name));
|
||||
maxwidth = max<int>(maxwidth, Bstrlen(symb->name));
|
||||
lastmatch = symb;
|
||||
|
||||
if (!lastmatch->next)
|
||||
|
|
|
@ -2921,7 +2921,7 @@ static int32_t polymer_buildfloor(int16_t sectnum)
|
|||
|
||||
if (s->floor.indices == NULL)
|
||||
{
|
||||
s->indicescount = (max(3, sec->wallnum) - 2) * 3;
|
||||
s->indicescount = (max<int16_t>(3, sec->wallnum) - 2) * 3;
|
||||
s->floor.indices = (GLushort *)Xcalloc(s->indicescount, sizeof(GLushort));
|
||||
s->ceil.indices = (GLushort *)Xcalloc(s->indicescount, sizeof(GLushort));
|
||||
}
|
||||
|
@ -4509,7 +4509,7 @@ static void polymer_drawmdsprite(uspritetype *tspr)
|
|||
color = mdspritematerial.diffusemodulation;
|
||||
|
||||
color[0] = color[1] = color[2] =
|
||||
(GLubyte)(((float)(numshades-min(max((tspr->shade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades) * 0xFF);
|
||||
(GLubyte)(((float)(numshades-min(max((tspr->shade * shadescale)+m->shadeoff,0.f),(float)numshades)))/((float)numshades) * 0xFF);
|
||||
|
||||
usinghighpal = (pr_highpalookups &&
|
||||
prhighpalookups[curbasepal][tspr->pal].map);
|
||||
|
|
|
@ -2111,7 +2111,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
|
|||
static int32_t fullbrightloadingpass = 0;
|
||||
vec2s_t const & tsizart = tilesiz[dapic];
|
||||
vec2_t siz = { 0, 0 }, tsiz = { tsizart.x, tsizart.y };
|
||||
size_t const picdim = tsiz.x*tsiz.y;
|
||||
int const picdim = tsiz.x*tsiz.y;
|
||||
char hasalpha = 0, hasfullbright = 0;
|
||||
char npoty = 0;
|
||||
|
||||
|
|
|
@ -972,8 +972,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
|
|||
|
||||
float pc[4];
|
||||
|
||||
pc[0] = pc[1] = pc[2] =
|
||||
(float)(numshades-min(max((globalshade * shadescale)+m->shadeoff, 0), numshades)) / (float)numshades;
|
||||
pc[0] = pc[1] = pc[2] = ((float)numshades - min(max((globalshade * shadescale) + m->shadeoff, 0.f), (float)numshades)) / (float)numshades;
|
||||
hictinting_apply(pc, globalpal);
|
||||
|
||||
pc[3] = (tspr->cstat&2) ? glblend[tspr->blend].def[!!(tspr->cstat&512)].alpha : 1.0f;
|
||||
|
|
|
@ -6406,7 +6406,7 @@ static void Keys3d(void)
|
|||
#endif
|
||||
temppicnum = AIMED_SELOVR_WALL(picnum);
|
||||
tempxrepeat = AIMED_SEL_WALL(xrepeat);
|
||||
tempxrepeat = max(1, tempxrepeat);
|
||||
tempxrepeat = max<int>(1, tempxrepeat);
|
||||
tempyrepeat = AIMED_SEL_WALL(yrepeat);
|
||||
tempxpanning = AIMED_SEL_WALL(xpanning);
|
||||
tempypanning = AIMED_SEL_WALL(ypanning);
|
||||
|
@ -6612,13 +6612,13 @@ static void Keys3d(void)
|
|||
if (AIMING_AT_WALL_OR_MASK && eitherCTRL) //Ctrl-shift Enter (auto-shade)
|
||||
{
|
||||
int16_t daang;
|
||||
int32_t dashade[2] = { 127, -128 };
|
||||
int8_t dashade[2] = { 127, -128 };
|
||||
|
||||
i = searchwall;
|
||||
do
|
||||
{
|
||||
dashade[0] = min(dashade[0], wall[i].shade);
|
||||
dashade[1] = max(dashade[1], wall[i].shade);
|
||||
dashade[0] = min(dashade[0], TrackerCast(wall[i].shade));
|
||||
dashade[1] = max(dashade[1], TrackerCast(wall[i].shade));
|
||||
|
||||
i = wall[i].point2;
|
||||
}
|
||||
|
@ -6862,8 +6862,8 @@ paste_ceiling_or_floor:
|
|||
|
||||
if (somethingintab == SEARCH_SPRITE)
|
||||
{
|
||||
sprite[searchwall].xrepeat = max(tempxrepeat, 1);
|
||||
sprite[searchwall].yrepeat = max(tempyrepeat, 1);
|
||||
sprite[searchwall].xrepeat = max(tempxrepeat, 1u);
|
||||
sprite[searchwall].yrepeat = max(tempyrepeat, 1u);
|
||||
sprite[searchwall].cstat = tempcstat;
|
||||
sprite[searchwall].lotag = templotag;
|
||||
sprite[searchwall].hitag = temphitag;
|
||||
|
@ -7326,8 +7326,8 @@ static void Keys2d(void)
|
|||
if (yax_getbunch(i, YAX_FLOOR) < 0 /*&& yax_getbunch(i, YAX_CEILING) < 0*/)
|
||||
continue;
|
||||
|
||||
loz = min(loz, sector[i].floorz);
|
||||
hiz = max(hiz, sector[i].floorz);
|
||||
loz = min(loz, TrackerCast(sector[i].floorz));
|
||||
hiz = max(hiz, TrackerCast(sector[i].floorz));
|
||||
|
||||
// TODO: see if at least one sector point inside sceeen
|
||||
j = (sector[i].floorz-pos.z)*zsign;
|
||||
|
@ -7383,8 +7383,8 @@ static void Keys2d(void)
|
|||
|
||||
for (i=0; i<highlightsectorcnt; i++)
|
||||
{
|
||||
damin = min(damin, sector[highlightsector[i]].ceilingz);
|
||||
damax = max(damax, sector[highlightsector[i]].floorz);
|
||||
damin = min(damin, TrackerCast(sector[highlightsector[i]].ceilingz));
|
||||
damax = max(damax, TrackerCast(sector[highlightsector[i]].floorz));
|
||||
}
|
||||
|
||||
if (damin < damax)
|
||||
|
@ -7579,7 +7579,7 @@ static void Keys2d(void)
|
|||
if ((ppointhighlight&0xc000) == 16384 && (sprite[cursprite].cstat & 48))
|
||||
{
|
||||
uint8_t *repeat = (k==0) ? &sprite[cursprite].xrepeat : &sprite[cursprite].yrepeat;
|
||||
*repeat = max(4, changechar(*repeat, changedir, smooshy, 1));
|
||||
*repeat = max<uint8_t>(4, changechar(*repeat, changedir, smooshy, 1));
|
||||
silentmessage("Sprite %d repeat: %d, %d", cursprite,
|
||||
TrackerCast(sprite[cursprite].xrepeat),
|
||||
TrackerCast(sprite[cursprite].yrepeat));
|
||||
|
|
|
@ -4978,10 +4978,10 @@ FAKE_F3:
|
|||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
g_player[myconnectindex].ps->zoom += mulscale6(timerOffset, max(g_player[myconnectindex].ps->zoom, 256));
|
||||
g_player[myconnectindex].ps->zoom += mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
g_player[myconnectindex].ps->zoom -= mulscale6(timerOffset, max(g_player[myconnectindex].ps->zoom, 256));
|
||||
g_player[myconnectindex].ps->zoom -= mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
||||
|
||||
g_player[myconnectindex].ps->zoom = clamp(g_player[myconnectindex].ps->zoom, 48, 2048);
|
||||
}
|
||||
|
|
|
@ -100,15 +100,17 @@ void VM_ScriptInfo(intptr_t const *ptr, int range)
|
|||
{
|
||||
initprintf("\n");
|
||||
|
||||
for (intptr_t const *pScript = max(ptr - (range >> 1), apScript), *p_end = min(ptr + (range >> 1), apScript + g_scriptSize); pScript < p_end;
|
||||
pScript++)
|
||||
for (auto pScript = max<intptr_t const *>(ptr - (range >> 1), apScript),
|
||||
p_end = min<intptr_t const *>(ptr + (range >> 1), apScript + g_scriptSize);
|
||||
pScript < p_end;
|
||||
++pScript)
|
||||
{
|
||||
initprintf("%5d: %3d: ", (int32_t) (pScript - apScript), (int32_t) (pScript - ptr));
|
||||
initprintf("%5d: %3d: ", (int32_t)(pScript - apScript), (int32_t)(pScript - ptr));
|
||||
|
||||
if (*pScript >> 12 && (*pScript & VM_INSTMASK) < CON_END)
|
||||
initprintf("%5d %s\n", (int32_t) (*pScript >> 12), VM_GetKeywordForID(*pScript & VM_INSTMASK));
|
||||
initprintf("%5d %s\n", (int32_t)(*pScript >> 12), VM_GetKeywordForID(*pScript & VM_INSTMASK));
|
||||
else
|
||||
initprintf("%d\n", (int32_t) *pScript);
|
||||
initprintf("%d\n", (int32_t)*pScript);
|
||||
}
|
||||
|
||||
initprintf("\n");
|
||||
|
|
|
@ -726,7 +726,7 @@ static int32_t C_SkipComments(void)
|
|||
// Be sure to have enough space allocated for the command to be parsed next.
|
||||
// Currently, the commands that potentially need the most space are
|
||||
// various string handling function that accept inline strings.
|
||||
if ((unsigned)(g_scriptPtr-apScript) > (unsigned)(g_scriptSize - max(40, MAXQUOTELEN/sizeof(instype)+8)))
|
||||
if ((unsigned)(g_scriptPtr-apScript) > (unsigned)(g_scriptSize - max<int>(40, MAXQUOTELEN/sizeof(instype)+8)))
|
||||
return C_SetScriptSize(g_scriptSize<<1);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -3957,7 +3957,7 @@ static void Menu_ReadSaveGameHeaders()
|
|||
{
|
||||
ReadSaveGameHeaders();
|
||||
|
||||
size_t const numloaditems = max(g_nummenusaves, 1), numsaveitems = g_nummenusaves+1;
|
||||
uint32_t const numloaditems = max(g_nummenusaves, 1u), numsaveitems = g_nummenusaves+1;
|
||||
ME_LOAD = (MenuEntry_t *)Xrealloc(ME_LOAD, g_nummenusaves * sizeof(MenuEntry_t));
|
||||
MEL_LOAD = (MenuEntry_t **)Xrealloc(MEL_LOAD, numloaditems * sizeof(MenuEntry_t *));
|
||||
MEO_SAVE = (MenuString_t *)Xrealloc(MEO_SAVE, g_nummenusaves * sizeof(MenuString_t));
|
||||
|
|
|
@ -181,7 +181,7 @@ static int32_t osdcmd_map(osdfuncparm_t const * const parm)
|
|||
fnlist_getnames(&fnlist, "/", filename, -1, 0);
|
||||
|
||||
for (r=fnlist.findfiles; r; r=r->next)
|
||||
maxwidth = max((unsigned)maxwidth, Bstrlen(r->name));
|
||||
maxwidth = max<int>(maxwidth, Bstrlen(r->name));
|
||||
|
||||
if (maxwidth > 0)
|
||||
{
|
||||
|
|
|
@ -801,7 +801,7 @@ void P_ResetWeapons(int playerNum)
|
|||
pPlayer->curr_weapon = PISTOL_WEAPON;
|
||||
pPlayer->kickback_pic = PWEAPON(playerNum, pPlayer->curr_weapon, TotalTime);
|
||||
pPlayer->gotweapon = ((1 << PISTOL_WEAPON) | (1 << KNEE_WEAPON) | (1 << HANDREMOTE_WEAPON));
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON] = min(pPlayer->max_ammo_amount[PISTOL_WEAPON], 48);
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON] = min<int16_t>(pPlayer->max_ammo_amount[PISTOL_WEAPON], 48);
|
||||
pPlayer->last_weapon = -1;
|
||||
pPlayer->show_empty_weapon = 0;
|
||||
pPlayer->last_pissed_time = 0;
|
||||
|
@ -1396,7 +1396,7 @@ end_vol4a:
|
|||
{
|
||||
pPlayer->curr_weapon = weaponNum;
|
||||
pPlayer->gotweapon |= (1 << weaponNum);
|
||||
pPlayer->ammo_amount[weaponNum] = min(pPlayer->max_ammo_amount[weaponNum], 48);
|
||||
pPlayer->ammo_amount[weaponNum] = min<int16_t>(pPlayer->max_ammo_amount[weaponNum], 48);
|
||||
}
|
||||
else if (PWEAPON(0, weaponNum, WorksLike) == KNEE_WEAPON || PWEAPON(0, weaponNum, WorksLike) == HANDREMOTE_WEAPON)
|
||||
pPlayer->gotweapon |= (1 << weaponNum);
|
||||
|
|
|
@ -140,7 +140,7 @@ bool g_saveRequested;
|
|||
savebrief_t * g_quickload;
|
||||
|
||||
menusave_t * g_menusaves;
|
||||
size_t g_nummenusaves;
|
||||
uint32_t g_nummenusaves;
|
||||
|
||||
static menusave_t * g_internalsaves;
|
||||
static size_t g_numinternalsaves;
|
||||
|
|
|
@ -114,7 +114,7 @@ extern bool g_saveRequested;
|
|||
extern savebrief_t * g_quickload;
|
||||
|
||||
extern menusave_t * g_menusaves;
|
||||
extern size_t g_nummenusaves;
|
||||
extern uint32_t g_nummenusaves;
|
||||
|
||||
int32_t sv_updatestate(int32_t frominit);
|
||||
int32_t sv_readdiff(int32_t fil);
|
||||
|
|
Loading…
Reference in a new issue