diff --git a/src/d_main.cpp b/src/d_main.cpp index efc33b5f4..515592f95 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -165,7 +165,6 @@ extern bool demorecording; extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop extern bool insave; -extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -2469,97 +2468,3 @@ void FStartupScreen::NetMessage(char const *,...) {} void FStartupScreen::NetDone(void) {} bool FStartupScreen::NetLoop(bool (*)(void *),void *) { return false; } -//========================================================================== -// -// STAT fps -// -// Displays statistics about rendering times -// -//========================================================================== - -//========================================================================== -// -// STAT fps -// -// Displays statistics about rendering times -// -//========================================================================== - -ADD_STAT (fps) -{ - FString out; - out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms", - FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS()); - return out; -} - - -static double f_acc, w_acc,p_acc,m_acc; -static int acc_c; - -ADD_STAT (fps_accumulated) -{ - f_acc += FrameCycles.TimeMS(); - w_acc += WallCycles.TimeMS(); - p_acc += PlaneCycles.TimeMS(); - m_acc += MaskedCycles.TimeMS(); - acc_c++; - FString out; - out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts", - f_acc/acc_c, w_acc/acc_c, p_acc/acc_c, m_acc/acc_c, acc_c); - Printf(PRINT_LOG, "%s\n", out.GetChars()); - return out; -} - -//========================================================================== -// -// STAT wallcycles -// -// Displays the minimum number of cycles spent drawing walls -// -//========================================================================== - -static double bestwallcycles = HUGE_VAL; - -ADD_STAT (wallcycles) -{ - FString out; - double cycles = WallCycles.Time(); - if (cycles && cycles < bestwallcycles) - bestwallcycles = cycles; - out.Format ("%g", bestwallcycles); - return out; -} - -//========================================================================== -// -// CCMD clearwallcycles -// -// Resets the count of minimum wall drawing cycles -// -//========================================================================== - -CCMD (clearwallcycles) -{ - bestwallcycles = HUGE_VAL; -} - -#if 1 -// To use these, also uncomment the clock/unclock in wallscan -static double bestscancycles = HUGE_VAL; - -ADD_STAT (scancycles) -{ - FString out; - double scancycles = WallScanCycles.Time(); - if (scancycles && scancycles < bestscancycles) - bestscancycles = scancycles; - out.Format ("%g", bestscancycles); - return out; -} - -CCMD (clearscancycles) -{ - bestscancycles = HUGE_VAL; -} -#endif diff --git a/src/d_net.cpp b/src/d_net.cpp index a00400dea..50d524cd2 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1540,7 +1540,6 @@ static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETN // D_CheckNetGame // Works out player numbers among the net participants // -extern int viewangleoffset; void D_CheckNetGame (void) { diff --git a/src/doomstat.h b/src/doomstat.h index 7a130a700..826c31990 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -124,10 +124,6 @@ extern "C" int halfviewwidth; // [RH] Half view width, for plane drawing -// This one is related to the 3-screen display mode. -// ANG90 = left side, ANG270 = right -extern int viewangleoffset; - // Player taking events. i.e. The local player. extern int consoleplayer; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index c75093b2e..0eac87b15 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -4004,7 +4004,7 @@ void P_Init () static void P_Shutdown () { - R_DeinitSprites (); + R_DeinitSpriteData (); P_DeinitKeyMessages (); P_FreeLevelData (); P_FreeExtraLevelData (); diff --git a/src/r_data/sprites.h b/src/r_data/sprites.h index 43deab133..919be76cf 100644 --- a/src/r_data/sprites.h +++ b/src/r_data/sprites.h @@ -65,6 +65,6 @@ extern BYTE OtherGameSkinRemap[256]; extern PalEntry OtherGameSkinPalette[256]; void R_InitSprites (); -void R_DeinitSprites (); +void R_DeinitSpriteData (); #endif diff --git a/src/r_data/voxels.h b/src/r_data/voxels.h index 76f405726..90b57e0af 100644 --- a/src/r_data/voxels.h +++ b/src/r_data/voxels.h @@ -35,6 +35,7 @@ struct FVoxel { int LumpNum; int NumMips; + int VoxelIndex; // Needed by GZDoom BYTE *Palette; FVoxelMipLevel Mips[MAXVOXMIPS]; @@ -48,6 +49,7 @@ struct FVoxelDef FVoxel *Voxel; int PlacedSpin; // degrees/sec to spin actors without MF_DROPPED set int DroppedSpin; // degrees/sec to spin actors with MF_DROPPED set + int VoxeldefIndex; // Needed by GZDoom fixed_t Scale; angle_t AngleOffset; // added to actor's angle to compensate for wrong-facing voxels }; diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 7003a65a3..f05c812d2 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -61,15 +61,11 @@ extern int ST_Y; BYTE* viewimage; extern "C" { -int viewwidth; int halfviewwidth; -int viewheight; int ylookup[MAXHEIGHT]; BYTE *dc_destorg; } int scaledviewwidth; -int viewwindowx; -int viewwindowy; // [RH] Pointers to the different column drawers. // These get changed depending on the current diff --git a/src/r_main.cpp b/src/r_main.cpp index 5a0bd4b82..f10efd73a 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -75,6 +75,7 @@ void R_SpanInitData (); void RP_RenderBSPNode (void *node); bool RP_SetupFrame (bool backside); +void R_DeinitSprites(); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -114,12 +115,9 @@ fixed_t r_SkyVisibility; fixed_t GlobVis; fixed_t viewingrangerecip; -fixed_t FocalTangent; fixed_t FocalLengthX; fixed_t FocalLengthY; float FocalLengthXfloat; -int viewangleoffset; -int validcount = 1; // increment every time a check is made FDynamicColormap*basecolormap; // [RH] colormap currently drawing with int fixedlightlev; lighttable_t *fixedcolormap; @@ -127,12 +125,6 @@ FSpecialColormap *realfixedcolormap; float WallTMapScale; float WallTMapScale2; -extern "C" { -int centerx; -int centery; -int centerxwide; - -} bool bRenderingToCanvas; // [RH] True if rendering to a special canvas fixed_t globaluclip, globaldclip; @@ -147,12 +139,10 @@ fixed_t InvZtoScale; int linecount; int loopcount; -int r_Yaspect = 200; // Why did I make this a variable? It's never set anywhere. // // precalculated math tables // -int FieldOfView = 2048; // Fineangles in the SCREENWIDTH wide window // The xtoviewangleangle[] table maps a screen pixel // to the lowest viewangle that maps back to x ranges @@ -162,9 +152,6 @@ angle_t xtoviewangle[MAXWIDTH+1]; bool foggy; // [RH] ignore extralight and fullbright? int r_actualextralight; -bool setsizeneeded; - - void (*colfunc) (void); void (*basecolfunc) (void); void (*fuzzcolfunc) (void); @@ -178,8 +165,6 @@ void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh); cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles; -FCanvasTextureInfo *FCanvasTextureInfo::List; - // PRIVATE DATA DEFINITIONS ------------------------------------------------ static int lastcenteryfrac; @@ -221,29 +206,10 @@ static inline int viewangletox(int i) void R_InitTextureMapping () { int i, x; - int fov = FieldOfView; - - // For widescreen displays, increase the FOV so that the middle part of the - // screen that would be visible on a 4:3 display has the requested FOV. - if (centerxwide != centerx) - { // centerxwide is what centerx would be if the display was not widescreen - fov = int(atan(double(centerx)*tan(double(fov)*M_PI/(FINEANGLES))/double(centerxwide))*(FINEANGLES)/M_PI); - if (fov > 170*FINEANGLES/360) - fov = 170*FINEANGLES/360; - } - /* - default: break; - case 1: fov = MIN (fov * 512/433, 170 * FINEANGLES / 360); break; // 16:9 - case 2: fov = MIN (fov * 512/459, 170 * FINEANGLES / 360); break; // 16:10 - } - */ - - const int hitan = finetangent[FINEANGLES/4+fov/2]; // Calc focallength so FieldOfView fineangles covers viewwidth. - FocalTangent = hitan; - FocalLengthX = FixedDiv (centerxfrac, hitan); - FocalLengthY = Scale (centerxfrac, yaspectmul, hitan); + FocalLengthX = FixedDiv (centerxfrac, FocalTangent); + FocalLengthY = Scale (centerxfrac, yaspectmul, FocalTangent); FocalLengthXfloat = (float)FocalLengthX / 65536.f; // This is 1/FocalTangent before the widescreen extension of FOV. @@ -396,8 +362,6 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, halfviewwidth = (viewwidth >> 1) - 1; lastcenteryfrac = 1<<30; - centery = viewheight/2; - centerx = viewwidth/2; centerxfrac = centerx< 170*FINEANGLES/360) + fov = 170*FINEANGLES/360; + } + + FocalTangent = finetangent[FINEANGLES/4+fov/2]; Renderer->SetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio); } @@ -749,7 +795,7 @@ void R_SetupFrame (AActor *actor) player = camera->player; } - iview->nviewangle = camera->angle + viewangleoffset; + iview->nviewangle = camera->angle; if (iview->otic == -1 || r_NoInterpolate) { R_ResetViewInterpolation (); diff --git a/src/r_utility.h b/src/r_utility.h index 79b133ec5..85ca7c410 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -16,6 +16,9 @@ extern fixed_t viewy; extern fixed_t viewz; extern int viewpitch; +extern "C" int centerx, centerxwide; +extern "C" int centery; + extern int setblocks; extern fixed_t viewtancos; @@ -35,6 +38,7 @@ extern DWORD r_FrameTime; extern int extralight; extern unsigned int R_OldBlend; +const int r_Yaspect = 200; // Why did I make this a variable? It's never set anywhere. //========================================================================== // @@ -61,6 +65,7 @@ void R_SetViewSize (int blocks); void R_SetFOV (float fov); float R_GetFOV (); void R_SetupFrame (AActor * camera); +void R_SetViewAngle (); // Called by startup code. void R_Init (void); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index e86f112bd..2fa1e493e 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -41,6 +41,7 @@ #include "v_video.h" #include "m_swap.h" #include "r_defs.h" +#include "r_utility.h" #ifndef NO_SWRENDER #include "r_draw.h" #include "r_main.h"