r4017 - packages/trunk/cultivation/debian/patches
Miriam Ruiz
baby-guest at alioth.debian.org
Fri Aug 31 20:08:25 UTC 2007
Author: baby-guest
Date: 2007-08-31 20:08:25 +0000 (Fri, 31 Aug 2007)
New Revision: 4017
Added:
packages/trunk/cultivation/debian/patches/mouse_pos.patch
Modified:
packages/trunk/cultivation/debian/patches/series
Log:
Add hacky patch to temporarily fix #440137
Added: packages/trunk/cultivation/debian/patches/mouse_pos.patch
===================================================================
--- packages/trunk/cultivation/debian/patches/mouse_pos.patch (rev 0)
+++ packages/trunk/cultivation/debian/patches/mouse_pos.patch 2007-08-31 20:08:25 UTC (rev 4017)
@@ -0,0 +1,82 @@
+# Copyright (C) 2007 David Martinez Marti <deavidsedice at gmail.com>
+# Distributed under the same license as the game. See debian/copyright.
+# Hacky patch to temporarily fix #440137
+
+Index: cultivation-8.20070809.dfsg1/game2/gameSource/game.cpp
+===================================================================
+--- cultivation-8.20070809.dfsg1.orig/game2/gameSource/game.cpp 2007-08-31 19:57:32.000000000 +0000
++++ cultivation-8.20070809.dfsg1/game2/gameSource/game.cpp 2007-08-31 20:00:42.000000000 +0000
+@@ -2627,69 +2627,10 @@
+ void GameSceneHandler::projectScreenPointIntoScene( int inX, int inY,
+ double *outSceneX,
+ double *outSceneY ) {
+- // first, get our current matrices
+- GLdouble modelMatrix[16];
+- GLdouble projMatrix[16];
+- GLint viewport[4];
+-
+- glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
+- glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
+- glGetIntegerv( GL_VIEWPORT, viewport );
+-
+-
+-
+- /*
+- From the OpenGL FAQ
+-
+- The concept of window space Z is often confusing. It's the depth buffer
+- value expressed as a GLdouble in the range 0.0 to 1.0. Assuming a
+- default glDepthRange(), a window coordinate with a Z value of 0.0
+- corresponds to an eye coordinate located on the zNear clipping plane.
+- Similarly, a window space Z value of 1.0 corresponds to an eye space
+- coordinate located on the zFar plane. You can obtain any window space Z
+- value by reading the depth buffer with glReadPixels().
+- */
+-
+- // so, use screen z of 0 for near clipping plane, which ScreenGL has
+- // set to 1 unit away from screen.
+-
+- // Thus, we need to find the z buffer value of our world plane (a z=0)
+- // we can call this our "windowZ", since it is how z space is represented
+- // in the window
+-
+- // if we project world (0,0,0) onto the screen, we will get the windowZ
+- // of our world zero
+-
+- double windowXForWorldZero, windowYForWorldZero, windowZForWorldZero;
+- gluProject( 0, 0, 0,
+- modelMatrix, projMatrix, viewport,
+- &windowXForWorldZero,
+- &windowYForWorldZero,
+- &windowZForWorldZero );
+-
+-
+- // use unproject to map our window coordinates back into the world
+- double xWorld, yWorld, zWorld;
+- gluUnProject( inX,
+- inY,
+- windowZForWorldZero,
+- modelMatrix, projMatrix, viewport,
+- &xWorld, &yWorld, &zWorld );
+-
+-
+-
+- // need to invert the resulting y and translate it for some reson
+-
+- Vector3D *viewPosition = screen->getViewPosition();
+-
+- yWorld = -yWorld + 2 * viewPosition->mY;
+-
+- delete viewPosition;
+-
+-
+-
+- *outSceneX = xWorld;
+- *outSceneY = yWorld;
++ Vector3D *viewPosition = screen->getViewPosition();
++ *outSceneX = viewPosition->mX-(inX-screen->getWidth()/2.0)*46.0/screen->getWidth();
++ *outSceneY = viewPosition->mY-(inY-screen->getHeight()/2.0)*46.0/screen->getHeight();
++ delete viewPosition;
+ }
+
+ void GameSceneHandler::keyPressed(
Modified: packages/trunk/cultivation/debian/patches/series
===================================================================
--- packages/trunk/cultivation/debian/patches/series 2007-08-31 18:08:21 UTC (rev 4016)
+++ packages/trunk/cultivation/debian/patches/series 2007-08-31 20:08:25 UTC (rev 4017)
@@ -3,3 +3,4 @@
cflags.patch
abs_paths.patch
math_h.patch
+mouse_pos.patch
More information about the Pkg-games-commits
mailing list