- replaced all uses of Bfree with Xfree so they are subjected to debug instrumentation, uses FStrings in a few cases where it made sense.

- fixed: Sound channels weren't freed.
This commit is contained in:
Christoph Oelckers 2019-12-26 14:43:44 +01:00
parent eff25141a0
commit d473f9c590
15 changed files with 66 additions and 153 deletions

View file

@ -1434,94 +1434,6 @@ static void parsedefinitions_game_include(const char *fileName, scriptfile *pScr
} }
} }
#if 0
static void parsedefinitions_game_animsounds(scriptfile *pScript, const char * blockEnd, char const * fileName, dukeanim_t * animPtr)
{
Bfree(animPtr->sounds);
size_t numPairs = 0, allocSize = 4;
animPtr->sounds = (animsound_t *)Xmalloc(allocSize * sizeof(animsound_t));
animPtr->numsounds = 0;
int defError = 1;
uint16_t lastFrameNum = 1;
while (pScript->textptr < blockEnd)
{
int32_t frameNum;
int32_t soundNum;
// HACK: we've reached the end of the list
// (hack because it relies on knowledge of
// how scriptfile_* preprocesses the text)
if (blockEnd - pScript->textptr == 1)
break;
// would produce error when it encounters the closing '}'
// without the above hack
if (scriptfile_getnumber(pScript, &frameNum))
break;
defError = 1;
if (scriptfile_getsymbol(pScript, &soundNum))
break;
// frame numbers start at 1 for us
if (frameNum <= 0)
{
initprintf("Error: frame number must be greater zero on line %s:%d\n", pScript->filename,
scriptfile_getlinum(pScript, pScript->ltextptr));
break;
}
if (frameNum < lastFrameNum)
{
initprintf("Error: frame numbers must be in (not necessarily strictly)"
" ascending order (line %s:%d)\n",
pScript->filename, scriptfile_getlinum(pScript, pScript->ltextptr));
break;
}
lastFrameNum = frameNum;
if ((unsigned)soundNum >= MAXSOUNDS && soundNum != -1)
{
initprintf("Error: sound number #%d invalid on line %s:%d\n", soundNum, pScript->filename,
scriptfile_getlinum(pScript, pScript->ltextptr));
break;
}
if (numPairs >= allocSize)
{
allocSize *= 2;
animPtr->sounds = (animsound_t *)Xrealloc(animPtr->sounds, allocSize * sizeof(animsound_t));
}
defError = 0;
animsound_t & sound = animPtr->sounds[numPairs];
sound.frame = frameNum;
sound.sound = soundNum;
++numPairs;
}
if (!defError)
{
animPtr->numsounds = numPairs;
// initprintf("Defined sound sequence for hi-anim \"%s\" with %d frame/sound pairs\n",
// hardcoded_anim_tokens[animnum].text, numpairs);
}
else
{
DO_FREE_AND_NULL(animPtr->sounds);
initprintf("Failed defining sound sequence for anim \"%s\".\n", fileName);
}
}
#endif
static int parsedefinitions_game(scriptfile *pScript, int firstPass) static int parsedefinitions_game(scriptfile *pScript, int firstPass)
{ {

View file

@ -161,22 +161,17 @@ void credReset(void)
DoUnFade(1); DoUnFade(1);
} }
FileReader credKOpen4Load(char *&pzFile) FileReader credKOpen4Load(FString pzFile)
{ {
int nLen = strlen(pzFile); int nLen = strlen(pzFile);
for (int i = 0; i < nLen; i++) FixPathSeperator(pzFile);
{
if (pzFile[i] == '\\')
pzFile[i] = '/';
}
auto nHandle = fileSystem.OpenFileReader(pzFile, 0); auto nHandle = fileSystem.OpenFileReader(pzFile, 0);
if (!nHandle.isOpen()) if (!nHandle.isOpen())
{ {
// Hack // Hack
if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/') if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/')
{ {
pzFile += 3; nHandle = fileSystem.OpenFileReader(pzFile.GetChars()+3, 0);
nHandle = fileSystem.OpenFileReader(pzFile, 0);
} }
} }
return nHandle; return nHandle;
@ -200,24 +195,18 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
} }
smkPlayer.sub_82E6C(pzSMK, pzWAV); smkPlayer.sub_82E6C(pzSMK, pzWAV);
#endif #endif
if (Bstrlen(_pzSMK) == 0) if (!_pzSMK || !*_pzSMK)
return; return;
char *pzSMK = Xstrdup(_pzSMK); FString pzSMK = _pzSMK;
char *pzWAV = Xstrdup(_pzWAV); FString pzWAV = _pzWAV;
char *pzSMK_ = pzSMK;
char *pzWAV_ = pzWAV;
auto nHandleSMK = credKOpen4Load(pzSMK); auto nHandleSMK = credKOpen4Load(pzSMK);
if (!nHandleSMK.isOpen()) if (!nHandleSMK.isOpen())
{ {
Bfree(pzSMK_);
Bfree(pzWAV_);
return; return;
} }
SmackerHandle hSMK = Smacker_Open(pzSMK); SmackerHandle hSMK = Smacker_Open(pzSMK);
if (!hSMK.isValid) if (!hSMK.isValid)
{ {
Bfree(pzSMK_);
Bfree(pzWAV_);
return; return;
} }
uint32_t nWidth, nHeight; uint32_t nWidth, nHeight;
@ -228,8 +217,6 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
if (!pFrame) if (!pFrame)
{ {
Smacker_Close(hSMK); Smacker_Close(hSMK);
Bfree(pzSMK_);
Bfree(pzWAV_);
return; return;
} }
int nFrameRate = Smacker_GetFrameRate(hSMK); int nFrameRate = Smacker_GetFrameRate(hSMK);
@ -295,8 +282,6 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
GLInterface.EnableNonTransparent255(false); GLInterface.EnableNonTransparent255(false);
videoSetPalette(0, 0, 8+2); videoSetPalette(0, 0, 8+2);
tileDelete(kSMKTile); tileDelete(kSMKTile);
Bfree(pzSMK_);
Bfree(pzWAV_);
} }
END_BLD_NS END_BLD_NS

View file

@ -1229,7 +1229,7 @@ static FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
return (EDUKE32_PREDICT_TRUE(newptr != NULL || size == 0)) ? newptr: handle_memerr(ptr); return (EDUKE32_PREDICT_TRUE(newptr != NULL || size == 0)) ? newptr: handle_memerr(ptr);
} }
// This will throw up when BFee is no longer usable, I do not want to change all code right now that uses it to make future merges easier. // This will throw up when BFree is no longer usable, I do not want to change all code right now that uses it to make future merges easier.
static_assert(Bfree == free, "BFree must be free"); static_assert(Bfree == free, "BFree must be free");
static FORCE_INLINE void xfree(void *const ptr) { Bfree(ptr); } static FORCE_INLINE void xfree(void *const ptr) { Bfree(ptr); }
@ -1265,6 +1265,7 @@ static FORCE_INLINE void *xaligned_calloc(const bsize_t alignment, const bsize_t
# define EDUKE32_PRE_XALLOC # define EDUKE32_PRE_XALLOC
#endif #endif
#ifndef _DEBUG
#define Xstrdup(s) (EDUKE32_PRE_XALLOC xstrdup(s)) #define Xstrdup(s) (EDUKE32_PRE_XALLOC xstrdup(s))
#define Xmalloc(size) (EDUKE32_PRE_XALLOC xmalloc(size)) #define Xmalloc(size) (EDUKE32_PRE_XALLOC xmalloc(size))
#define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLOC xcalloc(nmemb, size)) #define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLOC xcalloc(nmemb, size))
@ -1273,6 +1274,17 @@ static FORCE_INLINE void *xaligned_calloc(const bsize_t alignment, const bsize_t
#define Xaligned_calloc(alignment, count, size) (EDUKE32_PRE_XALLOC xaligned_calloc(alignment, count, size)) #define Xaligned_calloc(alignment, count, size) (EDUKE32_PRE_XALLOC xaligned_calloc(alignment, count, size))
#define Xfree(ptr) (EDUKE32_PRE_XALLOC xfree(ptr)) #define Xfree(ptr) (EDUKE32_PRE_XALLOC xfree(ptr))
#define Xaligned_free(ptr) (EDUKE32_PRE_XALLOC xaligned_free(ptr)) #define Xaligned_free(ptr) (EDUKE32_PRE_XALLOC xaligned_free(ptr))
#else
// This is for allowing the compiler's heap checker to do its job. When wrapped it only points to the wrapper for a memory leak, not to the real location where the allocation takes place.
#define Xstrdup(s) (strdup(s))
#define Xmalloc(size) (malloc(size))
#define Xcalloc(nmemb, size) (calloc(nmemb, size))
#define Xrealloc(ptr, size) (realloc(ptr, size))
#define Xaligned_alloc(alignment, size) (malloc(size))
#define Xaligned_calloc(alignment, count, size) (calloc(count, size))
#define Xfree(ptr) (free(ptr))
#define Xaligned_free(ptr) (free(ptr))
#endif
////////// More utility functions ////////// ////////// More utility functions //////////

View file

@ -905,7 +905,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length)
if (mip1leng > length - 4) if (mip1leng > length - 4)
{ {
// Invalid KVX file // Invalid KVX file
Bfree(buffer); Xfree(buffer);
return NULL; return NULL;
} }
memcpy(&voxsiz, longptr, sizeof(vec3_t)); memcpy(&voxsiz, longptr, sizeof(vec3_t));
@ -993,7 +993,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length)
DO_FREE_AND_NULL(vcol); DO_FREE_AND_NULL(vcol);
vnum = vmax = 0; vnum = vmax = 0;
DO_FREE_AND_NULL(vcolhashead); DO_FREE_AND_NULL(vcolhashead);
Bfree(buffer); Xfree(buffer);
return vm; return vm;
} }

View file

@ -79,7 +79,7 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic);
if (fp.isOpen()) if (fp.isOpen())
{ {
Bfree(testfn); Xfree(testfn);
return fp; return fp;
} }
@ -95,7 +95,7 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic);
if (fp.isOpen()) if (fp.isOpen())
{ {
Bfree(testfn); Xfree(testfn);
return fp; return fp;
} }
} }
@ -107,12 +107,12 @@ FileReader S_OpenAudio(const char *fn, char searchfirst, uint8_t const ismusic)
auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic); auto fp = S_TryExtensionReplacements(testfn, searchfirst, ismusic);
if (fp.isOpen()) if (fp.isOpen())
{ {
Bfree(testfn); Xfree(testfn);
return fp; return fp;
} }
} }
Bfree(testfn); Xfree(testfn);
return origfp; return origfp;
#endif #endif
} }

View file

@ -1192,10 +1192,10 @@ bool AddINIFile(const char* pzFile, bool bForce = false)
if (findfrompath(pzFile, &pzFN)) return false; // failed to resolve the filename if (findfrompath(pzFile, &pzFN)) return false; // failed to resolve the filename
if (!FileExists(pzFN)) if (!FileExists(pzFN))
{ {
Bfree(pzFN); Xfree(pzFN);
return false; return false;
} // failed to stat the file } // failed to stat the file
Bfree(pzFN); Xfree(pzFN);
IniFile* pTempIni = new IniFile(pzFile); IniFile* pTempIni = new IniFile(pzFile);
if (!pTempIni->FindSection("Episode1")) if (!pTempIni->FindSection("Episode1"))
{ {

View file

@ -65,6 +65,7 @@ int sfx_empty = -1;
void SoundEngine::Init(TArray<uint8_t> &curve) void SoundEngine::Init(TArray<uint8_t> &curve)
{ {
StopAllChannels();
// Free all channels for use. // Free all channels for use.
while (Channels != NULL) while (Channels != NULL)
{ {
@ -1427,7 +1428,7 @@ void SoundEngine::StopChannel(FSoundChan *chan)
chan->Source = NULL; chan->Source = NULL;
} }
} }
GSnd->StopChannel(chan); if (GSnd) GSnd->StopChannel(chan);
} }
else else
{ {

View file

@ -271,7 +271,10 @@ protected:
virtual FSoundID ResolveSound(const void *ent, int srctype, FSoundID soundid, float &attenuation); virtual FSoundID ResolveSound(const void *ent, int srctype, FSoundID soundid, float &attenuation);
public: public:
virtual ~SoundEngine() = default; virtual ~SoundEngine()
{
Shutdown();
}
void EvictAllChannels(); void EvictAllChannels();
void StopChannel(FSoundChan* chan); void StopChannel(FSoundChan* chan);

View file

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include "FileStream.h" #include "FileStream.h"
#include "tarray.h"
namespace SmackerCommon { namespace SmackerCommon {
@ -44,7 +45,7 @@ class BitReader
SmackerCommon::FileStream *file; SmackerCommon::FileStream *file;
uint8_t *cache; TArray<uint8_t> Cache;
void FillCache(); void FillCache();
}; };

View file

@ -29,13 +29,12 @@ BitReader::BitReader(SmackerCommon::FileStream &file, uint32_t size)
this->currentOffset = 0; this->currentOffset = 0;
this->bytesRead = 0; this->bytesRead = 0;
this->cache = (uint8_t*)Xmalloc(size); this->Cache.Resize(size);
file.ReadBytes(this->cache, size); file.ReadBytes(this->Cache.Data(), size);
} }
BitReader::~BitReader() BitReader::~BitReader()
{ {
Bfree(this->cache);
} }
void BitReader::FillCache() void BitReader::FillCache()
@ -54,7 +53,7 @@ uint32_t BitReader::GetPosition()
uint32_t BitReader::GetBit() uint32_t BitReader::GetBit()
{ {
uint32_t ret = (cache[currentOffset>>3]>>(currentOffset&7))&1; uint32_t ret = (Cache[currentOffset>>3]>>(currentOffset&7))&1;
currentOffset++; currentOffset++;
return ret; return ret;
} }

View file

@ -371,7 +371,7 @@ void G_GameExit(const char *msg)
{ {
if (!(msg[0] == ' ' && msg[1] == 0)) if (!(msg[0] == ' ' && msg[1] == 0))
{ {
I_FatalError(msg); I_Error(msg);
} }
} }
throw ExitEvent(0); throw ExitEvent(0);
@ -876,7 +876,7 @@ static void G_ReadGLFrame(void)
} }
} }
Bfree(frame); Xfree(frame);
} }
#endif #endif
@ -4678,7 +4678,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
#endif #endif
for (j=spritesortcnt-1; j>=0; j--) for (j=spritesortcnt-1; j>=0; j--)
{ {
uspritetype *const t = &tsprite[j]; tspritetype *const t = &tsprite[j];
const int32_t i = t->owner; const int32_t i = t->owner;
const spritetype *const s = &sprite[i]; const spritetype *const s = &sprite[i];
@ -4707,7 +4707,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
for (j=spritesortcnt-1; j>=0; j--) for (j=spritesortcnt-1; j>=0; j--)
{ {
uspritetype *const t = &tsprite[j]; tspritetype *const t = &tsprite[j];
const int32_t i = t->owner; const int32_t i = t->owner;
spritetype *const s = &sprite[i]; spritetype *const s = &sprite[i];
@ -4818,11 +4818,11 @@ default_case1:
int32_t curframe; int32_t curframe;
int32_t scrofs_action; int32_t scrofs_action;
//is the perfect time to animate sprites //is the perfect time to animate sprites
uspritetype *const t = &tsprite[j]; tspritetype *const t = &tsprite[j];
const int32_t i = t->owner; const int32_t i = t->owner;
// XXX: what's up with the (i < 0) check? // XXX: what's up with the (i < 0) check?
// NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below). // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
uspritetype *const pSprite = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i]; tspritetype *const pSprite = (i < 0) ? &tsprite[j] : (tspritetype *)&sprite[i];
if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum)))
{ {
@ -6696,7 +6696,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
static void G_FreeHashAnim(const char * /*string*/, intptr_t key) static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
{ {
Bfree((void *)key); Xfree((void *)key);
} }
static void G_Cleanup(void) static void G_Cleanup(void)
@ -6712,17 +6712,17 @@ static void G_Cleanup(void)
for (i=MAXPLAYERS-1; i>=0; i--) for (i=MAXPLAYERS-1; i>=0; i--)
{ {
Bfree(g_player[i].ps); Xfree(g_player[i].ps);
Bfree(g_player[i].inputBits); Xfree(g_player[i].inputBits);
} }
if (label != (char *)&sprite[0]) Bfree(label); if (label != (char *)&sprite[0]) Xfree(label);
if (labelcode != (int32_t *)&sector[0]) Bfree(labelcode); if (labelcode != (int32_t *)&sector[0]) Xfree(labelcode);
if (labeltype != (int32_t*)&wall[0]) Bfree(labeltype); if (labeltype != (int32_t*)&wall[0]) Xfree(labeltype);
Bfree(apScript); Xfree(apScript);
Bfree(bitptr); Xfree(bitptr);
// Bfree(MusicPtr); // Xfree(MusicPtr);
hash_free(&h_labels); hash_free(&h_labels);
} }

View file

@ -334,7 +334,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
else else
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3)); Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3));
Bfree(bitptr); Xfree(bitptr);
bitptr = newbitptr; bitptr = newbitptr;
if (apScript != newscript) if (apScript != newscript)
{ {
@ -358,7 +358,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0);
G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_BACK_NON0);
Bfree(scriptptrs); Xfree(scriptptrs);
return 0; return 0;
} }
@ -659,7 +659,7 @@ static int32_t C_GetNextValue(int32_t type)
{ {
char *gl = C_GetLabelType(labeltype[i]); char *gl = C_GetLabelType(labeltype[i]);
initprintf("%s:%d: debug: %s label `%s'.\n",g_scriptFileName,g_lineNumber,gl,label+(i<<6)); initprintf("%s:%d: debug: %s label `%s'.\n",g_scriptFileName,g_lineNumber,gl,label+(i<<6));
Bfree(gl); Xfree(gl);
} }
BITPTR_CLEAR(g_scriptPtr-apScript); BITPTR_CLEAR(g_scriptPtr-apScript);
@ -677,8 +677,8 @@ static int32_t C_GetNextValue(int32_t type)
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: warning: expected %s, found %s.\n",g_scriptFileName,g_lineNumber,el,gl); initprintf("%s:%d: warning: expected %s, found %s.\n",g_scriptFileName,g_lineNumber,el,gl);
g_warningCnt++; g_warningCnt++;
Bfree(el); Xfree(el);
Bfree(gl); Xfree(gl);
return -1; // valid label name, but wrong type return -1; // valid label name, but wrong type
} }
@ -829,7 +829,7 @@ static void C_Include(const char *confile)
textptr = origtptr; textptr = origtptr;
Bfree(mptr); Xfree(mptr);
} }
void G_DoGameStartup(const int32_t *params) void G_DoGameStartup(const int32_t *params)
@ -1001,7 +1001,7 @@ static int32_t C_ParseCommand(int32_t loop)
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: warning: expected state, found %s.\n", g_scriptFileName, g_lineNumber, gl); initprintf("%s:%d: warning: expected state, found %s.\n", g_scriptFileName, g_lineNumber, gl);
g_warningCnt++; g_warningCnt++;
Bfree(gl); Xfree(gl);
*(g_scriptPtr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions *(g_scriptPtr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions
BITPTR_CLEAR(g_scriptPtr-apScript-1); BITPTR_CLEAR(g_scriptPtr-apScript-1);
continue; // valid label name, but wrong type continue; // valid label name, but wrong type
@ -2226,7 +2226,7 @@ void C_Compile(const char *fileName)
g_scriptcrc = Bcrc32(NULL, 0, 0L); g_scriptcrc = Bcrc32(NULL, 0, 0L);
g_scriptcrc = Bcrc32(textptr, kFileLen, g_scriptcrc); g_scriptcrc = Bcrc32(textptr, kFileLen, g_scriptcrc);
Bfree(apScript); Xfree(apScript);
apScript = (intptr_t *)Xcalloc(1, g_scriptSize * sizeof(intptr_t)); apScript = (intptr_t *)Xcalloc(1, g_scriptSize * sizeof(intptr_t));
bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t)); bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t));

View file

@ -2398,7 +2398,7 @@ void Net_Connect(const char *srvaddr)
event.type == ENET_EVENT_TYPE_CONNECT) event.type == ENET_EVENT_TYPE_CONNECT)
{ {
initprintf("Connection to %s:%d succeeded.\n", oursrvaddr, address.port); initprintf("Connection to %s:%d succeeded.\n", oursrvaddr, address.port);
Bfree(oursrvaddr); Xfree(oursrvaddr);
return; return;
} }
else else
@ -2412,7 +2412,7 @@ void Net_Connect(const char *srvaddr)
initprintf(i ? "Retrying...\n" : "Giving up connection attempt.\n"); initprintf(i ? "Retrying...\n" : "Giving up connection attempt.\n");
} }
Bfree(oursrvaddr); Xfree(oursrvaddr);
Net_Disconnect(); Net_Disconnect();
} }

View file

@ -1669,7 +1669,7 @@ static void prelevel(char g)
actor[j].t_data[0] = 1; actor[j].t_data[0] = 1;
} }
Bfree(tagbitmap); Xfree(tagbitmap);
g_mirrorCount = 0; g_mirrorCount = 0;

View file

@ -541,7 +541,7 @@ vec2_t G_ScreenText(const int32_t font,
linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x; linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x;
Bfree(line); Xfree(line);
} }
if (f & TEXT_XJUSTIFY) if (f & TEXT_XJUSTIFY)
@ -733,7 +733,7 @@ vec2_t G_ScreenText(const int32_t font,
int32_t linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x; int32_t linewidth = G_ScreenTextSize(font, x, y, z, blockangle, line, o | ROTATESPRITE_FULL16, xspace_orig, yline_orig, (f & TEXT_XJUSTIFY) ? 0 : xbetween_orig, (f & TEXT_YJUSTIFY) ? 0 : ybetween_orig, f & ~(TEXT_XJUSTIFY|TEXT_YJUSTIFY|TEXT_BACKWARDS), x1, y1, x2, y2).x;
Bfree(line); Xfree(line);
if (f & TEXT_XJUSTIFY) if (f & TEXT_XJUSTIFY)
{ {