From 685de5ce30275ed683eddd8ca15bd804139a5611 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 13 Jan 2008 05:10:33 +0000 Subject: [PATCH] - Applied Blzut3's SBARINFO update #8: * Fixed: Drawbar had a few memory leaks. - Added another temporary cvar called pc to play with the multipiler used by D3DFB::SetPaletteTexture(). SVN r704 (trunk) --- docs/rh-log.txt | 13 ++++++++++++- src/g_shared/sbarinfo.cpp | 3 +++ src/g_shared/shared_sbar.cpp | 3 --- src/win32/fb_d3d9.cpp | 7 ++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 65ad551faa..d940efe23b 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,5 +1,16 @@ January 12, 2008 -- Applied Blzut3's SBARINFO update #7. +- Applied Blzut3's SBARINFO update #8: + * Fixed: Drawbar had a few memory leaks. +- Applied Blzut3's SBARINFO update #7: + * Added drawstring to SBARINFO. + * Added animatedgodmode flag to drawmugshot, also changed the flags to use the + standard named arguments instead of numbers. The old way is considered + deprecated. + * Added kills, monsters, items, totalitems, secrets, and totalsecrets to + drawnumber. Drawbar can also use kills, items, and secrets. + * Added weaponicon to drawimage which will display the inventory.icon of the + currently selected weapon. + * Fixed: I apparently forgot to add the "rampage" face to drawmugshot. January 12, 2008 (Changes by Graf Zahl) - Moved renderer dependent part of savegame pic creation into DFrameBuffer diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index c7aaa3cabf..62fe0e0c2d 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1067,6 +1067,8 @@ public: { width = (int) (((double) width/100)*value); } + if(Pixels != NULL) + delete Pixels; Pixels = new BYTE[Width*Height]; memset(Pixels, 0, Width*Height); //Prevent garbage when using transparent images bar->CopyToBlock(Pixels, Width, Height, 0, 0); //draw the bar @@ -1820,6 +1822,7 @@ private: else bar->PrepareTexture(Images[cmd.sprite], NULL, value, horizontal, reverse); DrawImage(bar, cmd.x, cmd.y); + delete bar; break; } case SBARINFO_DRAWGEM: diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index e586100edb..826be70eb0 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1505,9 +1505,6 @@ void FBaseStatusBar::DrawConsistancy () const players[1-consoleplayer].inconsistant, players[1-consoleplayer].inconsistant/ticdup); } -#ifdef _DEBUG - AddCommandString ("showrngs"); -#endif } screen->DrawText (CR_GREEN, (screen->GetWidth() - SmallFont->StringWidth (conbuff)*CleanXfac) / 2, diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index d1568180a5..d1178d1f74 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -3058,12 +3058,13 @@ void D3DFB::SetTexture(int tnum, IDirect3DTexture9 *texture) } CVAR(Float, pal, 0.5f, 0) +CVAR(Float, pc, 255.f, 0) void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count) { if (count == 256 || SM14) { // Shader Model 1.4 only uses 256-color palettes. - SetConstant(2, 255 / 256.f, pal / 256.f, 0, 0); + SetConstant(2, pc / 256.f, pal / 256.f, 0, 0); } else { @@ -3074,12 +3075,12 @@ void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count) // the palette indexes so they lie exactly in the center of each // texel. For a normal palette with 256 entries, that means the // range we use should be [0.5,255.5], adjusted so the coordinate - // is still with [0.0,1.0]. + // is still within [0.0,1.0]. // // The constant register c2 is used to hold the multiplier in the // x part and the adder in the y part. float fcount = 1 / float(count); - SetConstant(2, 255 * fcount, pal * fcount, 0, 0); + SetConstant(2, pc * fcount, pal * fcount, 0, 0); } SetTexture(1, texture); }