view IndoorCamera.cpp @ 41:fd64b06a39a8

19.10.12 PartyCreation Window complete
author Ritor1
date Fri, 19 Oct 2012 23:28:34 +0600
parents 8b8875f5b359
children 5159d2e6f559
line wrap: on
line source

#include "IndoorCamera.h"
#include "Render.h"
#include "Game.h"
#include "Indoor.h"
#include "Math.h"

#include "mm7_data.h"





IndoorCamera *pIndoorCamera; // idb





//----- (00481CCE) --------------------------------------------------------
float IndoorCamera::ViewTransform(RenderVertexSoft *a1)
{
  float result; // eax@1
  double vCamToVertexZ; // st7@1
  double v3; // st6@1
  double v4; // st5@1
  double v5; // st4@1
  float v6; // ST04_4@3
  float v7; // [sp+0h] [bp-14h]@1
  float v8; // [sp+8h] [bp-Ch]@1
  float vCamToVertexX; // [sp+Ch] [bp-8h]@1
  float vCamToVertexY; // [sp+10h] [bp-4h]@1

  v8 = fRotationXCosine;
  result = fRotationXSine;
  v7 = fRotationXSine;
  vCamToVertexX = a1->vWorldPosition.x - (double)pos.x;
  vCamToVertexY = a1->vWorldPosition.y - (double)pos.y;
  vCamToVertexZ = a1->vWorldPosition.z - (double)pos.z;
  v3 = fRotationYCosine;
  v4 = fRotationYSine;
  v5 = vCamToVertexY * fRotationYSine + fRotationYCosine * vCamToVertexX;
  if ( sRotationX )
  {
    v6 = v5;
    a1->vWorldViewPosition.x = v5 * fRotationXCosine + fRotationXSine * vCamToVertexZ;
    a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
    a1->vWorldViewPosition.z = v8 * vCamToVertexZ - v6 * v7;
  }
  else
  {
    a1->vWorldViewPosition.x = v5;
    a1->vWorldViewPosition.y = v3 * vCamToVertexY - v4 * vCamToVertexX;
    a1->vWorldViewPosition.z = vCamToVertexZ;
  }
  return result;
}



//----- (0042394D) --------------------------------------------------------
void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
{
  IndoorCamera *v4; // esi@1
  double v5; // st7@1

  v4 = this;
  v5 = (double)(signed int)(signed __int64)((double)(signed int)uViewportWidth
                                          * 0.5
                                          / tan((double)(degFov >> 1) * 0.01745329)
                                          + 0.5);
  v4->flt_1C_fov = v5;
  v4->flt_20_inv_1C = 65536.0 / v5;
}

//----- (004239A7) --------------------------------------------------------
void IndoorCamera::Initialize2()
{
  IndoorCamera *v1; // esi@1
  double v2; // st7@4
  double v3; // st7@6
  int v4; // eax@6
  int v5; // eax@6
  int v6; // ST04_4@6
  int v7; // eax@6
  int v8; // ST04_4@6

  v1 = this;
  this->fRotationYSine = sin((3.141592653589793 + 3.141592653589793) * (double)this->sRotationY * 0.00048828125);
  v1->fRotationYCosine = cos((3.141592653589793 + 3.141592653589793) * (double)v1->sRotationY * 0.00048828125);
  if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
  {
    v1->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)-v1->sRotationX * 0.00048828125);
    v2 = (3.141592653589793 + 3.141592653589793) * (double)-v1->sRotationX;
  }
  else
  {
    v1->fRotationXSine = sin((3.141592653589793 + 3.141592653589793) * (double)v1->sRotationX * 0.00048828125);
    v2 = (3.141592653589793 + 3.141592653589793) * (double)v1->sRotationX;
  }
  v3 = cos(v2 * 0.00048828125);
  v4 = v1->sRotationY;
  v1->fRotationXCosine = v3;
  v5 = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi);
  v6 = v1->sRotationY;
  v1->_int_sine = v5;
  v1->_int_cosine = stru_5C6E00->SinCos(v6);
  v7 = stru_5C6E00->SinCos(v1->sRotationX - stru_5C6E00->uIntegerHalfPi);
  v8 = v1->sRotationX;
  v1->_int_sine_2 = v7;
  v1->_int_cosine_2 = stru_5C6E00->SinCos(v8);
}
// 4D864C: using guessed type char byte_4D864C;