mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-05-30 00:41:19 +00:00
* Updated to ZDoom r3257:
- Removed some unnecessary r_ header #includes. - Separated sprite and skin maintenance code from r_things.cpp into a separate file. - Moved r_interpolate.cpp and r_translate.cpp to r_data. - Merged r_jpeg.h into jpegtexture.cpp because that's the only place where it's ever used. - Rename src/resources to src/r_data. - Fixed: p_sectors.cpp wouldn't compile. - Moved side_t::GetLightLevel out of software rendering code. - Moved render style and border drawing code out of r_draw.cpp. - Moved all code not specific to the software renderer out of r_bsp.cpp. * Adapted GL files to changes. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1222 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
05888b9577
commit
5540b6fefc
110 changed files with 1795 additions and 1737 deletions
|
@ -744,14 +744,12 @@ add_executable( zdoom WIN32
|
|||
r_bsp.cpp
|
||||
r_draw.cpp
|
||||
r_drawt.cpp
|
||||
r_interpolate.cpp
|
||||
r_main.cpp
|
||||
r_plane.cpp
|
||||
r_polymost.cpp
|
||||
r_segs.cpp
|
||||
r_sky.cpp
|
||||
r_things.cpp
|
||||
r_translate.cpp
|
||||
s_advsound.cpp
|
||||
s_environment.cpp
|
||||
s_playlist.cpp
|
||||
|
@ -973,8 +971,11 @@ add_executable( zdoom WIN32
|
|||
fragglescript/t_spec.cpp
|
||||
fragglescript/t_variable.cpp
|
||||
fragglescript/t_cmd.cpp
|
||||
resources/colormaps.cpp
|
||||
resources/voxels.cpp
|
||||
r_data/colormaps.cpp
|
||||
r_data/voxels.cpp
|
||||
r_data/renderstyle.cpp
|
||||
r_data/r_interpolate.cpp
|
||||
r_data/r_translate.cpp
|
||||
autozend.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
#include "textures/textures.h"
|
||||
#include "r_blend.h"
|
||||
#include "r_data/renderstyle.h"
|
||||
#include "s_sound.h"
|
||||
#include "memarena.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "statnums.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "d_event.h"
|
||||
#include "gi.h"
|
||||
#include "r_bsp.h"
|
||||
|
@ -63,7 +63,7 @@
|
|||
#include "a_artifacts.h"
|
||||
#include "po_man.h"
|
||||
#include "a_keys.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
|
|
|
@ -48,7 +48,6 @@ Everything that is changed is marked (maybe commented) with "Added by MC"
|
|||
#include "b_bot.h"
|
||||
#include "g_game.h"
|
||||
#include "m_random.h"
|
||||
#include "r_things.h"
|
||||
#include "doomstat.h"
|
||||
#include "cmdlib.h"
|
||||
#include "sc_man.h"
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "v_text.h"
|
||||
#include "w_wad.h"
|
||||
#include "r_main.h"
|
||||
#include "r_draw.h"
|
||||
#include "sbar.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_sndseq.h"
|
||||
|
|
|
@ -60,14 +60,13 @@
|
|||
#include "gi.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "decallib.h"
|
||||
#include "r_draw.h"
|
||||
#include "v_palette.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "thingdef/thingdef.h"
|
||||
#include "thingdef/thingdef_exp.h"
|
||||
#include "vectors.h"
|
||||
#include "dobject.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "sc_man.h"
|
||||
#include "i_system.h"
|
||||
#include "doomerrors.h"
|
||||
|
|
|
@ -765,7 +765,7 @@ void D_Display ()
|
|||
}
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
R_RefreshViewBorder ();
|
||||
V_RefreshViewBorder ();
|
||||
}
|
||||
|
||||
if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10)
|
||||
|
|
|
@ -47,13 +47,12 @@
|
|||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "i_system.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_state.h"
|
||||
#include "sbar.h"
|
||||
#include "gi.h"
|
||||
#include "m_random.h"
|
||||
#include "teaminfo.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "templates.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
|
|
|
@ -42,9 +42,8 @@
|
|||
#include "weightedlist.h"
|
||||
#include "statnums.h"
|
||||
#include "templates.h"
|
||||
#include "r_draw.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "gi.h"
|
||||
#include "g_level.h"
|
||||
#include "colormatcher.h"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "r_blend.h"
|
||||
#include "r_data/renderstyle.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
class FScanner;
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "p_acs.h"
|
||||
#include "s_sndseq.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "doomstat.h"
|
||||
#include "m_argv.h"
|
||||
#include "po_man.h"
|
||||
|
|
|
@ -67,3 +67,5 @@ int NextSkill = -1;
|
|||
int SinglePlayerClass[MAXPLAYERS];
|
||||
|
||||
bool ToggleFullscreen;
|
||||
int BorderTopRefresh;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "gi.h"
|
||||
#include "p_local.h"
|
||||
#include "p_3dmidtex.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "statnums.h"
|
||||
|
||||
IMPLEMENT_CLASS (DSectorEffect)
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include "g_level.h"
|
||||
#include "v_palette.h"
|
||||
#include "v_font.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
#include "actor.h"
|
||||
#include "p_enemy.h"
|
||||
#include "a_action.h"
|
||||
#include "r_draw.h"
|
||||
#include "m_random.h"
|
||||
#include "p_local.h"
|
||||
#include "a_doomglobal.h"
|
||||
#include "s_sound.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "thingdef/thingdef.h"
|
||||
#include "g_level.h"
|
||||
*/
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "s_sound.h"
|
||||
#include "gstrings.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h"
|
||||
#include "g_game.h"
|
||||
#include "g_level.h"
|
||||
#include "b_bot.h" //Added by MC:
|
||||
|
@ -72,13 +71,13 @@
|
|||
#include "gi.h"
|
||||
#include "a_keys.h"
|
||||
#include "a_artifacts.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "cmdlib.h"
|
||||
#include "d_net.h"
|
||||
#include "d_event.h"
|
||||
#include "p_acs.h"
|
||||
#include "m_joy.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "g_level.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "templates.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "doomstat.h"
|
||||
|
||||
// Include all the other Heretic stuff here to reduce compile time
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "p_local.h"
|
||||
#include "gstrings.h"
|
||||
#include "gi.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "thingdef/thingdef.h"
|
||||
#include "doomstat.h"
|
||||
*/
|
||||
|
|
|
@ -69,16 +69,16 @@
|
|||
#include "version.h"
|
||||
#include "statnums.h"
|
||||
#include "sbarinfo.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "cmdlib.h"
|
||||
#include "d_net.h"
|
||||
#include "d_netinf.h"
|
||||
#include "v_palette.h"
|
||||
#include "menu/menu.h"
|
||||
#include "a_strifeglobal.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "p_enemy.h"
|
||||
#include "statnums.h"
|
||||
#include "templates.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
|
||||
static FRandom pr_freezedeath ("FreezeDeath");
|
||||
static FRandom pr_icesettics ("IceSetTics");
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "g_level.h"
|
||||
#include "doomstat.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
static FRandom pr_torch ("Torch");
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "i_system.h"
|
||||
#include "sbarinfo.h"
|
||||
#include "gi.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_main.h"
|
||||
#include "a_weaponpiece.h"
|
||||
#include "a_strifeglobal.h"
|
||||
|
@ -993,7 +993,7 @@ public:
|
|||
if(script->completeBorder) //Fill the statusbar with the border before we draw.
|
||||
{
|
||||
FTexture *b = TexMan[gameinfo.border->b];
|
||||
R_DrawBorder(viewwindowx, viewwindowy + viewheight + b->GetHeight(), viewwindowx + viewwidth, SCREENHEIGHT);
|
||||
V_DrawBorder(viewwindowx, viewwindowy + viewheight + b->GetHeight(), viewwindowx + viewwidth, SCREENHEIGHT);
|
||||
if(screenblocks == 10)
|
||||
screen->FlatFill(viewwindowx, viewwindowy + viewheight, viewwindowx + viewwidth, viewwindowy + viewheight + b->GetHeight(), b, true);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "c_console.h"
|
||||
#include "v_video.h"
|
||||
#include "m_swap.h"
|
||||
#include "r_draw.h"
|
||||
#include "w_wad.h"
|
||||
#include "v_text.h"
|
||||
#include "s_sound.h"
|
||||
|
@ -1053,8 +1052,8 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
y = x == ST_X ? ST_Y : ::ST_Y;
|
||||
x2 = !(ratio & 3) || !Scaled ? ST_X+HorizontalResolution :
|
||||
SCREENWIDTH - (SCREENWIDTH*(48-BaseRatioSizes[ratio][3])+48*2-1)/(48*2);
|
||||
R_DrawBorder (0, y, x, SCREENHEIGHT);
|
||||
R_DrawBorder (x2, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
V_DrawBorder (0, y, x, SCREENHEIGHT);
|
||||
V_DrawBorder (x2, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
if (setblocks >= 10)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "colormatcher.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "i_system.h"
|
||||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "colormatcher.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "i_system.h"
|
||||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "gl/system/gl_system.h"
|
||||
#include "doomtype.h"
|
||||
#include "colormatcher.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "i_system.h"
|
||||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "gl/utility/gl_geometric.h"
|
||||
#include "p_pspr.h"
|
||||
#include "resources/voxels.h"
|
||||
#include "r_data/voxels.h"
|
||||
|
||||
#define MAX_LODS 4
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
extern DWORD gl_fixedcolormap;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define __GL_LIGHTDATA
|
||||
|
||||
#include "v_palette.h"
|
||||
#include "r_blend.h"
|
||||
#include "r_data/renderstyle.h"
|
||||
#include "gl/renderer/gl_colormap.h"
|
||||
|
||||
bool gl_BrightmapsActive();
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "r_draw.h"
|
||||
#include "v_video.h"
|
||||
#include "r_main.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "m_png.h"
|
||||
#include "m_crc32.h"
|
||||
#include "w_wad.h"
|
||||
|
|
|
@ -277,7 +277,7 @@ static void AddPolyobjs(subsector_t *sub)
|
|||
{
|
||||
if (sub->BSP == NULL || sub->BSP->bDirty)
|
||||
{
|
||||
R_BuildPolyBSP(sub);
|
||||
sub->BuildPolyBSP();
|
||||
}
|
||||
if (sub->BSP->Nodes.Size() == 0)
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "gl/system/gl_system.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
@ -1060,7 +1061,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
|
|||
Colormap.LightColor.r = Colormap.LightColor.g = Colormap.LightColor.b = 0xff;
|
||||
lightlevel=255;
|
||||
}
|
||||
else lightlevel=abs(ceiling? GetCeilingLight(sec) : GetFloorLight(sec));
|
||||
else lightlevel=abs(ceiling? sec->GetCeilingLight() : sec->GetFloorLight());
|
||||
}
|
||||
|
||||
int rel = extralight * gl_weaponlight;
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
#include "gl/scene/gl_wall.h"
|
||||
|
||||
|
||||
int GetFloorLight (const sector_t *sec);
|
||||
int GetCeilingLight (const sector_t *sec);
|
||||
|
||||
enum GLDrawItemType
|
||||
{
|
||||
GLDIT_WALL,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
** gl_renderutil.cpp
|
||||
** Utility functions for the renderer
|
||||
** gl_fakeflat.cpp
|
||||
** Fake flat functions to render stacked sectors
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2001-2008 Christoph Oelckers
|
||||
** Copyright 2001-2011 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -192,14 +192,6 @@ void gl_CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *source, const secplane_t *opp);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// This is mostly like R_FakeFlat but with a few alterations necessitated
|
||||
|
@ -252,7 +244,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
|
|||
// Replace floor and ceiling height with control sector's heights.
|
||||
if (diffTex)
|
||||
{
|
||||
if (CopyPlaneIfValid (&dest->floorplane, &s->floorplane, &sec->ceilingplane))
|
||||
if (s->floorplane.CopyPlaneIfValid (&dest->floorplane, &sec->ceilingplane))
|
||||
{
|
||||
dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false);
|
||||
dest->SetPlaneTexZ(sector_t::floor, s->GetPlaneTexZ(sector_t::floor));
|
||||
|
@ -290,7 +282,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
|
|||
{
|
||||
if (diffTex)
|
||||
{
|
||||
if (CopyPlaneIfValid (&dest->ceilingplane, &s->ceilingplane, &sec->floorplane))
|
||||
if (s->ceilingplane.CopyPlaneIfValid (&dest->ceilingplane, &sec->floorplane))
|
||||
{
|
||||
dest->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false);
|
||||
dest->SetPlaneTexZ(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling));
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_main.h"
|
||||
#include "g_level.h"
|
||||
|
@ -599,7 +600,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
|
||||
srf |= SSRF_RENDERFLOOR;
|
||||
|
||||
lightlevel = gl_ClampLight(GetFloorLight(frontsector));
|
||||
lightlevel = gl_ClampLight(frontsector->GetFloorLight());
|
||||
Colormap=frontsector->ColorMap;
|
||||
if ((stack = (frontsector->portals[sector_t::floor] != NULL)))
|
||||
{
|
||||
|
@ -647,7 +648,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
|
||||
srf |= SSRF_RENDERCEILING;
|
||||
|
||||
lightlevel = gl_ClampLight(GetCeilingLight(frontsector));
|
||||
lightlevel = gl_ClampLight(frontsector->GetCeilingLight());
|
||||
Colormap=frontsector->ColorMap;
|
||||
if ((stack = (frontsector->portals[sector_t::ceiling] != NULL)))
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_level.h"
|
||||
|
||||
|
@ -53,9 +54,6 @@
|
|||
#include "gl/utility/gl_clock.h"
|
||||
#include "gl/utility/gl_templates.h"
|
||||
|
||||
int GetFloorLight (const sector_t *sec);
|
||||
int GetCeilingLight (const sector_t *sec);
|
||||
|
||||
|
||||
// This is for debugging maps.
|
||||
|
||||
|
@ -768,7 +766,7 @@ bool FDrawInfo::CheckAnchorFloor(subsector_t * sub)
|
|||
// using such crap hacks is simply too small
|
||||
if (sub->render_sector->GetTexture(sector_t::floor)==backsub->render_sector->GetTexture(sector_t::floor) &&
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::floor)==backsub->render_sector->GetPlaneTexZ(sector_t::floor) &&
|
||||
GetFloorLight(sub->render_sector)==GetFloorLight(backsub->render_sector))
|
||||
sub->render_sector->GetFloorLight() == backsub->render_sector->GetFloorLight())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -806,7 +804,7 @@ bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
|
|||
|
||||
if (sub->render_sector->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) ||
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::floor)!=anchor->GetPlaneTexZ(sector_t::floor) ||
|
||||
GetFloorLight(sub->render_sector)!=GetFloorLight(anchor))
|
||||
sub->render_sector->GetFloorLight() != anchor->GetFloorLight())
|
||||
{
|
||||
if (sub==viewsubsector && viewz<anchor->GetPlaneTexZ(sector_t::floor)) inview=true;
|
||||
HandledSubsectors.Push (sub);
|
||||
|
@ -835,7 +833,7 @@ bool FDrawInfo::CollectSubsectorsFloor(subsector_t * sub, sector_t * anchor)
|
|||
// Any anchor not within the original anchor's visplane terminates the processing.
|
||||
if (sub->render_sector->GetTexture(sector_t::floor)!=anchor->GetTexture(sector_t::floor) ||
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::floor)!=anchor->GetPlaneTexZ(sector_t::floor) ||
|
||||
GetFloorLight(sub->render_sector)!=GetFloorLight(anchor))
|
||||
sub->render_sector->GetFloorLight() != anchor->GetFloorLight())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -874,7 +872,7 @@ bool FDrawInfo::CheckAnchorCeiling(subsector_t * sub)
|
|||
// using such crap hacks is simply too small
|
||||
if (sub->render_sector->GetTexture(sector_t::ceiling)==backsub->render_sector->GetTexture(sector_t::ceiling) &&
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::ceiling)==backsub->render_sector->GetPlaneTexZ(sector_t::ceiling) &&
|
||||
GetCeilingLight(sub->render_sector)==GetCeilingLight(backsub->render_sector))
|
||||
sub->render_sector->GetCeilingLight() == backsub->render_sector->GetCeilingLight())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -908,7 +906,7 @@ bool FDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
|
|||
|
||||
if (sub->render_sector->GetTexture(sector_t::ceiling)!=anchor->GetTexture(sector_t::ceiling) ||
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::ceiling)!=anchor->GetPlaneTexZ(sector_t::ceiling) ||
|
||||
GetCeilingLight(sub->render_sector)!=GetCeilingLight(anchor))
|
||||
sub->render_sector->GetCeilingLight() != anchor->GetCeilingLight())
|
||||
{
|
||||
HandledSubsectors.Push (sub);
|
||||
}
|
||||
|
@ -936,7 +934,7 @@ bool FDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
|
|||
// Any anchor not within the original anchor's visplane terminates the processing.
|
||||
if (sub->render_sector->GetTexture(sector_t::ceiling)!=anchor->GetTexture(sector_t::ceiling) ||
|
||||
sub->render_sector->GetPlaneTexZ(sector_t::ceiling)!=anchor->GetPlaneTexZ(sector_t::ceiling) ||
|
||||
GetCeilingLight(sub->render_sector)!=GetCeilingLight(anchor))
|
||||
sub->render_sector->GetCeilingLight() != anchor->GetCeilingLight())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1068,7 +1066,7 @@ void FDrawInfo::CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor)
|
|||
sector_t * me = gl_FakeFlat(sub->render_sector, &fake, false);
|
||||
if (me->GetTexture(sector_t::ceiling) != anchor->GetTexture(sector_t::ceiling) ||
|
||||
me->ceilingplane != anchor->ceilingplane ||
|
||||
GetCeilingLight(me) != GetCeilingLight(anchor) ||
|
||||
me->GetCeilingLight() != anchor->GetCeilingLight() ||
|
||||
me->ColorMap != anchor->ColorMap ||
|
||||
me->GetXOffset(sector_t::ceiling) != anchor->GetXOffset(sector_t::ceiling) ||
|
||||
me->GetYOffset(sector_t::ceiling) != anchor->GetYOffset(sector_t::ceiling) ||
|
||||
|
@ -1116,7 +1114,7 @@ void FDrawInfo::CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor)
|
|||
sector_t * me = gl_FakeFlat(sub->render_sector, &fake, false);
|
||||
if (me->GetTexture(sector_t::floor) != anchor->GetTexture(sector_t::floor) ||
|
||||
me->floorplane != anchor->floorplane ||
|
||||
GetFloorLight(me) != GetFloorLight(anchor) ||
|
||||
me->GetFloorLight() != anchor->GetFloorLight() ||
|
||||
me->ColorMap != anchor->ColorMap ||
|
||||
me->GetXOffset(sector_t::floor) != anchor->GetXOffset(sector_t::floor) ||
|
||||
me->GetYOffset(sector_t::floor) != anchor->GetYOffset(sector_t::floor) ||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "dobject.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_level.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "r_main.h"
|
||||
#include "r_things.h"
|
||||
#include "sbar.h"
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
*/
|
||||
#include "gl/system/gl_system.h"
|
||||
#include "p_local.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "g_level.h"
|
||||
#include "doomstat.h"
|
||||
#include "gl/gl_functions.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
@ -676,7 +677,8 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
|||
(!gl_BrightmapsActive() || !gltexture || !gltexture->tex->gl_info.bBrightmapDisablesFullbright);
|
||||
|
||||
lightlevel=fullbright? 255 :
|
||||
gl_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ? GetCeilingLight(rendersector) : GetFloorLight(rendersector));
|
||||
gl_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||
foglevel = (BYTE)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||
|
||||
lightlevel = (byte)gl_CheckSpriteGlow(rendersector->GetTexture(sector_t::floor), lightlevel, thingz-thing->floorz);
|
||||
|
@ -862,7 +864,8 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
|
|||
|
||||
if (particle->trans==0) return;
|
||||
|
||||
lightlevel = gl_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ? GetCeilingLight(sector) : GetFloorLight(sector));
|
||||
lightlevel = gl_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
sector->GetCeilingLight() : sector->GetFloorLight());
|
||||
foglevel = sector->lightlevel;
|
||||
|
||||
if (gl_fixedcolormap)
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "g_level.h"
|
||||
#include "templates.h"
|
||||
#include "vectors.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
@ -508,7 +509,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
|
|||
{
|
||||
type = RENDERWALL_HORIZON;
|
||||
hi.plane.GetFromSector(fs, true);
|
||||
hi.lightlevel = gl_ClampLight(GetCeilingLight(fs));
|
||||
hi.lightlevel = gl_ClampLight(fs->GetCeilingLight());
|
||||
hi.colormap = fs->ColorMap;
|
||||
|
||||
if (fs->e->XFloor.ffloors.Size())
|
||||
|
@ -537,7 +538,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
|
|||
{
|
||||
type = RENDERWALL_HORIZON;
|
||||
hi.plane.GetFromSector(fs, false);
|
||||
hi.lightlevel = gl_ClampLight(GetFloorLight(fs));
|
||||
hi.lightlevel = gl_ClampLight(fs->GetFloorLight());
|
||||
hi.colormap = fs->ColorMap;
|
||||
|
||||
if (fs->e->XFloor.ffloors.Size())
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_blend.h"
|
||||
//#include "r_data/r_blend.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "v_palette.h"
|
||||
#include "templates.h"
|
||||
#include "gl/renderer/gl_lightdata.h"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "r_main.h"
|
||||
#include "templates.h"
|
||||
#include "sc_man.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "colormatcher.h"
|
||||
|
||||
//#include "gl/gl_intern.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "colormatcher.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "c_dispatch.h"
|
||||
#ifdef _WIN32
|
||||
#include "win32gliface.h"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "gl/textures/gl_translate.h"
|
||||
#include "m_crc32.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define __GL_TRANSLATE__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "r_translate.h"
|
||||
//#include "r_data/r_translate.h"
|
||||
#include "v_video.h"
|
||||
|
||||
enum
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "actor.h"
|
||||
#include "d_player.h"
|
||||
#include "r_state.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "c_bind.h"
|
||||
#include "g_level.h"
|
||||
#include "p_conversation.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "a_keys.h"
|
||||
#include "templates.h"
|
||||
#include "c_console.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "g_level.h"
|
||||
#include "d_net.h"
|
||||
#include "d_dehacked.h"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "dobject.h"
|
||||
#include "d_player.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "c_cvars.h"
|
||||
#include "v_font.h"
|
||||
#include "version.h"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "teaminfo.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_state.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "v_text.h"
|
||||
|
||||
EXTERN_CVAR (String, playerclass)
|
||||
|
|
|
@ -165,6 +165,7 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
bsp->bDirty = false;
|
||||
bsp->Verts.Resize(Vertices.Size());
|
||||
for (i = 0; i < Vertices.Size(); ++i)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "sc_man.h"
|
||||
#include "g_level.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#ifdef _3DFLOORS
|
||||
EXTERN_CVAR(Int, vid_renderer)
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include "sc_man.h"
|
||||
#include "c_bind.h"
|
||||
#include "info.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "cmdlib.h"
|
||||
#include "m_png.h"
|
||||
#include "p_setup.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "r_defs.h"
|
||||
#include "p_setup.h"
|
||||
#include "g_level.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "v_video.h"
|
||||
#include "m_random.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_things.h"
|
||||
#include "s_sound.h"
|
||||
#include "templates.h"
|
||||
#include "gi.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "r_state.h"
|
||||
#include "tables.h"
|
||||
#include "p_3dmidtex.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -52,11 +52,11 @@
|
|||
#include "m_random.h"
|
||||
#include "p_conversation.h"
|
||||
#include "a_strifeglobal.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "p_3dmidtex.h"
|
||||
#include "d_net.h"
|
||||
#include "d_event.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#define FUNC(a) static int a (line_t *ln, AActor *it, bool backSide, \
|
||||
int arg0, int arg1, int arg2, int arg3, int arg4)
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
#include "a_sharedglobal.h"
|
||||
#include "p_conversation.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "g_level.h"
|
||||
|
||||
#define WATER_SINK_FACTOR 3
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "thingdef/thingdef.h"
|
||||
#include "g_game.h"
|
||||
#include "teaminfo.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_level.h"
|
||||
#include "d_event.h"
|
||||
|
@ -61,7 +61,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "p_enemy.h"
|
||||
#include "gstrings.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "p_spec.h"
|
||||
#include "g_level.h"
|
||||
#include "s_sndseq.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
|
||||
IMPLEMENT_POINTY_CLASS (DPillar)
|
||||
DECLARE_POINTER(m_Interp_Floor)
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
#include "s_sndseq.h"
|
||||
#include "v_palette.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "g_level.h"
|
||||
#include "po_man.h"
|
||||
#include "p_setup.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
static void CopyPlayer (player_t *dst, player_t *src, const char *name);
|
||||
static void ReadOnePlayer (FArchive &arc, bool skipload);
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
#include "p_spec.h"
|
||||
#include "c_cvars.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_level.h"
|
||||
#include "r_main.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "nodebuild.h"
|
||||
#include "po_man.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
|
||||
// [RH]
|
||||
|
@ -774,6 +777,61 @@ bool sector_t::PlaneMoving(int pos)
|
|||
}
|
||||
|
||||
|
||||
int sector_t::GetFloorLight () const
|
||||
{
|
||||
if (GetFlags(sector_t::floor) & PLANEF_ABSLIGHTING)
|
||||
{
|
||||
return GetPlaneLight(floor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ClampLight(lightlevel + GetPlaneLight(floor));
|
||||
}
|
||||
}
|
||||
|
||||
int sector_t::GetCeilingLight () const
|
||||
{
|
||||
if (GetFlags(ceiling) & PLANEF_ABSLIGHTING)
|
||||
{
|
||||
return GetPlaneLight(ceiling);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ClampLight(lightlevel + GetPlaneLight(ceiling));
|
||||
}
|
||||
}
|
||||
|
||||
bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const
|
||||
{
|
||||
bool copy = false;
|
||||
|
||||
// If the planes do not have matching slopes, then always copy them
|
||||
// because clipping would require creating new sectors.
|
||||
if (a != dest->a || b != dest->b || c != dest->c)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
else if (opp->a != -dest->a || opp->b != -dest->b || opp->c != -dest->c)
|
||||
{
|
||||
if (d < dest->d)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
}
|
||||
else if (d < dest->d && d > -opp->d)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
|
||||
if (copy)
|
||||
{
|
||||
*dest = *this;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_AlignFlat
|
||||
|
@ -805,3 +863,108 @@ bool P_AlignFlat (int linenum, int side, int fc)
|
|||
sec->SetBase(fc, dist & ((1<<(FRACBITS+8))-1), 0-angle);
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_BuildPolyBSP
|
||||
//
|
||||
//==========================================================================
|
||||
static FNodeBuilder::FLevel PolyNodeLevel;
|
||||
static FNodeBuilder PolyNodeBuilder(PolyNodeLevel);
|
||||
|
||||
void subsector_t::BuildPolyBSP()
|
||||
{
|
||||
assert((BSP == NULL || BSP->bDirty) && "BSP computed more than once");
|
||||
|
||||
// Set up level information for the node builder.
|
||||
PolyNodeLevel.Sides = sides;
|
||||
PolyNodeLevel.NumSides = numsides;
|
||||
PolyNodeLevel.Lines = lines;
|
||||
PolyNodeLevel.NumLines = numlines;
|
||||
|
||||
// Feed segs to the nodebuilder and build the nodes.
|
||||
PolyNodeBuilder.Clear();
|
||||
PolyNodeBuilder.AddSegs(firstline, numlines);
|
||||
for (FPolyNode *pn = polys; pn != NULL; pn = pn->pnext)
|
||||
{
|
||||
PolyNodeBuilder.AddPolySegs(&pn->segs[0], (int)pn->segs.Size());
|
||||
}
|
||||
PolyNodeBuilder.BuildMini(false);
|
||||
if (BSP == NULL)
|
||||
{
|
||||
BSP = new FMiniBSP;
|
||||
}
|
||||
PolyNodeBuilder.ExtractMini(BSP);
|
||||
for (unsigned int i = 0; i < BSP->Subsectors.Size(); ++i)
|
||||
{
|
||||
BSP->Subsectors[i].sector = sector;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CUSTOM_CVAR(Int, r_fakecontrast, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0) self = 1;
|
||||
else if (self > 2) self = 2;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int side_t::GetLightLevel (bool foggy, int baselight, int *pfakecontrast) const
|
||||
{
|
||||
if (Flags & WALLF_ABSLIGHTING)
|
||||
{
|
||||
baselight = Light;
|
||||
}
|
||||
|
||||
if (pfakecontrast != NULL)
|
||||
{
|
||||
*pfakecontrast = 0;
|
||||
}
|
||||
|
||||
if (!foggy) // Don't do relative lighting in foggy sectors
|
||||
{
|
||||
if (!(Flags & WALLF_NOFAKECONTRAST) && r_fakecontrast != 0)
|
||||
{
|
||||
int rel;
|
||||
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_fakecontrast == 2) &&
|
||||
linedef->dx != 0)
|
||||
{
|
||||
rel = xs_RoundToInt // OMG LEE KILLOUGH LIVES! :/
|
||||
(
|
||||
level.WallHorizLight
|
||||
+ fabs(atan(double(linedef->dy) / linedef->dx) / 1.57079)
|
||||
* (level.WallVertLight - level.WallHorizLight)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
rel = linedef->dx == 0 ? level.WallVertLight :
|
||||
linedef->dy == 0 ? level.WallHorizLight : 0;
|
||||
}
|
||||
if (pfakecontrast != NULL)
|
||||
{
|
||||
*pfakecontrast = rel;
|
||||
}
|
||||
else
|
||||
{
|
||||
baselight += rel;
|
||||
}
|
||||
}
|
||||
if (!(Flags & WALLF_ABSLIGHTING))
|
||||
{
|
||||
baselight += this->Light;
|
||||
}
|
||||
}
|
||||
return baselight;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,15 +58,15 @@
|
|||
#include "s_sndseq.h"
|
||||
#include "sbar.h"
|
||||
#include "p_setup.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "r_sky.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_level.h"
|
||||
#include "md5.h"
|
||||
#include "compatibility.h"
|
||||
#include "po_man.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
#include "c_console.h"
|
||||
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
|
||||
static FRandom pr_playerinspecialsector ("PlayerInSpecialSector");
|
||||
void P_SetupPortals();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "s_sound.h"
|
||||
#include "doomstat.h"
|
||||
#include "sbar.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "i_sound.h"
|
||||
#include "g_level.h"
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "p_udmf.h"
|
||||
#include "r_state.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "doomstat.h"
|
||||
#include "s_sound.h"
|
||||
#include "i_system.h"
|
||||
#include "r_draw.h"
|
||||
#include "gi.h"
|
||||
#include "m_random.h"
|
||||
#include "p_pspr.h"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "a_sharedglobal.h"
|
||||
#include "r_main.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "g_level.h"
|
||||
#include "po_man.h"
|
||||
#include "p_setup.h"
|
||||
|
|
130
src/r_bsp.cpp
130
src/r_bsp.cpp
|
@ -45,7 +45,6 @@
|
|||
#include "r_3dfloors.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "g_level.h"
|
||||
#include "nodebuild.h"
|
||||
|
||||
// State.
|
||||
#include "doomstat.h"
|
||||
|
@ -54,7 +53,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
int WallMost (short *mostbuf, const secplane_t &plane);
|
||||
|
||||
|
@ -112,9 +111,6 @@ WORD MirrorFlags;
|
|||
seg_t *ActiveWallMirror;
|
||||
TArray<size_t> WallMirrors;
|
||||
|
||||
static FNodeBuilder::FLevel PolyNodeLevel;
|
||||
static FNodeBuilder PolyNodeBuilder(PolyNodeLevel);
|
||||
|
||||
static subsector_t *InSubsector;
|
||||
|
||||
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
|
||||
|
@ -313,59 +309,6 @@ void R_ClearClipSegs (short left, short right)
|
|||
newend = solidsegs+2;
|
||||
}
|
||||
|
||||
int GetFloorLight (const sector_t *sec)
|
||||
{
|
||||
if (sec->GetFlags(sector_t::floor) & PLANEF_ABSLIGHTING)
|
||||
{
|
||||
return sec->GetPlaneLight(sector_t::floor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sector_t::ClampLight(sec->lightlevel + sec->GetPlaneLight(sector_t::floor));
|
||||
}
|
||||
}
|
||||
|
||||
int GetCeilingLight (const sector_t *sec)
|
||||
{
|
||||
if (sec->GetFlags(sector_t::ceiling) & PLANEF_ABSLIGHTING)
|
||||
{
|
||||
return sec->GetPlaneLight(sector_t::ceiling);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sector_t::ClampLight(sec->lightlevel + sec->GetPlaneLight(sector_t::ceiling));
|
||||
}
|
||||
}
|
||||
|
||||
bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *source, const secplane_t *opp)
|
||||
{
|
||||
bool copy = false;
|
||||
|
||||
// If the planes do not have matching slopes, then always copy them
|
||||
// because clipping would require creating new sectors.
|
||||
if (source->a != dest->a || source->b != dest->b || source->c != dest->c)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
else if (opp->a != -dest->a || opp->b != -dest->b || opp->c != -dest->c)
|
||||
{
|
||||
if (source->d < dest->d)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
}
|
||||
else if (source->d < dest->d && source->d > -opp->d)
|
||||
{
|
||||
copy = true;
|
||||
}
|
||||
|
||||
if (copy)
|
||||
{
|
||||
*dest = *source;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
//
|
||||
// killough 3/7/98: Hack floor/ceiling heights for deep water etc.
|
||||
|
@ -387,12 +330,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
// [RH] allow per-plane lighting
|
||||
if (floorlightlevel != NULL)
|
||||
{
|
||||
*floorlightlevel = GetFloorLight (sec);
|
||||
*floorlightlevel = sec->GetFloorLight ();
|
||||
}
|
||||
|
||||
if (ceilinglightlevel != NULL)
|
||||
{
|
||||
*ceilinglightlevel = GetCeilingLight (sec);
|
||||
*ceilinglightlevel = sec->GetCeilingLight ();
|
||||
}
|
||||
|
||||
FakeSide = FAKED_Center;
|
||||
|
@ -412,7 +355,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
// Replace floor and ceiling height with control sector's heights.
|
||||
if (diffTex)
|
||||
{
|
||||
if (CopyPlaneIfValid (&tempsec->floorplane, &s->floorplane, &sec->ceilingplane))
|
||||
if (s->floorplane.CopyPlaneIfValid (&tempsec->floorplane, &sec->ceilingplane))
|
||||
{
|
||||
tempsec->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false);
|
||||
}
|
||||
|
@ -427,12 +370,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
|
||||
if (floorlightlevel != NULL)
|
||||
{
|
||||
*floorlightlevel = GetFloorLight (s);
|
||||
*floorlightlevel = s->GetFloorLight ();
|
||||
}
|
||||
|
||||
if (ceilinglightlevel != NULL)
|
||||
{
|
||||
*ceilinglightlevel = GetCeilingLight (s);
|
||||
*ceilinglightlevel = s->GetCeilingLight ();
|
||||
}
|
||||
}
|
||||
FakeSide = FAKED_BelowFloor;
|
||||
|
@ -450,7 +393,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
{
|
||||
if (diffTex)
|
||||
{
|
||||
if (CopyPlaneIfValid (&tempsec->ceilingplane, &s->ceilingplane, &sec->floorplane))
|
||||
if (s->ceilingplane.CopyPlaneIfValid (&tempsec->ceilingplane, &sec->floorplane))
|
||||
{
|
||||
tempsec->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false);
|
||||
}
|
||||
|
@ -528,12 +471,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
|
||||
if (floorlightlevel != NULL)
|
||||
{
|
||||
*floorlightlevel = GetFloorLight (s);
|
||||
*floorlightlevel = s->GetFloorLight ();
|
||||
}
|
||||
|
||||
if (ceilinglightlevel != NULL)
|
||||
{
|
||||
*ceilinglightlevel = GetCeilingLight (s);
|
||||
*ceilinglightlevel = s->GetCeilingLight ();
|
||||
}
|
||||
}
|
||||
FakeSide = FAKED_BelowFloor;
|
||||
|
@ -565,12 +508,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
|
||||
if (floorlightlevel != NULL)
|
||||
{
|
||||
*floorlightlevel = GetFloorLight (s);
|
||||
*floorlightlevel = s->GetFloorLight ();
|
||||
}
|
||||
|
||||
if (ceilinglightlevel != NULL)
|
||||
{
|
||||
*ceilinglightlevel = GetCeilingLight (s);
|
||||
*ceilinglightlevel = s->GetCeilingLight ();
|
||||
}
|
||||
}
|
||||
FakeSide = FAKED_AboveCeiling;
|
||||
|
@ -1021,62 +964,13 @@ static bool R_CheckBBox (fixed_t *bspcoord) // killough 1/28/98: static
|
|||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMiniBSP Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FMiniBSP::FMiniBSP()
|
||||
{
|
||||
bDirty = false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_BuildPolyBSP
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_BuildPolyBSP(subsector_t *sub)
|
||||
{
|
||||
assert((sub->BSP == NULL || sub->BSP->bDirty) && "BSP computed more than once");
|
||||
|
||||
// Set up level information for the node builder.
|
||||
PolyNodeLevel.Sides = sides;
|
||||
PolyNodeLevel.NumSides = numsides;
|
||||
PolyNodeLevel.Lines = lines;
|
||||
PolyNodeLevel.NumLines = numlines;
|
||||
|
||||
// Feed segs to the nodebuilder and build the nodes.
|
||||
PolyNodeBuilder.Clear();
|
||||
PolyNodeBuilder.AddSegs(sub->firstline, sub->numlines);
|
||||
for (FPolyNode *pn = sub->polys; pn != NULL; pn = pn->pnext)
|
||||
{
|
||||
PolyNodeBuilder.AddPolySegs(&pn->segs[0], (int)pn->segs.Size());
|
||||
}
|
||||
PolyNodeBuilder.BuildMini(false);
|
||||
if (sub->BSP == NULL)
|
||||
{
|
||||
sub->BSP = new FMiniBSP;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub->BSP->bDirty = false;
|
||||
}
|
||||
PolyNodeBuilder.ExtractMini(sub->BSP);
|
||||
for (unsigned int i = 0; i < sub->BSP->Subsectors.Size(); ++i)
|
||||
{
|
||||
sub->BSP->Subsectors[i].sector = sub->sector;
|
||||
}
|
||||
}
|
||||
|
||||
void R_Subsector (subsector_t *sub);
|
||||
static void R_AddPolyobjs(subsector_t *sub)
|
||||
{
|
||||
if (sub->BSP == NULL || sub->BSP->bDirty)
|
||||
{
|
||||
R_BuildPolyBSP(sub);
|
||||
sub->BuildPolyBSP();
|
||||
}
|
||||
if (sub->BSP->Nodes.Size() == 0)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,6 @@ EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs?
|
|||
// BSP?
|
||||
void R_ClearClipSegs (short left, short right);
|
||||
void R_ClearDrawSegs ();
|
||||
void R_BuildPolyBSP(subsector_t *sub);
|
||||
void R_RenderBSPNode (void *node);
|
||||
|
||||
// killough 4/13/98: fake floors/ceilings for deep water / fake ceilings:
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include "v_text.h"
|
||||
#include "st_start.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "colormatcher.h"
|
||||
#include "colormaps.h"
|
|
@ -6,7 +6,7 @@ void R_DeinitColormaps ();
|
|||
|
||||
DWORD R_ColormapNumForName(const char *name); // killough 4/4/98
|
||||
void R_SetDefaultColormap (const char *name); // [RH] change normal fadetable
|
||||
DWORD R_BlendForColormap (DWORD map); // [RH] return calculated blend for a colormap
|
||||
DWORD R_BlendForColormap (DWORD map); // [RH] return calculated blend for a colormap
|
||||
extern BYTE *realcolormaps; // [RH] make the colormaps externally visible
|
||||
extern size_t numfakecmaps;
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "p_3dmidtex.h"
|
||||
#include "stats.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "p_local.h"
|
||||
#include "i_system.h"
|
||||
#include "po_man.h"
|
|
@ -35,9 +35,8 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include "templates.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_main.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "v_video.h"
|
||||
#include "g_game.h"
|
||||
#include "colormatcher.h"
|
||||
|
@ -47,13 +46,14 @@
|
|||
#include "doomerrors.h"
|
||||
#include "i_system.h"
|
||||
#include "w_wad.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include "gi.h"
|
||||
#include "stats.h"
|
||||
|
||||
TAutoGrowArray<FRemapTablePtr, FRemapTable *> translationtables[NUM_TRANSLATION_TABLES];
|
||||
|
||||
|
||||
const BYTE IcePalette[16][3] =
|
||||
{
|
||||
{ 10, 8, 18 },
|
||||
|
@ -681,7 +681,7 @@ static void PushIdentityTable(int slot)
|
|||
|
||||
void R_InitTranslationTables ()
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
// Each player gets two translations. Doom and Strife don't use the
|
||||
// extra ones, but Heretic and Hexen do. These are set up during
|
||||
|
@ -815,41 +815,6 @@ void R_InitTranslationTables ()
|
|||
remap->Remap[i] = IcePaletteRemap[v];
|
||||
remap->Palette[i] = PalEntry(255, IcePalette[v][0], IcePalette[v][1], IcePalette[v][2]);
|
||||
}
|
||||
|
||||
// set up shading tables for shaded columns
|
||||
// 16 colormap sets, progressing from full alpha to minimum visible alpha
|
||||
|
||||
BYTE *table = shadetables;
|
||||
|
||||
// Full alpha
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
ShadeFakeColormap[i].Color = ~0u;
|
||||
ShadeFakeColormap[i].Desaturate = ~0u;
|
||||
ShadeFakeColormap[i].Next = NULL;
|
||||
ShadeFakeColormap[i].Maps = table;
|
||||
|
||||
for (j = 0; j < NUMCOLORMAPS; ++j)
|
||||
{
|
||||
int a = (NUMCOLORMAPS - j) * 256 / NUMCOLORMAPS * (16-i);
|
||||
for (int k = 0; k < 256; ++k)
|
||||
{
|
||||
BYTE v = (((k+2) * a) + 256) >> 14;
|
||||
table[k] = MIN<BYTE> (v, 64);
|
||||
}
|
||||
table += 256;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NUMCOLORMAPS*16*256; ++i)
|
||||
{
|
||||
assert(shadetables[i] <= 64);
|
||||
}
|
||||
|
||||
// Set up a guaranteed identity map
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
identitymap[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
195
src/r_data/renderstyle.cpp
Normal file
195
src/r_data/renderstyle.cpp
Normal file
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
** r_data.cpp
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2008-2011 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
#include "farchive.h"
|
||||
#include "templates.h"
|
||||
#include "renderstyle.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
CVAR (Bool, r_drawtrans, true, 0)
|
||||
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
|
||||
|
||||
// Convert legacy render styles to flexible render styles.
|
||||
|
||||
// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
|
||||
// rather than the struct before it, which goes against the standard.
|
||||
#ifndef __APPLE__
|
||||
FRenderStyle LegacyRenderStyles[STYLE_Count] =
|
||||
{
|
||||
/* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
|
||||
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
|
||||
/* STYLE_Fuzzy */ {{ STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_SoulTrans */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha }},
|
||||
/* STYLE_OptFuzzy */ {{ STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_Stencil */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed }},
|
||||
/* STYLE_Translucent */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
|
||||
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
|
||||
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
|
||||
/* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }},
|
||||
};
|
||||
#else
|
||||
FRenderStyle LegacyRenderStyles[STYLE_Count];
|
||||
|
||||
static const BYTE Styles[STYLE_Count * 4] =
|
||||
{
|
||||
STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1,
|
||||
STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha,
|
||||
STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
|
||||
STYLEOP_Shadow, 0, 0, 0
|
||||
};
|
||||
|
||||
static struct LegacyInit
|
||||
{
|
||||
LegacyInit()
|
||||
{
|
||||
for (int i = 0; i < STYLE_Count; ++i)
|
||||
{
|
||||
LegacyRenderStyles[i].BlendOp = Styles[i*4];
|
||||
LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
|
||||
LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
|
||||
LegacyRenderStyles[i].Flags = Styles[i*4+3];
|
||||
}
|
||||
}
|
||||
} DoLegacyInit;
|
||||
|
||||
#endif
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
|
||||
{
|
||||
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
|
||||
return arc;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRenderStyle :: IsVisible
|
||||
//
|
||||
// Coupled with the given alpha, will this render style produce something
|
||||
// visible on-screen?
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
|
||||
{
|
||||
if (BlendOp == STYLEOP_None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (BlendOp == STYLEOP_Add || BlendOp == STYLEOP_RevSub)
|
||||
{
|
||||
if (Flags & STYLEF_Alpha1)
|
||||
{
|
||||
alpha = FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp(alpha, 0, FRACUNIT);
|
||||
}
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
|
||||
}
|
||||
// Treat anything else as visible.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRenderStyle :: CheckFuzz
|
||||
//
|
||||
// Adjusts settings based on r_drawfuzz CVAR
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FRenderStyle::CheckFuzz()
|
||||
{
|
||||
switch (BlendOp)
|
||||
{
|
||||
default:
|
||||
return;
|
||||
|
||||
case STYLEOP_FuzzOrAdd:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_Add;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLEOP_FuzzOrSub:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_Sub;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLEOP_FuzzOrRevSub:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_RevSub;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (r_drawfuzz == 2)
|
||||
{
|
||||
BlendOp = STYLEOP_Shadow;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlendOp = STYLEOP_Fuzz;
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t GetAlpha(int type, fixed_t alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return FRACUNIT;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,5 +148,6 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
|
|||
class FArchive;
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FRenderStyle &style);
|
||||
fixed_t GetAlpha(int type, fixed_t alpha);
|
||||
|
||||
#endif
|
995
src/r_data/sprites.cpp
Normal file
995
src/r_data/sprites.cpp
Normal file
|
@ -0,0 +1,995 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "w_wad.h"
|
||||
#include "i_system.h"
|
||||
#include "s_sound.h"
|
||||
#include "c_console.h"
|
||||
#include "d_player.h"
|
||||
#include "d_netinf.h"
|
||||
#include "gi.h"
|
||||
#include "colormatcher.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "r_defs.h"
|
||||
#include "v_text.h"
|
||||
#include "r_data/sprites.h"
|
||||
#include "r_data/voxels.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
// variables used to look up
|
||||
// and range check thing_t sprites patches
|
||||
TArray<spritedef_t> sprites;
|
||||
TArray<spriteframe_t> SpriteFrames;
|
||||
DWORD NumStdSprites; // The first x sprites that don't belong to skins.
|
||||
|
||||
struct spriteframewithrotate : public spriteframe_t
|
||||
{
|
||||
int rotate;
|
||||
}
|
||||
sprtemp[MAX_SPRITE_FRAMES];
|
||||
int maxframe;
|
||||
char* spritename;
|
||||
|
||||
// [RH] skin globals
|
||||
FPlayerSkin *skins;
|
||||
size_t numskins;
|
||||
BYTE OtherGameSkinRemap[256];
|
||||
PalEntry OtherGameSkinPalette[256];
|
||||
|
||||
|
||||
|
||||
//
|
||||
// R_InstallSpriteLump
|
||||
// Local function for R_InitSprites.
|
||||
//
|
||||
// [RH] Removed checks for coexistance of rotation 0 with other
|
||||
// rotations and made it look more like BOOM's version.
|
||||
//
|
||||
static bool R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool flipped)
|
||||
{
|
||||
unsigned rotation;
|
||||
|
||||
if (rot >= '0' && rot <= '9')
|
||||
{
|
||||
rotation = rot - '0';
|
||||
}
|
||||
else if (rot >= 'A')
|
||||
{
|
||||
rotation = rot - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation = 17;
|
||||
}
|
||||
|
||||
if (frame >= MAX_SPRITE_FRAMES || rotation > 16)
|
||||
{
|
||||
Printf (TEXTCOLOR_RED"R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->Name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((int)frame > maxframe)
|
||||
maxframe = frame;
|
||||
|
||||
if (rotation == 0)
|
||||
{
|
||||
// the lump should be used for all rotations
|
||||
// false=0, true=1, but array initialised to -1
|
||||
// allows doom to have a "no value set yet" boolean value!
|
||||
int r;
|
||||
|
||||
for (r = 14; r >= 0; r -= 2)
|
||||
{
|
||||
if (!sprtemp[frame].Texture[r].isValid())
|
||||
{
|
||||
sprtemp[frame].Texture[r] = lump;
|
||||
if (flipped)
|
||||
{
|
||||
sprtemp[frame].Flip |= 1 << r;
|
||||
}
|
||||
sprtemp[frame].rotate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rotation <= 8)
|
||||
{
|
||||
rotation = (rotation - 1) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation = (rotation - 9) * 2 + 1;
|
||||
}
|
||||
|
||||
if (!sprtemp[frame].Texture[rotation].isValid())
|
||||
{
|
||||
// the lump is only used for one rotation
|
||||
sprtemp[frame].Texture[rotation] = lump;
|
||||
if (flipped)
|
||||
{
|
||||
sprtemp[frame].Flip |= 1 << rotation;
|
||||
}
|
||||
sprtemp[frame].rotate = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// [RH] Seperated out of R_InitSpriteDefs()
|
||||
static void R_InstallSprite (int num)
|
||||
{
|
||||
int frame;
|
||||
int framestart;
|
||||
int rot;
|
||||
// int undefinedFix;
|
||||
|
||||
if (maxframe == -1)
|
||||
{
|
||||
sprites[num].numframes = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
maxframe++;
|
||||
|
||||
// [RH] If any frames are undefined, but there are some defined frames, map
|
||||
// them to the first defined frame. This is a fix for Doom Raider, which actually
|
||||
// worked with ZDoom 2.0.47, because of a bug here. It does not define frames A,
|
||||
// B, or C for the sprite PSBG, but because I had sprtemp[].rotate defined as a
|
||||
// bool, this code never detected that it was not actually present. After switching
|
||||
// to the unified texture system, this caused it to crash while loading the wad.
|
||||
|
||||
// [RH] Let undefined frames actually be blank because LWM uses this in at least
|
||||
// one of her wads.
|
||||
// for (frame = 0; frame < maxframe && sprtemp[frame].rotate == -1; ++frame)
|
||||
// { }
|
||||
//
|
||||
// undefinedFix = frame;
|
||||
|
||||
for (frame = 0; frame < maxframe; ++frame)
|
||||
{
|
||||
switch (sprtemp[frame].rotate)
|
||||
{
|
||||
case -1:
|
||||
// no rotations were found for that frame at all
|
||||
//I_FatalError ("R_InstallSprite: No patches found for %s frame %c", sprites[num].name, frame+'A');
|
||||
break;
|
||||
|
||||
case 0:
|
||||
// only the first rotation is needed
|
||||
for (rot = 1; rot < 16; ++rot)
|
||||
{
|
||||
sprtemp[frame].Texture[rot] = sprtemp[frame].Texture[0];
|
||||
}
|
||||
// If the frame is flipped, they all should be
|
||||
if (sprtemp[frame].Flip & 1)
|
||||
{
|
||||
sprtemp[frame].Flip = 0xFFFF;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// must have all 8 frame pairs
|
||||
for (rot = 0; rot < 8; ++rot)
|
||||
{
|
||||
if (!sprtemp[frame].Texture[rot*2+1].isValid())
|
||||
{
|
||||
sprtemp[frame].Texture[rot*2+1] = sprtemp[frame].Texture[rot*2];
|
||||
if (sprtemp[frame].Flip & (1 << (rot*2)))
|
||||
{
|
||||
sprtemp[frame].Flip |= 1 << (rot*2+1);
|
||||
}
|
||||
}
|
||||
if (!sprtemp[frame].Texture[rot*2].isValid())
|
||||
{
|
||||
sprtemp[frame].Texture[rot*2] = sprtemp[frame].Texture[rot*2+1];
|
||||
if (sprtemp[frame].Flip & (1 << (rot*2+1)))
|
||||
{
|
||||
sprtemp[frame].Flip |= 1 << (rot*2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (rot = 0; rot < 16; ++rot)
|
||||
{
|
||||
if (!sprtemp[frame].Texture[rot].isValid())
|
||||
I_FatalError ("R_InstallSprite: Sprite %s frame %c is missing rotations",
|
||||
sprites[num].name, frame+'A');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (frame = 0; frame < maxframe; ++frame)
|
||||
{
|
||||
if (sprtemp[frame].rotate == -1)
|
||||
{
|
||||
memset (&sprtemp[frame].Texture, 0, sizeof(sprtemp[0].Texture));
|
||||
sprtemp[frame].Flip = 0;
|
||||
sprtemp[frame].rotate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// allocate space for the frames present and copy sprtemp to it
|
||||
sprites[num].numframes = maxframe;
|
||||
sprites[num].spriteframes = WORD(framestart = SpriteFrames.Reserve (maxframe));
|
||||
for (frame = 0; frame < maxframe; ++frame)
|
||||
{
|
||||
memcpy (SpriteFrames[framestart+frame].Texture, sprtemp[frame].Texture, sizeof(sprtemp[frame].Texture));
|
||||
SpriteFrames[framestart+frame].Flip = sprtemp[frame].Flip;
|
||||
SpriteFrames[framestart+frame].Voxel = sprtemp[frame].Voxel;
|
||||
}
|
||||
|
||||
// Let the textures know about the rotations
|
||||
for (frame = 0; frame < maxframe; ++frame)
|
||||
{
|
||||
if (sprtemp[frame].rotate == 1)
|
||||
{
|
||||
for (int rot = 0; rot < 16; ++rot)
|
||||
{
|
||||
TexMan[sprtemp[frame].Texture[rot]]->Rotations = framestart + frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// R_InitSpriteDefs
|
||||
// Pass a null terminated list of sprite names
|
||||
// (4 chars exactly) to be used.
|
||||
// Builds the sprite rotation matrices to account
|
||||
// for horizontally flipped sprites.
|
||||
// Will report an error if the lumps are inconsistant.
|
||||
// Only called at startup.
|
||||
//
|
||||
// Sprite lump names are 4 characters for the actor,
|
||||
// a letter for the frame, and a number for the rotation.
|
||||
// A sprite that is flippable will have an additional
|
||||
// letter/number appended.
|
||||
// The rotation character can be 0 to signify no rotations.
|
||||
//
|
||||
void R_InitSpriteDefs ()
|
||||
{
|
||||
struct Hasher
|
||||
{
|
||||
int Head, Next;
|
||||
} *hashes;
|
||||
struct VHasher
|
||||
{
|
||||
int Head, Next, Name, Spin;
|
||||
char Frame;
|
||||
} *vhashes;
|
||||
unsigned int i, j, smax, vmax;
|
||||
DWORD intname;
|
||||
|
||||
// Create a hash table to speed up the process
|
||||
smax = TexMan.NumTextures();
|
||||
hashes = new Hasher[smax];
|
||||
clearbuf(hashes, sizeof(Hasher)*smax/4, -1);
|
||||
for (i = 0; i < smax; ++i)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
if (tex->UseType == FTexture::TEX_Sprite && strlen(tex->Name) >= 6)
|
||||
{
|
||||
size_t bucket = tex->dwName % smax;
|
||||
hashes[i].Next = hashes[bucket].Head;
|
||||
hashes[bucket].Head = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Repeat, for voxels
|
||||
vmax = Wads.GetNumLumps();
|
||||
vhashes = new VHasher[vmax];
|
||||
clearbuf(vhashes, sizeof(VHasher)*vmax/4, -1);
|
||||
for (i = 0; i < vmax; ++i)
|
||||
{
|
||||
if (Wads.GetLumpNamespace(i) == ns_voxels)
|
||||
{
|
||||
char name[9];
|
||||
size_t namelen;
|
||||
int spin;
|
||||
int sign;
|
||||
|
||||
Wads.GetLumpName(name, i);
|
||||
name[8] = 0;
|
||||
namelen = strlen(name);
|
||||
if (namelen < 4)
|
||||
{ // name is too short
|
||||
continue;
|
||||
}
|
||||
if (name[4] != '\0' && name[4] != ' ' && (name[4] < 'A' || name[4] >= 'A' + MAX_SPRITE_FRAMES))
|
||||
{ // frame char is invalid
|
||||
continue;
|
||||
}
|
||||
spin = 0;
|
||||
sign = 2; // 2 to convert from deg/halfsec to deg/sec
|
||||
j = 5;
|
||||
if (j < namelen && name[j] == '-')
|
||||
{ // a minus sign is okay, but only before any digits
|
||||
j++;
|
||||
sign = -2;
|
||||
}
|
||||
for (; j < namelen; ++j)
|
||||
{ // the remainder to the end of the name must be digits
|
||||
if (name[j] >= '0' && name[j] <= '9')
|
||||
{
|
||||
spin = spin * 10 + name[j] - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j < namelen)
|
||||
{ // the spin part is invalid
|
||||
continue;
|
||||
}
|
||||
memcpy(&vhashes[i].Name, name, 4);
|
||||
vhashes[i].Frame = name[4];
|
||||
vhashes[i].Spin = spin * sign;
|
||||
size_t bucket = vhashes[i].Name % vmax;
|
||||
vhashes[i].Next = vhashes[bucket].Head;
|
||||
vhashes[bucket].Head = i;
|
||||
}
|
||||
}
|
||||
|
||||
// scan all the lump names for each of the names, noting the highest frame letter.
|
||||
for (i = 0; i < sprites.Size(); ++i)
|
||||
{
|
||||
memset (sprtemp, 0xFF, sizeof(sprtemp));
|
||||
for (j = 0; j < MAX_SPRITE_FRAMES; ++j)
|
||||
{
|
||||
sprtemp[j].Flip = 0;
|
||||
sprtemp[j].Voxel = NULL;
|
||||
}
|
||||
|
||||
maxframe = -1;
|
||||
intname = sprites[i].dwName;
|
||||
|
||||
// scan the lumps, filling in the frames for whatever is found
|
||||
int hash = hashes[intname % smax].Head;
|
||||
while (hash != -1)
|
||||
{
|
||||
FTexture *tex = TexMan[hash];
|
||||
if (tex->dwName == intname)
|
||||
{
|
||||
bool res = R_InstallSpriteLump (FTextureID(hash), tex->Name[4] - 'A', tex->Name[5], false);
|
||||
|
||||
if (tex->Name[6] && res)
|
||||
R_InstallSpriteLump (FTextureID(hash), tex->Name[6] - 'A', tex->Name[7], true);
|
||||
}
|
||||
hash = hashes[hash].Next;
|
||||
}
|
||||
|
||||
// repeat, for voxels
|
||||
hash = vhashes[intname % vmax].Head;
|
||||
while (hash != -1)
|
||||
{
|
||||
VHasher *vh = &vhashes[hash];
|
||||
if (vh->Name == (int)intname)
|
||||
{
|
||||
FVoxelDef *voxdef = R_LoadVoxelDef(hash, vh->Spin);
|
||||
if (voxdef != NULL)
|
||||
{
|
||||
if (vh->Frame == ' ' || vh->Frame == '\0')
|
||||
{ // voxel applies to every sprite frame
|
||||
for (j = 0; j < MAX_SPRITE_FRAMES; ++j)
|
||||
{
|
||||
if (sprtemp[j].Voxel == NULL)
|
||||
{
|
||||
sprtemp[j].Voxel = voxdef;
|
||||
}
|
||||
}
|
||||
maxframe = MAX_SPRITE_FRAMES-1;
|
||||
}
|
||||
else
|
||||
{ // voxel applies to a specific frame
|
||||
j = vh->Frame - 'A';
|
||||
sprtemp[j].Voxel = voxdef;
|
||||
maxframe = MAX<int>(maxframe, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
hash = vh->Next;
|
||||
}
|
||||
|
||||
R_InstallSprite ((int)i);
|
||||
}
|
||||
|
||||
delete[] hashes;
|
||||
delete[] vhashes;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_ExtendSpriteFrames
|
||||
//
|
||||
// Extends a sprite so that it can hold the desired frame.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void R_ExtendSpriteFrames(spritedef_t &spr, int frame)
|
||||
{
|
||||
unsigned int i, newstart;
|
||||
|
||||
if (spr.numframes >= ++frame)
|
||||
{ // The sprite already has enough frames, so do nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
if (spr.numframes == 0 || (spr.spriteframes + spr.numframes == SpriteFrames.Size()))
|
||||
{ // Sprite's frames are at the end of the array, or it has no frames
|
||||
// at all, so we can tack the new frames directly on to the end
|
||||
// of the SpriteFrames array.
|
||||
newstart = SpriteFrames.Reserve(frame - spr.numframes);
|
||||
}
|
||||
else
|
||||
{ // We need to allocate space for all the sprite's frames and copy
|
||||
// the existing ones over to the new space. The old space will be
|
||||
// lost.
|
||||
newstart = SpriteFrames.Reserve(frame);
|
||||
for (i = 0; i < spr.numframes; ++i)
|
||||
{
|
||||
SpriteFrames[newstart + i] = SpriteFrames[spr.spriteframes + i];
|
||||
}
|
||||
spr.spriteframes = WORD(newstart);
|
||||
newstart += i;
|
||||
}
|
||||
// Initialize all new frames to 0.
|
||||
memset(&SpriteFrames[newstart], 0, sizeof(spriteframe_t)*(frame - spr.numframes));
|
||||
spr.numframes = frame;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// VOX_AddVoxel
|
||||
//
|
||||
// Sets a voxel for a single sprite frame.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def)
|
||||
{
|
||||
R_ExtendSpriteFrames(sprites[sprnum], frame);
|
||||
SpriteFrames[sprites[sprnum].spriteframes + frame].Voxel = def;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// [RH]
|
||||
// R_InitSkins
|
||||
// Reads in everything applicable to a skin. The skins should have already
|
||||
// been counted and had their identifiers assigned to namespaces.
|
||||
//
|
||||
#define NUMSKINSOUNDS 17
|
||||
static const char *skinsoundnames[NUMSKINSOUNDS][2] =
|
||||
{ // The *painXXX sounds must be the first four
|
||||
{ "dsplpain", "*pain100" },
|
||||
{ "dsplpain", "*pain75" },
|
||||
{ "dsplpain", "*pain50" },
|
||||
{ "dsplpain", "*pain25" },
|
||||
{ "dsplpain", "*poison" },
|
||||
|
||||
{ "dsoof", "*grunt" },
|
||||
{ "dsoof", "*land" },
|
||||
|
||||
{ "dspldeth", "*death" },
|
||||
{ "dspldeth", "*wimpydeath" },
|
||||
|
||||
{ "dspdiehi", "*xdeath" },
|
||||
{ "dspdiehi", "*crazydeath" },
|
||||
|
||||
{ "dsnoway", "*usefail" },
|
||||
{ "dsnoway", "*puzzfail" },
|
||||
|
||||
{ "dsslop", "*gibbed" },
|
||||
{ "dsslop", "*splat" },
|
||||
|
||||
{ "dspunch", "*fist" },
|
||||
{ "dsjump", "*jump" }
|
||||
};
|
||||
|
||||
/*
|
||||
static int STACK_ARGS skinsorter (const void *a, const void *b)
|
||||
{
|
||||
return stricmp (((FPlayerSkin *)a)->name, ((FPlayerSkin *)b)->name);
|
||||
}
|
||||
*/
|
||||
|
||||
void R_InitSkins (void)
|
||||
{
|
||||
FSoundID playersoundrefs[NUMSKINSOUNDS];
|
||||
spritedef_t temp;
|
||||
int sndlumps[NUMSKINSOUNDS];
|
||||
char key[65];
|
||||
DWORD intname, crouchname;
|
||||
size_t i;
|
||||
int j, k, base;
|
||||
int lastlump;
|
||||
int aliasid;
|
||||
bool remove;
|
||||
const PClass *basetype, *transtype;
|
||||
|
||||
key[sizeof(key)-1] = 0;
|
||||
i = PlayerClasses.Size () - 1;
|
||||
lastlump = 0;
|
||||
|
||||
for (j = 0; j < NUMSKINSOUNDS; ++j)
|
||||
{
|
||||
playersoundrefs[j] = skinsoundnames[j][1];
|
||||
}
|
||||
|
||||
while ((base = Wads.FindLump ("S_SKIN", &lastlump, true)) != -1)
|
||||
{
|
||||
// The player sprite has 23 frames. This means that the S_SKIN
|
||||
// marker needs a minimum of 23 lumps after it.
|
||||
if (base >= Wads.GetNumLumps() - 23 || base == -1)
|
||||
continue;
|
||||
|
||||
i++;
|
||||
for (j = 0; j < NUMSKINSOUNDS; j++)
|
||||
sndlumps[j] = -1;
|
||||
skins[i].namespc = Wads.GetLumpNamespace (base);
|
||||
|
||||
FScanner sc(base);
|
||||
intname = 0;
|
||||
crouchname = 0;
|
||||
|
||||
remove = false;
|
||||
basetype = NULL;
|
||||
transtype = NULL;
|
||||
|
||||
// Data is stored as "key = data".
|
||||
while (sc.GetString ())
|
||||
{
|
||||
strncpy (key, sc.String, sizeof(key)-1);
|
||||
if (!sc.GetString() || sc.String[0] != '=')
|
||||
{
|
||||
Printf (PRINT_BOLD, "Bad format for skin %d: %s\n", (int)i, key);
|
||||
break;
|
||||
}
|
||||
sc.GetString ();
|
||||
if (0 == stricmp (key, "name"))
|
||||
{
|
||||
strncpy (skins[i].name, sc.String, 16);
|
||||
for (j = 0; (size_t)j < i; j++)
|
||||
{
|
||||
if (stricmp (skins[i].name, skins[j].name) == 0)
|
||||
{
|
||||
mysnprintf (skins[i].name, countof(skins[i].name), "skin%d", (int)i);
|
||||
Printf (PRINT_BOLD, "Skin %s duplicated as %s\n",
|
||||
skins[j].name, skins[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (0 == stricmp (key, "sprite"))
|
||||
{
|
||||
for (j = 3; j >= 0; j--)
|
||||
sc.String[j] = toupper (sc.String[j]);
|
||||
intname = *((DWORD *)sc.String);
|
||||
}
|
||||
else if (0 == stricmp (key, "crouchsprite"))
|
||||
{
|
||||
for (j = 3; j >= 0; j--)
|
||||
sc.String[j] = toupper (sc.String[j]);
|
||||
crouchname = *((DWORD *)sc.String);
|
||||
}
|
||||
else if (0 == stricmp (key, "face"))
|
||||
{
|
||||
for (j = 2; j >= 0; j--)
|
||||
skins[i].face[j] = toupper (sc.String[j]);
|
||||
skins[i].face[3] = '\0';
|
||||
}
|
||||
else if (0 == stricmp (key, "gender"))
|
||||
{
|
||||
skins[i].gender = D_GenderToInt (sc.String);
|
||||
}
|
||||
else if (0 == stricmp (key, "scale"))
|
||||
{
|
||||
skins[i].ScaleX = clamp<fixed_t> (FLOAT2FIXED(atof (sc.String)), 1, 256*FRACUNIT);
|
||||
skins[i].ScaleY = skins[i].ScaleX;
|
||||
}
|
||||
else if (0 == stricmp (key, "game"))
|
||||
{
|
||||
if (gameinfo.gametype == GAME_Heretic)
|
||||
basetype = PClass::FindClass (NAME_HereticPlayer);
|
||||
else if (gameinfo.gametype == GAME_Strife)
|
||||
basetype = PClass::FindClass (NAME_StrifePlayer);
|
||||
else
|
||||
basetype = PClass::FindClass (NAME_DoomPlayer);
|
||||
|
||||
transtype = basetype;
|
||||
|
||||
if (stricmp (sc.String, "heretic") == 0)
|
||||
{
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
transtype = PClass::FindClass (NAME_HereticPlayer);
|
||||
skins[i].othergame = true;
|
||||
}
|
||||
else if (gameinfo.gametype != GAME_Heretic)
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
else if (stricmp (sc.String, "strife") == 0)
|
||||
{
|
||||
if (gameinfo.gametype != GAME_Strife)
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameinfo.gametype == GAME_Heretic)
|
||||
{
|
||||
transtype = PClass::FindClass (NAME_DoomPlayer);
|
||||
skins[i].othergame = true;
|
||||
}
|
||||
else if (!(gameinfo.gametype & GAME_DoomChex))
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (remove)
|
||||
break;
|
||||
}
|
||||
else if (0 == stricmp (key, "class"))
|
||||
{ // [GRB] Define the skin for a specific player class
|
||||
int pclass = D_PlayerClassToInt (sc.String);
|
||||
|
||||
if (pclass < 0)
|
||||
{
|
||||
remove = true;
|
||||
break;
|
||||
}
|
||||
|
||||
basetype = transtype = PlayerClasses[pclass].Type;
|
||||
}
|
||||
else if (key[0] == '*')
|
||||
{ // Player sound replacment (ZDoom extension)
|
||||
int lump = Wads.CheckNumForName (sc.String, skins[i].namespc);
|
||||
if (lump == -1)
|
||||
{
|
||||
lump = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
|
||||
}
|
||||
if (lump != -1)
|
||||
{
|
||||
if (stricmp (key, "*pain") == 0)
|
||||
{ // Replace all pain sounds in one go
|
||||
aliasid = S_AddPlayerSound (skins[i].name, skins[i].gender,
|
||||
playersoundrefs[0], lump, true);
|
||||
for (int l = 3; l > 0; --l)
|
||||
{
|
||||
S_AddPlayerSoundExisting (skins[i].name, skins[i].gender,
|
||||
playersoundrefs[l], aliasid, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int sndref = S_FindSoundNoHash (key);
|
||||
if (sndref != 0)
|
||||
{
|
||||
S_AddPlayerSound (skins[i].name, skins[i].gender, sndref, lump, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < NUMSKINSOUNDS; j++)
|
||||
{
|
||||
if (stricmp (key, skinsoundnames[j][0]) == 0)
|
||||
{
|
||||
sndlumps[j] = Wads.CheckNumForName (sc.String, skins[i].namespc);
|
||||
if (sndlumps[j] == -1)
|
||||
{ // Replacement not found, try finding it in the global namespace
|
||||
sndlumps[j] = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (j == 8)
|
||||
// Printf ("Funny info for skin %i: %s = %s\n", i, key, sc.String);
|
||||
}
|
||||
}
|
||||
|
||||
// [GRB] Assume Doom skin by default
|
||||
if (!remove && basetype == NULL)
|
||||
{
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
basetype = transtype = PClass::FindClass (NAME_DoomPlayer);
|
||||
}
|
||||
else if (gameinfo.gametype == GAME_Heretic)
|
||||
{
|
||||
basetype = PClass::FindClass (NAME_HereticPlayer);
|
||||
transtype = PClass::FindClass (NAME_DoomPlayer);
|
||||
skins[i].othergame = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!remove)
|
||||
{
|
||||
skins[i].range0start = transtype->Meta.GetMetaInt (APMETA_ColorRange) & 0xff;
|
||||
skins[i].range0end = transtype->Meta.GetMetaInt (APMETA_ColorRange) >> 8;
|
||||
|
||||
remove = true;
|
||||
for (j = 0; j < (int)PlayerClasses.Size (); j++)
|
||||
{
|
||||
const PClass *type = PlayerClasses[j].Type;
|
||||
|
||||
if (type->IsDescendantOf (basetype) &&
|
||||
GetDefaultByType (type)->SpawnState->sprite == GetDefaultByType (basetype)->SpawnState->sprite &&
|
||||
type->Meta.GetMetaInt (APMETA_ColorRange) == basetype->Meta.GetMetaInt (APMETA_ColorRange))
|
||||
{
|
||||
PlayerClasses[j].Skins.Push ((int)i);
|
||||
remove = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!remove)
|
||||
{
|
||||
if (skins[i].name[0] == 0)
|
||||
mysnprintf (skins[i].name, countof(skins[i].name), "skin%d", (int)i);
|
||||
|
||||
// Now collect the sprite frames for this skin. If the sprite name was not
|
||||
// specified, use whatever immediately follows the specifier lump.
|
||||
if (intname == 0)
|
||||
{
|
||||
char name[9];
|
||||
Wads.GetLumpName (name, base+1);
|
||||
memcpy(&intname, name, 4);
|
||||
}
|
||||
|
||||
int basens = Wads.GetLumpNamespace(base);
|
||||
|
||||
for(int spr = 0; spr<2; spr++)
|
||||
{
|
||||
memset (sprtemp, 0xFFFF, sizeof(sprtemp));
|
||||
for (k = 0; k < MAX_SPRITE_FRAMES; ++k)
|
||||
{
|
||||
sprtemp[k].Flip = 0;
|
||||
sprtemp[k].Voxel = NULL;
|
||||
}
|
||||
maxframe = -1;
|
||||
|
||||
if (spr == 1)
|
||||
{
|
||||
if (crouchname !=0 && crouchname != intname)
|
||||
{
|
||||
intname = crouchname;
|
||||
}
|
||||
else
|
||||
{
|
||||
skins[i].crouchsprite = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (k = base + 1; Wads.GetLumpNamespace(k) == basens; k++)
|
||||
{
|
||||
char lname[9];
|
||||
DWORD lnameint;
|
||||
Wads.GetLumpName (lname, k);
|
||||
memcpy(&lnameint, lname, 4);
|
||||
if (lnameint == intname)
|
||||
{
|
||||
FTextureID picnum = TexMan.CreateTexture(k, FTexture::TEX_SkinSprite);
|
||||
bool res = R_InstallSpriteLump (picnum, lname[4] - 'A', lname[5], false);
|
||||
|
||||
if (lname[6] && res)
|
||||
R_InstallSpriteLump (picnum, lname[6] - 'A', lname[7], true);
|
||||
}
|
||||
}
|
||||
|
||||
if (spr == 0 && maxframe <= 0)
|
||||
{
|
||||
Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, (int)i);
|
||||
remove = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Wads.GetLumpName (temp.name, base+1);
|
||||
temp.name[4] = 0;
|
||||
int sprno = (int)sprites.Push (temp);
|
||||
if (spr==0) skins[i].sprite = sprno;
|
||||
else skins[i].crouchsprite = sprno;
|
||||
R_InstallSprite (sprno);
|
||||
}
|
||||
}
|
||||
|
||||
if (remove)
|
||||
{
|
||||
if (i < numskins-1)
|
||||
memmove (&skins[i], &skins[i+1], sizeof(skins[0])*(numskins-i-1));
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Register any sounds this skin provides
|
||||
aliasid = 0;
|
||||
for (j = 0; j < NUMSKINSOUNDS; j++)
|
||||
{
|
||||
if (sndlumps[j] != -1)
|
||||
{
|
||||
if (j == 0 || sndlumps[j] != sndlumps[j-1])
|
||||
{
|
||||
aliasid = S_AddPlayerSound (skins[i].name, skins[i].gender,
|
||||
playersoundrefs[j], sndlumps[j], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_AddPlayerSoundExisting (skins[i].name, skins[i].gender,
|
||||
playersoundrefs[j], aliasid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure face prefix is a full 3 chars
|
||||
if (skins[i].face[1] == 0 || skins[i].face[2] == 0)
|
||||
{
|
||||
skins[i].face[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (numskins > PlayerClasses.Size ())
|
||||
{ // The sound table may have changed, so rehash it.
|
||||
S_HashSounds ();
|
||||
S_ShrinkPlayerSoundLists ();
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Find a skin by name
|
||||
int R_FindSkin (const char *name, int pclass)
|
||||
{
|
||||
if (stricmp ("base", name) == 0)
|
||||
{
|
||||
return pclass;
|
||||
}
|
||||
|
||||
for (unsigned i = PlayerClasses.Size(); i < numskins; i++)
|
||||
{
|
||||
if (strnicmp (skins[i].name, name, 16) == 0)
|
||||
{
|
||||
if (PlayerClasses[pclass].CheckSkin (i))
|
||||
return i;
|
||||
else
|
||||
return pclass;
|
||||
}
|
||||
}
|
||||
return pclass;
|
||||
}
|
||||
|
||||
// [RH] List the names of all installed skins
|
||||
CCMD (skins)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = PlayerClasses.Size ()-1; i < (int)numskins; i++)
|
||||
Printf ("% 3d %s\n", i-PlayerClasses.Size ()+1, skins[i].name);
|
||||
}
|
||||
|
||||
|
||||
static void R_CreateSkinTranslation (const char *palname)
|
||||
{
|
||||
FMemLump lump = Wads.ReadLump (palname);
|
||||
const BYTE *otherPal = (BYTE *)lump.GetMem();
|
||||
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
OtherGameSkinRemap[i] = ColorMatcher.Pick (otherPal[0], otherPal[1], otherPal[2]);
|
||||
OtherGameSkinPalette[i] = PalEntry(otherPal[0], otherPal[1], otherPal[2]);
|
||||
otherPal += 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// R_InitSprites
|
||||
// Called at program start.
|
||||
//
|
||||
void R_InitSprites ()
|
||||
{
|
||||
int lump, lastlump;
|
||||
unsigned int i, j;
|
||||
|
||||
// [RH] Create a standard translation to map skins between Heretic and Doom
|
||||
if (gameinfo.gametype == GAME_DoomChex)
|
||||
{
|
||||
R_CreateSkinTranslation ("SPALHTIC");
|
||||
}
|
||||
else
|
||||
{
|
||||
R_CreateSkinTranslation ("SPALDOOM");
|
||||
}
|
||||
|
||||
// [RH] Count the number of skins.
|
||||
numskins = PlayerClasses.Size ();
|
||||
lastlump = 0;
|
||||
while ((lump = Wads.FindLump ("S_SKIN", &lastlump, true)) != -1)
|
||||
{
|
||||
numskins++;
|
||||
}
|
||||
|
||||
SpriteFrames.Clear();
|
||||
|
||||
// [RH] Do some preliminary setup
|
||||
if (skins != NULL) delete [] skins;
|
||||
skins = new FPlayerSkin[numskins];
|
||||
memset (skins, 0, sizeof(*skins) * numskins);
|
||||
for (i = 0; i < numskins; i++)
|
||||
{ // Assume Doom skin by default
|
||||
const PClass *type = PlayerClasses[0].Type;
|
||||
skins[i].range0start = type->Meta.GetMetaInt (APMETA_ColorRange) & 255;
|
||||
skins[i].range0end = type->Meta.GetMetaInt (APMETA_ColorRange) >> 8;
|
||||
skins[i].ScaleX = GetDefaultByType (type)->scaleX;
|
||||
skins[i].ScaleY = GetDefaultByType (type)->scaleY;
|
||||
}
|
||||
|
||||
R_InitSpriteDefs ();
|
||||
R_InitVoxels(); // [RH] Parse VOXELDEF
|
||||
NumStdSprites = sprites.Size();
|
||||
R_InitSkins (); // [RH] Finish loading skin data
|
||||
|
||||
// [RH] Set up base skin
|
||||
// [GRB] Each player class has its own base skin
|
||||
for (i = 0; i < PlayerClasses.Size (); i++)
|
||||
{
|
||||
const PClass *basetype = PlayerClasses[i].Type;
|
||||
const char *pclassface = basetype->Meta.GetMetaString (APMETA_Face);
|
||||
|
||||
strcpy (skins[i].name, "Base");
|
||||
if (pclassface == NULL || strcmp(pclassface, "None") == 0)
|
||||
{
|
||||
skins[i].face[0] = 'S';
|
||||
skins[i].face[1] = 'T';
|
||||
skins[i].face[2] = 'F';
|
||||
skins[i].face[3] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(skins[i].face, pclassface);
|
||||
}
|
||||
skins[i].range0start = basetype->Meta.GetMetaInt (APMETA_ColorRange) & 255;
|
||||
skins[i].range0end = basetype->Meta.GetMetaInt (APMETA_ColorRange) >> 8;
|
||||
skins[i].ScaleX = GetDefaultByType (basetype)->scaleX;
|
||||
skins[i].ScaleY = GetDefaultByType (basetype)->scaleY;
|
||||
skins[i].sprite = GetDefaultByType (basetype)->SpawnState->sprite;
|
||||
skins[i].namespc = ns_global;
|
||||
|
||||
PlayerClasses[i].Skins.Push (i);
|
||||
|
||||
if (memcmp (sprites[skins[i].sprite].name, "PLAY", 4) == 0)
|
||||
{
|
||||
for (j = 0; j < sprites.Size (); j++)
|
||||
{
|
||||
if (memcmp (sprites[j].name, deh.PlayerSprite, 4) == 0)
|
||||
{
|
||||
skins[i].sprite = (int)j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Sort the skins, but leave base as skin 0
|
||||
//qsort (&skins[PlayerClasses.Size ()], numskins-PlayerClasses.Size (), sizeof(FPlayerSkin), skinsorter);
|
||||
}
|
||||
|
||||
void R_DeinitSpriteData()
|
||||
{
|
||||
// Free skins
|
||||
if (skins != NULL)
|
||||
{
|
||||
delete[] skins;
|
||||
skins = NULL;
|
||||
}
|
||||
}
|
69
src/r_data/sprites.h
Normal file
69
src/r_data/sprites.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
#ifndef __RES_SPRITES_H
|
||||
#define __RES_SPRITES_H
|
||||
|
||||
#define MAX_SPRITE_FRAMES 29 // [RH] Macro-ized as in BOOM.
|
||||
|
||||
//
|
||||
// Sprites are patches with a special naming convention so they can be
|
||||
// recognized by R_InitSprites. The base name is NNNNFx or NNNNFxFx, with
|
||||
// x indicating the rotation, x = 0, 1-7. The sprite and frame specified
|
||||
// by a thing_t is range checked at run time.
|
||||
// A sprite is a patch_t that is assumed to represent a three dimensional
|
||||
// object and may have multiple rotations pre drawn. Horizontal flipping
|
||||
// is used to save space, thus NNNNF2F5 defines a mirrored patch.
|
||||
// Some sprites will only have one picture used for all views: NNNNF0
|
||||
//
|
||||
struct spriteframe_t
|
||||
{
|
||||
struct FVoxelDef *Voxel;// voxel to use for this frame
|
||||
FTextureID Texture[16]; // texture to use for view angles 0-15
|
||||
WORD Flip; // flip (1 = flip) to use for view angles 0-15.
|
||||
};
|
||||
|
||||
//
|
||||
// A sprite definition:
|
||||
// a number of animation frames.
|
||||
//
|
||||
|
||||
struct spritedef_t
|
||||
{
|
||||
union
|
||||
{
|
||||
char name[5];
|
||||
DWORD dwName;
|
||||
};
|
||||
BYTE numframes;
|
||||
WORD spriteframes;
|
||||
};
|
||||
|
||||
extern TArray<spriteframe_t> SpriteFrames;
|
||||
|
||||
|
||||
//
|
||||
// [RH] Internal "skin" definition.
|
||||
//
|
||||
class FPlayerSkin
|
||||
{
|
||||
public:
|
||||
char name[17]; // 16 chars + NULL
|
||||
char face[4]; // 3 chars ([MH] + NULL so can use as a C string)
|
||||
BYTE gender; // This skin's gender (not really used)
|
||||
BYTE range0start;
|
||||
BYTE range0end;
|
||||
bool othergame; // [GRB]
|
||||
fixed_t ScaleX;
|
||||
fixed_t ScaleY;
|
||||
int sprite;
|
||||
int crouchsprite;
|
||||
int namespc; // namespace for this skin
|
||||
};
|
||||
|
||||
extern size_t numskins; // [RH]
|
||||
extern FPlayerSkin * skins; // [RH]
|
||||
|
||||
extern BYTE OtherGameSkinRemap[256];
|
||||
extern PalEntry OtherGameSkinPalette[256];
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -58,12 +58,9 @@
|
|||
#include "d_net.h"
|
||||
#include "colormatcher.h"
|
||||
#include "d_netinf.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_plane.h"
|
||||
#include "r_segs.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_translate.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "voxels.h"
|
||||
|
||||
void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def);
|
62
src/r_defs.h
62
src/r_defs.h
|
@ -334,6 +334,9 @@ struct secplane_t
|
|||
{
|
||||
return -TMulScale16 (a, v->x, b, v->y, z, c);
|
||||
}
|
||||
|
||||
bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const;
|
||||
|
||||
};
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, secplane_t &plane)
|
||||
|
@ -478,6 +481,8 @@ struct sector_t
|
|||
void SetColor(int r, int g, int b, int desat);
|
||||
void SetFade(int r, int g, int b);
|
||||
void ClosestPoint(fixed_t x, fixed_t y, fixed_t &ox, fixed_t &oy) const;
|
||||
int GetFloorLight () const;
|
||||
int GetCeilingLight () const;
|
||||
|
||||
DInterpolation *SetInterpolation(int position, bool attach);
|
||||
void StopInterpolation(int position);
|
||||
|
@ -1089,6 +1094,7 @@ struct subsector_t
|
|||
DWORD numlines;
|
||||
int flags;
|
||||
|
||||
void BuildPolyBSP();
|
||||
// subsector related GL data
|
||||
FLightNode * lighthead[2]; // Light nodes (blended and additive)
|
||||
int validcount;
|
||||
|
@ -1125,8 +1131,6 @@ struct node_t
|
|||
|
||||
struct FMiniBSP
|
||||
{
|
||||
FMiniBSP();
|
||||
|
||||
bool bDirty;
|
||||
|
||||
TArray<node_t> Nodes;
|
||||
|
@ -1187,60 +1191,6 @@ enum
|
|||
FAKED_AboveCeiling
|
||||
};
|
||||
|
||||
//
|
||||
// Sprites are patches with a special naming convention so they can be
|
||||
// recognized by R_InitSprites. The base name is NNNNFx or NNNNFxFx, with
|
||||
// x indicating the rotation, x = 0, 1-7. The sprite and frame specified
|
||||
// by a thing_t is range checked at run time.
|
||||
// A sprite is a patch_t that is assumed to represent a three dimensional
|
||||
// object and may have multiple rotations pre drawn. Horizontal flipping
|
||||
// is used to save space, thus NNNNF2F5 defines a mirrored patch.
|
||||
// Some sprites will only have one picture used for all views: NNNNF0
|
||||
//
|
||||
struct spriteframe_t
|
||||
{
|
||||
struct FVoxelDef *Voxel;// voxel to use for this frame
|
||||
FTextureID Texture[16]; // texture to use for view angles 0-15
|
||||
WORD Flip; // flip (1 = flip) to use for view angles 0-15.
|
||||
};
|
||||
|
||||
//
|
||||
// A sprite definition:
|
||||
// a number of animation frames.
|
||||
//
|
||||
|
||||
struct spritedef_t
|
||||
{
|
||||
union
|
||||
{
|
||||
char name[5];
|
||||
DWORD dwName;
|
||||
};
|
||||
BYTE numframes;
|
||||
WORD spriteframes;
|
||||
};
|
||||
|
||||
extern TArray<spriteframe_t> SpriteFrames;
|
||||
|
||||
//
|
||||
// [RH] Internal "skin" definition.
|
||||
//
|
||||
class FPlayerSkin
|
||||
{
|
||||
public:
|
||||
char name[17]; // 16 chars + NULL
|
||||
char face[4]; // 3 chars ([MH] + NULL so can use as a C string)
|
||||
BYTE gender; // This skin's gender (not really used)
|
||||
BYTE range0start;
|
||||
BYTE range0end;
|
||||
bool othergame; // [GRB]
|
||||
fixed_t ScaleX;
|
||||
fixed_t ScaleY;
|
||||
int sprite;
|
||||
int crouchsprite;
|
||||
int namespc; // namespace for this skin
|
||||
};
|
||||
|
||||
|
||||
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
||||
|
||||
|
|
288
src/r_draw.cpp
288
src/r_draw.cpp
|
@ -36,9 +36,9 @@
|
|||
#include "a_hexenglobal.h"
|
||||
#include "g_game.h"
|
||||
#include "g_level.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#include "gi.h"
|
||||
#include "stats.h"
|
||||
|
@ -125,67 +125,48 @@ BYTE shadetables[NUMCOLORMAPS*16*256];
|
|||
FDynamicColormap ShadeFakeColormap[16];
|
||||
BYTE identitymap[256];
|
||||
|
||||
// Convert legacy render styles to flexible render styles.
|
||||
EXTERN_CVAR (Int, r_columnmethod)
|
||||
|
||||
// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
|
||||
// rather than the struct before it, which goes against the standard.
|
||||
#ifndef __APPLE__
|
||||
FRenderStyle LegacyRenderStyles[STYLE_Count] =
|
||||
{
|
||||
/* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
|
||||
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
|
||||
/* STYLE_Fuzzy */ {{ STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_SoulTrans */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha }},
|
||||
/* STYLE_OptFuzzy */ {{ STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_Stencil */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed }},
|
||||
/* STYLE_Translucent */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 }},
|
||||
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
|
||||
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
|
||||
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
|
||||
/* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }},
|
||||
};
|
||||
#else
|
||||
FRenderStyle LegacyRenderStyles[STYLE_Count];
|
||||
|
||||
static const BYTE Styles[STYLE_Count * 4] =
|
||||
void R_InitShadeMaps()
|
||||
{
|
||||
STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1,
|
||||
STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha,
|
||||
STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
|
||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
|
||||
STYLEOP_Shadow, 0, 0, 0
|
||||
};
|
||||
int i,j;
|
||||
// set up shading tables for shaded columns
|
||||
// 16 colormap sets, progressing from full alpha to minimum visible alpha
|
||||
|
||||
static struct LegacyInit
|
||||
{
|
||||
LegacyInit()
|
||||
BYTE *table = shadetables;
|
||||
|
||||
// Full alpha
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
for (int i = 0; i < STYLE_Count; ++i)
|
||||
ShadeFakeColormap[i].Color = ~0u;
|
||||
ShadeFakeColormap[i].Desaturate = ~0u;
|
||||
ShadeFakeColormap[i].Next = NULL;
|
||||
ShadeFakeColormap[i].Maps = table;
|
||||
|
||||
for (j = 0; j < NUMCOLORMAPS; ++j)
|
||||
{
|
||||
LegacyRenderStyles[i].BlendOp = Styles[i*4];
|
||||
LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
|
||||
LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
|
||||
LegacyRenderStyles[i].Flags = Styles[i*4+3];
|
||||
int a = (NUMCOLORMAPS - j) * 256 / NUMCOLORMAPS * (16-i);
|
||||
for (int k = 0; k < 256; ++k)
|
||||
{
|
||||
BYTE v = (((k+2) * a) + 256) >> 14;
|
||||
table[k] = MIN<BYTE> (v, 64);
|
||||
}
|
||||
table += 256;
|
||||
}
|
||||
}
|
||||
} DoLegacyInit;
|
||||
for (i = 0; i < NUMCOLORMAPS*16*256; ++i)
|
||||
{
|
||||
assert(shadetables[i] <= 64);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
|
||||
{
|
||||
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
|
||||
return arc;
|
||||
// Set up a guaranteed identity map
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
identitymap[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
EXTERN_CVAR (Int, r_columnmethod)
|
||||
|
||||
/************************************/
|
||||
/* */
|
||||
/* Palettized drawers (C versions) */
|
||||
|
@ -2020,29 +2001,6 @@ void tmvline4_revsubclamp ()
|
|||
}
|
||||
|
||||
|
||||
void R_DrawBorder (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
FTextureID picnum;
|
||||
|
||||
if (level.info != NULL && level.info->bordertexture[0] != 0)
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (level.info->bordertexture, FTexture::TEX_Flat);
|
||||
}
|
||||
else
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
|
||||
}
|
||||
|
||||
if (picnum.isValid())
|
||||
{
|
||||
screen->FlatFill (x1, y1, x2, y2, TexMan(picnum));
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->Clear (x1, y1, x2, y2, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_GetColumn
|
||||
|
@ -2055,91 +2013,6 @@ const BYTE *R_GetColumn (FTexture *tex, int col)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
=
|
||||
= R_DrawViewBorder
|
||||
=
|
||||
= Draws the border around the view for different size windows
|
||||
==================
|
||||
*/
|
||||
|
||||
int BorderNeedRefresh;
|
||||
|
||||
void V_MarkRect (int x, int y, int width, int height);
|
||||
void V_DrawFrame (int x, int y, int width, int height);
|
||||
|
||||
void R_DrawViewBorder (void)
|
||||
{
|
||||
// [RH] Redraw the status bar if SCREENWIDTH > status bar width.
|
||||
// Will draw borders around itself, too.
|
||||
if (SCREENWIDTH > 320)
|
||||
{
|
||||
SB_state = screen->GetPageCount ();
|
||||
}
|
||||
|
||||
if (viewwidth == SCREENWIDTH)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
R_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
|
||||
R_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
R_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
|
||||
R_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);
|
||||
|
||||
V_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
=
|
||||
= R_DrawTopBorder
|
||||
=
|
||||
= Draws the top border around the view for different size windows
|
||||
==================
|
||||
*/
|
||||
|
||||
int BorderTopRefresh;
|
||||
|
||||
void R_DrawTopBorder ()
|
||||
{
|
||||
FTexture *p;
|
||||
int offset;
|
||||
|
||||
if (viewwidth == SCREENWIDTH)
|
||||
return;
|
||||
|
||||
offset = gameinfo.border->offset;
|
||||
|
||||
if (viewwindowy < 34)
|
||||
{
|
||||
R_DrawBorder (0, 0, viewwindowx, 34);
|
||||
R_DrawBorder (viewwindowx, 0, viewwindowx + viewwidth, viewwindowy);
|
||||
R_DrawBorder (viewwindowx + viewwidth, 0, SCREENWIDTH, 34);
|
||||
p = TexMan(gameinfo.border->t);
|
||||
screen->FlatFill(viewwindowx, viewwindowy - p->GetHeight(),
|
||||
viewwindowx + viewwidth, viewwindowy, p, true);
|
||||
|
||||
p = TexMan(gameinfo.border->l);
|
||||
screen->FlatFill(viewwindowx - p->GetWidth(), viewwindowy,
|
||||
viewwindowx, 35, p, true);
|
||||
p = TexMan(gameinfo.border->r);
|
||||
screen->FlatFill(viewwindowx + viewwidth, viewwindowy,
|
||||
viewwindowx + viewwidth + p->GetWidth(), 35, p, true);
|
||||
|
||||
p = TexMan(gameinfo.border->tl);
|
||||
screen->DrawTexture (p, viewwindowx - offset, viewwindowy - offset, TAG_DONE);
|
||||
|
||||
p = TexMan(gameinfo.border->tr);
|
||||
screen->DrawTexture (p, viewwindowx + viewwidth, viewwindowy - offset, TAG_DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_DrawBorder (0, 0, SCREENWIDTH, 34);
|
||||
}
|
||||
}
|
||||
// [RH] Initialize the column drawer pointers
|
||||
void R_InitColumnDrawers ()
|
||||
{
|
||||
|
@ -2175,8 +2048,8 @@ void R_InitColumnDrawers ()
|
|||
|
||||
// [RH] Choose column drawers in a single place
|
||||
EXTERN_CVAR (Int, r_drawfuzz)
|
||||
EXTERN_CVAR (Bool, r_drawtrans)
|
||||
EXTERN_CVAR (Float, transsouls)
|
||||
CVAR (Bool, r_drawtrans, true, 0)
|
||||
|
||||
static FDynamicColormap *basecolormapsave;
|
||||
|
||||
|
@ -2323,18 +2196,6 @@ static bool R_SetBlendFunc (int op, fixed_t fglevel, fixed_t bglevel, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
static fixed_t GetAlpha(int type, fixed_t alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return FRACUNIT;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, DWORD color)
|
||||
{
|
||||
fixed_t fglevel, bglevel;
|
||||
|
@ -2461,84 +2322,3 @@ bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)())
|
|||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRenderStyle :: IsVisible
|
||||
//
|
||||
// Coupled with the given alpha, will this render style produce something
|
||||
// visible on-screen?
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
|
||||
{
|
||||
if (BlendOp == STYLEOP_None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (BlendOp == STYLEOP_Add || BlendOp == STYLEOP_RevSub)
|
||||
{
|
||||
if (Flags & STYLEF_Alpha1)
|
||||
{
|
||||
alpha = FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp(alpha, 0, FRACUNIT);
|
||||
}
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
|
||||
}
|
||||
// Treat anything else as visible.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRenderStyle :: CheckFuzz
|
||||
//
|
||||
// Adjusts settings based on r_drawfuzz CVAR
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FRenderStyle::CheckFuzz()
|
||||
{
|
||||
switch (BlendOp)
|
||||
{
|
||||
default:
|
||||
return;
|
||||
|
||||
case STYLEOP_FuzzOrAdd:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_Add;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLEOP_FuzzOrSub:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_Sub;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLEOP_FuzzOrRevSub:
|
||||
if (r_drawtrans && r_drawfuzz == 0)
|
||||
{
|
||||
BlendOp = STYLEOP_RevSub;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (r_drawfuzz == 2)
|
||||
{
|
||||
BlendOp = STYLEOP_Shadow;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlendOp = STYLEOP_Fuzz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,13 +251,8 @@ extern FDynamicColormap ShadeFakeColormap[16];
|
|||
extern BYTE identitymap[256];
|
||||
extern BYTE *dc_translation;
|
||||
|
||||
|
||||
// If the view size is not full screen, draws a border around it.
|
||||
void R_DrawViewBorder (void);
|
||||
void R_DrawTopBorder (void);
|
||||
void R_DrawBorder (int x1, int y1, int x2, int y2);
|
||||
|
||||
// [RH] Added for muliresolution support
|
||||
void R_InitShadeMaps();
|
||||
void R_InitFuzzTable (int fuzzoff);
|
||||
|
||||
// [RH] Consolidate column drawer selection
|
||||
|
|
30
src/r_jpeg.h
30
src/r_jpeg.h
|
@ -1,30 +0,0 @@
|
|||
#ifndef __R_JPEG_H
|
||||
#define __R_JPEG_H
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <jpeglib.h>
|
||||
}
|
||||
|
||||
class FileReader;
|
||||
|
||||
|
||||
struct FLumpSourceMgr : public jpeg_source_mgr
|
||||
{
|
||||
FileReader *Lump;
|
||||
JOCTET Buffer[4096];
|
||||
bool StartOfFile;
|
||||
|
||||
FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo);
|
||||
static void InitSource (j_decompress_ptr cinfo);
|
||||
static boolean FillInputBuffer (j_decompress_ptr cinfo);
|
||||
static void SkipInputData (j_decompress_ptr cinfo, long num_bytes);
|
||||
static void TermSource (j_decompress_ptr cinfo);
|
||||
};
|
||||
|
||||
|
||||
void JPEG_ErrorExit (j_common_ptr cinfo);
|
||||
void JPEG_OutputMessage (j_common_ptr cinfo);
|
||||
|
||||
|
||||
#endif
|
|
@ -44,9 +44,9 @@
|
|||
#include "i_video.h"
|
||||
#include "i_system.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "p_3dmidtex.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "r_bsp.h"
|
||||
#include "r_plane.h"
|
||||
#include "r_3dfloors.h"
|
||||
|
@ -54,7 +54,7 @@
|
|||
#include "po_man.h"
|
||||
#include "st_start.h"
|
||||
#include "v_font.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
//#include "gl/data/gl_data.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
|
@ -816,6 +816,8 @@ void R_Init ()
|
|||
{
|
||||
atterm (R_Shutdown);
|
||||
|
||||
clearbufshort (zeroarray, MAXWIDTH, 0);
|
||||
|
||||
StartScreen->Progress();
|
||||
V_InitFonts();
|
||||
StartScreen->Progress();
|
||||
|
@ -830,6 +832,7 @@ void R_Init ()
|
|||
R_SetViewSize (screenblocks);
|
||||
R_InitPlanes ();
|
||||
R_InitTranslationTables ();
|
||||
R_InitShadeMaps();
|
||||
R_InitParticles (); // [RH] Setup particle engine
|
||||
R_InitColumnDrawers ();
|
||||
|
||||
|
@ -1408,35 +1411,6 @@ void R_SetupFrame (AActor *actor)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_RefreshViewBorder
|
||||
//
|
||||
// Draws the border around the player view, if needed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_RefreshViewBorder ()
|
||||
{
|
||||
if (setblocks < 10)
|
||||
{
|
||||
if (BorderNeedRefresh)
|
||||
{
|
||||
BorderNeedRefresh--;
|
||||
if (BorderTopRefresh)
|
||||
{
|
||||
BorderTopRefresh--;
|
||||
}
|
||||
R_DrawViewBorder();
|
||||
}
|
||||
else if (BorderTopRefresh)
|
||||
{
|
||||
BorderTopRefresh--;
|
||||
R_DrawTopBorder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_EnterMirror
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "d_player.h"
|
||||
#include "r_state.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
|
||||
//
|
||||
|
@ -186,7 +186,6 @@ void R_SetViewAngle ();
|
|||
|
||||
// Called by G_Drawer.
|
||||
void R_RenderActorView (AActor *actor, bool dontmaplines = false);
|
||||
void R_RefreshViewBorder ();
|
||||
void R_SetupBuffer ();
|
||||
|
||||
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "r_segs.h"
|
||||
#include "r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244)
|
||||
|
|
|
@ -82,7 +82,7 @@ Low priority:
|
|||
#include "v_palette.h"
|
||||
#include "v_font.h"
|
||||
#include "v_video.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
EXTERN_CVAR (Int, r_polymost)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "r_segs.h"
|
||||
#include "r_3dfloors.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#define WALLYREPEAT 8
|
||||
|
||||
|
@ -2047,62 +2047,6 @@ void R_NewWall (bool needlights)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, r_fakecontrast, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0) self = 1;
|
||||
else if (self > 2) self = 2;
|
||||
}
|
||||
|
||||
int side_t::GetLightLevel (bool foggy, int baselight, int *pfakecontrast) const
|
||||
{
|
||||
if (Flags & WALLF_ABSLIGHTING)
|
||||
{
|
||||
baselight = Light;
|
||||
}
|
||||
|
||||
if (pfakecontrast != NULL)
|
||||
{
|
||||
*pfakecontrast = 0;
|
||||
}
|
||||
|
||||
if (!foggy) // Don't do relative lighting in foggy sectors
|
||||
{
|
||||
if (!(Flags & WALLF_NOFAKECONTRAST) && r_fakecontrast != 0)
|
||||
{
|
||||
int rel;
|
||||
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_fakecontrast == 2) &&
|
||||
linedef->dx != 0)
|
||||
{
|
||||
rel = xs_RoundToInt // OMG LEE KILLOUGH LIVES! :/
|
||||
(
|
||||
level.WallHorizLight
|
||||
+ fabs(atan(double(linedef->dy) / linedef->dx) / 1.57079)
|
||||
* (level.WallVertLight - level.WallHorizLight)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
rel = linedef->dx == 0 ? level.WallVertLight :
|
||||
linedef->dy == 0 ? level.WallHorizLight : 0;
|
||||
}
|
||||
if (pfakecontrast != NULL)
|
||||
{
|
||||
*pfakecontrast = rel;
|
||||
}
|
||||
else
|
||||
{
|
||||
baselight += rel;
|
||||
}
|
||||
}
|
||||
if (!(Flags & WALLF_ABSLIGHTING))
|
||||
{
|
||||
baselight += this->Light;
|
||||
}
|
||||
}
|
||||
return baselight;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// R_CheckDrawSegs
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
// Need data structure definitions.
|
||||
#include "d_player.h"
|
||||
#include "r_data/sprites.h"
|
||||
|
||||
//
|
||||
// Refresh internal data structures,
|
||||
|
@ -34,18 +35,6 @@
|
|||
extern "C" int viewwidth;
|
||||
extern "C" int viewheight;
|
||||
|
||||
// Sprite....
|
||||
extern int firstspritelump;
|
||||
extern int lastspritelump;
|
||||
extern int numspritelumps;
|
||||
|
||||
extern size_t numskins; // [RH]
|
||||
extern FPlayerSkin * skins; // [RH]
|
||||
|
||||
extern BYTE OtherGameSkinRemap[256];
|
||||
extern PalEntry OtherGameSkinPalette[256];
|
||||
|
||||
|
||||
//
|
||||
// Lookup tables for map data.
|
||||
//
|
||||
|
|
984
src/r_things.cpp
984
src/r_things.cpp
File diff suppressed because it is too large
Load diff
|
@ -23,8 +23,6 @@
|
|||
#ifndef __R_THINGS__
|
||||
#define __R_THINGS__
|
||||
|
||||
#define MAX_SPRITE_FRAMES 29 // [RH] Macro-ized as in BOOM.
|
||||
|
||||
// [RH] Particle details
|
||||
struct particle_t
|
||||
{
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
// This file was automatically generated by the
|
||||
// updaterevision tool. Do not edit by hand.
|
||||
|
||||
#define ZD_SVN_REVISION_STRING "3249"
|
||||
#define ZD_SVN_REVISION_NUMBER 3249
|
||||
#define ZD_SVN_REVISION_STRING "3257"
|
||||
#define ZD_SVN_REVISION_NUMBER 3257
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
|
||||
#include "bitmap.h"
|
||||
#include "templates.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "v_palette.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -33,15 +33,35 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
extern "C"
|
||||
{
|
||||
#include <jpeglib.h>
|
||||
}
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_jpeg.h"
|
||||
#include "w_wad.h"
|
||||
#include "v_text.h"
|
||||
#include "bitmap.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
struct FLumpSourceMgr : public jpeg_source_mgr
|
||||
{
|
||||
FileReader *Lump;
|
||||
JOCTET Buffer[4096];
|
||||
bool StartOfFile;
|
||||
|
||||
FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo);
|
||||
static void InitSource (j_decompress_ptr cinfo);
|
||||
static boolean FillInputBuffer (j_decompress_ptr cinfo);
|
||||
static void SkipInputData (j_decompress_ptr cinfo, long num_bytes);
|
||||
static void TermSource (j_decompress_ptr cinfo);
|
||||
};
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
#include "st_start.h"
|
||||
#include "sc_man.h"
|
||||
#include "templates.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "m_fixed.h"
|
||||
#include "textures/textures.h"
|
||||
#include "resources/colormaps.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
// On the Alpha, accessing the shorts directly if they aren't aligned on a
|
||||
// 4-byte boundary causes unaligned access warnings. Why it does this at
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "i_system.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "c_dispatch.h"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "i_system.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_text.h"
|
||||
#include "sc_man.h"
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "tarray.h"
|
||||
#include "templates.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_draw.h"
|
||||
#include "a_pickups.h"
|
||||
#include "s_sound.h"
|
||||
#include "cmdlib.h"
|
||||
|
@ -49,7 +48,7 @@
|
|||
#include "decallib.h"
|
||||
#include "i_system.h"
|
||||
#include "thingdef.h"
|
||||
#include "r_translate.h"
|
||||
#include "r_data/r_translate.h"
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue