diff --git a/source/build/include/build.h b/source/build/include/build.h index 9645964a6..80c086141 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -390,7 +390,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange int32_t (*blacklist_sprite_func)(int32_t) = nullptr) ATTRIBUTE((nonnull(6,7,8))); int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2); -int32_t inside(int32_t x, int32_t y, int16_t sectnum); +int32_t inside(int32_t x, int32_t y, int sectnum); void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags = 0); int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in, int32_t vx, int32_t vy, int32_t vz, @@ -418,9 +418,9 @@ inline int32_t krand(void) int32_t krand(void); #endif -inline int32_t ksqrt(uint32_t num) +inline int32_t ksqrt(uint64_t num) { - return int(sqrt((float)num)); + return int(sqrt(double(num))); } int32_t getangle(int32_t xvect, int32_t yvect); @@ -459,36 +459,36 @@ void yax_getzsofslope(int sectNum, int playerX, int playerY, int32_t* pCeilZ, in int32_t yax_getceilzofslope(int const sectnum, vec2_t const vect); int32_t yax_getflorzofslope(int const sectnum, vec2_t const vect); -inline int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) +inline int32_t getceilzofslope(int sectnum, int32_t dax, int32_t day) { return getceilzofslopeptr((usectorptr_t)§or[sectnum], dax, day); } -inline int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day) +inline int32_t getflorzofslope(int sectnum, int32_t dax, int32_t day) { return getflorzofslopeptr((usectorptr_t)§or[sectnum], dax, day); } -inline void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) +inline void getzsofslope(int sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) { getzsofslopeptr((usectorptr_t)§or[sectnum], dax, day, ceilz, florz); } -inline void getcorrectzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) +inline void getcorrectzsofslope(int sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) { vec2_t closest = { dax, day }; getsectordist(closest, sectnum, &closest); getzsofslopeptr((usectorptr_t)§or[sectnum], closest.x, closest.y, ceilz, florz); } -inline int32_t getcorrectceilzofslope(int16_t sectnum, int32_t dax, int32_t day) +inline int32_t getcorrectceilzofslope(int sectnum, int32_t dax, int32_t day) { vec2_t closest = { dax, day }; getsectordist(closest, sectnum, &closest); return getceilzofslopeptr((usectorptr_t)§or[sectnum], closest.x, closest.y); } -inline int32_t getcorrectflorzofslope(int16_t sectnum, int32_t dax, int32_t day) +inline int32_t getcorrectflorzofslope(int sectnum, int32_t dax, int32_t day) { vec2_t closest = { dax, day }; getsectordist(closest, sectnum, &closest); diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 109d34380..2a3ba6352 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -295,7 +295,7 @@ static inline int32_t cliptrace(vec2_t const pos, vec2_t * const goal) { int32_t hitwall = -1; - for (native_t z=clipnum-1; z>=0; z--) + for (int z=clipnum-1; z>=0; z--) { vec2_t const p1 = { clipit[z].x1, clipit[z].y1 }; vec2_t const p2 = { clipit[z].x2, clipit[z].y2 }; @@ -716,13 +716,13 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int int32_t hitwalls[4], hitwall; int32_t clipReturn = 0; - native_t cnt = clipmoveboxtracenum; + int cnt = clipmoveboxtracenum; do { if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE && (xvect|yvect)) { - for (native_t i=clipnum-1;i>=0;--i) + for (int i=clipnum-1;i>=0;--i) { if (!bitmap_test(clipignore, i) && clipinsideboxline(pos->x, pos->y, clipit[i].x1, clipit[i].y1, clipit[i].x2, clipit[i].y2, walldist)) { @@ -750,7 +750,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int int32_t const templl2 = (int32_t)clamp(compat_maybe_truncate_to_int32((int64_t)(goal.x - vec.x) * clipr.x + (int64_t)(goal.y - vec.y) * clipr.y), INT32_MIN, INT32_MAX); int32_t const i = (enginecompatibility_mode == ENGINECOMPATIBILITY_19950829 || (abs(templl2)>>11) < templl) ? - DivScaleL(templl2, templl, 20) : 0; + (int)DivScaleL(templl2, templl, 20) : 0; goal = { MulScale(clipr.x, i, 20)+vec.x, MulScale(clipr.y, i, 20)+vec.y }; } @@ -807,7 +807,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int int32_t tempint2, tempint1 = INT32_MAX; *sectnum = -1; - for (native_t j=numsectors-1; j>=0; j--) + for (int j=numsectors-1; j>=0; j--) if (inside(pos->x, pos->y, j) == 1) { if (enginecompatibility_mode != ENGINECOMPATIBILITY_19950829 && (sector[j].ceilingstat&2)) @@ -819,7 +819,8 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int { if (tempint2 < tempint1) { - *sectnum = j; tempint1 = tempint2; + *sectnum = (int16_t)j; + tempint1 = tempint2; } } else @@ -831,12 +832,13 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int if (tempint2 <= 0) { - *sectnum = j; + *sectnum = (int16_t)j; return clipReturn; } if (tempint2 < tempint1) { - *sectnum = j; tempint1 = tempint2; + *sectnum = (int16_t)j; + tempint1 = tempint2; } } } @@ -1257,9 +1259,9 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * { if (tmp==NULL) { - if (inside(x1,y1,sec-sector) == 1) + if (inside(x1,y1,int(sec-sector)) == 1) { - hit_set(hit, sec-sector, -1, -1, x1, y1, z1); + hit_set(hit, int(sec-sector), -1, -1, x1, y1, z1); hitscan_hitsectcf = (how+1)>>1; } } @@ -1267,12 +1269,12 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * { const int32_t curidx=(int32_t)tmp[0]; auto const curspr=(spritetype *)tmp[1]; - const int32_t thislastsec = tmp[2]; + const int32_t thislastsec = (int32_t)tmp[2]; if (!thislastsec) { - if (inside(x1,y1,sec-sector) == 1) - hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1); + if (inside(x1,y1,int(sec-sector)) == 1) + hit_set(hit, int(curspr->sectnum), -1, int(curspr-sprite), x1, y1, z1); } } } diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a7e2a68c8..8e0f7896d 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -778,7 +778,7 @@ int32_t inside_old(int32_t x, int32_t y, int16_t sectnum) return -1; } -int32_t inside(int32_t x, int32_t y, int16_t sectnum) +int32_t inside(int32_t x, int32_t y, int sectnum) { switch (enginecompatibility_mode) { diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index bac6b65cf..157dc1f23 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -19,6 +19,12 @@ #include "hw_voxels.h" #include "../../glbackend/glbackend.h" +#ifdef _MSC_VER +// just make it shut up. Most of this file will go down the drain anyway soon. +#pragma warning(disable:4244) +#pragma warning(disable:4267) +#endif + static int32_t curextra=MAXTILES; #define MIN_CACHETIME_PRINT 10 diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index a8a7572bc..95d4bef9d 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -28,6 +28,10 @@ Ken Silverman's official web site: http://www.advsys.net/ken #include "gamestruct.h" #include "hw_voxels.h" +#ifdef _MSC_VER +// just make it shut up. Most of this file will go down the drain anyway soon. +#pragma warning(disable:4244) +#endif typedef struct { union { double x; double d; }; @@ -309,7 +313,7 @@ static void polymost_updaterotmat(void) renderSetVisibility(g_visibility * fxdimen * (1.f / (65536.f)) / r_ambientlight); } -const vec2_16_t tileSize(size_t index) +const vec2_16_t tileSize(int index) { vec2_16_t v = { (int16_t)tileWidth(index), (int16_t)tileHeight(index) }; return v;