home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ST-Computer Leser-CD 2000 January
/
LCD_01_2000.iso
/
games
/
doom
/
pmdoom
/
src
/
v_vieo24.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-12-17
|
5KB
|
186 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_DrawPatch24
( int x,
int y,
int scrn,
patch_t* patch )
{
unsigned long couleur;
int count;
int col;
column_t* column;
byte *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 = screens[scrn] + (y*SCREENWIDTH+x)*3;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop+=3)
{
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*3;
count = column->length;
while (count--)
{
couleur = truecolor_palette[*source++];
*dest++ = couleur;
*dest++ = couleur >> 8;
*dest++ = couleur >> 16;
dest += (SCREENWIDTH*3)-3;
}
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_DrawPatchFlipped24
( int x,
int y,
int scrn,
patch_t* patch )
{
int count;
int col;
column_t* column;
byte *desttop,*dest;
byte *source;
int w;
unsigned long couleur;
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 = screens[scrn] + (y*SCREENWIDTH+x)*3;
w = SHORT(patch->width);
for ( ; col<w ; x++, col++, desttop+=3)
{
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*3;
count = column->length;
while (count--)
{
couleur = truecolor_palette[*source++];
*dest++ = couleur;
*dest++ = couleur >> 8;
*dest++ = couleur >> 16;
dest += (SCREENWIDTH*3)-3;
}
column = (column_t *)( (byte *)column + column->length
+ 4 );
}
}
}