From 7c1407ea7171f83287b720ec65450940c9cbf158 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 Sep 2008 21:26:30 +0000 Subject: Merge heretic/v_video.c to common code. Subversion-branch: /branches/raven-branch Subversion-revision: 1252 --- src/heretic/Makefile.am | 3 +- src/heretic/am_map.c | 1 + src/heretic/ct_chat.c | 1 + src/heretic/d_main.c | 1 + src/heretic/doomdata.h | 23 ---- src/heretic/doomdef.h | 14 --- src/heretic/f_finale.c | 1 + src/heretic/g_game.c | 1 + src/heretic/i_ibm.c | 1 + src/heretic/i_sound.c | 1 + src/heretic/in_lude.c | 1 + src/heretic/m_misc.c | 1 + src/heretic/mn_menu.c | 2 + src/heretic/p_ceilng.c | 1 + src/heretic/p_doors.c | 1 + src/heretic/p_enemy.c | 1 + src/heretic/p_floor.c | 1 + src/heretic/p_lights.c | 1 + src/heretic/p_plats.c | 1 + src/heretic/p_spec.c | 1 + src/heretic/p_switch.c | 1 + src/heretic/p_telept.c | 1 + src/heretic/p_tick.c | 1 + src/heretic/r_draw.c | 1 + src/heretic/r_local.h | 2 + src/heretic/sb_bar.c | 1 + src/heretic/v_video.c | 306 ------------------------------------------------ src/v_video.c | 125 +++++++++++++++++++- src/v_video.h | 6 + 29 files changed, 154 insertions(+), 348 deletions(-) delete mode 100644 src/heretic/v_video.c diff --git a/src/heretic/Makefile.am b/src/heretic/Makefile.am index 5f6bc865..fa9d2a6f 100644 --- a/src/heretic/Makefile.am +++ b/src/heretic/Makefile.am @@ -47,8 +47,7 @@ r_segs.c \ r_things.c \ sb_bar.c \ sounds.c sounds.h \ -s_sound.c s_sound.h \ -v_video.c +s_sound.c s_sound.h EXTRA_DIST= \ i_sound.c i_sound.h \ diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c index 90807644..44f9b1c9 100644 --- a/src/heretic/am_map.c +++ b/src/heretic/am_map.c @@ -31,6 +31,7 @@ #include "am_data.h" #include "doomkeys.h" +#include "v_video.h" vertex_t KeyPoints[NUMKEYS]; diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index 16635ba2..25ebbeae 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -30,6 +30,7 @@ #include "doomkeys.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" #define QUEUESIZE 128 #define MESSAGESIZE 128 diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index bc1b0899..dc647556 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -34,6 +34,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" GameMission_t gamemission = heretic; GameMode_t gamemode = indetermined; diff --git a/src/heretic/doomdata.h b/src/heretic/doomdata.h index ec93ac62..8b56c0ed 100644 --- a/src/heretic/doomdata.h +++ b/src/heretic/doomdata.h @@ -168,29 +168,6 @@ typedef struct =============================================================================== */ -// posts are runs of non masked source pixels -typedef struct -{ - byte topdelta; // -1 is the last post in a column - byte length; -// length data bytes follows -} post_t; - -// column_t is a list of 0 or more post_t, (byte)-1 terminated -typedef post_t column_t; - -// a patch holds one or more columns -// patches are used for sprites and all masked pictures -typedef struct -{ - short width; // bounding box size - short height; - short leftoffset; // pixels to the left of origin - short topoffset; // pixels below the origin - int columnofs[8]; // only [width] used - // the [0] is &columnofs[width] -} patch_t; - // a pic is an unmasked block of pixels typedef struct { diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index 654c1bd8..4505abcd 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -1005,20 +1005,6 @@ int MN_TextAWidth(char *text); void MN_DrTextB(char *text, int x, int y); int MN_TextBWidth(char *text); -//------ -// VIDEO -//------ - -extern int dirtybox[4]; -extern byte gammatable[5][256]; -extern int usegamma; - -void V_Init(void); // Allocates buffer screens, call before R_Init -void V_DrawPatch(int x, int y, patch_t * patch); -void V_DrawFuzzPatch(int x, int y, patch_t * patch); -void V_DrawShadowedPatch(int x, int y, patch_t * patch); -void V_DrawRawScreen(byte * raw); - #include "sounds.h" #endif // __DOOMDEF__ diff --git a/src/heretic/f_finale.c b/src/heretic/f_finale.c index 50b28efe..e6053a60 100644 --- a/src/heretic/f_finale.c +++ b/src/heretic/f_finale.c @@ -27,6 +27,7 @@ #include "doomdef.h" #include "i_swap.h" #include "s_sound.h" +#include "v_video.h" int finalestage; // 0 = text, 1 = art screen int finalecount; diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 602afbf0..87ac8f94 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -29,6 +29,7 @@ #include "doomkeys.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" // Macros diff --git a/src/heretic/i_ibm.c b/src/heretic/i_ibm.c index 5058bf7e..fba6b599 100644 --- a/src/heretic/i_ibm.c +++ b/src/heretic/i_ibm.c @@ -31,6 +31,7 @@ #include "doomdef.h" #include "r_local.h" #include "dmx.h" +#include "v_video.h" // Macros diff --git a/src/heretic/i_sound.c b/src/heretic/i_sound.c index 30b63a43..8f0d5f35 100644 --- a/src/heretic/i_sound.c +++ b/src/heretic/i_sound.c @@ -28,6 +28,7 @@ #include "dmx.h" #include "sounds.h" #include "i_sound.h" +#include "v_video.h" /* =============== diff --git a/src/heretic/in_lude.c b/src/heretic/in_lude.c index 8cd3c5da..7e574570 100644 --- a/src/heretic/in_lude.c +++ b/src/heretic/in_lude.c @@ -30,6 +30,7 @@ #include "doomdef.h" #include "s_sound.h" +#include "v_video.h" typedef enum { diff --git a/src/heretic/m_misc.c b/src/heretic/m_misc.c index 91642f02..951dce0c 100644 --- a/src/heretic/m_misc.c +++ b/src/heretic/m_misc.c @@ -365,6 +365,7 @@ void M_ForceUppercase(char *text) int usemouse; int usejoystick; +extern int usegamma; extern int key_right, key_left, key_up, key_down; extern int key_strafeleft, key_straferight; extern int key_fire, key_use, key_strafe, key_speed; diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 6423ebdf..5a7f2801 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -29,6 +29,7 @@ #include "p_local.h" #include "r_local.h" #include "s_sound.h" +#include "v_video.h" // Macros @@ -116,6 +117,7 @@ void MN_LoadSlotText(void); // External Data +extern int usegamma; extern int detailLevel; extern int screenblocks; diff --git a/src/heretic/p_ceilng.c b/src/heretic/p_ceilng.c index cc596500..ba856c63 100644 --- a/src/heretic/p_ceilng.c +++ b/src/heretic/p_ceilng.c @@ -24,6 +24,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" //================================================================== //================================================================== diff --git a/src/heretic/p_doors.c b/src/heretic/p_doors.c index 619f6ca6..45f6883d 100644 --- a/src/heretic/p_doors.c +++ b/src/heretic/p_doors.c @@ -26,6 +26,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" //================================================================== //================================================================== diff --git a/src/heretic/p_enemy.c b/src/heretic/p_enemy.c index c33f7834..f6782d05 100644 --- a/src/heretic/p_enemy.c +++ b/src/heretic/p_enemy.c @@ -27,6 +27,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" // Macros diff --git a/src/heretic/p_floor.c b/src/heretic/p_floor.c index f00447e4..cd043bde 100644 --- a/src/heretic/p_floor.c +++ b/src/heretic/p_floor.c @@ -23,6 +23,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" //================================================================== //================================================================== diff --git a/src/heretic/p_lights.c b/src/heretic/p_lights.c index 78ca77d3..fb5942d6 100644 --- a/src/heretic/p_lights.c +++ b/src/heretic/p_lights.c @@ -22,6 +22,7 @@ //----------------------------------------------------------------------------- #include "doomdef.h" #include "p_local.h" +#include "v_video.h" //================================================================== //================================================================== diff --git a/src/heretic/p_plats.c b/src/heretic/p_plats.c index 7c68233f..9d3b99e6 100644 --- a/src/heretic/p_plats.c +++ b/src/heretic/p_plats.c @@ -26,6 +26,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" plat_t *activeplats[MAXPLATS]; diff --git a/src/heretic/p_spec.c b/src/heretic/p_spec.c index 5be43eae..469937c1 100644 --- a/src/heretic/p_spec.c +++ b/src/heretic/p_spec.c @@ -26,6 +26,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" // Macros diff --git a/src/heretic/p_switch.c b/src/heretic/p_switch.c index 7c4f8c02..82951718 100644 --- a/src/heretic/p_switch.c +++ b/src/heretic/p_switch.c @@ -24,6 +24,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" //================================================================== // diff --git a/src/heretic/p_telept.c b/src/heretic/p_telept.c index 287814f3..f8030337 100644 --- a/src/heretic/p_telept.c +++ b/src/heretic/p_telept.c @@ -26,6 +26,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" //---------------------------------------------------------------------------- // diff --git a/src/heretic/p_tick.c b/src/heretic/p_tick.c index ea0a8e7a..8a2b2577 100644 --- a/src/heretic/p_tick.c +++ b/src/heretic/p_tick.c @@ -25,6 +25,7 @@ #include "doomdef.h" #include "p_local.h" +#include "v_video.h" int leveltime; int TimerGame; diff --git a/src/heretic/r_draw.c b/src/heretic/r_draw.c index aac9e88d..1266187b 100644 --- a/src/heretic/r_draw.c +++ b/src/heretic/r_draw.c @@ -24,6 +24,7 @@ #include "doomdef.h" #include "r_local.h" +#include "v_video.h" /* diff --git a/src/heretic/r_local.h b/src/heretic/r_local.h index fa0efacd..e7b7c531 100644 --- a/src/heretic/r_local.h +++ b/src/heretic/r_local.h @@ -25,6 +25,8 @@ #ifndef __R_LOCAL__ #define __R_LOCAL__ +#include "v_patch.h" + #define ANGLETOSKYSHIFT 22 // sky map is 256*128*4 maps #define BASEYCENTER 100 diff --git a/src/heretic/sb_bar.c b/src/heretic/sb_bar.c index 3b6434b3..57db3560 100644 --- a/src/heretic/sb_bar.c +++ b/src/heretic/sb_bar.c @@ -26,6 +26,7 @@ #include "doomdef.h" #include "p_local.h" #include "s_sound.h" +#include "v_video.h" // Macros diff --git a/src/heretic/v_video.c b/src/heretic/v_video.c deleted file mode 100644 index 28d2f476..00000000 --- a/src/heretic/v_video.c +++ /dev/null @@ -1,306 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 1993-2008 Raven Software -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -//----------------------------------------------------------------------------- - -// V_video.c - -#include "doomdef.h" - -#include "i_swap.h" - -#define SC_INDEX 0x3c4 - -byte *screen; -int dirtybox[4]; -int usegamma; - -byte gammatable[5][256] = { - {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255}, - - {2, 4, 5, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 23, 24, 25, 26, - 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, - 233, 234, 235, 236, 237, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255}, - - {4, 7, 9, 11, 13, 15, 17, 19, 21, 22, 24, 26, 27, 29, 30, 32, 33, 35, 36, - 38, 39, 40, 42, 43, 45, 46, 47, 48, 50, 51, 52, 54, 55, 56, 57, 59, 60, - 61, 62, 63, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, - 166, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, - 178, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 188, - 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 197, 198, 199, 200, - 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, - 212, 213, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 221, 222, - 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, - 234, 235, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 244, - 244, 245, 246, 247, 247, 248, 249, 250, 251, 251, 252, 253, 254, 254, - 255}, - - {8, 12, 16, 19, 22, 24, 27, 29, 31, 34, 36, 38, 40, 41, 43, 45, 47, 49, - 50, 52, 53, 55, 57, 58, 60, 61, 63, 64, 65, 67, 68, 70, 71, 72, 74, 75, - 76, 77, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, - 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, - 164, 165, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 173, 174, - 175, 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, 185, - 186, 186, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, - 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 205, 205, - 206, 207, 207, 208, 209, 210, 210, 211, 212, 212, 213, 214, 214, 215, - 216, 216, 217, 218, 219, 219, 220, 221, 221, 222, 223, 223, 224, 225, - 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, - 235, 235, 236, 237, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, - 244, 244, 245, 246, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, - 253, 253, 254, 254, 255}, - - {16, 23, 28, 32, 36, 39, 42, 45, 48, 50, 53, 55, 57, 60, 62, 64, 66, 68, - 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, 90, 92, 93, 94, 96, - 97, 98, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, - 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, - 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, - 176, 177, 177, 178, 179, 180, 180, 181, 182, 182, 183, 184, 184, 185, - 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, - 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 202, 202, 203, 203, - 204, 205, 205, 206, 207, 207, 208, 208, 209, 210, 210, 211, 211, 212, - 213, 213, 214, 214, 215, 216, 216, 217, 217, 218, 219, 219, 220, 220, - 221, 221, 222, 223, 223, 224, 224, 225, 225, 226, 227, 227, 228, 228, - 229, 229, 230, 230, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, - 236, 237, 237, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, - 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, - 251, 251, 252, 252, 253, 254, 254, 255, 255} -}; - -//--------------------------------------------------------------------------- -// -// PROC V_DrawPatch -// -// Draws a column based masked pic to the screen. -// -//--------------------------------------------------------------------------- - -void V_DrawPatch(int x, int y, patch_t * patch) -{ - int count; - int col; - column_t *column; - byte *desttop; - byte *dest; - byte *source; - int w; - - y -= SHORT(patch->topoffset); - x -= SHORT(patch->leftoffset); - if (x < 0 || x + SHORT(patch->width) > SCREENWIDTH || y < 0 - || y + SHORT(patch->height) > SCREENHEIGHT) - { - I_Error("Bad V_DrawPatch"); - } - col = 0; - desttop = screen + 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 = *source++; - dest += SCREENWIDTH; - } - column = (column_t *) ((byte *) column + column->length + 4); - } - } -} - -/* -================== -= -= V_DrawFuzzPatch -= -= Masks a column based translucent masked pic to the screen. -= -================== -*/ -extern byte *tinttable; - -void V_DrawFuzzPatch(int x, int y, patch_t * patch) -{ - int count, col; - column_t *column; - byte *desttop, *dest, *source; - int w; - - y -= SHORT(patch->topoffset); - x -= SHORT(patch->leftoffset); - - if (x < 0 || x + SHORT(patch->width) > SCREENWIDTH || y < 0 - || y + SHORT(patch->height) > SCREENHEIGHT) - I_Error("Bad V_DrawPatch"); - - col = 0; - desttop = screen + 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 = tinttable[((*dest) << 8) + *source++]; - dest += SCREENWIDTH; - } - column = (column_t *) ((byte *) column + column->length + 4); - } - } -} - -/* -================== -= -= V_DrawShadowedPatch -= -= Masks a column based masked pic to the screen. -= -================== -*/ - -void V_DrawShadowedPatch(int x, int y, patch_t * patch) -{ - int count, col; - column_t *column; - byte *desttop, *dest, *source; - byte *desttop2, *dest2; - int w; - - y -= SHORT(patch->topoffset); - x -= SHORT(patch->leftoffset); - - if (x < 0 || x + SHORT(patch->width) > SCREENWIDTH || y < 0 - || y + SHORT(patch->height) > SCREENHEIGHT) - I_Error("Bad V_DrawPatch"); - - col = 0; - desttop = screen + y * SCREENWIDTH + x; - desttop2 = screen + (y + 2) * SCREENWIDTH + x + 2; - - w = SHORT(patch->width); - for (; col < w; x++, col++, desttop++, desttop2++) - { - 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; - dest2 = desttop2 + column->topdelta * SCREENWIDTH; - count = column->length; - - while (count--) - { - *dest2 = tinttable[((*dest2) << 8)]; - dest2 += SCREENWIDTH; - *dest = *source++; - dest += SCREENWIDTH; - - } - column = (column_t *) ((byte *) column + column->length + 4); - } - } -} - -//--------------------------------------------------------------------------- -// -// PROC V_DrawRawScreen -// -//--------------------------------------------------------------------------- - -void V_DrawRawScreen(byte * raw) -{ - memcpy(screen, raw, SCREENWIDTH * SCREENHEIGHT); -} - -//--------------------------------------------------------------------------- -// -// PROC V_Init -// -//--------------------------------------------------------------------------- - -void V_Init(void) -{ - // I_AllocLow will put screen in low dos memory on PCs. - screen = I_AllocLow(SCREENWIDTH * SCREENHEIGHT); -} diff --git a/src/v_video.c b/src/v_video.c index e2fc7eea..db2779c2 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -26,9 +26,6 @@ // //----------------------------------------------------------------------------- - - - #include "i_system.h" #include "doomtype.h" @@ -42,6 +39,11 @@ #include "w_wad.h" #include "z_zone.h" +// Blending table used for fuzzpatch, etc. +// Only used in Heretic/Hexen + +byte *tinttable = NULL; + // The screen buffer that the v_video.c code draws to. static byte *dest_screen = NULL; @@ -312,6 +314,114 @@ void V_DrawPatchDirect(int x, int y, patch_t *patch) { V_DrawPatch(x, y, patch); } + +// +// V_DrawFuzzPatch +// +// Masks a column based translucent masked pic to the screen. +// + +void V_DrawFuzzPatch(int x, int y, patch_t * patch) +{ + int count, col; + column_t *column; + byte *desttop, *dest, *source; + int w; + + y -= SHORT(patch->topoffset); + x -= SHORT(patch->leftoffset); + + if (x < 0 + || x + SHORT(patch->width) > SCREENWIDTH + || y < 0 + || y + SHORT(patch->height) > SCREENHEIGHT) + { + I_Error("Bad V_DrawFuzzPatch"); + } + + col = 0; + desttop = dest_screen + 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 = tinttable[((*dest) << 8) + *source++]; + dest += SCREENWIDTH; + } + column = (column_t *) ((byte *) column + column->length + 4); + } + } +} + +// +// V_DrawShadowedPatch +// +// Masks a column based masked pic to the screen. +// + +void V_DrawShadowedPatch(int x, int y, patch_t *patch) +{ + int count, col; + column_t *column; + byte *desttop, *dest, *source; + byte *desttop2, *dest2; + int w; + + y -= SHORT(patch->topoffset); + x -= SHORT(patch->leftoffset); + + if (x < 0 + || x + SHORT(patch->width) > SCREENWIDTH + || y < 0 + || y + SHORT(patch->height) > SCREENHEIGHT) + { + I_Error("Bad V_DrawShadowedPatch"); + } + + col = 0; + desttop = dest_screen + y * SCREENWIDTH + x; + desttop2 = dest_screen + (y + 2) * SCREENWIDTH + x + 2; + + w = SHORT(patch->width); + for (; col < w; x++, col++, desttop++, desttop2++) + { + 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; + dest2 = desttop2 + column->topdelta * SCREENWIDTH; + count = column->length; + + while (count--) + { + *dest2 = tinttable[((*dest2) << 8)]; + dest2 += SCREENWIDTH; + *dest = *source++; + dest += SCREENWIDTH; + + } + column = (column_t *) ((byte *) column + column->length + 4); + } + } +} + + @@ -345,7 +455,16 @@ void V_DrawBlock(int x, int y, int width, int height, byte *src) dest += SCREENWIDTH; } } + +// +// Draw a "raw" screen (lump containing raw data to blit directly +// to the screen) +// +void V_DrawRawScreen(byte *raw) +{ + memcpy(dest_screen, raw, SCREENWIDTH * SCREENHEIGHT); +} // // V_Init diff --git a/src/v_video.h b/src/v_video.h index d304f8f8..033633fc 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -57,6 +57,8 @@ void V_CopyRect(int srcx, int srcy, byte *source, void V_DrawPatch(int x, int y, patch_t *patch); void V_DrawPatchFlipped(int x, int y, patch_t *patch); +void V_DrawFuzzPatch(int x, int y, patch_t *patch); +void V_DrawShadowedPatch(int x, int y, patch_t *patch); void V_DrawPatchDirect(int x, int y, patch_t *patch); @@ -66,6 +68,10 @@ void V_DrawBlock(int x, int y, int width, int height, byte *src); void V_MarkRect(int x, int y, int width, int height); +// Draw a raw screen lump + +void V_DrawRawScreen(byte *raw); + // Temporarily switch to using a different buffer to draw graphics, etc. void V_UseBuffer(byte *buffer); -- cgit v1.2.3