- 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.


SVN r676 (trunk)
This commit is contained in:
Randy Heit 2008-01-08 01:08:27 +00:00
parent ed242b32df
commit 016ac67376
17 changed files with 183 additions and 119 deletions

View file

@ -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.

View file

@ -39,6 +39,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#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++;
}

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -2719,19 +2719,17 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
}
else
{
TArray<FRemapTable*> &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);
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -4675,13 +4675,11 @@ int DLevelScript::RunScript ()
sp--;
if (i >= 1 && i <= MAX_ACS_TRANSLATIONS)
{
TArray<FRemapTable*> &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();
}

View file

@ -1496,7 +1496,7 @@ FUNC(LS_Thing_SetTranslation)
// Thing_SetTranslation (tid, range)
{
TActorIterator<AActor> iterator (arg0);
WORD range;
int range;
AActor *target;
bool ok = false;

View file

@ -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;

View file

@ -44,7 +44,7 @@
#include "gi.h"
#include "stats.h"
TArray<FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
TAutoGrowArray<FRemapTablePtr> translationtables[NUM_TRANSLATION_TABLES];
/****************************************************/
/****************************************************/
@ -281,7 +281,7 @@ FRemapTable *TranslationToTable(int translation)
{
unsigned int type = GetTranslationType(translation);
unsigned int index = GetTranslationIndex(translation);
TArray<FRemapTable *> *slots;
TAutoGrowArray<FRemapTablePtr> *slots;
if (type <= 0 || type >= NUM_TRANSLATION_TABLES)
{

View file

@ -49,7 +49,24 @@ private:
void Alloc(int count);
};
extern TArray<FRemapTable *> 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<FRemapTablePtr> translationtables[NUM_TRANSLATION_TABLES];
#define TRANSLATION_SHIFT 16
#define TRANSLATION_MASK ((1<<TRANSLATION_SHIFT)-1)

View file

@ -265,12 +265,15 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
INTBOOL boolval;
int intval;
bool translationset = false;
bool virtBottom;
if (img == NULL || img->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)

View file

@ -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;

View file

@ -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

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="updaterevision"
ProjectGUID="{6077B7D6-349F-4077-B552-3BC302EF5859}"
RootNamespace="updaterevision"
@ -95,6 +95,82 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
@ -172,82 +248,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"