home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ST-Computer Leser-CD 2000 January
/
LCD_01_2000.iso
/
games
/
doom
/
pmdoom
/
src
/
v_vieo32.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-12-17
|
4KB
|
170 lines
/* 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: */
/* Gamma correction LUT stuff. */
/* Functions to draw patches (by post) directly to screen. */
/* Functions to blit a block to the screen. */
/* */
/* ----------------------------------------------------------------------------- */
static const char
rcsid[] = "$Id: v_video.c,v 1.5 1997/02/03 22:45:13 b1 Exp $";
#include "i_system.h"
#include "r_local.h"
#include "doomdef.h"
#include "doomdata.h"
#include "m_bbox.h"
#include "m_swap.h"
#include "v_video.h"
#include "i_video.h"
/* Each screen is [SCREENWIDTH*SCREENHEIGHT]; */
extern byte *screens[5];
/* */
/* V_DrawPatch */
/* Masks a column based masked pic to the screen. */
/* */
void
V_DrawPatch32
( int x,
int y,
int scrn,
patch_t* patch )
{
int count;
int col;
column_t* column;
unsigned long *desttop,*dest;
byte* source;
int w;
y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset);
#ifdef RANGECHECK
if (x<0
||x+SHORT(patch->width) >SCREENWIDTH
|| y<0
|| y+SHORT(patch->height)>SCREENHEIGHT
|| (unsigned)scrn>4)
{
fprintf( stderr, "Patch at %d,%d exceeds LFB\n", x,y );
/* No I_Error abort - what is up with TNT.WAD? */
fprintf( stderr, "V_DrawPatch: bad patch (ignored)\n");
return;
}
#endif
if (!scrn)
V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
col = 0;
desttop = (unsigned long *) (screens[scrn]) +y*SCREENWIDTH+x;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop++)
{
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
/* step through the posts in a column */
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH;
count = column->length;
while (count--)
{
*dest = truecolor_palette[*source++];
dest += SCREENWIDTH;
}
column = (column_t *)( (byte *)column + column->length + 4 );
}
}
}
/* */
/* V_DrawPatchFlipped */
/* Masks a column based masked pic to the screen. */
/* Flips horizontally, e.g. to mirror face. */
/* */
void V_DrawPatchFlipped32
( int x,
int y,
int scrn,
patch_t* patch )
{
int count;
int col;
column_t* column;
unsigned long *desttop,*dest;
byte* source;
int w;
y -= SHORT(patch->topoffset);
x -= SHORT(patch->leftoffset);
#ifdef RANGECHECK
if (x<0
||x+SHORT(patch->width) >SCREENWIDTH
|| y<0
|| y+SHORT(patch->height)>SCREENHEIGHT
|| (unsigned)scrn>4)
{
fprintf( stderr, "Patch origin %d,%d exceeds LFB\n", x,y );
I_Error ("Bad V_DrawPatch in V_DrawPatchFlipped");
}
#endif
if (!scrn)
V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
col = 0;
desttop = (unsigned long *) (screens[scrn]) +y*SCREENWIDTH+x;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop++)
{
column = (column_t *)((byte *)patch + LONG(patch->columnofs[w-1-col]));
/* step through the posts in a column */
while (column->topdelta != 0xff )
{
source = (byte *)column + 3;
dest = desttop + column->topdelta*SCREENWIDTH;
count = column->length;
while (count--)
{
*dest = truecolor_palette[*source++];
dest += SCREENWIDTH;
}
column = (column_t *)( (byte *)column + column->length + 4 );
}
}
}