SVN r657 (trunk)

This commit is contained in:
Christoph Oelckers 2007-12-29 10:25:07 +00:00
parent 6872bcd3ef
commit 68e2134f70
5 changed files with 158 additions and 98 deletions

View file

@ -1,3 +1,7 @@
December 29, 2007 (Changes by Graf Zahl)
- Changed the FStatusBarTexture for Doom so that it can create a true color
image.
December 28, 2007
- Fixed position of the Doom HUD selectbox as per SnowKate709's guidance.

View file

@ -129,9 +129,8 @@ public:
FBaseStatusBar::MultiplayerChanged ();
if (multiplayer)
{
// draw face background
StatusBarTex.DrawToBar ("STFBANY", 143, 1,
translationtables[TRANSLATION_Players][int(CPlayer - players)]->Remap);
// set face background color
StatusBarTex.SetPlayerRemap(translationtables[TRANSLATION_Players][int(CPlayer - players)]);
}
}
@ -146,9 +145,8 @@ public:
}
if (multiplayer)
{
// draw face background
StatusBarTex.DrawToBar ("STFBANY", 143, 1,
translationtables[TRANSLATION_Players][int(CPlayer - players)]->Remap);
// set face background color
StatusBarTex.SetPlayerRemap(translationtables[TRANSLATION_Players][int(CPlayer - players)]);
}
bEvilGrin = false;
}
@ -198,19 +196,29 @@ public:
private:
struct FDoomStatusBarTexture : public FTexture
{
void DrawToBar (const char *name, int x, int y, const BYTE *colormap_in = NULL);
public:
FDoomStatusBarTexture ();
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
const BYTE *GetPixels ();
void Unload ();
~FDoomStatusBarTexture ();
void DrawToBar (const char *name, int x, int y, const BYTE *colormap_in = NULL);
void SetPlayerRemap(FRemapTable *remap);
int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
FTextureFormat GetFormat()
{
return TEX_RGB;
}
protected:
void MakeTexture ();
FTexture *BaseTexture;
BYTE *Pixels;
FRemapTable *STBFremap;
}
StatusBarTex;
@ -239,13 +247,6 @@ private:
}
StatusBarTex.Unload ();
if (!deathmatch)
{
StatusBarTex.DrawToBar ("STARMS", 104, 0);
}
StatusBarTex.DrawToBar ("STTPRCNT", 90, 3); // Health %
StatusBarTex.DrawToBar ("STTPRCNT", 221, 3); // Armor %
SB_state = screen->GetPageCount ();
FaceLastAttackDown = -1;
@ -1053,6 +1054,7 @@ FDoomStatusBar::FDoomStatusBarTexture::FDoomStatusBarTexture ()
// now copy all the properties from the base texture
CopySize(BaseTexture);
Pixels = NULL;
STBFremap = NULL;
}
const BYTE *FDoomStatusBar::FDoomStatusBarTexture::GetColumn (unsigned int column, const Span **spans_out)
@ -1095,18 +1097,50 @@ void FDoomStatusBar::FDoomStatusBarTexture::MakeTexture ()
Pixels = new BYTE[Width*Height];
const BYTE *pix = BaseTexture->GetPixels();
memcpy(Pixels, pix, Width*Height);
if (!deathmatch) DrawToBar("STARMS", 104, 0, NULL);
DrawToBar("STTPRCNT", 90, 3, NULL);
DrawToBar("STTPRCNT", 221, 3, NULL);
if (multiplayer) DrawToBar("STFBANY", 143, 1, STBFremap? STBFremap->Remap : NULL);
}
int FDoomStatusBar::FDoomStatusBarTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y)
{
FTexture *tex;
BaseTexture->CopyTrueColorPixels(buffer, buf_pitch, buf_height, x, y);
if (!deathmatch)
{
tex = TexMan["STARMS"];
if (tex != NULL)
{
tex->CopyTrueColorPixels(buffer, buf_pitch, buf_height, x+104, y);
}
}
tex = TexMan["STTPRCNT"];
if (tex != NULL)
{
tex->CopyTrueColorPixels(buffer, buf_pitch, buf_height, x+90, y+3);
tex->CopyTrueColorPixels(buffer, buf_pitch, buf_height, x+221, y+3);
}
if (multiplayer)
{
tex = TexMan["STFBANY"];
if (tex != NULL)
{
tex->CopyTrueColorTranslated(buffer, buf_pitch, buf_height, x+143, y+1, STBFremap);
}
}
return -1;
}
void FDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x, int y, const BYTE *colormap_in)
{
FTexture *pic;
BYTE colormap[256];
if (Pixels == NULL)
{
MakeTexture ();
}
if (colormap_in != NULL)
{
for (int i = 0; i < 256; ++i)
@ -1131,6 +1165,13 @@ void FDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x,
}
}
void FDoomStatusBar::FDoomStatusBarTexture::SetPlayerRemap(FRemapTable *remap)
{
Unload();
KillNative();
STBFremap = remap;
}
FBaseStatusBar *CreateDoomStatusBar ()
{
return new FDoomStatusBar;

View file

@ -92,6 +92,7 @@ class player_s;
//
class DSectorEffect;
struct sector_t;
struct FRemapTable;
enum
{
@ -666,6 +667,7 @@ public:
virtual const BYTE *GetPixels () = 0;
virtual int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y);
int CopyTrueColorTranslated(BYTE *buffer, int buf_pitch, int buf_height, int x, int y, FRemapTable *remap);
virtual bool UseBasePalette();
virtual int GetSourceLump() { return -1; }

View file

@ -39,6 +39,7 @@
#include "r_data.h"
#include "templates.h"
#include "i_system.h"
#include "r_translate.h"
typedef bool (*CheckFunc)(FileReader & file);
typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
@ -493,6 +494,18 @@ int FTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, i
return 0;
}
int FTexture::CopyTrueColorTranslated(BYTE *buffer, int buf_pitch, int buf_height, int x, int y, FRemapTable *remap)
{
PalEntry *palette = remap->Palette;
palette[0].a=255; // temporarily modify the first color's alpha
screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y,
GetPixels(), Width, Height, Height, 1,
palette);
palette[0].a=0;
return 0;
}
bool FTexture::UseBasePalette()
{
return true;

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,82 +95,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|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
@ -248,6 +172,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|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"