mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 03:12:00 -04:00
any res bunny scroll, HOM detection, disk flash, st_bar solid colors
* Various fixes.
This commit is contained in:
parent
7be7a78e8a
commit
3d8c701a60
@ -2646,9 +2646,6 @@ void D_DoomMain(void)
|
||||
I_Printf(VB_INFO, "S_Init: Setting up sound.");
|
||||
S_Init(snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
|
||||
|
||||
// [FG] init graphics (video.widedelta) before HUD widgets
|
||||
I_InitGraphics();
|
||||
|
||||
I_Printf(VB_INFO, "HU_Init: Setting up heads up display.");
|
||||
HU_Init();
|
||||
M_SetMenuFontSpacing();
|
||||
@ -2807,6 +2804,9 @@ void D_DoomMain(void)
|
||||
I_SetFastdemoTimer(true);
|
||||
}
|
||||
|
||||
// [FG] init graphics (video.widedelta) before HUD widgets
|
||||
I_InitGraphics();
|
||||
|
||||
if (startloadgame >= 0)
|
||||
{
|
||||
char *file;
|
||||
|
@ -705,60 +705,18 @@ void F_CastDrawer (void)
|
||||
V_DrawPatch (160, 170, patch);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// F_DrawPatchCol
|
||||
//
|
||||
// killough 11/98: reformatted and added hires support
|
||||
|
||||
static void F_DrawPatchCol(int x, patch_t *patch, int col)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
const column_t *column =
|
||||
(const column_t *)((byte *) patch + LONG(patch->columnofs[col]));
|
||||
|
||||
// step through the posts in a column
|
||||
if (hires)
|
||||
while (column->topdelta != 0xff)
|
||||
{
|
||||
byte *desttop = I_VideoBuffer + x*2;
|
||||
const byte *source = (byte *) column + 3;
|
||||
byte *dest = desttop + column->topdelta*SCREENWIDTH*4;
|
||||
int count = column->length;
|
||||
for (;count--; dest += SCREENWIDTH*4)
|
||||
dest[0] = dest[SCREENWIDTH*2] = dest[1] = dest[SCREENWIDTH*2+1] =
|
||||
*source++;
|
||||
column = (column_t *)(source+1);
|
||||
}
|
||||
else
|
||||
while (column->topdelta != 0xff)
|
||||
{
|
||||
byte *desttop = I_VideoBuffer + x;
|
||||
const byte *source = (byte *) column + 3;
|
||||
byte *dest = desttop + column->topdelta*SCREENWIDTH;
|
||||
int count = column->length;
|
||||
for (;count--; dest += SCREENWIDTH)
|
||||
*dest = *source++;
|
||||
column = (column_t *)(source+1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// F_BunnyScroll
|
||||
//
|
||||
void F_BunnyScroll (void)
|
||||
{
|
||||
int scrolled;
|
||||
int x;
|
||||
patch_t* p1;
|
||||
patch_t* p2;
|
||||
char name[16];
|
||||
int stage;
|
||||
static int laststage;
|
||||
int p2offset, p1offset, pillar_width;
|
||||
int offset;
|
||||
|
||||
p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
|
||||
p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);
|
||||
@ -769,42 +727,22 @@ void F_BunnyScroll (void)
|
||||
if (scrolled < 0)
|
||||
scrolled = 0;
|
||||
|
||||
pillar_width = (SCREENWIDTH - SHORT(p1->width)) / 2;
|
||||
|
||||
if (pillar_width > 0)
|
||||
offset = 0;
|
||||
if (SHORT(p2->width) != SCREENWIDTH)
|
||||
{
|
||||
// [crispy] fill pillarboxes in widescreen mode
|
||||
memset(I_VideoBuffer, 0, video.width * video.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pillar_width = 0;
|
||||
offset = video.deltaw;
|
||||
}
|
||||
|
||||
// Calculate the portion of PFUB2 that would be offscreen at original res.
|
||||
p1offset = (SCREENWIDTH - SHORT(p1->width)) / 2;
|
||||
if (scrolled > 0)
|
||||
V_DrawPatch(320 - scrolled - offset, 0, p2);
|
||||
if (scrolled < 320)
|
||||
V_DrawPatch(-scrolled - offset, 0, p1);
|
||||
|
||||
if (SHORT(p2->width) == SCREENWIDTH)
|
||||
{
|
||||
// Unity or original PFUBs.
|
||||
// PFUB1 only contains the pixels that scroll off.
|
||||
p2offset = SCREENWIDTH - p1offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Widescreen mod PFUBs.
|
||||
// Right side of PFUB2 and left side of PFUB1 are identical.
|
||||
p2offset = SCREENWIDTH + p1offset;
|
||||
}
|
||||
|
||||
for (x = pillar_width; x < SCREENWIDTH - pillar_width; x++)
|
||||
{
|
||||
int x2 = x - video.deltaw + scrolled;
|
||||
|
||||
if (x2 < p2offset)
|
||||
F_DrawPatchCol (x, p1, x2 - p1offset);
|
||||
else
|
||||
F_DrawPatchCol (x, p2, x2 - p2offset);
|
||||
V_FillRect(0, 0, video.deltaw, SCREENHEIGHT, v_darkest_color);
|
||||
V_FillRect(video.unscaledw - video.deltaw, 0,
|
||||
video.deltaw, SCREENHEIGHT, v_darkest_color);
|
||||
}
|
||||
|
||||
if (finalecount < 1130)
|
||||
|
@ -1405,8 +1405,8 @@ boolean HU_DemoProgressBar(boolean force)
|
||||
return false;
|
||||
}
|
||||
|
||||
V_DrawHorizLine(0, video.unscaledh - 2, progress, v_darkest_color);
|
||||
V_DrawHorizLine(0, video.unscaledh - 1, progress, v_lightest_color);
|
||||
V_FillRect(0, video.unscaledh - 2, progress, 1, v_darkest_color);
|
||||
V_FillRect(0, video.unscaledh - 1, progress, 1, v_lightest_color);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ static inline void I_UpdateRender (void)
|
||||
}
|
||||
|
||||
static void I_DrawDiskIcon(), I_RestoreDiskBackground();
|
||||
//static unsigned int disk_to_draw, disk_to_restore;
|
||||
static unsigned int disk_to_draw, disk_to_restore;
|
||||
|
||||
static void CreateUpscaledTexture(boolean force);
|
||||
|
||||
@ -566,13 +566,21 @@ void I_ReadScreen(byte *scr)
|
||||
// killough 10/98: init disk icon
|
||||
//
|
||||
|
||||
//static pixel_t *diskflash, *old_data;
|
||||
static pixel_t *diskflash, *old_data;
|
||||
static vrect_t disk;
|
||||
|
||||
static void I_InitDiskFlash(void)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
pixel_t temp[32*32];
|
||||
pixel_t *temp;
|
||||
|
||||
disk.x = 0;
|
||||
disk.y = 0;
|
||||
disk.w = 16;
|
||||
disk.h = 16;
|
||||
|
||||
V_ScaleRect(&disk);
|
||||
|
||||
temp = Z_Malloc(disk.sw * disk.sh * sizeof(*temp), PU_STATIC, 0);
|
||||
|
||||
if (diskflash)
|
||||
{
|
||||
@ -580,14 +588,15 @@ static void I_InitDiskFlash(void)
|
||||
Z_Free(old_data);
|
||||
}
|
||||
|
||||
diskflash = Z_Malloc((16<<hires) * (16<<hires) * sizeof(*diskflash), PU_STATIC, 0);
|
||||
old_data = Z_Malloc((16<<hires) * (16<<hires) * sizeof(*old_data), PU_STATIC, 0);
|
||||
diskflash = Z_Malloc(disk.sw * disk.sh * sizeof(*diskflash), PU_STATIC, 0);
|
||||
old_data = Z_Malloc(disk.sw * disk.sh * sizeof(*old_data), PU_STATIC, 0);
|
||||
|
||||
V_GetBlock(0, 0, 16, 16, temp);
|
||||
V_DrawPatchDirect(0-video.widedelta, 0, W_CacheLumpName("STDISK", PU_CACHE));
|
||||
V_GetBlock(0, 0, 16, 16, diskflash);
|
||||
V_DrawBlock(0, 0, 16, 16, temp);
|
||||
#endif
|
||||
V_GetBlock(0, 0, disk.sw, disk.sh, temp);
|
||||
V_DrawPatch(-video.deltaw, 0, W_CacheLumpName("STDISK", PU_CACHE));
|
||||
V_GetBlock(0, 0, disk.sw, disk.sh, diskflash);
|
||||
V_PutBlock(0, 0, disk.sw, disk.sh, temp);
|
||||
|
||||
Z_Free(temp);
|
||||
}
|
||||
|
||||
//
|
||||
@ -596,24 +605,21 @@ static void I_InitDiskFlash(void)
|
||||
|
||||
void I_BeginRead(unsigned int bytes)
|
||||
{
|
||||
//disk_to_draw += bytes;
|
||||
disk_to_draw += bytes;
|
||||
}
|
||||
|
||||
static void I_DrawDiskIcon(void)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
if (!disk_icon || PLAYBACK_SKIP)
|
||||
return;
|
||||
|
||||
if (disk_to_draw >= DISK_ICON_THRESHOLD)
|
||||
{
|
||||
V_GetBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 16, 16, old_data);
|
||||
V_PutBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 16, 16, diskflash);
|
||||
V_GetBlock(video.width - disk.sw, video.height - disk.sh, disk.sw, disk.sh, old_data);
|
||||
V_PutBlock(video.width - disk.sw, video.height - disk.sh, disk.sw, disk.sh, diskflash);
|
||||
|
||||
disk_to_restore = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@ -627,20 +633,17 @@ void I_EndRead(void)
|
||||
|
||||
static void I_RestoreDiskBackground(void)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
if (!disk_icon || PLAYBACK_SKIP)
|
||||
return;
|
||||
|
||||
if (disk_to_restore)
|
||||
{
|
||||
V_PutBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 16, 16, old_data);
|
||||
V_PutBlock(video.width - disk.sw, video.height - disk.sh, disk.sw, disk.sh, old_data);
|
||||
|
||||
disk_to_restore = 0;
|
||||
}
|
||||
|
||||
disk_to_draw = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const float gammalevels[9] =
|
||||
@ -957,7 +960,6 @@ static void I_GetScreenDimensions(void)
|
||||
// [FG] For performance reasons, SDL2 insists that the screen pitch, i.e.
|
||||
// the *number of bytes* that one horizontal row of pixels occupy in
|
||||
// memory, must be a multiple of 4.
|
||||
video.unscaledw = (video.unscaledw + 3) & ~3;
|
||||
video.width = (video.width + 3) & ~3;
|
||||
video.height = (video.height + 3) & ~3;
|
||||
|
||||
@ -1141,7 +1143,7 @@ static void I_ResetGraphicsMode(void)
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
V_Init();
|
||||
ST_Init();
|
||||
ST_InitRes();
|
||||
|
||||
// [FG] create paletted frame buffer
|
||||
|
||||
|
@ -482,7 +482,6 @@ void R_ExecuteSetViewSize (void)
|
||||
view.w = scaledviewwidth;
|
||||
view.h = scaledviewheight;
|
||||
|
||||
V_ClipRect(&view);
|
||||
V_ScaleRect(&view);
|
||||
|
||||
viewwidth = view.sw;
|
||||
@ -754,12 +753,11 @@ void R_RenderPlayerView (player_t* player)
|
||||
R_ClearSprites ();
|
||||
VX_ClearVoxels ();
|
||||
|
||||
// TODO
|
||||
#if 0
|
||||
if (autodetect_hom)
|
||||
{ // killough 2/10/98: add flashing red HOM indicators
|
||||
pixel_t c[47*47];
|
||||
extern int lastshottic;
|
||||
const int linesize = video.width;
|
||||
int i , color = !flashing_hom || (gametic % 20) < 9 ? 0xb0 : 0;
|
||||
memset(I_VideoBuffer+viewwindowy*linesize,color,viewheight*linesize);
|
||||
for (i=0;i<47*47;i++)
|
||||
@ -822,11 +820,10 @@ void R_RenderPlayerView (player_t* player)
|
||||
c[i] = t=='/' ? color : t;
|
||||
}
|
||||
if (gametic-lastshottic < TICRATE*2 && gametic-lastshottic > TICRATE/8)
|
||||
V_DrawBlock((viewwindowx + viewwidth/2 - 24)>>hires,
|
||||
(viewwindowy + viewheight/2 - 24)>>hires, 47, 47, c);
|
||||
V_DrawBlock(scaledviewx + scaledviewwidth/2 - 24,
|
||||
scaledviewy + scaledviewheight/2 - 24, 47, 47, c);
|
||||
R_DrawViewBorder();
|
||||
}
|
||||
#endif
|
||||
|
||||
// check for new console commands.
|
||||
NetUpdate ();
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef __R_THINGS__
|
||||
#define __R_THINGS__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "m_fixed.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
|
@ -32,9 +32,6 @@
|
||||
#include "r_main.h"
|
||||
#include "am_map.h"
|
||||
#include "m_cheat.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
#include "dstrings.h"
|
||||
#include "m_misc2.h"
|
||||
#include "m_swap.h"
|
||||
#include "i_printf.h"
|
||||
@ -318,22 +315,24 @@ void ST_Stop(void);
|
||||
|
||||
int st_solidbackground;
|
||||
|
||||
static void ST_DrawSolidBackground(void)
|
||||
static void ST_DrawSolidBackground(int st_x)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
// [FG] calculate average color of the 16px left and right of the status bar
|
||||
const int vstep[][2] = {{0, 1}, {1, 2}, {2, ST_HEIGHT}};
|
||||
const int hstep = video.width;
|
||||
const int lo = MAX(st_x + video.widedelta - SHORT(sbar->leftoffset), 0);
|
||||
const int w = MIN(SHORT(sbar->width), SCREENWIDTH);
|
||||
const int depth = 16;
|
||||
|
||||
byte *pal = W_CacheLumpName("PLAYPAL", PU_STATIC);
|
||||
int v;
|
||||
|
||||
// [FG] temporarily draw status bar to background buffer
|
||||
V_DrawPatch(st_x, 0, sbar);
|
||||
|
||||
vrect_t rect;
|
||||
rect.w = MIN(SHORT(sbar->width), video.unscaledw);
|
||||
rect.h = ST_HEIGHT;
|
||||
|
||||
const int offset = MAX(st_x + video.deltaw - SHORT(sbar->leftoffset), 0);
|
||||
const int depth = 16;
|
||||
int v;
|
||||
|
||||
// [FG] separate colors for the top rows
|
||||
for (v = 0; v < arrlen(vstep); v++)
|
||||
{
|
||||
@ -346,12 +345,16 @@ static void ST_DrawSolidBackground(void)
|
||||
{
|
||||
for (x = 0; x < depth; x++)
|
||||
{
|
||||
byte *c = st_backing_screen + y * hstep + ((x + lo) << hires);
|
||||
rect.x = x + offset;
|
||||
rect.y = y;
|
||||
V_ScaleRect(&rect);
|
||||
|
||||
byte *c = st_backing_screen + rect.sy * video.width + rect.sx;
|
||||
r += pal[3 * c[0] + 0];
|
||||
g += pal[3 * c[0] + 1];
|
||||
b += pal[3 * c[0] + 2];
|
||||
|
||||
c += (w - 2 * x - 1) << hires;
|
||||
c += rect.sw - 2 * rect.sx - 1;
|
||||
r += pal[3 * c[0] + 0];
|
||||
g += pal[3 * c[0] + 1];
|
||||
b += pal[3 * c[0] + 2];
|
||||
@ -365,15 +368,10 @@ static void ST_DrawSolidBackground(void)
|
||||
// [FG] tune down to half saturation (for empiric reasons)
|
||||
col = I_GetPaletteIndex(pal, r/2, g/2, b/2);
|
||||
|
||||
// [FG] fill background buffer with average status bar color
|
||||
for (y = (v0 << hires); y < (v1 << hires); y++)
|
||||
{
|
||||
memset(dest + y * (SCREENWIDTH << hires), col, (SCREENWIDTH << hires));
|
||||
}
|
||||
V_FillRect(0, v0, video.unscaledw, v1 - v0, col);
|
||||
}
|
||||
|
||||
Z_ChangeTag (pal, PU_CACHE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ST_refreshBackground(boolean force)
|
||||
@ -387,7 +385,7 @@ void ST_refreshBackground(boolean force)
|
||||
|
||||
if (SHORT(sbar->width) > video.unscaledw && SHORT(sbar->leftoffset) == 0)
|
||||
{
|
||||
st_x = ST_X + (video.unscaledw - SHORT(sbar->width)) / 2;
|
||||
st_x = ST_X + (SCREENWIDTH - SHORT(sbar->width)) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -398,14 +396,11 @@ void ST_refreshBackground(boolean force)
|
||||
|
||||
if (video.unscaledw != ST_WIDTH)
|
||||
{
|
||||
// TODO
|
||||
#if 0
|
||||
if (st_solidbackground)
|
||||
{
|
||||
ST_DrawSolidBackground();
|
||||
ST_DrawSolidBackground(st_x);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// [crispy] this is our own local copy of R_FillBackScreen() to fill
|
||||
// the entire background of st_backing_screen with the bezel
|
||||
@ -426,7 +421,7 @@ void ST_refreshBackground(boolean force)
|
||||
for (x = 0; x < video.deltaw; x += 8)
|
||||
{
|
||||
V_DrawPatch(x - video.deltaw, 0, patch);
|
||||
V_DrawPatch(video.unscaledw - x - 8 - video.deltaw, 0, patch);
|
||||
V_DrawPatch(SCREENWIDTH + video.deltaw - x - 8, 0, patch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -463,9 +458,9 @@ void ST_refreshBackground(boolean force)
|
||||
V_CopyRect(0, 0, st_backing_screen,
|
||||
video.deltaw, ST_HEIGHT,
|
||||
0, ST_Y);
|
||||
V_CopyRect(video.unscaledw - video.deltaw, 0, st_backing_screen,
|
||||
V_CopyRect(SCREENWIDTH + video.deltaw, 0, st_backing_screen,
|
||||
video.deltaw, ST_HEIGHT,
|
||||
video.unscaledw - video.deltaw, ST_Y);
|
||||
SCREENWIDTH + video.deltaw, ST_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1338,16 +1333,18 @@ static int StatusBarBufferHeight(void)
|
||||
|
||||
void ST_Init(void)
|
||||
{
|
||||
vrect_t rect;
|
||||
|
||||
ST_loadData();
|
||||
}
|
||||
|
||||
void ST_InitRes(void)
|
||||
{
|
||||
vrect_t rect;
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = video.unscaledw;
|
||||
rect.h = StatusBarBufferHeight();
|
||||
|
||||
V_ClipRect(&rect);
|
||||
V_ScaleRect(&rect);
|
||||
|
||||
if (st_backing_screen)
|
||||
|
@ -53,7 +53,9 @@ void ST_Init(void);
|
||||
void ST_Warnings(void);
|
||||
|
||||
// [crispy] forcefully initialize the status bar backing screen
|
||||
extern void ST_refreshBackground(boolean force);
|
||||
void ST_refreshBackground(boolean force);
|
||||
|
||||
void ST_InitRes(void);
|
||||
|
||||
// killough 5/2/98: moved from m_misc.c:
|
||||
|
||||
|
112
src/v_video.c
112
src/v_video.c
@ -553,7 +553,7 @@ void V_DrawPatchInt(int x, int y, patch_t *patch, boolean flipped,
|
||||
#ifdef RANGECHECK
|
||||
if(texturecolumn < 0 || texturecolumn >= w)
|
||||
{
|
||||
I_Error("V_DrawPatchInt: bad texturecolumn %d\n", texturecolumn);
|
||||
I_Error("V_DrawPatchInt: bad texturecolumn %d", texturecolumn);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -604,7 +604,9 @@ void V_DrawPatchFullScreen(patch_t *patch)
|
||||
// [crispy] fill pillarboxes in widescreen mode
|
||||
if (video.unscaledw != NONWIDEWIDTH)
|
||||
{
|
||||
memset(dest_screen, v_darkest_color, video.width * video.height);
|
||||
V_FillRect(0, 0, video.deltaw, SCREENHEIGHT, v_darkest_color);
|
||||
V_FillRect(video.unscaledw - video.deltaw, 0,
|
||||
video.deltaw, SCREENHEIGHT, v_darkest_color);
|
||||
}
|
||||
|
||||
V_DrawPatchInt(x, 0, patch, false, NULL);
|
||||
@ -612,23 +614,13 @@ void V_DrawPatchFullScreen(patch_t *patch)
|
||||
|
||||
void V_ScaleRect(vrect_t *rect)
|
||||
{
|
||||
rect->sx = x1lookup[rect->cx1];
|
||||
rect->sy = y1lookup[rect->cy1];
|
||||
rect->sw = x2lookup[rect->cx2] - rect->sx + 1;
|
||||
rect->sh = y2lookup[rect->cy2] - rect->sy + 1;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
// sanity check - out-of-bounds values should not come out of the scaling
|
||||
// arrays so long as they are accessed within bounds.
|
||||
if(rect->sx < 0 || rect->sx + rect->sw > video.width ||
|
||||
rect->sy < 0 || rect->sy + rect->sh > video.height)
|
||||
{
|
||||
I_Error("V_ScaleRect: internal error - invalid scaling lookups");
|
||||
}
|
||||
#endif
|
||||
rect->sx = x1lookup[rect->x];
|
||||
rect->sy = y1lookup[rect->y];
|
||||
rect->sw = x2lookup[rect->x + rect->w - 1] - rect->sx + 1;
|
||||
rect->sh = y2lookup[rect->y + rect->h - 1] - rect->sy + 1;
|
||||
}
|
||||
|
||||
void V_ClipRect(vrect_t *rect)
|
||||
static void V_ClipRect(vrect_t *rect)
|
||||
{
|
||||
// clip to left and top edges
|
||||
rect->cx1 = rect->x >= 0 ? rect->x : 0;
|
||||
@ -649,6 +641,45 @@ void V_ClipRect(vrect_t *rect)
|
||||
rect->ch = rect->cy2 - rect->cy1 + 1;
|
||||
}
|
||||
|
||||
static void V_ScaleClippedRect(vrect_t *rect)
|
||||
{
|
||||
rect->sx = x1lookup[rect->cx1];
|
||||
rect->sy = y1lookup[rect->cy1];
|
||||
rect->sw = x2lookup[rect->cx2] - rect->sx + 1;
|
||||
rect->sh = y2lookup[rect->cy2] - rect->sy + 1;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
// sanity check - out-of-bounds values should not come out of the scaling
|
||||
// arrays so long as they are accessed within bounds.
|
||||
if(rect->sx < 0 || rect->sx + rect->sw > video.width ||
|
||||
rect->sy < 0 || rect->sy + rect->sh > video.height)
|
||||
{
|
||||
I_Error("V_ScaleRect: internal error - invalid scaling lookups");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void V_FillRect(int x, int y, int width, int height, byte color)
|
||||
{
|
||||
vrect_t dstrect;
|
||||
|
||||
dstrect.x = x;
|
||||
dstrect.y = y;
|
||||
dstrect.w = width;
|
||||
dstrect.h = height;
|
||||
|
||||
V_ClipRect(&dstrect);
|
||||
V_ScaleClippedRect(&dstrect);
|
||||
|
||||
byte* dest = V_ADDRESS(dest_screen, dstrect.sx, dstrect.sy);
|
||||
|
||||
while (dstrect.sh--)
|
||||
{
|
||||
memset(dest, color, dstrect.sw);
|
||||
dest += linesize;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// V_CopyRect
|
||||
//
|
||||
@ -700,8 +731,8 @@ void V_CopyRect(int srcx, int srcy, pixel_t *source,
|
||||
if (dstrect.cw <= 0 || dstrect.ch <= 0)
|
||||
return;
|
||||
|
||||
V_ScaleRect(&srcrect);
|
||||
V_ScaleRect(&dstrect);
|
||||
V_ScaleClippedRect(&srcrect);
|
||||
V_ScaleClippedRect(&dstrect);
|
||||
|
||||
// use the smaller of the two scaled rect widths / heights
|
||||
usew = (srcrect.sw < dstrect.sw ? srcrect.sw : dstrect.sw);
|
||||
@ -749,7 +780,7 @@ void V_DrawBlock(int x, int y, int width, int height, pixel_t *src)
|
||||
dx = dstrect.cx1 - x;
|
||||
dy = dstrect.cy1 - y;
|
||||
|
||||
V_ScaleRect(&dstrect);
|
||||
V_ScaleClippedRect(&dstrect);
|
||||
|
||||
source = src + dy * width + dx;
|
||||
dest = V_ADDRESS(dest_screen, dstrect.sx, dstrect.sy);
|
||||
@ -794,7 +825,6 @@ void V_TileBlock64(int line, int width, int height, const byte *src)
|
||||
dstrect.w = width;
|
||||
dstrect.h = height;
|
||||
|
||||
V_ClipRect(&dstrect);
|
||||
V_ScaleRect(&dstrect);
|
||||
|
||||
h = dstrect.sh;
|
||||
@ -837,20 +867,18 @@ void V_GetBlock(int x, int y, int width, int height, byte *dest)
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (x<0
|
||||
||x+width >SCREENWIDTH
|
||||
|| x+width >video.width
|
||||
|| y<0
|
||||
|| y+height>SCREENHEIGHT )
|
||||
|| y+height>video.height )
|
||||
I_Error ("Bad V_GetBlock");
|
||||
#endif
|
||||
|
||||
if (hires) // killough 11/98: hires support
|
||||
y<<=2, x<<=1, width<<=1, height<<=1;
|
||||
src = V_ADDRESS(dest_screen, x, y);
|
||||
|
||||
src = dest_screen + y*SCREENWIDTH+x;
|
||||
while (height--)
|
||||
{
|
||||
memcpy (dest, src, width);
|
||||
src += SCREENWIDTH << hires;
|
||||
src += linesize;
|
||||
dest += width;
|
||||
}
|
||||
}
|
||||
@ -863,32 +891,22 @@ void V_PutBlock(int x, int y, int width, int height, byte *src)
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (x<0
|
||||
||x+width >SCREENWIDTH
|
||||
||x+width >video.width
|
||||
|| y<0
|
||||
|| y+height>SCREENHEIGHT )
|
||||
|| y+height>video.height )
|
||||
I_Error ("Bad V_PutBlock");
|
||||
#endif
|
||||
|
||||
if (hires)
|
||||
y<<=2, x<<=1, width<<=1, height<<=1;
|
||||
|
||||
dest = dest_screen + y*SCREENWIDTH+x;
|
||||
dest = V_ADDRESS(dest_screen, x, y);
|
||||
|
||||
while (height--)
|
||||
{
|
||||
memcpy (dest, src, width);
|
||||
dest += SCREENWIDTH << hires;
|
||||
dest += linesize;
|
||||
src += width;
|
||||
}
|
||||
}
|
||||
|
||||
void V_DrawHorizLine(int x, int y, int width, byte color)
|
||||
{
|
||||
byte line[WIDE_SCREENWIDTH];
|
||||
memset(line, color, width);
|
||||
V_DrawBlock(x, y, width, 1, line);
|
||||
}
|
||||
|
||||
void V_ShadeScreen(void)
|
||||
{
|
||||
int y;
|
||||
@ -945,9 +963,9 @@ void V_Init(void)
|
||||
|
||||
x1lookup[0] = 0;
|
||||
lastfrac = frac = 0;
|
||||
for(i = 0; i < video.width; i++)
|
||||
for (i = 0; i < video.width; i++)
|
||||
{
|
||||
if(frac >> FRACBITS > lastfrac >> FRACBITS)
|
||||
if (frac >> FRACBITS > lastfrac >> FRACBITS)
|
||||
{
|
||||
x1lookup[frac >> FRACBITS] = i;
|
||||
x2lookup[lastfrac >> FRACBITS] = i - 1;
|
||||
@ -961,9 +979,9 @@ void V_Init(void)
|
||||
|
||||
y1lookup[0] = 0;
|
||||
lastfrac = frac = 0;
|
||||
for(i = 0; i < video.height; i++)
|
||||
for (i = 0; i < video.height; i++)
|
||||
{
|
||||
if(frac >> FRACBITS > lastfrac >> FRACBITS)
|
||||
if (frac >> FRACBITS > lastfrac >> FRACBITS)
|
||||
{
|
||||
y1lookup[frac >> FRACBITS] = i;
|
||||
y2lookup[lastfrac >> FRACBITS] = i - 1;
|
||||
@ -972,8 +990,8 @@ void V_Init(void)
|
||||
|
||||
frac += video.ystep;
|
||||
}
|
||||
y2lookup[video.unscaledh - 1] = video.height - 1;
|
||||
y1lookup[video.unscaledh] = y2lookup[video.unscaledh] = video.height;
|
||||
y2lookup[SCREENHEIGHT - 1] = video.height - 1;
|
||||
y1lookup[SCREENHEIGHT] = y2lookup[SCREENHEIGHT] = video.height;
|
||||
}
|
||||
|
||||
// Set the buffer that the code draws to.
|
||||
|
@ -110,8 +110,6 @@ typedef struct
|
||||
int sh; // scaled height
|
||||
} vrect_t;
|
||||
|
||||
void V_ClipRect(vrect_t *rect);
|
||||
|
||||
void V_ScaleRect(vrect_t *rect);
|
||||
|
||||
// Allocates buffer screens, call before R_Init.
|
||||
@ -151,7 +149,7 @@ void V_GetBlock(int x, int y, int width, int height, pixel_t *dest);
|
||||
|
||||
void V_PutBlock(int x, int y, int width, int height, pixel_t *src);
|
||||
|
||||
void V_DrawHorizLine(int x, int y, int width, byte color);
|
||||
void V_FillRect(int x, int y, int width, int height, byte color);
|
||||
|
||||
void V_ShadeScreen(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user