From ef0fd5736789a8364ddf6726bfdf2895ef9ad8bd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 8 Oct 2019 22:23:48 +0200 Subject: [PATCH] - small bits of cleanup. --- source/build/src/cache1d.cpp | 5 ++-- source/build/src/defs.cpp | 8 +++--- source/build/src/engine_priv.h | 45 ---------------------------------- source/build/src/tiles.cpp | 9 +++---- 4 files changed, 11 insertions(+), 56 deletions(-) diff --git a/source/build/src/cache1d.cpp b/source/build/src/cache1d.cpp index e7103ba4a..9eefdea92 100644 --- a/source/build/src/cache1d.cpp +++ b/source/build/src/cache1d.cpp @@ -225,8 +225,9 @@ int32_t cacheFindBlock(int32_t newbytes, int32_t *besto, int32_t *bestz) void cacheAllocateBlock(intptr_t* newhandle, int32_t newbytes, uint8_t* newlockptr) { // Make all requests a multiple of the system page size - int const pageSize = Bgetpagesize(); - newbytes = (newbytes + pageSize-1) & ~(pageSize-1); + // No, no, no! This wastes exorbitant amounts of memory for precisely nothing! + //int const pageSize = Bgetpagesize(); + //newbytes = (newbytes + pageSize-1) & ~(pageSize-1); #ifdef DEBUGGINGAIDS if (EDUKE32_PREDICT_FALSE(!newlockptr || *newlockptr == 0)) diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 398946fc1..dca55c18f 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -1017,7 +1017,7 @@ static int32_t defsparser(scriptfile *script) if (texstatus < 0) break; - picanm[tile].Clear(); + picanm[tile] = {}; break; } @@ -1041,7 +1041,7 @@ static int32_t defsparser(scriptfile *script) if (xsiz > 0 && ysiz > 0) { tileSetSize(tile, xsiz, ysiz); - picanm[tile].Clear(); + picanm[tile] = {}; tileSetupDummy(tile); } @@ -1072,7 +1072,7 @@ static int32_t defsparser(scriptfile *script) for (i=tile1; i<=tile2; i++) { tileSetSize(i, xsiz, ysiz); - picanm[i].Clear(); + picanm[i] = {}; tileSetupDummy(i); } @@ -2287,7 +2287,7 @@ static int32_t defsparser(scriptfile *script) if (xsiz > 0 && ysiz > 0) { tileSetSize(tile, xsiz, ysiz); - picanm[tile].Clear(); + picanm[tile] = {}; tileSetupDummy(tile); } #ifdef USE_OPENGL diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 11472a5a4..86eea23e9 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -207,57 +207,12 @@ extern int32_t m32_numdebuglines; -#if defined(_MSC_VER) && !defined(NOASM) - -static inline void setgotpic(int32_t a) -{ - _asm { - push ebx - mov eax, a - mov ebx, eax - cmp byte ptr walock[eax], 200 - jae skipit - mov byte ptr walock[eax], 199 -skipit: - shr eax, 3 - and ebx, 7 - mov dl, byte ptr gotpic[eax] - mov bl, byte ptr pow2char[ebx] - or dl, bl - mov byte ptr gotpic[eax], dl - pop ebx - } -} - -#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER - -#define setgotpic(a) \ -({ int32_t __a=(a); \ - __asm__ __volatile__ ( \ - "movl %%eax, %%ebx\n\t" \ - "cmpb $200, " ASMSYM("walock") "(%%eax)\n\t" \ - "jae 0f\n\t" \ - "movb $199, " ASMSYM("walock") "(%%eax)\n\t" \ - "0:\n\t" \ - "shrl $3, %%eax\n\t" \ - "andl $7, %%ebx\n\t" \ - "movb " ASMSYM("gotpic") "(%%eax), %%dl\n\t" \ - "movb " ASMSYM("pow2char_") "(%%ebx), %%bl\n\t" \ - "orb %%bl, %%dl\n\t" \ - "movb %%dl, " ASMSYM("gotpic") "(%%eax)" \ - : "=a" (__a) : "a" (__a) \ - : "ebx", "edx", "memory", "cc"); \ - __a; }) - -#else // __GNUC__ && __i386__ - static FORCE_INLINE void setgotpic(int32_t tilenume) { if (walock[tilenume] < 200) walock[tilenume] = 199; gotpic[tilenume>>3] |= pow2char[tilenume&7]; } -#endif // Get properties of parallaxed sky to draw. // Returns: pointer to tile offset array. Sets-by-pointer the other three. diff --git a/source/build/src/tiles.cpp b/source/build/src/tiles.cpp index fd02162ab..53579343e 100644 --- a/source/build/src/tiles.cpp +++ b/source/build/src/tiles.cpp @@ -26,6 +26,7 @@ EDUKE32_STATIC_ASSERT(MAXARTFILES_TOTAL <= 256); static int32_t tilefileoffs[MAXTILES]; + // Backup tilefilenum[] and tilefileoffs[]. These get allocated only when // necessary (have per-map ART files). static uint8_t *g_bakTileFileNum; @@ -251,7 +252,7 @@ static void tileSoftDelete(int32_t const tile) waloff[tile] = 0; faketile[tile>>3] &= ~pow2char[tile&7]; - picanm[tile].Clear(); + picanm[tile] = {}; } void tileDelete(int32_t const tile) @@ -680,9 +681,7 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer) char const *fn = artGetIndexedFileName(tfn); - auto kopen4loadfunc = bloodhack == 2 ? kopen4loadfrommod : kopen4load; - - artfil = kopen4loadfunc(fn, 0); + artfil = kopen4loadfrommod(fn, 0); if (artfil == buildvfs_kfd_invalid) { @@ -744,7 +743,7 @@ intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz) cacheAllocateBlock(&waloff[tilenume], dasiz, &walock[tilenume]); tileSetSize(tilenume, xsiz, ysiz); - picanm[tilenume].Clear(); + picanm[tilenume] = {}; return waloff[tilenume]; }