Mercurial > mm7
annotate OutdoorCamera.cpp @ 1505:6306a33af531
UIGame.cpp cleaning(continue) wizard_eye
author | Ritor1 |
---|---|
date | Mon, 02 Sep 2013 12:03:25 +0600 |
parents | cc9a3a24d61d |
children | 75fafd8ced59 |
rev | line source |
---|---|
1295 | 1 #include "OutdoorCamera.h" |
2 #include "IndoorCamera.h" | |
3 #include "Outdoor_stuff.h" | |
4 #include "Game.h" | |
5 #include "LightmapBuilder.h" | |
6 #include "Viewport.h" | |
7 #include "Math.h" | |
8 #include "mm7_data.h" | |
9 #include "Allocator.h" | |
10 | |
11 //----- (00481E55) -------------------------------------------------------- | |
12 void OutdoorCamera::Project(unsigned int uNumVertices) | |
13 { | |
14 double v1; // st7@2 | |
15 double v2; // st6@2 | |
16 double v3; // st5@2 | |
17 int v4; // eax@2 | |
18 unsigned int v5; // edx@2 | |
19 double v6; // st4@3 | |
20 double v7; // st3@3 | |
21 | |
22 if ( (signed int)uNumVertices > 0 ) | |
23 { | |
24 v1 = (double)pOutdoorCamera->int_fov_rad; | |
25 v2 = (double)pViewport->uScreenCenterX; | |
26 v3 = (double)pViewport->uScreenCenterY; | |
27 v4 = 0; | |
28 v5 = uNumVertices; | |
29 do | |
30 { | |
31 v6 = v1 * array_507D30[v4]._rhw; | |
32 v7 = v6 * array_507D30[v4].vWorldViewPosition.y; | |
33 memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4])); | |
34 array_50AC10[v4].vWorldViewProjX = v2 - v7; | |
35 array_50AC10[v4].vWorldViewProjY = v3 - v6 * array_507D30[v4].vWorldViewPosition.z; | |
36 ++v4; | |
37 --v5; | |
38 } | |
39 while ( v5 ); | |
40 } | |
41 } | |
42 //----- (00485F64) -------------------------------------------------------- | |
43 void OutdoorCamera::_485F64() | |
44 { | |
45 int v1; // eax@1 | |
46 int v2; // eax@2 | |
47 signed __int64 v3; // qtt@4 | |
48 int v4; // eax@4 | |
49 | |
50 this->uCameraFovInDegrees = 75; | |
51 v1 = stru_5C6E00->uPiMask & 0xD5; | |
52 if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi ) | |
53 v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1]; | |
54 else | |
55 v2 = stru_5C6E00->pTanTable[v1]; | |
56 LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31; | |
57 HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16; | |
58 v4 = (signed int)(v3 / v2) >> 16; | |
59 this->int_fov_rad = v4; | |
60 this->field_4C = 360000; | |
61 this->int_fov_rad_inv = 65536 / v4; | |
62 this->field_50 = 115; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1295
diff
changeset
|
63 //sr_6BE060[1] = 1; |
1295 | 64 RotationToInts(); |
65 } | |
66 | |
67 //----- (0048600E) -------------------------------------------------------- | |
68 void OutdoorCamera::RotationToInts() | |
69 { | |
70 camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
71 camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
72 camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
73 camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); | |
74 } | |
75 //----- (00486A28) -------------------------------------------------------- | |
76 void OutdoorCamera::AllocSoftwareDrawBuffers() | |
77 { | |
78 if ( !this || !pSpans ) | |
79 { | |
80 ReleaseSoftwareDrawBuffers(); | |
81 pSpans = (Span *)pAllocator->AllocNamedChunk(pSpans, 0x493E0u, "SPANS"); | |
82 pEdges = (Edge *)pAllocator->AllocNamedChunk(pEdges, 0x4C2C0u, "EDGES"); | |
83 pSurfs = (Surf *)pAllocator->AllocNamedChunk(pSurfs, 0x11940u, "SURFS"); | |
84 pNewEdges = (Edge *)pAllocator->AllocNamedChunk(pNewEdges, 0x6180u, "NEWEDGES"); | |
85 memset(pSpans, 0, 0x493E0u); | |
86 memset(pEdges, 0, 0x4C2C0u); | |
87 memset(pSurfs, 0, 0x11940u); | |
88 memset(pNewEdges, 0, 0x6180u); | |
89 } | |
90 } | |
91 | |
92 //----- (00486AFC) -------------------------------------------------------- | |
93 void OutdoorCamera::ReleaseSoftwareDrawBuffers() | |
94 { | |
95 pAllocator->FreeChunk(pSpans); | |
96 pAllocator->FreeChunk(pEdges); | |
97 pAllocator->FreeChunk(pSurfs); | |
98 pAllocator->FreeChunk(pNewEdges); | |
99 pSpans = 0; | |
100 pEdges = 0; | |
101 pSurfs = 0; | |
102 pNewEdges = 0; | |
103 } |