diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f84da4e1f..1e8946c8b 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,6 +1,15 @@ +January 7, 2008 +- Fixed: Thing_SetTranslation still used a 16-bit word to hold the translation. +- Bumped the maximum resolution up to 2560x1600. +- Fixed: DCanvas::DrawTexture() only expanded virtual screen sizes for widescreen + resolutions but left 5:4 modes alone. This fix neccessitated the addition of + DTA_Bottom320x200 for the status bar to use so that it could be flush with the + bottom of the screen rather than sitting slightly above it. +- Fixed: FConfigFile::ReadConfig()'s definition of whitespace was too broad. +- Fixed: Defining custom translation ranges in descending order and/or with gaps + made for crashes. + January 7, 2008 (Changes by Graf Zahl) -- Fixed: translationtables cannot use a TAutoGrowArray because it doesn't - initialize newly added fields when growing. - Added fix for Heretic IDKFA cheat by Karate Chris. - Added fix for Strife's AlienSpectre obituary by Karate Chris. diff --git a/src/configfile.cpp b/src/configfile.cpp index 850ef6cc9..23d47996a 100644 --- a/src/configfile.cpp +++ b/src/configfile.cpp @@ -39,6 +39,7 @@ #include #include +#include #include "doomtype.h" #include "configfile.h" @@ -374,14 +375,14 @@ bool FConfigFile::ReadConfig (void *file) { // Remove white space in front of = char *whiteprobe = equalpt - 1; - while (whiteprobe > start && *whiteprobe <= ' ') + while (whiteprobe > start && isspace(*whiteprobe)) { whiteprobe--; } whiteprobe[1] = 0; // Remove white space after = whiteprobe = equalpt + 1; - while (*whiteprobe && *whiteprobe <= ' ') + while (*whiteprobe && isspace(*whiteprobe)) { whiteprobe++; } diff --git a/src/g_heretic/heretic_sbar.cpp b/src/g_heretic/heretic_sbar.cpp index 3065ee474..34ab68ea3 100644 --- a/src/g_heretic/heretic_sbar.cpp +++ b/src/g_heretic/heretic_sbar.cpp @@ -248,7 +248,7 @@ private: DrawImage (Images[imgLTFCTOP], 0, -10); //DrawImage (Images[imgRTFCTOP], 290, -10); screen->DrawTexture (Images[imgRTFCTOP], ST_X+290, ST_Y, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, DTA_TopOffset, Images[imgRTFCTOP]->GetHeight(), TAG_DONE); @@ -278,12 +278,12 @@ private: DrawImage (Images[imgLTFACE], 0, 32); DrawImage (Images[imgRTFACE], 276, 32); screen->DrawTexture (&ChainShade, ST_X+19, ST_Y+32, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, DTA_AlphaChannel, true, DTA_FillColor, 0, TAG_DONE); screen->DrawTexture (&ChainShade, ST_X+277, ST_Y+32, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, DTA_AlphaChannel, true, DTA_FillColor, 0, DTA_FlipX, true, @@ -392,7 +392,7 @@ private: screen->DrawTexture (Images[imgSTATBAR], ST_X+34, ST_Y+2, DTA_WindowLeft, 119, DTA_WindowRight, 129, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); if (playerkeys & 4) { @@ -432,12 +432,12 @@ private: { // Draw both ammos screen->DrawTexture (TexMan[ammo1->Icon], 115+ST_X, 11+ST_Y, DTA_CenterOffset, true, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); DrSmallNumber (ammo1->Amount, 124, 7); screen->DrawTexture (TexMan[ammo2->Icon], 115+ST_X, 22+ST_Y, DTA_CenterOffset, true, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); DrSmallNumber (ammo2->Amount, 124, 19); } @@ -446,7 +446,7 @@ private: DrINumber (ammo1->Amount, 109, 4); screen->DrawTexture (TexMan[ammo1->Icon], 123+ST_X, 22+ST_Y, DTA_CenterOffset, true, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } } diff --git a/src/g_hexen/hexen_sbar.cpp b/src/g_hexen/hexen_sbar.cpp index 3f1b24a85..ebff79bb5 100644 --- a/src/g_hexen/hexen_sbar.cpp +++ b/src/g_hexen/hexen_sbar.cpp @@ -538,13 +538,13 @@ private: AmmoRefresh--; screen->DrawTexture (TexMan[ammo1->Icon], 89+ST_X, 10+ST_Y, DTA_CenterOffset, true, - DTA_320x200, true, + DTA_Bottom320x200, true, TAG_DONE); DrSmallNumber (ammo1->Amount, 86, 20); screen->DrawTexture (TexMan[ammo2->Icon], 113+ST_X, 10+ST_Y, DTA_CenterOffset, true, - DTA_320x200, true, + DTA_Bottom320x200, true, TAG_DONE); DrSmallNumber (ammo2->Amount, 110, 20); } @@ -552,7 +552,7 @@ private: { // Draw one ammo screen->DrawTexture (TexMan[ammo1->Icon], 100+ST_X, 10+ST_Y, DTA_CenterOffset, true, - DTA_320x200, true, + DTA_Bottom320x200, true, TAG_DONE); DrSmallNumber (ammo1->Amount, 97, 20); } @@ -588,7 +588,7 @@ private: screen->DrawTexture (Images[imgSTATBAR], ST_X+38, ST_Y, DTA_WindowLeft, 39, DTA_WindowRight, 87, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } diff --git a/src/g_level.cpp b/src/g_level.cpp index 623847d86..e30590d43 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -2719,19 +2719,17 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) } else { - TArray &tt = translationtables[TRANSLATION_LevelScripted]; while (arc << w, w != 0xffff) { if (w >= MAX_ACS_TRANSLATIONS) { // hack hack to avoid crashing w = 0; } - while (tt.Size() <= w) tt.Push(NULL); - trans = tt[w]; + trans = translationtables[TRANSLATION_LevelScripted].GetVal(w); if (trans == NULL) { trans = new FRemapTable; - tt[w] = trans; + translationtables[TRANSLATION_LevelScripted].SetVal(t, trans); } trans->Serialize(arc); } diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index d7905076f..f2fc7a2a4 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1696,7 +1696,7 @@ private: screen->DrawTexture (shaders[(vertical << 1) + reverse], ST_X+cmd.x, ST_Y+cmd.y, DTA_DestWidth, cmd.special, DTA_DestHeight, cmd.special2, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, DTA_AlphaChannel, true, DTA_FillColor, 0, TAG_DONE); diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 99833823e..3480de270 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -202,7 +202,15 @@ void FBaseStatusBar::SetScaled (bool scale) { ST_X = 0; ST_Y = 200 - RelTop; - ::ST_Y = Scale (ST_Y, SCREENHEIGHT, 200); + if (CheckRatio(SCREENWIDTH, SCREENHEIGHT) != 4) + { // Normal resolution + ::ST_Y = Scale (ST_Y, SCREENHEIGHT, 200); + } + else + { // 5:4 resolution + ::ST_Y = Scale(ST_Y - 100, SCREENHEIGHT*3, BaseRatioSizes[4][1]) + SCREENHEIGHT/2 + + (SCREENHEIGHT - SCREENHEIGHT * BaseRatioSizes[4][3] / 48) / 2; + } // If this is odd, add one to make it even and close the gap between the // status bar and the rest of the screen ::ST_Y += (::ST_Y & 1); @@ -427,7 +435,7 @@ void FBaseStatusBar::DrawImage (FTexture *img, { screen->DrawTexture (img, x + ST_X, y + ST_Y, DTA_Translation, translation, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } } @@ -448,7 +456,7 @@ void FBaseStatusBar::DrawDimImage (FTexture *img, { screen->DrawTexture (img, x + ST_X, y + ST_Y, DTA_ColorOverlay, dimmed ? DIM_OVERLAY : 0, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } } @@ -469,7 +477,7 @@ void FBaseStatusBar::DrawFadedImage (FTexture *img, { screen->DrawTexture (img, x + ST_X, y + ST_Y, DTA_Alpha, shade, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } } @@ -491,7 +499,7 @@ void FBaseStatusBar::DrawPartialImage (FTexture *img, int wx, int ww) const screen->DrawTexture (img, ST_X, ST_Y, DTA_WindowLeft, wx, DTA_WindowRight, wx + ww, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, TAG_DONE); } } diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index a6590f237..5ddf1bb2c 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -432,7 +432,7 @@ private: { screen->DrawTexture (Images[CursorImage], 42 + 35*i + ST_X, 12 + ST_Y, - DTA_320x200, Scaled, + DTA_Bottom320x200, Scaled, DTA_Alpha, FRACUNIT - ItemFlash, TAG_DONE); } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 513199782..40ed4629a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4675,13 +4675,11 @@ int DLevelScript::RunScript () sp--; if (i >= 1 && i <= MAX_ACS_TRANSLATIONS) { - TArray &tt = translationtables[TRANSLATION_LevelScripted]; - while (tt.Size() < i) tt.Push(NULL); - translation = tt[i-1]; + translation = translationtables[TRANSLATION_LevelScripted].GetVal(i - 1); if (translation == NULL) { translation = new FRemapTable; - tt[i-1] = translation; + translationtables[TRANSLATION_LevelScripted].SetVal(i - 1, translation); } translation->MakeIdentity(); } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index fb22c9361..49b9c8332 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1496,7 +1496,7 @@ FUNC(LS_Thing_SetTranslation) // Thing_SetTranslation (tid, range) { TActorIterator iterator (arg0); - WORD range; + int range; AActor *target; bool ok = false; diff --git a/src/r_defs.h b/src/r_defs.h index 3d4c42f69..00a719404 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -38,8 +38,8 @@ -#define MAXWIDTH 2048 -#define MAXHEIGHT 1536 +#define MAXWIDTH 2560 +#define MAXHEIGHT 1600 const WORD NO_INDEX = 0xffffu; const DWORD NO_SIDE = 0xffffffffu; diff --git a/src/r_translate.cpp b/src/r_translate.cpp index fd0bc659f..6d1686903 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -44,7 +44,7 @@ #include "gi.h" #include "stats.h" -TArray translationtables[NUM_TRANSLATION_TABLES]; +TAutoGrowArray translationtables[NUM_TRANSLATION_TABLES]; /****************************************************/ /****************************************************/ @@ -281,7 +281,7 @@ FRemapTable *TranslationToTable(int translation) { unsigned int type = GetTranslationType(translation); unsigned int index = GetTranslationIndex(translation); - TArray *slots; + TAutoGrowArray *slots; if (type <= 0 || type >= NUM_TRANSLATION_TABLES) { diff --git a/src/r_translate.h b/src/r_translate.h index a621d7ace..24b231b5e 100644 --- a/src/r_translate.h +++ b/src/r_translate.h @@ -49,7 +49,24 @@ private: void Alloc(int count); }; -extern TArray translationtables[NUM_TRANSLATION_TABLES]; +// A class that initializes unusued pointers to NULL. This is used so that when +// the TAutoGrowArray below is expanded, the new elements will be NULLed. +class FRemapTablePtr +{ +public: + FRemapTablePtr() throw() : Ptr(0) {} + FRemapTablePtr(FRemapTable *p) throw() : Ptr(p) {} + FRemapTablePtr(FRemapTablePtr &p) throw() : Ptr(p.Ptr) {} + operator FRemapTable *() const throw() { return Ptr; } + FRemapTablePtr &operator= (FRemapTable *p) throw() { Ptr = p; return *this; } + FRemapTablePtr &operator= (FRemapTablePtr &p) throw() { Ptr = p.Ptr; return *this; } + FRemapTable &operator*() const throw() { return *Ptr; } + FRemapTable *operator->() const throw() { return Ptr; } +private: + FRemapTable *Ptr; +}; + +extern TAutoGrowArray translationtables[NUM_TRANSLATION_TABLES]; #define TRANSLATION_SHIFT 16 #define TRANSLATION_MASK ((1<UseType == FTexture::TEX_Null) { return false; } + virtBottom = false; + parms->texwidth = img->GetScaledWidth(); parms->texheight = img->GetScaledHeight(); @@ -363,6 +366,16 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l } break; + case DTA_Bottom320x200: + boolval = va_arg (tags, INTBOOL); + if (boolval) + { + parms->virtWidth = 320; + parms->virtHeight = 200; + } + virtBottom = true; + break; + case DTA_HUDRules: { bool xright = parms->x < 0; @@ -538,9 +551,9 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l int bottom = parms->y + parms->destheight; if (myratio != 0 && myratio != 4 && !parms->keepratio) - { // The target surface is not 4:3, so expand the specified - // virtual size to avoid undesired stretching of the image. - // Does not handle non-4:3 virtual sizes. I'll worry about + { // The target surface is either 16:9 or 16:10, so expand the + // specified virtual size to avoid undesired stretching of the + // image. Does not handle non-4:3 virtual sizes. I'll worry about // those if somebody expresses a desire to use them. parms->x = Scale(parms->x - parms->virtWidth*FRACUNIT/2, Width*960, @@ -556,8 +569,26 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l parms->x = Scale (parms->x, Width, parms->virtWidth); parms->destwidth = Scale (right, Width, parms->virtWidth) - parms->x; } - parms->y = Scale (parms->y, Height, parms->virtHeight); - parms->destheight = Scale (bottom, Height, parms->virtHeight) - parms->y; + if (myratio != 0 && myratio == 4 && !parms->keepratio) + { // The target surface is 5:4 + parms->y = Scale(parms->y - parms->virtHeight*FRACUNIT/2, + Height*600, + parms->virtHeight*BaseRatioSizes[myratio][1]) + + Height*FRACUNIT/2; + parms->destheight = Scale(bottom - parms->virtHeight*FRACUNIT/2, + Height*600, + parms->virtHeight*BaseRatioSizes[myratio][1]) + + Height*FRACUNIT/2 - parms->y; + if (virtBottom) + { + parms->y += (Height - Height * BaseRatioSizes[myratio][3] / 48) << (FRACBITS - 1); + } + } + else + { + parms->y = Scale (parms->y, Height, parms->virtHeight); + parms->destheight = Scale (bottom, Height, parms->virtHeight) - parms->y; + } } if (parms->destwidth <= 0 || parms->destheight <= 0) diff --git a/src/v_video.cpp b/src/v_video.cpp index 18eb1b129..cda905cde 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -986,10 +986,11 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int buffer[pos]=palette[v].b; buffer[pos+1]=palette[v].g; buffer[pos+2]=palette[v].r; - buffer[pos+3]=255-palette[v].a; + buffer[pos+3]=255; } else if (palette[v].a!=255) { + // [RH] Err... This can't be right, can it? buffer[pos ] = (buffer[pos ] * palette[v].a + palette[v].b * (1-palette[v].a)) / 255; buffer[pos+1] = (buffer[pos+1] * palette[v].a + palette[v].g * (1-palette[v].a)) / 255; buffer[pos+2] = (buffer[pos+2] * palette[v].a + palette[v].r * (1-palette[v].a)) / 255; diff --git a/src/v_video.h b/src/v_video.h index e5960bd6b..0e768da45 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -80,6 +80,7 @@ enum DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen + DTA_Bottom320x200, // bool: same as DTA_320x200 but centers virtual screen on bottom for 1280x1024 targets DTA_CleanNoMove, // bool: like DTA_Clean but does not reposition output position DTA_FlipX, // bool: flip image horizontally //FIXME: Does not work with DTA_Window(Left|Right) DTA_ShadowColor, // color of shadow diff --git a/tools/updaterevision/updaterevision.vcproj b/tools/updaterevision/updaterevision.vcproj index f39914dca..202c9d042 100644 --- a/tools/updaterevision/updaterevision.vcproj +++ b/tools/updaterevision/updaterevision.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - -