⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hw_main.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 5 页
字号:
// Emacs style mode select   -*- C++ -*-//-----------------------------------------------------------------------------//// $Id: hw_main.c,v 1.73 2001/05/07 20:27:16 stroggonmeth Exp $//// Copyright (C) 1998-2000 by DooM Legacy Team.//// 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.////// $Log: hw_main.c,v $// Revision 1.73  2001/05/07 20:27:16  stroggonmeth// no message//// Revision 1.72  2001/05/03 21:52:23  hurdler// fix bis//// Revision 1.71  2001/05/03 20:05:56  hurdler// small opengl fix//// Revision 1.70  2001/05/01 20:38:34  hurdler// some fix/hack for the beta release//// Revision 1.69  2001/04/30 21:00:10  stroggonmeth// Another HWR fix//// Revision 1.68  2001/04/30 17:19:25  stroggonmeth// HW fix and misc. changes//// Revision 1.67  2001/04/27 13:32:14  bpereira// no message//// Revision 1.66  2001/04/18 23:22:00  hurdler// Until SoM fix it more properly than me ;)//// Revision 1.65  2001/04/18 22:53:55  hurdler// Until SoM fix it more properly than me ;)//// Revision 1.64  2001/04/16 21:40:06  hurdler// Fix misaligned midtexture problem (to verify!)//// Revision 1.63  2001/04/16 15:16:45  hurdler// minor changes//// Revision 1.62  2001/04/09 23:26:05  hurdler// clean up//// Revision 1.61  2001/04/09 20:24:28  metzgermeister// turned it on again :)//// Revision 1.60  2001/04/09 14:18:21  hurdler// no message//// Revision 1.59  2001/04/08 10:15:54  bpereira// no message//// Revision 1.58  2001/04/03 23:15:39  hurdler// FIXME: this code adds basic 3D-floors support in hw mode//// Revision 1.57  2001/03/25 18:11:24  metzgermeister//   * SDL sound bug with swapped stereo channels fixed//   * separate hw_trick.c now for HW_correctSWTrick(.)//// Revision 1.56  2001/03/20 21:26:21  hurdler// use PI instead of M_PI as it  is defined in hw_defs.h (M_PI undefined under win32 by default)//// Revision 1.55  2001/03/19 21:18:48  metzgermeister//   * missing textures in HW mode are replaced by default texture//   * fixed crash bug with P_SpawnMissile(.) returning NULL//   * deep water trick and other nasty thing work now in HW mode (tested with tnt/map02 eternal/map02)//   * added cvar gr_correcttricks//// Revision 1.54  2001/03/19 18:15:59  hurdler// fix a fog problem//// Revision 1.53  2001/03/13 22:14:21  stroggonmeth// Long time no commit. 3D floors, FraggleScript, portals, ect.//// Revision 1.52  2001/02/24 13:35:22  bpereira// no message//// Revision 1.51  2001/02/10 12:27:14  bpereira// no message//// Revision 1.50  2001/01/31 17:15:09  hurdler// Add cv_scalestatusbar in hardware mode//// Revision 1.49  2001/01/25 18:56:27  bpereira// no message//// Revision 1.48  2000/11/18 15:51:25  bpereira// no message//// Revision 1.47  2000/11/12 21:04:28  hurdler// Fix a bug with validcount and boom code (dyn.light looked ugly with boom water)//// Revision 1.46  2000/11/11 13:59:47  bpereira// no message//// Revision 1.45  2000/11/02 22:14:02  bpereira// no message//// Revision 1.44  2000/11/02 21:54:26  bpereira// no message//// Revision 1.43  2000/11/02 19:49:39  bpereira// no message//// Revision 1.42  2000/10/22 14:16:41  hurdler// Prepare code for TANDL//// Revision 1.41  2000/10/21 08:43:32  bpereira// no message//// Revision 1.40  2000/10/04 16:21:57  hurdler// small clean-up//// Revision 1.39  2000/10/02 18:25:46  bpereira// no message//// Revision 1.38  2000/10/01 15:18:38  hurdler// no message//// Revision 1.37  2000/10/01 10:18:23  bpereira// no message//// Revision 1.36  2000/10/01 09:10:19  hurdler// Put the md2 code in #ifdef TANDL//// Revision 1.35  2000/10/01 01:22:35  hurdler// remove polysky, enable PF_Environment for sprites//// Revision 1.34  2000/09/28 20:57:20  bpereira// no message//// Revision 1.33  2000/09/21 16:45:11  bpereira// no message//// Revision 1.32  2000/08/31 14:30:57  bpereira// no message//// Revision 1.31  2000/08/21 21:13:58  metzgermeister// crash on polys>256verts fixed//// Revision 1.30  2000/08/11 19:11:57  metzgermeister// *** empty log message ***//// Revision 1.29  2000/08/03 17:57:42  bpereira// no message//// Revision 1.28  2000/07/01 09:23:50  bpereira// no message//// Revision 1.27  2000/06/08 19:40:34  hurdler// my changes before splitting (can be reverted in development branch)//// Revision 1.26  2000/05/30 18:03:22  kegetys// Wall, floor and ceiling lighting is now done by changing only the RGB, not the alpha//// Revision 1.25  2000/05/10 17:45:35  kegetys// no message//// Revision 1.24  2000/05/05 18:00:05  bpereira// no message//// Revision 1.23  2000/04/30 10:30:10  bpereira// no message//// Revision 1.22  2000/04/27 23:41:16  hurdler// better splitscreen support in OpenGL mode//// Revision 1.21  2000/04/27 17:48:47  hurdler// colormap code in hardware mode is now the default//// Revision 1.20  2000/04/24 20:24:38  bpereira// no message//// Revision 1.19  2000/04/24 15:46:34  hurdler// Support colormap for text//// Revision 1.18  2000/04/23 16:19:52  bpereira// no message//// Revision 1.17  2000/04/23 12:50:32  hurdler// support filter mode in OpenGL//// Revision 1.16  2000/04/22 21:08:23  hurdler// I like it better like that//// Revision 1.15  2000/04/22 16:09:14  hurdler// support skin color in hardware mode//// Revision 1.14  2000/04/18 16:07:16  hurdler// better support of decals//// Revision 1.13  2000/04/18 12:52:21  hurdler// join with Boris' code//// Revision 1.11  2000/04/14 16:34:26  hurdler// some nice changes for coronas//// Revision 1.10  2000/04/12 16:03:51  hurdler// ready for T&L code and true static lighting//// Revision 1.9  2000/04/09 01:59:06  hurdler// removed warnings//// Revision 1.8  2000/04/08 11:28:46  hurdler// added boom water support//// Revision 1.7  2000/03/29 19:39:49  bpereira// no message//// Revision 1.6  2000/03/08 17:02:05  hurdler// fix the joiningame problem under Linux//// Revision 1.5  2000/03/07 14:22:48  hurdler// no message//// Revision 1.4  2000/03/06 16:52:06  hurdler// hack for OpenGL / Open Entry problem//// Revision 1.3  2000/03/05 17:10:56  bpereira// no message//// Revision 1.2  2000/02/27 00:42:11  hurdler// fix CR+LF problem//// Revision 1.1.1.1  2000/02/22 20:32:33  hurdler// Initial import into CVS (v1.29 pr3)////// DESCRIPTION://      hardware renderer, using the standard HardWareRender driver DLL for Doom Legacy////-----------------------------------------------------------------------------#include <math.h>#include "hw_glob.h"#include "hw_light.h"#include "../doomstat.h"#include "../i_video.h"  // added by Hurdler for rendermode == render_glide#include "../v_video.h"#include "../p_local.h"#include "../p_setup.h"#include "../r_local.h"#include "../d_clisrv.h"#include "../w_wad.h"#include "../z_zone.h"#include "../r_splats.h"#define ZCLIP_PLANE     4.0f#define R_FAKEFLOORS// ==========================================================================// the hardware driver object// ==========================================================================struct hwdriver_s hwdriver;// ==========================================================================//                                                                     PROTOS// ==========================================================================static  void    HWR_AddSprites (sector_t* sec );static  void    HWR_ProjectSprite (mobj_t* thing );static unsigned int atohex(char* s);// ==========================================================================//                                          3D ENGINE COMMANDS & CONSOLE VARS// ==========================================================================CV_PossibleValue_t grcrappymlook_cons_t[]= {{0,"Off"}, {1,"On"},{2,"Full"}, {0,NULL} };CV_PossibleValue_t grgamma_cons_t[]= {{1,"MIN"}, {255,"MAX"}, {0,NULL} };CV_PossibleValue_t grfiltermode_cons_t[]= {{HWD_SET_TEXTUREFILTER_POINTSAMPLED,"Nearest"},                                           {HWD_SET_TEXTUREFILTER_BILINEAR,"Bilinear"},                                           {HWD_SET_TEXTUREFILTER_TRILINEAR,"Trilinear"},                                           {HWD_SET_TEXTUREFILTER_MIXED1,"Linear_Nearest"},                                           {HWD_SET_TEXTUREFILTER_MIXED2,"Nearest_Linear"},                                           {0,NULL} };// BP: change directely the palette to see the changevoid CV_Gammaxxx_ONChange(void){    V_SetPalette( 0 );}void CV_filtermode_ONChange(void);void CV_FogDensity_ONChange(void);//static void CV_grFogColor_OnChange (void);static void CV_grFov_OnChange (void);//static void CV_grMonsterDL_OnChange (void);static void CV_grPolygonSmooth_OnChange (void);consvar_t cv_grrounddown       = {"gr_rounddown",       "Off", 0,       CV_OnOff };consvar_t cv_grcrappymlook     = {"gr_mlook",          "Full", CV_SAVE, grcrappymlook_cons_t };consvar_t cv_grfov             = {"gr_fov",              "90", CV_SAVE|CV_CALL, CV_Unsigned, CV_grFov_OnChange };consvar_t cv_grsky             = {"gr_sky",              "On", 0,       CV_OnOff };consvar_t cv_grfog             = {"gr_fog",              "On", CV_SAVE, CV_OnOff };consvar_t cv_grfogcolor        = {"gr_fogcolor",     "000000", CV_SAVE, NULL };consvar_t cv_grfogdensity      = {"gr_fogdensity",      "100", CV_SAVE|CV_CALL|CV_NOINIT, CV_Unsigned, CV_FogDensity_ONChange };consvar_t cv_grgammared        = {"gr_gammared",        "127", CV_SAVE|CV_CALL, grgamma_cons_t, CV_Gammaxxx_ONChange };consvar_t cv_grgammagreen      = {"gr_gammagreen",      "127", CV_SAVE|CV_CALL, grgamma_cons_t, CV_Gammaxxx_ONChange };consvar_t cv_grgammablue       = {"gr_gammablue",       "127", CV_SAVE|CV_CALL, grgamma_cons_t, CV_Gammaxxx_ONChange };consvar_t cv_grfiltermode      = {"gr_filtermode", "Bilinear", CV_SAVE|CV_CALL, grfiltermode_cons_t, CV_filtermode_ONChange };consvar_t cv_grzbuffer         = {"gr_zbuffer",          "On", 0,       CV_OnOff };consvar_t cv_grcorrecttricks   = {"gr_correcttricks",    "On", 0,       CV_OnOff };consvar_t cv_grsolvetjoin      = {"gr_solvetjoin",       "On", 0,       CV_OnOff };// console variables in developmentconsvar_t cv_grpolygonsmooth   = {"gr_polygonsmooth",   "Off", CV_CALL, CV_OnOff, CV_grPolygonSmooth_OnChange };#ifdef TANDLconsvar_t cv_grmd2             = {"gr_md2",             "Off", CV_SAVE, CV_OnOff };#endif// faB : needs fix : walls are incorrectly clipped one column lessconsvar_t cv_grclipwalls       = {"gr_clipwalls",       "Off", 0,       CV_OnOff };//development variables for diverse usesconsvar_t cv_gralpha = {"gr_alpha","160", 0, CV_Unsigned };consvar_t cv_grbeta  = {"gr_beta", "0",   0, CV_Unsigned };consvar_t cv_grgamma = {"gr_gamma","0",   0, CV_Unsigned };void CV_FogDensity_ONChange(void){    HWD.pfnSetSpecialState( HWD_SET_FOG_DENSITY, cv_grfogdensity.value );}void CV_filtermode_ONChange(void){    HWD.pfnSetSpecialState( HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);}// ==========================================================================//                                                               VIEW GLOBALS// ==========================================================================// Fineangles in the SCREENWIDTH wide window.#define FIELDOFVIEW      ANG90angle_t                 gr_clipangle;// The viewangletox[viewangle + FINEANGLES/4] lookup// maps the visible view angles to screen X coordinates,// flattening the arc to a flat projection plane.// There will be many angles mapped to the same X.int                     gr_viewangletox[FINEANGLES/2];// The xtoviewangleangle[] table maps a screen pixel// to the lowest viewangle that maps back to x ranges// from clipangle to -clipangle.angle_t                 gr_xtoviewangle[MAXVIDWIDTH+1];// ==========================================================================//                                                                    GLOBALS// ==========================================================================// uncomment to remove the plane rendering#define DOPLANES//#define DOWALLS// BP: test of draw sky by polygone like in sofware with visplane, unfortunately// this don't work since we must have z for pixel and z for texture (not like now with z=oow)//#define POLYSKY// BP: test change fov when looking up/down but bsp projection messup :(//#define NOCRAPPYMLOOK#define drawtextured  true//static  boolean     drawtextured = false;// base values set at SetViewSizefloat       gr_basecentery;float       gr_baseviewwindowy;float       gr_basewindowcentery;float       gr_viewwidth;           // viewport clipping boundaries (screen coords)float       gr_viewheight;float       gr_centerx;float       gr_centery;float       gr_viewwindowx;         // top left corner of view windowfloat       gr_viewwindowy;float       gr_windowcenterx;       // center of view window, for projectionfloat       gr_windowcentery;float       gr_pspritexscale;float       gr_pspriteyscale;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -