diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 487225bb7..2edc3fea1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -671,7 +671,6 @@ set (PCH_SOURCES build/src/animvpx.cpp build/src/clip.cpp build/src/common.cpp - build/src/compat.cpp build/src/defs.cpp build/src/engine.cpp build/src/hash.cpp diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index ebe3d4838..1c320b7f8 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -79,7 +79,6 @@ skip: extern uint32_t divideu32_noinline(uint32_t n, uint32_t d); extern int32_t tabledivide32_noinline(int32_t n, int32_t d); -extern int64_t tabledivide64_noinline(int64_t n, int64_t d); static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(qw(eax) << by(ecx), ebx)); } @@ -169,18 +168,6 @@ static FORCE_INLINE CONSTEXPR int32_t dmulscale(int32_t eax, int32_t edx, int32_ } #endif -#ifndef pragmas_have_qinterpolatedown16 -void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add); -void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add); -#endif - -#ifndef pragmas_have_clearbufbyte -void clearbufbyte(void *D, int32_t c, int32_t a); -#endif -#ifndef pragmas_have_copybufbyte -void copybufbyte(const void *S, void *D, int32_t c); -#endif - #ifndef pragmas_have_krecipasm static inline int32_t krecipasm(int32_t i) { diff --git a/source/build/src/common.cpp b/source/build/src/common.cpp index 191108e1a..0f490a88c 100644 --- a/source/build/src/common.cpp +++ b/source/build/src/common.cpp @@ -1,4 +1,5 @@ +#define LIBDIVIDE_BODY #include "compat.h" #include "build.h" #include "scriptfile.h" diff --git a/source/build/src/compat.cpp b/source/build/src/compat.cpp deleted file mode 100644 index 9d125589c..000000000 --- a/source/build/src/compat.cpp +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Playing-field leveler for Build - */ - -#define LIBDIVIDE_BODY -#include "compat.h" -#include "debugbreak.h" - - -#include "baselayer.h" - - diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index c6c1e409d..429451344 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1433,21 +1433,6 @@ int32_t animateoffs(int const tilenum, int fakevar) } -static inline void wallmosts_finish(int16_t *mostbuf, int32_t z1, int32_t z2, - int32_t ix1, int32_t iy1, int32_t ix2, int32_t iy2) -{ - const int32_t y = scale(z1, xdimenscale, iy1)<<4; - - // PK 20110423: a bit consistency checking is a good thing: - int32_t const tmp = (ix2 - ix1 >= 0) ? (ix2 - ix1 + 1) : 1; - int32_t const yinc = tabledivide32((scale(z2, xdimenscale, iy2) << 4) - y, tmp); - - qinterpolatedown16short((intptr_t)&mostbuf[ix1], tmp, y + (globalhoriz << 16), yinc); - - mostbuf[ix1] = clamp(mostbuf[ix1], 0, ydimen); - mostbuf[ix2] = clamp(mostbuf[ix2], 0, ydimen); -} - // globalpicnum --> globalxshift, globalyshift static void calc_globalshifts(void) { @@ -1986,12 +1971,12 @@ int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, else if (bot < 0 && (topt > 0 || topu > 0 || topu <= bot)) return -1; - int64_t t = tabledivide64_noinline(topt<<16, bot); + int64_t t = (topt<<16) / bot; *intx = x1 + ((vx*t)>>16); *inty = y1 + ((vy*t)>>16); *intz = z1 + ((vz*t)>>16); - t = tabledivide64_noinline(topu<<16, bot); + t = (topu<<16) / bot; Bassert((unsigned)t < 65536); diff --git a/source/build/src/pragmas.cpp b/source/build/src/pragmas.cpp index 344f8cde4..97608f66d 100644 --- a/source/build/src/pragmas.cpp +++ b/source/build/src/pragmas.cpp @@ -24,60 +24,3 @@ void initdivtables(void) uint32_t divideu32_noinline(uint32_t n, uint32_t d) { return divideu32(n, d); } int32_t tabledivide32_noinline(int32_t n, int32_t d) { return tabledivide32(n, d); } -int64_t tabledivide64_noinline(int64_t n, int64_t d) { return tabledivide64(n, d); } - - -// -// Generic C version -// - -#ifndef pragmas_have_qinterpolatedown16 -void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add) -{ - auto lptr = (int32_t *)bufptr; - for (size_t i = 0, i_end = num; i < i_end; ++i) - { - lptr[i] = val>>16; - val += add; - } -} - -void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add) -{ - auto sptr = (int16_t *)bufptr; - for (size_t i = 0, i_end = num; i < i_end; ++i) - { - sptr[i] = val>>16; - val += add; - } -} -#endif - -#ifndef pragmas_have_clearbufbyte -void clearbufbyte(void *D, int32_t c, int32_t a) -{ - // Cringe City - constexpr int32_t m[4] = { 0xffl, 0xff00l, 0xff0000l, (int32_t)0xff000000l }; - int z = 0; - auto p = (char *)D; - - while ((c--) > 0) - { - *(p++) = (uint8_t)((a & m[z])>>(z<<3)); - z=(z+1)&3; - } -} -#endif - -#ifndef pragmas_have_copybufbyte -void copybufbyte(const void *s, void *d, int32_t c) -{ - auto src = (const char *)s; - auto dst = (char *)d; - - while (c--) - *dst++ = *src++; -} -#endif - - diff --git a/source/rr/src/net.cpp b/source/rr/src/net.cpp index 84e2f5a97..ba568bcb9 100644 --- a/source/rr/src/net.cpp +++ b/source/rr/src/net.cpp @@ -1798,8 +1798,8 @@ void Net_GetInput(void) if (g_player[myconnectindex].movefifoend&(g_movesPerPacket-1)) { - copybufbyte(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex], - &inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input_t)); + memcpy(&inputfifo[g_player[myconnectindex].movefifoend & (MOVEFIFOSIZ - 1)][myconnectindex], + &inputfifo[(g_player[myconnectindex].movefifoend - 1) & (MOVEFIFOSIZ - 1)][myconnectindex], sizeof(input_t)); g_player[myconnectindex].movefifoend++; return; } @@ -2176,7 +2176,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) continue; } - copybufbyte(&osyn[i],&nsyn[i],sizeof(input_t)); + memcpy(&nsyn[i],&osyn[i],sizeof(input_t)); if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (l&4) @@ -2215,7 +2215,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) if (i != myconnectindex) for (j=g_movesPerPacket-1;j>=1;j--) { - copybufbyte(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t)); + memcpy(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i], &nsyn[i],sizeof(input_t)); g_player[i].movefifoend++; } @@ -2229,7 +2229,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; - copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t)); + memcpy(&nsyn[other], &osyn[other], sizeof(input_t)); if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (k&4) @@ -2268,7 +2268,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) for (i=g_movesPerPacket-1;i>=1;i--) { - copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); + memcpy(&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other], &nsyn[other], sizeof(input_t)); g_player[other].movefifoend++; } @@ -2292,7 +2292,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; - copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t)); + memcpy(&nsyn[other], &osyn[other], sizeof(input_t)); k = packbuf[j] + (int)(packbuf[j+1]<<8); j += 2; @@ -2328,7 +2328,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng) for (i=g_movesPerPacket-1;i>=1;i--) { - copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); + memcpy(&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other], &nsyn[other], sizeof(input_t)); g_player[other].movefifoend++; } diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index f75828b44..acb0b825e 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -2185,8 +2185,8 @@ void G_ClearFIFO(void) { Net_ClearFIFO(); - clearbufbyte(&localInput, sizeof(input_t), 0L); - clearbufbyte(&inputfifo, sizeof(input_t) * MOVEFIFOSIZ * MAXPLAYERS, 0L); + memset(&localInput, 0, sizeof(input_t)); + memset(&inputfifo, 0, sizeof(input_t) * MOVEFIFOSIZ * MAXPLAYERS); for (bsize_t p = 0; p <= MAXPLAYERS - 1; ++p) { @@ -2380,8 +2380,6 @@ int G_EnterLevel(int gameMode) Bmemset(gotpic, 0, sizeof(gotpic)); Bmemset(precachehightile, 0, sizeof(precachehightile)); - //clearbufbyte(Actor,sizeof(Actor),0l); // JBF 20040531: yes? no? - prelevel(gameMode); G_InitRRRASkies(); diff --git a/source/sw/src/jplayer.cpp b/source/sw/src/jplayer.cpp index b7e81db3c..c5cb54f17 100644 --- a/source/sw/src/jplayer.cpp +++ b/source/sw/src/jplayer.cpp @@ -665,7 +665,7 @@ void computergetinput(int snum, SW_PACKET *syn) startsect = sprite[p->PlayerSprite].sectnum; endsect = sprite[Player[goalplayer[snum]].PlayerSprite].sectnum; - clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); + memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3); searchsect[0] = startsect; searchparent[0] = -1; dashow2dsector[startsect>>3] |= (1<<(startsect&7)); @@ -691,7 +691,7 @@ void computergetinput(int snum, SW_PACKET *syn) send++; if (j == endsect) { - clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); + memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3); for (k=send-1; k>=0; k=searchparent[k]) dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7)); @@ -751,7 +751,7 @@ void computergetinput(int snum, SW_PACKET *syn) send++; if (j == endsect) { - clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); + memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3); for (k=send-1; k>=0; k=searchparent[k]) dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));