changeset 120:fe0e317c0de0

Camera rotation fixed. Sorta
author Nomad
date Sun, 10 Feb 2013 23:43:28 +0200
parents be3c07c98861
children 3471df3713e2 eeb0a8222d59 30e731fc0f7a
files Game.cpp Indoor.cpp Outdoor.cpp Party.cpp Party.h mm7_2.cpp mm7_3.cpp
diffstat 7 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/Game.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -58,8 +58,10 @@
     uFlags2 |= 2u;
   pIndoorCamera->sRotationX = pParty->sRotationX;
   pIndoorCamera->sRotationY = pParty->sRotationY;
-  pIndoorCamera->pos.x = pParty->vPosition.x - pParty->field_18 * (stru_5C6E00->SinCos(pIndoorCamera->sRotationY) / 2048.0);//12552
-  pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * (stru_5C6E00->SinCos(pIndoorCamera->sRotationY) / 2048.0);//800
+  //pIndoorCamera->pos.x = pParty->vPosition.x - ((__int64)pParty->y_rotation_granularity * stru_5C6E00->SinCos(pIndoorCamera->sRotationY)) / 2048.0;//12552
+  //pIndoorCamera->pos.y = pParty->vPosition.y - ((__int64)pParty->y_rotation_granularity * stru_5C6E00->SinCos(pIndoorCamera->sRotationY)) / 2048.0;//800
+  pIndoorCamera->pos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pIndoorCamera->sRotationY / 2048.0);
+  pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pIndoorCamera->sRotationY / 2048.0);
   pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
   pIndoorCamera->Initialize2();
   pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
--- a/Indoor.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/Indoor.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -373,9 +373,9 @@
   _this.uFlags = v0;
   _this.vPosition.x = pParty->vPosition.x
                    - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY)
-                                       * (signed __int64)pParty->field_18) >> 16);
+                                       * (signed __int64)pParty->y_rotation_granularity) >> 16);
   v2 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi);
-  v3 = (unsigned __int64)(v2 * (signed __int64)pParty->field_18) >> 16;
+  v3 = (unsigned __int64)(v2 * (signed __int64)pParty->y_rotation_granularity) >> 16;
   _this.field_1C_mb_fov = 65;
   _this.vPosition.y = pParty->vPosition.y - v3;
   _this.sRotationY = pParty->sRotationY;
--- a/Outdoor.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/Outdoor.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -60,10 +60,10 @@
   pIndoorCamera->sRotationY = pParty->sRotationY;
   pIndoorCamera->pos.x = pParty->vPosition.x
                       - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY)
-                                          * (signed __int64)pParty->field_18) >> 16);
+                                          * (signed __int64)pParty->y_rotation_granularity) >> 16);
   //v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi);
   pIndoorCamera->field_4C = v1;
-  pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16);
+  pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16);
   pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;
   if ( v2 || pRenderer->pRenderD3D )
   {
--- a/Party.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/Party.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -828,7 +828,7 @@
   this->field_28 = 0;
   this->uDefaultPartyHeight = 120;
   this->field_14 = 37;
-  this->field_18 = 25;
+  this->y_rotation_granularity = 25;
   this->uWalkSpeed = 384;
   this->field_20_prolly_turn_speed = 90;
   this->field_24 = 5;
--- a/Party.h	Sun Feb 10 23:14:42 2013 +0200
+++ b/Party.h	Sun Feb 10 23:43:28 2013 +0200
@@ -127,6 +127,8 @@
 
     field_6FC = 0;
     field_764 = 0;
+
+    y_rotation_granularity = 1;
   }
 
   void _4909F4();
@@ -164,7 +166,7 @@
   int sEyelevel;
   unsigned int uDefaultEyelevel;
   int field_14;
-  int field_18;
+  int y_rotation_granularity;
   unsigned int uWalkSpeed;
   int field_20_prolly_turn_speed;
   int field_24;
--- a/mm7_2.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/mm7_2.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -13758,7 +13758,7 @@
   }
   else
   {
-    uTurnSpeed = (unsigned int)uCPUSpeed < 0xC7 ? 128 : 64;
+    uTurnSpeed = (unsigned int)uCPUSpeed < 0xC7 ? 128 : 64; // adjust turn speed to estimated fps
   }
   return true;
 }
--- a/mm7_3.cpp	Sun Feb 10 23:14:42 2013 +0200
+++ b/mm7_3.cpp	Sun Feb 10 23:43:28 2013 +0200
@@ -8038,7 +8038,7 @@
   stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0);
   v62._48607B(&stru_8019C8);
   v62.uTileBitmapID = pFace->uBitmapID;
-  v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? (int)&pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
+  v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
   if ( !v62.pTexture )
     return;
   v8 = pBLVRenderParams->sPartyRotX;