mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- also replaced the AM crosshair drawer by a DCanvas::DrawPixel function.
- moved the AM line drawer into DCanvas as a virtual function. While testing this code I discovered that the antialias precalculation was never used except for the very first frame of AM drawing. However, since I couldn't detect even a marginal performance improvement using this code on 2 computers I just disabled it completely because it severely complicates a more generic implementation. I also disabled am_ovtrans in the process because I couldn't see any positive effects of using this cvar. All it does is adding some ugly distortion to the lines it affects without any apparent benefits. * Added fix by Karate Chris containing: - Added a 'No team changing' DMFlag2 which prevents players from changing teams unless they are not on a team. - Added a 'No respawn' DMFlag2 which prevents a player from respawning after they have died. - Added a 'Keep frags gained' DMFlag2 which allows you to choose whether you want to reset the frags of each player next level or not. - Added a small visual enhancement to the cooperative scoreboard to show if a player has died. - Fixed: If the 'teamplay' console variable was set to 'true' in a cooperative game, the scoreboard would show team play related items as opposed to cooperative items. - Fixed: The 'bot_observer' console variable should not work in network games. - Fixed: Bots made intermission skip really fast. SVN r634 (trunk)
This commit is contained in:
parent
3c4344f2ec
commit
d12ede252f
14 changed files with 399 additions and 552 deletions
|
@ -1,3 +1,28 @@
|
|||
December 24, 2007 (Changes by Graf Zahl)
|
||||
- also replaced the AM crosshair drawer by a DCanvas::DrawPixel function.
|
||||
- moved the AM line drawer into DCanvas as a virtual function. While testing
|
||||
this code I discovered that the antialias precalculation was never used
|
||||
except for the very first frame of AM drawing. However, since I couldn't
|
||||
detect even a marginal performance improvement using this code on 2 computers
|
||||
I just disabled it completely because it severely complicates a more generic
|
||||
implementation. I also disabled am_ovtrans in the process because I couldn't
|
||||
see any positive effects of using this cvar. All it does is adding some
|
||||
ugly distortion to the lines it affects without any apparent benefits.
|
||||
* Added fix by Karate Chris containing:
|
||||
- Added a 'No team changing' DMFlag2 which prevents players from changing teams
|
||||
unless they are not on a team.
|
||||
- Added a 'No respawn' DMFlag2 which prevents a player from respawning after
|
||||
they have died.
|
||||
- Added a 'Keep frags gained' DMFlag2 which allows you to choose whether you
|
||||
want to reset the frags of each player next level or not.
|
||||
- Added a small visual enhancement to the cooperative scoreboard to show
|
||||
if a player has died.
|
||||
- Fixed: If the 'teamplay' console variable was set to 'true' in a cooperative
|
||||
game, the scoreboard would show team play related items as opposed to
|
||||
cooperative items.
|
||||
- Fixed: The 'bot_observer' console variable should not work in network games.
|
||||
- Fixed: Bots made intermission skip really fast.
|
||||
|
||||
December 23, 2007 (Changes by Graf Zahl)
|
||||
- Fixed a few font related problems.
|
||||
- Fixed: ASkyViewpoint::Destroy was missing the super call.
|
||||
|
|
628
src/am_map.cpp
628
src/am_map.cpp
|
@ -53,7 +53,25 @@
|
|||
#include "am_map.h"
|
||||
#include "a_artifacts.h"
|
||||
|
||||
static int Background, YourColor, WallColor, TSWallColor,
|
||||
struct AMColor
|
||||
{
|
||||
int Index;
|
||||
uint32 RGB;
|
||||
|
||||
void FromCVar(FColorCVar & cv)
|
||||
{
|
||||
Index = cv.GetIndex();
|
||||
RGB = uint32(cv) | MAKEARGB(255, 0, 0, 0);
|
||||
}
|
||||
|
||||
void FromRGB(int r,int g, int b)
|
||||
{
|
||||
RGB = MAKEARGB(255, r, g, b);
|
||||
Index = ColorMatcher.Pick(r, g, b);
|
||||
}
|
||||
};
|
||||
|
||||
static AMColor Background, YourColor, WallColor, TSWallColor,
|
||||
FDWallColor, CDWallColor, ThingColor,
|
||||
ThingColor_Item, ThingColor_Monster, ThingColor_Friend,
|
||||
SecretWallColor, GridColor, XHairColor,
|
||||
|
@ -63,7 +81,7 @@ static int Background, YourColor, WallColor, TSWallColor,
|
|||
IntraTeleportColor, InterTeleportColor,
|
||||
SecretSectorColor;
|
||||
|
||||
static int DoomColors[11];
|
||||
static AMColor DoomColors[11];
|
||||
static BYTE DoomPaletteVals[11*3] =
|
||||
{
|
||||
0x00,0x00,0x00, 0xff,0xff,0xff, 0x10,0x10,0x10,
|
||||
|
@ -96,7 +114,7 @@ inline fixed_t MTOF(fixed_t x)
|
|||
return MulScale24 (x, scale_mtof);
|
||||
}
|
||||
|
||||
static int WeightingScale;
|
||||
//static int WeightingScale;
|
||||
|
||||
CVAR (Int, am_rotate, 0, CVAR_ARCHIVE);
|
||||
CVAR (Int, am_overlay, 0, CVAR_ARCHIVE);
|
||||
|
@ -279,7 +297,6 @@ static int f_w;
|
|||
static int f_h;
|
||||
static int f_p; // [RH] # of bytes from start of a line to start of next
|
||||
|
||||
static BYTE *fb; // pseudo-frame buffer
|
||||
static int amclock;
|
||||
|
||||
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||
|
@ -329,25 +346,19 @@ static fixed_t mapxstart=0; //x-value for the bitmap.
|
|||
static bool stopped = true;
|
||||
|
||||
|
||||
/*
|
||||
#define NUMALIASES 3
|
||||
#define WALLCOLORS -1
|
||||
#define FDWALLCOLORS -2
|
||||
#define CDWALLCOLORS -3
|
||||
|
||||
#define WEIGHTBITS 6
|
||||
#define WEIGHTSHIFT (16-WEIGHTBITS)
|
||||
#define NUMWEIGHTS (1<<WEIGHTBITS)
|
||||
#define WEIGHTMASK (NUMWEIGHTS-1)
|
||||
static BYTE antialias[NUMALIASES][NUMWEIGHTS];
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void AM_rotatePoint (fixed_t *x, fixed_t *y);
|
||||
void AM_rotate (fixed_t *x, fixed_t *y, angle_t an);
|
||||
|
||||
void DrawWuLine (int X0, int Y0, int X1, int Y1, BYTE *BaseColor);
|
||||
void DrawTransWuLine (int X0, int Y0, int X1, int Y1, BYTE BaseColor);
|
||||
|
||||
// Calculates the slope and slope according to the x-axis of a line
|
||||
// segment in map coordinates (with the upright y-axis n' all) so
|
||||
// that it can be used with the brain-dead drawing stuff.
|
||||
|
@ -604,6 +615,7 @@ void AM_initVariables ()
|
|||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
/*
|
||||
static void GetComponents (int color, DWORD *palette, float &r, float &g, float &b)
|
||||
{
|
||||
if (palette)
|
||||
|
@ -613,11 +625,13 @@ static void GetComponents (int color, DWORD *palette, float &r, float &g, float
|
|||
g = (float)GPART(color);
|
||||
b = (float)BPART(color);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static void AM_initColors (bool overlayed)
|
||||
{
|
||||
static DWORD *lastpal = NULL;
|
||||
static int lastback = -1;
|
||||
//static int lastback = -1;
|
||||
DWORD *palette;
|
||||
|
||||
palette = (DWORD *)GPalette.BaseColors;
|
||||
|
@ -628,45 +642,47 @@ static void AM_initColors (bool overlayed)
|
|||
|
||||
for (i = j = 0; i < 11; i++, j += 3)
|
||||
{
|
||||
DoomColors[i] = palette
|
||||
? ColorMatcher.Pick (DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2])
|
||||
: MAKERGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]);
|
||||
DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]);
|
||||
}
|
||||
}
|
||||
|
||||
if (overlayed)
|
||||
{
|
||||
YourColor = am_ovyourcolor.GetIndex ();
|
||||
SecretSectorColor = SecretWallColor = WallColor = am_ovwallcolor.GetIndex ();
|
||||
ThingColor_Item = am_ovthingcolor_item.GetIndex();
|
||||
ThingColor_Friend = am_ovthingcolor_friend.GetIndex();
|
||||
ThingColor_Monster = am_ovthingcolor_monster.GetIndex();
|
||||
ThingColor = am_ovthingcolor.GetIndex ();
|
||||
FDWallColor = CDWallColor = LockedColor = am_ovotherwallscolor.GetIndex ();
|
||||
NotSeenColor = TSWallColor = am_ovunseencolor.GetIndex ();
|
||||
IntraTeleportColor = InterTeleportColor = am_ovtelecolor.GetIndex ();
|
||||
YourColor.FromCVar (am_ovyourcolor);
|
||||
WallColor.FromCVar (am_ovwallcolor);
|
||||
SecretSectorColor = SecretWallColor = WallColor;
|
||||
ThingColor_Item.FromCVar (am_ovthingcolor_item);
|
||||
ThingColor_Friend.FromCVar (am_ovthingcolor_friend);
|
||||
ThingColor_Monster.FromCVar (am_ovthingcolor_monster);
|
||||
ThingColor.FromCVar (am_ovthingcolor);
|
||||
LockedColor.FromCVar (am_ovotherwallscolor);
|
||||
FDWallColor = CDWallColor = LockedColor;
|
||||
TSWallColor.FromCVar (am_ovunseencolor);
|
||||
NotSeenColor = TSWallColor;
|
||||
InterTeleportColor.FromCVar (am_ovtelecolor);
|
||||
IntraTeleportColor = InterTeleportColor;
|
||||
}
|
||||
else if (am_usecustomcolors)
|
||||
{
|
||||
/* Use the custom colors in the am_* cvars */
|
||||
Background = am_backcolor.GetIndex ();
|
||||
YourColor = am_yourcolor.GetIndex ();
|
||||
SecretWallColor = am_secretwallcolor.GetIndex ();
|
||||
WallColor = am_wallcolor.GetIndex ();
|
||||
TSWallColor = am_tswallcolor.GetIndex ();
|
||||
FDWallColor = am_fdwallcolor.GetIndex ();
|
||||
CDWallColor = am_cdwallcolor.GetIndex ();
|
||||
ThingColor_Item = am_thingcolor_item.GetIndex();
|
||||
ThingColor_Friend = am_thingcolor_friend.GetIndex();
|
||||
ThingColor_Monster = am_thingcolor_monster.GetIndex();
|
||||
ThingColor = am_thingcolor.GetIndex ();
|
||||
GridColor = am_gridcolor.GetIndex ();
|
||||
XHairColor = am_xhaircolor.GetIndex ();
|
||||
NotSeenColor = am_notseencolor.GetIndex ();
|
||||
LockedColor = am_lockedcolor.GetIndex ();
|
||||
InterTeleportColor = am_interlevelcolor.GetIndex ();
|
||||
IntraTeleportColor = am_intralevelcolor.GetIndex ();
|
||||
SecretSectorColor = am_secretsectorcolor.GetIndex ();
|
||||
Background.FromCVar (am_backcolor);
|
||||
YourColor.FromCVar (am_yourcolor);
|
||||
SecretWallColor.FromCVar (am_secretwallcolor);
|
||||
WallColor.FromCVar (am_wallcolor);
|
||||
TSWallColor.FromCVar (am_tswallcolor);
|
||||
FDWallColor.FromCVar (am_fdwallcolor);
|
||||
CDWallColor.FromCVar (am_cdwallcolor);
|
||||
ThingColor_Item.FromCVar (am_thingcolor_item);
|
||||
ThingColor_Friend.FromCVar (am_thingcolor_friend);
|
||||
ThingColor_Monster.FromCVar (am_thingcolor_monster);
|
||||
ThingColor.FromCVar (am_thingcolor);
|
||||
GridColor.FromCVar (am_gridcolor);
|
||||
XHairColor.FromCVar (am_xhaircolor);
|
||||
NotSeenColor.FromCVar (am_notseencolor);
|
||||
LockedColor.FromCVar (am_lockedcolor);
|
||||
InterTeleportColor.FromCVar (am_interlevelcolor);
|
||||
IntraTeleportColor.FromCVar (am_intralevelcolor);
|
||||
SecretSectorColor.FromCVar (am_secretsectorcolor);
|
||||
|
||||
DWORD ba = am_backcolor;
|
||||
|
||||
|
@ -681,7 +697,7 @@ static void AM_initColors (bool overlayed)
|
|||
if (b < 0)
|
||||
b += 32;
|
||||
|
||||
AlmostBackground = ColorMatcher.Pick (r, g, b);
|
||||
AlmostBackground.FromRGB(r, g, b);
|
||||
}
|
||||
else
|
||||
{ // Use colors corresponding to the original Doom's
|
||||
|
@ -704,6 +720,11 @@ static void AM_initColors (bool overlayed)
|
|||
NotSeenColor = DoomColors[10];
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Due to a bug (marked below) precalculated antialiasing was never working properly.
|
||||
// Also, tests show it provides no measurable performance improvement.
|
||||
// And since it only complicates matters it's disabled for now.
|
||||
|
||||
// initialize the anti-aliased lines
|
||||
static struct
|
||||
{
|
||||
|
@ -743,11 +764,14 @@ static void AM_initColors (bool overlayed)
|
|||
// else
|
||||
// antialias[alias][i] = MAKERGB(red, green, blue);
|
||||
}
|
||||
*(aliasedLines[alias].color) = aliasedLines[alias].falseColor;
|
||||
}
|
||||
// This line was inside the 'if' block rendering the whole
|
||||
// precalculation inoperable.
|
||||
*(aliasedLines[alias].color) = aliasedLines[alias].falseColor;
|
||||
}
|
||||
lastpal = palette;
|
||||
lastback = Background;
|
||||
#endif
|
||||
lastpal = palette;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1091,11 +1115,11 @@ void AM_Ticker ()
|
|||
//
|
||||
// Clear automap frame buffer.
|
||||
//
|
||||
void AM_clearFB (int color)
|
||||
void AM_clearFB (const AMColor &color)
|
||||
{
|
||||
if (mapback == NULL || !am_drawmapback)
|
||||
{
|
||||
screen->Clear (0, 0, f_w, f_h, color, 0);
|
||||
screen->Clear (0, 0, f_w, f_h, color.Index, color.RGB);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1243,480 +1267,17 @@ bool AM_clipMline (mline_t *ml, fline_t *fl)
|
|||
#undef DOOUTCODE
|
||||
|
||||
|
||||
//
|
||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||
//
|
||||
void AM_drawFline (fline_t *fl, int color)
|
||||
{
|
||||
fl->a.x += f_x;
|
||||
fl->b.x += f_x;
|
||||
fl->a.y += f_y;
|
||||
fl->b.y += f_y;
|
||||
|
||||
switch (color)
|
||||
{
|
||||
case WALLCOLORS:
|
||||
DrawWuLine (fl->a.x, fl->a.y, fl->b.x, fl->b.y, &antialias[0][0]);
|
||||
break;
|
||||
case FDWALLCOLORS:
|
||||
DrawWuLine (fl->a.x, fl->a.y, fl->b.x, fl->b.y, &antialias[1][0]);
|
||||
break;
|
||||
case CDWALLCOLORS:
|
||||
DrawWuLine (fl->a.x, fl->a.y, fl->b.x, fl->b.y, &antialias[2][0]);
|
||||
break;
|
||||
default:
|
||||
DrawTransWuLine (fl->a.x, fl->a.y, fl->b.x, fl->b.y, color);
|
||||
break;
|
||||
#if 0
|
||||
{
|
||||
register int x;
|
||||
register int y;
|
||||
register int dx;
|
||||
register int dy;
|
||||
register int sx;
|
||||
register int sy;
|
||||
register int ax;
|
||||
register int ay;
|
||||
register int d;
|
||||
|
||||
#define PUTDOTP(xx,yy,cc) fb[(yy)*f_p+(xx)]=(cc)
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx<0 ? -dx : dx);
|
||||
sx = dx<0 ? -1 : 1;
|
||||
|
||||
dy = fl->b.y - fl->a.y;
|
||||
ay = 2 * (dy<0 ? -dy : dy);
|
||||
sy = dy<0 ? -1 : 1;
|
||||
|
||||
x = fl->a.x;
|
||||
y = fl->a.y;
|
||||
|
||||
if (ax > ay) {
|
||||
d = ay - ax/2;
|
||||
for (;;) {
|
||||
PUTDOTP(x,y,(BYTE)color);
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d>=0) {
|
||||
y += sy;
|
||||
d -= ax;
|
||||
}
|
||||
x += sx;
|
||||
d += ay;
|
||||
}
|
||||
} else {
|
||||
d = ax - ay/2;
|
||||
for (;;) {
|
||||
PUTDOTP(x, y, (BYTE)color);
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0) {
|
||||
x += sx;
|
||||
d -= ay;
|
||||
}
|
||||
y += sy;
|
||||
d += ax;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Wu antialiased line drawer.
|
||||
* (X0,Y0),(X1,Y1) = line to draw
|
||||
* BaseColor = color # of first color in block used for antialiasing, the
|
||||
* 100% intensity version of the drawing color
|
||||
* NumLevels = size of color block, with BaseColor+NumLevels-1 being the
|
||||
* 0% intensity version of the drawing color
|
||||
* IntensityBits = log base 2 of NumLevels; the # of bits used to describe
|
||||
* the intensity of the drawing color. 2**IntensityBits==NumLevels
|
||||
*/
|
||||
void PUTDOT (int xx, int yy, BYTE *cc, BYTE *cm)
|
||||
{
|
||||
static int oldyy;
|
||||
static int oldyyshifted;
|
||||
BYTE *oldcc=cc;
|
||||
|
||||
#if 0
|
||||
if(xx < 32)
|
||||
cc += 7-(xx>>2);
|
||||
else if(xx > (finit_width - 32))
|
||||
cc += 7-((finit_width-xx) >> 2);
|
||||
// if(cc==oldcc) //make sure that we don't double fade the corners.
|
||||
// {
|
||||
if(yy < 32)
|
||||
cc += 7-(yy>>2);
|
||||
else if(yy > (finit_height - 32))
|
||||
cc += 7-((finit_height-yy) >> 2);
|
||||
// }
|
||||
#endif
|
||||
if (cm != NULL && cc > cm)
|
||||
{
|
||||
cc = cm;
|
||||
}
|
||||
else if (cc > oldcc+6) // don't let the color escape from the fade table...
|
||||
{
|
||||
cc=oldcc+6;
|
||||
}
|
||||
if (yy == oldyy+1)
|
||||
{
|
||||
oldyy++;
|
||||
oldyyshifted += SCREENPITCH;
|
||||
}
|
||||
else if (yy == oldyy-1)
|
||||
{
|
||||
oldyy--;
|
||||
oldyyshifted -= SCREENPITCH;
|
||||
}
|
||||
else if (yy != oldyy)
|
||||
{
|
||||
oldyy = yy;
|
||||
oldyyshifted = yy*SCREENPITCH;
|
||||
}
|
||||
fb[oldyyshifted+xx] = *(cc);
|
||||
}
|
||||
|
||||
void DrawWuLine (int x0, int y0, int x1, int y1, BYTE *baseColor)
|
||||
{
|
||||
int deltaX, deltaY, xDir;
|
||||
|
||||
if (viewactive)
|
||||
{
|
||||
// If the map is overlayed, use the translucent line drawer
|
||||
// code to avoid nasty discolored spots along the edges of
|
||||
// the lines. Otherwise, use this one to avoid reading from
|
||||
// the framebuffer.
|
||||
DrawTransWuLine (x0, y0, x1, y1, *baseColor);
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the line runs top to bottom
|
||||
if (y0 > y1)
|
||||
{
|
||||
int temp = y0; y0 = y1; y1 = temp;
|
||||
temp = x0; x0 = x1; x1 = temp;
|
||||
}
|
||||
|
||||
// Draw the initial pixel, which is always exactly intersected by
|
||||
// the line and so needs no weighting
|
||||
PUTDOT (x0, y0, &baseColor[0], NULL);
|
||||
|
||||
if ((deltaX = x1 - x0) >= 0)
|
||||
{
|
||||
xDir = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDir = -1;
|
||||
deltaX = -deltaX; // make deltaX positive
|
||||
}
|
||||
// Special-case horizontal, vertical, and diagonal lines, which
|
||||
// require no weighting because they go right through the center of
|
||||
// every pixel
|
||||
if ((deltaY = y1 - y0) == 0)
|
||||
{ // horizontal line
|
||||
while (deltaX-- != 0)
|
||||
{
|
||||
x0 += xDir;
|
||||
PUTDOT (x0, y0, &baseColor[0], NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (deltaX == 0)
|
||||
{ // vertical line
|
||||
do
|
||||
{
|
||||
y0++;
|
||||
PUTDOT (x0, y0, &baseColor[0], NULL);
|
||||
} while (--deltaY != 0);
|
||||
return;
|
||||
}
|
||||
if (deltaX == deltaY)
|
||||
{ // diagonal line.
|
||||
do
|
||||
{
|
||||
x0 += xDir;
|
||||
y0++;
|
||||
PUTDOT (x0, y0, &baseColor[0], NULL);
|
||||
} while (--deltaY != 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Line is not horizontal, diagonal, or vertical
|
||||
fixed_t errorAcc = 0; // initialize the line error accumulator to 0
|
||||
|
||||
// Is this an X-major or Y-major line?
|
||||
if (deltaY > deltaX)
|
||||
{
|
||||
// Y-major line; calculate 16-bit fixed-point fractional part of a
|
||||
// pixel that X advances each time Y advances 1 pixel, truncating the
|
||||
// result so that we won't overrun the endpoint along the X axis
|
||||
fixed_t errorAdj = ((DWORD) deltaX << 16) / (DWORD) deltaY & 0xffff;
|
||||
|
||||
// Draw all pixels other than the first and last
|
||||
if (xDir < 0)
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++; // Y-major, so always advance Y
|
||||
|
||||
// The most significant bits of ErrorAcc give us the intensity
|
||||
// weighting for this pixel, and the complement of the weighting
|
||||
// for the paired pixel
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTDOT (x0 - (errorAcc >> 16), y0, &baseColor[weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
PUTDOT (x0 - (errorAcc >> 16) - 1, y0,
|
||||
&baseColor[WEIGHTMASK - weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++; // Y-major, so always advance Y
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTDOT (x0 + (errorAcc >> 16), y0, &baseColor[weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
PUTDOT (x0 + (errorAcc >> 16) + 1, y0,
|
||||
&baseColor[WEIGHTMASK - weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It's an X-major line; calculate 16-bit fixed-point fractional part of a
|
||||
// pixel that Y advances each time X advances 1 pixel, truncating the
|
||||
// result to avoid overrunning the endpoint along the X axis
|
||||
fixed_t errorAdj = ((DWORD) deltaY << 16) / (DWORD) deltaX;
|
||||
|
||||
// Draw all pixels other than the first and last
|
||||
while (--deltaX)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
x0 += xDir; // X-major, so always advance X
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTDOT (x0, y0 + (errorAcc >> 16), &baseColor[weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
PUTDOT (x0, y0 + (errorAcc >> 16) + 1,
|
||||
&baseColor[WEIGHTMASK - weighting], &baseColor[NUMWEIGHTS-1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the final pixel, which is always exactly intersected by the line
|
||||
// and so needs no weighting
|
||||
PUTDOT (x1, y1, &baseColor[0], NULL);
|
||||
}
|
||||
|
||||
void PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
||||
{
|
||||
static int oldyy;
|
||||
static int oldyyshifted;
|
||||
|
||||
#if 0
|
||||
if(xx < 32)
|
||||
cc += 7-(xx>>2);
|
||||
else if(xx > (finit_width - 32))
|
||||
cc += 7-((finit_width-xx) >> 2);
|
||||
// if(cc==oldcc) //make sure that we don't double fade the corners.
|
||||
// {
|
||||
if(yy < 32)
|
||||
cc += 7-(yy>>2);
|
||||
else if(yy > (finit_height - 32))
|
||||
cc += 7-((finit_height-yy) >> 2);
|
||||
// }
|
||||
if(cc > cm && cm != NULL)
|
||||
{
|
||||
cc = cm;
|
||||
}
|
||||
else if(cc > oldcc+6) // don't let the color escape from the fade table...
|
||||
{
|
||||
cc=oldcc+6;
|
||||
}
|
||||
#endif
|
||||
if (yy == oldyy+1)
|
||||
{
|
||||
oldyy++;
|
||||
oldyyshifted += SCREENPITCH;
|
||||
}
|
||||
else if (yy == oldyy-1)
|
||||
{
|
||||
oldyy--;
|
||||
oldyyshifted -= SCREENPITCH;
|
||||
}
|
||||
else if (yy != oldyy)
|
||||
{
|
||||
oldyy = yy;
|
||||
oldyyshifted = yy*SCREENPITCH;
|
||||
}
|
||||
|
||||
BYTE *spot = fb + oldyyshifted + xx;
|
||||
DWORD *bg2rgb = Col2RGB8[1+level];
|
||||
DWORD *fg2rgb = Col2RGB8[63-level];
|
||||
DWORD fg = fg2rgb[basecolor];
|
||||
DWORD bg = bg2rgb[*spot];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*spot = RGB32k[0][0][bg&(bg>>15)];
|
||||
}
|
||||
|
||||
void DrawTransWuLine (int x0, int y0, int x1, int y1, BYTE baseColor)
|
||||
{
|
||||
int deltaX, deltaY, xDir;
|
||||
|
||||
if (y0 > y1)
|
||||
{
|
||||
int temp = y0; y0 = y1; y1 = temp;
|
||||
temp = x0; x0 = x1; x1 = temp;
|
||||
}
|
||||
|
||||
PUTTRANSDOT (x0, y0, baseColor, 0);
|
||||
|
||||
if ((deltaX = x1 - x0) >= 0)
|
||||
{
|
||||
xDir = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDir = -1;
|
||||
deltaX = -deltaX;
|
||||
}
|
||||
|
||||
if ((deltaY = y1 - y0) == 0)
|
||||
{ // horizontal line
|
||||
if (x0 > x1)
|
||||
{
|
||||
swap (x0, x1);
|
||||
}
|
||||
memset (screen->GetBuffer() + y0*screen->GetPitch() + x0, baseColor, deltaX+1);
|
||||
return;
|
||||
}
|
||||
if (deltaX == 0)
|
||||
{ // vertical line
|
||||
BYTE *spot = screen->GetBuffer() + y0*screen->GetPitch() + x0;
|
||||
int pitch = screen->GetPitch ();
|
||||
do
|
||||
{
|
||||
*spot = baseColor;
|
||||
spot += pitch;
|
||||
} while (--deltaY != 0);
|
||||
return;
|
||||
}
|
||||
if (deltaX == deltaY)
|
||||
{ // diagonal line.
|
||||
BYTE *spot = screen->GetBuffer() + y0*screen->GetPitch() + x0;
|
||||
int advance = screen->GetPitch() + xDir;
|
||||
do
|
||||
{
|
||||
*spot = baseColor;
|
||||
spot += advance;
|
||||
} while (--deltaY != 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// line is not horizontal, diagonal, or vertical
|
||||
fixed_t errorAcc = 0;
|
||||
|
||||
if (deltaY > deltaX)
|
||||
{ // y-major line
|
||||
fixed_t errorAdj = (((unsigned)deltaX << 16) / (unsigned)deltaY) & 0xffff;
|
||||
if (xDir < 0)
|
||||
{
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16), y0, baseColor, weighting);
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16) - 1, y0,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16), y0, baseColor, weighting);
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16) - 1, y0,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16), y0, baseColor, weighting);
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16) + xDir, y0,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16), y0, baseColor, weighting);
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16) + xDir, y0,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // x-major line
|
||||
fixed_t errorAdj = (((DWORD) deltaY << 16) / (DWORD) deltaX) & 0xffff;
|
||||
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaX)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
x0 += xDir;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16), baseColor, weighting);
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16) + 1,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaX)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
x0 += xDir;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16), baseColor, weighting);
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16) + 1,
|
||||
baseColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PUTTRANSDOT (x1, y1, baseColor, 0);
|
||||
}
|
||||
|
||||
//
|
||||
// Clip lines, draw visible parts of lines.
|
||||
//
|
||||
void AM_drawMline (mline_t *ml, int color)
|
||||
void AM_drawMline (mline_t *ml, const AMColor &color)
|
||||
{
|
||||
static fline_t fl;
|
||||
fline_t fl;
|
||||
|
||||
if (AM_clipMline (ml, &fl))
|
||||
AM_drawFline (&fl, color); // draws it on frame buffer using fb coords
|
||||
{
|
||||
screen->DrawLine (f_x + fl.a.x, f_y + fl.a.y, f_x + fl.b.x, f_y + fl.b.y, color.Index, color.RGB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1724,7 +1285,7 @@ void AM_drawMline (mline_t *ml, int color)
|
|||
//
|
||||
// Draws flat (floor/ceiling tile) aligned grid lines.
|
||||
//
|
||||
void AM_drawGrid (int color)
|
||||
void AM_drawGrid (const AMColor &color)
|
||||
{
|
||||
fixed_t x, y;
|
||||
fixed_t start, end;
|
||||
|
@ -1866,13 +1427,12 @@ void AM_drawWalls (bool allmap)
|
|||
|
||||
int color = P_GetMapColorForLock(lock);
|
||||
|
||||
if (color > 0)
|
||||
{
|
||||
color = ColorMatcher.Pick(RPART(color), GPART(color), BPART(color));
|
||||
}
|
||||
else color = LockedColor;
|
||||
AMColor c;
|
||||
|
||||
AM_drawMline (&l, color);
|
||||
if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color));
|
||||
else c = LockedColor;
|
||||
|
||||
AM_drawMline (&l, c);
|
||||
}
|
||||
else
|
||||
AM_drawMline (&l, LockedColor); // locked special
|
||||
|
@ -1931,7 +1491,7 @@ AM_drawLineCharacter
|
|||
int lineguylines,
|
||||
fixed_t scale,
|
||||
angle_t angle,
|
||||
int color,
|
||||
const AMColor &color,
|
||||
fixed_t x,
|
||||
fixed_t y )
|
||||
{
|
||||
|
@ -1997,7 +1557,7 @@ void AM_drawPlayers ()
|
|||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
player_t *p = &players[i];
|
||||
int color;
|
||||
AMColor color;
|
||||
mpoint_t pt;
|
||||
|
||||
if (!playeringame[i] || p->mo == NULL)
|
||||
|
@ -2023,8 +1583,7 @@ void AM_drawPlayers ()
|
|||
D_GetPlayerColor (i, &h, &s, &v);
|
||||
HSVtoRGB (&r, &g, &b, h, s, v);
|
||||
|
||||
color = ColorMatcher.Pick (clamp (int(r*255.f),0,255),
|
||||
clamp (int(g*255.f),0,255), clamp (int(b*255.f),0,255));
|
||||
color.FromRGB(clamp (int(r*255.f),0,255), clamp (int(g*255.f),0,255), clamp (int(b*255.f),0,255));
|
||||
}
|
||||
|
||||
if (p->mo != NULL)
|
||||
|
@ -2046,9 +1605,9 @@ void AM_drawPlayers ()
|
|||
}
|
||||
}
|
||||
|
||||
void AM_drawThings (int _color)
|
||||
void AM_drawThings ()
|
||||
{
|
||||
int color;
|
||||
AMColor color;
|
||||
int i;
|
||||
AActor* t;
|
||||
mpoint_t p;
|
||||
|
@ -2198,9 +1757,9 @@ void AM_drawAuthorMarkers ()
|
|||
}
|
||||
}
|
||||
|
||||
void AM_drawCrosshair (int color)
|
||||
void AM_drawCrosshair (const AMColor &color)
|
||||
{
|
||||
fb[f_p*((f_h+1)/2)+(f_w/2)] = (BYTE)color; // single point for now
|
||||
screen->DrawPixel(f_w/2, (f_h+1)/2, color.Index, color.RGB);
|
||||
}
|
||||
|
||||
void AM_Drawer ()
|
||||
|
@ -2213,7 +1772,6 @@ void AM_Drawer ()
|
|||
|
||||
AM_initColors (viewactive);
|
||||
|
||||
fb = screen->GetBuffer ();
|
||||
if (!viewactive)
|
||||
{
|
||||
// [RH] Set f_? here now to handle automap overlaying
|
||||
|
@ -2222,7 +1780,7 @@ void AM_Drawer ()
|
|||
f_w = screen->GetWidth ();
|
||||
f_h = ST_Y;
|
||||
f_p = screen->GetPitch ();
|
||||
WeightingScale = 0;
|
||||
//WeightingScale = 0;
|
||||
|
||||
AM_clearFB(Background);
|
||||
}
|
||||
|
@ -2233,11 +1791,13 @@ void AM_Drawer ()
|
|||
f_w = realviewwidth;
|
||||
f_h = realviewheight;
|
||||
f_p = screen->GetPitch ();
|
||||
/*
|
||||
WeightingScale = (int)(am_ovtrans * 256.f);
|
||||
if (WeightingScale < 0 || WeightingScale >= 256)
|
||||
{
|
||||
WeightingScale = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
AM_activateNewScale();
|
||||
|
||||
|
@ -2247,7 +1807,7 @@ void AM_Drawer ()
|
|||
AM_drawWalls(allmap);
|
||||
AM_drawPlayers();
|
||||
if (am_cheat >= 2 || allthings)
|
||||
AM_drawThings(ThingColor);
|
||||
AM_drawThings();
|
||||
AM_drawAuthorMarkers();
|
||||
|
||||
if (!viewactive)
|
||||
|
|
|
@ -143,7 +143,7 @@ void DCajunMaster::Main (int buf)
|
|||
}
|
||||
|
||||
//Check if player should go observer. Or un observe
|
||||
if (bot_observer && !observer)
|
||||
if (bot_observer && !observer && !netgame)
|
||||
{
|
||||
Printf ("%s is now observer\n", players[consoleplayer].userinfo.netname);
|
||||
observer = true;
|
||||
|
@ -152,7 +152,7 @@ void DCajunMaster::Main (int buf)
|
|||
players[consoleplayer].mo->flags2 |= MF2_FLY;
|
||||
players[consoleplayer].mo->LinkToWorld ();
|
||||
}
|
||||
else if (!bot_observer && observer) //Go back
|
||||
else if (!bot_observer && observer && !netgame) //Go back
|
||||
{
|
||||
Printf ("%s returned to the fray\n", players[consoleplayer].userinfo.netname);
|
||||
observer = false;
|
||||
|
|
|
@ -388,8 +388,11 @@ CVAR (Flag, sv_nocrouch, dmflags, DF_NO_CROUCH);
|
|||
|
||||
CVAR (Int, dmflags2, 0, CVAR_SERVERINFO);
|
||||
CVAR (Flag, sv_weapondrop, dmflags2, DF2_YES_WEAPONDROP);
|
||||
CVAR (Flag, sv_noteamswitch, dmflags2, DF2_NO_TEAMSWITCH);
|
||||
CVAR (Flag, sv_doubleammo, dmflags2, DF2_YES_DOUBLEAMMO);
|
||||
CVAR (Flag, sv_keepfrags, dmflags2, DF2_YES_KEEPFRAGS);
|
||||
CVAR (Flag, sv_degeneration, dmflags2, DF2_YES_DEGENERATION);
|
||||
CVAR (Flag, sv_norespawn, dmflags2, DF2_NO_RESPAWN);
|
||||
CVAR (Flag, sv_losefrag, dmflags2, DF2_YES_LOSEFRAG);
|
||||
CVAR (Flag, sv_nobfgaim, dmflags2, DF2_NO_FREEAIMBFG);
|
||||
CVAR (Flag, sv_respawnprotect, dmflags2, DF2_YES_INVUL);
|
||||
|
|
|
@ -274,6 +274,13 @@ int D_PickRandomTeam ()
|
|||
static void UpdateTeam (int pnum, int team, bool update)
|
||||
{
|
||||
userinfo_t *info = &players[pnum].userinfo;
|
||||
|
||||
if ((dmflags2 & DF2_NO_TEAMSWITCH) && (alwaysapplydmflags || deathmatch) && TEAMINFO_IsValidTeam (info->team))
|
||||
{
|
||||
Printf ("Team changing has been disabled!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int oldteam;
|
||||
|
||||
if (team < TEAM_None)
|
||||
|
|
|
@ -241,14 +241,14 @@ enum
|
|||
//#define DF2_YES_IRETURN 8 // Instantly return skull when player carrying it dies
|
||||
//#define DF2_YES_RETURN 16 // Return dropped skulls after 30 seconds
|
||||
//#define DF2_YES_TEAMCOLORS 32 // Don't use player's base color in teamgames
|
||||
//#define DF2_NO_SWITCH 64 // Player is not allowed to switch teams
|
||||
DF2_NO_TEAMSWITCH = 1 << 6, // Player is not allowed to switch teams
|
||||
//#define DF2_FORCE_RANDOM 128 // Player put on random team
|
||||
//#define DF2_YES_RUNEDROP 256 // Drop current rune upon death
|
||||
//#define DF2_YES_200MAX 512 // Don't all max. health/armor items to bring
|
||||
// // health or armor over 200%
|
||||
DF2_YES_DOUBLEAMMO = 1 << 10, // Doubles ammo like skill 1 and 5 do
|
||||
//#define DF2_NO_CLEARFRAGS 2048 // Don't clear frags after each level
|
||||
//#define DF2_FORCE_NORESPAWN 4096 // Player cannot respawn
|
||||
DF2_YES_KEEPFRAGS = 1 << 11, // Don't clear frags after each level
|
||||
DF2_NO_RESPAWN = 1 << 12, // Player cannot respawn
|
||||
DF2_YES_DEGENERATION = 1 << 13, // Quake-style degeneration
|
||||
DF2_YES_LOSEFRAG = 1 << 14, // Lose a frag when killed. More incentive to try to
|
||||
// // not get yerself killed
|
||||
|
|
|
@ -1977,8 +1977,9 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
{
|
||||
if (playeringame[i] && (deathmatch || players[i].playerstate == PST_DEAD))
|
||||
players[i].playerstate = PST_ENTER; // [BC]
|
||||
memset (players[i].frags,0,sizeof(players[i].frags));
|
||||
players[i].fragcount = 0;
|
||||
memset (players[i].frags,0,sizeof(players[i].frags));
|
||||
if (!(dmflags2 & DF2_YES_KEEPFRAGS) && (alwaysapplydmflags || deathmatch))
|
||||
players[i].fragcount = 0;
|
||||
}
|
||||
|
||||
if (g_nomonsters)
|
||||
|
|
|
@ -461,7 +461,7 @@ int P_GetMapColorForLock (int lock)
|
|||
{
|
||||
if (locks[lock]) return locks[lock]->rgb;
|
||||
}
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -132,7 +132,7 @@ void HU_DrawScores (player_t *player)
|
|||
sortedplayers[j] = &players[i];
|
||||
}
|
||||
|
||||
if (teamplay)
|
||||
if (teamplay && deathmatch)
|
||||
qsort (sortedplayers, MAXPLAYERS, sizeof(player_t *), compareteams);
|
||||
else
|
||||
qsort (sortedplayers, MAXPLAYERS, sizeof(player_t *), comparepoints);
|
||||
|
@ -179,14 +179,14 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
}
|
||||
}
|
||||
|
||||
if (teamplay)
|
||||
if (teamplay && deathmatch)
|
||||
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 16;
|
||||
else
|
||||
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 4 : y = SCREENHEIGHT / 16;
|
||||
|
||||
HU_DrawTimeRemaining (ST_Y - height);
|
||||
|
||||
if (teamplay)
|
||||
if (teamplay && deathmatch)
|
||||
{
|
||||
for (i = 0; i < teams.Size (); i++)
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1);
|
||||
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 10;
|
||||
|
||||
if (teamplay)
|
||||
if (teamplay && deathmatch)
|
||||
y += SCREENWIDTH / 32;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS && y < ST_Y - 12 * CleanYfac; i++)
|
||||
|
@ -306,7 +306,7 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int x, int y, int h
|
|||
clamp(int(g*255.f),0,255),
|
||||
clamp(int(b*255.f),0,255)));
|
||||
|
||||
if (teamplay)
|
||||
if (teamplay && deathmatch)
|
||||
{
|
||||
color = teams[player->userinfo.team].GetTextColor ();
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int x, int y, int h
|
|||
|
||||
sprintf (str, "%d", deathmatch ? player->fragcount : player->killcount);
|
||||
|
||||
screen->DrawText (color, SCREENWIDTH / 4, y, str,
|
||||
screen->DrawText (color, SCREENWIDTH / 4, y, player->playerstate == PST_DEAD && !deathmatch ? "DEAD" : str,
|
||||
DTA_CleanNoMove, true, TAG_DONE);
|
||||
|
||||
screen->DrawText (color, SCREENWIDTH / 2, y, player->userinfo.netname,
|
||||
|
|
|
@ -1016,6 +1016,7 @@ static menuitem_t DMFlagsItems[] = {
|
|||
{ bitflag, "Infinite ammo", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_INFINITE_AMMO} },
|
||||
{ bitflag, "No monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_NO_MONSTERS} },
|
||||
{ bitflag, "Monsters respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_MONSTERS_RESPAWN} },
|
||||
{ bitflag, "No respawn", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_NO_RESPAWN} },
|
||||
{ bitflag, "Items respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_ITEMS_RESPAWN} },
|
||||
{ bitflag, "Big powerups respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_RESPAWN_SUPER} },
|
||||
{ bitflag, "Fast monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_FAST_MONSTERS} },
|
||||
|
@ -1037,7 +1038,9 @@ static menuitem_t DMFlagsItems[] = {
|
|||
{ bitflag, "Allow exit", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_EXIT} },
|
||||
{ bitflag, "Barrels respawn", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_BARRELS_RESPAWN} },
|
||||
{ bitflag, "Respawn protection", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_INVUL} },
|
||||
{ bitflag, "Lose frag when fragged",{&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_LOSEFRAG} },
|
||||
{ bitflag, "Lose frag if fragged", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_LOSEFRAG} },
|
||||
{ bitflag, "Keep frags gained", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_KEEPFRAGS} },
|
||||
{ bitflag, "No team changing", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_NO_TEAMSWITCH} },
|
||||
{ redtext, " ", {NULL}, {0}, {0}, {0}, {NULL} },
|
||||
{ whitetext,"Cooperative Settings", {NULL}, {0}, {0}, {0}, {NULL} },
|
||||
{ bitflag, "Spawn multi. weapons", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_COOP_WEAPON_SPAWN} },
|
||||
|
|
|
@ -1807,8 +1807,8 @@ void P_DeathThink (player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->cmd.ucmd.buttons & BT_USE ||
|
||||
((deathmatch || alwaysapplydmflags) && (dmflags & DF_FORCE_RESPAWN)))
|
||||
if ((player->cmd.ucmd.buttons & BT_USE ||
|
||||
((deathmatch || alwaysapplydmflags) && (dmflags & DF_FORCE_RESPAWN))) && !(dmflags2 & DF2_NO_RESPAWN))
|
||||
{
|
||||
if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && !player->isbot))
|
||||
{
|
||||
|
|
240
src/v_draw.cpp
240
src/v_draw.cpp
|
@ -674,6 +674,246 @@ void DCanvas::DrawPlayerBackdrop (DCanvas *src, const BYTE *FireRemap, int x, in
|
|||
}
|
||||
|
||||
|
||||
void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
||||
{
|
||||
static int oldyy;
|
||||
static int oldyyshifted;
|
||||
|
||||
#if 0
|
||||
if(xx < 32)
|
||||
cc += 7-(xx>>2);
|
||||
else if(xx > (finit_width - 32))
|
||||
cc += 7-((finit_width-xx) >> 2);
|
||||
// if(cc==oldcc) //make sure that we don't double fade the corners.
|
||||
// {
|
||||
if(yy < 32)
|
||||
cc += 7-(yy>>2);
|
||||
else if(yy > (finit_height - 32))
|
||||
cc += 7-((finit_height-yy) >> 2);
|
||||
// }
|
||||
if(cc > cm && cm != NULL)
|
||||
{
|
||||
cc = cm;
|
||||
}
|
||||
else if(cc > oldcc+6) // don't let the color escape from the fade table...
|
||||
{
|
||||
cc=oldcc+6;
|
||||
}
|
||||
#endif
|
||||
if (yy == oldyy+1)
|
||||
{
|
||||
oldyy++;
|
||||
oldyyshifted += GetPitch();
|
||||
}
|
||||
else if (yy == oldyy-1)
|
||||
{
|
||||
oldyy--;
|
||||
oldyyshifted -= GetPitch();
|
||||
}
|
||||
else if (yy != oldyy)
|
||||
{
|
||||
oldyy = yy;
|
||||
oldyyshifted = yy * GetPitch();
|
||||
}
|
||||
|
||||
BYTE *spot = GetBuffer() + oldyyshifted + xx;
|
||||
DWORD *bg2rgb = Col2RGB8[1+level];
|
||||
DWORD *fg2rgb = Col2RGB8[63-level];
|
||||
DWORD fg = fg2rgb[basecolor];
|
||||
DWORD bg = bg2rgb[*spot];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*spot = RGB32k[0][0][bg&(bg>>15)];
|
||||
}
|
||||
|
||||
void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor)
|
||||
//void DrawTransWuLine (int x0, int y0, int x1, int y1, BYTE palColor)
|
||||
{
|
||||
const int WeightingScale = 0;
|
||||
const int WEIGHTBITS = 6;
|
||||
const int WEIGHTSHIFT = 16-WEIGHTBITS;
|
||||
const int NUMWEIGHTS = (1<<WEIGHTBITS);
|
||||
const int WEIGHTMASK = (NUMWEIGHTS-1);
|
||||
|
||||
if (palColor < 0)
|
||||
{
|
||||
// Quick check for black.
|
||||
if (realcolor == MAKEARGB(255,0,0,0))
|
||||
{
|
||||
palColor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
palColor = ColorMatcher.Pick(RPART(realcolor), GPART(realcolor), BPART(realcolor));
|
||||
}
|
||||
}
|
||||
|
||||
Lock();
|
||||
int deltaX, deltaY, xDir;
|
||||
|
||||
if (y0 > y1)
|
||||
{
|
||||
int temp = y0; y0 = y1; y1 = temp;
|
||||
temp = x0; x0 = x1; x1 = temp;
|
||||
}
|
||||
|
||||
PUTTRANSDOT (x0, y0, palColor, 0);
|
||||
|
||||
if ((deltaX = x1 - x0) >= 0)
|
||||
{
|
||||
xDir = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDir = -1;
|
||||
deltaX = -deltaX;
|
||||
}
|
||||
|
||||
if ((deltaY = y1 - y0) == 0)
|
||||
{ // horizontal line
|
||||
if (x0 > x1)
|
||||
{
|
||||
swap (x0, x1);
|
||||
}
|
||||
memset (GetBuffer() + y0*GetPitch() + x0, palColor, deltaX+1);
|
||||
}
|
||||
else if (deltaX == 0)
|
||||
{ // vertical line
|
||||
BYTE *spot = GetBuffer() + y0*GetPitch() + x0;
|
||||
int pitch = GetPitch ();
|
||||
do
|
||||
{
|
||||
*spot = palColor;
|
||||
spot += pitch;
|
||||
} while (--deltaY != 0);
|
||||
}
|
||||
else if (deltaX == deltaY)
|
||||
{ // diagonal line.
|
||||
BYTE *spot = GetBuffer() + y0*GetPitch() + x0;
|
||||
int advance = GetPitch() + xDir;
|
||||
do
|
||||
{
|
||||
*spot = palColor;
|
||||
spot += advance;
|
||||
} while (--deltaY != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// line is not horizontal, diagonal, or vertical
|
||||
fixed_t errorAcc = 0;
|
||||
|
||||
if (deltaY > deltaX)
|
||||
{ // y-major line
|
||||
fixed_t errorAdj = (((unsigned)deltaX << 16) / (unsigned)deltaY) & 0xffff;
|
||||
if (xDir < 0)
|
||||
{
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16), y0, palColor, weighting);
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16) - 1, y0,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16), y0, palColor, weighting);
|
||||
PUTTRANSDOT (x0 - (errorAcc >> 16) - 1, y0,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16), y0, palColor, weighting);
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16) + xDir, y0,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaY)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
y0++;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16), y0, palColor, weighting);
|
||||
PUTTRANSDOT (x0 + (errorAcc >> 16) + xDir, y0,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // x-major line
|
||||
fixed_t errorAdj = (((DWORD) deltaY << 16) / (DWORD) deltaX) & 0xffff;
|
||||
|
||||
if (WeightingScale == 0)
|
||||
{
|
||||
while (--deltaX)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
x0 += xDir;
|
||||
int weighting = (errorAcc >> WEIGHTSHIFT) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16), palColor, weighting);
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16) + 1,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (--deltaX)
|
||||
{
|
||||
errorAcc += errorAdj;
|
||||
x0 += xDir;
|
||||
int weighting = ((errorAcc * WeightingScale) >> (WEIGHTSHIFT+8)) & WEIGHTMASK;
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16), palColor, weighting);
|
||||
PUTTRANSDOT (x0, y0 + (errorAcc >> 16) + 1,
|
||||
palColor, WEIGHTMASK - weighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
PUTTRANSDOT (x1, y1, palColor, 0);
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void DCanvas::DrawPixel(int x, int y, int palColor, uint32 realcolor)
|
||||
{
|
||||
if (palColor < 0)
|
||||
{
|
||||
// Quick check for black.
|
||||
if (realcolor == MAKEARGB(255,0,0,0))
|
||||
{
|
||||
palColor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
palColor = ColorMatcher.Pick(RPART(realcolor), GPART(realcolor), BPART(realcolor));
|
||||
}
|
||||
}
|
||||
|
||||
Lock();
|
||||
GetBuffer()[GetPitch() * y + x] = (BYTE)palColor;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
/* */
|
||||
/* Other miscellaneous routines */
|
||||
|
|
|
@ -170,6 +170,12 @@ public:
|
|||
// renders the player backdrop for the menu
|
||||
virtual void DrawPlayerBackdrop (DCanvas *src, const BYTE *FireRemap, int x, int y);
|
||||
|
||||
// draws a line
|
||||
virtual void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor);
|
||||
|
||||
// draws a single pixel
|
||||
virtual void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
|
||||
|
||||
// Calculate gamma table
|
||||
void CalcGamma (float gamma, BYTE gammalookup[256]);
|
||||
|
||||
|
@ -232,6 +238,8 @@ private:
|
|||
// Keep track of canvases, for automatic destruction at exit
|
||||
DCanvas *Next;
|
||||
static DCanvas *CanvasChain;
|
||||
|
||||
void PUTTRANSDOT (int xx, int yy, int basecolor, int level);
|
||||
};
|
||||
|
||||
// A canvas in system memory.
|
||||
|
|
|
@ -1890,7 +1890,7 @@ void WI_checkForAccelerate(void)
|
|||
{
|
||||
if ((player->cmd.ucmd.buttons ^ player->oldbuttons) &&
|
||||
((players[i].cmd.ucmd.buttons & players[i].oldbuttons)
|
||||
== players[i].oldbuttons))
|
||||
== players[i].oldbuttons) && !player->isbot)
|
||||
{
|
||||
acceleratestage = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue