From 2034a02f74f52b1055d5c4dcacd8b8ce62cc4d2a Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 16 May 2013 00:57:05 +0100
Subject: [PATCH] [Fix] *Mutters something about macro hell.*

---
 src/opengl.c | 14 ++++++++------
 src/opengl.h |  8 ++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/opengl.c b/src/opengl.c
index 7cec798..c0c24b9 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -365,8 +365,8 @@ void gl_blitSprite(const glTexture* sprite, const double bx, const double by,
 
   glEnable(GL_TEXTURE_2D);
 
-  x = bx - (double)SCREEN_W/2.;
-  y = by - (double)SCREEN_H/2.;
+  x = bx - VX(*gl_camera) - sprite->sw/2. + gui_xoff;
+  y = by - VY(*gl_camera) - sprite->sh/2. + gui_yoff;
 
   tx = sprite->sw * (double)(sx)/sprite->rw;
   ty = sprite->sh * (sprite->sy-(double)sy-1)/sprite->rh;
@@ -402,8 +402,8 @@ void gl_blitStatic(const glTexture* texture, const double bx, const double by,
   double x, y;
   glEnable(GL_TEXTURE_2D);
 
-  x = bx - (double)gl_screen.w/2.;
-  y = by - (double)gl_screen.h/2.;
+  x = bx - (double)SCREEN_W/2.;
+  y = by - (double)SCREEN_H/2.;
 
   // Actual blitting..
   glBindTexture(GL_TEXTURE_2D, texture->texture);
@@ -579,8 +579,9 @@ static GLboolean gl_hasExt(char* name) {
 }
 
 // Check and report if there's been an error.
-#ifndef gl_checkErr // I know, I know, it's a little hackish.
+//#ifndef gl_checkErr // I know, I know, it's a little hackish.
 void gl_checkErr(void) {
+#ifdef DEBUG
   GLenum err;
   char* errstr;
 
@@ -615,8 +616,9 @@ void gl_checkErr(void) {
       break;
   }
   WARN("OpenGL error: %s", errstr);
-}
 #endif
+}
+//#endif
 
 // Initialize SDL/OpenGL etc.
 int gl_init(void) {
diff --git a/src/opengl.h b/src/opengl.h
index b134df2..8ed3964 100644
--- a/src/opengl.h
+++ b/src/opengl.h
@@ -80,9 +80,9 @@ void gl_exit(void);
 int gl_isTrans(const glTexture* t, const int x, const int y);
 void gl_getSpriteFromDir(int* x, int* y, const glTexture* t, const double dir);
 void gl_screenshot(const char* filename);
-#if DEBUG == 1
+//#if DEBUG == 1
 void gl_checkErr(void);
-#else
-#define gl_checkErr()
-#endif
+//#else
+//#define gl_checkErr()
+//#endif