mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- code cleanup
removed some unused definitions replaced the copybuf* functions with memcpy. These days doing homegrown copy loops is not efficient anymore.
This commit is contained in:
parent
66218dd074
commit
0604c72586
9 changed files with 15 additions and 81 deletions
|
@ -13,7 +13,3 @@ static FORCE_INLINE int32_t paletteGetClosestColor(int32_t r, int32_t g, int32_t
|
|||
{
|
||||
return getclosestcol_lim(r, g, b, 255);
|
||||
}
|
||||
static FORCE_INLINE int32_t getclosestcol_nocache(int32_t r, int32_t g, int32_t b)
|
||||
{
|
||||
return getclosestcol_nocache_lim(r, g, b, 255);
|
||||
}
|
||||
|
|
|
@ -1169,8 +1169,6 @@ static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
|
|||
|
||||
////////// Paths //////////
|
||||
|
||||
char *Bgethomedir(void);
|
||||
|
||||
int32_t Bcorrectfilename(char *filename, int32_t removefn);
|
||||
|
||||
////////// String manipulation //////////
|
||||
|
|
|
@ -189,9 +189,6 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
|
|||
#ifndef pragmas_have_clearbuf
|
||||
void clearbuf(void *d, int32_t c, int32_t a);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c);
|
||||
#endif
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c);
|
||||
#endif
|
||||
|
@ -199,9 +196,6 @@ void swapbuf4(void *a, void *b, int32_t c);
|
|||
#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_copybufreverse
|
||||
void copybufreverse(const void *S, void *D, int32_t c);
|
||||
#endif
|
||||
|
|
|
@ -73,29 +73,6 @@ void set_memerr_handler(void(*handlerfunc)(int32_t, const char *, const char *))
|
|||
g_MemErrHandler = handlerfunc;
|
||||
}
|
||||
|
||||
//
|
||||
// Stuff which must be a function
|
||||
//
|
||||
char *Bgethomedir(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
char appdata[MAX_PATH];
|
||||
|
||||
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
|
||||
{
|
||||
return Xstrdup(appdata);
|
||||
}
|
||||
return NULL;
|
||||
#elif defined EDUKE32_OSX
|
||||
return osx_gethomedir();
|
||||
#else
|
||||
char *e = getenv("HOME");
|
||||
if (!e) return NULL;
|
||||
return Xstrdup(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t Bcorrectfilename(char *filename, int32_t removefn)
|
||||
{
|
||||
|
|
|
@ -4468,7 +4468,7 @@ static void classicDrawBunches(int32_t bunch)
|
|||
smostwall[smostwallcnt] = z;
|
||||
smostwalltype[smostwallcnt] = 1; //1 for umost
|
||||
smostwallcnt++;
|
||||
copybufbyte(&umost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
memcpy(&umost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
smostcnt += i;
|
||||
}
|
||||
}
|
||||
|
@ -4554,7 +4554,7 @@ static void classicDrawBunches(int32_t bunch)
|
|||
smostwall[smostwallcnt] = z;
|
||||
smostwalltype[smostwallcnt] = 2; //2 for dmost
|
||||
smostwallcnt++;
|
||||
copybufbyte(&dmost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
memcpy(&dmost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
smostcnt += i;
|
||||
}
|
||||
}
|
||||
|
@ -5023,16 +5023,6 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (x=0; x<xdimen; x++)
|
||||
{
|
||||
if (daumost[x]>=0 && daumost[x]<ydimen)
|
||||
*(char *)(frameplace + x + bytesperline*daumost[x]) = editorcolors[13];
|
||||
if (dadmost[x]>=0 && dadmost[x]<ydimen)
|
||||
*(char *)(frameplace + x + bytesperline*dadmost[x]) = editorcolors[14];
|
||||
}
|
||||
#endif
|
||||
|
||||
videoEndDrawing(); //}}}
|
||||
}
|
||||
|
||||
|
@ -11637,8 +11627,8 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
|||
rendmode = REND_CLASSIC;
|
||||
#endif
|
||||
|
||||
copybufbyte(&startumost[windowxy1.x],&bakumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakumost[0]));
|
||||
copybufbyte(&startdmost[windowxy1.x],&bakdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakdmost[0]));
|
||||
memcpy(&startumost[windowxy1.x],&bakumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakumost[0]));
|
||||
memcpy(&startdmost[windowxy1.x],&bakdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakdmost[0]));
|
||||
setviewcnt++;
|
||||
|
||||
offscreenrendering = 1;
|
||||
|
@ -11672,8 +11662,8 @@ void renderRestoreTarget(void)
|
|||
ydim = bakysiz[setviewcnt];
|
||||
videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y,
|
||||
bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y);
|
||||
copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0]));
|
||||
copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0]));
|
||||
memcpy(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0]));
|
||||
memcpy(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0]));
|
||||
frameplace = bakframeplace[setviewcnt];
|
||||
|
||||
calc_ylookup((setviewcnt == 0) ? bytesperline : bakxsiz[setviewcnt],
|
||||
|
|
|
@ -71,17 +71,6 @@ void clearbuf(void *d, int32_t c, int32_t a)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c)
|
||||
{
|
||||
auto p = (const int32_t *) s;
|
||||
auto q = (int32_t *) d;
|
||||
|
||||
while (c--)
|
||||
*q++ = *p++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c)
|
||||
{
|
||||
|
@ -113,16 +102,6 @@ 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)
|
||||
{
|
||||
auto src = (const char *)s;
|
||||
auto dst = (char *)d;
|
||||
|
||||
while (c--)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// copybufreverse() is a special case: use the assembly version for GCC on x86
|
||||
|
|
|
@ -161,7 +161,7 @@ static void AddAnItem(const char* item)
|
|||
void G_AddExternalSearchPaths(TArray<FString> &searchpaths)
|
||||
{
|
||||
FString path;
|
||||
char *homepath = Bgethomedir();
|
||||
char *homepath = getenv("HOME");
|
||||
|
||||
path.Format("%s/.steam/steam", homepath);
|
||||
G_AddSteamPaths(searchpaths, buf);
|
||||
|
|
|
@ -1801,7 +1801,7 @@ void Net_GetInput(void)
|
|||
|
||||
if (g_player[myconnectindex].movefifoend&(g_movesPerPacket-1))
|
||||
{
|
||||
copybufbyte(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex],
|
||||
memcpy(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex],
|
||||
&inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input_t));
|
||||
g_player[myconnectindex].movefifoend++;
|
||||
return;
|
||||
|
@ -2179,7 +2179,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
continue;
|
||||
}
|
||||
|
||||
copybufbyte(&osyn[i],&nsyn[i],sizeof(input_t));
|
||||
memcpy(&osyn[i],&nsyn[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)
|
||||
|
@ -2218,7 +2218,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(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t));
|
||||
g_player[i].movefifoend++;
|
||||
}
|
||||
|
||||
|
@ -2232,7 +2232,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(&osyn[other],&nsyn[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)
|
||||
|
@ -2271,7 +2271,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(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
g_player[other].movefifoend++;
|
||||
}
|
||||
|
||||
|
@ -2295,7 +2295,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(&osyn[other],&nsyn[other],sizeof(input_t));
|
||||
k = packbuf[j] + (int)(packbuf[j+1]<<8);
|
||||
j += 2;
|
||||
|
||||
|
@ -2331,7 +2331,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(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
g_player[other].movefifoend++;
|
||||
}
|
||||
|
||||
|
|
|
@ -3174,7 +3174,7 @@ void movelava(char *dapic)
|
|||
offs2 = (LAVASIZ + 2) + 1 + ((intptr_t) lavabakpic);
|
||||
for (x = 0; x < LAVASIZ; x++)
|
||||
{
|
||||
copybuf(offs, offs2, LAVASIZ >> 2);
|
||||
memcpy(offs, offs2, LAVASIZ);
|
||||
offs += LAVASIZ;
|
||||
offs2 += LAVASIZ + 2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue