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

📄 r_plane.c

📁 The source code of Doom legacy for windows
💻 C
字号:
// Emacs style mode select   -*- C++ -*-//-----------------------------------------------------------------------------//// $Id: r_plane.c,v 1.15 2001/03/21 18:24:39 stroggonmeth Exp $//// Copyright (C) 1993-1996 by id Software, Inc.// Portions 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: r_plane.c,v $// Revision 1.15  2001/03/21 18:24:39  stroggonmeth// Misc changes and fixes. Code cleanup//// Revision 1.14  2001/03/13 22:14:20  stroggonmeth// Long time no commit. 3D floors, FraggleScript, portals, ect.//// Revision 1.13  2001/01/25 22:15:44  bpereira// added heretic support//// Revision 1.12  2000/11/11 13:59:46  bpereira// no message//// Revision 1.11  2000/11/06 20:52:16  bpereira// no message//// Revision 1.10  2000/11/02 17:50:09  stroggonmeth// Big 3Dfloors & FraggleScript commit!!//// Revision 1.9  2000/04/30 10:30:10  bpereira// no message//// Revision 1.8  2000/04/18 17:39:39  stroggonmeth// Bug fixes and performance tuning.//// Revision 1.7  2000/04/13 23:47:47  stroggonmeth// See logs//// Revision 1.6  2000/04/08 17:29:25  stroggonmeth// no message//// Revision 1.5  2000/04/06 21:06:19  stroggonmeth// Optimized extra_colormap code...// Added #ifdefs for older water code.//// Revision 1.4  2000/04/04 19:28:43  stroggonmeth// Global colormaps working. Added a new linedef type 272.//// Revision 1.3  2000/04/04 00:32:48  stroggonmeth// Initial Boom compatability plus few misc changes all around.//// Revision 1.2  2000/02/27 00:42:10  hurdler// fix CR+LF problem//// Revision 1.1.1.1  2000/02/22 20:32:32  hurdler// Initial import into CVS (v1.29 pr3)////// DESCRIPTION://      Here is a core component: drawing the floors and ceilings,//       while maintaining a per column clipping list only.//      Moreover, the sky areas have to be determined.////-----------------------------------------------------------------------------#include "doomdef.h"#include "console.h"#include "g_game.h"#include "r_data.h"#include "r_local.h"#include "r_state.h"#include "r_splats.h"   //faB(21jan):testing#include "r_sky.h"#include "v_video.h"#include "w_wad.h"#include "z_zone.h"#include "p_setup.h"    // levelflatsplanefunction_t         floorfunc;planefunction_t         ceilingfunc;//// opening//// Here comes the obnoxious "visplane"./*#define                 MAXVISPLANES 128 //SoM: 3/20/2000visplane_t*             visplanes;visplane_t*             lastvisplane;*///SoM: 3/23/2000: Use Boom visplane hashing.#define           MAXVISPLANES      128static visplane_t *visplanes[MAXVISPLANES];static visplane_t *freetail;static visplane_t **freehead = &freetail;visplane_t*             floorplane;visplane_t*             ceilingplane;visplane_t*             currentplane;planemgr_t              ffloor[MAXFFLOORS];int                     numffloors;//SoM: 3/23/2000: Boom visplane hashing routine.#define visplane_hash(picnum,lightlevel,height) \  ((unsigned)((picnum)*3+(lightlevel)+(height)*7) & (MAXVISPLANES-1))// ?/*#define MAXOPENINGS     MAXVIDWIDTH*128short                   openings[MAXOPENINGS];short*                  lastopening;*///SoM: 3/23/2000: Use boom opening limit removalsize_t maxopenings;short *openings,*lastopening;//// Clip values are the solid pixel bounding the range.//  floorclip starts out SCREENHEIGHT//  ceilingclip starts out -1//short                   floorclip[MAXVIDWIDTH];short                   ceilingclip[MAXVIDWIDTH];fixed_t                 frontscale[MAXVIDWIDTH];#ifdef OLDWATER  short                   waterclip[MAXVIDWIDTH];   //added:18-02-98:WATER!  boolean                 itswater;       //added:24-02-98:WATER!#endif//// spanstart holds the start of a plane span// initialized to 0 at start//int                     spanstart[MAXVIDHEIGHT];//int                     spanstop[MAXVIDHEIGHT]; //added:08-02-98: Unused!!//// texture mapping//lighttable_t**          planezlight;fixed_t                 planeheight;//added:10-02-98: yslopetab is what yslope used to be,//                yslope points somewhere into yslopetab,//                now (viewheight/2) slopes are calculated above and//                below the original viewheight for mouselook//                (this is to calculate yslopes only when really needed)//                (when mouselookin', yslope is moving into yslopetab)//                Check R_SetupFrame, R_SetViewSize for more...fixed_t                 yslopetab[MAXVIDHEIGHT*4];fixed_t*                yslope;fixed_t                 distscale[MAXVIDWIDTH];fixed_t                 basexscale;fixed_t                 baseyscale;fixed_t                 cachedheight[MAXVIDHEIGHT];fixed_t                 cacheddistance[MAXVIDHEIGHT];fixed_t                 cachedxstep[MAXVIDHEIGHT];fixed_t                 cachedystep[MAXVIDHEIGHT];fixed_t   xoffs, yoffs;//// R_InitPlanes// Only at game startup.//void R_InitPlanes (void){  // Doh!}//profile stuff ---------------------------------------------------------//#define TIMING#ifdef TIMING#include "p5prof.h"         long long mycount;         long long mytotal = 0;         unsigned long  nombre = 100000;#endif//profile stuff ---------------------------------------------------------//// R_MapPlane//// Uses global vars://  planeheight//  ds_source//  basexscale//  baseyscale//  viewx//  viewy//  xoffs//  yoffs//// BASIC PRIMITIVE//#ifdef OLDWATERstatic int bgofs;static int wtofs=0;#endifvoid R_MapPlane( int           y,              // t1  int           x1,  int           x2 ){    angle_t     angle;    fixed_t     distance;    fixed_t     length;    unsigned    index;#ifdef RANGECHECK    if (x2 < x1        || x1<0        || x2>=viewwidth        || (unsigned)y>viewheight)    {        I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y);    }#endif    if (planeheight != cachedheight[y])    {        cachedheight[y] = planeheight;        distance = cacheddistance[y] = FixedMul (planeheight, yslope[y]);        ds_xstep = cachedxstep[y] = FixedMul (distance,basexscale);        ds_ystep = cachedystep[y] = FixedMul (distance,baseyscale);    }    else    {        distance = cacheddistance[y];        ds_xstep = cachedxstep[y];        ds_ystep = cachedystep[y];    }    length = FixedMul (distance,distscale[x1]);    angle = (currentplane->viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;    // SoM: Wouldn't it be faster just to add viewx and viewy to the plane's    // x/yoffs anyway?? (Besides, it serves my purpose well for portals!)    ds_xfrac = /*viewx +*/ FixedMul(finecosine[angle], length) + xoffs;    ds_yfrac = /*-viewy*/yoffs - FixedMul(finesine[angle], length);#ifdef OLDWATER    if (itswater)    {        int         fuck;        //ripples da water texture        fuck = (wtofs + (distance>>10) ) & 8191;        bgofs = FixedDiv(finesine[fuck],distance>>9)>>16;        angle = (angle + 2048) & 8191;  //90

⌨️ 快捷键说明

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