2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// $Log:$
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Functions to draw patches (by post) directly to screen->
|
|
|
|
// Functions to blit a block to the screen->
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "i_system.h"
|
2008-08-10 03:25:08 +00:00
|
|
|
#include "x86.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "i_video.h"
|
|
|
|
#include "r_local.h"
|
|
|
|
#include "r_draw.h"
|
|
|
|
#include "r_state.h"
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomdata.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "hu_stuff.h"
|
|
|
|
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "m_bbox.h"
|
|
|
|
#include "m_swap.h"
|
|
|
|
#include "m_menu.h"
|
|
|
|
|
|
|
|
#include "i_video.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "v_text.h"
|
|
|
|
|
|
|
|
#include "w_wad.h"
|
|
|
|
|
|
|
|
#include "c_cvars.h"
|
|
|
|
#include "c_dispatch.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "templates.h"
|
2006-05-09 00:28:01 +00:00
|
|
|
#include "sbar.h"
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
#include "hardware.h"
|
2007-12-26 16:06:03 +00:00
|
|
|
#include "r_translate.h"
|
2007-12-30 04:18:39 +00:00
|
|
|
#include "f_wipe.h"
|
2008-01-12 12:49:05 +00:00
|
|
|
#include "m_png.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "colormatcher.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS (DCanvas)
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer)
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
#if defined(_DEBUG) && defined(_M_IX86)
|
|
|
|
#define DBGBREAK { __asm int 3 }
|
|
|
|
#else
|
|
|
|
#define DBGBREAK
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class DDummyFrameBuffer : public DFrameBuffer
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DDummyFrameBuffer, DFrameBuffer);
|
|
|
|
public:
|
|
|
|
DDummyFrameBuffer (int width, int height)
|
|
|
|
: DFrameBuffer (0, 0)
|
|
|
|
{
|
|
|
|
Width = width;
|
|
|
|
Height = height;
|
|
|
|
}
|
|
|
|
bool Lock(bool buffered) { DBGBREAK; return false; }
|
|
|
|
void Update() { DBGBREAK; }
|
|
|
|
PalEntry *GetPalette() { DBGBREAK; return NULL; }
|
|
|
|
void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; }
|
|
|
|
void UpdatePalette() { DBGBREAK; }
|
|
|
|
bool SetGamma(float gamma) { Gamma = gamma; return true; }
|
|
|
|
bool SetFlash(PalEntry rgb, int amount) { DBGBREAK; return false; }
|
|
|
|
void GetFlash(PalEntry &rgb, int &amount) { DBGBREAK; }
|
|
|
|
int GetPageCount() { DBGBREAK; return 0; }
|
|
|
|
bool IsFullscreen() { DBGBREAK; return 0; }
|
|
|
|
#ifdef _WIN32
|
|
|
|
void PaletteChanged() {}
|
|
|
|
int QueryNewPalette() { return 0; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
float Gamma;
|
|
|
|
};
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS (DDummyFrameBuffer)
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// SimpleCanvas is not really abstract, but this macro does not
|
|
|
|
// try to generate a CreateNew() function.
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS (DSimpleCanvas)
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
class FPaletteTester : public FTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FPaletteTester ();
|
|
|
|
|
|
|
|
const BYTE *GetColumn(unsigned int column, const Span **spans_out);
|
|
|
|
const BYTE *GetPixels();
|
|
|
|
void Unload();
|
|
|
|
bool CheckModified();
|
|
|
|
void SetTranslation(int num);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BYTE Pixels[16*16];
|
|
|
|
int CurTranslation;
|
|
|
|
int WantTranslation;
|
|
|
|
static const Span DummySpan[2];
|
|
|
|
|
|
|
|
void MakeTexture();
|
|
|
|
};
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
const FTexture::Span FPaletteTester::DummySpan[2] = { { 0, 16 }, { 0, 0 } };
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int DisplayWidth, DisplayHeight, DisplayBits;
|
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
FFont *SmallFont, *SmallFont2, *BigFont, *ConFont, *IntermissionFont;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
DWORD Col2RGB8[65][256];
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
DWORD *Col2RGB8_LessPrecision[65];
|
|
|
|
DWORD Col2RGB8_Inverse[65][256];
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE RGB32k[32][32][32];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD Col2RGB8_2[63][256];
|
|
|
|
|
|
|
|
// [RH] The framebuffer is no longer a mere byte array.
|
|
|
|
// There's also only one, not four.
|
|
|
|
DFrameBuffer *screen;
|
|
|
|
|
|
|
|
CVAR (Int, vid_defwidth, 640, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
CVAR (Int, vid_defheight, 480, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
CVAR (Int, vid_defbits, 8, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
CVAR (Bool, vid_fps, false, 0)
|
|
|
|
CVAR (Bool, ticker, false, 0)
|
|
|
|
CVAR (Int, vid_showpalette, 0, 0)
|
2008-02-19 02:48:56 +00:00
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
CUSTOM_CVAR (Bool, vid_vsync, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
{
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
screen->SetVSync (*self);
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-02-19 02:48:56 +00:00
|
|
|
CUSTOM_CVAR (Int, vid_refreshrate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
{
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
screen->NewRefreshRate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CUSTOM_CVAR (Float, dimamount, 0.2f, CVAR_ARCHIVE)
|
|
|
|
{
|
|
|
|
if (self < 0.f)
|
|
|
|
{
|
|
|
|
self = 0.f;
|
|
|
|
}
|
|
|
|
else if (self > 1.f)
|
|
|
|
{
|
|
|
|
self = 1.f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CVAR (Color, dimcolor, 0xffd700, CVAR_ARCHIVE)
|
|
|
|
|
|
|
|
// [RH] Set true when vid_setmode command has been executed
|
2006-09-14 00:02:31 +00:00
|
|
|
bool setmodeneeded = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
// [RH] Resolution to change to when setmodeneeded is true
|
|
|
|
int NewWidth, NewHeight, NewBits;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// V_MarkRect
|
|
|
|
//
|
|
|
|
void V_MarkRect (int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DCanvas *DCanvas::CanvasChain = NULL;
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas Constructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
DCanvas::DCanvas (int _width, int _height)
|
|
|
|
{
|
|
|
|
// Init member vars
|
|
|
|
Buffer = NULL;
|
|
|
|
LockCount = 0;
|
|
|
|
Width = _width;
|
|
|
|
Height = _height;
|
|
|
|
|
|
|
|
// Add to list of active canvases
|
|
|
|
Next = CanvasChain;
|
|
|
|
CanvasChain = this;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
DCanvas::~DCanvas ()
|
|
|
|
{
|
|
|
|
// Remove from list of active canvases
|
|
|
|
DCanvas *probe = CanvasChain, **prev;
|
|
|
|
|
|
|
|
prev = &CanvasChain;
|
|
|
|
probe = CanvasChain;
|
|
|
|
|
|
|
|
while (probe != NULL)
|
|
|
|
{
|
|
|
|
if (probe == this)
|
|
|
|
{
|
|
|
|
*prev = probe->Next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
prev = &probe->Next;
|
|
|
|
probe = probe->Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: IsValid
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
bool DCanvas::IsValid ()
|
|
|
|
{
|
|
|
|
// A nun-subclassed DCanvas is never valid
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-01-09 23:04:49 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: FlatFill
|
|
|
|
//
|
|
|
|
// Fill an area with a texture. If local_origin is false, then the origin
|
|
|
|
// used for the wrapping is (0,0). Otherwise, (left,right) is used.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void DCanvas::FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int w = src->GetWidth();
|
|
|
|
int h = src->GetHeight();
|
|
|
|
|
2008-01-09 23:04:49 +00:00
|
|
|
// Repeatedly draw the texture, left-to-right, top-to-bottom.
|
|
|
|
for (int y = local_origin ? top : (top / h * h); y < bottom; y += h)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-01-09 23:04:49 +00:00
|
|
|
for (int x = local_origin ? left : (left / w * w); x < right; x += w)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DrawTexture (src, x, y,
|
|
|
|
DTA_ClipLeft, left,
|
|
|
|
DTA_ClipRight, right,
|
|
|
|
DTA_ClipTop, top,
|
|
|
|
DTA_ClipBottom, bottom,
|
2008-01-09 23:04:49 +00:00
|
|
|
DTA_TopOffset, 0,
|
|
|
|
DTA_LeftOffset, 0,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: Dim
|
|
|
|
//
|
|
|
|
// Applies a colored overlay to the entire screen, with the opacity
|
|
|
|
// determined by the dimamount cvar.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void DCanvas::Dim (PalEntry color)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-09 00:28:01 +00:00
|
|
|
PalEntry dimmer;
|
2006-02-24 04:48:15 +00:00
|
|
|
float amount = dimamount;
|
|
|
|
|
|
|
|
if (gameinfo.gametype == GAME_Hexen && gamestate == GS_DEMOSCREEN)
|
|
|
|
{ // On the Hexen title screen, the default dimming is not
|
|
|
|
// enough to make the menus readable.
|
|
|
|
amount = MIN<float> (1.f, amount*2.f);
|
|
|
|
}
|
2006-05-09 00:28:01 +00:00
|
|
|
dimmer = PalEntry(dimcolor);
|
|
|
|
// Add the cvar's dimming on top of the color passed to the function
|
|
|
|
if (color.a != 0)
|
|
|
|
{
|
|
|
|
float dim[4] = { color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f };
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::AddBlend (dimmer.r/255.f, dimmer.g/255.f, dimmer.b/255.f, amount, dim);
|
2006-05-09 00:28:01 +00:00
|
|
|
dimmer = PalEntry (BYTE(dim[0]*255), BYTE(dim[1]*255), BYTE(dim[2]*255));
|
|
|
|
amount = dim[3];
|
|
|
|
}
|
|
|
|
Dim (dimmer, amount, 0, 0, Width, Height);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: Dim
|
|
|
|
//
|
|
|
|
// Applies a colored overlay to an area of the screen.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (damount == 0.f)
|
|
|
|
return;
|
|
|
|
|
|
|
|
DWORD *bg2rgb;
|
|
|
|
DWORD fg;
|
|
|
|
int gap;
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE *spot;
|
2006-02-24 04:48:15 +00:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
{
|
|
|
|
int amount;
|
|
|
|
|
|
|
|
amount = (int)(damount * 64);
|
|
|
|
bg2rgb = Col2RGB8[64-amount];
|
|
|
|
|
|
|
|
fg = (((color.r * amount) >> 4) << 20) |
|
|
|
|
((color.g * amount) >> 4) |
|
|
|
|
(((color.b * amount) >> 4) << 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
spot = Buffer + x1 + y1*Pitch;
|
|
|
|
gap = Pitch - w;
|
|
|
|
for (y = h; y != 0; y--)
|
|
|
|
{
|
|
|
|
for (x = w; x != 0; x--)
|
|
|
|
{
|
|
|
|
DWORD bg;
|
|
|
|
|
|
|
|
bg = bg2rgb[(*spot)&0xff];
|
|
|
|
bg = (fg+bg) | 0x1f07c1f;
|
|
|
|
*spot = RGB32k[0][0][bg&(bg>>15)];
|
|
|
|
spot++;
|
|
|
|
}
|
|
|
|
spot += gap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: UsesColormap
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-24 21:56:49 +00:00
|
|
|
bool DCanvas::UsesColormap() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: GetScreenshotBuffer
|
|
|
|
//
|
|
|
|
// Returns a buffer containing the most recently displayed frame. The
|
|
|
|
// width and height of this buffer are the same as the canvas.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void DCanvas::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type)
|
|
|
|
{
|
|
|
|
Lock(true);
|
|
|
|
buffer = GetBuffer();
|
|
|
|
pitch = GetPitch();
|
|
|
|
color_type = SS_PAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: ReleaseScreenshotBuffer
|
|
|
|
//
|
|
|
|
// Releases the buffer obtained through GetScreenshotBuffer. These calls
|
|
|
|
// must not be nested.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void DCanvas::ReleaseScreenshotBuffer()
|
|
|
|
{
|
|
|
|
Unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// V_GetColorFromString
|
|
|
|
//
|
|
|
|
// Passed a string of the form "#RGB", "#RRGGBB", "R G B", or "RR GG BB",
|
|
|
|
// returns a number representing that color. If palette is non-NULL, the
|
|
|
|
// index of the best match in the palette is returned, otherwise the
|
|
|
|
// RRGGBB value is returned directly.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int V_GetColorFromString (const DWORD *palette, const char *cstr)
|
|
|
|
{
|
|
|
|
int c[3], i, p;
|
2006-08-30 02:38:39 +00:00
|
|
|
char val[3];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-08-30 02:38:39 +00:00
|
|
|
val[2] = '\0';
|
|
|
|
|
|
|
|
// Check for HTML-style #RRGGBB or #RGB color string
|
|
|
|
if (cstr[0] == '#')
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-08-30 02:38:39 +00:00
|
|
|
size_t len = strlen (cstr);
|
|
|
|
|
|
|
|
if (len == 7)
|
|
|
|
{
|
|
|
|
// Extract each eight-bit component into c[].
|
|
|
|
for (i = 0; i < 3; ++i)
|
|
|
|
{
|
|
|
|
val[0] = cstr[1 + i*2];
|
|
|
|
val[1] = cstr[2 + i*2];
|
|
|
|
c[i] = ParseHex (val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (len == 4)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-08-30 02:38:39 +00:00
|
|
|
// Extract each four-bit component into c[], expanding to eight bits.
|
|
|
|
for (i = 0; i < 3; ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-08-30 02:38:39 +00:00
|
|
|
val[1] = val[0] = cstr[1 + i];
|
|
|
|
c[i] = ParseHex (val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Bad HTML-style; pretend it's black.
|
|
|
|
c[2] = c[1] = c[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
if (strlen(cstr) == 6)
|
2006-08-30 02:38:39 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
char *p;
|
|
|
|
int color = strtol(cstr, &p, 16);
|
|
|
|
if (*p == 0)
|
2006-08-30 02:38:39 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
// RRGGBB string
|
|
|
|
c[0] = (color & 0xff0000) >> 16;
|
|
|
|
c[1] = (color & 0xff00) >> 8;
|
|
|
|
c[2] = (color & 0xff);
|
2006-08-30 02:38:39 +00:00
|
|
|
}
|
2009-01-06 00:03:18 +00:00
|
|
|
else goto normal;
|
2008-12-07 12:11:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-01-06 00:03:18 +00:00
|
|
|
normal:
|
2008-12-07 12:11:59 +00:00
|
|
|
// Treat it as a space-delemited hexadecimal string
|
|
|
|
for (i = 0; i < 3; ++i)
|
2006-08-30 02:38:39 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
// Skip leading whitespace
|
|
|
|
while (*cstr <= ' ' && *cstr != '\0')
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
cstr++;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-12-07 12:11:59 +00:00
|
|
|
// Extract a component and convert it to eight-bit
|
|
|
|
for (p = 0; *cstr > ' '; ++p, ++cstr)
|
2006-08-30 02:38:39 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
if (p < 2)
|
|
|
|
{
|
|
|
|
val[p] = *cstr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p == 0)
|
|
|
|
{
|
|
|
|
c[i] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p == 1)
|
|
|
|
{
|
|
|
|
val[1] = val[0];
|
|
|
|
}
|
|
|
|
c[i] = ParseHex (val);
|
2006-08-30 02:38:39 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (palette)
|
2008-01-12 06:27:13 +00:00
|
|
|
return ColorMatcher.Pick (c[0], c[1], c[2]);
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
2006-08-30 02:38:39 +00:00
|
|
|
return MAKERGB(c[0], c[1], c[2]);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// V_GetColorStringByName
|
|
|
|
//
|
|
|
|
// Searches for the given color name in x11r6rgb.txt and returns an
|
|
|
|
// HTML-ish "#RRGGBB" string for it if found or the empty string if not.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-08-30 02:38:39 +00:00
|
|
|
FString V_GetColorStringByName (const char *name)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
FMemLump rgbNames;
|
|
|
|
char *rgbEnd;
|
|
|
|
char *rgb, *endp;
|
|
|
|
int rgblump;
|
|
|
|
int c[3], step;
|
|
|
|
size_t namelen;
|
|
|
|
|
2006-08-30 02:38:39 +00:00
|
|
|
if (Wads.GetNumLumps()==0) return FString();
|
2006-04-11 08:36:23 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
rgblump = Wads.CheckNumForName ("X11R6RGB");
|
|
|
|
if (rgblump == -1)
|
|
|
|
{
|
|
|
|
Printf ("X11R6RGB lump not found\n");
|
2006-08-30 02:38:39 +00:00
|
|
|
return FString();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rgbNames = Wads.ReadLump (rgblump);
|
|
|
|
rgb = (char *)rgbNames.GetMem();
|
|
|
|
rgbEnd = rgb + Wads.LumpLength (rgblump);
|
|
|
|
step = 0;
|
|
|
|
namelen = strlen (name);
|
|
|
|
|
|
|
|
while (rgb < rgbEnd)
|
|
|
|
{
|
|
|
|
// Skip white space
|
|
|
|
if (*rgb <= ' ')
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
rgb++;
|
|
|
|
} while (rgb < rgbEnd && *rgb <= ' ');
|
|
|
|
}
|
|
|
|
else if (step == 0 && *rgb == '!')
|
|
|
|
{ // skip comment lines
|
|
|
|
do
|
|
|
|
{
|
|
|
|
rgb++;
|
|
|
|
} while (rgb < rgbEnd && *rgb != '\n');
|
|
|
|
}
|
|
|
|
else if (step < 3)
|
|
|
|
{ // collect RGB values
|
|
|
|
c[step++] = strtoul (rgb, &endp, 10);
|
|
|
|
if (endp == rgb)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
rgb = endp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Check color name
|
|
|
|
endp = rgb;
|
|
|
|
// Find the end of the line
|
|
|
|
while (endp < rgbEnd && *endp != '\n')
|
|
|
|
endp++;
|
|
|
|
// Back up over any whitespace
|
|
|
|
while (endp > rgb && *endp <= ' ')
|
|
|
|
endp--;
|
|
|
|
if (endp == rgb)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
size_t checklen = ++endp - rgb;
|
|
|
|
if (checklen == namelen && strnicmp (rgb, name, checklen) == 0)
|
|
|
|
{
|
2006-08-30 02:38:39 +00:00
|
|
|
FString descr;
|
|
|
|
descr.Format ("#%02x%02x%02x", c[0], c[1], c[2]);
|
|
|
|
return descr;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
rgb = endp;
|
|
|
|
step = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rgb < rgbEnd)
|
|
|
|
{
|
|
|
|
Printf ("X11R6RGB lump is corrupt\n");
|
|
|
|
}
|
2006-08-30 02:38:39 +00:00
|
|
|
return FString();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// V_GetColor
|
|
|
|
//
|
|
|
|
// Works like V_GetColorFromString(), but also understands X11 color names.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int V_GetColor (const DWORD *palette, const char *str)
|
|
|
|
{
|
2006-08-30 02:38:39 +00:00
|
|
|
FString string = V_GetColorStringByName (str);
|
2006-02-24 04:48:15 +00:00
|
|
|
int res;
|
|
|
|
|
2006-08-30 02:38:39 +00:00
|
|
|
if (!string.IsEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
res = V_GetColorFromString (palette, string);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
res = V_GetColorFromString (palette, str);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// BuildTransTable
|
|
|
|
//
|
2006-02-24 04:48:15 +00:00
|
|
|
// Build the tables necessary for blending
|
2008-01-12 06:27:13 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void BuildTransTable (const PalEntry *palette)
|
|
|
|
{
|
|
|
|
int r, g, b;
|
|
|
|
|
|
|
|
// create the RGB555 lookup table
|
|
|
|
for (r = 0; r < 32; r++)
|
|
|
|
for (g = 0; g < 32; g++)
|
|
|
|
for (b = 0; b < 32; b++)
|
|
|
|
RGB32k[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
// create the swizzled palette
|
|
|
|
for (x = 0; x < 65; x++)
|
|
|
|
for (y = 0; y < 256; y++)
|
|
|
|
Col2RGB8[x][y] = (((palette[y].r*x)>>4)<<20) |
|
|
|
|
((palette[y].g*x)>>4) |
|
|
|
|
(((palette[y].b*x)>>4)<<10);
|
|
|
|
|
|
|
|
// create the swizzled palette with the lsb of red and blue forced to 0
|
|
|
|
// (for green, a 1 is okay since it never gets added into)
|
|
|
|
for (x = 1; x < 64; x++)
|
|
|
|
{
|
|
|
|
Col2RGB8_LessPrecision[x] = Col2RGB8_2[x-1];
|
|
|
|
for (y = 0; y < 256; y++)
|
|
|
|
{
|
|
|
|
Col2RGB8_2[x-1][y] = Col2RGB8[x][y] & 0x3feffbff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Col2RGB8_LessPrecision[0] = Col2RGB8[0];
|
|
|
|
Col2RGB8_LessPrecision[64] = Col2RGB8[64];
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
|
|
|
// create the inverse swizzled palette
|
|
|
|
for (x = 0; x < 65; x++)
|
|
|
|
for (y = 0; y < 256; y++)
|
|
|
|
{
|
|
|
|
Col2RGB8_Inverse[x][y] = (((((255-palette[y].r)*x)>>4)<<20) |
|
|
|
|
(((255-palette[y].g)*x)>>4) |
|
|
|
|
((((255-palette[y].b)*x)>>4)<<10)) & 0x3feffbff;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DCanvas :: CalcGamma
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void DCanvas::CalcGamma (float gamma, BYTE gammalookup[256])
|
|
|
|
{
|
|
|
|
// I found this formula on the web at
|
|
|
|
// <http://panda.mostang.com/sane/sane-gamma.html>,
|
|
|
|
// but that page no longer exits.
|
|
|
|
|
|
|
|
double invgamma = 1.f / gamma;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
{
|
|
|
|
gammalookup[i] = (BYTE)(255.0 * pow (i / 255.0, invgamma));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DSimpleCanvas Constructor
|
|
|
|
//
|
|
|
|
// A simple canvas just holds a buffer in main memory.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
DSimpleCanvas::DSimpleCanvas (int width, int height)
|
|
|
|
: DCanvas (width, height)
|
|
|
|
{
|
|
|
|
// Making the pitch a power of 2 is very bad for performance
|
|
|
|
// Try to maximize the number of cache lines that can be filled
|
|
|
|
// for each column drawing operation by making the pitch slightly
|
|
|
|
// longer than the width. The values used here are all based on
|
|
|
|
// empirical evidence.
|
|
|
|
|
|
|
|
if (width <= 640)
|
|
|
|
{
|
|
|
|
// For low resolutions, just keep the pitch the same as the width.
|
|
|
|
// Some speedup can be seen using the technique below, but the speedup
|
|
|
|
// is so marginal that I don't consider it worthwhile.
|
|
|
|
Pitch = width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
// If we couldn't figure out the CPU's L1 cache line size, assume
|
|
|
|
// it's 32 bytes wide.
|
|
|
|
if (CPU.DataL1LineSize == 0)
|
|
|
|
{
|
|
|
|
CPU.DataL1LineSize = 32;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
// The Athlon and P3 have very different caches, apparently.
|
|
|
|
// I am going to generalize the Athlon's performance to all AMD
|
|
|
|
// processors and the P3's to all non-AMD processors. I don't know
|
|
|
|
// how smart that is, but I don't have a vast plethora of
|
|
|
|
// processors to test with.
|
|
|
|
if (CPU.bIsAMD)
|
|
|
|
{
|
|
|
|
Pitch = width + CPU.DataL1LineSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-09 21:30:31 +00:00
|
|
|
Pitch = width + MAX(0, CPU.DataL1LineSize - 8);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
MemBuffer = new BYTE[Pitch * height];
|
2006-12-01 01:17:45 +00:00
|
|
|
memset (MemBuffer, 0, Pitch * height);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DSimpleCanvas Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
DSimpleCanvas::~DSimpleCanvas ()
|
|
|
|
{
|
|
|
|
if (MemBuffer != NULL)
|
|
|
|
{
|
|
|
|
delete[] MemBuffer;
|
|
|
|
MemBuffer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DSimpleCanvas :: IsValid
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
bool DSimpleCanvas::IsValid ()
|
|
|
|
{
|
|
|
|
return (MemBuffer != NULL);
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DSimpleCanvas :: Lock
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
bool DSimpleCanvas::Lock ()
|
|
|
|
{
|
|
|
|
if (LockCount == 0)
|
|
|
|
{
|
|
|
|
Buffer = MemBuffer;
|
|
|
|
}
|
|
|
|
LockCount++;
|
|
|
|
return false; // System surfaces are never lost
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DSimpleCanvas :: Unlock
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void DSimpleCanvas::Unlock ()
|
|
|
|
{
|
|
|
|
if (--LockCount <= 0)
|
|
|
|
{
|
|
|
|
LockCount = 0;
|
|
|
|
Buffer = NULL; // Enforce buffer access only between Lock/Unlock
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer Constructor
|
|
|
|
//
|
|
|
|
// A frame buffer canvas is the most common and represents the image that
|
|
|
|
// gets drawn to the screen.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
DFrameBuffer::DFrameBuffer (int width, int height)
|
|
|
|
: DSimpleCanvas (width, height)
|
|
|
|
{
|
|
|
|
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
2007-12-27 04:30:12 +00:00
|
|
|
Accel2D = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: DrawRateStuff
|
|
|
|
//
|
|
|
|
// Draws the fps counter, dot ticker, and palette debug.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void DFrameBuffer::DrawRateStuff ()
|
|
|
|
{
|
|
|
|
// Draws frame time and cumulative fps
|
|
|
|
if (vid_fps)
|
|
|
|
{
|
2006-09-14 00:02:31 +00:00
|
|
|
DWORD ms = I_MSTime ();
|
|
|
|
DWORD howlong = ms - LastMS;
|
2007-12-27 04:30:12 +00:00
|
|
|
if (howlong >= 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
char fpsbuff[40];
|
|
|
|
int chars;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
int rate_x;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2u ms (%3u fps)", howlong, LastCount);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
rate_x = Width - chars * 8;
|
|
|
|
Clear (rate_x, 0, Width, 8, 0, 0);
|
2008-11-27 17:43:36 +00:00
|
|
|
DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
DWORD thisSec = ms/1000;
|
|
|
|
if (LastSec < thisSec)
|
|
|
|
{
|
|
|
|
LastCount = FrameCount / (thisSec - LastSec);
|
|
|
|
LastSec = thisSec;
|
|
|
|
FrameCount = 0;
|
|
|
|
}
|
|
|
|
FrameCount++;
|
|
|
|
}
|
|
|
|
LastMS = ms;
|
|
|
|
}
|
|
|
|
|
|
|
|
// draws little dots on the bottom of the screen
|
|
|
|
if (ticker)
|
|
|
|
{
|
|
|
|
int i = I_GetTime(false);
|
|
|
|
int tics = i - LastTic;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
BYTE *buffer = GetBuffer();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
LastTic = i;
|
|
|
|
if (tics > 20) tics = 20;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
|
|
|
|
// Buffer can be NULL if we're doing hardware accelerated 2D
|
|
|
|
if (buffer != NULL)
|
|
|
|
{
|
|
|
|
buffer += (GetHeight()-1)*GetPitch();
|
|
|
|
|
|
|
|
for (i = 0; i < tics*2; i += 2) buffer[i] = 0xff;
|
|
|
|
for ( ; i < 20*2; i += 2) buffer[i] = 0x00;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < tics*2; i += 2) Clear(i, Height-1, i+1, Height, 255, 0);
|
|
|
|
for ( ; i < 20*2; i += 2) Clear(i, Height-1, i+1, Height, 0, 0);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// draws the palette for debugging
|
|
|
|
if (vid_showpalette)
|
|
|
|
{
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
// This used to just write the palette to the display buffer.
|
|
|
|
// With hardware-accelerated 2D, that doesn't work anymore.
|
|
|
|
// Drawing it as a texture does and continues to show how
|
|
|
|
// well the PalTex shader is working.
|
|
|
|
static FPaletteTester palette;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
palette.SetTranslation(vid_showpalette);
|
|
|
|
DrawTexture(&palette, 0, 0,
|
|
|
|
DTA_DestWidth, 16*7,
|
|
|
|
DTA_DestHeight, 16*7,
|
|
|
|
DTA_Masked, false,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaleteTester Constructor
|
|
|
|
//
|
|
|
|
// This is just a 16x16 image with every possible color value.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
FPaletteTester::FPaletteTester()
|
|
|
|
{
|
|
|
|
Width = 16;
|
|
|
|
Height = 16;
|
|
|
|
WidthBits = 4;
|
|
|
|
HeightBits = 4;
|
|
|
|
WidthMask = 15;
|
|
|
|
CurTranslation = 0;
|
|
|
|
WantTranslation = 1;
|
|
|
|
MakeTexture();
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: CheckModified
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
bool FPaletteTester::CheckModified()
|
|
|
|
{
|
|
|
|
return CurTranslation != WantTranslation;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: SetTranslation
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void FPaletteTester::SetTranslation(int num)
|
|
|
|
{
|
|
|
|
if (num >= 1 && num <= 9)
|
|
|
|
{
|
|
|
|
WantTranslation = num;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: Unload
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void FPaletteTester::Unload()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: GetColumn
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
const BYTE *FPaletteTester::GetColumn (unsigned int column, const Span **spans_out)
|
|
|
|
{
|
|
|
|
if (CurTranslation != WantTranslation)
|
|
|
|
{
|
|
|
|
MakeTexture();
|
|
|
|
}
|
|
|
|
column &= 15;
|
|
|
|
if (spans_out != NULL)
|
|
|
|
{
|
|
|
|
*spans_out = DummySpan;
|
|
|
|
}
|
|
|
|
return Pixels + column*16;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: GetPixels
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
const BYTE *FPaletteTester::GetPixels ()
|
|
|
|
{
|
|
|
|
if (CurTranslation != WantTranslation)
|
|
|
|
{
|
|
|
|
MakeTexture();
|
|
|
|
}
|
|
|
|
return Pixels;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FPaletteTester :: MakeTexture
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void FPaletteTester::MakeTexture()
|
|
|
|
{
|
|
|
|
int i, j, k, t;
|
|
|
|
BYTE *p;
|
|
|
|
|
|
|
|
t = WantTranslation;
|
|
|
|
p = Pixels;
|
|
|
|
k = 0;
|
|
|
|
for (i = 0; i < 16; ++i)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 16; ++j)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
*p++ = (t > 1) ? translationtables[TRANSLATION_Standard][t - 2]->Remap[k] : k;
|
2006-02-24 04:48:15 +00:00
|
|
|
k += 16;
|
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
k -= 255;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
CurTranslation = t;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: CopyFromBuff
|
|
|
|
//
|
|
|
|
// Copies pixels from main memory to video memory. This is only used by
|
|
|
|
// DDrawFB.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void DFrameBuffer::CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest)
|
|
|
|
{
|
|
|
|
if (Pitch == width && Pitch == Width && srcPitch == width)
|
|
|
|
{
|
|
|
|
memcpy (dest, src, Width * Height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int y = 0; y < height; y++)
|
|
|
|
{
|
|
|
|
memcpy (dest, src, width);
|
|
|
|
dest += Pitch;
|
|
|
|
src += srcPitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: SetVSync
|
|
|
|
//
|
|
|
|
// Turns vertical sync on and off, if supported.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void DFrameBuffer::SetVSync (bool vsync)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-02-19 02:48:56 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: NewRefreshRate
|
|
|
|
//
|
|
|
|
// Sets the fullscreen display to the new refresh rate in vid_refreshrate,
|
|
|
|
// if possible.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void DFrameBuffer::NewRefreshRate ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: SetBlendingRect
|
|
|
|
//
|
|
|
|
// Defines the area of the screen containing the 3D view.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
void DFrameBuffer::SetBlendingRect (int x1, int y1, int x2, int y2)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: Begin2D
|
|
|
|
//
|
|
|
|
// Signal that 3D rendering is complete, and the rest of the operations on
|
|
|
|
// the canvas until Unlock() will be 2D ones.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-02 05:21:48 +00:00
|
|
|
bool DFrameBuffer::Begin2D (bool copy3d)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
return false;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: CreateTexture
|
|
|
|
//
|
|
|
|
// Creates a native texture for a game texture, if supported.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
FNativeTexture *DFrameBuffer::CreateTexture(FTexture *gametex, bool wrapping)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: CreatePalette
|
|
|
|
//
|
|
|
|
// Creates a native palette from a remap table, if supported.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
FNativePalette *DFrameBuffer::CreatePalette(FRemapTable *remap)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: WipeStartScreen
|
|
|
|
//
|
|
|
|
// Grabs a copy of the screen currently displayed to serve as the initial
|
|
|
|
// frame of a screen wipe. Also determines which screenwipe will be
|
|
|
|
// performed.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-30 04:18:39 +00:00
|
|
|
bool DFrameBuffer::WipeStartScreen(int type)
|
|
|
|
{
|
|
|
|
return wipe_StartScreen(type);
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: WipeEndScreen
|
|
|
|
//
|
|
|
|
// Grabs a copy of the most-recently drawn, but not yet displayed, screen
|
|
|
|
// to serve as the final frame of a screen wipe.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-30 04:18:39 +00:00
|
|
|
void DFrameBuffer::WipeEndScreen()
|
|
|
|
{
|
|
|
|
wipe_EndScreen();
|
|
|
|
Unlock();
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: WipeDo
|
|
|
|
//
|
|
|
|
// Draws one frame of a screenwipe. Should be called no more than 35
|
|
|
|
// times per second. If called less than that, ticks indicates how many
|
|
|
|
// ticks have passed since the last call.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-30 04:18:39 +00:00
|
|
|
bool DFrameBuffer::WipeDo(int ticks)
|
|
|
|
{
|
|
|
|
Lock(true);
|
|
|
|
return wipe_ScreenWipe(ticks);
|
|
|
|
}
|
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// DFrameBuffer :: WipeCleanup
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-30 04:18:39 +00:00
|
|
|
void DFrameBuffer::WipeCleanup()
|
|
|
|
{
|
|
|
|
wipe_Cleanup();
|
|
|
|
}
|
|
|
|
|
2008-01-28 10:23:18 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Texture precaching
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-04-14 12:10:45 +00:00
|
|
|
void DFrameBuffer::PrecacheTexture(FTexture *tex, int cache)
|
2008-01-28 10:23:18 +00:00
|
|
|
{
|
|
|
|
if (tex != NULL)
|
|
|
|
{
|
2008-04-14 12:10:45 +00:00
|
|
|
if (cache & 1)
|
|
|
|
{
|
|
|
|
const FTexture::Span *spanp;
|
|
|
|
tex->GetColumn(0, &spanp);
|
|
|
|
}
|
|
|
|
else if (cache != 0)
|
2008-01-28 10:23:18 +00:00
|
|
|
{
|
|
|
|
tex->GetPixels ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tex->Unload ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-11 21:04:22 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Render the view
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-01-12 12:49:05 +00:00
|
|
|
|
2008-01-11 21:04:22 +00:00
|
|
|
void DFrameBuffer::RenderView(player_t *player)
|
|
|
|
{
|
|
|
|
R_RenderActorView (player->mo);
|
|
|
|
// [RH] Let cameras draw onto textures that were visible this frame.
|
|
|
|
FCanvasTextureInfo::UpdateAll ();
|
|
|
|
}
|
|
|
|
|
2008-01-12 12:49:05 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Render the view to a savegame picture
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void DFrameBuffer::WriteSavePic (player_t *player, FILE *file, int width, int height)
|
|
|
|
{
|
|
|
|
DCanvas *pic = new DSimpleCanvas (width, height);
|
|
|
|
PalEntry palette[256];
|
|
|
|
|
|
|
|
// Take a snapshot of the player's view
|
2008-03-13 00:41:16 +00:00
|
|
|
pic->ObjectFlags |= OF_Fixed;
|
2008-01-12 12:49:05 +00:00
|
|
|
pic->Lock ();
|
|
|
|
R_RenderViewToCanvas (player->mo, pic, 0, 0, width, height);
|
|
|
|
GetFlashedPalette (palette);
|
|
|
|
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
|
|
|
|
pic->Unlock ();
|
2008-03-13 00:41:16 +00:00
|
|
|
pic->Destroy();
|
2008-03-12 02:56:11 +00:00
|
|
|
pic->ObjectFlags |= OF_YesReallyDelete;
|
2008-01-12 12:49:05 +00:00
|
|
|
delete pic;
|
|
|
|
}
|
|
|
|
|
2008-01-11 21:04:22 +00:00
|
|
|
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
FNativePalette::~FNativePalette()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
FNativeTexture::~FNativeTexture()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
bool FNativeTexture::CheckWrapping(bool wrapping)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-12-18 02:15:32 +00:00
|
|
|
CCMD(clean)
|
|
|
|
{
|
|
|
|
Printf ("CleanXfac: %d\nCleanYfac: %d\n", CleanXfac, CleanYfac);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// V_SetResolution
|
|
|
|
//
|
|
|
|
bool V_DoModeSetup (int width, int height, int bits)
|
|
|
|
{
|
|
|
|
DFrameBuffer *buff = I_SetMode (width, height, screen);
|
|
|
|
|
|
|
|
if (buff == NULL)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
screen = buff;
|
2008-03-12 02:56:11 +00:00
|
|
|
GC::WriteBarrier(screen);
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->SetGamma (Gamma);
|
|
|
|
|
2008-01-27 05:23:10 +00:00
|
|
|
// Load fonts now so they can be packed into textures straight away,
|
|
|
|
// if D3DFB is being used for the display.
|
|
|
|
FFont::StaticPreloadFonts();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int ratio;
|
|
|
|
int cwidth;
|
|
|
|
int cheight;
|
2007-12-18 02:15:32 +00:00
|
|
|
int cx1, cy1, cx2, cy2;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
ratio = CheckRatio (width, height);
|
|
|
|
if (ratio & 4)
|
|
|
|
{
|
|
|
|
cwidth = width;
|
|
|
|
cheight = height * BaseRatioSizes[ratio][3] / 48;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cwidth = width * BaseRatioSizes[ratio][3] / 48;
|
|
|
|
cheight = height;
|
|
|
|
}
|
2007-12-18 02:15:32 +00:00
|
|
|
// Use whichever pair of cwidth/cheight or width/height that produces less difference
|
|
|
|
// between CleanXfac and CleanYfac.
|
|
|
|
cx1 = MAX(cwidth / 320, 1);
|
|
|
|
cy1 = MAX(cheight / 200, 1);
|
|
|
|
cx2 = MAX(width / 320, 1);
|
|
|
|
cy2 = MAX(height / 200, 1);
|
|
|
|
if (abs(cx1 - cy1) <= abs(cx2 - cy2))
|
|
|
|
{ // e.g. 640x360 looks better with this.
|
|
|
|
CleanXfac = cx1;
|
|
|
|
CleanYfac = cy1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // e.g. 720x480 looks better with this.
|
|
|
|
CleanXfac = cx2;
|
|
|
|
CleanYfac = cy2;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CleanXfac > 1 && CleanYfac > 1 && CleanXfac != CleanYfac)
|
|
|
|
{
|
|
|
|
if (CleanXfac < CleanYfac)
|
|
|
|
CleanYfac = CleanXfac;
|
|
|
|
else
|
|
|
|
CleanXfac = CleanYfac;
|
|
|
|
}
|
|
|
|
|
|
|
|
CleanWidth = width / CleanXfac;
|
|
|
|
CleanHeight = height / CleanYfac;
|
2007-12-18 02:15:32 +00:00
|
|
|
assert(CleanWidth >= 320);
|
|
|
|
assert(CleanHeight >= 200);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
DisplayWidth = width;
|
|
|
|
DisplayHeight = height;
|
|
|
|
DisplayBits = bits;
|
|
|
|
|
|
|
|
R_MultiresInit ();
|
|
|
|
|
|
|
|
RenderTarget = screen;
|
|
|
|
screen->Lock (true);
|
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
|
|
|
R_SetupBuffer ();
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->Unlock ();
|
|
|
|
|
|
|
|
M_RefreshModesList ();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-01-11 21:04:22 +00:00
|
|
|
bool IVideo::SetResolution (int width, int height, int bits)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int oldwidth, oldheight;
|
|
|
|
int oldbits;
|
|
|
|
|
|
|
|
if (screen)
|
|
|
|
{
|
|
|
|
oldwidth = SCREENWIDTH;
|
|
|
|
oldheight = SCREENHEIGHT;
|
|
|
|
oldbits = DisplayBits;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Harmless if screen wasn't allocated
|
|
|
|
oldwidth = width;
|
|
|
|
oldheight = height;
|
|
|
|
oldbits = bits;
|
|
|
|
}
|
|
|
|
|
|
|
|
I_ClosestResolution (&width, &height, bits);
|
|
|
|
if (!I_CheckResolution (width, height, bits))
|
|
|
|
{ // Try specified resolution
|
|
|
|
if (!I_CheckResolution (oldwidth, oldheight, oldbits))
|
|
|
|
{ // Try previous resolution (if any)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = oldwidth;
|
|
|
|
height = oldheight;
|
|
|
|
bits = oldbits;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return V_DoModeSetup (width, height, bits);
|
|
|
|
}
|
|
|
|
|
|
|
|
CCMD (vid_setmode)
|
|
|
|
{
|
2006-09-14 00:02:31 +00:00
|
|
|
bool goodmode = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
int width = 0, height = SCREENHEIGHT;
|
|
|
|
int bits = DisplayBits;
|
|
|
|
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
width = atoi (argv[1]);
|
|
|
|
if (argv.argc() > 2)
|
|
|
|
{
|
|
|
|
height = atoi (argv[2]);
|
|
|
|
if (argv.argc() > 3)
|
|
|
|
{
|
|
|
|
bits = atoi (argv[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (width && I_CheckResolution (width, height, bits))
|
|
|
|
{
|
|
|
|
goodmode = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (goodmode)
|
|
|
|
{
|
|
|
|
// The actual change of resolution will take place
|
|
|
|
// near the beginning of D_Display().
|
|
|
|
if (gamestate != GS_STARTUP)
|
|
|
|
{
|
|
|
|
setmodeneeded = true;
|
|
|
|
NewWidth = width;
|
|
|
|
NewHeight = height;
|
|
|
|
NewBits = bits;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (width)
|
|
|
|
{
|
|
|
|
Printf ("Unknown resolution %d x %d x %d\n", width, height, bits);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf ("Usage: vid_setmode <width> <height> <mode>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// V_Init
|
|
|
|
//
|
|
|
|
|
|
|
|
void V_Init (void)
|
|
|
|
{
|
|
|
|
char *i;
|
|
|
|
int width, height, bits;
|
|
|
|
|
2006-05-12 03:14:40 +00:00
|
|
|
atterm (V_Shutdown);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// [RH] Initialize palette management
|
|
|
|
InitPalette ();
|
|
|
|
|
|
|
|
width = height = bits = 0;
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
if ( (i = Args->CheckValue ("-width")) )
|
2006-02-24 04:48:15 +00:00
|
|
|
width = atoi (i);
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
if ( (i = Args->CheckValue ("-height")) )
|
2006-02-24 04:48:15 +00:00
|
|
|
height = atoi (i);
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
if ( (i = Args->CheckValue ("-bits")) )
|
2006-02-24 04:48:15 +00:00
|
|
|
bits = atoi (i);
|
|
|
|
|
|
|
|
if (width == 0)
|
|
|
|
{
|
|
|
|
if (height == 0)
|
|
|
|
{
|
|
|
|
width = vid_defwidth;
|
|
|
|
height = vid_defheight;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = (height * 8) / 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (height == 0)
|
|
|
|
{
|
|
|
|
height = (width * 6) / 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bits == 0)
|
|
|
|
{
|
|
|
|
bits = vid_defbits;
|
|
|
|
}
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
screen = new DDummyFrameBuffer (width, height);
|
|
|
|
|
|
|
|
BuildTransTable (GPalette.BaseColors);
|
|
|
|
}
|
|
|
|
|
|
|
|
void V_Init2()
|
|
|
|
{
|
|
|
|
assert (screen->IsKindOf(RUNTIME_CLASS(DDummyFrameBuffer)));
|
|
|
|
int width = screen->GetWidth();
|
|
|
|
int height = screen->GetHeight();
|
|
|
|
float gamma = static_cast<DDummyFrameBuffer *>(screen)->Gamma;
|
|
|
|
|
2008-03-30 08:58:36 +00:00
|
|
|
{
|
|
|
|
DFrameBuffer *s = screen;
|
|
|
|
screen = NULL;
|
|
|
|
s->ObjectFlags |= OF_YesReallyDelete;
|
|
|
|
delete s;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
I_InitGraphics();
|
|
|
|
I_ClosestResolution (&width, &height, 8);
|
|
|
|
|
2008-01-11 21:04:22 +00:00
|
|
|
if (!Video->SetResolution (width, height, 8))
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
I_FatalError ("Could not set resolution to %d x %d x %d", width, height, 8);
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
|
|
|
Printf ("Resolution: %d x %d\n", SCREENWIDTH, SCREENHEIGHT);
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
screen->SetGamma (gamma);
|
2006-02-24 04:48:15 +00:00
|
|
|
FBaseCVar::ResetColors ();
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
C_NewModeAdjust();
|
|
|
|
M_InitVideoModesMenu();
|
|
|
|
BorderNeedRefresh = screen->GetPageCount ();
|
|
|
|
setsizeneeded = true;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-05-12 03:14:40 +00:00
|
|
|
void V_Shutdown()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-03-30 08:58:36 +00:00
|
|
|
if (screen)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-03-30 08:58:36 +00:00
|
|
|
DFrameBuffer *s = screen;
|
2006-05-26 04:38:22 +00:00
|
|
|
screen = NULL;
|
2008-03-30 08:58:36 +00:00
|
|
|
s->ObjectFlags |= OF_YesReallyDelete;
|
|
|
|
delete s;
|
2006-05-26 04:38:22 +00:00
|
|
|
}
|
|
|
|
while (FFont::FirstFont != NULL)
|
|
|
|
{
|
|
|
|
delete FFont::FirstFont;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EXTERN_CVAR (Bool, vid_tft)
|
2006-10-20 01:58:26 +00:00
|
|
|
CUSTOM_CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|
|
|
{
|
|
|
|
setsizeneeded = true;
|
|
|
|
if (StatusBar != NULL)
|
|
|
|
{
|
|
|
|
StatusBar->ScreenSizeChanged();
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-06-06 15:21:57 +00:00
|
|
|
CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|
|
|
{
|
|
|
|
setsizeneeded = true;
|
|
|
|
if (StatusBar != NULL)
|
|
|
|
{
|
|
|
|
StatusBar->ScreenSizeChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Tries to guess the physical dimensions of the screen based on the
|
|
|
|
// screen's pixel dimensions. Can return:
|
|
|
|
// 0: 4:3
|
|
|
|
// 1: 16:9
|
|
|
|
// 2: 16:10
|
|
|
|
// 4: 5:4
|
|
|
|
int CheckRatio (int width, int height)
|
|
|
|
{
|
2009-06-06 15:21:57 +00:00
|
|
|
if ((vid_aspect >=1) && (vid_aspect <=4))
|
|
|
|
{
|
|
|
|
// [SP] User wants to force aspect ratio; let them.
|
|
|
|
return vid_aspect == 3? 0: int(vid_aspect);
|
|
|
|
}
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
if (vid_nowidescreen)
|
|
|
|
{
|
|
|
|
if (!vid_tft)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (height * 5/4 == width) ? 4 : 0;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
// If the size is approximately 16:9, consider it so.
|
|
|
|
if (abs (height * 16/9 - width) < 10)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
// 16:10 has more variance in the pixel dimensions. Grr.
|
|
|
|
if (abs (height * 16/10 - width) < 60)
|
|
|
|
{
|
|
|
|
// 320x200 and 640x400 are always 4:3, not 16:10
|
|
|
|
if ((width == 320 && height == 200) || (width == 640 && height == 400))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
// Unless vid_tft is set, 1280x1024 is 4:3, not 5:4.
|
|
|
|
if (height * 5/4 == width && vid_tft)
|
|
|
|
{
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
// Assume anything else is 4:3.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// First column: Base width (unused)
|
|
|
|
// Second column: Base height (used for wall visibility multiplier)
|
|
|
|
// Third column: Psprite offset (needed for "tallscreen" modes)
|
|
|
|
// Fourth column: Width or height multiplier
|
|
|
|
const int BaseRatioSizes[5][4] =
|
|
|
|
{
|
2007-01-22 23:14:00 +00:00
|
|
|
{ 960, 600, 0, 48 }, // 4:3 320, 200, multiplied by three
|
|
|
|
{ 1280, 450, 0, 48*3/4 }, // 16:9 426.6667, 150, multiplied by three
|
|
|
|
{ 1152, 500, 0, 48*5/6 }, // 16:10 386, 166.6667, multiplied by three
|
2006-02-24 04:48:15 +00:00
|
|
|
{ 960, 600, 0, 48 },
|
2007-01-22 23:14:00 +00:00
|
|
|
{ 960, 640, (int)(6.5*FRACUNIT), 48*15/16 } // 5:4 320, 213.3333, multiplied by three
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|