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

📄 hw_light.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 2 页
字号:
// Emacs style mode select   -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: hw_light.c,v 1.34 2001/04/28 15:18:46 hurdler 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_light.c,v $// Revision 1.34  2001/04/28 15:18:46  hurdler// newcoronas defined again//// Revision 1.33  2001/04/17 22:30:40  hurdler// fix some (strange!) problems//// Revision 1.32  2001/04/09 14:17:45  hurdler// no message//// Revision 1.31  2001/02/28 17:50:56  bpereira// no message//// Revision 1.30  2001/02/24 13:35:22  bpereira// no message//// Revision 1.29  2001/01/25 18:56:27  bpereira// no message//// Revision 1.28  2000/11/18 15:51:25  bpereira// no message//// Revision 1.27  2000/11/02 19:49:39  bpereira// no message//// Revision 1.26  2000/10/04 16:21:57  hurdler// small clean-up//// Revision 1.25  2000/09/28 20:57:20  bpereira// no message//// Revision 1.24  2000/09/21 16:45:11  bpereira// no message//// Revision 1.23  2000/08/31 14:30:57  bpereira// no message//// Revision 1.22  2000/08/11 19:11:57  metzgermeister// *** empty log message ***//// Revision 1.21  2000/08/11 12:27:43  hurdler// latest changes for v1.30//// Revision 1.20  2000/08/10 19:58:04  bpereira// no message//// Revision 1.19  2000/08/10 14:16:25  hurdler// no message//// Revision 1.18  2000/08/03 17:57:42  bpereira// no message//// Revision 1.17  2000/07/01 09:23:50  bpereira// no message//// Revision 1.16  2000/05/09 21:09:18  hurdler// people prefer coronas on plasma riffles//// Revision 1.15  2000/04/24 20:24:38  bpereira// no message//// Revision 1.14  2000/04/24 15:46:34  hurdler// Support colormap for text//// Revision 1.13  2000/04/23 16:19:52  bpereira// no message//// Revision 1.12  2000/04/18 12:52:21  hurdler// join with Boris' code//// Revision 1.10  2000/04/14 16:34:26  hurdler// some nice changes for coronas//// Revision 1.9  2000/04/12 16:03:51  hurdler// ready for T&L code and true static lighting//// Revision 1.8  2000/04/11 01:00:59  hurdler// Better coronas support//// Revision 1.7  2000/04/09 17:18:01  hurdler// modified coronas' code for 16 bits video mode//// Revision 1.6  2000/04/06 20:50:23  hurdler// add Boris' changes for coronas in doom3.wad//// Revision 1.5  2000/03/29 19:39:49  bpereira// no message//// Revision 1.4  2000/03/07 03:31:45  hurdler// fix linux compilation//// 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://      Dynamic/Static lighting & coronas add on by Hurdler//      !!! Under construction !!!////-----------------------------------------------------------------------------#include "hw_light.h"#include "../i_video.h"#include "../z_zone.h"#include "../m_random.h"#include "../m_bbox.h"#include "../w_wad.h"#ifdef TANDL#include "../r_state.h"#include "../r_main.h"#include "../p_local.h"#endif//=============================================================================//                                                                      DEFINES//=============================================================================#define DL_SQRRADIUS(x)     dynlights->p_lspr[(x)]->dynamic_sqrradius#define DL_RADIUS(x)        dynlights->p_lspr[(x)]->dynamic_radius#define LIGHT_POS(i)        dynlights->position[(i)]#define DL_HIGH_QUALITY#define BACKFACECULL//#define LIGHTMAPFLAGS  (PF_Masked|PF_Clip|PF_NoAlphaTest)  // debug see overdraw#define LIGHTMAPFLAGS (PF_Modulated|PF_Additive|PF_Clip)//=============================================================================//                                                                       GLOBAL//=============================================================================void CV_grMonsterDL_OnChange (void);consvar_t cv_grdynamiclighting = {"gr_dynamiclighting",  "On", CV_SAVE, CV_OnOff };consvar_t cv_grstaticlighting  = {"gr_staticlighting",   "On", CV_SAVE, CV_OnOff };consvar_t cv_grcoronas         = {"gr_coronas",          "On", CV_SAVE, CV_OnOff };consvar_t cv_grcoronasize      = {"gr_coronasize",        "1", CV_SAVE| CV_FLOAT,0 };consvar_t cv_grmblighting      = {"gr_mblighting",       "On", CV_SAVE|CV_CALL                                  , CV_OnOff, CV_grMonsterDL_OnChange };static dynlights_t view_dynlights[2]; // 2 players in splitscreen modestatic dynlights_t *dynlights = &view_dynlights[0];typedef enum {    NOLIGHT = 0,    PLASMA_L,    PLASMAEXP_L,    ROCKET_L,    ROCKETEXP_L,    BFG_L,    BFGEXP_L,    BLUETALL_L,    GREENTALL_L,    REDTALL_L,    BLUESMALL_L,    GREENSMALL_L,    REDSMALL_L,    TECHLAMP_L,    TECHLAMP2_L,    COLUMN_L,    CANDLE_L,    CANDLEABRE_L,    REDBALL_L,    GREENBALL_L,    ROCKET2_L,    NUMLIGHTS} lightspritenum_t;#define UNDEFINED_SPR   0x0 // actually just for testing#define CORONA_SPR      0x1 // a light source which only emit a corona#define DYNLIGHT_SPR    0x2 // a light source which is only used for dynamic lighting#define LIGHT_SPR       (DYNLIGHT_SPR|CORONA_SPR)#define ROCKET_SPR      (DYNLIGHT_SPR|CORONA_SPR|0x10)//#define MONSTER_SPR     4//#define AMMO_SPR        8//#define BONUS_SPR      16static light_t lspr[NUMLIGHTS] = {    // type       offset x,   y  coronas color, c_size,light color,l_radius, sqr radius computed at init   // UNDEFINED: 0      { UNDEFINED_SPR,  0.0f,   0.0f,        0x0,  24.0f,        0x0,   0.0f },    // weapons    // PLASMA_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x60ff7750,  24.0f, 0x20f77760,  80.0f },    // PLASMAEXP_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x60ff7750,  24.0f, 0x40f77760, 120.0f },    // ROCKET_L    {   ROCKET_SPR,   0.0f,   0.0f, 0x606060f0,  20.0f, 0x4020f7f7, 120.0f },    // ROCKETEXP_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x606060f0,  20.0f, 0x6020f7f7, 200.0f },    // BFG_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x6077f777, 120.0f, 0x8060f060, 200.0f },    // BFGEXP_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x6077f777, 120.0f, 0x6060f060, 400.0f },    // tall lights    // BLUETALL_L    {    LIGHT_SPR,   0.0f,  20.0f, 0x80ff7070,  75.0f, 0x40ff5050, 100.0f },    // GREENTALL_L    {    LIGHT_SPR,   0.0f,  20.0f, 0x5060ff60,  75.0f, 0x4070ff70, 100.0f },    // REDTALL_L    {    LIGHT_SPR,   0.0f,  20.0f, 0x705070ff,  75.0f, 0x405070ff, 100.0f },    // small lights    // BLUESMALL_L    {    LIGHT_SPR,   0.0f,   4.0f, 0x80ff7070,  60.0f, 0x40ff5050, 100.0f },    // GREENSMALL_L    {    LIGHT_SPR,   0.0f,   4.0f, 0x6070ff70,  60.0f, 0x4070ff70, 100.0f },    // REDSMALL_L    {    LIGHT_SPR,   0.0f,   4.0f, 0x705070ff,  60.0f, 0x405070ff, 100.0f },    // other lights    // TECHLAMP_L    {    LIGHT_SPR,   0.0f,  44.0f, 0x80ffb0b0,  75.0f, 0x40ffb0b0, 100.0f },    // TECHLAMP2_L    {    LIGHT_SPR,   0.0f,  36.0f, 0x80ffb0b0,  60.0f, 0x40ffb0b0, 100.0f },    // COLUMN_L    {    LIGHT_SPR,   3.0f,  30.0f, 0x80b0f0f0,  60.0f, 0x40b0f0f0, 100.0f },    // CANDLE_L    {    LIGHT_SPR,   0.0f,  11.0f, 0x60b0f0f0,  20.0f, 0x30b0f0f0,  30.0f },    // CANDLEABRE_L    {    LIGHT_SPR,   0.0f,  30.0f, 0x60b0f0f0,  60.0f, 0x30b0f0f0, 100.0f },        // monsters    // REDBALL_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x606060f0,   0.0f, 0x302070ff, 100.0f },    // GREENBALL_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x6077f777, 120.0f, 0x3060f060, 100.0f },    // ROCKET2_L    { DYNLIGHT_SPR,   0.0f,   0.0f, 0x606060f0,  20.0f, 0x4020f7f7, 120.0f },};static light_t *t_lspr[NUMSPRITES] = {    &lspr[NOLIGHT],     // SPR_TROO    &lspr[NOLIGHT],     // SPR_SHTG    &lspr[NOLIGHT],     // SPR_PUNG    &lspr[NOLIGHT],     // SPR_PISG    &lspr[NOLIGHT],     // SPR_PISF    &lspr[NOLIGHT],     // SPR_SHTF    &lspr[NOLIGHT],     // SPR_SHT2    &lspr[NOLIGHT],     // SPR_CHGG    &lspr[NOLIGHT],     // SPR_CHGF    &lspr[NOLIGHT],     // SPR_MISG    &lspr[NOLIGHT],     // SPR_MISF    &lspr[NOLIGHT],     // SPR_SAWG    &lspr[NOLIGHT],     // SPR_PLSG    &lspr[NOLIGHT],     // SPR_PLSF    &lspr[NOLIGHT],     // SPR_BFGG    &lspr[NOLIGHT],     // SPR_BFGF    &lspr[NOLIGHT],     // SPR_BLUD    &lspr[NOLIGHT],     // SPR_PUFF    &lspr[REDBALL_L],   // SPR_BAL1 * // imp    &lspr[REDBALL_L],   // SPR_BAL2 * // cacodemon    &lspr[PLASMA_L],    // SPR_PLSS * // plasma    &lspr[PLASMAEXP_L], // SPR_PLSE * // plasma explosion    &lspr[ROCKET_L],    // SPR_MISL * // rocket    &lspr[BFG_L],       // SPR_BFS1 * // bfg    &lspr[BFGEXP_L],    // SPR_BFE1 * // bfg explosion    &lspr[NOLIGHT],     // SPR_BFE2    &lspr[GREENBALL_L], // SPR_TFOG * teleport fog    &lspr[PLASMA_L],    // SPR_IFOG * respaw fog    &lspr[NOLIGHT],     // SPR_PLAY    &lspr[NOLIGHT],     // SPR_POSS    &lspr[NOLIGHT],     // SPR_SPOS    &lspr[NOLIGHT],     // SPR_VILE    &lspr[NOLIGHT],     // SPR_FIRE    &lspr[REDBALL_L],   // SPR_FATB * // revenent tracer

⌨️ 快捷键说明

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