From 434e39e62fb0d9f912e3bd4f023fbb4c92727f38 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 28 Apr 2016 17:55:58 +0200 Subject: [PATCH] - made adjustments to ZDoom's last changes. --- src/gl/compatibility/gl_20.cpp | 8 +++++++- src/gl/data/gl_data.cpp | 4 ++-- src/gl/models/gl_models_md2.cpp | 4 ++-- src/gl/models/gl_models_md3.cpp | 4 ++-- src/gl/scene/gl_clipper.h | 1 - src/gl/scene/gl_drawinfo.h | 2 +- src/gl/scene/gl_scene.cpp | 6 +++--- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index 280affa1a..b06ce762b 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -143,12 +143,15 @@ BYTE *gl_WarpBuffer(BYTE *buffer, int Width, int Height, int warp, float Speed) int xmask = xsize - 1; int ymask = ysize - 1; int ds_xbits; - int i, x; + int i; if (warp == 1) { for (ds_xbits = -1, i = Width; i; i >>= 1, ds_xbits++); + // pending consolidation with the software renderer's code. + + /* for (x = xsize - 1; x >= 0; x--) { int yt, yf = (finesine[(timebase + (x + 17) * 128)&FINEMASK] >> 13) & ymask; @@ -172,12 +175,14 @@ BYTE *gl_WarpBuffer(BYTE *buffer, int Width, int Height, int warp, float Speed) } memcpy(out + y*xsize, linebuffer, xsize * sizeof(DWORD)); } + */ } else { int ybits; for (ybits = -1, i = ysize; i; i >>= 1, ybits++); + /* DWORD timebase = (r_FrameTime * Speed * 40 / 28); for (x = xsize - 1; x >= 0; x--) { @@ -194,6 +199,7 @@ BYTE *gl_WarpBuffer(BYTE *buffer, int Width, int Height, int warp, float Speed) *dest = *source; } } + */ } delete[] buffer; return (BYTE*)out; diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index ba6105d5a..2aea2b8a3 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -431,11 +431,11 @@ FTextureID gl_GetSpriteFrame(unsigned sprite, int frame, int rot, angle_t ang, b { if (sprframe->Texture[0] == sprframe->Texture[1]) { - rot = (ang + (angle_t)(ANGLE_45/2)*9) >> 28; + rot = (ang + (angle_t)(ANGLE_90/4)*9) >> 28; } else { - rot = (ang + (angle_t)(ANGLE_45/2)*9-(angle_t)(ANGLE_180/16)) >> 28; + rot = (ang + (angle_t)(ANGLE_90/4)*9-(angle_t)(ANGLE_180/16)) >> 28; } } if (mirror) *mirror = !!(sprframe->Flip&(1<> 9) / 127.0f - 0.5f) * PI; + float yaw = (packed & 511) / 512.0f * 2 * M_PI; + float pitch = ((packed >> 9) / 127.0f - 0.5f) * M_PI; float cosp = (float) cos(pitch); vec[VX] = (float) cos(yaw) * cosp; diff --git a/src/gl/models/gl_models_md3.cpp b/src/gl/models/gl_models_md3.cpp index 13f02bc0a..7e8a4845e 100644 --- a/src/gl/models/gl_models_md3.cpp +++ b/src/gl/models/gl_models_md3.cpp @@ -60,8 +60,8 @@ static void UnpackVector(unsigned short packed, float & nx, float & ny, float & { double lat = ( packed >> 8 ) & 0xff; double lng = ( packed & 0xff ); - lat *= PI/128; - lng *= PI/128; + lat *= M_PI/128; + lng *= M_PI/128; nx = cos(lat) * sin(lng); ny = sin(lat) * sin(lng); diff --git a/src/gl/scene/gl_clipper.h b/src/gl/scene/gl_clipper.h index 7d05cf701..977107e61 100644 --- a/src/gl/scene/gl_clipper.h +++ b/src/gl/scene/gl_clipper.h @@ -2,7 +2,6 @@ #define __GL_CLIPPER #include "doomtype.h" -#include "tables.h" #include "xs_Float.h" #include "r_utility.h" diff --git a/src/gl/scene/gl_drawinfo.h b/src/gl/scene/gl_drawinfo.h index 9745ade88..744ffeef4 100644 --- a/src/gl/scene/gl_drawinfo.h +++ b/src/gl/scene/gl_drawinfo.h @@ -229,7 +229,7 @@ struct FDrawInfo FDrawInfo * next; GLDrawList drawlists[GLDL_TYPES]; - GLDrawList *dldrawlists; // only gets allocated when needed. + GLDrawList *dldrawlists = NULL; // only gets allocated when needed. FDrawInfo(); ~FDrawInfo(); diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index a745f7307..f09343f44 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -793,7 +793,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo SetViewArea(); // We have to scale the pitch to account for the pixel stretching, because the playsim doesn't know about this and treats it as 1:1. - double radPitch = clamp(ViewPitch.Normalized180().Radians(), -PI / 2, PI / 2); + double radPitch = ViewPitch.Normalized180().Radians(); double angx = cos(radPitch); double angy = sin(radPitch) * glset.pixelstretch; double alen = sqrt(angx*angx + angy*angy); @@ -922,7 +922,7 @@ void FGLRenderer::RenderView (player_t* player) TThinkerIterator it(STAT_DLIGHT); GLRenderer->mLightCount = ((it.Next()) != NULL); - sector_t * viewsector = RenderViewpoint(player->camera, NULL, FieldOfView * 360.0f / FINEANGLES, ratio, fovratio, true, true); + sector_t * viewsector = RenderViewpoint(player->camera, NULL, FieldOfView.Degrees, ratio, fovratio, true, true); All.Unclock(); } @@ -952,7 +952,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei GLRenderer->mLightCount = ((it.Next()) != NULL); sector_t *viewsector = RenderViewpoint(players[consoleplayer].camera, &bounds, - FieldOfView * 360.0f / FINEANGLES, 1.6f, 1.6f, true, false); + FieldOfView.Degrees, 1.6f, 1.6f, true, false); glDisable(GL_STENCIL_TEST); gl_RenderState.SetFixedColormap(CM_DEFAULT); gl_RenderState.SetSoftLightLevel(-1);