summary refs log tree commit diff
path: root/src/GameDraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GameDraw.cpp')
-rw-r--r--src/GameDraw.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/GameDraw.cpp b/src/GameDraw.cpp
index 54fddc1..f2d5695 100644
--- a/src/GameDraw.cpp
+++ b/src/GameDraw.cpp
@@ -19,6 +19,8 @@
 // You should have received a copy of the GNU General Public License
 // along with Black Shades.  If not, see <https://www.gnu.org/licenses/>.
 
+#include <stdio.h>
+
 #include "Game.h"
 #include "misc.h"
 
@@ -39,6 +41,16 @@ extern float sinefluctprog;
 extern int environment;
 extern Decals decals;
 
+GLvoid ReSizeGLScene(Game* game, float fov, float near)
+{
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+	gluPerspective(fov, game->screenwidth / (GLfloat) game->screenheight,
+		near, game->viewdistance);
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();
+}
+
 void Game::DrawGLScene(void)
 {
 	//Main menu
@@ -571,9 +583,9 @@ void Game::DrawGLScene(void)
 			glEnable(GL_LIGHT0);
 			// Change fov if zooming with scope
 			if (zoom)
-				ReSizeGLScene(10.0f, 0.6f);
+				ReSizeGLScene(this, 10.0f, 0.6f);
 			else
-				ReSizeGLScene(90.0f, 0.1f);
+				ReSizeGLScene(this, 90.0f, 0.1f);
 			nocolors=0;
 		} else {
 			glLightfv(GL_LIGHT0, GL_AMBIENT, (GLfloat[]) { 0.0f, 0.0f, 0.0f, 1.0f });
@@ -586,7 +598,7 @@ void Game::DrawGLScene(void)
 			fog.SetFog(fogcolorr,fogcolorg,fogcolorb,0,viewdistance*.8*.5*(sinefluct/4+.3),sinefluct/3+.7);
 			glClearColor(fogcolorr,fogcolorg,fogcolorb,1);
 
-			ReSizeGLScene(120-sinefluct*20,.3);
+			ReSizeGLScene(this, 120.0f - sinefluct * 20.0f, 0.3f);
 			glRotatef(sinefluct*10,0,0,.1);
 			nocolors=1;