diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 152021668..a79fcbc59 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,11 @@ April 19, 2008 +- Fixed: MugShotFrame::getTexture() allocated space for the sprite name that + it never freed. I'm not sure it's a good assumption that 9 characters is + always long enough, either, since you can have longer file names than that + inside a zip. +- Fixed: DSBarInfo::DrawGem() crashed if chain or gem was NULL. +- Fixed: Sound sequences are not thinkers, therefore they must be explicitly + marked as roots for the GC. - Reduced the range that area sounds require to interpolate between 2D and 3D panning. - The listener's velocity is now set at 0 for the sound engine. The player diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index efa8d0cf4..25bbb1e44 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -67,6 +67,7 @@ #include "stats.h" #include "c_dispatch.h" #include "p_acs.h" +#include "s_sndseq.h" // MACROS ------------------------------------------------------------------ @@ -300,6 +301,8 @@ static void MarkRoot() if (playeringame[i]) players[i].PropagateMark(); } + // Mark sound sequences. + DSeqNode::StaticMarkHead(); // Mark sectors. if (SectorMarker == NULL && sectors != NULL) { diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index 21a9da55f..de87777cc 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -88,16 +88,15 @@ FTexture *MugShotFrame::getTexture(FString &defaultFace, FPlayerSkin *skin, int int index = !directional ? random % graphic.Size() : direction; if(index > (signed int) (graphic.Size()-1)) index = graphic.Size()-1; - char* sprite = new char[9]; - memcpy(sprite, skin->face[0] != 0 ? skin->face : defaultFace, 3); - memcpy(sprite+3, graphic[index], strlen(graphic[index])); - sprite[3+strlen(graphic[index])] = '\0'; + FString sprite(skin->face[0] != 0 ? skin->face : &defaultFace[0], 3); + sprite += graphic[index]; if(usesLevels) //change the last character to the level { if(!health2 && (!healthspecial || index == 1)) - sprite[2+strlen(graphic[index])] += level; + sprite.LockBuffer()[2 + graphic[index].Len()] += level; else - sprite[1+strlen(graphic[index])] += level; + sprite.LockBuffer()[1 + graphic[index].Len()] += level; + sprite.UnlockBuffer(); } return TexMan[TexMan.CheckForTexture(sprite, 0, true)]; } @@ -1511,19 +1510,17 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, bool alwayssho void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int padleft, int padright, int chainsize, bool wiggle, bool translate) { + if(chain == NULL) + return; if(value > 100) value = 100; else if(value < 0) value = 0; if(wiggle) y += chainWiggle; - int gemWidth = gem->GetWidth(); int chainWidth = chain->GetWidth(); int offset = (int) (((double) (chainWidth-padleft-padright)/100)*value); - if(chain != NULL) - { - DrawGraphic(chain, x+(offset%chainsize), y); - } + DrawGraphic(chain, x+(offset%chainsize), y); if(gem != NULL) DrawGraphic(gem, x+padleft+offset, y, translate ? DRAWIMAGE_TRANSLATABLE : 0); } diff --git a/src/s_sndseq.h b/src/s_sndseq.h index 234f70e53..0395e2843 100644 --- a/src/s_sndseq.h +++ b/src/s_sndseq.h @@ -29,6 +29,7 @@ public: void ChangeData (int seqOffset, int delayTics, float volume, int currentSoundID); void AddChoice (int seqnum, seqtype_t type); FName GetSequenceName() const; + static void StaticMarkHead() { GC::Mark(SequenceListHead); } virtual void MakeSound (int loop) {} virtual void *Source () { return NULL; }