From 6931c565dfb7469c298660103d0bf3a3456260de Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 29 Apr 2020 11:43:33 +0000 Subject: [PATCH] Some compile fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5684 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- build_wip.sh | 7 ++++++- engine/client/m_mp3.c | 18 +++++++++--------- engine/common/net_wins.c | 2 +- engine/common/pr_bgcmd.c | 1 + engine/d3d/d3d11_image.c | 4 ++-- engine/d3d/d3d_image.c | 4 ++-- engine/qclib/pr_edict.c | 2 ++ 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/build_wip.sh b/build_wip.sh index 6912505d6..e99549955 100755 --- a/build_wip.sh +++ b/build_wip.sh @@ -325,12 +325,17 @@ if [ "$BUILD_LINUXx86" != "n" ]; then cd csaddon/src $BUILDFOLDER/linux_x86/fteqcc32 -srcfile csaddon.src > $BUILDLOGFOLDER/csaddon.txt mv ../csaddon.dat $BUILDFOLDER/csaddon/ + cd .. + zip -9 $BUILDFOLDER/csaddon/csaddon.pk3 csaddon.dat - cd ../../menusys + cd $SVNROOT/quakec + cd menusys $BUILDFOLDER/linux_x86/fteqcc32 -srcfile menu.src > $BUILDLOGFOLDER/menu.txt rm -f fteqcc.log zip -q -9 -o -r $BUILDFOLDER/csaddon/menusys_src.zip . mv ../menu.dat $BUILDFOLDER/csaddon/ + cd .. + zip -9 $BUILDFOLDER/csaddon/menusys.pk3 menu.dat else echo "Skiping csaddon + qcmenu, no compiler build" fi diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index e03df1591..6e239c3bb 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -4913,7 +4913,7 @@ typedef struct qbyte *dstdata; unsigned int srcspeed; - unsigned int srcwidth; + qaudiofmt_t srcformat; unsigned int srcchannels; unsigned int srcoffset; /*in bytes*/ unsigned int srclen; /*in bytes*/ @@ -4992,7 +4992,7 @@ sfxcache_t *QDECL S_MP3_Locate(sfx_t *sfx, sfxcache_t *buf, ssamplepos_t start, ACMSTREAMHEADER strhdr; char buffer[8192]; extern cvar_t snd_linearresample_stream; - int framesz = (dec->srcwidth/8 * dec->srcchannels); + int framesz = (QAF_BYTES(dec->srcformat) * dec->srcchannels); if (length) { @@ -5053,12 +5053,12 @@ sfxcache_t *QDECL S_MP3_Locate(sfx_t *sfx, sfxcache_t *buf, ssamplepos_t start, SND_ResampleStream(strhdr.pbDst, dec->srcspeed, - dec->srcwidth/8, + dec->srcformat, dec->srcchannels, strhdr.cbDstLengthUsed / framesz, dec->dstdata+dec->dstcount*framesz, snd_speed, - dec->srcwidth/8, + dec->srcformat, dec->srcchannels, snd_linearresample_stream.ival); dec->dstcount = newlen; @@ -5070,7 +5070,7 @@ sfxcache_t *QDECL S_MP3_Locate(sfx_t *sfx, sfxcache_t *buf, ssamplepos_t start, buf->numchannels = dec->srcchannels; buf->soundoffset = dec->dststart; buf->speed = snd_speed; - buf->width = dec->srcwidth/8; + buf->format = dec->srcformat; if (dec->srclen == dec->srcoffset && start >= dec->dststart+dec->dstcount) return NULL; //once we reach the EOF, start reporting errors. @@ -5128,15 +5128,15 @@ static qboolean QDECL S_LoadMP3Sound (sfx_t *s, qbyte *data, size_t datalen, int dec->srcspeed = 44100; dec->srcchannels = 2; - dec->srcwidth = 16; + dec->srcformat = QAF_S16; memset (&pcm_format, 0, sizeof(pcm_format)); pcm_format.wFormatTag = WAVE_FORMAT_PCM; pcm_format.nChannels = dec->srcchannels; pcm_format.nSamplesPerSec = dec->srcspeed; - pcm_format.nBlockAlign = dec->srcwidth/8*dec->srcchannels; - pcm_format.nAvgBytesPerSec = pcm_format.nSamplesPerSec*dec->srcwidth/8*dec->srcchannels; - pcm_format.wBitsPerSample = dec->srcwidth; + pcm_format.nBlockAlign = QAF_BYTES(dec->srcformat)*dec->srcchannels; + pcm_format.nAvgBytesPerSec = pcm_format.nSamplesPerSec*QAF_BYTES(dec->srcformat)*dec->srcchannels; + pcm_format.wBitsPerSample = QAF_BYTES(dec->srcformat)*8; pcm_format.cbSize = 0; mp3format.wfx.cbSize = MPEGLAYER3_WFX_EXTRA_BYTES; diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 8e3a31d1b..0c179aefe 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -9266,7 +9266,7 @@ vfsfile_t *FS_OpenTCP(const char *name, int defaultport) return NULL; } #else -vfsfile_t *FS_OpenTCP(const char *name, int defaultport) +vfsfile_t *FS_OpenTCP(const char *name, int defaultport, qboolean assumetls) { return NULL; } diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index 0c4709e78..91c2b24dc 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -3849,6 +3849,7 @@ void QCBUILTIN PF_strunzone(pubprogfuncs_t *prinst, struct globalvars_s *pr_glob { #ifdef QCGC //gc frees everything for us. + //FIXME: explicitly free it anyway, to save running the gc quite so often. #else prinst->AddressableFree(prinst, prinst->stringtable + G_INT(OFS_PARM0)); #endif diff --git a/engine/d3d/d3d11_image.c b/engine/d3d/d3d11_image.c index 1df251180..80dcedd18 100644 --- a/engine/d3d/d3d11_image.c +++ b/engine/d3d/d3d11_image.c @@ -38,7 +38,7 @@ void D3D11_DestroyTexture (texid_t tex) qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mips) { - unsigned int blockbytes, blockwidth, blockheight; + unsigned int blockbytes, blockwidth, blockheight, blockdepth; HRESULT hr; D3D11_TEXTURE2D_DESC tdesc = {0}; D3D11_SUBRESOURCE_DATA *subresdesc; @@ -316,7 +316,7 @@ qboolean D3D11_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mi return false; } - Image_BlockSizeForEncoding(mips->encoding, &blockbytes, &blockwidth, &blockheight); + Image_BlockSizeForEncoding(mips->encoding, &blockbytes, &blockwidth, &blockheight, &blockdepth); if (!mips->mip[0].data) { diff --git a/engine/d3d/d3d_image.c b/engine/d3d/d3d_image.c index 35945c819..a10ea8fed 100644 --- a/engine/d3d/d3d_image.c +++ b/engine/d3d/d3d_image.c @@ -27,7 +27,7 @@ qboolean D3D9_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mip D3DSURFACE_DESC desc; IDirect3DBaseTexture9 *dbt; qboolean swap = false; - unsigned int blockwidth, blockheight, blockbytes; + unsigned int blockwidth, blockheight, blockdepth, blockbytes; //NOTE: d3d9 formats are written as little-endian packed formats, so RR GG BB AA -> 0xAABBGGRR //whereas fte formats vary depending on whether they're packed or byte-aligned. @@ -109,7 +109,7 @@ qboolean D3D9_LoadTextureMips(image_t *tex, const struct pendingtextureinfo *mip if (mips->type != ((tex->flags&IF_TEXTYPEMASK)>>IF_TEXTYPESHIFT)) return false; - Image_BlockSizeForEncoding(mips->encoding, &blockbytes, &blockwidth, &blockheight); + Image_BlockSizeForEncoding(mips->encoding, &blockbytes, &blockwidth, &blockheight, &blockdepth); if (!pD3DDev9) return false; //can happen on errors diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 55f10b948..e0b1498d4 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -926,6 +926,7 @@ char *PR_GlobalString (progfuncs_t *progfuncs, int ofs, struct QCC_type_s **type { etype_t type; //urgh, this is so hideous +#if !defined(MINIMAL) && !defined(OMIT_QCC) if (typehint == &type_float) type = ev_float; else if (typehint == &type_string) @@ -937,6 +938,7 @@ char *PR_GlobalString (progfuncs_t *progfuncs, int ofs, struct QCC_type_s **type else if (typehint == &type_field) type = ev_field; else +#endif type = ev_integer; s = PR_ValueString (progfuncs, type, val, false); sprintf (line,"%i(?)%s", ofs, s);