- small bits of cleanup.

This commit is contained in:
Christoph Oelckers 2019-10-08 22:23:48 +02:00
parent 93f9303c62
commit ef0fd57367
4 changed files with 11 additions and 56 deletions

View file

@ -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))

View file

@ -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

View file

@ -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.

View file

@ -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];
}