annotate mm7_3.cpp @ 1653:d453ed393d6e

NPCGreetings
author Ritor1
date Wed, 18 Sep 2013 11:04:47 +0600
parents bac69d9157b6
children 5f2583a4fa7d
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4
1323
bfde0563ecdc removed weather.h from indoor.h
Grumpy7
parents: 1306
diff changeset
5 #include "Weather.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
6 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
7 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
8 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
9 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
10 #include "LightmapBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
11 #include "DecalBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
12 #include "ParticleEngine.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
13 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
14 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
15 #include "stru6.h"
1263
73269755dd89 arcomage renaming&cleaning
Gloval
parents: 1254
diff changeset
16 #include "FactionTable.h"
0
Ritor1
parents:
diff changeset
17 #include "MapInfo.h"
Ritor1
parents:
diff changeset
18 #include "Game.h"
Ritor1
parents:
diff changeset
19 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
20 #include "GUIFont.h"
Ritor1
parents:
diff changeset
21 #include "GUIProgressBar.h"
Ritor1
parents:
diff changeset
22 #include "Party.h"
Ritor1
parents:
diff changeset
23 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
24 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1264
diff changeset
25 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
26 #include "Overlays.h"
Ritor1
parents:
diff changeset
27 #include "LOD.h"
Ritor1
parents:
diff changeset
28 #include "Actor.h"
Ritor1
parents:
diff changeset
29 #include "Events.h"
Ritor1
parents:
diff changeset
30 #include "Viewport.h"
Ritor1
parents:
diff changeset
31 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
32 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
33 #include "ObjectList.h"
Ritor1
parents:
diff changeset
34 #include "PaletteManager.h"
Ritor1
parents:
diff changeset
35 #include "DecorationList.h"
Ritor1
parents:
diff changeset
36 #include "stru123.h"
Ritor1
parents:
diff changeset
37 #include "Time.h"
Ritor1
parents:
diff changeset
38 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
39 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
40 #include "Events2D.h"
Ritor1
parents:
diff changeset
41 #include "stru176.h"
Ritor1
parents:
diff changeset
42 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 185
diff changeset
43 #include "texts.h"
0
Ritor1
parents:
diff changeset
44 #include "Log.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
45 #include "Lights.h"
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
46
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
47 #include "MM7.h"
0
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 //----- (0046E44E) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
50 int _46E44E_collide_against_faces_and_portals(unsigned int b1)
0
Ritor1
parents:
diff changeset
51 {
717
Ritor1
parents: 688
diff changeset
52 BLVSector *pSector; // edi@1
0
Ritor1
parents:
diff changeset
53 signed int v2; // ebx@1
717
Ritor1
parents: 688
diff changeset
54 BLVFace *pFace; // esi@2
Ritor1
parents: 688
diff changeset
55 __int16 pNextSector; // si@10
Ritor1
parents: 688
diff changeset
56 int pArrayNum; // ecx@12
0
Ritor1
parents:
diff changeset
57 unsigned __int8 v6; // sf@12
Ritor1
parents:
diff changeset
58 unsigned __int8 v7; // of@12
Ritor1
parents:
diff changeset
59 int result; // eax@14
717
Ritor1
parents: 688
diff changeset
60 //BLVSector *v9; // ebx@15
0
Ritor1
parents:
diff changeset
61 int v10; // ecx@15
717
Ritor1
parents: 688
diff changeset
62 int pFloor; // eax@16
Ritor1
parents: 688
diff changeset
63 //BLVFace *v12; // ebp@16
0
Ritor1
parents:
diff changeset
64 int v13; // eax@24
Ritor1
parents:
diff changeset
65 int v14; // esi@24
Ritor1
parents:
diff changeset
66 int v15; // eax@24
Ritor1
parents:
diff changeset
67 int v16; // edx@25
Ritor1
parents:
diff changeset
68 int v17; // eax@29
Ritor1
parents:
diff changeset
69 unsigned int v18; // eax@33
Ritor1
parents:
diff changeset
70 int v19; // eax@35
Ritor1
parents:
diff changeset
71 int v20; // edx@35
Ritor1
parents:
diff changeset
72 int v21; // eax@35
Ritor1
parents:
diff changeset
73 int v22; // ecx@36
Ritor1
parents:
diff changeset
74 int v23; // eax@40
Ritor1
parents:
diff changeset
75 unsigned int v24; // eax@44
Ritor1
parents:
diff changeset
76 int a3; // [sp+10h] [bp-48h]@28
Ritor1
parents:
diff changeset
77 int v26; // [sp+14h] [bp-44h]@15
Ritor1
parents:
diff changeset
78 int i; // [sp+18h] [bp-40h]@1
Ritor1
parents:
diff changeset
79 int a10; // [sp+1Ch] [bp-3Ch]@1
Ritor1
parents:
diff changeset
80 int v29; // [sp+20h] [bp-38h]@14
Ritor1
parents:
diff changeset
81 int v30; // [sp+24h] [bp-34h]@35
Ritor1
parents:
diff changeset
82 int v31; // [sp+28h] [bp-30h]@24
Ritor1
parents:
diff changeset
83 int v32; // [sp+2Ch] [bp-2Ch]@15
717
Ritor1
parents: 688
diff changeset
84 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
Ritor1
parents: 688
diff changeset
85
Ritor1
parents: 688
diff changeset
86 pSector = &pIndoor->pSectors[stru_721530.uSectorID];
0
Ritor1
parents:
diff changeset
87 v2 = 0;
Ritor1
parents:
diff changeset
88 a10 = b1;
717
Ritor1
parents: 688
diff changeset
89 pSectorsArray[0] = stru_721530.uSectorID;
Ritor1
parents: 688
diff changeset
90 for ( i = 1; v2 < pSector->uNumPortals; ++v2 )
Ritor1
parents: 688
diff changeset
91 {
Ritor1
parents: 688
diff changeset
92 pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
Ritor1
parents: 688
diff changeset
93 if ( stru_721530.sMaxX <= pFace->pBounding.x2
Ritor1
parents: 688
diff changeset
94 && stru_721530.sMinX >= pFace->pBounding.x1
Ritor1
parents: 688
diff changeset
95 && stru_721530.sMaxY <= pFace->pBounding.y2
Ritor1
parents: 688
diff changeset
96 && stru_721530.sMinY >= pFace->pBounding.y1
Ritor1
parents: 688
diff changeset
97 && stru_721530.sMaxZ <= pFace->pBounding.z2
Ritor1
parents: 688
diff changeset
98 && stru_721530.sMinZ >= pFace->pBounding.z1
Ritor1
parents: 688
diff changeset
99 && abs((pFace->pFacePlane_old.dist
Ritor1
parents: 688
diff changeset
100 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 688
diff changeset
101 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 688
diff changeset
102 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
Ritor1
parents: 688
diff changeset
103 {
Ritor1
parents: 688
diff changeset
104 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
Ritor1
parents: 688
diff changeset
105 pArrayNum = i++;
Ritor1
parents: 688
diff changeset
106 v7 = i < 10;
0
Ritor1
parents:
diff changeset
107 v6 = i - 10 < 0;
717
Ritor1
parents: 688
diff changeset
108 pSectorsArray[pArrayNum] = pNextSector;
0
Ritor1
parents:
diff changeset
109 if ( !(v6 ^ v7) )
Ritor1
parents:
diff changeset
110 break;
Ritor1
parents:
diff changeset
111 }
Ritor1
parents:
diff changeset
112 }
Ritor1
parents:
diff changeset
113 result = 0;
Ritor1
parents:
diff changeset
114 v29 = 0;
Ritor1
parents:
diff changeset
115 if ( i > 0 )
Ritor1
parents:
diff changeset
116 {
Ritor1
parents:
diff changeset
117 while ( 1 )
Ritor1
parents:
diff changeset
118 {
717
Ritor1
parents: 688
diff changeset
119 pSector = &pIndoor->pSectors[pSectorsArray[result]];
0
Ritor1
parents:
diff changeset
120 v10 = 0;
717
Ritor1
parents: 688
diff changeset
121 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
0
Ritor1
parents:
diff changeset
122 v26 = 0;
Ritor1
parents:
diff changeset
123 if ( v32 > 0 )
Ritor1
parents:
diff changeset
124 break;
Ritor1
parents:
diff changeset
125 LABEL_46:
Ritor1
parents:
diff changeset
126 result = v29++ + 1;
Ritor1
parents:
diff changeset
127 if ( v29 >= i )
Ritor1
parents:
diff changeset
128 return result;
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 while ( 1 )
Ritor1
parents:
diff changeset
131 {
717
Ritor1
parents: 688
diff changeset
132 pFloor = pSector->pFloors[v10];
Ritor1
parents: 688
diff changeset
133 pFace = &pIndoor->pFaces[pFloor];
Ritor1
parents: 688
diff changeset
134 if ( pFace->Portal()
Ritor1
parents: 688
diff changeset
135 || stru_721530.sMaxX > pFace->pBounding.x2
Ritor1
parents: 688
diff changeset
136 || stru_721530.sMinX < pFace->pBounding.x1
Ritor1
parents: 688
diff changeset
137 || stru_721530.sMaxY > pFace->pBounding.y2
Ritor1
parents: 688
diff changeset
138 || stru_721530.sMinY < pFace->pBounding.y1
Ritor1
parents: 688
diff changeset
139 || stru_721530.sMaxZ > pFace->pBounding.z2
Ritor1
parents: 688
diff changeset
140 || stru_721530.sMinZ < pFace->pBounding.z1
Ritor1
parents: 688
diff changeset
141 || pFloor == stru_721530.field_84 )
0
Ritor1
parents:
diff changeset
142 goto LABEL_45;
717
Ritor1
parents: 688
diff changeset
143 v13 = pFace->pFacePlane_old.vNormal.y;
Ritor1
parents: 688
diff changeset
144 v14 = pFace->pFacePlane_old.dist;
0
Ritor1
parents:
diff changeset
145 v31 = v13;
717
Ritor1
parents: 688
diff changeset
146 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13
Ritor1
parents: 688
diff changeset
147 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16;
0
Ritor1
parents:
diff changeset
148 if ( v15 > 0 )
Ritor1
parents:
diff changeset
149 {
717
Ritor1
parents: 688
diff changeset
150 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z
Ritor1
parents: 688
diff changeset
151 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16;
0
Ritor1
parents:
diff changeset
152 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
153 {
Ritor1
parents:
diff changeset
154 if ( v16 <= v15 )
Ritor1
parents:
diff changeset
155 {
Ritor1
parents:
diff changeset
156 a3 = stru_721530.field_6C;
717
Ritor1
parents: 688
diff changeset
157 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
158 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
159 {
Ritor1
parents:
diff changeset
160 v17 = a3;
Ritor1
parents:
diff changeset
161 }
Ritor1
parents:
diff changeset
162 else
Ritor1
parents:
diff changeset
163 {
Ritor1
parents:
diff changeset
164 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
165 if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) )
0
Ritor1
parents:
diff changeset
166 goto LABEL_34;
Ritor1
parents:
diff changeset
167 v17 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
168 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
169 }
Ritor1
parents:
diff changeset
170 if ( v17 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
171 {
Ritor1
parents:
diff changeset
172 stru_721530.field_7C = v17;
717
Ritor1
parents: 688
diff changeset
173 v18 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
174 LOBYTE(v18) = v18 | 6;
Ritor1
parents:
diff changeset
175 stru_721530.uFaceID = v18;
Ritor1
parents:
diff changeset
176 }
Ritor1
parents:
diff changeset
177 }
Ritor1
parents:
diff changeset
178 }
Ritor1
parents:
diff changeset
179 }
Ritor1
parents:
diff changeset
180 LABEL_34:
Ritor1
parents:
diff changeset
181 if ( !(stru_721530.field_0 & 1)
717
Ritor1
parents: 688
diff changeset
182 || (v19 = pFace->pFacePlane_old.vNormal.x,
Ritor1
parents: 688
diff changeset
183 v20 = pFace->pFacePlane_old.vNormal.y,
0
Ritor1
parents:
diff changeset
184 v30 = v19,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
185 v21 = (stru_721530.position.x * v19 + pFace->pFacePlane_old.dist + stru_721530.position.y * v20
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
186 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16,
0
Ritor1
parents:
diff changeset
187 v21 <= 0)
717
Ritor1
parents: 688
diff changeset
188 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
Ritor1
parents: 688
diff changeset
189 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
0
Ritor1
parents:
diff changeset
190 v21 > stru_721530.prolly_normal_d)
Ritor1
parents:
diff changeset
191 && v22 > stru_721530.prolly_normal_d
Ritor1
parents:
diff changeset
192 || v22 > v21 )
Ritor1
parents:
diff changeset
193 goto LABEL_45;
Ritor1
parents:
diff changeset
194 a3 = stru_721530.field_6C;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
195 if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
196 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
197 {
Ritor1
parents:
diff changeset
198 v23 = a3;
Ritor1
parents:
diff changeset
199 goto LABEL_43;
Ritor1
parents:
diff changeset
200 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
201 a3 = stru_721530.field_6C + stru_721530.field_8_radius;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
202 if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) )
0
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 v23 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
205 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
206 LABEL_43:
Ritor1
parents:
diff changeset
207 if ( v23 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
208 {
Ritor1
parents:
diff changeset
209 stru_721530.field_7C = v23;
717
Ritor1
parents: 688
diff changeset
210 v24 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
211 LOBYTE(v24) = v24 | 6;
Ritor1
parents:
diff changeset
212 stru_721530.uFaceID = v24;
Ritor1
parents:
diff changeset
213 }
Ritor1
parents:
diff changeset
214 }
Ritor1
parents:
diff changeset
215 LABEL_45:
Ritor1
parents:
diff changeset
216 v10 = v26++ + 1;
Ritor1
parents:
diff changeset
217 if ( v26 >= v32 )
Ritor1
parents:
diff changeset
218 goto LABEL_46;
Ritor1
parents:
diff changeset
219 }
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 return result;
Ritor1
parents:
diff changeset
222 }
Ritor1
parents:
diff changeset
223 // 46E44E: using guessed type int var_28[10];
Ritor1
parents:
diff changeset
224
Ritor1
parents:
diff changeset
225 //----- (0046E889) --------------------------------------------------------
Ritor1
parents:
diff changeset
226 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0)
Ritor1
parents:
diff changeset
227 {
Ritor1
parents:
diff changeset
228 int result; // eax@1
Ritor1
parents:
diff changeset
229 BSPModel *v2; // ecx@3
Ritor1
parents:
diff changeset
230 int v3; // ebx@9
Ritor1
parents:
diff changeset
231 ODMFace *v4; // eax@11
Ritor1
parents:
diff changeset
232 int v5; // edi@17
Ritor1
parents:
diff changeset
233 int v6; // esi@17
Ritor1
parents:
diff changeset
234 unsigned int v7; // ecx@17
Ritor1
parents:
diff changeset
235 int v8; // eax@19
Ritor1
parents:
diff changeset
236 int v9; // ecx@20
Ritor1
parents:
diff changeset
237 int v10; // eax@24
Ritor1
parents:
diff changeset
238 int v11; // ST18_4@25
Ritor1
parents:
diff changeset
239 int v12; // ST1C_4@25
Ritor1
parents:
diff changeset
240 int v13; // ST0C_4@25
Ritor1
parents:
diff changeset
241 unsigned int v14; // eax@28
Ritor1
parents:
diff changeset
242 int v15; // eax@30
Ritor1
parents:
diff changeset
243 int v16; // ecx@31
Ritor1
parents:
diff changeset
244 unsigned int v17; // eax@36
Ritor1
parents:
diff changeset
245 int v18; // ST18_4@41
Ritor1
parents:
diff changeset
246 int v19; // ST1C_4@41
Ritor1
parents:
diff changeset
247 int v20; // ST0C_4@41
Ritor1
parents:
diff changeset
248 int v21; // eax@42
Ritor1
parents:
diff changeset
249 unsigned int v22; // eax@43
Ritor1
parents:
diff changeset
250 //BLVFace f; // [sp+Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
251 int v24; // [sp+6Ch] [bp-1Ch]@9
Ritor1
parents:
diff changeset
252 int a11; // [sp+70h] [bp-18h]@1
Ritor1
parents:
diff changeset
253 unsigned int v26; // [sp+74h] [bp-14h]@2
Ritor1
parents:
diff changeset
254 unsigned int v27; // [sp+78h] [bp-10h]@10
Ritor1
parents:
diff changeset
255 BSPModel *v28; // [sp+7Ch] [bp-Ch]@3
Ritor1
parents:
diff changeset
256 int a10; // [sp+80h] [bp-8h]@1
Ritor1
parents:
diff changeset
257 int a2; // [sp+84h] [bp-4h]@23
Ritor1
parents:
diff changeset
258
Ritor1
parents:
diff changeset
259 a11 = ecx0;
Ritor1
parents:
diff changeset
260
Ritor1
parents:
diff changeset
261 BLVFace f; // [sp+Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
262 //BLVFace::BLVFace(&f);
Ritor1
parents:
diff changeset
263
Ritor1
parents:
diff changeset
264 result = 0;
Ritor1
parents:
diff changeset
265 a10 = 0;
Ritor1
parents:
diff changeset
266 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
267 {
Ritor1
parents:
diff changeset
268 v26 = 0;
Ritor1
parents:
diff changeset
269 while ( 1 )
Ritor1
parents:
diff changeset
270 {
Ritor1
parents:
diff changeset
271 v2 = &pOutdoor->pBModels[v26 / 0xBC];
Ritor1
parents:
diff changeset
272 v28 = &pOutdoor->pBModels[v26 / 0xBC];
Ritor1
parents:
diff changeset
273 if ( stru_721530.sMaxX <= pOutdoor->pBModels[v26 / 0xBC].sMaxX )
Ritor1
parents:
diff changeset
274 {
Ritor1
parents:
diff changeset
275 if ( stru_721530.sMinX >= v2->sMinX )
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 if ( stru_721530.sMaxY <= v2->sMaxY )
Ritor1
parents:
diff changeset
278 {
Ritor1
parents:
diff changeset
279 if ( stru_721530.sMinY >= v2->sMinY )
Ritor1
parents:
diff changeset
280 {
Ritor1
parents:
diff changeset
281 if ( stru_721530.sMaxZ <= v2->sMaxZ )
Ritor1
parents:
diff changeset
282 {
Ritor1
parents:
diff changeset
283 if ( stru_721530.sMinZ >= v2->sMinZ )
Ritor1
parents:
diff changeset
284 {
Ritor1
parents:
diff changeset
285 v3 = 0;
Ritor1
parents:
diff changeset
286 v24 = v2->uNumFaces;
Ritor1
parents:
diff changeset
287 if ( v24 > 0 )
Ritor1
parents:
diff changeset
288 break;
Ritor1
parents:
diff changeset
289 }
Ritor1
parents:
diff changeset
290 }
Ritor1
parents:
diff changeset
291 }
Ritor1
parents:
diff changeset
292 }
Ritor1
parents:
diff changeset
293 }
Ritor1
parents:
diff changeset
294 }
Ritor1
parents:
diff changeset
295 LABEL_39:
Ritor1
parents:
diff changeset
296 ++a10;
Ritor1
parents:
diff changeset
297 v26 += 188;
Ritor1
parents:
diff changeset
298 result = a10;
Ritor1
parents:
diff changeset
299 if ( a10 >= (signed int)pOutdoor->uNumBModels )
Ritor1
parents:
diff changeset
300 return result;
Ritor1
parents:
diff changeset
301 }
Ritor1
parents:
diff changeset
302 v27 = 0;
Ritor1
parents:
diff changeset
303 while ( 1 )
Ritor1
parents:
diff changeset
304 {
Ritor1
parents:
diff changeset
305 v4 = &v2->pFaces[v27 / 0x134];
Ritor1
parents:
diff changeset
306 if ( stru_721530.sMaxX > v4->pBoundingBox.x2
Ritor1
parents:
diff changeset
307 || stru_721530.sMinX < v4->pBoundingBox.x1
Ritor1
parents:
diff changeset
308 || stru_721530.sMaxY > v4->pBoundingBox.y2
Ritor1
parents:
diff changeset
309 || stru_721530.sMinY < v4->pBoundingBox.y1
Ritor1
parents:
diff changeset
310 || stru_721530.sMaxZ > v4->pBoundingBox.z2
Ritor1
parents:
diff changeset
311 || stru_721530.sMinZ < v4->pBoundingBox.z1 )
Ritor1
parents:
diff changeset
312 goto LABEL_38;
Ritor1
parents:
diff changeset
313 f.pFacePlane_old.vNormal.x = v4->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
314 f.pFacePlane_old.vNormal.y = v4->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
315 v5 = v4->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
316 f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
317 v6 = v4->pFacePlane.dist;
Ritor1
parents:
diff changeset
318 f.pFacePlane_old.dist = v4->pFacePlane.dist;
Ritor1
parents:
diff changeset
319 v7 = v4->uAttributes;
Ritor1
parents:
diff changeset
320 f.uAttributes = v7;
Ritor1
parents:
diff changeset
321 f.pBounding.x1 = v4->pBoundingBox.x1;
Ritor1
parents:
diff changeset
322 f.pBounding.y1 = v4->pBoundingBox.y1;
Ritor1
parents:
diff changeset
323 f.pBounding.z1 = v4->pBoundingBox.z1;
Ritor1
parents:
diff changeset
324 f.pBounding.x2 = v4->pBoundingBox.x2;
Ritor1
parents:
diff changeset
325 f.pBounding.y2 = v4->pBoundingBox.y2;
Ritor1
parents:
diff changeset
326 f.pBounding.z2 = v4->pBoundingBox.z2;
Ritor1
parents:
diff changeset
327 f.zCalc1 = v4->zCalc1;
Ritor1
parents:
diff changeset
328 f.zCalc2 = v4->zCalc2;
Ritor1
parents:
diff changeset
329 f.zCalc3 = v4->zCalc3;
Ritor1
parents:
diff changeset
330 f.pXInterceptDisplacements = v4->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
331 f.pYInterceptDisplacements = v4->pYInterceptDisplacements;
Ritor1
parents:
diff changeset
332 f.pZInterceptDisplacements = v4->pZInterceptDisplacements;
Ritor1
parents:
diff changeset
333 f.uPolygonType = (PolygonType)v4->uPolygonType;
Ritor1
parents:
diff changeset
334 f.uNumVertices = v4->uNumVertices;
Ritor1
parents:
diff changeset
335 f.uBitmapID = v4->uTextureID;
Ritor1
parents:
diff changeset
336 f.pVertexIDs = v4->pVertexIDs;
Ritor1
parents:
diff changeset
337 if ( !(v7 & 0x20000000) )
Ritor1
parents:
diff changeset
338 {
Ritor1
parents:
diff changeset
339 if ( !(v7 & 1) )
Ritor1
parents:
diff changeset
340 break;
Ritor1
parents:
diff changeset
341 }
Ritor1
parents:
diff changeset
342 LABEL_37:
Ritor1
parents:
diff changeset
343 v2 = v28;
Ritor1
parents:
diff changeset
344 LABEL_38:
Ritor1
parents:
diff changeset
345 v27 += 308;
Ritor1
parents:
diff changeset
346 ++v3;
Ritor1
parents:
diff changeset
347 if ( v3 >= v24 )
Ritor1
parents:
diff changeset
348 goto LABEL_39;
Ritor1
parents:
diff changeset
349 }
Ritor1
parents:
diff changeset
350 v8 = (v5 * stru_721530.normal.z
Ritor1
parents:
diff changeset
351 + v6
Ritor1
parents:
diff changeset
352 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y
Ritor1
parents:
diff changeset
353 + f.pFacePlane_old.vNormal.x * stru_721530.normal.x) >> 16;
Ritor1
parents:
diff changeset
354 if ( v8 > 0 )
Ritor1
parents:
diff changeset
355 {
Ritor1
parents:
diff changeset
356 v9 = (v5 * stru_721530.normal2.z
Ritor1
parents:
diff changeset
357 + v6
Ritor1
parents:
diff changeset
358 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y
Ritor1
parents:
diff changeset
359 + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x) >> 16;
Ritor1
parents:
diff changeset
360 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
361 {
Ritor1
parents:
diff changeset
362 if ( v9 <= v8 )
Ritor1
parents:
diff changeset
363 {
Ritor1
parents:
diff changeset
364 a2 = stru_721530.field_6C;
Ritor1
parents:
diff changeset
365 if ( sub_4754BF(
Ritor1
parents:
diff changeset
366 stru_721530.prolly_normal_d,
Ritor1
parents:
diff changeset
367 &a2,
Ritor1
parents:
diff changeset
368 stru_721530.normal.x,
Ritor1
parents:
diff changeset
369 stru_721530.normal.y,
Ritor1
parents:
diff changeset
370 stru_721530.normal.z,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
371 stru_721530.direction.x,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
372 stru_721530.direction.y,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
373 stru_721530.direction.z,
0
Ritor1
parents:
diff changeset
374 &f,
Ritor1
parents:
diff changeset
375 a10,
Ritor1
parents:
diff changeset
376 a11) )
Ritor1
parents:
diff changeset
377 {
Ritor1
parents:
diff changeset
378 v10 = a2;
Ritor1
parents:
diff changeset
379 }
Ritor1
parents:
diff changeset
380 else
Ritor1
parents:
diff changeset
381 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
382 v11 = stru_721530.direction.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
383 v12 = stru_721530.direction.z;
0
Ritor1
parents:
diff changeset
384 v13 = stru_721530.normal.y;
Ritor1
parents:
diff changeset
385 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C;
Ritor1
parents:
diff changeset
386 if ( !sub_475F30(
Ritor1
parents:
diff changeset
387 &a2,
Ritor1
parents:
diff changeset
388 &f,
Ritor1
parents:
diff changeset
389 stru_721530.normal.x,
Ritor1
parents:
diff changeset
390 v13,
Ritor1
parents:
diff changeset
391 stru_721530.normal.z,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
392 stru_721530.direction.x,
0
Ritor1
parents:
diff changeset
393 v11,
Ritor1
parents:
diff changeset
394 v12,
Ritor1
parents:
diff changeset
395 a10) )
Ritor1
parents:
diff changeset
396 goto LABEL_29;
Ritor1
parents:
diff changeset
397 v10 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
398 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
399 }
Ritor1
parents:
diff changeset
400 if ( v10 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
401 {
Ritor1
parents:
diff changeset
402 stru_721530.field_7C = v10;
Ritor1
parents:
diff changeset
403 v14 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
404 LOBYTE(v14) = v14 | 6;
Ritor1
parents:
diff changeset
405 stru_721530.uFaceID = v14;
Ritor1
parents:
diff changeset
406 }
Ritor1
parents:
diff changeset
407 }
Ritor1
parents:
diff changeset
408 }
Ritor1
parents:
diff changeset
409 }
Ritor1
parents:
diff changeset
410 LABEL_29:
Ritor1
parents:
diff changeset
411 if ( stru_721530.field_0 & 1 )
Ritor1
parents:
diff changeset
412 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
413 v15 = (f.pFacePlane_old.vNormal.z * stru_721530.position.z
0
Ritor1
parents:
diff changeset
414 + f.pFacePlane_old.dist
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
415 + f.pFacePlane_old.vNormal.y * stru_721530.position.y
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
416 + f.pFacePlane_old.vNormal.x * stru_721530.position.x) >> 16;
0
Ritor1
parents:
diff changeset
417 if ( v15 > 0 )
Ritor1
parents:
diff changeset
418 {
Ritor1
parents:
diff changeset
419 v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54
Ritor1
parents:
diff changeset
420 + f.pFacePlane_old.dist
Ritor1
parents:
diff changeset
421 + f.pFacePlane_old.vNormal.y * stru_721530.field_50
Ritor1
parents:
diff changeset
422 + f.pFacePlane_old.vNormal.x * stru_721530.field_4C) >> 16;
Ritor1
parents:
diff changeset
423 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
424 {
Ritor1
parents:
diff changeset
425 if ( v16 <= v15 )
Ritor1
parents:
diff changeset
426 {
Ritor1
parents:
diff changeset
427 a2 = stru_721530.field_6C;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
428 if ( sub_4754BF(stru_721530.field_8_radius,
0
Ritor1
parents:
diff changeset
429 &a2,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
430 stru_721530.position.x,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
431 stru_721530.position.y,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
432 stru_721530.position.z,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
433 stru_721530.direction.x,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
434 stru_721530.direction.y,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
435 stru_721530.direction.z,
0
Ritor1
parents:
diff changeset
436 &f,
Ritor1
parents:
diff changeset
437 a10,
Ritor1
parents:
diff changeset
438 a11) )
Ritor1
parents:
diff changeset
439 {
Ritor1
parents:
diff changeset
440 if ( a2 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
441 {
Ritor1
parents:
diff changeset
442 stru_721530.field_7C = a2;
Ritor1
parents:
diff changeset
443 v17 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
444 LOBYTE(v17) = v17 | 6;
Ritor1
parents:
diff changeset
445 stru_721530.uFaceID = v17;
Ritor1
parents:
diff changeset
446 }
Ritor1
parents:
diff changeset
447 }
Ritor1
parents:
diff changeset
448 else
Ritor1
parents:
diff changeset
449 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
450 v18 = stru_721530.direction.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
451 v19 = stru_721530.direction.z;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
452 v20 = stru_721530.position.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
453 a2 = stru_721530.field_6C + stru_721530.field_8_radius;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
454 if ( sub_475F30(&a2,
0
Ritor1
parents:
diff changeset
455 &f,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
456 stru_721530.position.x,
0
Ritor1
parents:
diff changeset
457 v20,
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
458 stru_721530.position.z,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
459 stru_721530.direction.x,
0
Ritor1
parents:
diff changeset
460 v18,
Ritor1
parents:
diff changeset
461 v19,
Ritor1
parents:
diff changeset
462 a10) )
Ritor1
parents:
diff changeset
463 {
Ritor1
parents:
diff changeset
464 v2 = v28;
Ritor1
parents:
diff changeset
465 v21 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
466 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
467 if ( a2 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
468 {
Ritor1
parents:
diff changeset
469 stru_721530.field_7C = v21;
Ritor1
parents:
diff changeset
470 v22 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
471 LOBYTE(v22) = v22 | 6;
Ritor1
parents:
diff changeset
472 stru_721530.uFaceID = v22;
Ritor1
parents:
diff changeset
473 }
Ritor1
parents:
diff changeset
474 goto LABEL_38;
Ritor1
parents:
diff changeset
475 }
Ritor1
parents:
diff changeset
476 }
Ritor1
parents:
diff changeset
477 }
Ritor1
parents:
diff changeset
478 }
Ritor1
parents:
diff changeset
479 }
Ritor1
parents:
diff changeset
480 }
Ritor1
parents:
diff changeset
481 goto LABEL_37;
Ritor1
parents:
diff changeset
482 }
Ritor1
parents:
diff changeset
483 return result;
Ritor1
parents:
diff changeset
484 }
Ritor1
parents:
diff changeset
485
Ritor1
parents:
diff changeset
486 //----- (0046ED1B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
487 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
488 {
Ritor1
parents:
diff changeset
489 uint uFaceID = -1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
490 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
491
Ritor1
parents:
diff changeset
492 if (floor_level != -30000 && floor_level <= z + 50)
Ritor1
parents:
diff changeset
493 {
Ritor1
parents:
diff changeset
494 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
495 return floor_level;
Ritor1
parents:
diff changeset
496 }
Ritor1
parents:
diff changeset
497
Ritor1
parents:
diff changeset
498 uint uSectorID = pIndoor->GetSector(x, y, z);
Ritor1
parents:
diff changeset
499 *pSectorID = uSectorID;
Ritor1
parents:
diff changeset
500
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
501 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
502 if (uSectorID && floor_level != -30000)
Ritor1
parents:
diff changeset
503 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
504 else return -30000;
Ritor1
parents:
diff changeset
505 return floor_level;
Ritor1
parents:
diff changeset
506 }
Ritor1
parents:
diff changeset
507
Ritor1
parents:
diff changeset
508 //----- (0046ED8A) --------------------------------------------------------
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
509 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this)
0
Ritor1
parents:
diff changeset
510 {
Ritor1
parents:
diff changeset
511 int v1; // ebx@2
Ritor1
parents:
diff changeset
512 ObjectDesc *v2; // edx@4
Ritor1
parents:
diff changeset
513 int v3; // esi@5
Ritor1
parents:
diff changeset
514 int v4; // ecx@5
Ritor1
parents:
diff changeset
515 int v5; // eax@7
Ritor1
parents:
diff changeset
516 int v6; // edi@9
Ritor1
parents:
diff changeset
517 int v7; // edx@9
Ritor1
parents:
diff changeset
518 int v8; // edi@11
Ritor1
parents:
diff changeset
519 int v9; // ebx@11
Ritor1
parents:
diff changeset
520 int v10; // ecx@12
Ritor1
parents:
diff changeset
521 int v11; // esi@13
Ritor1
parents:
diff changeset
522 signed int v12; // [sp+0h] [bp-14h]@1
Ritor1
parents:
diff changeset
523 int v13; // [sp+4h] [bp-10h]@9
Ritor1
parents:
diff changeset
524 char *v14; // [sp+8h] [bp-Ch]@2
Ritor1
parents:
diff changeset
525 unsigned int v15; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
526
Ritor1
parents:
diff changeset
527 v15 = 0;
Ritor1
parents:
diff changeset
528 v12 = _this;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
529 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
530 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
531 v1 = (int)&pSpriteObjects[0].uObjectDescID;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
532 v14 = (char *)&pSpriteObjects[0].uObjectDescID;
0
Ritor1
parents:
diff changeset
533 do
Ritor1
parents:
diff changeset
534 {
Ritor1
parents:
diff changeset
535 if ( *(short *)v1 )
Ritor1
parents:
diff changeset
536 {
Ritor1
parents:
diff changeset
537 v2 = &pObjectList->pObjects[*(short *)v1];
Ritor1
parents:
diff changeset
538 if ( !(v2->uFlags & 2) )
Ritor1
parents:
diff changeset
539 {
Ritor1
parents:
diff changeset
540 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
541 v4 = *(int *)(v1 + 2);
Ritor1
parents:
diff changeset
542 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
543 {
Ritor1
parents:
diff changeset
544 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
545 {
Ritor1
parents:
diff changeset
546 v5 = *(int *)(v1 + 6);
Ritor1
parents:
diff changeset
547 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
548 {
Ritor1
parents:
diff changeset
549 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
550 {
Ritor1
parents:
diff changeset
551 v6 = v2->uHeight;
Ritor1
parents:
diff changeset
552 v7 = *(int *)(v1 + 10);
Ritor1
parents:
diff changeset
553 v13 = v6;
Ritor1
parents:
diff changeset
554 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
555 {
Ritor1
parents:
diff changeset
556 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
557 {
Ritor1
parents:
diff changeset
558 v8 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
559 v9 = v5 - stru_721530.normal.y;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
560 if ( abs(((v4 - stru_721530.normal.x) * stru_721530.direction.y
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
561 - (v5 - stru_721530.normal.y) * stru_721530.direction.x) >> 16) <= v3
0
Ritor1
parents:
diff changeset
562 + stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
563 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
564 v10 = (v8 * stru_721530.direction.x + v9 * stru_721530.direction.y) >> 16;
0
Ritor1
parents:
diff changeset
565 if ( v10 > 0 )
Ritor1
parents:
diff changeset
566 {
Ritor1
parents:
diff changeset
567 v11 = stru_721530.normal.z
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
568 + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16);
0
Ritor1
parents:
diff changeset
569 if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
570 {
Ritor1
parents:
diff changeset
571 if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) )
Ritor1
parents:
diff changeset
572 {
Ritor1
parents:
diff changeset
573 if ( v10 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
574 sub_46DEF2(v12, v15);
Ritor1
parents:
diff changeset
575 }
Ritor1
parents:
diff changeset
576 }
Ritor1
parents:
diff changeset
577 }
Ritor1
parents:
diff changeset
578 }
Ritor1
parents:
diff changeset
579 }
Ritor1
parents:
diff changeset
580 }
Ritor1
parents:
diff changeset
581 }
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 }
Ritor1
parents:
diff changeset
585 }
Ritor1
parents:
diff changeset
586 }
Ritor1
parents:
diff changeset
587 ++v15;
Ritor1
parents:
diff changeset
588 v1 = (int)(v14 + 112);
Ritor1
parents:
diff changeset
589 v14 += 112;
Ritor1
parents:
diff changeset
590 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
591 while ( (signed int)v15 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
592 }
Ritor1
parents:
diff changeset
593 }
Ritor1
parents:
diff changeset
594
Ritor1
parents:
diff changeset
595 //----- (0046EF01) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
596 int _46EF01_collision_chech_player(int a1)
0
Ritor1
parents:
diff changeset
597 {
Ritor1
parents:
diff changeset
598 int v1; // edx@1
Ritor1
parents:
diff changeset
599 int result; // eax@1
Ritor1
parents:
diff changeset
600 int v3; // ebx@7
Ritor1
parents:
diff changeset
601 int v4; // esi@7
Ritor1
parents:
diff changeset
602 int v5; // edi@8
Ritor1
parents:
diff changeset
603 int v6; // ecx@9
Ritor1
parents:
diff changeset
604 int v7; // edi@12
Ritor1
parents:
diff changeset
605 int v8; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
606 unsigned int v9; // [sp+10h] [bp-Ch]@1
Ritor1
parents:
diff changeset
607 int v10; // [sp+14h] [bp-8h]@7
Ritor1
parents:
diff changeset
608 int v11; // [sp+18h] [bp-4h]@7
Ritor1
parents:
diff changeset
609
Ritor1
parents:
diff changeset
610 v8 = a1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
611 v1 = 2 * pParty->field_14_radius;
0
Ritor1
parents:
diff changeset
612 result = pParty->vPosition.x;
Ritor1
parents:
diff changeset
613 v9 = pParty->uPartyHeight;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
614 if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14_radius )
0
Ritor1
parents:
diff changeset
615 {
Ritor1
parents:
diff changeset
616 if ( stru_721530.sMinX >= pParty->vPosition.x - v1 )
Ritor1
parents:
diff changeset
617 {
Ritor1
parents:
diff changeset
618 if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 )
Ritor1
parents:
diff changeset
619 {
Ritor1
parents:
diff changeset
620 if ( stru_721530.sMinY >= pParty->vPosition.y - v1 )
Ritor1
parents:
diff changeset
621 {
Ritor1
parents:
diff changeset
622 if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) )
Ritor1
parents:
diff changeset
623 {
Ritor1
parents:
diff changeset
624 if ( stru_721530.sMinZ >= pParty->vPosition.z )
Ritor1
parents:
diff changeset
625 {
Ritor1
parents:
diff changeset
626 v3 = stru_721530.prolly_normal_d + v1;
Ritor1
parents:
diff changeset
627 v11 = pParty->vPosition.x - stru_721530.normal.x;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
628 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
629 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
0
Ritor1
parents:
diff changeset
630 v10 = pParty->vPosition.y - stru_721530.normal.y;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
631 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
632 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16);
0
Ritor1
parents:
diff changeset
633 if ( result <= v3 )
Ritor1
parents:
diff changeset
634 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
635 result = v10 * stru_721530.direction.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
636 v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16;
0
Ritor1
parents:
diff changeset
637 if ( v5 > 0 )
Ritor1
parents:
diff changeset
638 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
639 v6 = ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
0
Ritor1
parents:
diff changeset
640 result = pParty->vPosition.z;
Ritor1
parents:
diff changeset
641 if ( v6 >= pParty->vPosition.z )
Ritor1
parents:
diff changeset
642 {
Ritor1
parents:
diff changeset
643 result = v9 + pParty->vPosition.z;
Ritor1
parents:
diff changeset
644 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 )
Ritor1
parents:
diff changeset
645 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
646 result = integer_sqrt(v3 * v3 - v4 * v4);
0
Ritor1
parents:
diff changeset
647 v7 = v5 - result;
Ritor1
parents:
diff changeset
648 if ( v7 < 0 )
Ritor1
parents:
diff changeset
649 v7 = 0;
Ritor1
parents:
diff changeset
650 if ( v7 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
651 {
Ritor1
parents:
diff changeset
652 stru_721530.field_7C = v7;
Ritor1
parents:
diff changeset
653 stru_721530.uFaceID = 4;
Ritor1
parents:
diff changeset
654 }
Ritor1
parents:
diff changeset
655 }
Ritor1
parents:
diff changeset
656 }
Ritor1
parents:
diff changeset
657 }
Ritor1
parents:
diff changeset
658 }
Ritor1
parents:
diff changeset
659 }
Ritor1
parents:
diff changeset
660 }
Ritor1
parents:
diff changeset
661 }
Ritor1
parents:
diff changeset
662 }
Ritor1
parents:
diff changeset
663 }
Ritor1
parents:
diff changeset
664 }
Ritor1
parents:
diff changeset
665 return result;
Ritor1
parents:
diff changeset
666 }
Ritor1
parents:
diff changeset
667
Ritor1
parents:
diff changeset
668 //----- (0046F04E) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
669 int _46F04E_collide_against_portals()
0
Ritor1
parents:
diff changeset
670 {
Ritor1
parents:
diff changeset
671 BLVSector *v0; // ecx@1
Ritor1
parents:
diff changeset
672 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
673 int v2; // eax@2
Ritor1
parents:
diff changeset
674 BLVFace *v3; // eax@3
Ritor1
parents:
diff changeset
675 int v4; // ecx@9
Ritor1
parents:
diff changeset
676 int v5; // edx@9
Ritor1
parents:
diff changeset
677 signed int result; // eax@21
Ritor1
parents:
diff changeset
678 BLVFace *v7; // eax@22
Ritor1
parents:
diff changeset
679 signed int v8; // [sp+0h] [bp-14h]@1
Ritor1
parents:
diff changeset
680 BLVSector *v9; // [sp+4h] [bp-10h]@1
Ritor1
parents:
diff changeset
681 unsigned int v10; // [sp+8h] [bp-Ch]@1
Ritor1
parents:
diff changeset
682 int a3; // [sp+Ch] [bp-8h]@13
Ritor1
parents:
diff changeset
683 int v12; // [sp+10h] [bp-4h]@15
Ritor1
parents:
diff changeset
684
Ritor1
parents:
diff changeset
685 v8 = 0;
Ritor1
parents:
diff changeset
686 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
687 v1 = 0xFFFFFFu;
Ritor1
parents:
diff changeset
688 v10 = 0xFFFFFFu;
Ritor1
parents:
diff changeset
689 v9 = v0;
Ritor1
parents:
diff changeset
690 if ( v0->uNumPortals > 0 )
Ritor1
parents:
diff changeset
691 {
Ritor1
parents:
diff changeset
692 do
Ritor1
parents:
diff changeset
693 {
Ritor1
parents:
diff changeset
694 v2 = v0->pPortals[v8];
Ritor1
parents:
diff changeset
695 if ( v2 != stru_721530.field_80 )
Ritor1
parents:
diff changeset
696 {
Ritor1
parents:
diff changeset
697 v3 = &pIndoor->pFaces[v2];
Ritor1
parents:
diff changeset
698 if ( stru_721530.sMaxX <= v3->pBounding.x2 )
Ritor1
parents:
diff changeset
699 {
Ritor1
parents:
diff changeset
700 if ( stru_721530.sMinX >= v3->pBounding.x1
Ritor1
parents:
diff changeset
701 && stru_721530.sMaxY <= v3->pBounding.y2
Ritor1
parents:
diff changeset
702 && stru_721530.sMinY >= v3->pBounding.y1
Ritor1
parents:
diff changeset
703 && stru_721530.sMaxZ <= v3->pBounding.z2
Ritor1
parents:
diff changeset
704 && stru_721530.sMinZ >= v3->pBounding.z1 )
Ritor1
parents:
diff changeset
705 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
706 v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x + v3->pFacePlane_old.dist
0
Ritor1
parents:
diff changeset
707 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
708 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
709 v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z + v3->pFacePlane_old.dist
0
Ritor1
parents:
diff changeset
710 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
711 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
712 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d)
Ritor1
parents:
diff changeset
713 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d)
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
714 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, v3))
0
Ritor1
parents:
diff changeset
715 && a3 < (signed int)v10 )
Ritor1
parents:
diff changeset
716 {
Ritor1
parents:
diff changeset
717 v0 = v9;
Ritor1
parents:
diff changeset
718 v10 = a3;
Ritor1
parents:
diff changeset
719 v12 = v9->pPortals[v8];
Ritor1
parents:
diff changeset
720 }
Ritor1
parents:
diff changeset
721 else
Ritor1
parents:
diff changeset
722 {
Ritor1
parents:
diff changeset
723 v0 = v9;
Ritor1
parents:
diff changeset
724 }
Ritor1
parents:
diff changeset
725 }
Ritor1
parents:
diff changeset
726 }
Ritor1
parents:
diff changeset
727 }
Ritor1
parents:
diff changeset
728 ++v8;
Ritor1
parents:
diff changeset
729 }
Ritor1
parents:
diff changeset
730 while ( v8 < v0->uNumPortals );
Ritor1
parents:
diff changeset
731 v1 = v10;
Ritor1
parents:
diff changeset
732 }
Ritor1
parents:
diff changeset
733 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C )
Ritor1
parents:
diff changeset
734 {
Ritor1
parents:
diff changeset
735 stru_721530.field_80 = v12;
Ritor1
parents:
diff changeset
736 v7 = &pIndoor->pFaces[v12];
Ritor1
parents:
diff changeset
737 if ( v7->uSectorID == stru_721530.uSectorID )
Ritor1
parents:
diff changeset
738 stru_721530.uSectorID = v7->uBackSectorID;
Ritor1
parents:
diff changeset
739 else
Ritor1
parents:
diff changeset
740 stru_721530.uSectorID = v7->uSectorID;
Ritor1
parents:
diff changeset
741 stru_721530.field_7C = 268435455;
Ritor1
parents:
diff changeset
742 result = 0;
Ritor1
parents:
diff changeset
743 }
Ritor1
parents:
diff changeset
744 else
Ritor1
parents:
diff changeset
745 {
Ritor1
parents:
diff changeset
746 result = 1;
Ritor1
parents:
diff changeset
747 }
Ritor1
parents:
diff changeset
748 return result;
Ritor1
parents:
diff changeset
749 }
Ritor1
parents:
diff changeset
750
Ritor1
parents:
diff changeset
751 //----- (0047050A) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
752 int stru141_actor_collision_object::_47050A(int dt)
0
Ritor1
parents:
diff changeset
753 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
754 stru141_actor_collision_object *v2; // esi@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
755 //signed int v3; // eax@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
756 //int v4; // ecx@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
757 //int v5; // edx@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
758 //int v6; // edx@1
0
Ritor1
parents:
diff changeset
759 int v7; // eax@1
Ritor1
parents:
diff changeset
760 int v8; // eax@3
Ritor1
parents:
diff changeset
761 signed int result; // eax@4
Ritor1
parents:
diff changeset
762 int v10; // eax@5
Ritor1
parents:
diff changeset
763 int v11; // eax@5
Ritor1
parents:
diff changeset
764 int v12; // ebx@5
Ritor1
parents:
diff changeset
765 int v13; // edx@5
Ritor1
parents:
diff changeset
766 int v14; // edi@5
Ritor1
parents:
diff changeset
767 int v15; // ecx@5
Ritor1
parents:
diff changeset
768 int v16; // eax@5
Ritor1
parents:
diff changeset
769 int v17; // eax@5
Ritor1
parents:
diff changeset
770 int v18; // eax@7
Ritor1
parents:
diff changeset
771 int v19; // edx@9
Ritor1
parents:
diff changeset
772 int v20; // edi@9
Ritor1
parents:
diff changeset
773 int v21; // eax@9
Ritor1
parents:
diff changeset
774 int v22; // eax@11
Ritor1
parents:
diff changeset
775 int v23; // edx@13
Ritor1
parents:
diff changeset
776 int v24; // eax@13
Ritor1
parents:
diff changeset
777 int v25; // eax@14
Ritor1
parents:
diff changeset
778 int v26; // eax@16
Ritor1
parents:
diff changeset
779 int v27; // eax@17
Ritor1
parents:
diff changeset
780 int v28; // [sp+14h] [bp+8h]@5
Ritor1
parents:
diff changeset
781
Ritor1
parents:
diff changeset
782 v2 = this;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
783 int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x);
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
784
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
785 v2->direction.x = 65536 / speed * v2->velocity.x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
786 v2->direction.y = 65536 / speed * v2->velocity.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
787 v2->direction.z = 65536 / speed * v2->velocity.z;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
788
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
789 v2->speed = speed;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
790 v2->inv_speed = 65536 / speed;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
791
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
792 if (dt)
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
793 v7 = dt;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
794 else
0
Ritor1
parents:
diff changeset
795 v7 = pEventTimer->dt_in_some_format;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
796
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
797 v8 = fixpoint_mul(v7, speed) - v2->field_70; // speed * dt - something
0
Ritor1
parents:
diff changeset
798 v2->field_6C = v8;
Ritor1
parents:
diff changeset
799 if ( v8 > 0 )
Ritor1
parents:
diff changeset
800 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
801 v10 = fixpoint_mul(v8, v2->direction.x) + v2->normal.x;
0
Ritor1
parents:
diff changeset
802 v2->field_4C = v10;
Ritor1
parents:
diff changeset
803 v2->normal2.x = v10;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
804 v11 = fixpoint_mul(v2->field_6C, v2->direction.y) + v2->normal.y;
0
Ritor1
parents:
diff changeset
805 v2->field_50 = v11;
Ritor1
parents:
diff changeset
806 v2->normal2.y = v11;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
807 v2->normal2.z = fixpoint_mul(v2->field_6C, v2->direction.z) + v2->normal.z;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
808 v12 = v2->position.z;
0
Ritor1
parents:
diff changeset
809 v13 = v2->normal.x;
Ritor1
parents:
diff changeset
810 v14 = v2->normal2.x;
Ritor1
parents:
diff changeset
811 v15 = v2->prolly_normal_d;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
812 v16 = v12 + fixpoint_mul(v2->field_6C, v2->direction.z);
0
Ritor1
parents:
diff changeset
813 v28 = v16;
Ritor1
parents:
diff changeset
814 v2->field_54 = v16;
Ritor1
parents:
diff changeset
815 v17 = v13;
Ritor1
parents:
diff changeset
816 if ( v13 >= v14 )
Ritor1
parents:
diff changeset
817 v17 = v14;
Ritor1
parents:
diff changeset
818 v2->sMaxX = v17 - v15;
Ritor1
parents:
diff changeset
819 v18 = v15 + v13;
Ritor1
parents:
diff changeset
820 if ( v13 <= v14 )
Ritor1
parents:
diff changeset
821 v18 = v15 + v14;
Ritor1
parents:
diff changeset
822 v19 = v2->normal.y;
Ritor1
parents:
diff changeset
823 v20 = v2->normal2.y;
Ritor1
parents:
diff changeset
824 v2->sMinX = v18;
Ritor1
parents:
diff changeset
825 v21 = v19;
Ritor1
parents:
diff changeset
826 if ( v19 >= v20 )
Ritor1
parents:
diff changeset
827 v21 = v20;
Ritor1
parents:
diff changeset
828 v2->sMaxY = v21 - v15;
Ritor1
parents:
diff changeset
829 v22 = v15 + v19;
Ritor1
parents:
diff changeset
830 if ( v19 <= v20 )
Ritor1
parents:
diff changeset
831 v22 = v20 + v15;
Ritor1
parents:
diff changeset
832 v23 = v2->normal2.z;
Ritor1
parents:
diff changeset
833 v2->sMinY = v22;
Ritor1
parents:
diff changeset
834 v24 = v2->normal.z;
Ritor1
parents:
diff changeset
835 if ( v24 >= v23 )
Ritor1
parents:
diff changeset
836 v25 = v23 - v15;
Ritor1
parents:
diff changeset
837 else
Ritor1
parents:
diff changeset
838 v25 = v24 - v15;
Ritor1
parents:
diff changeset
839 v2->sMaxZ = v25;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
840 v26 = v2->field_8_radius;
0
Ritor1
parents:
diff changeset
841 if ( v12 <= v28 )
Ritor1
parents:
diff changeset
842 v27 = v28 + v26;
Ritor1
parents:
diff changeset
843 else
Ritor1
parents:
diff changeset
844 v27 = v12 + v26;
Ritor1
parents:
diff changeset
845 v2->uFaceID = 0;
Ritor1
parents:
diff changeset
846 v2->field_80 = -1;
Ritor1
parents:
diff changeset
847 v2->field_88 = -1;
Ritor1
parents:
diff changeset
848 v2->sMinZ = v27;
Ritor1
parents:
diff changeset
849 v2->field_7C = 0xFFFFFFu;
Ritor1
parents:
diff changeset
850 result = 0;
Ritor1
parents:
diff changeset
851 }
Ritor1
parents:
diff changeset
852 else
Ritor1
parents:
diff changeset
853 {
Ritor1
parents:
diff changeset
854 result = 1;
Ritor1
parents:
diff changeset
855 }
Ritor1
parents:
diff changeset
856 return result;
Ritor1
parents:
diff changeset
857 }
Ritor1
parents:
diff changeset
858
Ritor1
parents:
diff changeset
859 //----- (004706C6) --------------------------------------------------------
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
860 void UpdateActors_ODM()
0
Ritor1
parents:
diff changeset
861 {
Ritor1
parents:
diff changeset
862 Actor *v0; // esi@2
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
863 AIState uAIState; // ax@2
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
864 //unsigned int v2; // ecx@6
0
Ritor1
parents:
diff changeset
865 int v3; // ebx@6
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
866 //int v4; // eax@8
0
Ritor1
parents:
diff changeset
867 int v5; // eax@10
Ritor1
parents:
diff changeset
868 int v6; // ecx@10
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
869 //signed int v7; // ebx@10
0
Ritor1
parents:
diff changeset
870 signed int v8; // ebx@17
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
871 //unsigned __int8 v9; // zf@17
0
Ritor1
parents:
diff changeset
872 unsigned __int8 v10; // sf@17
Ritor1
parents:
diff changeset
873 unsigned __int16 v11; // ax@21
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
874 //int v12; // eax@29
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
875 //unsigned __int64 v13; // qax@29
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
876 //int v14; // eax@30
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
877 //unsigned __int64 v15; // qax@30
0
Ritor1
parents:
diff changeset
878 int v16; // eax@33
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
879 //int v17; // edi@34
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
880 //int v18; // edx@42
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
881 //int v19; // ecx@42
0
Ritor1
parents:
diff changeset
882 __int16 v20; // ax@42
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
883 //int v21; // ebx@42
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
884 //int v22; // edi@42
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
885 //int v23; // ecx@42
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
886 //__int16 v24; // ax@42
0
Ritor1
parents:
diff changeset
887 int v25; // eax@45
Ritor1
parents:
diff changeset
888 signed int v26; // ecx@50
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
889 //int v27; // eax@52
0
Ritor1
parents:
diff changeset
890 int v28; // eax@54
Ritor1
parents:
diff changeset
891 signed int v29; // ebx@57
Ritor1
parents:
diff changeset
892 signed int v30; // eax@57
Ritor1
parents:
diff changeset
893 int v31; // edi@57
Ritor1
parents:
diff changeset
894 signed int i; // ebx@57
Ritor1
parents:
diff changeset
895 unsigned int v33; // ecx@58
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
896 //int v34; // ebx@64
0
Ritor1
parents:
diff changeset
897 int v35; // edi@64
Ritor1
parents:
diff changeset
898 int v36; // eax@64
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
899 //unsigned __int16 v37; // cx@66
0
Ritor1
parents:
diff changeset
900 signed int v38; // edx@71
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
901 unsigned int v39; // edi@71
0
Ritor1
parents:
diff changeset
902 BSPModel *v40; // eax@75
Ritor1
parents:
diff changeset
903 ODMFace *v41; // edi@75
Ritor1
parents:
diff changeset
904 int v42; // ebx@76
Ritor1
parents:
diff changeset
905 int v43; // ecx@77
Ritor1
parents:
diff changeset
906 int v44; // edx@77
Ritor1
parents:
diff changeset
907 __int16 v45; // dx@82
Ritor1
parents:
diff changeset
908 int v46; // ecx@82
Ritor1
parents:
diff changeset
909 signed int v47; // ebx@85
Ritor1
parents:
diff changeset
910 int v48; // edi@85
Ritor1
parents:
diff changeset
911 int v49; // edi@85
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
912 //int v50; // eax@85
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
913 //unsigned __int64 v51; // qax@85
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
914 //unsigned __int8 v52; // zf@87
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
915 //unsigned __int8 v53; // sf@87
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
916 // unsigned __int8 v54; // of@104
0
Ritor1
parents:
diff changeset
917 int v55; // eax@107
Ritor1
parents:
diff changeset
918 unsigned int v56; // edi@107
Ritor1
parents:
diff changeset
919 int v57; // ST10_4@107
Ritor1
parents:
diff changeset
920 unsigned int v58; // edi@107
Ritor1
parents:
diff changeset
921 unsigned int v59; // ebx@107
Ritor1
parents:
diff changeset
922 signed int v60; // eax@107
Ritor1
parents:
diff changeset
923 int v61; // eax@124
Ritor1
parents:
diff changeset
924 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42
153
86a2637ba125 UpdateActors
Ritor1
parents: 152
diff changeset
925 int v63; // [sp+18h] [bp-38h]@64
0
Ritor1
parents:
diff changeset
926 int v64; // [sp+1Ch] [bp-34h]@64
Ritor1
parents:
diff changeset
927 int v65; // [sp+20h] [bp-30h]@2
Ritor1
parents:
diff changeset
928 int v66; // [sp+24h] [bp-2Ch]@2
Ritor1
parents:
diff changeset
929 bool v67; // [sp+28h] [bp-28h]@10
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
930 //unsigned int v68; // [sp+2Ch] [bp-24h]@10
0
Ritor1
parents:
diff changeset
931 unsigned int v69; // [sp+30h] [bp-20h]@6
Ritor1
parents:
diff changeset
932 unsigned int v70; // [sp+34h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
933 int v71; // [sp+38h] [bp-18h]@62
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
934 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
935 int v72b;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
936 //int v73; // [sp+40h] [bp-10h]@17
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
937 int uIsFlying; // [sp+44h] [bp-Ch]@8
0
Ritor1
parents:
diff changeset
938 unsigned int v75; // [sp+48h] [bp-8h]@1
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
939 int uIsOnWater; // [sp+4Ch] [bp-4h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
940
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
941 for (v75 = 0; v75 < uNumActors; ++v75)
0
Ritor1
parents:
diff changeset
942 {
Ritor1
parents:
diff changeset
943 v0 = &pActors[v75];
Ritor1
parents:
diff changeset
944 v66 = v0->vPosition.x;
Ritor1
parents:
diff changeset
945 v65 = v0->vPosition.y;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
946 uAIState = v0->uAIState;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
947 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
948 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
949 continue;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
950 }
0
Ritor1
parents:
diff changeset
951 v3 = 0;
Ritor1
parents:
diff changeset
952 v69 = 0;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
953 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
0
Ritor1
parents:
diff changeset
954 v3 = 1;
Ritor1
parents:
diff changeset
955 v0->uSectorID = 0;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
956 uIsFlying = v0->pMonsterInfo.uFlying;
0
Ritor1
parents:
diff changeset
957 if ( !v0->CanAct() )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
958 uIsFlying = 0;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
959 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
960 v5 = ODM_GetFloorLevel(
0
Ritor1
parents:
diff changeset
961 v0->vPosition.x,
Ritor1
parents:
diff changeset
962 v0->vPosition.y,
Ritor1
parents:
diff changeset
963 v0->vPosition.z,
Ritor1
parents:
diff changeset
964 v0->uActorHeight,
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
965 &uIsOnWater,
0
Ritor1
parents:
diff changeset
966 (int *)&v69,
Ritor1
parents:
diff changeset
967 v3);
Ritor1
parents:
diff changeset
968 v6 = v0->vPosition.z;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
969 uIsAboveFloor = 0;
0
Ritor1
parents:
diff changeset
970 v67 = v69 == 0;
Ritor1
parents:
diff changeset
971 if ( v6 > v5 + 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
972 uIsAboveFloor = 1;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
973 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor )
0
Ritor1
parents:
diff changeset
974 {
Ritor1
parents:
diff changeset
975 v0->uAIState = Removed;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
976 continue;
0
Ritor1
parents:
diff changeset
977 }
305
cc8e4dc397ec MonsterPopup_Draw crash fix
Nomad
parents: 303
diff changeset
978 if ( v0->uCurrentActionAnimation == ANIM_Walking )
0
Ritor1
parents:
diff changeset
979 {
Ritor1
parents:
diff changeset
980 v8 = v0->uMovementSpeed;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
981 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
982 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
983 v8 = (signed __int64)((double)v8 * 0.5);
0
Ritor1
parents:
diff changeset
984 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
985 if ( uAIState == Fleeing || uAIState == Pursuing )
0
Ritor1
parents:
diff changeset
986 {
Ritor1
parents:
diff changeset
987 v8 *= 2;
Ritor1
parents:
diff changeset
988 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
989 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
990 v8 *= flt_6BE3AC_debug_recmod1_x_1_6;
0
Ritor1
parents:
diff changeset
991 if ( v8 > 1000 )
Ritor1
parents:
diff changeset
992 v8 = 1000;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
993
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
994 v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v0->uYawAngle), v8);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
995 v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v0->uYawAngle), v8);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
996 if ( uIsFlying )
0
Ritor1
parents:
diff changeset
997 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
998 v0->vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(v0->uPitchAngle), v8);
0
Ritor1
parents:
diff changeset
999 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1000 //v7 = v68;
0
Ritor1
parents:
diff changeset
1001 }
Ritor1
parents:
diff changeset
1002 else
Ritor1
parents:
diff changeset
1003 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1004 v0->vVelocity.x = fixpoint_mul(55000, v0->vVelocity.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1005 v0->vVelocity.y = fixpoint_mul(55000, v0->vVelocity.y);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1006 if ( uIsFlying )
0
Ritor1
parents:
diff changeset
1007 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1008 v0->vVelocity.z = fixpoint_mul(55000, v0->vVelocity.z);
0
Ritor1
parents:
diff changeset
1009 }
Ritor1
parents:
diff changeset
1010 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1011 if ( v0->vPosition.z < v5 )
0
Ritor1
parents:
diff changeset
1012 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1013 v16 = uIsFlying;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1014 v0->vPosition.z = v5;
0
Ritor1
parents:
diff changeset
1015 v0->vVelocity.z = v16 != 0 ? 0x14 : 0;
Ritor1
parents:
diff changeset
1016 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1017 //v17 = 0;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1018 if ( !uIsAboveFloor || uIsFlying )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1019 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1020 if ( v70 && !uIsAboveFloor && v67 )
0
Ritor1
parents:
diff changeset
1021 {
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1022 v0->vPosition.z = v5;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1023 ODM_GetTerrainNormalAt(v0->vPosition.x, v0->vPosition.y, &v62);
0
Ritor1
parents:
diff changeset
1024 v20 = GetGravityStrength();
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1025 //v21 = v62.y;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1026 //v22 = v62.z;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1027 //v23 = v62.y * v0->vVelocity.y;
0
Ritor1
parents:
diff changeset
1028 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1029 int v73 = abs(v62.x * v0->vVelocity.x + v62.z * v0->vVelocity.z + v62.y * v0->vVelocity.y) >> 16;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1030 //v72b = v21;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1031 v0->vVelocity.x += fixpoint_mul(v73, v62.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1032 v0->vVelocity.y += fixpoint_mul(v73, v62.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1033 v0->vVelocity.z += fixpoint_mul(v73, v62.z);
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1034 //v17 = 0;
0
Ritor1
parents:
diff changeset
1035 }
Ritor1
parents:
diff changeset
1036 }
Ritor1
parents:
diff changeset
1037 else
Ritor1
parents:
diff changeset
1038 {
Ritor1
parents:
diff changeset
1039 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
Ritor1
parents:
diff changeset
1040 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1041 if ( pParty->armageddon_timer != 0 && v0->CanAct() )
0
Ritor1
parents:
diff changeset
1042 {
Ritor1
parents:
diff changeset
1043 v0->vVelocity.x += rand() % 100 - 50;
Ritor1
parents:
diff changeset
1044 v0->vVelocity.y += rand() % 100 - 50;
Ritor1
parents:
diff changeset
1045 v0->vVelocity.z += rand() % 100 - 20;
Ritor1
parents:
diff changeset
1046 v25 = rand();
Ritor1
parents:
diff changeset
1047 v0->uAIState = Stunned;
Ritor1
parents:
diff changeset
1048 v0->uYawAngle += v25 % 32 - 16;
Ritor1
parents:
diff changeset
1049 v0->UpdateAnimation();
Ritor1
parents:
diff changeset
1050 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1051 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == 0 )
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1052 {
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1053 v0->vVelocity.y = 0;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1054 v0->vVelocity.x = 0;
0
Ritor1
parents:
diff changeset
1055 }
Ritor1
parents:
diff changeset
1056 stru_721530.field_0 = 1;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1057 if ( !uIsFlying )
0
Ritor1
parents:
diff changeset
1058 v26 = 40;
Ritor1
parents:
diff changeset
1059 else
Ritor1
parents:
diff changeset
1060 v26 = v0->uActorRadius;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1061
0
Ritor1
parents:
diff changeset
1062 stru_721530.field_84 = -1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1063 stru_721530.field_8_radius = v26;
0
Ritor1
parents:
diff changeset
1064 stru_721530.prolly_normal_d = v26;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1065 stru_721530.height = v0->uActorHeight;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1066 stru_721530.field_70 = 0;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1067 v69 = 0;
0
Ritor1
parents:
diff changeset
1068 while ( 1 )
Ritor1
parents:
diff changeset
1069 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1070 stru_721530.position.x = v0->vPosition.x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1071 stru_721530.normal.x = stru_721530.position.x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1072 stru_721530.position.y = v0->vPosition.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1073 stru_721530.normal.y = stru_721530.position.y;
0
Ritor1
parents:
diff changeset
1074 v28 = v0->vPosition.z;
Ritor1
parents:
diff changeset
1075 stru_721530.normal.z = v28 + v26 + 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1076 stru_721530.position.z = v28 - v26 + stru_721530.height - 1;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1077 if ( stru_721530.position.z < stru_721530.normal.z )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1078 stru_721530.position.z = v28 + v26 + 1;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1079 stru_721530.velocity.x = v0->vVelocity.x;
0
Ritor1
parents:
diff changeset
1080 stru_721530.uSectorID = 0;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1081 stru_721530.velocity.y = v0->vVelocity.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1082 stru_721530.velocity.z = v0->vVelocity.z;
0
Ritor1
parents:
diff changeset
1083 if ( stru_721530._47050A(0) )
Ritor1
parents:
diff changeset
1084 break;
Ritor1
parents:
diff changeset
1085 _46E889_collide_against_bmodels(1u);
Ritor1
parents:
diff changeset
1086 v29 = WorldPosToGridCellZ(v0->vPosition.y);
Ritor1
parents:
diff changeset
1087 v30 = WorldPosToGridCellX(v0->vPosition.x);
Ritor1
parents:
diff changeset
1088 _46E26D_collide_against_sprites(v30, v29);
Ritor1
parents:
diff changeset
1089 _46EF01_collision_chech_player(0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
1090 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75));
0
Ritor1
parents:
diff changeset
1091 v31 = 0;
Ritor1
parents:
diff changeset
1092 for ( i = 0; v31 < ai_arrays_size; ++v31 )
Ritor1
parents:
diff changeset
1093 {
390
35a62d1948d4 More sound fixes
Nomad
parents: 377
diff changeset
1094 v33 = ai_near_actors_ids[v31];
0
Ritor1
parents:
diff changeset
1095 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) )
Ritor1
parents:
diff changeset
1096 ++i;
Ritor1
parents:
diff changeset
1097 }
Ritor1
parents:
diff changeset
1098 v71 = i > 1;
Ritor1
parents:
diff changeset
1099 if ( stru_721530.field_7C < stru_721530.field_6C )
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1100 v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1101 //v34 = 0;
0
Ritor1
parents:
diff changeset
1102 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1103 v36 = ODM_GetFloorLevel(stru_721530.normal2.x,
0
Ritor1
parents:
diff changeset
1104 stru_721530.normal2.y,
Ritor1
parents:
diff changeset
1105 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
Ritor1
parents:
diff changeset
1106 v0->uActorHeight,
Ritor1
parents:
diff changeset
1107 (int *)&v63,
Ritor1
parents:
diff changeset
1108 &v64,
Ritor1
parents:
diff changeset
1109 0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1110 if ( uIsOnWater )
0
Ritor1
parents:
diff changeset
1111 {
Ritor1
parents:
diff changeset
1112 if ( v35 < v36 + 60 )
Ritor1
parents:
diff changeset
1113 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1114 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled )
0
Ritor1
parents:
diff changeset
1115 {
Ritor1
parents:
diff changeset
1116 if ( v64 )
Ritor1
parents:
diff changeset
1117 v61 = v36 + 30;
Ritor1
parents:
diff changeset
1118 else
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1119 v61 = v5 + 60;
0
Ritor1
parents:
diff changeset
1120 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61);
Ritor1
parents:
diff changeset
1121 v0->uAIState = Removed;
Ritor1
parents:
diff changeset
1122 return;
Ritor1
parents:
diff changeset
1123 }
Ritor1
parents:
diff changeset
1124 }
Ritor1
parents:
diff changeset
1125 }
Ritor1
parents:
diff changeset
1126 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1127 {
Ritor1
parents:
diff changeset
1128 v0->vPosition.x = LOWORD(stru_721530.normal2.x);
Ritor1
parents:
diff changeset
1129 v0->vPosition.y = LOWORD(stru_721530.normal2.y);
Ritor1
parents:
diff changeset
1130 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
Ritor1
parents:
diff changeset
1131 break;
Ritor1
parents:
diff changeset
1132 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1133 //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1134 v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1135 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1136 v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1137 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1138 v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
0
Ritor1
parents:
diff changeset
1139 v38 = stru_721530.uFaceID;
Ritor1
parents:
diff changeset
1140 stru_721530.field_70 += stru_721530.field_7C;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1141 v39 = PID_ID(v38);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1142 switch ( PID_TYPE(v38) )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1143 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1144 case OBJECT_Actor:
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1145 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1146 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1147 //if(pParty->bTurnBasedModeOn == 1)
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1148 //v34 = 0;
0
Ritor1
parents:
diff changeset
1149 if ( v0->pMonsterInfo.uHostilityType )
Ritor1
parents:
diff changeset
1150 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1151 if ( v71 == 0 )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1152 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1153 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1154 }
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1155 else
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1156 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1157 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1158 }
0
Ritor1
parents:
diff changeset
1159 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1160 else if ( v71 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1161 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1162 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1163 }
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1164 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
0
Ritor1
parents:
diff changeset
1165 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1166 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
0
Ritor1
parents:
diff changeset
1167 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1168 else
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1169 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1170 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1171 }
0
Ritor1
parents:
diff changeset
1172 }
Ritor1
parents:
diff changeset
1173 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1174 case OBJECT_Player:
0
Ritor1
parents:
diff changeset
1175 if ( !v0->GetActorsRelation(0) )
Ritor1
parents:
diff changeset
1176 {
Ritor1
parents:
diff changeset
1177 v38 = stru_721530.uFaceID;
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1178 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1179 break;
0
Ritor1
parents:
diff changeset
1180 }
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1181 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1182 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0;
0
Ritor1
parents:
diff changeset
1183 v0->vVelocity.y = 0;
Ritor1
parents:
diff changeset
1184 v0->vVelocity.x = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1185 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) )
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1186 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0)
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1187 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
0
Ritor1
parents:
diff changeset
1188 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1189 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1190 case OBJECT_Decoration:
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
1191 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
0
Ritor1
parents:
diff changeset
1192 v48 = stru_5C6E00->Atan2(
Ritor1
parents:
diff changeset
1193 v0->vPosition.x - pLevelDecorations[v39].vPosition.x,
Ritor1
parents:
diff changeset
1194 v0->vPosition.y - pLevelDecorations[v39].vPosition.y);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1195 v49 = v48;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1196 v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1197 v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47);
0
Ritor1
parents:
diff changeset
1198 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1199 case OBJECT_BModel:
0
Ritor1
parents:
diff changeset
1200 v40 = &pOutdoor->pBModels[v38 >> 9];
Ritor1
parents:
diff changeset
1201 v41 = &v40->pFaces[v39 & 0x3F];
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1202 if ( !(v41->uAttributes & 0x20000000) )
0
Ritor1
parents:
diff changeset
1203 {
Ritor1
parents:
diff changeset
1204 v42 = v41->uPolygonType;
Ritor1
parents:
diff changeset
1205 if ( v42 == 3 )
Ritor1
parents:
diff changeset
1206 {
Ritor1
parents:
diff changeset
1207 v43 = v0->vVelocity.y;
Ritor1
parents:
diff changeset
1208 v44 = v0->vVelocity.x;
Ritor1
parents:
diff changeset
1209 v0->vVelocity.z = 0;
Ritor1
parents:
diff changeset
1210 v0->vPosition.z = LOWORD(v40->pVertices.pVertices[v41->pVertexIDs[0]].z) + 1;
Ritor1
parents:
diff changeset
1211 if ( v44 * v44 + v43 * v43 < 400 )
Ritor1
parents:
diff changeset
1212 {
Ritor1
parents:
diff changeset
1213 v0->vVelocity.y = 0;
Ritor1
parents:
diff changeset
1214 v0->vVelocity.x = 0;
Ritor1
parents:
diff changeset
1215 }
Ritor1
parents:
diff changeset
1216 }
Ritor1
parents:
diff changeset
1217 else
Ritor1
parents:
diff changeset
1218 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1219 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z
0
Ritor1
parents:
diff changeset
1220 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1221 if ( (stru_721530.speed >> 3) > v72b )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1222 v72b = stru_721530.speed >> 3;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1223
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1224 v0->vVelocity.x += fixpoint_mul(v72b, v41->pFacePlane.vNormal.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1225 v0->vVelocity.y += fixpoint_mul(v72b, v41->pFacePlane.vNormal.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1226 v0->vVelocity.z += fixpoint_mul(v72b, v41->pFacePlane.vNormal.z);
0
Ritor1
parents:
diff changeset
1227 if ( v42 != 4 )
Ritor1
parents:
diff changeset
1228 {
Ritor1
parents:
diff changeset
1229 v45 = v0->vPosition.z;
Ritor1
parents:
diff changeset
1230 v46 = stru_721530.prolly_normal_d
Ritor1
parents:
diff changeset
1231 - ((v41->pFacePlane.dist
Ritor1
parents:
diff changeset
1232 + v41->pFacePlane.vNormal.x * v0->vPosition.x
Ritor1
parents:
diff changeset
1233 + v41->pFacePlane.vNormal.y * v0->vPosition.y
Ritor1
parents:
diff changeset
1234 + v41->pFacePlane.vNormal.z * v0->vPosition.z) >> 16);
Ritor1
parents:
diff changeset
1235 if ( v46 > 0 )
Ritor1
parents:
diff changeset
1236 {
Ritor1
parents:
diff changeset
1237 v0->vPosition.x += (unsigned int)(v46 * v41->pFacePlane.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
1238 v0->vPosition.y += (unsigned int)(v46 * v41->pFacePlane.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
1239 v0->vPosition.z = v45 + ((unsigned int)(v46 * v41->pFacePlane.vNormal.z) >> 16);
Ritor1
parents:
diff changeset
1240 }
Ritor1
parents:
diff changeset
1241 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y);
Ritor1
parents:
diff changeset
1242 }
Ritor1
parents:
diff changeset
1243 }
Ritor1
parents:
diff changeset
1244 }
Ritor1
parents:
diff changeset
1245 break;
Ritor1
parents:
diff changeset
1246 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1247
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1248 v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1249 v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1250 v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1251
0
Ritor1
parents:
diff changeset
1252 ++v69;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1253 if ( v69 >= 100 )
0
Ritor1
parents:
diff changeset
1254 break;
Ritor1
parents:
diff changeset
1255 v26 = stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
1256 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1257 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1258 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1259 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x)
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1260 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y)
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1261 && v58
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1262 || v67 != 0 )
0
Ritor1
parents:
diff changeset
1263 {
Ritor1
parents:
diff changeset
1264 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
Ritor1
parents:
diff changeset
1265 {
Ritor1
parents:
diff changeset
1266 v58 = v58 == 0;
Ritor1
parents:
diff changeset
1267 v59 = v59 == 0;
Ritor1
parents:
diff changeset
1268 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1269 if ( !uIsFlying && v58 && !v59 )
0
Ritor1
parents:
diff changeset
1270 {
Ritor1
parents:
diff changeset
1271 v0->vPosition.x = v66;
Ritor1
parents:
diff changeset
1272 v0->vPosition.y = v65;
Ritor1
parents:
diff changeset
1273 if ( v0->CanAct() )
Ritor1
parents:
diff changeset
1274 {
Ritor1
parents:
diff changeset
1275 v0->uYawAngle -= 32;
Ritor1
parents:
diff changeset
1276 v0->uCurrentActionTime = 0;
Ritor1
parents:
diff changeset
1277 v0->uCurrentActionLength = 128;
Ritor1
parents:
diff changeset
1278 v0->uAIState = Fleeing;
Ritor1
parents:
diff changeset
1279 }
Ritor1
parents:
diff changeset
1280 }
Ritor1
parents:
diff changeset
1281 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1282 }
0
Ritor1
parents:
diff changeset
1283 }
Ritor1
parents:
diff changeset
1284
Ritor1
parents:
diff changeset
1285 //----- (0047253E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1286 void UpdateObjects()
Ritor1
parents:
diff changeset
1287 {
Ritor1
parents:
diff changeset
1288 unsigned int v0; // ebx@0
Ritor1
parents:
diff changeset
1289 //unsigned int v1; // edi@1
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1290 //char *v2; // esi@2
0
Ritor1
parents:
diff changeset
1291 //__int16 v3; // dx@5
Ritor1
parents:
diff changeset
1292 ObjectDesc *v4; // eax@5
Ritor1
parents:
diff changeset
1293 int v5; // ecx@6
Ritor1
parents:
diff changeset
1294 __int16 v6; // cx@7
Ritor1
parents:
diff changeset
1295 signed int v7; // eax@9
Ritor1
parents:
diff changeset
1296 __int16 v8; // cx@14
Ritor1
parents:
diff changeset
1297 __int16 v9; // dx@14
Ritor1
parents:
diff changeset
1298 unsigned int v10; // ecx@16
Ritor1
parents:
diff changeset
1299 signed int v11; // eax@17
Ritor1
parents:
diff changeset
1300 int v12; // edi@27
Ritor1
parents:
diff changeset
1301 int v13; // eax@27
Ritor1
parents:
diff changeset
1302 int v14; // ebx@27
Ritor1
parents:
diff changeset
1303 unsigned int v15; // ecx@27
Ritor1
parents:
diff changeset
1304 unsigned int v16; // edx@30
Ritor1
parents:
diff changeset
1305 unsigned int v17; // edx@32
Ritor1
parents:
diff changeset
1306 int v18; // [sp+4h] [bp-10h]@27
Ritor1
parents:
diff changeset
1307 int v19; // [sp+8h] [bp-Ch]@27
Ritor1
parents:
diff changeset
1308 //signed int v20; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1309
Ritor1
parents:
diff changeset
1310 //v1 = 0;
Ritor1
parents:
diff changeset
1311 //v20 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1312 for (uint i = 0; i < uNumSpriteObjects; ++i)
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1313 {
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
1314 auto item = &pSpriteObjects[i];
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1315 //v2 = (char *)&item->uSpriteFrameID;
0
Ritor1
parents:
diff changeset
1316 //do
Ritor1
parents:
diff changeset
1317 //{
Ritor1
parents:
diff changeset
1318 //LOWORD(v0) = item->uAttributes;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1319 if (item->uAttributes & OBJECT_40)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1320 item->uAttributes &= ~OBJECT_40;
0
Ritor1
parents:
diff changeset
1321 else
Ritor1
parents:
diff changeset
1322 {
Ritor1
parents:
diff changeset
1323 //v3 = item->uObjectDescID;
Ritor1
parents:
diff changeset
1324 v4 = &pObjectList->pObjects[item->uObjectDescID];
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1325 if (item->AttachedToActor())
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1326 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1327 v5 = PID_ID(item->spell_target_pid);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1328 item->vPosition.x = pActors[v5].vPosition.x;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1329 item->vPosition.y = pActors[v5].vPosition.y;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1330 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1331 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1332 continue;
0
Ritor1
parents:
diff changeset
1333 if ( v6 >= 0 )
Ritor1
parents:
diff changeset
1334 {
Ritor1
parents:
diff changeset
1335 v7 = v4->uLifetime;
Ritor1
parents:
diff changeset
1336 if (item->uAttributes & 2)
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1337 v7 = item->field_20;
0
Ritor1
parents:
diff changeset
1338 if ( v6 < v7 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1339 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1340 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1341 v10 = i;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1342 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1343 continue;
0
Ritor1
parents:
diff changeset
1344 }
Ritor1
parents:
diff changeset
1345
Ritor1
parents:
diff changeset
1346 if ( item->uObjectDescID )
Ritor1
parents:
diff changeset
1347 {
Ritor1
parents:
diff changeset
1348 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
Ritor1
parents:
diff changeset
1349 item->uSpriteFrameID = v8;
Ritor1
parents:
diff changeset
1350 v9 = v4->uFlags;
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1351 if ( v9 & 4 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1352 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1353 if ( v8 < 0 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1354 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1355 v10 = i;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1356 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1357 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1358 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1359 v11 = v4->uLifetime;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1360 if (item->uAttributes & 2)
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1361 v11 = item->field_20;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1362 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1363 if ( !(v9 & 4) || v8 < v11 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1364 {
0
Ritor1
parents:
diff changeset
1365 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1366 SpriteObject::UpdateObject_fn0_BLV(i);
0
Ritor1
parents:
diff changeset
1367 else
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1368 SpriteObject::UpdateObject_fn0_ODM(i);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1369 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1370 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1371 v12 = abs(pParty->vPosition.x - item->vPosition.x);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1372 v18 = abs(pParty->vPosition.y - item->vPosition.y);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1373 v19 = abs(pParty->vPosition.z - item->vPosition.z);
0
Ritor1
parents:
diff changeset
1374 v13 = v12;
Ritor1
parents:
diff changeset
1375 v14 = v18;
Ritor1
parents:
diff changeset
1376 v15 = v19;
Ritor1
parents:
diff changeset
1377 if ( v12 < v18 )
Ritor1
parents:
diff changeset
1378 {
Ritor1
parents:
diff changeset
1379 v13 = v18;
Ritor1
parents:
diff changeset
1380 v14 = v12;
Ritor1
parents:
diff changeset
1381 }
Ritor1
parents:
diff changeset
1382 if ( v13 < v19 )
Ritor1
parents:
diff changeset
1383 {
Ritor1
parents:
diff changeset
1384 v16 = v13;
Ritor1
parents:
diff changeset
1385 v13 = v19;
Ritor1
parents:
diff changeset
1386 v15 = v16;
Ritor1
parents:
diff changeset
1387 }
Ritor1
parents:
diff changeset
1388 if ( v14 < (signed int)v15 )
Ritor1
parents:
diff changeset
1389 {
Ritor1
parents:
diff changeset
1390 v17 = v15;
Ritor1
parents:
diff changeset
1391 v15 = v14;
Ritor1
parents:
diff changeset
1392 v14 = v17;
Ritor1
parents:
diff changeset
1393 }
Ritor1
parents:
diff changeset
1394 v0 = (unsigned int)(11 * v14) >> 5;
Ritor1
parents:
diff changeset
1395 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1396 continue;
0
Ritor1
parents:
diff changeset
1397 v10 = i;
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1398 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1399 continue;
0
Ritor1
parents:
diff changeset
1400 }
Ritor1
parents:
diff changeset
1401 v10 = i;
Ritor1
parents:
diff changeset
1402 if ( !(v9 & 0x40) )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1403 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1404 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1405 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1406 }
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
1407 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
0
Ritor1
parents:
diff changeset
1408 }
Ritor1
parents:
diff changeset
1409 }
Ritor1
parents:
diff changeset
1410 //v2 += 112;
Ritor1
parents:
diff changeset
1411 //v1 = v20++ + 1;
Ritor1
parents:
diff changeset
1412 //}
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1413 //while ( v20 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
1414 }
Ritor1
parents:
diff changeset
1415 }
Ritor1
parents:
diff changeset
1416
Ritor1
parents:
diff changeset
1417 //----- (0047272C) --------------------------------------------------------
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1418 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
1419 {
Ritor1
parents:
diff changeset
1420 signed int v5; // ebx@1
Ritor1
parents:
diff changeset
1421 int result; // eax@1
Ritor1
parents:
diff changeset
1422 int v7; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
1423 signed int v8; // [sp+14h] [bp-4h]@1
Ritor1
parents:
diff changeset
1424
Ritor1
parents:
diff changeset
1425 v5 = x - 2;
Ritor1
parents:
diff changeset
1426 v7 = x;
Ritor1
parents:
diff changeset
1427 v8 = y;
Ritor1
parents:
diff changeset
1428 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1429 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1430 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1431 {
Ritor1
parents:
diff changeset
1432 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1433 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1434 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1435 {
Ritor1
parents:
diff changeset
1436 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1437 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1438 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1439 {
Ritor1
parents:
diff changeset
1440 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1441 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1442 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1443 {
Ritor1
parents:
diff changeset
1444 *pSectorID = pIndoor->GetSector(v7, v8, z + 140);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1445 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1446 }
Ritor1
parents:
diff changeset
1447 }
Ritor1
parents:
diff changeset
1448 }
Ritor1
parents:
diff changeset
1449 }
Ritor1
parents:
diff changeset
1450 return result;
Ritor1
parents:
diff changeset
1451 }
Ritor1
parents:
diff changeset
1452
Ritor1
parents:
diff changeset
1453 //----- (00472866) --------------------------------------------------------
Ritor1
parents:
diff changeset
1454 void BLV_ProcessPartyActions()
Ritor1
parents:
diff changeset
1455 {
Ritor1
parents:
diff changeset
1456 int v1; // ebx@1
Ritor1
parents:
diff changeset
1457 int v2; // edi@1
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1458 //int v6; // eax@18
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1459 //signed __int64 v8; // qax@27
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1460 //int v9; // eax@27
0
Ritor1
parents:
diff changeset
1461 double v10; // st7@27
Ritor1
parents:
diff changeset
1462 unsigned int v12; // eax@49
Ritor1
parents:
diff changeset
1463 double v13; // st7@50
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1464 //int v14; // eax@51
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1465 //signed __int64 v15; // qax@53
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1466 //double v16; // st7@54
0
Ritor1
parents:
diff changeset
1467 int v17; // eax@62
Ritor1
parents:
diff changeset
1468 double v18; // st7@62
Ritor1
parents:
diff changeset
1469 int v19; // ST40_4@62
Ritor1
parents:
diff changeset
1470 int v20; // eax@65
Ritor1
parents:
diff changeset
1471 double v21; // st7@65
Ritor1
parents:
diff changeset
1472 int v22; // ST40_4@65
Ritor1
parents:
diff changeset
1473 int v23; // eax@66
Ritor1
parents:
diff changeset
1474 double v24; // st7@66
Ritor1
parents:
diff changeset
1475 int v25; // ST40_4@66
Ritor1
parents:
diff changeset
1476 int v26; // eax@67
Ritor1
parents:
diff changeset
1477 double v27; // st7@67
Ritor1
parents:
diff changeset
1478 int v28; // ST40_4@67
Ritor1
parents:
diff changeset
1479 unsigned int v35; // eax@74
Ritor1
parents:
diff changeset
1480 int v36; // ecx@88
Ritor1
parents:
diff changeset
1481 int new_party_z; // esi@96
Ritor1
parents:
diff changeset
1482 int v38; // eax@96
Ritor1
parents:
diff changeset
1483 int v39; // ecx@106
Ritor1
parents:
diff changeset
1484 int v40; // eax@106
Ritor1
parents:
diff changeset
1485 Player **v41; // esi@113
Ritor1
parents:
diff changeset
1486 int v42; // eax@120
Ritor1
parents:
diff changeset
1487 signed int v43; // ecx@123
Ritor1
parents:
diff changeset
1488 BLVFace *v44; // esi@126
Ritor1
parents:
diff changeset
1489 PolygonType v45; // al@126
Ritor1
parents:
diff changeset
1490 int v46; // ecx@133
Ritor1
parents:
diff changeset
1491 char v47; // zf@133
Ritor1
parents:
diff changeset
1492 int v48; // eax@133
Ritor1
parents:
diff changeset
1493 int v49; // ST40_4@136
Ritor1
parents:
diff changeset
1494 int v50; // ST40_4@140
Ritor1
parents:
diff changeset
1495 int v51; // eax@140
Ritor1
parents:
diff changeset
1496 int v52; // eax@140
Ritor1
parents:
diff changeset
1497 signed int v53; // edi@146
Ritor1
parents:
diff changeset
1498 int v54; // ebx@146
Ritor1
parents:
diff changeset
1499 int v55; // ST30_4@146
Ritor1
parents:
diff changeset
1500 AudioPlayer *v56; // ecx@162
Ritor1
parents:
diff changeset
1501 SoundID v57; // [sp-20h] [bp-80h]@163
Ritor1
parents:
diff changeset
1502 signed int v58; // [sp-1Ch] [bp-7Ch]@161
Ritor1
parents:
diff changeset
1503 unsigned int v59; // [sp-18h] [bp-78h]@161
Ritor1
parents:
diff changeset
1504 signed int v60; // [sp-14h] [bp-74h]@161
Ritor1
parents:
diff changeset
1505 signed int v61; // [sp-10h] [bp-70h]@161
Ritor1
parents:
diff changeset
1506 int v62; // [sp-Ch] [bp-6Ch]@161
Ritor1
parents:
diff changeset
1507 int v63; // [sp-8h] [bp-68h]@75
Ritor1
parents:
diff changeset
1508 unsigned int v64; // [sp-8h] [bp-68h]@161
Ritor1
parents:
diff changeset
1509 int v65; // [sp-4h] [bp-64h]@75
Ritor1
parents:
diff changeset
1510 int v66; // [sp-4h] [bp-64h]@161
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1511 //int v68; // [sp+10h] [bp-50h]@45
0
Ritor1
parents:
diff changeset
1512 int v69; // [sp+10h] [bp-50h]@140
Ritor1
parents:
diff changeset
1513 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1514 //signed int v71; // [sp+18h] [bp-48h]@1
0
Ritor1
parents:
diff changeset
1515 signed int v72; // [sp+1Ch] [bp-44h]@1
Ritor1
parents:
diff changeset
1516 signed int v73; // [sp+20h] [bp-40h]@100
Ritor1
parents:
diff changeset
1517 int v74; // [sp+20h] [bp-40h]@140
Ritor1
parents:
diff changeset
1518 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
Ritor1
parents:
diff changeset
1519 unsigned int uSectorID; // [sp+28h] [bp-38h]@1
Ritor1
parents:
diff changeset
1520 int v78; // [sp+2Ch] [bp-34h]@1
Ritor1
parents:
diff changeset
1521 unsigned int uFaceID; // [sp+30h] [bp-30h]@1
Ritor1
parents:
diff changeset
1522 int v80; // [sp+34h] [bp-2Ch]@1
Ritor1
parents:
diff changeset
1523 int v81; // [sp+38h] [bp-28h]@47
Ritor1
parents:
diff changeset
1524 int v82; // [sp+3Ch] [bp-24h]@47
Ritor1
parents:
diff changeset
1525 int _view_angle; // [sp+40h] [bp-20h]@47
Ritor1
parents:
diff changeset
1526 int bJumping; // [sp+44h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
1527 int new_party_y; // [sp+48h] [bp-18h]@1
Ritor1
parents:
diff changeset
1528 int new_party_x; // [sp+4Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
1529 int party_z; // [sp+50h] [bp-10h]@1
717
Ritor1
parents: 688
diff changeset
1530 //int v89; // [sp+58h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
1531 int angle; // [sp+5Ch] [bp-4h]@47
Ritor1
parents:
diff changeset
1532
Ritor1
parents:
diff changeset
1533 uFaceEvent = 0;
717
Ritor1
parents: 688
diff changeset
1534 //v89 = pParty->uFallSpeed;
0
Ritor1
parents:
diff changeset
1535 v1 = 0;
Ritor1
parents:
diff changeset
1536 v2 = 0;
Ritor1
parents:
diff changeset
1537 new_party_x = pParty->vPosition.x;
717
Ritor1
parents: 688
diff changeset
1538 new_party_y = pParty->vPosition.y;
0
Ritor1
parents:
diff changeset
1539 party_z = pParty->vPosition.z;
Ritor1
parents:
diff changeset
1540 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
Ritor1
parents:
diff changeset
1541 v72 = 0;
Ritor1
parents:
diff changeset
1542 v78 = 0;
Ritor1
parents:
diff changeset
1543 bJumping = 0;
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
1544
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
1545 uFaceID = -1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1546 auto floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
1547
0
Ritor1
parents:
diff changeset
1548 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
1549 {
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1550 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
1551 if (pParty->FlyActive())
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1552 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1553 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1554
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1555 if ( floor_level == -30000 || uFaceID == -1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1556 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1557 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1558 if ( floor_level == -30000 || uFaceID == -1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1559 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1560 __debugbreak(); // level built with errors
0
Ritor1
parents:
diff changeset
1561 pParty->vPosition.x = blv_prev_party_x;
Ritor1
parents:
diff changeset
1562 pParty->vPosition.y = blv_prev_party_z;
Ritor1
parents:
diff changeset
1563 pParty->vPosition.z = blv_prev_party_y;
Ritor1
parents:
diff changeset
1564 pParty->uFallStartY = blv_prev_party_y;
Ritor1
parents:
diff changeset
1565 return;
Ritor1
parents:
diff changeset
1566 }
Ritor1
parents:
diff changeset
1567 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1568
0
Ritor1
parents:
diff changeset
1569 blv_prev_party_x = pParty->vPosition.x;
Ritor1
parents:
diff changeset
1570 blv_prev_party_z = pParty->vPosition.y;
Ritor1
parents:
diff changeset
1571 blv_prev_party_y = pParty->vPosition.z;
Ritor1
parents:
diff changeset
1572 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1573 {
Ritor1
parents:
diff changeset
1574 auto v67 = GetTickCount() / 500;
Ritor1
parents:
diff changeset
1575 if (dword_720CDC != v67 )
Ritor1
parents:
diff changeset
1576 {
1285
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1577 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x;
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1578 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y;
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1579 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
1580 if ( dword_4F8580[0] > 60 )
Ritor1
parents:
diff changeset
1581 dword_4F8580[0] = 1;
Ritor1
parents:
diff changeset
1582 }
Ritor1
parents:
diff changeset
1583 dword_720CDC = v67;
Ritor1
parents:
diff changeset
1584 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1585
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1586 uint fall_start;
0
Ritor1
parents:
diff changeset
1587 if (!pParty->FeatherFallActive())
Ritor1
parents:
diff changeset
1588 {
Ritor1
parents:
diff changeset
1589 bFeatherFall = false;
1563
0311debb684c splitting Player::WearsItem into two functions
Grumpy7
parents: 1546
diff changeset
1590 if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && // grants feather fall
0311debb684c splitting Player::WearsItem into two functions
Grumpy7
parents: 1546
diff changeset
1591 !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
0311debb684c splitting Player::WearsItem into two functions
Grumpy7
parents: 1546
diff changeset
1592 !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
0311debb684c splitting Player::WearsItem into two functions
Grumpy7
parents: 1546
diff changeset
1593 !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT))
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1594 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1595 fall_start = pParty->uFallStartY;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1596 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1597 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1598 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1599 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1600 fall_start = floor_level;
0
Ritor1
parents:
diff changeset
1601 bFeatherFall = true;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1602 pParty->uFallStartY = floor_level;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1603 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1604
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1605
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1606 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1607 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1608 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
1609 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
1610 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
1611 else for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1612 { // receive falling damage
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1613 auto player = pParty->pPlayers + i;
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1614 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS))
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1615 {
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1616 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL);
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1617 v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1618 player->SetRecoveryTime((signed __int64)v10);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1619 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1620 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1621 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1622
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1623 if ( party_z > floor_level + 1 )
0
Ritor1
parents:
diff changeset
1624 bJumping = 1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1625
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1626 bool jumping_up = false;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1627
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1628 if ( party_z - floor_level <= 32 )
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1629 {
0
Ritor1
parents:
diff changeset
1630 pParty->uFallStartY = party_z;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1631 jumping_up = true;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1632 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1633
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1634 if (bWalkSound && pParty->walk_sound_timer)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1635 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1636 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1637 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1638 else pParty->walk_sound_timer = 0;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1639 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1640
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1641
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1642 if (party_z <= floor_level + 1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1643 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1644 party_z = floor_level + 1;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1645 pParty->uFallStartY = floor_level + 1;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1646
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1647 if (!bJumping && pParty->floor_face_pid != uFaceID)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1648 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1649 auto pFace = &pIndoor->pFaces[uFaceID];
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1650 if (pFace->uAttributes & FACE_PRESSURE_PLATE)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1651 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1652 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1653 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1654 if (!bJumping)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1655 pParty->floor_face_pid = uFaceID;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1656
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1657 bool on_water = false;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1658 if ( pIndoor->pFaces[uFaceID].Fluid())
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1659 on_water = true;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1660
0
Ritor1
parents:
diff changeset
1661 v81 = pParty->uWalkSpeed;
Ritor1
parents:
diff changeset
1662 angle = pParty->sRotationY;
Ritor1
parents:
diff changeset
1663 _view_angle = pParty->sRotationX;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1664 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
0
Ritor1
parents:
diff changeset
1665 / 180)) >> 16;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1666 //LABEL_87:
0
Ritor1
parents:
diff changeset
1667 while ( pPartyActionQueue->uNumActions )
Ritor1
parents:
diff changeset
1668 {
Ritor1
parents:
diff changeset
1669 switch ( pPartyActionQueue->Next() )
Ritor1
parents:
diff changeset
1670 {
Ritor1
parents:
diff changeset
1671 case PARTY_TurnLeft:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1672 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1673 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1674 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1675 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1676 break;
0
Ritor1
parents:
diff changeset
1677 case PARTY_TurnRight:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1678 if (uTurnSpeed)
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1679 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1680 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1681 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1682 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1683
0
Ritor1
parents:
diff changeset
1684 case PARTY_FastTurnLeft:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1685 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1686 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
0
Ritor1
parents:
diff changeset
1687 else
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1688 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1689 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1690
0
Ritor1
parents:
diff changeset
1691 case PARTY_FastTurnRight:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1692 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1693 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1694 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1695 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1696 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1697
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1698 case PARTY_StrafeLeft:
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1699 v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1700 v1 += fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
717
Ritor1
parents: 688
diff changeset
1701 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1702 break;
0
Ritor1
parents:
diff changeset
1703 case PARTY_StrafeRight:
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1704 v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1705 v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
717
Ritor1
parents: 688
diff changeset
1706 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1707 break;
0
Ritor1
parents:
diff changeset
1708 case PARTY_WalkForward:
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1709 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1710 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier);
717
Ritor1
parents: 688
diff changeset
1711 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1712 break;
0
Ritor1
parents:
diff changeset
1713 case PARTY_WalkBackward:
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1714 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1715 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
0
Ritor1
parents:
diff changeset
1716 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1717 break;
0
Ritor1
parents:
diff changeset
1718 case PARTY_RunForward:
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1719 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1720 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier);
0
Ritor1
parents:
diff changeset
1721 v72 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1722 break;
0
Ritor1
parents:
diff changeset
1723 case PARTY_RunBackward:
Ritor1
parents:
diff changeset
1724 //v32 = stru_5C6E00->SinCos(angle);
Ritor1
parents:
diff changeset
1725 //v33 = (double)v81;
Ritor1
parents:
diff changeset
1726 //v88 = (double)v81;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1727 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
0
Ritor1
parents:
diff changeset
1728 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
1729 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
0
Ritor1
parents:
diff changeset
1730 v72 = 1;
807
Ritor1
parents: 795
diff changeset
1731 break;
0
Ritor1
parents:
diff changeset
1732 case PARTY_LookUp:
Ritor1
parents:
diff changeset
1733 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
Ritor1
parents:
diff changeset
1734 if ( _view_angle > 128 )
Ritor1
parents:
diff changeset
1735 _view_angle = 128;
Ritor1
parents:
diff changeset
1736 v35 = uActiveCharacter;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1737 if ( uActiveCharacter )
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1738 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
717
Ritor1
parents: 688
diff changeset
1739 break;
0
Ritor1
parents:
diff changeset
1740 case PARTY_LookDown:
Ritor1
parents:
diff changeset
1741 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
Ritor1
parents:
diff changeset
1742 if ( _view_angle < -128 )
Ritor1
parents:
diff changeset
1743 _view_angle = -128;
Ritor1
parents:
diff changeset
1744 v35 = uActiveCharacter;
Ritor1
parents:
diff changeset
1745 if ( uActiveCharacter )
717
Ritor1
parents: 688
diff changeset
1746 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
0
Ritor1
parents:
diff changeset
1747 break;
Ritor1
parents:
diff changeset
1748 case PARTY_CenterView:
Ritor1
parents:
diff changeset
1749 _view_angle = 0;
Ritor1
parents:
diff changeset
1750 break;
Ritor1
parents:
diff changeset
1751 case PARTY_Jump:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1752 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
0
Ritor1
parents:
diff changeset
1753 {
Ritor1
parents:
diff changeset
1754 bJumping = 1;
717
Ritor1
parents: 688
diff changeset
1755 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
0
Ritor1
parents:
diff changeset
1756 }
Ritor1
parents:
diff changeset
1757 break;
Ritor1
parents:
diff changeset
1758 default:
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1759 break;
0
Ritor1
parents:
diff changeset
1760 }
Ritor1
parents:
diff changeset
1761 }
Ritor1
parents:
diff changeset
1762 v36 = 0;
Ritor1
parents:
diff changeset
1763 pParty->sRotationY = angle;
Ritor1
parents:
diff changeset
1764 pParty->sRotationX = _view_angle;
Ritor1
parents:
diff changeset
1765 if ( bJumping )
Ritor1
parents:
diff changeset
1766 {
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1767 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1768 if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1769 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1770 if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1771 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1772 v41 = &pPlayers[1];
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1773 do
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1774 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1775 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1776 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1777 ++v41;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1778 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1779 while ( (signed int)v41 <= (signed int)&pPlayers[4] );
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1780 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1781 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1782 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1783 pParty->uFallStartY = party_z;
0
Ritor1
parents:
diff changeset
1784 }
Ritor1
parents:
diff changeset
1785 else
Ritor1
parents:
diff changeset
1786 {
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1787 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
0
Ritor1
parents:
diff changeset
1788 {
717
Ritor1
parents: 688
diff changeset
1789 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1790 pParty->uFallStartY = party_z;
0
Ritor1
parents:
diff changeset
1791 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1792 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1793 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1794 if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1795 pParty->uFallSpeed = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1796 pParty->uFallStartY = party_z;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1797 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1798 }
0
Ritor1
parents:
diff changeset
1799 if ( v2 * v2 + v1 * v1 < 400 )
Ritor1
parents:
diff changeset
1800 {
Ritor1
parents:
diff changeset
1801 v1 = 0;
Ritor1
parents:
diff changeset
1802 v2 = 0;
Ritor1
parents:
diff changeset
1803 }
Ritor1
parents:
diff changeset
1804 stru_721530.field_84 = -1;
Ritor1
parents:
diff changeset
1805 stru_721530.field_70 = 0;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1806 stru_721530.prolly_normal_d = pParty->field_14_radius;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1807 stru_721530.field_8_radius = pParty->field_14_radius / 2;
0
Ritor1
parents:
diff changeset
1808 auto v83 = 0;
Ritor1
parents:
diff changeset
1809 stru_721530.field_0 = 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1810 stru_721530.height = pParty->uPartyHeight - 32;
0
Ritor1
parents:
diff changeset
1811 while ( 1 )
Ritor1
parents:
diff changeset
1812 {
Ritor1
parents:
diff changeset
1813 new_party_z = party_z;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1814 stru_721530.position.x = new_party_x;
0
Ritor1
parents:
diff changeset
1815 stru_721530.normal.x = new_party_x;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1816 stru_721530.velocity.x = v2;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1817 stru_721530.position.y = new_party_y;
0
Ritor1
parents:
diff changeset
1818 stru_721530.normal.y = new_party_y;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1819 stru_721530.velocity.y = v1;
0
Ritor1
parents:
diff changeset
1820 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1821 stru_721530.position.z = stru_721530.height + party_z + 1;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1822 stru_721530.velocity.z = pParty->uFallSpeed;
0
Ritor1
parents:
diff changeset
1823 stru_721530.uSectorID = uSectorID;
Ritor1
parents:
diff changeset
1824 v38 = 0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1825 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
0
Ritor1
parents:
diff changeset
1826 v38 = 13312;
Ritor1
parents:
diff changeset
1827 if ( stru_721530._47050A(v38) )
Ritor1
parents:
diff changeset
1828 break;
Ritor1
parents:
diff changeset
1829 v73 = 0;
Ritor1
parents:
diff changeset
1830 do
Ritor1
parents:
diff changeset
1831 {
Ritor1
parents:
diff changeset
1832 _46E44E_collide_against_faces_and_portals(1u);
Ritor1
parents:
diff changeset
1833 _46E0B2_collide_against_decorations();
Ritor1
parents:
diff changeset
1834 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
Ritor1
parents:
diff changeset
1835 _46DF1A_collide_against_actor(v80, 0);
Ritor1
parents:
diff changeset
1836 if ( _46F04E_collide_against_portals() )
Ritor1
parents:
diff changeset
1837 break;
Ritor1
parents:
diff changeset
1838 ++v73;
Ritor1
parents:
diff changeset
1839 }
Ritor1
parents:
diff changeset
1840 while ( v73 < 100 );
Ritor1
parents:
diff changeset
1841 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1842 {
Ritor1
parents:
diff changeset
1843 v39 = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
1844 uSectorID = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
1845 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
1846 }
Ritor1
parents:
diff changeset
1847 else
Ritor1
parents:
diff changeset
1848 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1849 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1850 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1851 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
0
Ritor1
parents:
diff changeset
1852 }
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1853 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
1854 if ( v42 == -30000 || v42 - new_party_z > 128 )
Ritor1
parents:
diff changeset
1855 return;
Ritor1
parents:
diff changeset
1856 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1857 {
Ritor1
parents:
diff changeset
1858 new_party_x = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
1859 new_party_y = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
1860 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
1861 break;
Ritor1
parents:
diff changeset
1862 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1863 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1864 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
0
Ritor1
parents:
diff changeset
1865 v43 = stru_721530.uFaceID;
Ritor1
parents:
diff changeset
1866 uSectorID = stru_721530.uSectorID;
Ritor1
parents:
diff changeset
1867 stru_721530.field_70 += stru_721530.field_7C;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1868 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1869 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
1870 {
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1871 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1872 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) )
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1873 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
0
Ritor1
parents:
diff changeset
1874 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1875 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1876 else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
1877 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
1878 v53 = integer_sqrt(v2 * v2 + v1 * v1);
0
Ritor1
parents:
diff changeset
1879 v80 = v53;
717
Ritor1
parents: 688
diff changeset
1880 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
0
Ritor1
parents:
diff changeset
1881 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1882 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1883 v55 = stru_5C6E00->Sin(v54);
0
Ritor1
parents:
diff changeset
1884 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
Ritor1
parents:
diff changeset
1885 }
Ritor1
parents:
diff changeset
1886 else
Ritor1
parents:
diff changeset
1887 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1888 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
0
Ritor1
parents:
diff changeset
1889 {
Ritor1
parents:
diff changeset
1890 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
Ritor1
parents:
diff changeset
1891 v45 = v44->uPolygonType;
Ritor1
parents:
diff changeset
1892 if ( v45 == 3 )
Ritor1
parents:
diff changeset
1893 {
717
Ritor1
parents: 688
diff changeset
1894 if ( pParty->uFallSpeed < 0 )
Ritor1
parents: 688
diff changeset
1895 pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
1896 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
Ritor1
parents:
diff changeset
1897 if ( pParty->uFallStartY - v87 < 512 )
Ritor1
parents:
diff changeset
1898 pParty->uFallStartY = v87;
Ritor1
parents:
diff changeset
1899 if ( v2 * v2 + v1 * v1 < 400 )
Ritor1
parents:
diff changeset
1900 {
Ritor1
parents:
diff changeset
1901 v1 = 0;
Ritor1
parents:
diff changeset
1902 v2 = 0;
Ritor1
parents:
diff changeset
1903 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1904 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
717
Ritor1
parents: 688
diff changeset
1905 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
Ritor1
parents: 688
diff changeset
1906 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1907 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1908 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1909 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1910 v47 = v45 == 4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1911 v48 = v44->pFacePlane_old.vNormal.x;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1912 if ( !v47 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1913 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1914 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1915 if ((stru_721530.speed >> 3) > v80 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1916 v80 = stru_721530.speed >> 3;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1917 v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1918 v81 = v44->pFacePlane_old.vNormal.y;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1919 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1920 v82 = v44->pFacePlane_old.vNormal.z;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1921 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1922 v2 += v50;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1923 pParty->uFallSpeed += v82;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1924 v74 = v44->pFacePlane_old.vNormal.z;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1925 v51 = v44->pFacePlane_old.vNormal.y;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1926 v69 = v44->pFacePlane_old.vNormal.x;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1927 v80 = v51;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1928 v1 += v81;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1929 v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1930 if ( v52 > 0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1931 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1932 new_party_x += v52 * v69 >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1933 new_party_y += v52 * v80 >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1934 v87 += v52 * v74 >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1935 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1936 v43 = stru_721530.uFaceID;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1937 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1938 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1939 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1940 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1941 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1942 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1943 if ((stru_721530.speed >> 3) > v80 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
1944 v80 = stru_721530.speed >> 3;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1945 v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1946 v81 = v44->pFacePlane_old.vNormal.y;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1947 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1948 v82 = v44->pFacePlane_old.vNormal.z;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1949 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1950 v2 += v49;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1951 v1 += v81;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1952 pParty->uFallSpeed += v82;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1953 if ( v2 * v2 + v1 * v1 >= 400 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1954 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1955 v43 = stru_721530.uFaceID;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1956 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1957 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1958 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1959 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1960 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1961 v2 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1962 v1 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1963 pParty->uFallSpeed = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1964 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1965 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1966 }
0
Ritor1
parents:
diff changeset
1967 }
Ritor1
parents:
diff changeset
1968 }
Ritor1
parents:
diff changeset
1969 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
Ritor1
parents:
diff changeset
1970 v1 = (unsigned __int64)(58500i64 * v1) >> 16;
Ritor1
parents:
diff changeset
1971 ++v83;
717
Ritor1
parents: 688
diff changeset
1972 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
0
Ritor1
parents:
diff changeset
1973 if ( v83 >= 100 )
Ritor1
parents:
diff changeset
1974 {
Ritor1
parents:
diff changeset
1975 new_party_z = v87;
Ritor1
parents:
diff changeset
1976 break;
Ritor1
parents:
diff changeset
1977 }
Ritor1
parents:
diff changeset
1978 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1979 if ( bWalkSound && !pParty->walk_sound_timer)
0
Ritor1
parents:
diff changeset
1980 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
1981 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y)
717
Ritor1
parents: 688
diff changeset
1982 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z)
Ritor1
parents: 688
diff changeset
1983 * (pParty->vPosition.z - new_party_z)) <= 16 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1984 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1985 pAudioPlayer->_4AA258(804);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1986 pParty->walk_sound_timer = 64;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1987 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1988 else if ( v72 && (!bJumping || jumping_up) )
0
Ritor1
parents:
diff changeset
1989 {
Ritor1
parents:
diff changeset
1990 v66 = 0;
Ritor1
parents:
diff changeset
1991 v64 = 0;
Ritor1
parents:
diff changeset
1992 v62 = 0;
Ritor1
parents:
diff changeset
1993 v61 = 0;
Ritor1
parents:
diff changeset
1994 v60 = -1;
Ritor1
parents:
diff changeset
1995 v59 = 1;
Ritor1
parents:
diff changeset
1996 v58 = 804;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1997 if ( !on_water )
0
Ritor1
parents:
diff changeset
1998 {
Ritor1
parents:
diff changeset
1999 v56 = pAudioPlayer;
Ritor1
parents:
diff changeset
2000 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
2001 v57 = (SoundID)50;
Ritor1
parents:
diff changeset
2002 else
Ritor1
parents:
diff changeset
2003 v57 = (SoundID)64;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2004 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66);
0
Ritor1
parents:
diff changeset
2005 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2006 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2007 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2008 v57 = (SoundID)63;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2009 v56 = pAudioPlayer;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2010 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2011 }
0
Ritor1
parents:
diff changeset
2012 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2013 else if ( v78 && (!bJumping || jumping_up) )
0
Ritor1
parents:
diff changeset
2014 {
Ritor1
parents:
diff changeset
2015 v66 = 0;
Ritor1
parents:
diff changeset
2016 v64 = 0;
Ritor1
parents:
diff changeset
2017 v62 = 0;
Ritor1
parents:
diff changeset
2018 v61 = 0;
Ritor1
parents:
diff changeset
2019 v60 = -1;
Ritor1
parents:
diff changeset
2020 v59 = 1;
Ritor1
parents:
diff changeset
2021 v58 = 804;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2022 if ( on_water )
0
Ritor1
parents:
diff changeset
2023 {
Ritor1
parents:
diff changeset
2024 v57 = (SoundID)102;
717
Ritor1
parents: 688
diff changeset
2025 v56 = pAudioPlayer;
0
Ritor1
parents:
diff changeset
2026 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2027 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2028 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2029 v56 = pAudioPlayer;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2030 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2031 v57 = (SoundID)89;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2032 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2033 v57 = (SoundID)103;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2034 }
0
Ritor1
parents:
diff changeset
2035 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66);
Ritor1
parents:
diff changeset
2036 }
Ritor1
parents:
diff changeset
2037 else
Ritor1
parents:
diff changeset
2038 {
Ritor1
parents:
diff changeset
2039 pAudioPlayer->_4AA258(804);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2040 pParty->walk_sound_timer = 64;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2041 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2042 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2043 if ( !bJumping || jumping_up )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2044 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2045 else
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2046 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2047 pParty->uFlags &= ~0x200;
0
Ritor1
parents:
diff changeset
2048 pParty->vPosition.x = new_party_x;
Ritor1
parents:
diff changeset
2049 pParty->vPosition.z = new_party_z;
Ritor1
parents:
diff changeset
2050 pParty->vPosition.y = new_party_y;
717
Ritor1
parents: 688
diff changeset
2051 //pParty->uFallSpeed = v89;
0
Ritor1
parents:
diff changeset
2052 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2053 pParty->uFlags |= 0x200;
0
Ritor1
parents:
diff changeset
2054 if (uFaceEvent)
Ritor1
parents:
diff changeset
2055 EventProcessor(uFaceEvent, 0, 1);
Ritor1
parents:
diff changeset
2056 }
Ritor1
parents:
diff changeset
2057
Ritor1
parents:
diff changeset
2058 //----- (00473893) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2059 void ODM_ProcessPartyActions()
0
Ritor1
parents:
diff changeset
2060 {
Ritor1
parents:
diff changeset
2061 int v1; // edi@1
Ritor1
parents:
diff changeset
2062 int v2; // ebx@1
Ritor1
parents:
diff changeset
2063 int v3; // eax@14
Ritor1
parents:
diff changeset
2064 int v6; // esi@45
Ritor1
parents:
diff changeset
2065 ODMFace *v7; // ecx@45
Ritor1
parents:
diff changeset
2066 signed int v33; // eax@143
Ritor1
parents:
diff changeset
2067 int v34; // esi@143
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2068 int v35; // esi@147
0
Ritor1
parents:
diff changeset
2069 int v36; // eax@155
Ritor1
parents:
diff changeset
2070 signed int v37; // esi@159
Ritor1
parents:
diff changeset
2071 signed int v38; // eax@159
Ritor1
parents:
diff changeset
2072 signed int i; // esi@159
Ritor1
parents:
diff changeset
2073 int v40; // esi@162
Ritor1
parents:
diff changeset
2074 bool v42; // eax@180
Ritor1
parents:
diff changeset
2075 signed int v43; // ecx@184
Ritor1
parents:
diff changeset
2076 signed int v44; // edx@184
Ritor1
parents:
diff changeset
2077 int v45; // ecx@200
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2078 BSPModel *pModel; // eax@203
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2079 ODMFace *pODMFace; // esi@203
0
Ritor1
parents:
diff changeset
2080 int v48; // eax@203
Ritor1
parents:
diff changeset
2081 char v49; // zf@203
Ritor1
parents:
diff changeset
2082 char v50; // sf@203
Ritor1
parents:
diff changeset
2083 unsigned __int8 v51; // of@203
Ritor1
parents:
diff changeset
2084 int v52; // eax@203
Ritor1
parents:
diff changeset
2085 BSPModel *v54; // eax@215
Ritor1
parents:
diff changeset
2086 int v55; // eax@217
Ritor1
parents:
diff changeset
2087 signed int v56; // ebx@228
Ritor1
parents:
diff changeset
2088 int v57; // eax@228
Ritor1
parents:
diff changeset
2089 BSPModel *v58; // eax@228
Ritor1
parents:
diff changeset
2090 unsigned __int64 v59; // qax@228
Ritor1
parents:
diff changeset
2091 BSPModel *v60; // eax@228
Ritor1
parents:
diff changeset
2092 unsigned __int64 v61; // qax@228
Ritor1
parents:
diff changeset
2093 int v62; // eax@241
Ritor1
parents:
diff changeset
2094 unsigned int v65; // ebx@263
Ritor1
parents:
diff changeset
2095 unsigned int v66; // esi@263
Ritor1
parents:
diff changeset
2096 int v67; // eax@263
Ritor1
parents:
diff changeset
2097 signed int v68; // ecx@263
Ritor1
parents:
diff changeset
2098 int v69; // eax@263
Ritor1
parents:
diff changeset
2099 int v70; // ebx@271
Ritor1
parents:
diff changeset
2100 int v71; // esi@271
Ritor1
parents:
diff changeset
2101 int v72; // edi@271
Ritor1
parents:
diff changeset
2102 int v73; // eax@271
Ritor1
parents:
diff changeset
2103 unsigned int v76; // edi@293
Ritor1
parents:
diff changeset
2104 bool v77; // edx@297
Ritor1
parents:
diff changeset
2105 bool v78; // ecx@303
Ritor1
parents:
diff changeset
2106 int v79; // ecx@314
Ritor1
parents:
diff changeset
2107 __int16 v80; // dx@317
Ritor1
parents:
diff changeset
2108 int v81; // ebx@318
Ritor1
parents:
diff changeset
2109 int v82; // ecx@318
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2110 int pTerrainHeight; // eax@321
0
Ritor1
parents:
diff changeset
2111 int v86; // [sp-20h] [bp-B4h]@246
Ritor1
parents:
diff changeset
2112 int v87; // [sp-20h] [bp-B4h]@248
Ritor1
parents:
diff changeset
2113 signed int v88; // [sp-1Ch] [bp-B0h]@246
Ritor1
parents:
diff changeset
2114 unsigned int v89; // [sp-18h] [bp-ACh]@246
Ritor1
parents:
diff changeset
2115 signed int v90; // [sp-14h] [bp-A8h]@246
Ritor1
parents:
diff changeset
2116 signed int v91; // [sp-10h] [bp-A4h]@246
Ritor1
parents:
diff changeset
2117 int v92; // [sp-Ch] [bp-A0h]@246
Ritor1
parents:
diff changeset
2118 unsigned int v94; // [sp-8h] [bp-9Ch]@246
Ritor1
parents:
diff changeset
2119 int v96; // [sp-4h] [bp-98h]@246
Ritor1
parents:
diff changeset
2120 int v97; // [sp+Ch] [bp-88h]@180
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2121 Vec3_int_ v98;
0
Ritor1
parents:
diff changeset
2122 bool v101; // [sp+1Ch] [bp-78h]@33
Ritor1
parents:
diff changeset
2123 int v102; // [sp+20h] [bp-74h]@1
Ritor1
parents:
diff changeset
2124 int v103; // [sp+24h] [bp-70h]@1
Ritor1
parents:
diff changeset
2125 int bFeatherFall; // [sp+28h] [bp-6Ch]@4
Ritor1
parents:
diff changeset
2126 int v105; // [sp+2Ch] [bp-68h]@24
Ritor1
parents:
diff changeset
2127 int bWaterWalk; // [sp+30h] [bp-64h]@1
Ritor1
parents:
diff changeset
2128 int v109; // [sp+3Ch] [bp-58h]@28
Ritor1
parents:
diff changeset
2129 int v110; // [sp+40h] [bp-54h]@180
Ritor1
parents:
diff changeset
2130 int v111; // [sp+44h] [bp-50h]@14
Ritor1
parents:
diff changeset
2131 int bJumping; // [sp+48h] [bp-4Ch]@1
Ritor1
parents:
diff changeset
2132 int v113; // [sp+4Ch] [bp-48h]@1
Ritor1
parents:
diff changeset
2133 unsigned int v114; // [sp+50h] [bp-44h]@1
Ritor1
parents:
diff changeset
2134 int _walk_speed; // [sp+54h] [bp-40h]@48
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2135 int pX; // [sp+58h] [bp-3Ch]@1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2136 int pY; // [sp+5Ch] [bp-38h]@1
0
Ritor1
parents:
diff changeset
2137 int v118; // [sp+60h] [bp-34h]@1
Ritor1
parents:
diff changeset
2138 int _angle_x; // [sp+68h] [bp-2Ch]@48
Ritor1
parents:
diff changeset
2139 unsigned int v122; // [sp+70h] [bp-24h]@180
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2140 int pZ; // [sp+74h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
2141 int v124; // [sp+78h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
2142 int _angle_y; // [sp+7Ch] [bp-18h]@48
Ritor1
parents:
diff changeset
2143 int v126; // [sp+80h] [bp-14h]@48
Ritor1
parents:
diff changeset
2144 int v128; // [sp+88h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2145 int v129; // [sp+8Ch] [bp-8h]@92
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2146
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2147 pZ = pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
2148 v1 = 0;
Ritor1
parents:
diff changeset
2149 v103 = 0;
Ritor1
parents:
diff changeset
2150 v2 = 0;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2151 //*(float *)&v128 = 0.0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2152 v128 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2153 v129 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2154 pX = pParty->vPosition.x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2155 pY = pParty->vPosition.y;
0
Ritor1
parents:
diff changeset
2156 v113 = pParty->field_6F0;
Ritor1
parents:
diff changeset
2157 bJumping = 0;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2158 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
0
Ritor1
parents:
diff changeset
2159 v114 = 0;
Ritor1
parents:
diff changeset
2160 v124 = 0;
Ritor1
parents:
diff changeset
2161 v102 = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2162 pModel = 0;
0
Ritor1
parents:
diff changeset
2163 bWaterWalk = 0;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2164 if (!pParty->FeatherFallActive())
0
Ritor1
parents:
diff changeset
2165 {
Ritor1
parents:
diff changeset
2166 bFeatherFall = 0;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2167 for (int i = 0; i < 4; ++i)
1563
0311debb684c splitting Player::WearsItem into two functions
Grumpy7
parents: 1546
diff changeset
2168 if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) // seems like flying boots
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2169 {
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2170 bFeatherFall = 1;
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2171 break;
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2172 }
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2173 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2174 else
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2175 {
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2176 bFeatherFall = 1;
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2177 }
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2178 //LABEL_9:
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2179 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2180 if (pParty->WaterWalkActive())
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2181 {
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2182 //LOBYTE(pParty->uFlags) &= 0x7Fu;
0
Ritor1
parents:
diff changeset
2183 bWaterWalk = 1;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2184 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2185 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2186 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
0
Ritor1
parents:
diff changeset
2187 bWaterWalk = 0;
Ritor1
parents:
diff changeset
2188 }
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2189 int bmodel_standing_on_pid;
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2190 int is_on_water = false;
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2191 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2192 int is_not_on_bmodel = bmodel_standing_on_pid == 0;
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2193
0
Ritor1
parents:
diff changeset
2194 v111 = v3;
Ritor1
parents:
diff changeset
2195 if ( bFeatherFall )
Ritor1
parents:
diff changeset
2196 pParty->uFallStartY = v3;
Ritor1
parents:
diff changeset
2197 else
Ritor1
parents:
diff changeset
2198 v3 = pParty->uFallStartY;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2199 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )
0
Ritor1
parents:
diff changeset
2200 {
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2201 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2202 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2203 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2204 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2205 else for (int _i = 0; _i < 4; ++_i) // receive falling damage
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2206 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2207 auto player = pParty->pPlayers + _i;
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2208
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
2209 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2210 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2211 player->ReceiveDamage(
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2212 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2213 DMGT_PHISYCAL);
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2214 v105 = 20 - player->GetParameterBonus(player->GetActualEndurance());
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2215 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2216 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2217 //}
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2218 //while ( (signed int)v4 <= (signed int)&pPlayers[4] );
0
Ritor1
parents:
diff changeset
2219 }
Ritor1
parents:
diff changeset
2220 }
Ritor1
parents:
diff changeset
2221 v109 = -1;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2222 if ( pParty->bFlying )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2223 v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2224 //v107 = bmodel_standing_on_pid == 0;
0
Ritor1
parents:
diff changeset
2225 v105 = v111 + 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2226 if ( pZ <= v111 + 1 )
0
Ritor1
parents:
diff changeset
2227 {
Ritor1
parents:
diff changeset
2228 v109 = -1;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2229 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
2230 }
Ritor1
parents:
diff changeset
2231 else
Ritor1
parents:
diff changeset
2232 {
Ritor1
parents:
diff changeset
2233 bJumping = 1;
Ritor1
parents:
diff changeset
2234 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2235 v101 = pZ - v111 <= 32;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2236 if ( bWalkSound && pParty->walk_sound_timer)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2237 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2238 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2239 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2240 else pParty->walk_sound_timer = 0;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2241 }
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2242 if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2243 pParty->bFlying = false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2244 if (!bJumping)
0
Ritor1
parents:
diff changeset
2245 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2246 if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) )
0
Ritor1
parents:
diff changeset
2247 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2248 if (bmodel_standing_on_pid)
0
Ritor1
parents:
diff changeset
2249 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2250 if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels )
0
Ritor1
parents:
diff changeset
2251 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2252 v7 = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces;
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2253 v6 = bmodel_standing_on_pid & 0x3F;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2254 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
0
Ritor1
parents:
diff changeset
2255 {
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
2256 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
0
Ritor1
parents:
diff changeset
2257 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2258 }*/
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2259 if ( BYTE3(v7[v6].uAttributes) & 4 )
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2260 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2261 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2262 v103 = v7[v6].sCogTriggeredID;
0
Ritor1
parents:
diff changeset
2263 }
Ritor1
parents:
diff changeset
2264 }
Ritor1
parents:
diff changeset
2265 }
Ritor1
parents:
diff changeset
2266 }
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2267 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
0
Ritor1
parents:
diff changeset
2268 }
Ritor1
parents:
diff changeset
2269 _walk_speed = pParty->uWalkSpeed;
Ritor1
parents:
diff changeset
2270 _angle_y = pParty->sRotationY;
Ritor1
parents:
diff changeset
2271 _angle_x = pParty->sRotationX;
Ritor1
parents:
diff changeset
2272 v126 = pEventTimer->dt_in_some_format;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2273 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
0
Ritor1
parents:
diff changeset
2274 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
Ritor1
parents:
diff changeset
2275 * stru_5C6E00->uIntegerPi)
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2276 / 180)) >> 16);*/
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2277 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2278 while (pPartyActionQueue->uNumActions)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2279 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2280 switch (pPartyActionQueue->Next())
0
Ritor1
parents:
diff changeset
2281 {
Ritor1
parents:
diff changeset
2282 case PARTY_FlyUp:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2283 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2284 if (!pParty->FlyActive() && !bUnderwater)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2285 break;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2286
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2287 pParty->bFlying = false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2288 if (bUnderwater ||
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2289 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2290 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )
0
Ritor1
parents:
diff changeset
2291 {
Ritor1
parents:
diff changeset
2292 if ( pParty->vPosition.z < 4000 || bJumping )
Ritor1
parents:
diff changeset
2293 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2294 pZ += 30;
0
Ritor1
parents:
diff changeset
2295 v113 += 30;
Ritor1
parents:
diff changeset
2296 pParty->bFlying = 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2297 if ( pZ > 4000 )
0
Ritor1
parents:
diff changeset
2298 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2299 pZ = 4000;
0
Ritor1
parents:
diff changeset
2300 v113 = 4000;
Ritor1
parents:
diff changeset
2301 }
Ritor1
parents:
diff changeset
2302 v1 = 0;
Ritor1
parents:
diff changeset
2303 v2 = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2304 pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
2305 *(float *)&v128 = 0.0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2306 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )
0
Ritor1
parents:
diff changeset
2307 {
Ritor1
parents:
diff changeset
2308 pParty->field_6E0 = 0;
Ritor1
parents:
diff changeset
2309 pParty->field_6E4 = 0;
Ritor1
parents:
diff changeset
2310 pPartyActionQueue->uNumActions = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2311 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
2312 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2313 pParty->field_6F0 = pZ;
0
Ritor1
parents:
diff changeset
2314 pParty->bFlying = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2315 pZ = v109 - pParty->uPartyHeight - 31;
0
Ritor1
parents:
diff changeset
2316 v113 = pParty->field_6F0;
Ritor1
parents:
diff changeset
2317 }
Ritor1
parents:
diff changeset
2318 pParty->uFallSpeed = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2319 pModel = (BSPModel *)1;
0
Ritor1
parents:
diff changeset
2320 }
Ritor1
parents:
diff changeset
2321 }
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2322 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2323 break;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2324
0
Ritor1
parents:
diff changeset
2325 case PARTY_FlyDown:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2326 if (pParty->FlyActive() || bUnderwater)
0
Ritor1
parents:
diff changeset
2327 {
Ritor1
parents:
diff changeset
2328 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2329 if ( bUnderwater
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2330 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2331 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
0
Ritor1
parents:
diff changeset
2332 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2333 pZ -= 30;
0
Ritor1
parents:
diff changeset
2334 v113 -= 30;
Ritor1
parents:
diff changeset
2335 pParty->uFallSpeed = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2336 //pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
2337 pParty->bFlying = 1;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2338 pModel = (BSPModel *)1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2339 if ( pZ <= v111 )
0
Ritor1
parents:
diff changeset
2340 {
Ritor1
parents:
diff changeset
2341 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2342 pPartyActionQueue->uNumActions = 0;
Ritor1
parents:
diff changeset
2343 }
Ritor1
parents:
diff changeset
2344 }
Ritor1
parents:
diff changeset
2345 }
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2346 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2347
0
Ritor1
parents:
diff changeset
2348 case PARTY_TurnLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2349 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2350 _angle_y += uTurnSpeed; //descrete turn
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2351 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2352 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2353
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2354 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2355 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2356
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2357 case PARTY_TurnRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2358 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2359 _angle_y -= uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2360 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2361 _angle_y -= dturn * fTurnSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2362
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2363 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2364 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2365
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2366 case PARTY_FastTurnLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2367 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2368 _angle_y += uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2369 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2370 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2371
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2372 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2373 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2374
0
Ritor1
parents:
diff changeset
2375 case PARTY_FastTurnRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2376 if (!uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2377 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2378 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2379 _angle_y -= uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2380
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2381 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2382 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2383
0
Ritor1
parents:
diff changeset
2384 case PARTY_StrafeLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2385 {
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2386 *(float *)&v128 = pParty->uWalkSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2387
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2388 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2389 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2390 v2 -= 3 * dx / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2391
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2392 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2393 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2394 v1 += 3 * dy / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2395
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2396 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2397 v124 = 1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2398 }
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2399 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2400
0
Ritor1
parents:
diff changeset
2401 case PARTY_StrafeRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2402 {
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2403 *(float *)&v128 = pParty->uWalkSpeed;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2404
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2405 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2406 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2407 v2 += 3 * dx / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2408
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2409 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2410 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2411 v1 -= 3 * dy / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2412
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2413 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2414 v124 = 1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2415 }
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2416 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2417
0
Ritor1
parents:
diff changeset
2418 case PARTY_WalkForward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2419 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2420 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2421
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2422 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2423 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2424
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2425 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
433
0eaed3e0d75f Walk speed x12 (debugging purposes)
Nomad
parents: 431
diff changeset
2426 v2 += dx * 12;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2427
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2428 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
433
0eaed3e0d75f Walk speed x12 (debugging purposes)
Nomad
parents: 431
diff changeset
2429 v1 += dy * 12;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2430
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2431 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2432 v124 = 1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2433 }
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2434 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2435
0
Ritor1
parents:
diff changeset
2436 case PARTY_RunForward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2437 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2438 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2439
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2440 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2441 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2442
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2443 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2444 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2445
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2446 if (pParty->bFlying)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2447 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2448 v2 += 4 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2449 v1 += 4 * dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2450
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2451 v128 = v1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2452 }
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2453 else if (partyAtHighSlope && !bmodel_standing_on_pid)
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2454 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2455 v2 += dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2456 v1 += dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2457
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2458 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2459 v124 = 1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2460 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2461 else
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2462 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2463 v2 += 2 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2464 v1 += 2 * dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2465
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2466 v128 = v1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2467 v114 = 1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2468 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2469 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2470 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2471
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2472
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2473 case PARTY_WalkBackward:
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2474 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2475 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2476
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2477 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2478 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2479
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2480 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2481 v2 -= dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2482
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2483 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2484 v1 -= dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2485
0
Ritor1
parents:
diff changeset
2486 v128 = v1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2487 v124 = 1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2488 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2489 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2490
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2491
0
Ritor1
parents:
diff changeset
2492 case PARTY_RunBackward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2493 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2494 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2495 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2496
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2497 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2498 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2499
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2500 if (pParty->bFlying)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2501 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2502 v2 -= 4 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2503 v1 -= 4 * dy;
0
Ritor1
parents:
diff changeset
2504 v128 = v1;
Ritor1
parents:
diff changeset
2505 }
Ritor1
parents:
diff changeset
2506 else
Ritor1
parents:
diff changeset
2507 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2508 v2 -= dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2509 v1 -= dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2510
0
Ritor1
parents:
diff changeset
2511 v128 = v1;
Ritor1
parents:
diff changeset
2512 v124 = 1;
Ritor1
parents:
diff changeset
2513 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2514 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2515 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2516
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2517 case PARTY_CenterView:
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2518 _angle_x = 0;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2519 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2520
0
Ritor1
parents:
diff changeset
2521 case PARTY_LookUp:
Ritor1
parents:
diff changeset
2522 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
Ritor1
parents:
diff changeset
2523 if ( _angle_x > 128 )
Ritor1
parents:
diff changeset
2524 _angle_x = 128;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2525 if (uActiveCharacter)
187
49728858c35e On player voices
Nomad
parents: 186
diff changeset
2526 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0);
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2527 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2528
0
Ritor1
parents:
diff changeset
2529 case PARTY_LookDown:
Ritor1
parents:
diff changeset
2530 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
Ritor1
parents:
diff changeset
2531 if ( _angle_x < -128 )
Ritor1
parents:
diff changeset
2532 _angle_x = -128;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2533 if (uActiveCharacter)
187
49728858c35e On player voices
Nomad
parents: 186
diff changeset
2534 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0);
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2535 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2536
0
Ritor1
parents:
diff changeset
2537 case PARTY_Jump:
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2538 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
0
Ritor1
parents:
diff changeset
2539 {
Ritor1
parents:
diff changeset
2540 v126 = pParty->field_24 << 6;
Ritor1
parents:
diff changeset
2541 bJumping = 1;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2542 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
0
Ritor1
parents:
diff changeset
2543 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2544 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2545
0
Ritor1
parents:
diff changeset
2546 default:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2547 assert(false);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2548
0
Ritor1
parents:
diff changeset
2549 case PARTY_Land:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2550 if (pParty->bFlying)
0
Ritor1
parents:
diff changeset
2551 {
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2552 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
2553 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
2554 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2555 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
2556 pPartyActionQueue->uNumActions = 0;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2557 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2558 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2559 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2560
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2561 //LABEL_123:
0
Ritor1
parents:
diff changeset
2562 pParty->sRotationY = _angle_y;
Ritor1
parents:
diff changeset
2563 pParty->sRotationX = _angle_x;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2564 if ( pZ < v111 || pParty->bFlying)
0
Ritor1
parents:
diff changeset
2565 {
Ritor1
parents:
diff changeset
2566 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
2567 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2568 v126 = stru_5C6E00->Cos(GetTickCount());
0
Ritor1
parents:
diff changeset
2569 v129 = (unsigned __int64)(4i64 * v126) >> 16;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2570 pZ = v113 + v129;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2571 if ( pModel )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2572 pZ = v113;
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2573 if (pParty->FlyActive())
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2574 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2575 pParty->uFallStartY = pZ;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2576 }
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2577 else
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2578 {
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2579 if ( is_on_water && pParty->uFallSpeed )
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2580 sub_42F960_create_object(pX, pY, v111);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2581 pParty->uFallSpeed = 0;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2582 pZ = v111;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2583 pParty->uFallStartY = v111;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2584 v113 = pZ;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2585 if (pParty->FlyActive())
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2586 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2587 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2588 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2589 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2590 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2591 v113 = pZ;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2592 if (pParty->FlyActive())
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2593 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2594 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2595 //LABEL_141:
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2596 if (bJumping && !pParty->bFlying)
0
Ritor1
parents:
diff changeset
2597 {
Ritor1
parents:
diff changeset
2598 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2599 v34 = pParty->uFallSpeed + 2 * v33;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2600 pParty->uFallSpeed += 2 * v33;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2601 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2602 else if (!partyAtHighSlope)
0
Ritor1
parents:
diff changeset
2603 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2604 v34 = pParty->uFallSpeed;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2605 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2606 else if (!bJumping)
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2607 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2608 if ( !bmodel_standing_on_pid )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2609 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2610 // rolling down the hill
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2611 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2612 // and falling to the gravity, gradually sliding downwards. nice trick
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2613 pZ = v111;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2614 ODM_GetTerrainNormalAt(pX, pY, &v98);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2615 v35 = pParty->uFallSpeed + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2616 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2617 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2618 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2619 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2620 v128 = v1;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2621 pParty->uFallSpeed = v34;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2622 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2623 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2624 else
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2625 v34 = pParty->uFallSpeed;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2626
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2627 //LABEL_164:
1070
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2628 if(bJumping)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2629 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2630 if ( !bUnderwater && v34 <= 0)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2631 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2632 if ( v34 < -500
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2633 && !pParty->bFlying
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2634 && pParty->vPosition.z - v111 > 1000
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2635 && !pParty->FeatherFallActive())
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2636 { // falling scream
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2637 for (int i = 0; i < 4; ++i)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2638 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2639 auto player = pParty->pPlayers + i;
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
2640 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && player->CanAct())
1070
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2641 player->PlaySound(SPEECH_66, 0);
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2642 }
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2643 }
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2644 }
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2645 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2646 else
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2647 {
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2648 //LABEL_150:
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2649 pParty->uFallStartY = pZ;
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2650 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2651
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2652 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
0
Ritor1
parents:
diff changeset
2653 {
Ritor1
parents:
diff changeset
2654 *(float *)&v128 = 0.0;
Ritor1
parents:
diff changeset
2655 v2 = 0;
Ritor1
parents:
diff changeset
2656 }
Ritor1
parents:
diff changeset
2657 stru_721530.field_84 = -1;
Ritor1
parents:
diff changeset
2658 stru_721530.field_70 = 0;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2659 stru_721530.prolly_normal_d = pParty->field_14_radius;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2660 stru_721530.field_8_radius = pParty->field_14_radius >> 1;
0
Ritor1
parents:
diff changeset
2661 v126 = 0;
Ritor1
parents:
diff changeset
2662 stru_721530.field_0 = 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2663 stru_721530.height = pParty->uPartyHeight - 32;
0
Ritor1
parents:
diff changeset
2664 do
Ritor1
parents:
diff changeset
2665 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2666 stru_721530.position.x = pX;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2667 stru_721530.normal.x = pX;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2668 stru_721530.velocity.x = v2;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2669 stru_721530.position.y = pY;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2670 stru_721530.normal.y = pY;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2671 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2672 stru_721530.position.z = stru_721530.height + pZ + 1;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2673 stru_721530.velocity.y = v128;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2674 stru_721530.velocity.z = pParty->uFallSpeed;
0
Ritor1
parents:
diff changeset
2675 v36 = 0;
Ritor1
parents:
diff changeset
2676 stru_721530.uSectorID = 0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
2677 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
0
Ritor1
parents:
diff changeset
2678 v36 = 13312;
Ritor1
parents:
diff changeset
2679 if ( stru_721530._47050A(v36) )
Ritor1
parents:
diff changeset
2680 break;
Ritor1
parents:
diff changeset
2681 _46E889_collide_against_bmodels(1u);
Ritor1
parents:
diff changeset
2682 v37 = WorldPosToGridCellZ(pParty->vPosition.y);
Ritor1
parents:
diff changeset
2683 v38 = WorldPosToGridCellX(pParty->vPosition.x);
Ritor1
parents:
diff changeset
2684 _46E26D_collide_against_sprites(v38, v37);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
2685 _46ED8A_collide_against_sprite_objects(4u);
0
Ritor1
parents:
diff changeset
2686 for ( i = 0; i < (signed int)uNumActors; ++i )
Ritor1
parents:
diff changeset
2687 _46DF1A_collide_against_actor(i, 0);
Ritor1
parents:
diff changeset
2688 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
2689 {
Ritor1
parents:
diff changeset
2690 _angle_x = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
2691 _angle_y = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
2692 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
2693 }
Ritor1
parents:
diff changeset
2694 else
Ritor1
parents:
diff changeset
2695 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
2696 _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
2697 _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
2698 pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
2699 v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ;
0
Ritor1
parents:
diff changeset
2700 }
Ritor1
parents:
diff changeset
2701 v122 = v40;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2702 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2703 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0);
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2704 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2705 pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2706 v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2707 is_not_on_bmodel = false;
0
Ritor1
parents:
diff changeset
2708 v118 = v42;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2709 if ( !v97 && !v110 && !bmodel_standing_on_pid )
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2710 is_not_on_bmodel = true;
0
Ritor1
parents:
diff changeset
2711 v43 = 1;
Ritor1
parents:
diff changeset
2712 v44 = 1;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2713 if ( bUnderwater || !is_not_on_bmodel )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2714 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2715 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2716 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2717 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2718 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2719 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2720 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2721 if ( pModel && v129 > pZ )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2722 v44 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2723 if ( v118 && v119 > pZ )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2724 v43 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2725 if ( v44 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2726 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2727 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2728 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2729 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2730 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2731 else if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2732 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2733 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2734 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2735 pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2736 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2737 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2738 v43 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2739 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2740 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2741 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2742 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2743 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2744 }
0
Ritor1
parents:
diff changeset
2745 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
2746 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2747 if ( !is_not_on_bmodel )
0
Ritor1
parents:
diff changeset
2748 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2749 pX = stru_721530.normal2.x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2750 pY = stru_721530.normal2.y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2751 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2752 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
0
Ritor1
parents:
diff changeset
2753 break;
Ritor1
parents:
diff changeset
2754 }
Ritor1
parents:
diff changeset
2755 stru_721530.field_70 += stru_721530.field_7C;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2756 pX = _angle_x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2757 pY = _angle_y;
0
Ritor1
parents:
diff changeset
2758 v45 = stru_721530.uFaceID;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2759 pZ = v40;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2760 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2761 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2762 if (pParty->Invisible())
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2763 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2764
0
Ritor1
parents:
diff changeset
2765 viewparams->bRedrawGameUI = 1;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2766 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2767 pModel = (BSPModel *)58500;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2768 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2769 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2770 ++v126;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2771 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2772 continue;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2773 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2774 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
2775 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
2776 v56 = integer_sqrt(v2 * v2 + v128 * v128);
0
Ritor1
parents:
diff changeset
2777 v118 = v56;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2778 v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2779 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
0
Ritor1
parents:
diff changeset
2780 v129 = v57;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2781 v58 = (BSPModel *)stru_5C6E00->Cos(v57);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2782 pModel = v58;
0
Ritor1
parents:
diff changeset
2783 v59 = (signed int)v58 * (signed __int64)v56;
Ritor1
parents:
diff changeset
2784 v122 = v59 >> 16;
Ritor1
parents:
diff changeset
2785 v2 = v59 >> 16;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2786 v60 = (BSPModel *)stru_5C6E00->Sin(v129);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2787 pModel = v60;
0
Ritor1
parents:
diff changeset
2788 v61 = (signed int)v60 * (signed __int64)v118;
Ritor1
parents:
diff changeset
2789 v122 = v61 >> 16;
Ritor1
parents:
diff changeset
2790 v128 = v61 >> 16;
Ritor1
parents:
diff changeset
2791 }
Ritor1
parents:
diff changeset
2792 else
Ritor1
parents:
diff changeset
2793 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2794 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
0
Ritor1
parents:
diff changeset
2795 {
Ritor1
parents:
diff changeset
2796 pParty->bFlying = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2797 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2798 //v127 = v46;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2799 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2800 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1;
0
Ritor1
parents:
diff changeset
2801 v51 = __OFSUB__(v48, 32);
Ritor1
parents:
diff changeset
2802 v49 = v48 == 32;
Ritor1
parents:
diff changeset
2803 v50 = v48 - 32 < 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2804 v52 = pODMFace->pFacePlane.vNormal.z;
0
Ritor1
parents:
diff changeset
2805 v129 = (unsigned __int8)(v50 ^ v51 | v49);
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2806 v119 = v52 < 46378;
0
Ritor1
parents:
diff changeset
2807 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
2808 v119 = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2809 if ( pODMFace->uPolygonType == POLYGON_Floor )
0
Ritor1
parents:
diff changeset
2810 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2811 if ( pParty->uFallSpeed < 0 )
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2812 pParty->uFallSpeed = 0;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2813 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2814 if ( v2 * v2 + v128 * v128 < 400 )
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2815 {
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2816 v2 = 0;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2817 *(float *)&v128 = 0.0;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2818 }
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2819 if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE))
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2820 {
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2821 pParty->floor_face_pid = v45;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2822 v103 = pODMFace->sCogTriggeredID;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2823 }
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2824 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2825 pModel = (BSPModel *)58500;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2826 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2827 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2828 ++v126;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2829 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2830 continue;
0
Ritor1
parents:
diff changeset
2831 }
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2832 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// óï¸ðñÿ â ñòîëá
0
Ritor1
parents:
diff changeset
2833 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2834 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2835 if ((stru_721530.speed >> 3) > v118 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2836 v118 = stru_721530.speed >> 3;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2837 v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2838 _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
0
Ritor1
parents:
diff changeset
2839 v54 = 0;
Ritor1
parents:
diff changeset
2840 if ( !v119 )
Ritor1
parents:
diff changeset
2841 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2842 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2843 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2844 v54 = pModel;
0
Ritor1
parents:
diff changeset
2845 }
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2846 pParty->uFallSpeed += (int)v54;
0
Ritor1
parents:
diff changeset
2847 v128 += _walk_speed;
Ritor1
parents:
diff changeset
2848 v2 += v129;
Ritor1
parents:
diff changeset
2849 v55 = stru_721530.prolly_normal_d
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2850 - ((signed int)(pODMFace->pFacePlane.dist
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2851 + v122 * pODMFace->pFacePlane.vNormal.z
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2852 + _angle_y * pODMFace->pFacePlane.vNormal.y
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2853 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16);
0
Ritor1
parents:
diff changeset
2854 if ( v55 > 0 )
Ritor1
parents:
diff changeset
2855 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2856 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2857 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16);
0
Ritor1
parents:
diff changeset
2858 if ( !v119 )
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2859 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16);
0
Ritor1
parents:
diff changeset
2860 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2861 //LABEL_220:
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2862 v45 = stru_721530.uFaceID;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2863 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2864 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2865 pParty->floor_face_pid = v45;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2866 v103 = pODMFace->sCogTriggeredID;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2867 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2868 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2869 pModel = (BSPModel *)58500;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2870 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2871 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2872 ++v126;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2873 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2874 continue;
0
Ritor1
parents:
diff changeset
2875 }
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2876 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2877 if ((stru_721530.speed >> 3) > v118 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
2878 v118 = stru_721530.speed >> 3;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2879 v122 = pODMFace->pFacePlane.vNormal.x;
0
Ritor1
parents:
diff changeset
2880 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2881 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2882 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2883 v129 = pODMFace->pFacePlane.vNormal.z;
0
Ritor1
parents:
diff changeset
2884 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2885 pParty->uFallSpeed += v129;
0
Ritor1
parents:
diff changeset
2886 v2 += v122;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2887 v128 += (int)pModel;
0
Ritor1
parents:
diff changeset
2888 if ( v2 * v2 + v128 * v128 >= 400 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2889 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2890 v45 = stru_721530.uFaceID;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2891 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2892 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2893 pParty->floor_face_pid = v45;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2894 v103 = pODMFace->sCogTriggeredID;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2895 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2896 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2897 pModel = (BSPModel *)58500;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2898 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2899 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2900 ++v126;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2901 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2902 continue;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2903 }
0
Ritor1
parents:
diff changeset
2904 v2 = 0;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2905 pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
2906 *(float *)&v128 = 0.0;
Ritor1
parents:
diff changeset
2907 }
Ritor1
parents:
diff changeset
2908 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2909 //LABEL_234:
0
Ritor1
parents:
diff changeset
2910 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2911 pModel = (BSPModel *)58500;
0
Ritor1
parents:
diff changeset
2912 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2913 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
0
Ritor1
parents:
diff changeset
2914 ++v126;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2915 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
0
Ritor1
parents:
diff changeset
2916 }
Ritor1
parents:
diff changeset
2917 while ( v126 < 100 );
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2918 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
0
Ritor1
parents:
diff changeset
2919 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2920 v122 = abs(pParty->vPosition.x - pX);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2921 v126 = abs(pParty->vPosition.y - pY);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2922 v62 = abs(pParty->vPosition.z - pZ);
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
2923 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2924 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2925 pAudioPlayer->_4AA258(804);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2926 pParty->walk_sound_timer = 64;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2927 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2928 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2929 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2930 if ( v114 && (!bJumping || v101) )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2931 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2932 if ( !is_not_on_bmodel
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2933 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2934 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2935 pAudioPlayer->PlaySound(SOUND_64, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2936 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2937 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2938 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2939 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2940 //v64 = WorldPosToGridCellX(pParty->vPosition.x);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2941 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
1398
Ritor1
parents: 1345
diff changeset
2942 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2943 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2944 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2945 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2946 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2947 if ( v124 && (!bJumping || v101) )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2948 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2949 if ( is_not_on_bmodel
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2950 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2951 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2952 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2953 //v64 = WorldPosToGridCellX(pParty->vPosition.x);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2954 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
1398
Ritor1
parents: 1345
diff changeset
2955 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2956 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2957 else
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2958 pAudioPlayer->PlaySound(SOUND_103, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2959 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2960 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2961 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2962 pAudioPlayer->_4AA258(804);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2963 pParty->walk_sound_timer = 64;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2964 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2965 }
0
Ritor1
parents:
diff changeset
2966 }
Ritor1
parents:
diff changeset
2967 }
Ritor1
parents:
diff changeset
2968 if ( !bJumping || v101 )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2969 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2970 else
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2971 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
0
Ritor1
parents:
diff changeset
2972 v126 = WorldPosToGridCellX(pParty->vPosition.x);
Ritor1
parents:
diff changeset
2973 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2974 v114 = WorldPosToGridCellX(pX);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2975 v66 = WorldPosToGridCellZ(pY) - 1;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2976 pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1);
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2977 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1;
0
Ritor1
parents:
diff changeset
2978 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66);
Ritor1
parents:
diff changeset
2979 v68 = 0;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2980 v69 = (~(unsigned int)v67 >> 1) & 1;
0
Ritor1
parents:
diff changeset
2981 if ( v114 == v126 && v66 == v65 && v122 && v69 )
Ritor1
parents:
diff changeset
2982 v68 = 1;
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1412
diff changeset
2983 if ( !is_not_on_bmodel )
0
Ritor1
parents:
diff changeset
2984 v68 = 1;
Ritor1
parents:
diff changeset
2985 if ( v68 )
Ritor1
parents:
diff changeset
2986 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2987 v70 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2988 v71 = pX;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2989 v72 = pY;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
2990 //pParty->uFallSpeed = v121;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2991 v73 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2992 pParty->vPosition.x = pX;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2993 pParty->vPosition.y = pY;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2994 pParty->vPosition.z = pZ;
0
Ritor1
parents:
diff changeset
2995 pParty->field_6F0 = v113;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2996 if ( pZ > 8160 )
0
Ritor1
parents:
diff changeset
2997 {
Ritor1
parents:
diff changeset
2998 v73 = 8160;
Ritor1
parents:
diff changeset
2999 pParty->uFallStartY = 8160;
Ritor1
parents:
diff changeset
3000 pParty->vPosition.z = 8160;
Ritor1
parents:
diff changeset
3001 }
Ritor1
parents:
diff changeset
3002 if ( !v103
Ritor1
parents:
diff changeset
3003 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71)
Ritor1
parents:
diff changeset
3004 && pParty->vPosition.y == v72
Ritor1
parents:
diff changeset
3005 && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) )
Ritor1
parents:
diff changeset
3006 {
Ritor1
parents:
diff changeset
3007 if ( v73 < v111 )
Ritor1
parents:
diff changeset
3008 {
Ritor1
parents:
diff changeset
3009 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
3010 v73 = v105;
Ritor1
parents:
diff changeset
3011 pParty->vPosition.z = v105;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3012 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )//Fall to the ground(ïàäåíèå íà çåìëþ ñ âûñîòû)
0
Ritor1
parents:
diff changeset
3013 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3014 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3015 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3016 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
3017 }
Ritor1
parents:
diff changeset
3018 else
Ritor1
parents:
diff changeset
3019 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3020 for ( uint i = 1; i <= 4; ++i )
0
Ritor1
parents:
diff changeset
3021 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3022 v110 = pPlayers[i]->GetMaxHealth();
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3023 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
3024 DMGT_PHISYCAL);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3025 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3026 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
0
Ritor1
parents:
diff changeset
3027 }
Ritor1
parents:
diff changeset
3028 v73 = pParty->vPosition.z;
Ritor1
parents:
diff changeset
3029 }
Ritor1
parents:
diff changeset
3030 }
Ritor1
parents:
diff changeset
3031 pParty->uFallStartY = v70;
Ritor1
parents:
diff changeset
3032 }
Ritor1
parents:
diff changeset
3033 if ( v102 && v73 < v109 )
Ritor1
parents:
diff changeset
3034 {
Ritor1
parents:
diff changeset
3035 if ( (signed int)(pParty->uPartyHeight + v73) >= v109 )
Ritor1
parents:
diff changeset
3036 {
Ritor1
parents:
diff changeset
3037 pParty->vPosition.z = v109 - pParty->uPartyHeight - 1;
Ritor1
parents:
diff changeset
3038 pParty->field_6F0 = v109 - pParty->uPartyHeight - 1;
Ritor1
parents:
diff changeset
3039 }
Ritor1
parents:
diff changeset
3040 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3041 pParty->uFlags &= ~0x204;
0
Ritor1
parents:
diff changeset
3042 }
Ritor1
parents:
diff changeset
3043 return;
Ritor1
parents:
diff changeset
3044 }
Ritor1
parents:
diff changeset
3045 v76 = pParty->bFlying;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3046 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !pModel )
0
Ritor1
parents:
diff changeset
3047 v77 = 1;
Ritor1
parents:
diff changeset
3048 else
Ritor1
parents:
diff changeset
3049 v77 = v122 != 0;
Ritor1
parents:
diff changeset
3050 v114 = 0;
Ritor1
parents:
diff changeset
3051 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk )
Ritor1
parents:
diff changeset
3052 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3053 if ( pModel )
0
Ritor1
parents:
diff changeset
3054 {
Ritor1
parents:
diff changeset
3055 v78 = v69 != 0;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3056 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3057 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3058 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3059 v114 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3060 v78 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3061 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3062 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3063 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3064 v78 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3065 //LABEL_306:
0
Ritor1
parents:
diff changeset
3066 if ( v77 )
Ritor1
parents:
diff changeset
3067 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3068 pParty->vPosition.x = pX;
0
Ritor1
parents:
diff changeset
3069 }
Ritor1
parents:
diff changeset
3070 if ( v78 )
Ritor1
parents:
diff changeset
3071 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3072 pParty->vPosition.y = pY;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3073 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3074 if ( v78 || v77)
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3075 {
0
Ritor1
parents:
diff changeset
3076 if ( bWaterWalk )
Ritor1
parents:
diff changeset
3077 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3078 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
3079 //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
3080 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
3081 v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119];
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3082 *(short *)v79 |= 1u;
0
Ritor1
parents:
diff changeset
3083 if ( !v122 || !v69 )
Ritor1
parents:
diff changeset
3084 {
Ritor1
parents:
diff changeset
3085 if ( !v76 )
Ritor1
parents:
diff changeset
3086 {
Ritor1
parents:
diff changeset
3087 v80 = *(short *)v79;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3088 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
3089 *(short *)v79 = v80 & 0xFFFE;
Ritor1
parents:
diff changeset
3090 }
Ritor1
parents:
diff changeset
3091 }
Ritor1
parents:
diff changeset
3092 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3093 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3094 else if ( bWalkSound && pParty->walk_sound_timer <= 0 )
0
Ritor1
parents:
diff changeset
3095 {
Ritor1
parents:
diff changeset
3096 pAudioPlayer->_4AA258(804);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
3097 pParty->walk_sound_timer = 64;
0
Ritor1
parents:
diff changeset
3098 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3099 //LABEL_318:
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3100 v81 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3101 v82 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3102 pParty->vPosition.z = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3103 if ( pZ > 8160 )
0
Ritor1
parents:
diff changeset
3104 {
Ritor1
parents:
diff changeset
3105 v82 = 8160;
Ritor1
parents:
diff changeset
3106 pParty->uFallStartY = 8160;
Ritor1
parents:
diff changeset
3107 pParty->vPosition.z = 8160;
Ritor1
parents:
diff changeset
3108 }
Ritor1
parents:
diff changeset
3109 LOWORD(pParty->uFlags) &= 0xFDFBu;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3110 //pParty->uFallSpeed = v121;
0
Ritor1
parents:
diff changeset
3111 pParty->field_6F0 = v113;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3112 if ( v114 )//party stand to the water(ãðóïïà ñòîèò íà âîäå)
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3113 {
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3114 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3115 if ( pParty->vPosition.z <= pTerrainHeight + 1 )//ïîëîæåíèå ãðóïïû âñåãäà +1
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3116 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE;
0
Ritor1
parents:
diff changeset
3117 }
Ritor1
parents:
diff changeset
3118 if ( !v103
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3119 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3120 && pParty->vPosition.y == pY
0
Ritor1
parents:
diff changeset
3121 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
Ritor1
parents:
diff changeset
3122 {
Ritor1
parents:
diff changeset
3123 if ( v82 < v111 )
Ritor1
parents:
diff changeset
3124 {
Ritor1
parents:
diff changeset
3125 v82 = v105;
Ritor1
parents:
diff changeset
3126 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
3127 pParty->vPosition.z = v105;
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3128 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water(ïàäåíèå íà âîäó ñ âûñîòû)
0
Ritor1
parents:
diff changeset
3129 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3130 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3131 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3132 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
3133 }
Ritor1
parents:
diff changeset
3134 else
Ritor1
parents:
diff changeset
3135 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3136 for ( uint i = 1; i <= 4; ++i )
0
Ritor1
parents:
diff changeset
3137 {
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3138 v110 = pPlayers[i]->GetMaxHealth();
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3139 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
3140 DMGT_PHISYCAL);
1424
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3141 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
5930342f092b fall to the water
Ritor1
parents: 1418
diff changeset
3142 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
0
Ritor1
parents:
diff changeset
3143 }
Ritor1
parents:
diff changeset
3144 v82 = pParty->vPosition.z;
Ritor1
parents:
diff changeset
3145 }
Ritor1
parents:
diff changeset
3146 }
Ritor1
parents:
diff changeset
3147 pParty->uFallStartY = v81;
Ritor1
parents:
diff changeset
3148 }
Ritor1
parents:
diff changeset
3149 if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 )
Ritor1
parents:
diff changeset
3150 {
Ritor1
parents:
diff changeset
3151 pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1;
Ritor1
parents:
diff changeset
3152 pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1;
Ritor1
parents:
diff changeset
3153 }
Ritor1
parents:
diff changeset
3154 }
Ritor1
parents:
diff changeset
3155 }
Ritor1
parents:
diff changeset
3156
Ritor1
parents:
diff changeset
3157 //----- (0047531C) --------------------------------------------------------
Ritor1
parents:
diff changeset
3158 bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10)
Ritor1
parents:
diff changeset
3159 {
Ritor1
parents:
diff changeset
3160 BLVFace *v10; // ebx@1
Ritor1
parents:
diff changeset
3161 int v11; // ST1C_4@3
Ritor1
parents:
diff changeset
3162 int v12; // edi@3
Ritor1
parents:
diff changeset
3163 int v13; // esi@3
Ritor1
parents:
diff changeset
3164 int v14; // edi@4
Ritor1
parents:
diff changeset
3165 signed __int64 v15; // qtt@6
Ritor1
parents:
diff changeset
3166 __int16 v16; // si@7
Ritor1
parents:
diff changeset
3167 int *v18; // [sp+Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
3168 int v19; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
3169 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
3170 int a9b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3171 int a9a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3172 int a10b; // [sp+3Ch] [bp+24h]@3
Ritor1
parents:
diff changeset
3173 signed int a10a; // [sp+3Ch] [bp+24h]@4
Ritor1
parents:
diff changeset
3174 int a10c; // [sp+3Ch] [bp+24h]@5
Ritor1
parents:
diff changeset
3175
Ritor1
parents:
diff changeset
3176 v10 = a9;
Ritor1
parents:
diff changeset
3177 v18 = a2;
Ritor1
parents:
diff changeset
3178 v19 = a1;
Ritor1
parents:
diff changeset
3179 if ( a10 && BYTE3(a9->uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
3180 return 0;
Ritor1
parents:
diff changeset
3181 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
3182 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
3183 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
3184 v12 = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
3185 a9a = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
3186 v13 = (a1 << 16)
Ritor1
parents:
diff changeset
3187 - a3 * v10->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3188 - a4 * v10->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3189 - a5 * v10->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
3190 - v10->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
3191 if ( abs((a1 << 16)
Ritor1
parents:
diff changeset
3192 - a3 * v10->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3193 - a4 * v10->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3194 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 )
Ritor1
parents:
diff changeset
3195 {
Ritor1
parents:
diff changeset
3196 a10c = abs(v13) >> 14;
Ritor1
parents:
diff changeset
3197 if ( a10c > abs(v12) )
Ritor1
parents:
diff changeset
3198 return 0;
Ritor1
parents:
diff changeset
3199 LODWORD(v15) = v13 << 16;
Ritor1
parents:
diff changeset
3200 HIDWORD(v15) = v13 >> 16;
Ritor1
parents:
diff changeset
3201 v14 = v19;
Ritor1
parents:
diff changeset
3202 a10a = v15 / a9a;
Ritor1
parents:
diff changeset
3203 }
Ritor1
parents:
diff changeset
3204 else
Ritor1
parents:
diff changeset
3205 {
Ritor1
parents:
diff changeset
3206 a10a = 0;
Ritor1
parents:
diff changeset
3207 v14 = abs(v13) >> 16;
Ritor1
parents:
diff changeset
3208 }
Ritor1
parents:
diff changeset
3209 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16);
Ritor1
parents:
diff changeset
3210 LOWORD(a7a) = (short)a3
Ritor1
parents:
diff changeset
3211 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16)
Ritor1
parents:
diff changeset
3212 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents:
diff changeset
3213 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents:
diff changeset
3214 if ( !sub_475665(
Ritor1
parents:
diff changeset
3215 v10,
Ritor1
parents:
diff changeset
3216 a7a,
Ritor1
parents:
diff changeset
3217 (short)a5
Ritor1
parents:
diff changeset
3218 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16)
Ritor1
parents:
diff changeset
3219 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) )
Ritor1
parents:
diff changeset
3220 return 0;
Ritor1
parents:
diff changeset
3221 *v18 = a10a >> 16;
Ritor1
parents:
diff changeset
3222 if ( a10a >> 16 < 0 )
Ritor1
parents:
diff changeset
3223 *v18 = 0;
Ritor1
parents:
diff changeset
3224 return 1;
Ritor1
parents:
diff changeset
3225 }
Ritor1
parents:
diff changeset
3226
Ritor1
parents:
diff changeset
3227 //----- (004754BF) --------------------------------------------------------
Ritor1
parents:
diff changeset
3228 bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10, int a11)
Ritor1
parents:
diff changeset
3229 {
Ritor1
parents:
diff changeset
3230 BLVFace *v11; // ebx@1
Ritor1
parents:
diff changeset
3231 int v12; // ST1C_4@3
Ritor1
parents:
diff changeset
3232 int v13; // edi@3
Ritor1
parents:
diff changeset
3233 int v14; // esi@3
Ritor1
parents:
diff changeset
3234 int v15; // edi@4
Ritor1
parents:
diff changeset
3235 signed __int64 v16; // qtt@6
Ritor1
parents:
diff changeset
3236 __int16 v17; // si@7
Ritor1
parents:
diff changeset
3237 int *v19; // [sp+Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
3238 int v20; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
3239 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
3240 int a1b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3241 int a1a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3242 int a11b; // [sp+40h] [bp+28h]@3
Ritor1
parents:
diff changeset
3243 signed int a11a; // [sp+40h] [bp+28h]@4
Ritor1
parents:
diff changeset
3244 int a11c; // [sp+40h] [bp+28h]@5
Ritor1
parents:
diff changeset
3245
Ritor1
parents:
diff changeset
3246 v11 = a9;
Ritor1
parents:
diff changeset
3247 v19 = a2;
Ritor1
parents:
diff changeset
3248 v20 = a1;
Ritor1
parents:
diff changeset
3249 if ( a11 && BYTE3(a9->uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
3250 return 0;
Ritor1
parents:
diff changeset
3251 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
3252 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
3253 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
3254 v13 = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
3255 a1a = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
3256 v14 = (a1 << 16)
Ritor1
parents:
diff changeset
3257 - a3 * v11->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3258 - a4 * v11->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3259 - a5 * v11->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
3260 - v11->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
3261 if ( abs((a1 << 16)
Ritor1
parents:
diff changeset
3262 - a3 * v11->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3263 - a4 * v11->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3264 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 )
Ritor1
parents:
diff changeset
3265 {
Ritor1
parents:
diff changeset
3266 a11c = abs(v14) >> 14;
Ritor1
parents:
diff changeset
3267 if ( a11c > abs(v13) )
Ritor1
parents:
diff changeset
3268 return 0;
Ritor1
parents:
diff changeset
3269 LODWORD(v16) = v14 << 16;
Ritor1
parents:
diff changeset
3270 HIDWORD(v16) = v14 >> 16;
Ritor1
parents:
diff changeset
3271 v15 = v20;
Ritor1
parents:
diff changeset
3272 a11a = v16 / a1a;
Ritor1
parents:
diff changeset
3273 }
Ritor1
parents:
diff changeset
3274 else
Ritor1
parents:
diff changeset
3275 {
Ritor1
parents:
diff changeset
3276 a11a = 0;
Ritor1
parents:
diff changeset
3277 v15 = abs(v14) >> 16;
Ritor1
parents:
diff changeset
3278 }
Ritor1
parents:
diff changeset
3279 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16);
Ritor1
parents:
diff changeset
3280 LOWORD(a7a) = (short)a3
Ritor1
parents:
diff changeset
3281 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16)
Ritor1
parents:
diff changeset
3282 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents:
diff changeset
3283 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents:
diff changeset
3284 if ( !sub_4759C9(
Ritor1
parents:
diff changeset
3285 v11,
Ritor1
parents:
diff changeset
3286 a10,
Ritor1
parents:
diff changeset
3287 a7a,
Ritor1
parents:
diff changeset
3288 (short)a5
Ritor1
parents:
diff changeset
3289 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16)
Ritor1
parents:
diff changeset
3290 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) )
Ritor1
parents:
diff changeset
3291 return 0;
Ritor1
parents:
diff changeset
3292 *v19 = a11a >> 16;
Ritor1
parents:
diff changeset
3293 if ( a11a >> 16 < 0 )
Ritor1
parents:
diff changeset
3294 *v19 = 0;
Ritor1
parents:
diff changeset
3295 return 1;
Ritor1
parents:
diff changeset
3296 }
Ritor1
parents:
diff changeset
3297
Ritor1
parents:
diff changeset
3298 //----- (00475665) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
3299 int sub_475665(BLVFace *_this, int a2, __int16 a3)
0
Ritor1
parents:
diff changeset
3300 {
Ritor1
parents:
diff changeset
3301 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
3302 Vec3_short_ *v4; // edx@3
Ritor1
parents:
diff changeset
3303 signed int v5; // eax@4
Ritor1
parents:
diff changeset
3304 int v6; // esi@4
Ritor1
parents:
diff changeset
3305 signed int v7; // eax@7
Ritor1
parents:
diff changeset
3306 Vec3_short_ *v8; // edx@8
Ritor1
parents:
diff changeset
3307 signed int v9; // eax@9
Ritor1
parents:
diff changeset
3308 int v10; // esi@9
Ritor1
parents:
diff changeset
3309 signed int v11; // eax@11
Ritor1
parents:
diff changeset
3310 Vec3_short_ *v12; // edx@12
Ritor1
parents:
diff changeset
3311 signed int v13; // eax@13
Ritor1
parents:
diff changeset
3312 int v14; // esi@13
Ritor1
parents:
diff changeset
3313 int v15; // esi@14
Ritor1
parents:
diff changeset
3314 bool v16; // edi@14
Ritor1
parents:
diff changeset
3315 int v17; // ecx@16
Ritor1
parents:
diff changeset
3316 signed int v18; // edx@16
Ritor1
parents:
diff changeset
3317 int v19; // eax@17
Ritor1
parents:
diff changeset
3318 signed int v20; // ebx@18
Ritor1
parents:
diff changeset
3319 int v21; // edi@20
Ritor1
parents:
diff changeset
3320 signed int v22; // ST14_4@22
Ritor1
parents:
diff changeset
3321 signed __int64 v23; // qtt@22
Ritor1
parents:
diff changeset
3322 signed int result; // eax@25
Ritor1
parents:
diff changeset
3323 int v25; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
3324 int v26; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3325 signed int v27; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
3326 signed int v28; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
3327 signed int v29; // [sp+30h] [bp+Ch]@7
Ritor1
parents:
diff changeset
3328 signed int v30; // [sp+30h] [bp+Ch]@11
Ritor1
parents:
diff changeset
3329 signed int v31; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
3330
Ritor1
parents:
diff changeset
3331 v3 = _this->uAttributes;
Ritor1
parents:
diff changeset
3332 if ( BYTE1(v3) & 1 )
Ritor1
parents:
diff changeset
3333 {
Ritor1
parents:
diff changeset
3334 v28 = 0;
Ritor1
parents:
diff changeset
3335 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
3336 v27 = SHIWORD(a2);
Ritor1
parents:
diff changeset
3337 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3338 {
Ritor1
parents:
diff changeset
3339 v4 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3340 do
Ritor1
parents:
diff changeset
3341 {
Ritor1
parents:
diff changeset
3342 v5 = v28;
Ritor1
parents:
diff changeset
3343 v6 = 2 * v28;
Ritor1
parents:
diff changeset
3344 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x;
Ritor1
parents:
diff changeset
3345 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y;
Ritor1
parents:
diff changeset
3346 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1]
Ritor1
parents:
diff changeset
3347 + v4[_this->pVertexIDs[v5 + 1]].x;
Ritor1
parents:
diff changeset
3348 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y;
Ritor1
parents:
diff changeset
3349 }
Ritor1
parents:
diff changeset
3350 while ( v28 < _this->uNumVertices );
Ritor1
parents:
diff changeset
3351 }
Ritor1
parents:
diff changeset
3352 }
Ritor1
parents:
diff changeset
3353 else
Ritor1
parents:
diff changeset
3354 {
Ritor1
parents:
diff changeset
3355 if ( BYTE1(v3) & 2 )
Ritor1
parents:
diff changeset
3356 {
Ritor1
parents:
diff changeset
3357 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
3358 v7 = a3;
Ritor1
parents:
diff changeset
3359 v29 = 0;
Ritor1
parents:
diff changeset
3360 v27 = v7;
Ritor1
parents:
diff changeset
3361 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3362 {
Ritor1
parents:
diff changeset
3363 v8 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3364 do
Ritor1
parents:
diff changeset
3365 {
Ritor1
parents:
diff changeset
3366 v9 = v29;
Ritor1
parents:
diff changeset
3367 v10 = 2 * v29;
Ritor1
parents:
diff changeset
3368 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x;
Ritor1
parents:
diff changeset
3369 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z;
Ritor1
parents:
diff changeset
3370 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x;
Ritor1
parents:
diff changeset
3371 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z;
Ritor1
parents:
diff changeset
3372 }
Ritor1
parents:
diff changeset
3373 while ( v29 < _this->uNumVertices );
Ritor1
parents:
diff changeset
3374 }
Ritor1
parents:
diff changeset
3375 }
Ritor1
parents:
diff changeset
3376 else
Ritor1
parents:
diff changeset
3377 {
Ritor1
parents:
diff changeset
3378 v26 = SHIWORD(a2);
Ritor1
parents:
diff changeset
3379 v11 = a3;
Ritor1
parents:
diff changeset
3380 v30 = 0;
Ritor1
parents:
diff changeset
3381 v27 = v11;
Ritor1
parents:
diff changeset
3382 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3383 {
Ritor1
parents:
diff changeset
3384 v12 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3385 do
Ritor1
parents:
diff changeset
3386 {
Ritor1
parents:
diff changeset
3387 v13 = v30;
Ritor1
parents:
diff changeset
3388 v14 = 2 * v30;
Ritor1
parents:
diff changeset
3389 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y;
Ritor1
parents:
diff changeset
3390 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z;
Ritor1
parents:
diff changeset
3391 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y;
Ritor1
parents:
diff changeset
3392 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z;
Ritor1
parents:
diff changeset
3393 }
Ritor1
parents:
diff changeset
3394 while ( v30 < _this->uNumVertices );
Ritor1
parents:
diff changeset
3395 }
Ritor1
parents:
diff changeset
3396 }
Ritor1
parents:
diff changeset
3397 }
Ritor1
parents:
diff changeset
3398 v15 = 2 * _this->uNumVertices;
Ritor1
parents:
diff changeset
3399 v31 = 0;
Ritor1
parents:
diff changeset
3400 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0];
Ritor1
parents:
diff changeset
3401 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0];
Ritor1
parents:
diff changeset
3402 v25 = 0;
Ritor1
parents:
diff changeset
3403 v16 = word_720B40_intercepts_zs[0] >= v27;
Ritor1
parents:
diff changeset
3404 if ( v15 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3405 return 0;
0
Ritor1
parents:
diff changeset
3406 do
Ritor1
parents:
diff changeset
3407 {
Ritor1
parents:
diff changeset
3408 if ( v31 >= 2 )
Ritor1
parents:
diff changeset
3409 break;
Ritor1
parents:
diff changeset
3410 v17 = v25;
Ritor1
parents:
diff changeset
3411 v18 = word_720B40_intercepts_zs[v25 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3412 if ( v16 ^ (v18 >= v27) )
0
Ritor1
parents:
diff changeset
3413 {
Ritor1
parents:
diff changeset
3414 v19 = word_720C10_intercepts_xs[v17 + 1];
Ritor1
parents:
diff changeset
3415 if ( v19 >= v26 )
Ritor1
parents:
diff changeset
3416 v20 = 0;
Ritor1
parents:
diff changeset
3417 else
Ritor1
parents:
diff changeset
3418 v20 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3419 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26);
0
Ritor1
parents:
diff changeset
3420 if ( v21 != 3 )
Ritor1
parents:
diff changeset
3421 {
Ritor1
parents:
diff changeset
3422 if ( !v21
Ritor1
parents:
diff changeset
3423 || (v22 = v19 - word_720C10_intercepts_xs[v17],
Ritor1
parents:
diff changeset
3424 LODWORD(v23) = v22 << 16,
Ritor1
parents:
diff changeset
3425 HIDWORD(v23) = v22 >> 16,
Ritor1
parents:
diff changeset
3426 word_720C10_intercepts_xs[v17]
Ritor1
parents:
diff changeset
3427 + ((signed int)(((unsigned __int64)(v23
Ritor1
parents:
diff changeset
3428 / (v18 - word_720B40_intercepts_zs[v17])
Ritor1
parents:
diff changeset
3429 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16)
Ritor1
parents:
diff changeset
3430 + 32768) >> 16) >= v26) )
Ritor1
parents:
diff changeset
3431 ++v31;
Ritor1
parents:
diff changeset
3432 }
Ritor1
parents:
diff changeset
3433 }
Ritor1
parents:
diff changeset
3434 ++v25;
Ritor1
parents:
diff changeset
3435 v16 = v18 >= v27;
Ritor1
parents:
diff changeset
3436 }
Ritor1
parents:
diff changeset
3437 while ( v25 < v15 );
Ritor1
parents:
diff changeset
3438 result = 1;
Ritor1
parents:
diff changeset
3439 if ( v31 != 1 )
Ritor1
parents:
diff changeset
3440 result = 0;
Ritor1
parents:
diff changeset
3441 return result;
Ritor1
parents:
diff changeset
3442 }
Ritor1
parents:
diff changeset
3443
Ritor1
parents:
diff changeset
3444 //----- (004759C9) --------------------------------------------------------
Ritor1
parents:
diff changeset
3445 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4)
Ritor1
parents:
diff changeset
3446 {
Ritor1
parents:
diff changeset
3447 unsigned int v4; // eax@1
Ritor1
parents:
diff changeset
3448 int v5; // edx@4
Ritor1
parents:
diff changeset
3449 __int16 v6; // si@4
Ritor1
parents:
diff changeset
3450 int v7; // edx@9
Ritor1
parents:
diff changeset
3451 __int16 v8; // si@9
Ritor1
parents:
diff changeset
3452 int v9; // edx@13
Ritor1
parents:
diff changeset
3453 __int16 v10; // si@13
Ritor1
parents:
diff changeset
3454 int v11; // esi@14
Ritor1
parents:
diff changeset
3455 bool v12; // edi@14
Ritor1
parents:
diff changeset
3456 int v13; // ecx@16
Ritor1
parents:
diff changeset
3457 signed int v14; // edx@16
Ritor1
parents:
diff changeset
3458 int v15; // eax@17
Ritor1
parents:
diff changeset
3459 signed int v16; // ebx@18
Ritor1
parents:
diff changeset
3460 int v17; // edi@20
Ritor1
parents:
diff changeset
3461 signed int v18; // ST14_4@22
Ritor1
parents:
diff changeset
3462 signed __int64 v19; // qtt@22
Ritor1
parents:
diff changeset
3463 bool result; // eax@25
Ritor1
parents:
diff changeset
3464 int v21; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
3465 signed int v22; // [sp+18h] [bp-Ch]@1
Ritor1
parents:
diff changeset
3466 int v23; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3467 signed int v24; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
3468 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3
Ritor1
parents:
diff changeset
3469 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8
Ritor1
parents:
diff changeset
3470 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12
Ritor1
parents:
diff changeset
3471 signed int a4d; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
3472
Ritor1
parents:
diff changeset
3473 v4 = a1->uAttributes;
Ritor1
parents:
diff changeset
3474 v22 = 0;
Ritor1
parents:
diff changeset
3475 if ( BYTE1(v4) & 1 )
Ritor1
parents:
diff changeset
3476 {
Ritor1
parents:
diff changeset
3477 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
3478 v24 = SHIWORD(a3);
Ritor1
parents:
diff changeset
3479 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3480 {
Ritor1
parents:
diff changeset
3481 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3482 do
Ritor1
parents:
diff changeset
3483 {
Ritor1
parents:
diff changeset
3484 v5 = 2 * v22;
Ritor1
parents:
diff changeset
3485 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
3486 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
3487 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x);
Ritor1
parents:
diff changeset
3488 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y);
Ritor1
parents:
diff changeset
3489 ++v22;
Ritor1
parents:
diff changeset
3490 }
Ritor1
parents:
diff changeset
3491 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3492 }
Ritor1
parents:
diff changeset
3493 }
Ritor1
parents:
diff changeset
3494 else
Ritor1
parents:
diff changeset
3495 {
Ritor1
parents:
diff changeset
3496 if ( BYTE1(v4) & 2 )
Ritor1
parents:
diff changeset
3497 {
Ritor1
parents:
diff changeset
3498 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
3499 v24 = a4;
Ritor1
parents:
diff changeset
3500 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3501 {
Ritor1
parents:
diff changeset
3502 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3503 do
Ritor1
parents:
diff changeset
3504 {
Ritor1
parents:
diff changeset
3505 v7 = 2 * v22;
Ritor1
parents:
diff changeset
3506 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
3507 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
3508 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x);
Ritor1
parents:
diff changeset
3509 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z);
Ritor1
parents:
diff changeset
3510 ++v22;
Ritor1
parents:
diff changeset
3511 }
Ritor1
parents:
diff changeset
3512 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3513 }
Ritor1
parents:
diff changeset
3514 }
Ritor1
parents:
diff changeset
3515 else
Ritor1
parents:
diff changeset
3516 {
Ritor1
parents:
diff changeset
3517 v23 = SHIWORD(a3);
Ritor1
parents:
diff changeset
3518 v24 = a4;
Ritor1
parents:
diff changeset
3519 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3520 {
Ritor1
parents:
diff changeset
3521 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3522 do
Ritor1
parents:
diff changeset
3523 {
Ritor1
parents:
diff changeset
3524 v9 = 2 * v22;
Ritor1
parents:
diff changeset
3525 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
3526 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
3527 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y);
Ritor1
parents:
diff changeset
3528 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z);
Ritor1
parents:
diff changeset
3529 ++v22;
Ritor1
parents:
diff changeset
3530 }
Ritor1
parents:
diff changeset
3531 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3532 }
Ritor1
parents:
diff changeset
3533 }
Ritor1
parents:
diff changeset
3534 }
Ritor1
parents:
diff changeset
3535 v11 = 2 * a1->uNumVertices;
Ritor1
parents:
diff changeset
3536 a4d = 0;
Ritor1
parents:
diff changeset
3537 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0];
Ritor1
parents:
diff changeset
3538 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0];
Ritor1
parents:
diff changeset
3539 v21 = 0;
Ritor1
parents:
diff changeset
3540 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24;
Ritor1
parents:
diff changeset
3541 if ( v11 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3542 return 0;
0
Ritor1
parents:
diff changeset
3543 do
Ritor1
parents:
diff changeset
3544 {
Ritor1
parents:
diff changeset
3545 if ( a4d >= 2 )
Ritor1
parents:
diff changeset
3546 break;
Ritor1
parents:
diff changeset
3547 v13 = v21;
Ritor1
parents:
diff changeset
3548 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3549 if ( v12 ^ (v14 >= v24) )
0
Ritor1
parents:
diff changeset
3550 {
Ritor1
parents:
diff changeset
3551 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1];
Ritor1
parents:
diff changeset
3552 if ( v15 >= v23 )
Ritor1
parents:
diff changeset
3553 v16 = 0;
Ritor1
parents:
diff changeset
3554 else
Ritor1
parents:
diff changeset
3555 v16 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3556 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23);
0
Ritor1
parents:
diff changeset
3557 if ( v17 != 3 )
Ritor1
parents:
diff changeset
3558 {
Ritor1
parents:
diff changeset
3559 if ( !v17
Ritor1
parents:
diff changeset
3560 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13],
Ritor1
parents:
diff changeset
3561 LODWORD(v19) = v18 << 16,
Ritor1
parents:
diff changeset
3562 HIDWORD(v19) = v18 >> 16,
Ritor1
parents:
diff changeset
3563 word_720A70_intercepts_xs_plus_xs[v13]
Ritor1
parents:
diff changeset
3564 + ((signed int)(((unsigned __int64)(v19
Ritor1
parents:
diff changeset
3565 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13])
Ritor1
parents:
diff changeset
3566 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16)
Ritor1
parents:
diff changeset
3567 + 32768) >> 16) >= v23) )
Ritor1
parents:
diff changeset
3568 ++a4d;
Ritor1
parents:
diff changeset
3569 }
Ritor1
parents:
diff changeset
3570 }
Ritor1
parents:
diff changeset
3571 ++v21;
Ritor1
parents:
diff changeset
3572 v12 = v14 >= v24;
Ritor1
parents:
diff changeset
3573 }
Ritor1
parents:
diff changeset
3574 while ( v21 < v11 );
Ritor1
parents:
diff changeset
3575 result = 1;
Ritor1
parents:
diff changeset
3576 if ( a4d != 1 )
Ritor1
parents:
diff changeset
3577 result = 0;
Ritor1
parents:
diff changeset
3578 return result;
Ritor1
parents:
diff changeset
3579 }
Ritor1
parents:
diff changeset
3580
Ritor1
parents:
diff changeset
3581 //----- (00475D85) --------------------------------------------------------
Ritor1
parents:
diff changeset
3582 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4)
Ritor1
parents:
diff changeset
3583 {
Ritor1
parents:
diff changeset
3584 BLVFace *v4; // ebx@1
Ritor1
parents:
diff changeset
3585 int v5; // ST24_4@2
Ritor1
parents:
diff changeset
3586 int v6; // ST28_4@2
Ritor1
parents:
diff changeset
3587 int v7; // edi@2
Ritor1
parents:
diff changeset
3588 int v8; // eax@5
Ritor1
parents:
diff changeset
3589 signed int v9; // esi@5
Ritor1
parents:
diff changeset
3590 signed __int64 v10; // qtt@10
Ritor1
parents:
diff changeset
3591 Vec3_int_ *v11; // esi@11
Ritor1
parents:
diff changeset
3592 int v12; // ST14_4@11
Ritor1
parents:
diff changeset
3593 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1
Ritor1
parents:
diff changeset
3594 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
3595 int v16; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
3596 int v17; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
3597 int a4b; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
3598 int a4c; // [sp+30h] [bp+Ch]@9
Ritor1
parents:
diff changeset
3599 signed int a4a; // [sp+30h] [bp+Ch]@10
Ritor1
parents:
diff changeset
3600
Ritor1
parents:
diff changeset
3601 v4 = a4;
Ritor1
parents:
diff changeset
3602 v15 = a2;
Ritor1
parents:
diff changeset
3603 v14 = a1;
Ritor1
parents:
diff changeset
3604 if ( BYTE3(a4->uAttributes) & 0x20
Ritor1
parents:
diff changeset
3605 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
3606 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
3607 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
3608 v7 = v5 + v6 + a4b,
Ritor1
parents:
diff changeset
3609 (v16 = v5 + v6 + a4b) == 0)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
3610 || v7 > 0 && !v4->Portal())
0
Ritor1
parents:
diff changeset
3611 return 0;
Ritor1
parents:
diff changeset
3612 v8 = v4->pFacePlane_old.vNormal.z * a1->z;
Ritor1
parents:
diff changeset
3613 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x);
Ritor1
parents:
diff changeset
3614 if ( v7 <= 0 )
Ritor1
parents:
diff changeset
3615 {
Ritor1
parents:
diff changeset
3616 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 )
Ritor1
parents:
diff changeset
3617 return 0;
Ritor1
parents:
diff changeset
3618 }
Ritor1
parents:
diff changeset
3619 else
Ritor1
parents:
diff changeset
3620 {
Ritor1
parents:
diff changeset
3621 if ( v9 < 0 )
Ritor1
parents:
diff changeset
3622 return 0;
Ritor1
parents:
diff changeset
3623 }
Ritor1
parents:
diff changeset
3624 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14;
Ritor1
parents:
diff changeset
3625 if ( a4c > abs(v7)
Ritor1
parents:
diff changeset
3626 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16)
Ritor1
parents:
diff changeset
3627 || (v11 = v14,
Ritor1
parents:
diff changeset
3628 LOWORD(v12) = LOWORD(v14->x)
Ritor1
parents:
diff changeset
3629 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3630 HIWORD(v12) = LOWORD(v11->y)
Ritor1
parents:
diff changeset
3631 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3632 !sub_475665(
Ritor1
parents:
diff changeset
3633 v4,
Ritor1
parents:
diff changeset
3634 v12,
Ritor1
parents:
diff changeset
3635 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
3636 return 0;
Ritor1
parents:
diff changeset
3637 *a3 = a4a >> 16;
Ritor1
parents:
diff changeset
3638 return 1;
Ritor1
parents:
diff changeset
3639 }
Ritor1
parents:
diff changeset
3640
Ritor1
parents:
diff changeset
3641 //----- (00475F30) --------------------------------------------------------
Ritor1
parents:
diff changeset
3642 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
Ritor1
parents:
diff changeset
3643 {
Ritor1
parents:
diff changeset
3644 BLVFace *v9; // ebx@1
Ritor1
parents:
diff changeset
3645 int v10; // ST20_4@2
Ritor1
parents:
diff changeset
3646 int v11; // ST28_4@2
Ritor1
parents:
diff changeset
3647 int v12; // ST24_4@2
Ritor1
parents:
diff changeset
3648 char v13; // zf@2
Ritor1
parents:
diff changeset
3649 int v14; // edi@2
Ritor1
parents:
diff changeset
3650 int v15; // eax@5
Ritor1
parents:
diff changeset
3651 signed int v16; // esi@5
Ritor1
parents:
diff changeset
3652 int v17; // ST20_4@9
Ritor1
parents:
diff changeset
3653 signed __int64 v18; // qtt@10
Ritor1
parents:
diff changeset
3654 int v19; // ST14_4@11
Ritor1
parents:
diff changeset
3655 int *v21; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
3656 int v22; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3657 int v23; // [sp+1Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
3658 signed int v24; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
3659
Ritor1
parents:
diff changeset
3660 v9 = a2;
Ritor1
parents:
diff changeset
3661 v21 = a1;
Ritor1
parents:
diff changeset
3662 if ( BYTE3(a2->uAttributes) & 0x20
Ritor1
parents:
diff changeset
3663 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
3664 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
3665 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
3666 v13 = v10 + v12 + v11 == 0,
Ritor1
parents:
diff changeset
3667 v14 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
3668 v22 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
3669 v13)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
3670 || v14 > 0 && !a2->Portal())
0
Ritor1
parents:
diff changeset
3671 return 0;
Ritor1
parents:
diff changeset
3672 v15 = a4 * a2->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
3673 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z);
Ritor1
parents:
diff changeset
3674 if ( v14 <= 0 )
Ritor1
parents:
diff changeset
3675 {
Ritor1
parents:
diff changeset
3676 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 )
Ritor1
parents:
diff changeset
3677 return 0;
Ritor1
parents:
diff changeset
3678 }
Ritor1
parents:
diff changeset
3679 else
Ritor1
parents:
diff changeset
3680 {
Ritor1
parents:
diff changeset
3681 if ( v16 < 0 )
Ritor1
parents:
diff changeset
3682 return 0;
Ritor1
parents:
diff changeset
3683 }
Ritor1
parents:
diff changeset
3684 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14;
Ritor1
parents:
diff changeset
3685 if ( v17 > abs(v14)
Ritor1
parents:
diff changeset
3686 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16)
Ritor1
parents:
diff changeset
3687 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3688 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3689 !sub_4759C9(
Ritor1
parents:
diff changeset
3690 v9,
Ritor1
parents:
diff changeset
3691 a9,
Ritor1
parents:
diff changeset
3692 v19,
Ritor1
parents:
diff changeset
3693 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
3694 return 0;
Ritor1
parents:
diff changeset
3695 *v21 = v24 >> 16;
Ritor1
parents:
diff changeset
3696 return 1;
Ritor1
parents:
diff changeset
3697 }
Ritor1
parents:
diff changeset
3698
Ritor1
parents:
diff changeset
3699 //----- (004760D5) --------------------------------------------------------
Ritor1
parents:
diff changeset
3700 PartyAction ActionQueue::Next()
Ritor1
parents:
diff changeset
3701 {
Ritor1
parents:
diff changeset
3702 if (!uNumActions)
Ritor1
parents:
diff changeset
3703 return PARTY_INVALID;
Ritor1
parents:
diff changeset
3704
Ritor1
parents:
diff changeset
3705 auto result = pActions[0];
Ritor1
parents:
diff changeset
3706 for (unsigned int i = 0; i < uNumActions - 1; ++i)
Ritor1
parents:
diff changeset
3707 pActions[i] = pActions[i + 1];
Ritor1
parents:
diff changeset
3708 --uNumActions;
Ritor1
parents:
diff changeset
3709
Ritor1
parents:
diff changeset
3710 return result;
Ritor1
parents:
diff changeset
3711 }
Ritor1
parents:
diff changeset
3712
Ritor1
parents:
diff changeset
3713 //----- (004775ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
3714 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2)
Ritor1
parents:
diff changeset
3715 {
Ritor1
parents:
diff changeset
3716 char *v2; // edi@1
Ritor1
parents:
diff changeset
3717 int v3; // eax@1
Ritor1
parents:
diff changeset
3718 char *v4; // edx@2
Ritor1
parents:
diff changeset
3719 char *v5; // esi@3
Ritor1
parents:
diff changeset
3720 double v6; // st7@6
Ritor1
parents:
diff changeset
3721 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
3722 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
3723 int v9; // esi@6
Ritor1
parents:
diff changeset
3724 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
3725 int v11; // ecx@6
Ritor1
parents:
diff changeset
3726 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
3727 int v13; // ecx@6
Ritor1
parents:
diff changeset
3728 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
3729 double v15; // st7@8
Ritor1
parents:
diff changeset
3730 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
3731 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
3732 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
3733 int v19; // edi@8
Ritor1
parents:
diff changeset
3734 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
3735 int v21; // ecx@8
Ritor1
parents:
diff changeset
3736 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
3737 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
3738 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
3739 int *v25; // edi@8
Ritor1
parents:
diff changeset
3740 int v26; // esi@8
Ritor1
parents:
diff changeset
3741 int *v27; // edi@10
Ritor1
parents:
diff changeset
3742 int v28; // esi@10
Ritor1
parents:
diff changeset
3743 int result; // eax@12
Ritor1
parents:
diff changeset
3744 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
3745 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
3746 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
3747 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
3748 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
3749 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
3750 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
3751 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
3752 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
3753 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
3754 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
3755
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3756 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
3757 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3758 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
3759 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3760 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
3761 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3762 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3763 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3764 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
3765 v35 = this;
Ritor1
parents:
diff changeset
3766 if ( v3 > 0 )
Ritor1
parents:
diff changeset
3767 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3768 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3769 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
3770 v34 = v3;
Ritor1
parents:
diff changeset
3771 while ( 1 )
Ritor1
parents:
diff changeset
3772 {
Ritor1
parents:
diff changeset
3773 v5 = v4 - 15;
Ritor1
parents:
diff changeset
3774 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3775 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3776 v4 += 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3777 --v34;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3778 if ( !v34 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3779 return this->uNumVertices = v38;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3780 continue;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3781 }
0
Ritor1
parents:
diff changeset
3782 if ( *(float *)v5 <= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3783 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3784 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3785 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3786 v36 = v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3787 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3788 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3789 *(float *)&v37 = (double)v7 * v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3790 v8 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3791 v9 = (unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3792 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3793 v10 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3794 v11 = (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3795 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3796 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3797 v12 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3798 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3799 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3800 v14 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3801 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3802 //this = v35;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3803 v5 = (char *)&v30 + 4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3804 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3805 else if ( *(float *)(v4 + 1) <= (double)a2 )
0
Ritor1
parents:
diff changeset
3806 {
Ritor1
parents:
diff changeset
3807 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
3808 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3809 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
3810 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
3811 v36 = v15;
Ritor1
parents:
diff changeset
3812 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
3813 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
3814 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
3815 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3816 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3817 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
3818 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3819 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3820 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
3821 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
3822 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3823 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3824 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
3825 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3826 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
3827 v25 = v40;
Ritor1
parents:
diff changeset
3828 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3829 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3830 ++v25;
Ritor1
parents:
diff changeset
3831 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3832 v26 += 4;
Ritor1
parents:
diff changeset
3833 ++v25;
Ritor1
parents:
diff changeset
3834 ++v38;
Ritor1
parents:
diff changeset
3835 v40 += 4;
Ritor1
parents:
diff changeset
3836 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3837 v25[1] = *(int *)(v26 + 4);
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3838 v5 = (char *)&v30 + 4;
0
Ritor1
parents:
diff changeset
3839 }
Ritor1
parents:
diff changeset
3840 v27 = v40;
Ritor1
parents:
diff changeset
3841 ++v38;
Ritor1
parents:
diff changeset
3842 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3843 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3844 ++v27;
Ritor1
parents:
diff changeset
3845 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3846 v28 += 4;
Ritor1
parents:
diff changeset
3847 ++v27;
Ritor1
parents:
diff changeset
3848 v40 += 4;
Ritor1
parents:
diff changeset
3849 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3850 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
3851 v4 += 16;
Ritor1
parents:
diff changeset
3852 --v34;
Ritor1
parents:
diff changeset
3853 if ( !v34 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3854 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
3855 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3856 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3857 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
3858 }
Ritor1
parents:
diff changeset
3859
Ritor1
parents:
diff changeset
3860 //----- (00477927) --------------------------------------------------------
Ritor1
parents:
diff changeset
3861 int stru6_stru1_indoor_sw_billboard::_477927(float a2)
Ritor1
parents:
diff changeset
3862 {
Ritor1
parents:
diff changeset
3863 char *v2; // edi@1
Ritor1
parents:
diff changeset
3864 int v3; // eax@1
Ritor1
parents:
diff changeset
3865 char *v4; // edx@2
Ritor1
parents:
diff changeset
3866 char *v5; // esi@3
Ritor1
parents:
diff changeset
3867 double v6; // st7@6
Ritor1
parents:
diff changeset
3868 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
3869 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
3870 int v9; // esi@6
Ritor1
parents:
diff changeset
3871 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
3872 int v11; // ecx@6
Ritor1
parents:
diff changeset
3873 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
3874 int v13; // ecx@6
Ritor1
parents:
diff changeset
3875 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
3876 double v15; // st7@8
Ritor1
parents:
diff changeset
3877 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
3878 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
3879 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
3880 int v19; // edi@8
Ritor1
parents:
diff changeset
3881 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
3882 int v21; // ecx@8
Ritor1
parents:
diff changeset
3883 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
3884 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
3885 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
3886 int *v25; // edi@8
Ritor1
parents:
diff changeset
3887 int v26; // esi@8
Ritor1
parents:
diff changeset
3888 int *v27; // edi@10
Ritor1
parents:
diff changeset
3889 int v28; // esi@10
Ritor1
parents:
diff changeset
3890 int result; // eax@12
Ritor1
parents:
diff changeset
3891 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
3892 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
3893 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
3894 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
3895 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
3896 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
3897 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
3898 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
3899 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
3900 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
3901 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
3902
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3903 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
3904 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3905 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
3906 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3907 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
3908 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3909 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3910 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3911 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
3912 v35 = this;
Ritor1
parents:
diff changeset
3913 if ( v3 > 0 )
Ritor1
parents:
diff changeset
3914 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3915 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3916 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
3917 v34 = v3;
Ritor1
parents:
diff changeset
3918 while ( 1 )
Ritor1
parents:
diff changeset
3919 {
Ritor1
parents:
diff changeset
3920 v5 = v4 - 15;
Ritor1
parents:
diff changeset
3921 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3922 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3923 v4 += 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3924 --v34;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3925 if ( !v34 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3926 return this->uNumVertices = v38;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3927 continue;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3928 }
0
Ritor1
parents:
diff changeset
3929 if ( *(float *)v5 >= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3930 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3931 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3932 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3933 v36 = v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3934 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3935 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3936 *(float *)&v37 = (double)v7 * v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3937 v8 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3938 v9 = (unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3939 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3940 v10 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3941 v11 = (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3942 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3943 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3944 v12 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3945 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3946 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3947 v14 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3948 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3949 //this = v35;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3950 v5 = (char *)&v30 + 4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3951 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3952 else if ( *(float *)(v4 + 1) >= (double)a2 )
0
Ritor1
parents:
diff changeset
3953 {
Ritor1
parents:
diff changeset
3954 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
3955 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3956 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
3957 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
3958 v36 = v15;
Ritor1
parents:
diff changeset
3959 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
3960 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
3961 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
3962 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3963 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3964 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
3965 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3966 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3967 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
3968 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
3969 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3970 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3971 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
3972 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3973 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
3974 v25 = v40;
Ritor1
parents:
diff changeset
3975 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3976 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3977 ++v25;
Ritor1
parents:
diff changeset
3978 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3979 v26 += 4;
Ritor1
parents:
diff changeset
3980 ++v25;
Ritor1
parents:
diff changeset
3981 ++v38;
Ritor1
parents:
diff changeset
3982 v40 += 4;
Ritor1
parents:
diff changeset
3983 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3984 v25[1] = *(int *)(v26 + 4);
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3985 v5 = (char *)&v30 + 4;
0
Ritor1
parents:
diff changeset
3986 }
Ritor1
parents:
diff changeset
3987 v27 = v40;
Ritor1
parents:
diff changeset
3988 ++v38;
Ritor1
parents:
diff changeset
3989 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3990 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3991 ++v27;
Ritor1
parents:
diff changeset
3992 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3993 v28 += 4;
Ritor1
parents:
diff changeset
3994 ++v27;
Ritor1
parents:
diff changeset
3995 v40 += 4;
Ritor1
parents:
diff changeset
3996 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3997 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
3998 v4 += 16;
Ritor1
parents:
diff changeset
3999 --v34;
Ritor1
parents:
diff changeset
4000 if ( !v34 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4001 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
4002 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4003 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4004 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
4005 }
Ritor1
parents:
diff changeset
4006
Ritor1
parents:
diff changeset
4007 //----- (00477C61) --------------------------------------------------------
Ritor1
parents:
diff changeset
4008 int stru6_stru1_indoor_sw_billboard::sub_477C61()
Ritor1
parents:
diff changeset
4009 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4010 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1
0
Ritor1
parents:
diff changeset
4011 int v2; // ecx@2
Ritor1
parents:
diff changeset
4012 int v3; // eax@3
Ritor1
parents:
diff changeset
4013 double v4; // st7@4
Ritor1
parents:
diff changeset
4014 double v5; // st7@5
Ritor1
parents:
diff changeset
4015 double v6; // st6@5
Ritor1
parents:
diff changeset
4016 double v7; // st5@6
Ritor1
parents:
diff changeset
4017 float v8; // ST30_4@8
Ritor1
parents:
diff changeset
4018 float v9; // ST24_4@8
Ritor1
parents:
diff changeset
4019 double v10; // st7@8
Ritor1
parents:
diff changeset
4020 double v11; // st6@8
Ritor1
parents:
diff changeset
4021 double v12; // st5@8
Ritor1
parents:
diff changeset
4022 float v13; // ST24_4@13
Ritor1
parents:
diff changeset
4023 int v14; // esi@13
Ritor1
parents:
diff changeset
4024 char *v15; // esi@15
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
4025 //signed int v16; // eax@16
0
Ritor1
parents:
diff changeset
4026 __int16 v17; // fps@16
Ritor1
parents:
diff changeset
4027 unsigned __int8 v18; // c2@16
Ritor1
parents:
diff changeset
4028 unsigned __int8 v19; // c3@16
Ritor1
parents:
diff changeset
4029 double v20; // st6@16
Ritor1
parents:
diff changeset
4030 float v21; // ST18_4@17
Ritor1
parents:
diff changeset
4031 float v22; // ST2C_4@17
Ritor1
parents:
diff changeset
4032 float v23; // ST34_4@17
Ritor1
parents:
diff changeset
4033 float v24; // ST24_4@17
Ritor1
parents:
diff changeset
4034 double v25; // st7@17
Ritor1
parents:
diff changeset
4035 double v26; // st6@17
Ritor1
parents:
diff changeset
4036 float v27; // ST34_4@18
Ritor1
parents:
diff changeset
4037 float v28; // ST30_4@18
Ritor1
parents:
diff changeset
4038 int v29; // eax@19
Ritor1
parents:
diff changeset
4039 signed int v31; // [sp+8h] [bp-28h]@15
Ritor1
parents:
diff changeset
4040 float v32; // [sp+Ch] [bp-24h]@16
Ritor1
parents:
diff changeset
4041 float v33; // [sp+14h] [bp-1Ch]@16
Ritor1
parents:
diff changeset
4042 float v34; // [sp+18h] [bp-18h]@16
Ritor1
parents:
diff changeset
4043 float v35; // [sp+1Ch] [bp-14h]@17
Ritor1
parents:
diff changeset
4044 float v36; // [sp+20h] [bp-10h]@4
Ritor1
parents:
diff changeset
4045 float v37; // [sp+24h] [bp-Ch]@4
Ritor1
parents:
diff changeset
4046 float v38; // [sp+24h] [bp-Ch]@16
Ritor1
parents:
diff changeset
4047 float v39; // [sp+28h] [bp-8h]@9
Ritor1
parents:
diff changeset
4048 float v40; // [sp+28h] [bp-8h]@16
Ritor1
parents:
diff changeset
4049 float v41; // [sp+2Ch] [bp-4h]@6
Ritor1
parents:
diff changeset
4050 float v42; // [sp+2Ch] [bp-4h]@9
Ritor1
parents:
diff changeset
4051
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4052 //v1 = this;
0
Ritor1
parents:
diff changeset
4053 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4054 {
Ritor1
parents:
diff changeset
4055 v2 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4056 if ( this->uNumVertices > 0 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4057 {
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4058 v3 = (int)&this->field_14[1];
0
Ritor1
parents:
diff changeset
4059 do
Ritor1
parents:
diff changeset
4060 {
Ritor1
parents:
diff changeset
4061 v4 = *(float *)(v3 - 4);
Ritor1
parents:
diff changeset
4062 LODWORD(v37) = *(int *)v3;
Ritor1
parents:
diff changeset
4063 LODWORD(v36) = *(int *)(v3 + 4);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4064 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
4065 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4066 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4067 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4068 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4069 //{
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4070 v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4071 v7 = pGame->pIndoorCameraD3D->fRotationYSine * v5 - pGame->pIndoorCameraD3D->fRotationYCosine * v6;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4072 /*}
0
Ritor1
parents:
diff changeset
4073 else
Ritor1
parents:
diff changeset
4074 {
Ritor1
parents:
diff changeset
4075 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6;
Ritor1
parents:
diff changeset
4076 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4077 }*/
0
Ritor1
parents:
diff changeset
4078 v8 = v7;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4079 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4080 v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9;
0
Ritor1
parents:
diff changeset
4081 v11 = v8;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4082 v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41;
0
Ritor1
parents:
diff changeset
4083 }
Ritor1
parents:
diff changeset
4084 else
Ritor1
parents:
diff changeset
4085 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4086 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4087 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4088 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4089 //{
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4090 v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
4091 v11 = pGame->pIndoorCameraD3D->fRotationYSine * v42 - pGame->pIndoorCameraD3D->fRotationYCosine * v39;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4092 /*}
0
Ritor1
parents:
diff changeset
4093 else
Ritor1
parents:
diff changeset
4094 {
Ritor1
parents:
diff changeset
4095 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
Ritor1
parents:
diff changeset
4096 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4097 }*/
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4098 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
0
Ritor1
parents:
diff changeset
4099 }
Ritor1
parents:
diff changeset
4100 v13 = v12;
Ritor1
parents:
diff changeset
4101 ++v2;
Ritor1
parents:
diff changeset
4102 *(int *)(v3 + 84) = LODWORD(v13);
Ritor1
parents:
diff changeset
4103 v14 = *(int *)(v3 + 8);
Ritor1
parents:
diff changeset
4104 *(float *)(v3 + 76) = v10;
Ritor1
parents:
diff changeset
4105 *(int *)(v3 + 88) = v14;
Ritor1
parents:
diff changeset
4106 *(float *)(v3 + 80) = v11;
Ritor1
parents:
diff changeset
4107 v3 += 16;
Ritor1
parents:
diff changeset
4108 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4109 while ( v2 < this->uNumVertices );
0
Ritor1
parents:
diff changeset
4110 }
Ritor1
parents:
diff changeset
4111 }
Ritor1
parents:
diff changeset
4112 else
Ritor1
parents:
diff changeset
4113 {
Ritor1
parents:
diff changeset
4114 v15 = (char *)&this->field_14[1];
Ritor1
parents:
diff changeset
4115 v31 = 3;
Ritor1
parents:
diff changeset
4116 do
Ritor1
parents:
diff changeset
4117 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4118 v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4119 v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4120 v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4121 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
4122 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
0
Ritor1
parents:
diff changeset
4123 LODWORD(v38) = *(int *)v15;
Ritor1
parents:
diff changeset
4124 //UNDEF(v17);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4125 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1083
diff changeset
4126 //if ( v19 | v18 )
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4127 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0)
0
Ritor1
parents:
diff changeset
4128 {
Ritor1
parents:
diff changeset
4129 v27 = v20;
Ritor1
parents:
diff changeset
4130 LODWORD(v35) = *((int *)v15 + 1);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4131 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
0
Ritor1
parents:
diff changeset
4132 v25 = v33 * v28 + v34 * v27;
Ritor1
parents:
diff changeset
4133 v26 = v34 * v28 - v33 * v27;
Ritor1
parents:
diff changeset
4134 }
Ritor1
parents:
diff changeset
4135 else
Ritor1
parents:
diff changeset
4136 {
Ritor1
parents:
diff changeset
4137 v21 = v20;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4138 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
0
Ritor1
parents:
diff changeset
4139 v23 = v33 * v22 + v34 * v21;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4140 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
0
Ritor1
parents:
diff changeset
4141 v25 = v32 * v24 + v40 * v23;
Ritor1
parents:
diff changeset
4142 v26 = v34 * v22 - v33 * v21;
Ritor1
parents:
diff changeset
4143 v35 = v40 * v24 - v32 * v23;
Ritor1
parents:
diff changeset
4144 }
Ritor1
parents:
diff changeset
4145 *((int *)v15 + 21) = LODWORD(v35);
Ritor1
parents:
diff changeset
4146 v29 = *((int *)v15 + 2);
Ritor1
parents:
diff changeset
4147 *((float *)v15 + 19) = v25;
Ritor1
parents:
diff changeset
4148 *((int *)v15 + 22) = v29;
Ritor1
parents:
diff changeset
4149 *((float *)v15 + 20) = v26;
Ritor1
parents:
diff changeset
4150 v15 += 16;
Ritor1
parents:
diff changeset
4151 --v31;
Ritor1
parents:
diff changeset
4152 }
Ritor1
parents:
diff changeset
4153 while ( v31 );
Ritor1
parents:
diff changeset
4154 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4155 this->uNumVertices = 3;
0
Ritor1
parents:
diff changeset
4156 return 1;
Ritor1
parents:
diff changeset
4157 }
Ritor1
parents:
diff changeset
4158
Ritor1
parents:
diff changeset
4159 //----- (00477F63) --------------------------------------------------------
Ritor1
parents:
diff changeset
4160 bool stru6_stru1_indoor_sw_billboard::sub_477F63()
Ritor1
parents:
diff changeset
4161 {
Ritor1
parents:
diff changeset
4162 signed int v1; // ebx@1
Ritor1
parents:
diff changeset
4163 stru6_stru1_indoor_sw_billboard *v2; // esi@1
Ritor1
parents:
diff changeset
4164 double v3; // st7@2
Ritor1
parents:
diff changeset
4165 int v4; // edx@4
Ritor1
parents:
diff changeset
4166 char *v5; // ecx@5
Ritor1
parents:
diff changeset
4167 int v6; // edi@5
Ritor1
parents:
diff changeset
4168 float v7; // ST08_4@13
Ritor1
parents:
diff changeset
4169 signed int v9; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4170 float v10; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
4171
Ritor1
parents:
diff changeset
4172 auto a1 = this;
Ritor1
parents:
diff changeset
4173
Ritor1
parents:
diff changeset
4174 v1 = 0;
Ritor1
parents:
diff changeset
4175 v2 = a1;
Ritor1
parents:
diff changeset
4176 v9 = 0;
Ritor1
parents:
diff changeset
4177 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4178 {
Ritor1
parents:
diff changeset
4179 v10 = 16192.0;
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
4180 v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789;
0
Ritor1
parents:
diff changeset
4181 }
Ritor1
parents:
diff changeset
4182 else
Ritor1
parents:
diff changeset
4183 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4184 v10 = (double)pODMRenderParams->shading_dist_mist;
0
Ritor1
parents:
diff changeset
4185 v3 = 8.0;
Ritor1
parents:
diff changeset
4186 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4187 v4 = a1->uNumVertices;
0
Ritor1
parents:
diff changeset
4188 if ( v4 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4189 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4190 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4191 return v2->uNumVertices != 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4192 }
0
Ritor1
parents:
diff changeset
4193 v5 = (char *)&a1->field_14[20];
Ritor1
parents:
diff changeset
4194 v6 = v4;
Ritor1
parents:
diff changeset
4195 do
Ritor1
parents:
diff changeset
4196 {
Ritor1
parents:
diff changeset
4197 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 )
Ritor1
parents:
diff changeset
4198 {
Ritor1
parents:
diff changeset
4199 if ( v3 < *(float *)v5 )
Ritor1
parents:
diff changeset
4200 v9 = 1;
Ritor1
parents:
diff changeset
4201 else
Ritor1
parents:
diff changeset
4202 v1 = 1;
Ritor1
parents:
diff changeset
4203 }
Ritor1
parents:
diff changeset
4204 v5 += 16;
Ritor1
parents:
diff changeset
4205 --v6;
Ritor1
parents:
diff changeset
4206 }
Ritor1
parents:
diff changeset
4207 while ( v6 );
Ritor1
parents:
diff changeset
4208 if ( !v1 )
Ritor1
parents:
diff changeset
4209 {
Ritor1
parents:
diff changeset
4210 if ( v9 )
Ritor1
parents:
diff changeset
4211 {
Ritor1
parents:
diff changeset
4212 v2->_477927(v10);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4213 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4214 }
Ritor1
parents:
diff changeset
4215 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4216 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4217 }
Ritor1
parents:
diff changeset
4218 v7 = v3;
Ritor1
parents:
diff changeset
4219 _4775ED(v7);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4220 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4221 }
Ritor1
parents:
diff changeset
4222
Ritor1
parents:
diff changeset
4223 //----- (0047802A) --------------------------------------------------------
Ritor1
parents:
diff changeset
4224 int stru6_stru1_indoor_sw_billboard::sub_47802A()
Ritor1
parents:
diff changeset
4225 {
Ritor1
parents:
diff changeset
4226 double v6; // st7@4
Ritor1
parents:
diff changeset
4227 double v12; // st7@16
Ritor1
parents:
diff changeset
4228 signed int v16; // [sp+38h] [bp-Ch]@1
Ritor1
parents:
diff changeset
4229 int a6; // [sp+3Ch] [bp-8h]@5
Ritor1
parents:
diff changeset
4230 int a5; // [sp+40h] [bp-4h]@5
Ritor1
parents:
diff changeset
4231
Ritor1
parents:
diff changeset
4232 auto a1 = this;
Ritor1
parents:
diff changeset
4233
Ritor1
parents:
diff changeset
4234 v16 = 0;
Ritor1
parents:
diff changeset
4235 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4236 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4237 for(int i = 0; i < a1->uNumVertices; i++)
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4238 {
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
4239 v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / a1->field_B4[i*4];
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4240 if ( pRenderer->pRenderD3D )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4241 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4242 pGame->pIndoorCameraD3D->Project(
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4243 round(a1->field_B4[i*4]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4244 round(a1->field_B4[i*4+1]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4245 round(a1->field_B4[i*4+2]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4246 &a5,
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4247 &a6);
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4248 a1->field_B4[i*4+16] = (double)a5;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4249 a1->field_B4[i*4+17] = (double)a6;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4250 a1->field_B4[i*4+18] = round(a1->field_B4[i*4]);
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4251 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4252 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4253 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4254 a1->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * a1->field_B4[i*4+1];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4255 a1->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * a1->field_B4[i*4+2];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4256 a1->field_B4[i*4+18] = a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4257 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4258 a1->field_B4[i*4+19] = a1->field_B4[i*4+3];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4259 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+16]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4260 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+16]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4261 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+17]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4262 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+17] )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4263 v16 = 1;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4264 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4265 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4266 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4267 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4268 for(int i = 0; i < a1->uNumVertices; i++)
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4269 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4270 v12 = (double)pODMRenderParams->int_fov_rad / a1->field_B4[i*4];
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4271 a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4272 a1->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - v12 * a1->field_B4[i*4+2];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4273 *((int *)&a1->field_B4[i*4+22]) = (int)a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4274 *((int *)&a1->field_B4[i*4+23]) = a1->field_B4[i*4+3];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4275 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+20]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4276 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+20]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4277 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+21]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4278 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+21] )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4279 v16 = 1;
0
Ritor1
parents:
diff changeset
4280 }
Ritor1
parents:
diff changeset
4281 }
Ritor1
parents:
diff changeset
4282 return v16;
Ritor1
parents:
diff changeset
4283 }
Ritor1
parents:
diff changeset
4284
Ritor1
parents:
diff changeset
4285 //----- (0047840D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4286 char Render::DrawBuildingsD3D()
Ritor1
parents:
diff changeset
4287 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4288 //IndoorCameraD3D *v0; // eax@3
0
Ritor1
parents:
diff changeset
4289 char result; // al@3
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4290 BSPModel *v2; // ebx@4
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4291 int v3; // eax@6
0
Ritor1
parents:
diff changeset
4292 ODMFace *pFace; // esi@6
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4293 //Vec3_int_ *v5; // ecx@8
0
Ritor1
parents:
diff changeset
4294 int v6; // eax@8
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4295 struct Polygon *v7; // ebx@8
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4296 //LightmapBuilder *v8; // eax@8
0
Ritor1
parents:
diff changeset
4297 int v9; // ecx@8
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4298 //char v10; // zf@8
0
Ritor1
parents:
diff changeset
4299 Texture *pFaceTexture; // eax@10
Ritor1
parents:
diff changeset
4300 signed int v12; // ecx@10
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4301 //unsigned int v13; // eax@14
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4302 //unsigned int v14; // eax@18
0
Ritor1
parents:
diff changeset
4303 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
4304 unsigned int v16; // edi@22
Ritor1
parents:
diff changeset
4305 int v17; // eax@24
Ritor1
parents:
diff changeset
4306 int v18; // edi@34
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4307 RenderVertexSoft *v19; // eax@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4308 unsigned short *v20; // ecx@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4309 unsigned short *v20b; // ecx@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4310 unsigned short *v20c; // ecx@35
0
Ritor1
parents:
diff changeset
4311 Vec3_int_ *v21; // edx@36
Ritor1
parents:
diff changeset
4312 int v22; // edx@36
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4313 RenderVertexSoft *v23; // edi@37
0
Ritor1
parents:
diff changeset
4314 int v24; // eax@50
Ritor1
parents:
diff changeset
4315 int v25; // ecx@55
Ritor1
parents:
diff changeset
4316 int v26; // eax@57
Ritor1
parents:
diff changeset
4317 int v27; // eax@57
Ritor1
parents:
diff changeset
4318 int v28; // eax@58
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4319 //int v29; // edx@58
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4320 //double v30; // st7@59
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4321 //LightmapBuilder *v31; // edi@63
0
Ritor1
parents:
diff changeset
4322 signed int v32; // eax@73
Ritor1
parents:
diff changeset
4323 int v33; // eax@78
Ritor1
parents:
diff changeset
4324 unsigned int v34; // eax@80
Ritor1
parents:
diff changeset
4325 std::string v35; // [sp-18h] [bp-70h]@2
Ritor1
parents:
diff changeset
4326 int v36; // [sp-14h] [bp-6Ch]@69
Ritor1
parents:
diff changeset
4327 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69
Ritor1
parents:
diff changeset
4328 int v38; // [sp-Ch] [bp-64h]@69
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4329 //LightmapBuilder *v39; // [sp-8h] [bp-60h]@2
0
Ritor1
parents:
diff changeset
4330 int v40; // [sp-4h] [bp-5Ch]@2
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4331 //std::string *v41; // [sp+Ch] [bp-4Ch]@2
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4332 int v41b;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4333 int v42; // [sp+10h] [bp-48h]@6
0
Ritor1
parents:
diff changeset
4334 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8
Ritor1
parents:
diff changeset
4335 float v44; // [sp+18h] [bp-40h]@10
Ritor1
parents:
diff changeset
4336 float v45; // [sp+1Ch] [bp-3Ch]@10
Ritor1
parents:
diff changeset
4337 ODMFace *v46; // [sp+20h] [bp-38h]@6
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4338 //IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4339 //unsigned int v48; // [sp+28h] [bp-30h]@8
0
Ritor1
parents:
diff changeset
4340 int v49; // [sp+2Ch] [bp-2Ch]@10
Ritor1
parents:
diff changeset
4341 int v50; // [sp+30h] [bp-28h]@34
Ritor1
parents:
diff changeset
4342 int v51; // [sp+34h] [bp-24h]@35
Ritor1
parents:
diff changeset
4343 int v52; // [sp+38h] [bp-20h]@36
Ritor1
parents:
diff changeset
4344 int v53; // [sp+3Ch] [bp-1Ch]@8
Ritor1
parents:
diff changeset
4345 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6
Ritor1
parents:
diff changeset
4346 int a1; // [sp+44h] [bp-14h]@3
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4347 BSPModel *v56; // [sp+48h] [bp-10h]@4
0
Ritor1
parents:
diff changeset
4348 int uNumVertices; // [sp+4Ch] [bp-Ch]@34
Ritor1
parents:
diff changeset
4349 int unused; // [sp+50h] [bp-8h]@3
Ritor1
parents:
diff changeset
4350 int a3; // [sp+57h] [bp-1h]@2
Ritor1
parents:
diff changeset
4351
Ritor1
parents:
diff changeset
4352 if ( !pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4353 {
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4354 MessageBoxW(nullptr, L"D3D version of RenderBuildings called in software!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odbuild.cpp:73", 0);
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4355 }
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4356
0
Ritor1
parents:
diff changeset
4357 unused = 0;
Ritor1
parents:
diff changeset
4358 a1 = 0;
Ritor1
parents:
diff changeset
4359 result = LOBYTE(pOutdoor->pBModels);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4360 v41b = pOutdoor->uNumBModels;
0
Ritor1
parents:
diff changeset
4361 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
4362 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4363 v2 = pOutdoor->pBModels;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4364 v56 = pOutdoor->pBModels;
0
Ritor1
parents:
diff changeset
4365 while ( 1 )
Ritor1
parents:
diff changeset
4366 {
Ritor1
parents:
diff changeset
4367 if ( IsBModelVisible(a1, &unused) )
Ritor1
parents:
diff changeset
4368 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4369 v2->field_40 |= 1u;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4370 v3 = v2->uNumFaces;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4371 pFace = v2->pFaces;
0
Ritor1
parents:
diff changeset
4372 v54 = 0;
Ritor1
parents:
diff changeset
4373 v46 = pFace;
Ritor1
parents:
diff changeset
4374 v42 = v3;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4375 if ( v3 > 0 )
0
Ritor1
parents:
diff changeset
4376 break;
Ritor1
parents:
diff changeset
4377 }
Ritor1
parents:
diff changeset
4378 LABEL_86:
Ritor1
parents:
diff changeset
4379 ++a1;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4380 ++v2;// += 47;
0
Ritor1
parents:
diff changeset
4381 result = a1;
Ritor1
parents:
diff changeset
4382 v56 = v2;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4383 if ( a1 >= v41b )
0
Ritor1
parents:
diff changeset
4384 return result;
Ritor1
parents:
diff changeset
4385 }
Ritor1
parents:
diff changeset
4386 while ( 1 )
Ritor1
parents:
diff changeset
4387 {
Ritor1
parents:
diff changeset
4388 if (pFace->Invisible())
Ritor1
parents:
diff changeset
4389 goto LABEL_85;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4390 //v5 = (int)*(v2 - 1);
0
Ritor1
parents:
diff changeset
4391 v6 = pFace->pVertexIDs[0];
Ritor1
parents:
diff changeset
4392 v53 = 0;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4393 v7 = &array_77EC08[pODMRenderParams->uNumPolygons];
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4394 v7->flags = 0;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4395 v7->field_32 = 0;
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4396 pLightmapBuilder = (LightmapBuilder *)v2->pVertices.pVertices[v6].z;
0
Ritor1
parents:
diff changeset
4397 v9 = pFace->uTextureID;
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4398 if (pFace->uAttributes & FACE_TEXTURE_FRAME)
0
Ritor1
parents:
diff changeset
4399 {
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4400 v9 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed);
0
Ritor1
parents:
diff changeset
4401 }
945
0d96349d8c87 Restoring inlined methods
Nomad
parents: 940
diff changeset
4402 pFaceTexture = pBitmaps_LOD->GetTexture(v9);
0
Ritor1
parents:
diff changeset
4403 v7->pTexture = pFaceTexture;
945
0d96349d8c87 Restoring inlined methods
Nomad
parents: 940
diff changeset
4404 v12 = pFaceTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
4405 v49 = v12;
Ritor1
parents:
diff changeset
4406 v49 = pFaceTexture->uTextureHeight;
Ritor1
parents:
diff changeset
4407 v45 = 1.0 / (double)v12;
Ritor1
parents:
diff changeset
4408 v44 = 1.0 / (double)v49;
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4409 if (pFace->uAttributes & FACE_FLUID)
0
Ritor1
parents:
diff changeset
4410 *(int *)&v7->flags |= 2u;
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4411 if (pFace->uAttributes & FACE_DO_NOT_LIGHT )
0
Ritor1
parents:
diff changeset
4412 HIBYTE(v7->flags) |= 4u;
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4413 if ( pFace->uAttributes & 4 )
0
Ritor1
parents:
diff changeset
4414 {
Ritor1
parents:
diff changeset
4415 HIBYTE(v7->flags) |= 4u;
Ritor1
parents:
diff changeset
4416 }
Ritor1
parents:
diff changeset
4417 else
Ritor1
parents:
diff changeset
4418 {
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4419 if ( pFace->uAttributes & 0x20 )
0
Ritor1
parents:
diff changeset
4420 HIBYTE(v7->flags) |= 8u;
Ritor1
parents:
diff changeset
4421 }
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4422 if (pFace->uAttributes & 0x0800)
0
Ritor1
parents:
diff changeset
4423 {
Ritor1
parents:
diff changeset
4424 *(int *)&v7->flags |= 0x2000u;
Ritor1
parents:
diff changeset
4425 }
Ritor1
parents:
diff changeset
4426 else
Ritor1
parents:
diff changeset
4427 {
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4428 if (pFace->uAttributes & FACE_DONT_CACHE_TEXTURE)
0
Ritor1
parents:
diff changeset
4429 HIBYTE(v7->flags) |= 0x10u;
Ritor1
parents:
diff changeset
4430 }
Ritor1
parents:
diff changeset
4431 v15 = GetTickCount();
Ritor1
parents:
diff changeset
4432 v7->sTextureDeltaU = pFace->sTextureDeltaU;
Ritor1
parents:
diff changeset
4433 v7->sTextureDeltaV = pFace->sTextureDeltaV;
Ritor1
parents:
diff changeset
4434 v16 = v15 >> 4;
Ritor1
parents:
diff changeset
4435 if ( pFace->pFacePlane.vNormal.z && (v40 = pFace->pFacePlane.vNormal.z, abs(v40) >= 59082) )
Ritor1
parents:
diff changeset
4436 {
Ritor1
parents:
diff changeset
4437 v17 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4438 if ( BYTE1(v17) & 4 )
Ritor1
parents:
diff changeset
4439 goto LABEL_29;
Ritor1
parents:
diff changeset
4440 if ( BYTE1(v17) & 8 )
Ritor1
parents:
diff changeset
4441 {
Ritor1
parents:
diff changeset
4442 LABEL_26:
Ritor1
parents:
diff changeset
4443 v7->sTextureDeltaV -= v16 & v7->pTexture->uHeightMinus1;
Ritor1
parents:
diff changeset
4444 goto LABEL_30;
Ritor1
parents:
diff changeset
4445 }
Ritor1
parents:
diff changeset
4446 }
Ritor1
parents:
diff changeset
4447 else
Ritor1
parents:
diff changeset
4448 {
Ritor1
parents:
diff changeset
4449 v17 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4450 if ( BYTE1(v17) & 4 )
Ritor1
parents:
diff changeset
4451 goto LABEL_26;
Ritor1
parents:
diff changeset
4452 if ( BYTE1(v17) & 8 )
Ritor1
parents:
diff changeset
4453 {
Ritor1
parents:
diff changeset
4454 LABEL_29:
Ritor1
parents:
diff changeset
4455 v7->sTextureDeltaV += v16 & v7->pTexture->uHeightMinus1;
Ritor1
parents:
diff changeset
4456 goto LABEL_30;
Ritor1
parents:
diff changeset
4457 }
Ritor1
parents:
diff changeset
4458 }
Ritor1
parents:
diff changeset
4459 LABEL_30:
Ritor1
parents:
diff changeset
4460 if ( BYTE1(v17) & 0x10 )
Ritor1
parents:
diff changeset
4461 {
Ritor1
parents:
diff changeset
4462 v7->sTextureDeltaU -= v16 & v7->pTexture->uWidthMinus1;
Ritor1
parents:
diff changeset
4463 }
Ritor1
parents:
diff changeset
4464 else
Ritor1
parents:
diff changeset
4465 {
Ritor1
parents:
diff changeset
4466 if ( BYTE1(v17) & 0x20 )
Ritor1
parents:
diff changeset
4467 v7->sTextureDeltaU += v16 & v7->pTexture->uWidthMinus1;
Ritor1
parents:
diff changeset
4468 }
Ritor1
parents:
diff changeset
4469 v18 = pFace->uNumVertices;
Ritor1
parents:
diff changeset
4470 v50 = 0;
Ritor1
parents:
diff changeset
4471 v49 = 0;
Ritor1
parents:
diff changeset
4472 uNumVertices = v18;
Ritor1
parents:
diff changeset
4473 if ( v18 > 0 )
Ritor1
parents:
diff changeset
4474 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4475 //v19 = (char *)&array_73D150[0].vWorldPosition.z;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4476 //v20 = (char *)pFace->pTextureUIDs;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4477 v19 = array_73D150;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4478 v20 = pFace->pTextureUIDs;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4479 v20b = pFace->pVertexIDs;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4480 v20c = pFace->pTextureVIDs;
0
Ritor1
parents:
diff changeset
4481 v51 = v18;
Ritor1
parents:
diff changeset
4482 do
Ritor1
parents:
diff changeset
4483 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4484 /* v21 = &(*(v56 - 1))[*((short *)v20 - 20)];
0
Ritor1
parents:
diff changeset
4485 *((float *)v19 - 2) = (double)v21->x;
Ritor1
parents:
diff changeset
4486 *((float *)v19 - 1) = (double)v21->y;
Ritor1
parents:
diff changeset
4487 *(float *)v19 = (double)v21->z;
Ritor1
parents:
diff changeset
4488 v19 += 48;
Ritor1
parents:
diff changeset
4489 v52 = v7->sTextureDeltaU + *(short *)v20;
Ritor1
parents:
diff changeset
4490 *((float *)v19 - 5) = (double)v52 * v45;
Ritor1
parents:
diff changeset
4491 v22 = v7->sTextureDeltaV + *((short *)v20 + 20);
Ritor1
parents:
diff changeset
4492 v20 += 2;
Ritor1
parents:
diff changeset
4493 v10 = v51-- == 1;
Ritor1
parents:
diff changeset
4494 v52 = v22;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4495 *((float *)v19 - 4) = (double)v22 * v44;*/
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4496
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4497 //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20));
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4498 v21 = &v56->pVertices.pVertices[*v20b];
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4499 //*((float *)v19 - 2) = (double)v21->x;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4500 //*((float *)v19 - 1) = (double)v21->y;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4501 v19->vWorldPosition.x = (double)v21->x;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4502 v19->vWorldPosition.y = (double)v21->y;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4503 v19->vWorldPosition.z = (double)v21->z;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4504 ++v19;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4505 v52 = v7->sTextureDeltaU + (signed __int16)*v20;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4506 //*((float *)v19 - 5) = (double)v52 * v45;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4507 (v19-1)->u = (double)v52 * v45;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4508 v22 = v7->sTextureDeltaV + (signed __int16)*v20c;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4509 ++v20;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4510 ++v20b;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4511 ++v20c;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4512 v52 = v22;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4513 //*((float *)v19 - 4) = (double)v22 * v44;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4514 (v19-1)->v = (double)v22 * v44;
0
Ritor1
parents:
diff changeset
4515 }
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4516 while ( !(v51-- == 1) );
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4517 //v23 = (char *)&array_73D150[0].vWorldViewPosition;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4518 v23 = array_73D150;
0
Ritor1
parents:
diff changeset
4519 v51 = uNumVertices;
Ritor1
parents:
diff changeset
4520 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder;
Ritor1
parents:
diff changeset
4521 do
Ritor1
parents:
diff changeset
4522 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4523 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) )
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4524 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z )
0
Ritor1
parents:
diff changeset
4525 ++v53;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4526 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u);
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4527 pGame->pIndoorCameraD3D->ViewTransform(v23, 1u);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4528 if ( v23->vWorldViewPosition.x < 8.0 || (double)pODMRenderParams->shading_dist_mist < v23->vWorldViewPosition.x )
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4529 {
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4530 if ( v23->vWorldViewPosition.x >= 8.0 )
0
Ritor1
parents:
diff changeset
4531 v49 = 1;
Ritor1
parents:
diff changeset
4532 else
Ritor1
parents:
diff changeset
4533 v50 = 1;
Ritor1
parents:
diff changeset
4534 }
Ritor1
parents:
diff changeset
4535 else
Ritor1
parents:
diff changeset
4536 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4537 pGame->pIndoorCameraD3D->Project(v23, 1u, 0);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4538 }
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4539 ++v23;// += 48;
0
Ritor1
parents:
diff changeset
4540 --v51;
Ritor1
parents:
diff changeset
4541 }
Ritor1
parents:
diff changeset
4542 while ( v51 );
Ritor1
parents:
diff changeset
4543 v18 = uNumVertices;
Ritor1
parents:
diff changeset
4544 }
Ritor1
parents:
diff changeset
4545 if ( v53 == v18 )
Ritor1
parents:
diff changeset
4546 LOBYTE(v7->field_32) |= 1u;
Ritor1
parents:
diff changeset
4547 v24 = pOutdoor->vSunlight.x;
Ritor1
parents:
diff changeset
4548 v7->pODMFace = pFace;
Ritor1
parents:
diff changeset
4549 v7->uNumVertices = v18;
Ritor1
parents:
diff changeset
4550 v7->field_59 = 5;
Ritor1
parents:
diff changeset
4551 pLightmapBuilder = (LightmapBuilder *)-v24;
Ritor1
parents:
diff changeset
4552 v51 = pFace->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4553 v51 = (unsigned __int64)(-v24 * (signed __int64)v51) >> 16;
Ritor1
parents:
diff changeset
4554 v53 = pFace->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4555 pLightmapBuilder = (LightmapBuilder *)-pOutdoor->vSunlight.y;
Ritor1
parents:
diff changeset
4556 v53 = (unsigned __int64)(-pOutdoor->vSunlight.y * (signed __int64)v53) >> 16;
Ritor1
parents:
diff changeset
4557 v52 = pFace->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
4558 v52 = (unsigned __int64)(-pOutdoor->vSunlight.z * (signed __int64)v52) >> 16;
Ritor1
parents:
diff changeset
4559 pLightmapBuilder = (LightmapBuilder *)(v51 + v53 + v52);
Ritor1
parents:
diff changeset
4560 v51 = 20 * (int)pLightmapBuilder;
Ritor1
parents:
diff changeset
4561 result = 20 - (20 * (signed int)pLightmapBuilder >> 16);
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4562 v7->dimming_level = result;
0
Ritor1
parents:
diff changeset
4563 if ( result < 0 )
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4564 v7->dimming_level = 0;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4565 if ( v7->dimming_level > 31 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4566 v7->dimming_level = 31;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4567 if ( pODMRenderParams->uNumPolygons >= 1999 + 5000)
0
Ritor1
parents:
diff changeset
4568 return result;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4569 ++pODMRenderParams->uNumPolygons;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4570 ++pODMRenderParams->field_44;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4571 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) )
0
Ritor1
parents:
diff changeset
4572 {
Ritor1
parents:
diff changeset
4573 LOBYTE(v25) = (char)v54;
Ritor1
parents:
diff changeset
4574 v26 = a1;
Ritor1
parents:
diff changeset
4575 pFace->bVisible = 1;
Ritor1
parents:
diff changeset
4576 v7->uBModelFaceID = v25;
Ritor1
parents:
diff changeset
4577 LOWORD(v25) = (unsigned __int8)v25;
Ritor1
parents:
diff changeset
4578 v7->uBModelID = v26;
Ritor1
parents:
diff changeset
4579 v27 = 8 * (v25 | (v26 << 6));
Ritor1
parents:
diff changeset
4580 LOBYTE(v27) = v27 | 6;
Ritor1
parents:
diff changeset
4581 v7->field_50 = v27;
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4582
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4583 for (v28 = 0; v28 < v18; ++v28)
0
Ritor1
parents:
diff changeset
4584 {
Ritor1
parents:
diff changeset
4585 memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28]));
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4586 array_50AC10[v28]._rhw = 1.0 / (array_73D150[v28].vWorldViewPosition.x + 0.0000001);
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4587
0
Ritor1
parents:
diff changeset
4588 pFace = v46;
Ritor1
parents:
diff changeset
4589 }
Ritor1
parents:
diff changeset
4590
Ritor1
parents:
diff changeset
4591 static stru154 static_RenderBuildingsD3D_stru_73C834;
Ritor1
parents:
diff changeset
4592 /*static bool __init_flag = false;
Ritor1
parents:
diff changeset
4593 if (!__init_flag)
Ritor1
parents:
diff changeset
4594 {
Ritor1
parents:
diff changeset
4595 __init_flag = true;
Ritor1
parents:
diff changeset
4596
Ritor1
parents:
diff changeset
4597 static_RenderBuildingsD3D_byte_73C84C_init_flag |= 1u;
Ritor1
parents:
diff changeset
4598 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834);
Ritor1
parents:
diff changeset
4599 atexit(loc_4789D4);
Ritor1
parents:
diff changeset
4600 }*/
Ritor1
parents:
diff changeset
4601
Ritor1
parents:
diff changeset
4602 v40 = (int)pFace;
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4603 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(pFace);
0
Ritor1
parents:
diff changeset
4604 pDecalBuilder->ApplyDecals_OutdoorFace(pFace);
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4605 pGame->pLightmapBuilder->std__vector_000004_size = 0;
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4606
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4607 int v31 = 0;
0
Ritor1
parents:
diff changeset
4608 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
Ritor1
parents:
diff changeset
4609 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4610 v31 = v50 ? 3 : v49 != 0 ? 5 : 0;
866
7bd9beae3b8d GameUI_WritePointedObjectStatusString crash fixed
zipi
parents: 865
diff changeset
4611 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices);
0
Ritor1
parents:
diff changeset
4612 if ( pDecalBuilder->uNumDecals > 0 )
Ritor1
parents:
diff changeset
4613 {
Ritor1
parents:
diff changeset
4614 v40 = -1;
Ritor1
parents:
diff changeset
4615 v38 = 0;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4616 v37 = array_50AC10;
0
Ritor1
parents:
diff changeset
4617 v36 = uNumVertices;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4618 pDecalBuilder->ApplyDecals(31 - v7->dimming_level,
0
Ritor1
parents:
diff changeset
4619 2,
Ritor1
parents:
diff changeset
4620 &static_RenderBuildingsD3D_stru_73C834,
Ritor1
parents:
diff changeset
4621 uNumVertices,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4622 array_50AC10,
0
Ritor1
parents:
diff changeset
4623 0,
Ritor1
parents:
diff changeset
4624 (char)v31,
Ritor1
parents:
diff changeset
4625 -1);
Ritor1
parents:
diff changeset
4626 }
Ritor1
parents:
diff changeset
4627 }
Ritor1
parents:
diff changeset
4628 if ( stru_F8AD28.uNumLightsApplied > 0 )
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4629 pGame->pLightmapBuilder->ApplyLights(
0
Ritor1
parents:
diff changeset
4630 &stru_F8AD28,
Ritor1
parents:
diff changeset
4631 &static_RenderBuildingsD3D_stru_73C834,
Ritor1
parents:
diff changeset
4632 uNumVertices,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4633 array_50AC10,
0
Ritor1
parents:
diff changeset
4634 0,
Ritor1
parents:
diff changeset
4635 (char)v31);
Ritor1
parents:
diff changeset
4636 if ( v50 )
Ritor1
parents:
diff changeset
4637 {
Ritor1
parents:
diff changeset
4638 v32 = sr_424CD7(uNumVertices);
Ritor1
parents:
diff changeset
4639 goto LABEL_76;
Ritor1
parents:
diff changeset
4640 }
Ritor1
parents:
diff changeset
4641 if ( v49 )
Ritor1
parents:
diff changeset
4642 {
Ritor1
parents:
diff changeset
4643 v32 = sr_424EE0_MakeFanFromTriangle(uNumVertices);
Ritor1
parents:
diff changeset
4644 LABEL_76:
Ritor1
parents:
diff changeset
4645 v7->uNumVertices = v32;
Ritor1
parents:
diff changeset
4646 uNumVertices = v32;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4647 ODM_Project(v32);
0
Ritor1
parents:
diff changeset
4648 }
Ritor1
parents:
diff changeset
4649 if ( uNumVertices )
Ritor1
parents:
diff changeset
4650 {
Ritor1
parents:
diff changeset
4651 v33 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4652 if ( v33 & 2 )
Ritor1
parents:
diff changeset
4653 {
Ritor1
parents:
diff changeset
4654 if ( BYTE1(v33) & 0x3C )
Ritor1
parents:
diff changeset
4655 v34 = pRenderer->pHDWaterBitmapIDs[0];
Ritor1
parents:
diff changeset
4656 else
265
96bc024a5fed Render overflows
Nomad
parents: 257
diff changeset
4657 v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
0
Ritor1
parents:
diff changeset
4658 v40 = (int)pBitmaps_LOD->pHardwareTextures[v34];
Ritor1
parents:
diff changeset
4659 }
Ritor1
parents:
diff changeset
4660 else
Ritor1
parents:
diff changeset
4661 {
1632
69ab7593e7af Out of bounds (id 65536) texture fixed.
Nomad
parents: 1583
diff changeset
4662 v40 = (int)pBitmaps_LOD->pHardwareTextures[v9];
0
Ritor1
parents:
diff changeset
4663 }
Ritor1
parents:
diff changeset
4664 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40);
Ritor1
parents:
diff changeset
4665 }
Ritor1
parents:
diff changeset
4666 goto LABEL_85;
Ritor1
parents:
diff changeset
4667 }
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4668 --pODMRenderParams->uNumPolygons;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4669 --pODMRenderParams->field_44;
0
Ritor1
parents:
diff changeset
4670 LABEL_85:
Ritor1
parents:
diff changeset
4671 v54 = (Vec3_int_ *)((char *)v54 + 1);
Ritor1
parents:
diff changeset
4672 v2 = v56;
Ritor1
parents:
diff changeset
4673 ++pFace;
Ritor1
parents:
diff changeset
4674 v46 = pFace;
Ritor1
parents:
diff changeset
4675 if ( (signed int)v54 >= (signed int)v42 )
Ritor1
parents:
diff changeset
4676 goto LABEL_86;
Ritor1
parents:
diff changeset
4677 }
Ritor1
parents:
diff changeset
4678 }
Ritor1
parents:
diff changeset
4679 return result;
Ritor1
parents:
diff changeset
4680 }
Ritor1
parents:
diff changeset
4681 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag;
Ritor1
parents:
diff changeset
4682
Ritor1
parents:
diff changeset
4683
Ritor1
parents:
diff changeset
4684 //----- (00479089) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4685 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable)
0
Ritor1
parents:
diff changeset
4686 {
Ritor1
parents:
diff changeset
4687 BSPModel *v2; // eax@1
Ritor1
parents:
diff changeset
4688 int v3; // edi@1
Ritor1
parents:
diff changeset
4689 int v4; // ebx@1
Ritor1
parents:
diff changeset
4690 int v5; // ST28_4@1
Ritor1
parents:
diff changeset
4691 int v6; // ecx@1
Ritor1
parents:
diff changeset
4692 int v7; // ebx@3
Ritor1
parents:
diff changeset
4693 int v8; // eax@3
Ritor1
parents:
diff changeset
4694 int v9; // eax@3
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4695 //int v10; // ebx@3
0
Ritor1
parents:
diff changeset
4696 signed int v11; // esi@6
Ritor1
parents:
diff changeset
4697 int v12; // esi@8
Ritor1
parents:
diff changeset
4698 bool result; // eax@9
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4699 //unsigned int v14; // [sp+Ch] [bp-20h]@1
0
Ritor1
parents:
diff changeset
4700 int v15; // [sp+Ch] [bp-20h]@5
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4701 //int *v16; // [sp+10h] [bp-1Ch]@1
0
Ritor1
parents:
diff changeset
4702 int v17; // [sp+1Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
4703 int v18; // [sp+20h] [bp-Ch]@1
Ritor1
parents:
diff changeset
4704 int v19; // [sp+20h] [bp-Ch]@3
Ritor1
parents:
diff changeset
4705 int angle; // [sp+24h] [bp-8h]@1
Ritor1
parents:
diff changeset
4706 int v21; // [sp+28h] [bp-4h]@1
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4707 //int v22; // [sp+28h] [bp-4h]@3
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4708
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4709 //v16 = unused;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4710 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4711 //v14 = uModelID;
0
Ritor1
parents:
diff changeset
4712 v2 = &pOutdoor->pBModels[uModelID];
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4713 v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4714 v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4715 v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4716 v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4717 v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4718 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
0
Ritor1
parents:
diff changeset
4719 v6 = v5;
Ritor1
parents:
diff changeset
4720 v17 = v3 * v5 + v4 * v21;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
4721 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
4722 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16;
Ritor1
parents:
diff changeset
4723 v19 = v4 * v6 - v3 * v21;
Ritor1
parents:
diff changeset
4724 v7 = abs(v4);
Ritor1
parents:
diff changeset
4725 v8 = abs(v3);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 317
diff changeset
4726 v9 = int_get_vector_length(v8, v7, 0);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4727 //v10 = v14 * 188;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4728 //v22 = v9;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4729 *reachable = false;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4730 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 )
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4731 *reachable = true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4732 v15 = stru_5C6E00->Sin(angle);
0
Ritor1
parents:
diff changeset
4733 if ( v19 >= 0 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4734 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4735 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4736 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16);
0
Ritor1
parents:
diff changeset
4737 v12 = v11 >> 16;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4738 if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 )
0
Ritor1
parents:
diff changeset
4739 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4740 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4741 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 )
0
Ritor1
parents:
diff changeset
4742 {
Ritor1
parents:
diff changeset
4743 result = v12 < 0;
Ritor1
parents:
diff changeset
4744 LOBYTE(result) = v12 >= 0;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4745 return result;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4746 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4747 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4748 return true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4749 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4750 return false;
0
Ritor1
parents:
diff changeset
4751 }
Ritor1
parents:
diff changeset
4752
Ritor1
parents:
diff changeset
4753 //----- (00479295) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4754 int Polygon::_479295()
0
Ritor1
parents:
diff changeset
4755 {
Ritor1
parents:
diff changeset
4756 ODMFace *v2; // esi@1
Ritor1
parents:
diff changeset
4757 int v3; // ecx@4
Ritor1
parents:
diff changeset
4758 int v4; // eax@4
Ritor1
parents:
diff changeset
4759 int v5; // edx@4
Ritor1
parents:
diff changeset
4760 int v6; // ST14_4@5
Ritor1
parents:
diff changeset
4761 int v7; // ST04_4@5
Ritor1
parents:
diff changeset
4762 stru149 *v8; // ecx@5
Ritor1
parents:
diff changeset
4763 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8
Ritor1
parents:
diff changeset
4764 int v11; // [sp+18h] [bp-4h]@4
Ritor1
parents:
diff changeset
4765
Ritor1
parents:
diff changeset
4766 v2 = this->pODMFace;
Ritor1
parents:
diff changeset
4767 if ( !v2->pFacePlane.vNormal.z )
Ritor1
parents:
diff changeset
4768 {
Ritor1
parents:
diff changeset
4769 v3 = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4770 v4 = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4771 v5 = 0;
Ritor1
parents:
diff changeset
4772 v11 = 65536;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4773 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4774 else if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 )
0
Ritor1
parents:
diff changeset
4775 {
Ritor1
parents:
diff changeset
4776 thisa.x = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4777 thisa.y = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4778 thisa.z = 0;
Ritor1
parents:
diff changeset
4779 thisa.Normalize_float();
Ritor1
parents:
diff changeset
4780 v4 = thisa.x;
Ritor1
parents:
diff changeset
4781 v3 = thisa.y;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4782 v5 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4783 v11 = 65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4784 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4785 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4786 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4787 v3 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4788 v4 = 65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4789 v11 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4790 v5 = -65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
4791 }
0
Ritor1
parents:
diff changeset
4792 v6 = v11;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4793 sTextureDeltaU = v2->sTextureDeltaU;
0
Ritor1
parents:
diff changeset
4794 v7 = v3;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4795 v8 = ptr_38;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4796 sTextureDeltaV = v2->sTextureDeltaV;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
4797 v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6);
0
Ritor1
parents:
diff changeset
4798 return 1;
Ritor1
parents:
diff changeset
4799 }
Ritor1
parents:
diff changeset
4800
Ritor1
parents:
diff changeset
4801
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4802 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4803 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4804 #pragma pack(push, 1)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4805 struct TGAHeader
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4806 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4807 unsigned char tgaSkip;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4808 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4809 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4810
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4811 short colourmapstart; // first colour map entry in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4812 short colourmaplength; // number of colours in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4813 char colourmapbits; // number of bits per palette entry 15,16,24,32
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4814
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4815 //unsigned char tgaDontCare2[9];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4816 short xstart; // image x origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4817 short ystart; // image y origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4818
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4819 unsigned short tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4820 unsigned short tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4821 unsigned char tgaBPP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4822
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4823 char descriptor; // image descriptor bits: 00vhaaaa
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4824 // h horizontal flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4825 // v vertical flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4826 // a alpha bits
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4827 };
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4828 #pragma pack(pop)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4829
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4830 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4831 *out_width = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4832 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4833 *out_height = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4834
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4835 DWORD w;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4836 auto file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4837 if (file == INVALID_HANDLE_VALUE)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4838 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4839
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4840 TGAHeader header;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4841 ReadFile(file, &header, sizeof(header), &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4842 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4843
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4844 if (header.tgaBPP != 24 || header.tgaType != 2)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4845 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4846 CloseHandle(file);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4847 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4848 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4849
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4850 int imgSize = header.tgaWidth * header.tgaHeight * 3;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4851 auto pixels = new unsigned char[imgSize];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4852 ReadFile(file, pixels, imgSize, &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4853 CloseHandle(file);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4854
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4855 if (w != imgSize)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4856 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4857 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4858 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4859 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4860
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4861 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4862 *out_width = header.tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4863 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4864 *out_height = header.tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4865
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4866 auto pixels_16bit = new unsigned short[imgSize / 3];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4867 for (int i = 0; i < imgSize / 3; ++i)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4868 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4869 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4870 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4871 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4872 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4873 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4874 return pixels_16bit;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4875 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4876
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4877 unsigned short *skybox_xn, *skybox_xp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4878 *skybox_yn, *skybox_yp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4879 *skybox_zn, *skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4880 int skybox_width, skybox_height;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4881
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4882 IDirect3DTexture2 *skybox_texture;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4883 IDirectDrawSurface4 *skybox_surface;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4884
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4885 bool Skybox_Initialize(const wchar_t *skybox_name)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4886 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4887 wchar_t xn_filename[1024], xp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4888 yn_filename[1024], yp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4889 zn_filename[1024], zp_filename[1024];
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4890 swprintf(xn_filename, wcslen(L"%s_xn.tga"), L"%s_xn.tga", skybox_name); swprintf(xp_filename, wcslen(L"%s_xp.tga"), L"%s_xp.tga", skybox_name);
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4891 swprintf(yn_filename, wcslen(L"%s_yn.tga"), L"%s_yn.tga", skybox_name); swprintf(yp_filename, wcslen(L"%s_yp.tga"), L"%s_yp.tga", skybox_name);
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4892 swprintf(zn_filename, wcslen(L"%s_zn.tga"), L"%s_zn.tga", skybox_name); swprintf(zp_filename, wcslen(L"%s_zp.tga"), L"%s_zp.tga", skybox_name);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4893
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4894 int xn_width, xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4895 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4896 if (!skybox_xn)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4897 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4898
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4899 int xp_width, xp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4900 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4901 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4902 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4903 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4904 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4905 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4906 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4907
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4908 int yn_width, yn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4909 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4910 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4911 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4912 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4913 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4914 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4915 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4916 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4917
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4918 int yp_width, yp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4919 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4920 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4921 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4922 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4923 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4924 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4925 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4926 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4927 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4928
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4929 int zn_width, zn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4930 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4931 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4932 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4933 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4934 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4935 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4936 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4937 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4938 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4939 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4940
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4941 int zp_width, zp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4942 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4943 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4944 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4945 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4946 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4947 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4948 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4949 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4950 if (skybox_zp) delete [] skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4951 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4952 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4953
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4954 skybox_width = xn_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4955 skybox_height = xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4956
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4957
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4958 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4959 false, false, pRenderer->uMinDeviceTextureDim))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4960 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4961
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4962 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4963 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4964
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4965 struct vector
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4966 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4967 float x, y, z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4968 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4969
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4970 struct matrix
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4971 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4972 float m[4][4];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4973 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4974
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4975 void VectorNormalize(vector *v)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4976 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4977 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4978 v->x *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4979 v->y *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4980 v->z *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4981 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4982
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4983 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4984 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4985 memset(pout, 0, sizeof(matrix));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4986 pout->m[3][0] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4987 pout->m[3][1] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4988 pout->m[3][2] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4989 pout->m[3][3] = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4990
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4991 vector v;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4992 v.x = pv->x; v.y = pv->y; v.z = pv->z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4993 VectorNormalize(&v);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4994
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4995 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4996 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4997 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4998 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4999 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5000 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5001 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5002 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5003 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5004 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5005
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5006 void VectorTransform(const matrix *m, const vector *v, vector *out)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5007 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5008 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5009 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5010 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5011 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5012
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5013 bool DrawSkyD3D_Skybox()
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5014 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5015 static bool initialized = false,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5016 initialization_failed = false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5017 if (initialization_failed)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5018 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5019
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5020 static int last_camera_rot_y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5021 last_camera_rot_x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5022 if (!initialized)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5023 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5024 if (!Skybox_Initialize(L"data/skybox/stars"))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5025 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5026 initialization_failed = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5027 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5028 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5029 initialized = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5030
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5031 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5032 last_camera_rot_x = pParty->sRotationX + 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5033 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5034
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5035 /*
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5036 r(y) =
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5037 cos y 0 sin y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5038 0 1 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5039 -sin y 0 cos y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5040 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5041
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5042 x cos y - z sin y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5043 y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5044 x sin y + z cos y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5045 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5046
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5047
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5048
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5049 r(x) = // should be r(right) actually
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5050 1 0 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5051 0 cos x -sin x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5052 0 sin x cos x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5053 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5054
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5055
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5056 x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5057 y cos x + z sin x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5058 -y sin x + z cos x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5059 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5060
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5061 */
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5062
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5063 if (last_camera_rot_y == pParty->sRotationY &&
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5064 last_camera_rot_x == pParty->sRotationX)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5065 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5066 draw:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5067 struct RenderVertexD3D3 v[6];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5068
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5069 v[0].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5070 v[0].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5071 v[0].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5072 v[0].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5073 v[0].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5074 v[0].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5075 v[0].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5076 v[0].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5077
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5078 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5079 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5080 v[1].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5081 v[1].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5082 v[1].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5083 v[1].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5084 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5085 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5086
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5087 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5088 v[2].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5089 v[2].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5090 v[2].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5091 v[2].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5092 v[2].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5093 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5094 v[2].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5095
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5096 memcpy(&v[3], &v[0], sizeof(*v));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5097
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5098 v[4].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5099 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5100 v[4].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5101 v[4].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5102 v[4].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5103 v[4].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5104 v[4].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5105 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5106
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5107 memcpy(&v[5], &v[1], sizeof(*v));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5108
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5109 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5110 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5111 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5112 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5113
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5114 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5115 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5116
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5117
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5118 DDSURFACEDESC2 desc;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5119 desc.dwSize = sizeof(desc);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5120 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5121 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5122
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5123 last_camera_rot_y = pParty->sRotationY;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5124 last_camera_rot_x = pParty->sRotationX;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5125
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5126 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5127 float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5128 float fov_y = fov_x / aspect;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5129
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5130 float ray_dx = fov_x / (float)pViewport->uScreenWidth,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5131 ray_dy = fov_y / (float)pViewport->uScreenHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5132 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5133 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5134 for (int y = 0; y < pViewport->uScreenHeight; ++y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5135 for (int x = 0; x < pViewport->uScreenWidth; ++x)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5136 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5137 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5138 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5139
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5140 float _dir_x_ = 1,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5141 _dir_y_ = 0,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5142 _dir_z_ = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5143
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5144 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5145 //float dir_y_ = _dir_y_;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5146 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5147
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5148 //float dir_x = dir_x_; // rotation around x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5149 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5150 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5151
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5152 vector right; // rotate around right actually to avoid space distortion
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5153 right.x = /*dir_y * 0*/ - dir_z_ * 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5154 right.y = /*dir_z_ * 0 - dir_x_ * */0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5155 right.z = dir_x_ * 1/* - dir_y_ * 0*/;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5156 //VectorNormalize(&right);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5157
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5158 matrix rightMatrix;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5159 MatrixRotationAxis(&rightMatrix, &right, angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5160
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5161 vector v1, v2;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5162 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5163 VectorTransform(&rightMatrix, &v1, &v2);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5164
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5165 float dir_x = v2.x,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5166 dir_y = v2.y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5167 dir_z = v2.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5169 float abs_dir_x = fabsf(dir_x),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5170 abs_dir_y = fabsf(dir_y),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5171 abs_dir_z = fabsf(dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5172
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5173 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5174 if (abs_dir_x >= abs_dir_y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5175 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5176 if (abs_dir_x >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5177 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5178 if (dir_x >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5179 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5180 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5181 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5182
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5183 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5184 v = 1.0f - (instersect_y + 0.5f);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5185
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5186 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5187 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5188
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5189 color = skybox_xp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5190 //color = ty * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5191 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5192 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5193 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5194 float instersect_y = dir_y / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5195 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5196
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5197 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5198 v = instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5199
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5200 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5201 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5202
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5203 color = skybox_xn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5204 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5205 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5206 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5207 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5208 goto DIR_ZP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5209 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5210 goto DIR_ZN;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5211 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5212 else if (abs_dir_y >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5213 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5214 if (dir_y >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5215 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5216 float instersect_x = dir_x / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5217 float instersect_z = dir_z / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5218
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5219 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5220 v = instersect_z + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5221
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5222 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5223 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5224
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5225 color = skybox_yp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5226 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5227 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5228 /*else should never be seen i guess
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5229 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5230 __debugbreak();
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5231 // -y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5232 //Log::Warning(L"(%03u, %03u): -y", x, y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5233 }*/
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5234 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5235 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5236 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5237 DIR_ZP:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5238 // +z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5239 float instersect_x = dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5240 float instersect_y = dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5241 //float intersect_z = 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5242
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5243 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5244 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5245
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5246 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5247 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5248
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5249 color = skybox_zp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5250 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5251 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5252 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5253 DIR_ZN:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5254 // -z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5255 float instersect_x = -dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5256 float instersect_y = -dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5257 //float intersect_z = -0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5258
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5259 float u = 1.0f - instersect_x - 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5260 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5261
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5262 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5263 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5264
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5265 color = skybox_zn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5266 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5267
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5268 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5269 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5270 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5271
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5272 ErrD3D((skybox_surface)->Unlock(0));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5273 goto draw;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5274 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5275
0
Ritor1
parents:
diff changeset
5276 //----- (00479543) --------------------------------------------------------
Ritor1
parents:
diff changeset
5277 void Render::DrawSkyD3D()
Ritor1
parents:
diff changeset
5278 {
Ritor1
parents:
diff changeset
5279 int v0; // esi@2
Ritor1
parents:
diff changeset
5280 int v1; // eax@2
Ritor1
parents:
diff changeset
5281 int v8; // eax@4
Ritor1
parents:
diff changeset
5282 int v9; // eax@4
Ritor1
parents:
diff changeset
5283 int v10; // ebx@4
Ritor1
parents:
diff changeset
5284 signed __int64 v11; // qax@6
Ritor1
parents:
diff changeset
5285 int v13; // edi@6
Ritor1
parents:
diff changeset
5286 int v14; // ecx@6
Ritor1
parents:
diff changeset
5287 int v16; // eax@12
1427
Ritor1
parents: 1424
diff changeset
5288 //signed __int64 v17; // qtt@13
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5289 signed int pShading; // ecx@13
1427
Ritor1
parents: 1424
diff changeset
5290 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
0
Ritor1
parents:
diff changeset
5291 float v28; // [sp+12Ch] [bp-38h]@2
Ritor1
parents:
diff changeset
5292 int v29; // [sp+130h] [bp-34h]@4
Ritor1
parents:
diff changeset
5293 int v30; // [sp+134h] [bp-30h]@1
Ritor1
parents:
diff changeset
5294 int v32; // [sp+13Ch] [bp-28h]@6
Ritor1
parents:
diff changeset
5295 int v33; // [sp+140h] [bp-24h]@2
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5296 int v34; // [sp+144h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
5297 int v35; // [sp+148h] [bp-1Ch]@4
1427
Ritor1
parents: 1424
diff changeset
5298 int screen_center_x; // [sp+14Ch] [bp-18h]@2
0
Ritor1
parents:
diff changeset
5299 int v37; // [sp+154h] [bp-10h]@8
Ritor1
parents:
diff changeset
5300 int v38; // [sp+158h] [bp-Ch]@1
Ritor1
parents:
diff changeset
5301 int v39; // [sp+15Ch] [bp-8h]@4
1427
Ritor1
parents: 1424
diff changeset
5302 //int v40; // [sp+160h] [bp-4h]@7
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5303
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5304 extern bool new_sky;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5305 if (new_sky)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5306 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5307 if (DrawSkyD3D_Skybox())
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5308 return;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5309 }
0
Ritor1
parents:
diff changeset
5310
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5311 v30 = ((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5312 / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 èçìåíÿåòñÿ ïðè ïîäú¸ìå íà âûñîòó
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5313 v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad /
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5314 (pODMRenderParams->shading_dist_mist * cos(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5315 (pODMRenderParams->shading_dist_mist * -sin(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) - pGame->pIndoorCameraD3D->vPartyPos.z);//61 / 184 / 310 èçìåíÿåòñÿ ïðè íàêëîíå êàìåðû
1427
Ritor1
parents: 1424
diff changeset
5316
Ritor1
parents: 1424
diff changeset
5317 pSkyPolygon.Create_48607B(&stru_8019C8);
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
5318 pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(âîçìîæíî ñîçäàíèå êóïîëà íåáà)
1427
Ritor1
parents: 1424
diff changeset
5319 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//íîìåð òåêñòóðû
Ritor1
parents: 1424
diff changeset
5320 pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//òåêñòóðà íåáà
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5321 if (pOutdoor->uSky_TextureID == -1)
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5322 return;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5323
1427
Ritor1
parents: 1424
diff changeset
5324 pSkyPolygon.dimming_level = 0;//çàòåìíåíèå
Ritor1
parents: 1424
diff changeset
5325 pSkyPolygon.uNumVertices = 4;//êîëè÷åñòâî âåðøèí
Ritor1
parents: 1424
diff changeset
5326
Ritor1
parents: 1424
diff changeset
5327 //centering(öåíòðóåì)--íàêëîí êàìåðû ----------------------------------------//
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5328 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216, ââåðõ: -28020, âíèç: 22078
1427
Ritor1
parents: 1424
diff changeset
5329 pSkyPolygon.v_18.y = 0;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5330 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457, ââåðõ: -59244, âíèç: -61705
1427
Ritor1
parents: 1424
diff changeset
5331 //---------------------------------------------------------------------------//
Ritor1
parents: 1424
diff changeset
5332
Ritor1
parents: 1424
diff changeset
5333 pSkyPolygon.field_24 = 0x2000000;
Ritor1
parents: 1424
diff changeset
5334
Ritor1
parents: 1424
diff changeset
5335 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928
Ritor1
parents: 1424
diff changeset
5336 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5337
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5338 //sky position(ïîëîæåíèå íåáà)----------------------------------------------
1427
Ritor1
parents: 1424
diff changeset
5339 // X
Ritor1
parents: 1424
diff changeset
5340 // 0._____________________________.3
Ritor1
parents: 1424
diff changeset
5341 // |8,8 468,8 |
Ritor1
parents: 1424
diff changeset
5342 // | |
Ritor1
parents: 1424
diff changeset
5343 // | |
Ritor1
parents: 1424
diff changeset
5344 // Y| |
Ritor1
parents: 1424
diff changeset
5345 // | |
Ritor1
parents: 1424
diff changeset
5346 // |8,? 468,? |
Ritor1
parents: 1424
diff changeset
5347 // 1._____________________________.2
Ritor1
parents: 1424
diff changeset
5348 //
Ritor1
parents: 1424
diff changeset
5349
Ritor1
parents: 1424
diff changeset
5350 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;//8
Ritor1
parents: 1424
diff changeset
5351 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;//8
Ritor1
parents: 1424
diff changeset
5352
Ritor1
parents: 1424
diff changeset
5353 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;//8
Ritor1
parents: 1424
diff changeset
5354 array_50AC10[1].vWorldViewProjY = v38;//61 / 184 / 310
Ritor1
parents: 1424
diff changeset
5355
Ritor1
parents: 1424
diff changeset
5356 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;//468
Ritor1
parents: 1424
diff changeset
5357 array_50AC10[2].vWorldViewProjY = v38;//61 / 184 / 310
Ritor1
parents: 1424
diff changeset
5358
Ritor1
parents: 1424
diff changeset
5359 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;//468
Ritor1
parents: 1424
diff changeset
5360 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;//8
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5361 //--------------------------------------------------------------------------
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5362
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5363 //pParty->sRotationY / 2048.0f
1427
Ritor1
parents: 1424
diff changeset
5364 // move sky(äâèæåíèå íåáà)--------------include(âñòàâêà)---------------------
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5365 float t = (GetTickCount() % 96000) / 96000.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5366 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5367 array_50AC10[0].v = t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5368
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5369 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5370 array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5371
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5372 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5373 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5374
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5375 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5376 array_50AC10[3].v = t - pParty->sRotationX / 512.0f;
1427
Ritor1
parents: 1424
diff changeset
5377 //--------------------------------------------------------------------------//
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5378
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5379 //rotate skydome(âðàùåíèå êóïîëà íåáà)--------------------------------------
1427
Ritor1
parents: 1424
diff changeset
5380 //  èãðå ïðèíÿòà ñâîÿ ñèñòåìà èçìåðåíèÿ óãëîâ. Ïîëíûé óãîë â 2Ï ðàäèàí ñîîòâåòñòâóåò 65536 åäåíèöàì. Çíà÷åíèþ óãëà 0 ñîîòâåòñòâóåò
Ritor1
parents: 1424
diff changeset
5381 // íàïðàâëåíèå íà âîñòîê, çíà÷åíèþ 16384(0õ4000) - íà ñåâåð è ò.ä..
Ritor1
parents: 1424
diff changeset
5382
Ritor1
parents: 1424
diff changeset
5383 //íàõîæäåíèå âåêòîðà âçãëÿäà------------------------------------------------
Ritor1
parents: 1424
diff changeset
5384 //ïîëîæåíèå êàìåðû----------------------------------------------------------
Ritor1
parents: 1424
diff changeset
5385 screen_center_x = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;//öåíòð ýêðàíà ïî X = 230
Ritor1
parents: 1424
diff changeset
5386 v33 = 65536 / (signed int)(screen_center_x / tan(0.6457717418670654) + 0.5);//360 : (ðàññòîÿíèå îò ýêðàíà äî êàìåðû â ïèêñåëÿõ) = 214
Ritor1
parents: 1424
diff changeset
5387 //--------------------------------------------------------------------------
Ritor1
parents: 1424
diff changeset
5388
Ritor1
parents: 1424
diff changeset
5389 for (uint i = 0; i < pSkyPolygon.uNumVertices; ++i)
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5390 {
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5391 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8
1427
Ritor1
parents: 1424
diff changeset
5392 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0
Ritor1
parents: 1424
diff changeset
5393 v8 = v39 + pSkyPolygon.ptr_38->field_C;//0
Ritor1
parents: 1424
diff changeset
5394
Ritor1
parents: 1424
diff changeset
5395 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0
Ritor1
parents: 1424
diff changeset
5396 screen_center_x = v39 + pSkyPolygon.ptr_38->field_18;//65536
Ritor1
parents: 1424
diff changeset
5397
Ritor1
parents: 1424
diff changeset
5398 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * v33 * (v30 - v29)) / 65536;//27917
Ritor1
parents: 1424
diff changeset
5399 v10 = pSkyPolygon.v_18.x + v9;//24701
Ritor1
parents: 1424
diff changeset
5400 v39 = pSkyPolygon.v_18.x + v9;//24701
Ritor1
parents: 1424
diff changeset
5401 if ( pSkyPolygon.v_18.x + v9 > 0 )
577
Ritor1
parents: 526
diff changeset
5402 {
Ritor1
parents: 526
diff changeset
5403 v10 = 0;
Ritor1
parents: 526
diff changeset
5404 v39 = 0;
Ritor1
parents: 526
diff changeset
5405 }
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5406 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
577
Ritor1
parents: 526
diff changeset
5407 v38 = v10;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5408 //v12 = array_50AC10[i].vWorldViewProjY - 1.0;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5409 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
1427
Ritor1
parents: 1424
diff changeset
5410 v34 = -pSkyPolygon.field_24;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5411 v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0;
577
Ritor1
parents: 526
diff changeset
5412 v14 = v33 * (v30 - v32);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5413
577
Ritor1
parents: 526
diff changeset
5414 while ( 1 )
Ritor1
parents: 526
diff changeset
5415 {
1427
Ritor1
parents: 1424
diff changeset
5416 //v40 = v14;
577
Ritor1
parents: 526
diff changeset
5417 if ( !v10 )
Ritor1
parents: 526
diff changeset
5418 {
1427
Ritor1
parents: 1424
diff changeset
5419 v37 = pSkyPolygon.v_18.z;
Ritor1
parents: 1424
diff changeset
5420 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16;
0
Ritor1
parents:
diff changeset
5421 --v32;
Ritor1
parents:
diff changeset
5422 v14 += v33;
1427
Ritor1
parents: 1424
diff changeset
5423 v10 = pSkyPolygon.v_18.x + v16;
Ritor1
parents: 1424
diff changeset
5424 v39 = pSkyPolygon.v_18.x + v16;
Ritor1
parents: 1424
diff changeset
5425 v38 = pSkyPolygon.v_18.x + v16;
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5426 break;
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5427 }
1427
Ritor1
parents: 1424
diff changeset
5428 v37 = abs(v34 >> 14);//2048
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5429 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y )
577
Ritor1
parents: 526
diff changeset
5430 {
Ritor1
parents: 526
diff changeset
5431 if ( v39 <= 0 )
Ritor1
parents: 526
diff changeset
5432 break;
Ritor1
parents: 526
diff changeset
5433 }
1427
Ritor1
parents: 1424
diff changeset
5434 //v14 = v40;
Ritor1
parents: 1424
diff changeset
5435 v37 = pSkyPolygon.v_18.z;
Ritor1
parents: 1424
diff changeset
5436 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * v14) >> 16;
577
Ritor1
parents: 526
diff changeset
5437 --v32;
Ritor1
parents: 526
diff changeset
5438 v14 += v33;
1427
Ritor1
parents: 1424
diff changeset
5439 v10 = pSkyPolygon.v_18.x + v16;
Ritor1
parents: 1424
diff changeset
5440 v39 = pSkyPolygon.v_18.x + v16;
Ritor1
parents: 1424
diff changeset
5441 v38 = pSkyPolygon.v_18.x + v16;
577
Ritor1
parents: 526
diff changeset
5442 break;
Ritor1
parents: 526
diff changeset
5443 }
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5444
1427
Ritor1
parents: 1424
diff changeset
5445 pShading = fixpoint_div(v34, v38);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5446 if ( pShading < 0 )
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5447 pShading = pODMRenderParams->shading_dist_mist;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5448
1427
Ritor1
parents: 1424
diff changeset
5449 v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);
Ritor1
parents: 1424
diff changeset
5450 screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
5451 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, pShading) / 8;
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
5452 screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(screen_center_x, pShading) / 8;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5453
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5454 //array_50AC10[i].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5455 //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5456 //array_50AC10[i].vWorldPosition.y = 1.0 / (pODMRenderParams->shading_dist_mist >> 16);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5457 //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0);
1427
Ritor1
parents: 1424
diff changeset
5458 //array_50AC10[i]._rhw = 1.0f / (pShading >> 16);
Ritor1
parents: 1424
diff changeset
5459 //array_50AC10[i].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth);
Ritor1
parents: 1424
diff changeset
5460 //array_50AC10[i].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5461 //-----------------------------------------------------------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5462
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5463 array_50AC10[i]._rhw = 1.0f;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5464 }
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5465 //if ( i == _this.uNumVertices - 1 )
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5466 //{
1427
Ritor1
parents: 1424
diff changeset
5467 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5468
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5469 array_50AC10[0].vWorldViewProjY = v38;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5470 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5471 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5472 array_50AC10[3].vWorldViewProjY = v38;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5473
1427
Ritor1
parents: 1424
diff changeset
5474 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5475 //}
0
Ritor1
parents:
diff changeset
5476 }
Ritor1
parents:
diff changeset
5477
Ritor1
parents:
diff changeset
5478 //----- (0047A384) --------------------------------------------------------
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5479 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa)
0
Ritor1
parents:
diff changeset
5480 {
Ritor1
parents:
diff changeset
5481 int v2; // ebx@3
Ritor1
parents:
diff changeset
5482 unsigned int v3; // eax@3
Ritor1
parents:
diff changeset
5483 MapInfo *v4; // edi@4
Ritor1
parents:
diff changeset
5484 //int v5; // eax@8
Ritor1
parents:
diff changeset
5485 //SpawnPointMM7 *v6; // edx@14
Ritor1
parents:
diff changeset
5486 size_t v7; // eax@19
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5487 //char *v8; // eax@19
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5488 //char *v9; // eax@21
0
Ritor1
parents:
diff changeset
5489 char Source[120]; // [sp+Ch] [bp-84h]@19
Ritor1
parents:
diff changeset
5490 const char *pFilename; // [sp+84h] [bp-Ch]@1
Ritor1
parents:
diff changeset
5491 //unsigned int v12; // [sp+88h] [bp-8h]@12
Ritor1
parents:
diff changeset
5492 //int v13; // [sp+8Ch] [bp-4h]@11
Ritor1
parents:
diff changeset
5493
Ritor1
parents:
diff changeset
5494 pFilename = pLevelFilename;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
5495 //thisa->AllocSoftwareDrawBuffers();
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5496 pODMRenderParams->Initialize();
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5497 pWeather->bRenderSnow = false;
0
Ritor1
parents:
diff changeset
5498 pRenderer->ClearZBuffer(0, 479);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5499 thisa = (ODMRenderParams *)1;
0
Ritor1
parents:
diff changeset
5500 GetAlertStatus();
Ritor1
parents:
diff changeset
5501 if ( qword_A750D8 )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
5502 qword_A750D8 = 0;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
5503 v2 = pMapStats->GetMapInfo(pCurrentMapName);
0
Ritor1
parents:
diff changeset
5504 v3 = 0;
Ritor1
parents:
diff changeset
5505 if ( v2 )
Ritor1
parents:
diff changeset
5506 {
Ritor1
parents:
diff changeset
5507 v4 = &pMapStats->pInfos[v2];
Ritor1
parents:
diff changeset
5508 v3 = v4->uRespawnIntervalDays;
Ritor1
parents:
diff changeset
5509 }
Ritor1
parents:
diff changeset
5510 else
Ritor1
parents:
diff changeset
5511 {
Ritor1
parents:
diff changeset
5512 v4 = (MapInfo *)thisa;
Ritor1
parents:
diff changeset
5513 }
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5514 day_attrib &= ~DAY_ATTRIB_FOG;
0
Ritor1
parents:
diff changeset
5515 dword_6BE13C_uCurrentlyLoadedLocationID = v2;
Ritor1
parents:
diff changeset
5516 pOutdoor->Initialize(
Ritor1
parents:
diff changeset
5517 pFilename,
Ritor1
parents:
diff changeset
5518 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1,
Ritor1
parents:
diff changeset
5519 v3,
Ritor1
parents:
diff changeset
5520 (int)&thisa);
Ritor1
parents:
diff changeset
5521 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) )
Ritor1
parents:
diff changeset
5522 {
Ritor1
parents:
diff changeset
5523 InitializeActors();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
5524 InitializeSpriteObjects();
0
Ritor1
parents:
diff changeset
5525 }
Ritor1
parents:
diff changeset
5526 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu;
Ritor1
parents:
diff changeset
5527 //v5 = 0;
Ritor1
parents:
diff changeset
5528 if ( !v2 )
Ritor1
parents:
diff changeset
5529 thisa = 0;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5530 if ( thisa == (ODMRenderParams *)1 )
0
Ritor1
parents:
diff changeset
5531 {
Ritor1
parents:
diff changeset
5532 //v13 = 0;
Ritor1
parents:
diff changeset
5533 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i)
Ritor1
parents:
diff changeset
5534 {
Ritor1
parents:
diff changeset
5535 //v12 = 0;
Ritor1
parents:
diff changeset
5536 //while ( 1 )
Ritor1
parents:
diff changeset
5537 //{
Ritor1
parents:
diff changeset
5538 auto spawn = pOutdoor->pSpawnPoints + i;
Ritor1
parents:
diff changeset
5539 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18];
Ritor1
parents:
diff changeset
5540 if (spawn->uKind == 3 )
Ritor1
parents:
diff changeset
5541 SpawnEncounter(v4, spawn, 0, 0, 0);
Ritor1
parents:
diff changeset
5542 else
Ritor1
parents:
diff changeset
5543 v4->SpawnRandomTreasure(spawn);
Ritor1
parents:
diff changeset
5544 //++v13;
Ritor1
parents:
diff changeset
5545 //v12 += 24;
Ritor1
parents:
diff changeset
5546 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints )
Ritor1
parents:
diff changeset
5547 // break;
Ritor1
parents:
diff changeset
5548 //v5 = 0;
Ritor1
parents:
diff changeset
5549 //}
Ritor1
parents:
diff changeset
5550 }
Ritor1
parents:
diff changeset
5551 RespawnGlobalDecorations();
Ritor1
parents:
diff changeset
5552 }
Ritor1
parents:
diff changeset
5553 pOutdoor->PrepareDecorations();
Ritor1
parents:
diff changeset
5554 pOutdoor->_47F223_LooksLikeGenerateMonsterLoot();
Ritor1
parents:
diff changeset
5555 pOutdoor->InitalizeActors(v2);
Ritor1
parents:
diff changeset
5556 pOutdoor->MessWithLUN();
Ritor1
parents:
diff changeset
5557 v7 = strlen("levels\\");
Ritor1
parents:
diff changeset
5558 strcpy(Source, &pFilename[v7]);
Ritor1
parents:
diff changeset
5559 strcpy(pOutdoor->pLevelFilename, Source);
Ritor1
parents:
diff changeset
5560 pWeather->Initialize();
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5561 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
5562 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
5563 //pODMRenderParams->RotationToInts();
0
Ritor1
parents:
diff changeset
5564 pOutdoor->UpdateSunlightVectors();
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5565
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5566 float fov_rad;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5567 float fov_rad_inv;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5568 //----- (0042394D) --------------------------------------------------------
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5569 //void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5570 {
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5571 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5572 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1);
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5573
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5574 int uViewportWidth = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1;
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
5575
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
5576 extern float _calc_fov(int viewport_width, int angle_degree);
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
5577 fov_rad = _calc_fov(uViewportWidth, 65);
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
5578 fov_rad_inv = 65536.0 / fov_rad;
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5579 }
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5580 pODMRenderParams->int_fov_rad = (signed __int64)fov_rad;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
5581 pODMRenderParams->int_fov_rad_inv = (signed __int64)fov_rad_inv;
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5582
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5583 for (int i = 0; i < 20000; ++i)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5584 {
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5585 array_77EC08[i].ptr_38 = &stru_8019C8;
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
5586
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5587 array_77EC08[i].ptr_48 = nullptr;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5588 }
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5589
0
Ritor1
parents:
diff changeset
5590 MM7Initialization();
Ritor1
parents:
diff changeset
5591 }
Ritor1
parents:
diff changeset
5592
Ritor1
parents:
diff changeset
5593 //----- (0047C370) --------------------------------------------------------
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5594 unsigned int GetLevelFogColor()
0
Ritor1
parents:
diff changeset
5595 {
Ritor1
parents:
diff changeset
5596 signed __int64 v1; // qax@5
Ritor1
parents:
diff changeset
5597 int v2; // eax@6
Ritor1
parents:
diff changeset
5598
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5599 if (bUnderwater)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5600 return 0xFF258F5C;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5601
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5602 if (day_attrib & DAY_ATTRIB_FOG)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5603 {
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5604 if ( pWeather->bNight ) // night-time fog
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5605 {
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5606 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5607 v2 = -(pWeather->bNight != 1);
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5608 return (v2 & 0xE0E0E1) - 0xE0E0E1;
0
Ritor1
parents:
diff changeset
5609 }
Ritor1
parents:
diff changeset
5610 else
Ritor1
parents:
diff changeset
5611 {
Ritor1
parents:
diff changeset
5612 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0);
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5613 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8);
0
Ritor1
parents:
diff changeset
5614 }
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5615 }
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5616
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
5617 return 0;
0
Ritor1
parents:
diff changeset
5618 }
Ritor1
parents:
diff changeset
5619
Ritor1
parents:
diff changeset
5620 //----- (0047C3D7) --------------------------------------------------------
Ritor1
parents:
diff changeset
5621 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3)
Ritor1
parents:
diff changeset
5622 {
Ritor1
parents:
diff changeset
5623 int v3; // ecx@1
Ritor1
parents:
diff changeset
5624 double v5; // st7@10
Ritor1
parents:
diff changeset
5625 signed int v7; // ecx@11
Ritor1
parents:
diff changeset
5626 double v8; // st6@12
Ritor1
parents:
diff changeset
5627 double v9; // st7@15
Ritor1
parents:
diff changeset
5628 double v10; // st6@16
Ritor1
parents:
diff changeset
5629 float v11; // ST14_4@17
Ritor1
parents:
diff changeset
5630 double v12; // ST08_8@17
Ritor1
parents:
diff changeset
5631
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5632 v3 = pWeather->bNight;
0
Ritor1
parents:
diff changeset
5633 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
5634 v3 = 0;
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5635 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5636 return 0xFF000000;
0
Ritor1
parents:
diff changeset
5637 if ( v3 )
Ritor1
parents:
diff changeset
5638 {
Ritor1
parents:
diff changeset
5639 v5 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
5640 if ( a3 < v5 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5641 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5642 v7 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5643 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5644 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5645 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5646 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5647 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5648 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5649 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5650 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5651 v8 = (double)day_fogrange_2;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5652 if ( a3 > v8 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5653 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5654 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5655 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5656 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5657 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5658 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5659 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5660 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5661 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5662 }
0
Ritor1
parents:
diff changeset
5663 }
Ritor1
parents:
diff changeset
5664 else
Ritor1
parents:
diff changeset
5665 {
Ritor1
parents:
diff changeset
5666 v9 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
5667 if ( a3 < v9 )
Ritor1
parents:
diff changeset
5668 {
Ritor1
parents:
diff changeset
5669 v7 = 0;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5670 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5671 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5672 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5673 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5674 goto LABEL_21;
0
Ritor1
parents:
diff changeset
5675 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5676 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5677 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5678 v10 = (double)day_fogrange_2;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5679 if ( a3 > v10 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5680 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5681 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5682 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5683 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5684 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5685 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5686 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5687 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5688 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5689 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5690 v11 = (a3 - v9) * 216.0 / (v10 - v9);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5691 v12 = v11 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5692 v7 = LODWORD(v12);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5693 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5694 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5695 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5696 if ( v7 > 216 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5697 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5698 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5699 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5700 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5701 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5702 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5703 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5704 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5705 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
5706 }
0
Ritor1
parents:
diff changeset
5707 LABEL_21:
Ritor1
parents:
diff changeset
5708 if ( a2 )
Ritor1
parents:
diff changeset
5709 v7 = 248;
Ritor1
parents:
diff changeset
5710 return (-1 - v7) << 24;
Ritor1
parents:
diff changeset
5711 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5712
0
Ritor1
parents:
diff changeset
5713 //----- (0047C4FC) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
5714 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5715 {
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5716 //int v5; // esi@1
0
Ritor1
parents:
diff changeset
5717 signed int v6; // edx@1
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5718 //signed int result; // eax@2
0
Ritor1
parents:
diff changeset
5719 int v8; // eax@3
Ritor1
parents:
diff changeset
5720 double v9; // st7@12
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5721 //double v10; // ST0C_8@18
0
Ritor1
parents:
diff changeset
5722 int v11; // ecx@28
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5723 //signed int v12; // edi@28
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5724 //double v13; // ST0C_8@33
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5725 //double v14; // ST0C_8@34
0
Ritor1
parents:
diff changeset
5726 double v15; // st7@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5727 //double v16; // ST0C_8@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5728 //double v17; // ST0C_8@44
0
Ritor1
parents:
diff changeset
5729 int v18; // ST14_4@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5730 //double v19; // ST0C_8@44
0
Ritor1
parents:
diff changeset
5731 signed int v20; // [sp+10h] [bp-4h]@10
Ritor1
parents:
diff changeset
5732 float a3a; // [sp+1Ch] [bp+8h]@33
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5733 //float a3b; // [sp+1Ch] [bp+8h]@34
0
Ritor1
parents:
diff changeset
5734 float a3c; // [sp+1Ch] [bp+8h]@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5735 //float a3d; // [sp+1Ch] [bp+8h]@44
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5736 //float a4b; // [sp+20h] [bp+Ch]@18
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5737 //int a4a; // [sp+20h] [bp+Ch]@33
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5738 //float a4c; // [sp+20h] [bp+Ch]@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5739 //float a4d; // [sp+20h] [bp+Ch]@44
0
Ritor1
parents:
diff changeset
5740 int a5a; // [sp+24h] [bp+10h]@44
Ritor1
parents:
diff changeset
5741
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5742 //v5 = a2;
0
Ritor1
parents:
diff changeset
5743 v6 = 0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5744
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5745 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5746 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5747
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5748 if (pParty->armageddon_timer)
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5749 return 0xFFFF0000;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5750
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5751 v8 = pWeather->bNight;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5752 if (bUnderwater)
0
Ritor1
parents:
diff changeset
5753 v8 = 0;
Ritor1
parents:
diff changeset
5754 if ( v8 )
Ritor1
parents:
diff changeset
5755 {
Ritor1
parents:
diff changeset
5756 v20 = 1;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5757 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5758 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
0
Ritor1
parents:
diff changeset
5759 v9 = (double)v20 * 1024.0;
Ritor1
parents:
diff changeset
5760 if ( a4 )
Ritor1
parents:
diff changeset
5761 goto LABEL_19;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5762 if ( distance <= v9 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5763 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5764 if ( distance > 0.0 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5765 {
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5766 //a4b = distance * 216.0 / v9;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5767 //v10 = a4b + 6.7553994e15;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5768 //v6 = LODWORD(v10);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5769 v6 = floorf(0.5f + distance * 216.0 / v9);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5770 if (v6 > 216 )
0
Ritor1
parents:
diff changeset
5771 goto LABEL_19;
Ritor1
parents:
diff changeset
5772 }
Ritor1
parents:
diff changeset
5773 }
Ritor1
parents:
diff changeset
5774 else
Ritor1
parents:
diff changeset
5775 {
Ritor1
parents:
diff changeset
5776 v6 = 216;
Ritor1
parents:
diff changeset
5777 }
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5778 if ( distance != 0.0 )
0
Ritor1
parents:
diff changeset
5779 {
Ritor1
parents:
diff changeset
5780 LABEL_20:
Ritor1
parents:
diff changeset
5781 if ( a5 )
Ritor1
parents:
diff changeset
5782 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
5783 if ( v6 > 216 )
Ritor1
parents:
diff changeset
5784 v6 = 216;
Ritor1
parents:
diff changeset
5785 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
Ritor1
parents:
diff changeset
5786 }
Ritor1
parents:
diff changeset
5787 LABEL_19:
Ritor1
parents:
diff changeset
5788 v6 = 216;
Ritor1
parents:
diff changeset
5789 goto LABEL_20;
Ritor1
parents:
diff changeset
5790 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5791
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5792
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5793
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5794 if (fabsf(distance) < 1.0e-6f)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5795 return 0xFFF8F8F8;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5796
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5797 // dim in measured in 8-steps
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5798 v11 = 8 * (max_dimm - min_dimm);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5799 //v12 = v11;
0
Ritor1
parents:
diff changeset
5800 if ( v11 >= 0 )
Ritor1
parents:
diff changeset
5801 {
Ritor1
parents:
diff changeset
5802 if ( v11 > 216 )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5803 v11 = 216;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5804 }
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5805 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5806 v11 = 0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5807
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5808 float fog_density_mult = 216.0f;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5809 if (a4)
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5810 fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5811
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5812 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5813 /*if ( a4 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5814 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5815 //a3b = pOutdoor->fFogDensity * 216.0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5816 //v14 = a3b + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5817 //a4a = floorf(a3b + 0.5f);//LODWORD(v14);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5818 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5819 else
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5820 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5821 //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5822 //v13 = a3a + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5823 //a4a = floorf(a3a + 0.5f);//LODWORD(v13);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5824 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5825 v6 = a4a + v11;*/
0
Ritor1
parents:
diff changeset
5826 if ( a5 )
Ritor1
parents:
diff changeset
5827 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
5828 if ( v6 > 216 )
Ritor1
parents:
diff changeset
5829 v6 = 216;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5830 if ( v6 < v11 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5831 v6 = v11;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5832 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5833 v6 = 8 * pOutdoor->max_terrain_dimming_level;
0
Ritor1
parents:
diff changeset
5834 if ( !bUnderwater )
Ritor1
parents:
diff changeset
5835 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5836 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5837 {
0
Ritor1
parents:
diff changeset
5838 v15 = (double)(255 - v6) * 0.0039215689;
Ritor1
parents:
diff changeset
5839 a3c = v15;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5840 //a4c = v15 * 16.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5841 //v16 = a4c + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5842 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5843 //a4d = a3c * 194.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5844 //v17 = a4d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5845 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5846 //a3d = a3c * 153.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5847 //v19 = a3d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5848 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5849 }
0
Ritor1
parents:
diff changeset
5850 }
Ritor1
parents:
diff changeset
5851 // 6BE3C4: using guessed type char bUnderwater;
Ritor1
parents:
diff changeset
5852
Ritor1
parents:
diff changeset
5853 //----- (0047F44B) --------------------------------------------------------
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5854 unsigned int WorldPosToGridCellX(int sWorldPosX)
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5855 {
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5856 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5857 // and -880 sar 9 = -2
0
Ritor1
parents:
diff changeset
5858 }
Ritor1
parents:
diff changeset
5859
Ritor1
parents:
diff changeset
5860 //----- (0047F458) --------------------------------------------------------
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5861 unsigned int WorldPosToGridCellZ(int sWorldPosZ)
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5862 {
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5863 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
5864 // and -880 sar 9 = -2
0
Ritor1
parents:
diff changeset
5865 }
Ritor1
parents:
diff changeset
5866
Ritor1
parents:
diff changeset
5867 //----- (0047F469) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
5868 int GridCellToWorldPosX(int a1)
0
Ritor1
parents:
diff changeset
5869 {
Ritor1
parents:
diff changeset
5870 return (a1 - 64) << 9;
Ritor1
parents:
diff changeset
5871 }
Ritor1
parents:
diff changeset
5872
Ritor1
parents:
diff changeset
5873 //----- (0047F476) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
5874 int GridCellToWorldPosZ(int a1)
0
Ritor1
parents:
diff changeset
5875 {
Ritor1
parents:
diff changeset
5876 return (64 - a1) << 9;
Ritor1
parents:
diff changeset
5877 }
Ritor1
parents:
diff changeset
5878
Ritor1
parents:
diff changeset
5879
Ritor1
parents:
diff changeset
5880 //----- (004811A3) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
5881 void Polygon::DrawBorderTiles()
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5882 {
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5883 //__debugbreak();
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5884
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5885 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false);
0
Ritor1
parents:
diff changeset
5886 pRenderer->DrawTerrainPolygon(uNumVertices, this,
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5887 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5888
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5889 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
5890 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true);
0
Ritor1
parents:
diff changeset
5891 }
Ritor1
parents:
diff changeset
5892
Ritor1
parents:
diff changeset
5893
Ritor1
parents:
diff changeset
5894 //----- (00481ED9) --------------------------------------------------------
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5895 void sub_481ED9_MessWithODMRenderParams()
0
Ritor1
parents:
diff changeset
5896 {
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
5897 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5898 pODMRenderParams->uNumPolygons = 0;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
5899 //pODMRenderParams->uNumEdges = 0;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
5900 //pODMRenderParams->uNumSpans = 0;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
5901 //pODMRenderParams->uNumSurfs = 0;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5902 pODMRenderParams->uNumBillboards = 0;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
5903 pODMRenderParams->field_44 = 0;
0
Ritor1
parents:
diff changeset
5904 }
Ritor1
parents:
diff changeset
5905
Ritor1
parents:
diff changeset
5906 //----- (004823F4) --------------------------------------------------------
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5907 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5908 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5909 //unsigned int v2; // ebx@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5910 //unsigned int v3; // edi@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5911 //int v4; // eax@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5912 //int v6; // esi@5
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5913 //int v7; // ecx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5914 //int v8; // edx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5915 //int v9; // eax@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5916 //int v10; // esi@10
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5917 //int v11; // [sp+14h] [bp-8h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5918 //int v12; // [sp+18h] [bp-4h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5919
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5920 //v12 = a1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5921 //v11 = a2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5922 auto grid_x = WorldPosToGridCellX(pos_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5923 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5924
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5925 auto party_grid_x1 = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5926 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5927 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5928 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5929 auto party_grid_z1 = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5930 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5931 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5932 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5933 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5934 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5935 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5936 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5937 //dword_76D554_terrain_cell_world_pos_around_party_y = v4;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5938 if (party_x1z1_y == party_x2z1_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5939 party_x2z1_y == party_x2z2_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5940 party_x2z2_y == party_x1z2_y )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5941 return false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5942
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5943 auto dx = abs(pos_x - party_grid_x1),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5944 dz = abs(party_grid_z1 - pos_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5945
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5946 int y1, y2, y3;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5947 if (dz >= dx)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5948 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5949 y1 = party_x1z2_y; // lower-left triangle
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5950 y2 = party_x2z2_y; // y3 | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5951 y3 = party_x1z1_y; // | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5952 /* | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5953 |______ \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5954 y1 y2 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5955 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5956 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5957 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5958 y1 = party_x2z1_y; // upper-right
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5959 y2 = party_x1z1_y; // y2_______ y1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5960 y3 = party_x2z2_y; // \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5961 /* \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5962 \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5963 y3 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5964 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5965
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5966 int y_min = min(y1, min(y2, y3)),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5967 y_max = max(y1, max(y2, y3));
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
5968 return (y_max - y_min) > 512;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5969
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5970 /*if ( y1 >= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5971 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5972 y_min = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5973 if ( y2 < y3 )
0
Ritor1
parents:
diff changeset
5974 goto LABEL_13;
Ritor1
parents:
diff changeset
5975 LABEL_12:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5976 y_min = y3;
0
Ritor1
parents:
diff changeset
5977 goto LABEL_13;
Ritor1
parents:
diff changeset
5978 }
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5979 else if ( y1 >= y3 )
0
Ritor1
parents:
diff changeset
5980 goto LABEL_12;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5981 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5982 y_min = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5983
0
Ritor1
parents:
diff changeset
5984 LABEL_13:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5985 if ( y1 <= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5986 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5987 if ( y2 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5988 y3 = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5989 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5990 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5991 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5992 if ( y1 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5993 y3 = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5994 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
5995 return y3 - v10 > 512;*/
0
Ritor1
parents:
diff changeset
5996 }
Ritor1
parents:
diff changeset
5997
Ritor1
parents:
diff changeset
5998 //----- (0048257A) --------------------------------------------------------
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
5999 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater)
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6000 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6001 //unsigned int v4; // ebx@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6002 //unsigned int v5; // edi@1
0
Ritor1
parents:
diff changeset
6003 int result; // eax@9
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6004 //int v7; // ebx@10
0
Ritor1
parents:
diff changeset
6005 int v8; // ebx@11
Ritor1
parents:
diff changeset
6006 int v9; // eax@11
Ritor1
parents:
diff changeset
6007 int v10; // ecx@11
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6008 //int v11; // [sp+Ch] [bp-Ch]@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6009 //int v12; // [sp+10h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
6010 int v13; // [sp+10h] [bp-8h]@11
Ritor1
parents:
diff changeset
6011 signed int v14; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
6012 int v15; // [sp+24h] [bp+Ch]@11
Ritor1
parents:
diff changeset
6013
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6014 //v11 = a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6015 //v12 = a2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6016 auto grid_x = WorldPosToGridCellX(a1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6017 auto grid_z = WorldPosToGridCellZ(a2) - 1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6018
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6019 auto grid_x1 = GridCellToWorldPosX(grid_x),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6020 grid_x2 = GridCellToWorldPosX(grid_x + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6021 auto grid_z1 = GridCellToWorldPosZ(grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6022 grid_z2 = GridCellToWorldPosZ(grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6023
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6024 auto y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6025 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6026 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6027 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6028 //v4 = WorldPosToGridCellX(a1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6029 //v5 = WorldPosToGridCellZ(v12) - 1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6030 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6031 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6032 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6033 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6034 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6035 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6036 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6037 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6038 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6039 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6040 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6041 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 790
diff changeset
6042 *pIsOnWater = false;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6043 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 )
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 790
diff changeset
6044 *pIsOnWater = true;
0
Ritor1
parents:
diff changeset
6045 v14 = 0;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6046 if ( !bFloatAboveWater && *pIsOnWater )
0
Ritor1
parents:
diff changeset
6047 v14 = -60;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6048 if ( y_x1z1 != y_x2z1 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6049 y_x2z1 != y_x2z2 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6050 y_x2z2 != y_x1z2 )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6051 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6052 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6053 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6054 v8 = y_x1z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6055 v9 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6056 v10 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6057 v15 = a1 - grid_x1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6058 v13 = a2 - grid_z2;
0
Ritor1
parents:
diff changeset
6059 }
Ritor1
parents:
diff changeset
6060 else
Ritor1
parents:
diff changeset
6061 {
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6062 v8 = y_x2z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6063 v9 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6064 v10 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6065 v15 = grid_x2 - a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6066 v13 = grid_z1 - a2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6067 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6068 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128);
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6069 }
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6070 else
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6071 return y_x1z1;
0
Ritor1
parents:
diff changeset
6072 }
Ritor1
parents:
diff changeset
6073
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6074
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6075
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6076
0
Ritor1
parents:
diff changeset
6077
Ritor1
parents:
diff changeset
6078 //----- (00485F53) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
6079 void sr_485F53(Vec2_int_ *v)
0
Ritor1
parents:
diff changeset
6080 {
Ritor1
parents:
diff changeset
6081 ++v->y;
Ritor1
parents:
diff changeset
6082 if ( v->y > 1000 )
Ritor1
parents:
diff changeset
6083 v->y = 0;
Ritor1
parents:
diff changeset
6084 }
Ritor1
parents:
diff changeset
6085
Ritor1
parents:
diff changeset
6086 //----- (0048607B) --------------------------------------------------------
1427
Ritor1
parents: 1424
diff changeset
6087 void Polygon::Create_48607B(stru149 *a2)
0
Ritor1
parents:
diff changeset
6088 {
Ritor1
parents:
diff changeset
6089 this->pTexture = 0;
Ritor1
parents:
diff changeset
6090 this->ptr_38 = a2;
Ritor1
parents:
diff changeset
6091 }
Ritor1
parents:
diff changeset
6092
Ritor1
parents:
diff changeset
6093 //----- (00486089) --------------------------------------------------------
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6094 void Polygon::_normalize_v_18()
0
Ritor1
parents:
diff changeset
6095 {
Ritor1
parents:
diff changeset
6096 double v2; // st7@1
Ritor1
parents:
diff changeset
6097 double v3; // st6@1
Ritor1
parents:
diff changeset
6098 double v5; // st5@1
Ritor1
parents:
diff changeset
6099
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6100 //v1 = this;
0
Ritor1
parents:
diff changeset
6101 v2 = (double)this->v_18.x;
Ritor1
parents:
diff changeset
6102 v3 = (double)this->v_18.y;
Ritor1
parents:
diff changeset
6103 v5 = (double)this->v_18.z;
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6104 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6105 if (fabsf(len) < 1e-6f)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6106 {
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6107 v_18.x = 0;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6108 v_18.y = 0;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6109 v_18.z = 65536;
0
Ritor1
parents:
diff changeset
6110 }
Ritor1
parents:
diff changeset
6111 else
Ritor1
parents:
diff changeset
6112 {
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6113 v_18.x = round(v2 / len * 65536.0);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6114 v_18.y = round(v3 / len * 65536.0);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
6115 v_18.y = round(v5 / len * 65536.0);
0
Ritor1
parents:
diff changeset
6116 }
Ritor1
parents:
diff changeset
6117 }
Ritor1
parents:
diff changeset
6118
Ritor1
parents:
diff changeset
6119 //----- (0048616B) --------------------------------------------------------
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6120 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7)
0
Ritor1
parents:
diff changeset
6121 {
Ritor1
parents:
diff changeset
6122 int v7; // ebx@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6123 //int v8; // esi@1
0
Ritor1
parents:
diff changeset
6124 int v9; // edi@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6125 //int v10; // eax@1
0
Ritor1
parents:
diff changeset
6126 int v11; // edx@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6127 //int v12; // esi@2
499761153844 stru149
Nomad
parents: 1542
diff changeset
6128 //int v13; // eax@2
499761153844 stru149
Nomad
parents: 1542
diff changeset
6129 //int v14; // ST10_4@3
499761153844 stru149
Nomad
parents: 1542
diff changeset
6130 //int v15; // esi@3
499761153844 stru149
Nomad
parents: 1542
diff changeset
6131 //int v16; // eax@5
0
Ritor1
parents:
diff changeset
6132 int v17; // ST0C_4@6
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6133 //int v18; // eax@8
0
Ritor1
parents:
diff changeset
6134 int v19; // ST0C_4@9
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6135 //int v20; // eax@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
6136 //int v21; // edx@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
6137 //int v22; // eax@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
6138 //int result; // eax@10
0
Ritor1
parents:
diff changeset
6139 int v24; // [sp+14h] [bp-14h]@1
Ritor1
parents:
diff changeset
6140 int v25; // [sp+18h] [bp-10h]@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6141 //int v26; // [sp+1Ch] [bp-Ch]@1
0
Ritor1
parents:
diff changeset
6142 int v27; // [sp+24h] [bp-4h]@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6143 //int v28; // [sp+30h] [bp+8h]@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
6144 //int v29; // [sp+3Ch] [bp+14h]@10
0
Ritor1
parents:
diff changeset
6145
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6146 v25 = pGame->pIndoorCameraD3D->int_cosine_x;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6147 v7 = pGame->pIndoorCameraD3D->int_sine_y;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6148 v27 = pGame->pIndoorCameraD3D->int_sine_x;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6149 //v8 = -pIndoorCamera->pos.y;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6150 v9 = pGame->pIndoorCameraD3D->int_cosine_y;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6151 //v26 = -pIndoorCamera->pos.z;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6152 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
6153 v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6154 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
6155 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6156 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) +
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6157 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x);
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6158 this->field_4_party_dir_y = v24;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6159 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27);
0
Ritor1
parents:
diff changeset
6160 }
Ritor1
parents:
diff changeset
6161 else
Ritor1
parents:
diff changeset
6162 {
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6163 this->field_0_party_dir_x = v11;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6164 this->field_4_party_dir_y = v24;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6165 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6166 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6167
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6168 if (pGame->pIndoorCameraD3D->sRotationX)
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6169 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6170 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6171
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6172 this->field_C = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6173 this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6174 this->field_14 = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27);
0
Ritor1
parents:
diff changeset
6175 }
Ritor1
parents:
diff changeset
6176 else
Ritor1
parents:
diff changeset
6177 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6178 this->field_C = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6179 this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6180 this->field_14 = a4;
499761153844 stru149
Nomad
parents: 1542
diff changeset
6181 }
499761153844 stru149
Nomad
parents: 1542
diff changeset
6182
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
6183 if (pGame->pIndoorCameraD3D->sRotationX)
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6184 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6185 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6186
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6187 this->field_18 = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6188 this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6189 this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
0
Ritor1
parents:
diff changeset
6190 }
Ritor1
parents:
diff changeset
6191 else
Ritor1
parents:
diff changeset
6192 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6193 this->field_18 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
6194 this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6195 this->field_20 = a7;
499761153844 stru149
Nomad
parents: 1542
diff changeset
6196 }
499761153844 stru149
Nomad
parents: 1542
diff changeset
6197
0
Ritor1
parents:
diff changeset
6198 this->field_18 = -this->field_18;
Ritor1
parents:
diff changeset
6199 this->field_1C = -this->field_1C;
Ritor1
parents:
diff changeset
6200 this->field_20 = -this->field_20;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6201
499761153844 stru149
Nomad
parents: 1542
diff changeset
6202 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6203 this->field_10, this->field_4_party_dir_y,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6204 this->field_14, this->field_8_party_dir_z);
499761153844 stru149
Nomad
parents: 1542
diff changeset
6205 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6206 this->field_1C, this->field_4_party_dir_y,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6207 this->field_20, this->field_8_party_dir_z);
0
Ritor1
parents:
diff changeset
6208 }
Ritor1
parents:
diff changeset
6209
Ritor1
parents:
diff changeset
6210 //----- (0048694B) --------------------------------------------------------
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6211 void stru149::_48694B_frustum_sky()
0
Ritor1
parents:
diff changeset
6212 {
Ritor1
parents:
diff changeset
6213 this->field_18 = -this->field_18;
Ritor1
parents:
diff changeset
6214 this->field_1C = -this->field_1C;
Ritor1
parents:
diff changeset
6215 this->field_20 = -this->field_20;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
6216
499761153844 stru149
Nomad
parents: 1542
diff changeset
6217 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6218 this->field_10, this->field_4_party_dir_y,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6219 this->field_14, this->field_8_party_dir_z);
499761153844 stru149
Nomad
parents: 1542
diff changeset
6220 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6221 this->field_1C, this->field_4_party_dir_y,
499761153844 stru149
Nomad
parents: 1542
diff changeset
6222 this->field_20, this->field_8_party_dir_z);
0
Ritor1
parents:
diff changeset
6223 }
Ritor1
parents:
diff changeset
6224
Ritor1
parents:
diff changeset
6225 //----- (0044100D) --------------------------------------------------------
994
3431f6abc786 GameUI clean
Nomad
parents: 978
diff changeset
6226 bool sub_44100D()
0
Ritor1
parents:
diff changeset
6227 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6228 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6229 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6230 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
0
Ritor1
parents:
diff changeset
6231 }
Ritor1
parents:
diff changeset
6232 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
6233
Ritor1
parents:
diff changeset
6234 //----- (00441A4E) --------------------------------------------------------
910
Ritor1
parents: 897
diff changeset
6235 __int16 __fastcall sub_441A4E(int a1)//for blessing
0
Ritor1
parents:
diff changeset
6236 {
Ritor1
parents:
diff changeset
6237 __int16 result; // ax@1
Ritor1
parents:
diff changeset
6238 int v2; // ebx@1
Ritor1
parents:
diff changeset
6239 char *v3; // esi@1
Ritor1
parents:
diff changeset
6240 int v4; // edi@4
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6241 bool v5; // ecx@4
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6242 SpriteFrame *pFrame; // eax@6
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6243 //SpriteFrame *v7; // edi@6
0
Ritor1
parents:
diff changeset
6244 int v8; // eax@6
Ritor1
parents:
diff changeset
6245 unsigned __int16 v9; // ax@6
Ritor1
parents:
diff changeset
6246 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1
Ritor1
parents:
diff changeset
6247 int v11; // [sp+5Ch] [bp-Ch]@6
Ritor1
parents:
diff changeset
6248 int v12; // [sp+60h] [bp-8h]@1
Ritor1
parents:
diff changeset
6249 int v13; // [sp+64h] [bp-4h]@6
Ritor1
parents:
diff changeset
6250
Ritor1
parents:
diff changeset
6251 v10.uParentBillboardID = -1;
Ritor1
parents:
diff changeset
6252 v10.pTarget = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
6253 v10.pTargetZ = pRenderer->pActiveZBuffer;
Ritor1
parents:
diff changeset
6254 v10.uTargetPitch = pRenderer->field_10;
Ritor1
parents:
diff changeset
6255 result = 0;
Ritor1
parents:
diff changeset
6256 v2 = a1;
Ritor1
parents:
diff changeset
6257 v10.uViewportX = 0;
Ritor1
parents:
diff changeset
6258 v10.uViewportY = 0;
Ritor1
parents:
diff changeset
6259 v10.uViewportZ = 639;
Ritor1
parents:
diff changeset
6260 v10.uViewportW = 479;
Ritor1
parents:
diff changeset
6261 v12 = 0;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6262 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6263 //do
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6264 for ( uint i = 0; i < 50; ++i )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6265 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6266 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6267 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6268 result = pOtherOverlayList->pOverlays[i].field_0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6269 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6270 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6271 //v4 = result;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6272 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6273 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6274 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6275 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6276 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6277 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 )
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6278 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6279 if ( !pOtherOverlayList->pOverlays[i].field_0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6280 {
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6281 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID,
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6282 pOtherOverlayList->pOverlays[i].field_4);
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6283 //v7 = v6;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6284 v11 = pOtherOverlayList->pOverlays[i].field_E;
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6285 //v13 = pFrame->scale;
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6286 v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6287 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6288 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
6289 v10._screenspace_x_scaler_packedfloat = v13;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
6290 v10._screenspace_y_scaler_packedfloat = v13;
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6291 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1);
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6292 v8 = pOtherOverlayList->pOverlays[i].field_2;
0
Ritor1
parents:
diff changeset
6293 v10.sZValue = 0;
Ritor1
parents:
diff changeset
6294 v10.uFlags = 0;
Ritor1
parents:
diff changeset
6295 v9 = pOverlayList->pOverlays[v8].uOverlayType;
Ritor1
parents:
diff changeset
6296 if ( !v9 || v9 == 2 )
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6297 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1;
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
6298 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
0
Ritor1
parents:
diff changeset
6299 ++v12;
Ritor1
parents:
diff changeset
6300 if ( v12 == 5 )
Ritor1
parents:
diff changeset
6301 break;
Ritor1
parents:
diff changeset
6302 }
Ritor1
parents:
diff changeset
6303 }
Ritor1
parents:
diff changeset
6304 }
Ritor1
parents:
diff changeset
6305 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6306 //v3 += 20;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6307 }
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6308 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays );
0
Ritor1
parents:
diff changeset
6309 return result;
Ritor1
parents:
diff changeset
6310 }
Ritor1
parents:
diff changeset
6311
Ritor1
parents:
diff changeset
6312 //----- (00443801) --------------------------------------------------------
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6313 void Initialize2DA()
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6314 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6315
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6316 int i;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6317 char* test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6318 unsigned char c;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6319 bool break_loop;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6320 unsigned int temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6321 char* tmp_pos;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6322 int decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6323
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6324 if ( p2DEventsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
6325 free(p2DEventsTXT_Raw);
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6326 p2DEventsTXT_Raw = NULL;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6327 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6328 strtok(p2DEventsTXT_Raw, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6329 strtok(NULL, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6330
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6331 for (i=0;i<525;++i)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6332 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6333 test_string = strtok(NULL, "\r") + 1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6334 break_loop = false;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6335 decode_step=0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6336 do
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6337 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6338 c = *(unsigned char*)test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6339 temp_str_len = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6340 while((c!='\t')&&(c>0))
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6341 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6342 ++temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6343 c=test_string[temp_str_len];
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6344 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6345 tmp_pos=test_string+temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6346 if (*tmp_pos == 0)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6347 break_loop = true;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6348 *tmp_pos = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6349 if (temp_str_len)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6350 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6351 switch (decode_step)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6352 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6353 case 2:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6354 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6355 if ( !_strnicmp(test_string, "wea", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6356 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6357 p2DEvents[i].uType = BuildingType_WeaponShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6358 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6359 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6360 if ( !_strnicmp(test_string, "arm", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6361 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6362 p2DEvents[i].uType = BuildingType_ArmorShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6363 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6364 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6365 if ( !_strnicmp(test_string, "mag", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6366 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6367 p2DEvents[i].uType = BuildingType_MagicShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6368 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6369 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6370 if ( !_strnicmp(test_string, "alc", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6371 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6372 p2DEvents[i].uType = BuildingType_AlchemistShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6373 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6374 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6375 if ( !_strnicmp(test_string, "sta", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6376 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6377 p2DEvents[i].uType = BuildingType_Stables;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6378 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6379 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6380 if ( !_strnicmp(test_string, "boa", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6381 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6382 p2DEvents[i].uType = BuildingType_Boats;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6383 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6384 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6385 if ( !_strnicmp(test_string, "tem", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6386 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6387 p2DEvents[i].uType = BuildingType_Temple;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6388 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6389 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6390 if ( !_strnicmp(test_string, "tra", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6391 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6392 p2DEvents[i].uType = BuildingType_Training;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6393 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6394 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6395 if ( !_strnicmp(test_string, "tow", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6396 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6397 p2DEvents[i].uType = BuildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6398 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6399 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6400
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6401 if ( !_strnicmp(test_string, "tav", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6402 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6403 p2DEvents[i].uType = BuildingType_Tavern;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6404 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6405 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6406 if ( !_strnicmp(test_string, "ban", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6407 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6408 p2DEvents[i].uType = BuildingType_Bank;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6409 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6410 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6411 if ( !_strnicmp(test_string, "fir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6412 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6413 p2DEvents[i].uType = BuildingType_FireGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6414 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6415 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6416 if ( !_strnicmp(test_string, "air", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6417 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6418 p2DEvents[i].uType = BuildingType_AirGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6419 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6420 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6421 if ( !_strnicmp(test_string, "wat", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6422 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6423 p2DEvents[i].uType = BuildingType_WaterGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6424 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6425 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6426 if ( !_strnicmp(test_string, "ear", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6427 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6428 p2DEvents[i].uType = BuildingType_EarthGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6429 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6430 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6431 if ( !_strnicmp(test_string, "spi", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6432 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6433 p2DEvents[i].uType = BuildingType_SpiritGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6434 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6435 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6436 if ( !_strnicmp(test_string, "min", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6437 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6438 p2DEvents[i].uType = BuildingType_MindGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6439 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6440 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6441 if ( !_strnicmp(test_string, "bod", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6442 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6443 p2DEvents[i].uType = BuildingType_BodyGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6444 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6445 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6446 if ( !_strnicmp(test_string, "lig", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6447 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6448 p2DEvents[i].uType = BuildingType_LightGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6449 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6450 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6451 if ( !_strnicmp(test_string, "dar", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6452 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6453 p2DEvents[i].uType = BuildingType_DarkGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6454 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6455 }
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
6456 if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6457 {
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
6458 p2DEvents[i].uType = BuildingType_ElementalGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6459 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6460 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6461 if ( !_strnicmp(test_string, "sel", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6462 {
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
6463 p2DEvents[i].uType = BuildingType_SelfGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6464 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6465 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6466 if ( !_strnicmp(test_string, "mir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6467 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6468 p2DEvents[i].uType = BuildingType_16;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6469 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6470 }
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
6471 if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6472 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6473 p2DEvents[i].uType = BuildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6474 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6475 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6476 p2DEvents[i].uType = BuildingType_18;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6477 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6478 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6479
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6480 case 4:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6481 p2DEvents[i].uAnimationID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6482 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6483 case 5:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6484 p2DEvents[i].pName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6485 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6486 case 6:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6487 p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6488 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6489 case 7:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6490 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6491 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6492 case 8:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6493 p2DEvents[i].field_14 = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6494 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6495 case 9:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6496 p2DEvents[i]._state = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6497 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6498 case 10:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6499 p2DEvents[i]._rep = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6500 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6501 case 11:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6502 p2DEvents[i]._per = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6503 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6504 case 12:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6505 p2DEvents[i].fPriceMultiplier = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6506 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6507 case 13:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6508 p2DEvents[i].flt_24 = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6509 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6510 case 15:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6511 p2DEvents[i].field_1C = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6512 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6513 case 18:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6514 p2DEvents[i].uOpenTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6515 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6516 case 19:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6517 p2DEvents[i].uCloseTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6518 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6519 case 20:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6520 p2DEvents[i].uExitPicID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6521 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6522 case 21:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6523 p2DEvents[i].uExitMapID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6524 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6525 case 22:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6526 p2DEvents[i]._quest_related = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6527 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6528 case 23:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6529 p2DEvents[i].pEnterText = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6530 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6531 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6532 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6533 ++decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6534 test_string=tmp_pos+1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6535 } while ((decode_step<24)&&!break_loop);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6536 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6537
0
Ritor1
parents:
diff changeset
6538 }
Ritor1
parents:
diff changeset
6539
Ritor1
parents:
diff changeset
6540 //----- (00443E31) --------------------------------------------------------
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
6541 void LoadLevel_InitializeLevelStr()
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
6542 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6543
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6544 char Args[100];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6545 int string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6546 int max_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6547 int current_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6548 int prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6549
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6550 if (sizeof(pLevelStrOffsets) != 2000)
0
Ritor1
parents:
diff changeset
6551 Log::Warning(L"pLevelStrOffsets: deserialization warning");
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
6552 memset(pLevelStrOffsets.data(), 0, 2000);
0
Ritor1
parents:
diff changeset
6553
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6554 max_string_length = 0;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6555 string_num = 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6556 prev_string_offset = 0;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6557 pLevelStrOffsets[0]=0;
0
Ritor1
parents:
diff changeset
6558 for (uint i = 0; i < uLevelStrFileSize; ++i)
Ritor1
parents:
diff changeset
6559 {
Ritor1
parents:
diff changeset
6560 if ( !pLevelStr[i] )
Ritor1
parents:
diff changeset
6561 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6562 pLevelStrOffsets[string_num] = i + 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6563 ++string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6564 if ( i - prev_string_offset > max_string_length )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6565 max_string_length = i - prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6566 prev_string_offset = i;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6567 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6568 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6569
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6570 uLevelStrNumStrings = string_num - 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6571 if ( max_string_length > 800 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
6572 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1);
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6573
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6574 if ( uLevelStrNumStrings > 0 )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6575 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6576 for(uint i = 0; i <uLevelStrNumStrings ; ++i)
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6577 {
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6578 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6579 ++pLevelStrOffsets[i];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
6580 }
0
Ritor1
parents:
diff changeset
6581 }
Ritor1
parents:
diff changeset
6582 }
Ritor1
parents:
diff changeset
6583
Ritor1
parents:
diff changeset
6584 //----- (00443F95) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
6585 void OnMapLeave()
0
Ritor1
parents:
diff changeset
6586 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6587 _evt_raw *test_event;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6588 if ( uLevelEVT_NumEvents > 0 )
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6589 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6590 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6591 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6592 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6593 if ( test_event->_e_type == EVENT_OnMapLeave )
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6594 {
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6595 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6596 }
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
6597 }
0
Ritor1
parents:
diff changeset
6598 }
Ritor1
parents:
diff changeset
6599 }
Ritor1
parents:
diff changeset
6600
Ritor1
parents:
diff changeset
6601 //----- (00443FDC) --------------------------------------------------------
Ritor1
parents:
diff changeset
6602 void OnMapLoad()
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6603 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6604 stru176 *v3; // esi@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6605 __int16 v4; // cx@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6606 __int16 v5; // di@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6607 int v6; // eax@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6608 signed __int64 v8; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6609 unsigned int v9; // ecx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6610 signed __int64 v10; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6611 signed __int64 v11; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6612 int v12; // ST50_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6613 signed __int64 v13; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6614 signed __int64 v14; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6615 int v15; // ST58_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6616 signed __int64 v16; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6617 int hours; // ebx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6618 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6619 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6620 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6621 int minutes; // [sp+2Ch] [bp-24h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6622 int years; // [sp+34h] [bp-1Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6623 int weeks; // [sp+38h] [bp-18h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6624 int v26; // [sp+3Ch] [bp-14h]@15
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6625 int days; // [sp+3Ch] [bp-14h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6626 int months; // [sp+40h] [bp-10h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6627 __int16 v29; // [sp+46h] [bp-Ah]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6628 __int16 v30; // [sp+48h] [bp-8h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6629 __int16 v31; // [sp+4Ah] [bp-6h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6630 __int16 v32; // [sp+4Ch] [bp-4h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6631 __int16 v33; // [sp+4Eh] [bp-2h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6632
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6633 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6634 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6635 auto pEvent = pLevelEVT_Index[i];
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6636
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
6637 auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6638
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6639 if (_evt->_e_type == EVENT_PlaySound)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6640 {
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
6641 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6642 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6643 else if (_evt->_e_type == EVENT_OnMapReload)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6644 {
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6645 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6646 }
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6647 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6648 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6649 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
810
f5156b8c61ad savegame refactoring
Gloval
parents: 795
diff changeset
6650 v20 = pOutdoor->loc_time.uLastVisitDay;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6651 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6652 v20 = pIndoor->stru1.uLastVisitDay;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6653
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6654 v3->timer_evt_type = _evt->_e_type;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6655 v3->timer_evt_ID = pEvent.uEventID;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6656 v3->timer_evt_seq_num = pEvent.event_sequence_num;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6657
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6658 v3->field_10 = _evt->v5;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6659 v3->field_12 = _evt->v6;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6660 v3->field_14 = _evt->v7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6661 v3->field_16 = _evt->v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6662 v3->field_18 = _evt->v9;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6663 v3->field_1A = _evt->v10;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6664
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6665
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6666 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6667
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
6668 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
6669 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6670 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6671 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6672 if ( v20 )
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6673 v18 = pParty->uTimePlayed - v20;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6674 else
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6675 v18 = 0i64;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6676 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6677
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6678 if ( v26 / 7 / 4 / 12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6679 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6680 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6681 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6682 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
6683 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6684 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6685 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6686 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6687 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6688 v26 / 7 != 0 && v3->field_14 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6689 v26 != 0 || !v20)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6690 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6691 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
6692 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6693 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6694 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6695 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6696 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6697 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6698 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6699 v9 = v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6700 v10 = (signed int)v8 / 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6701 minutes = v10 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6702 v11 = (signed int)(v10 / 60);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6703 v12 = v11 % 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6704 v13 = (signed int)(v11 / 24);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6705 days = v13 % 7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6706 v14 = (signed int)(v13 / 7);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6707 v15 = v14 % 4;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6708 v16 = (signed int)(v14 / 4);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6709 years = v16 / 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6710
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6711 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6712 auto _2 = ((__int64)v9 << 32) | _1;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6713
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6714 seconds = _2 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6715 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6716 // v9)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6717 // % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6718
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6719 hours = v12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6720 weeks = v15;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6721 months = v16 % 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6722 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6723 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6724 ++years;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6725 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6726 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6727 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6728 if ( v3->field_12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6729 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6730 ++months;
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6731 }
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6732 else
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6733 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6734 if ( v3->field_14 )
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6735 {
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6736 ++weeks;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6737 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6738 else
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6739 {
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6740 ++days;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6741 minutes = v3->field_18;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6742 hours = v3->field_16;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6743 seconds = v3->field_1A;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6744 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6745 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6746 }
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
6747 v3->next_fire_time = (signed __int64)((double)((seconds
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6748 + 60 * minutes
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6749 + 3600 * hours
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6750 + 0x93A80 * weeks
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6751 + 0x15180 * days
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6752 + 0x24EA00 * (months + 12i64 * years)) << 7)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6753 * 0.033333335);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6754
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6755 ++dword_5B65C8_timers_count;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6756 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6757 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
6758 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
6759 }
0
Ritor1
parents:
diff changeset
6760
Ritor1
parents:
diff changeset
6761 //----- (00444360) --------------------------------------------------------
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6762 void Level_LoadEvtAndStr(const char *pLevelName)
0
Ritor1
parents:
diff changeset
6763 {
Ritor1
parents:
diff changeset
6764 char pContainerName[120]; // [sp+8h] [bp-98h]@1
Ritor1
parents:
diff changeset
6765
Ritor1
parents:
diff changeset
6766 sprintf(pContainerName, "%s.evt", pLevelName);
1541
86cb7398d2a8 mm8 icons
Nomad
parents: 1477
diff changeset
6767 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216);
0
Ritor1
parents:
diff changeset
6768
Ritor1
parents:
diff changeset
6769 sprintf(pContainerName, "%s.str", pLevelName);
1541
86cb7398d2a8 mm8 icons
Nomad
parents: 1477
diff changeset
6770 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216);
0
Ritor1
parents:
diff changeset
6771 if (uLevelStrFileSize)
Ritor1
parents:
diff changeset
6772 LoadLevel_InitializeLevelStr();
Ritor1
parents:
diff changeset
6773 }
Ritor1
parents:
diff changeset
6774
Ritor1
parents:
diff changeset
6775 //----- (00444564) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
6776 const char * sub_444564()
0
Ritor1
parents:
diff changeset
6777 {
Ritor1
parents:
diff changeset
6778 double v0; // st7@3
Ritor1
parents:
diff changeset
6779 int v1; // ebx@3
Ritor1
parents:
diff changeset
6780 int v2; // edi@3
Ritor1
parents:
diff changeset
6781 int v3; // eax@3
Ritor1
parents:
diff changeset
6782 int v5; // edi@6
Ritor1
parents:
diff changeset
6783 int v6; // eax@6
Ritor1
parents:
diff changeset
6784 int v7; // eax@6
Ritor1
parents:
diff changeset
6785 unsigned __int8 v9; // zf@7
Ritor1
parents:
diff changeset
6786 unsigned __int8 v10; // sf@7
Ritor1
parents:
diff changeset
6787 ODMFace *v11; // eax@9
Ritor1
parents:
diff changeset
6788 __int16 v12; // cx@9
Ritor1
parents:
diff changeset
6789 const char *v13; // eax@11
Ritor1
parents:
diff changeset
6790 const char *v14; // edi@11
Ritor1
parents:
diff changeset
6791 const char *result; // eax@15
Ritor1
parents:
diff changeset
6792 unsigned int v16; // [sp+0h] [bp-20h]@3
Ritor1
parents:
diff changeset
6793 const char *v17; // [sp+4h] [bp-1Ch]@3
Ritor1
parents:
diff changeset
6794 unsigned int pY; // [sp+8h] [bp-18h]@3
Ritor1
parents:
diff changeset
6795 float v19; // [sp+Ch] [bp-14h]@1
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6796 int v20;
0
Ritor1
parents:
diff changeset
6797 int v21; // [sp+14h] [bp-Ch]@1
Ritor1
parents:
diff changeset
6798 unsigned int v22; // [sp+18h] [bp-8h]@8
Ritor1
parents:
diff changeset
6799 int pX; // [sp+1Ch] [bp-4h]@3
Ritor1
parents:
diff changeset
6800
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
6801 v20 = viewparams->sViewCenterX;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
6802 v21 = viewparams->sViewCenterY;
0
Ritor1
parents:
diff changeset
6803 v19 = (double)viewparams->field_2C * 0.000015258789;
Ritor1
parents:
diff changeset
6804 if ( viewparams->field_2C == 384 )
Ritor1
parents:
diff changeset
6805 {
711
a5e587c8e30e some cleaning
Gloval
parents: 708
diff changeset
6806 v20 = viewparams->indoor_center_x;
a5e587c8e30e some cleaning
Gloval
parents: 708
diff changeset
6807 v21 = viewparams->indoor_center_y;
0
Ritor1
parents:
diff changeset
6808 }
Ritor1
parents:
diff changeset
6809 v17 = 0;
Ritor1
parents:
diff changeset
6810 v16 = pOutdoor->uNumBModels;
Ritor1
parents:
diff changeset
6811 pMouse->GetClickPos((unsigned int *)&pX, &pY);
Ritor1
parents:
diff changeset
6812 v0 = 1.0 / v19;
Ritor1
parents:
diff changeset
6813 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
Ritor1
parents:
diff changeset
6814 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0);
Ritor1
parents:
diff changeset
6815 v2 = abs(v1 + 22528) / 512;
Ritor1
parents:
diff changeset
6816 v3 = abs((signed)LODWORD(v19) - 22528);
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6817 result = 0;
0
Ritor1
parents:
diff changeset
6818 if ( pOutdoor->_47F04C(v2, v3 / 512)
Ritor1
parents:
diff changeset
6819 && uCurrentlyLoadedLevelType == LEVEL_Outdoor
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6820 && (signed int)v16 > 0 )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6821 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6822 for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++)
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6823 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6824 pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1;
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6825 pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19);
0
Ritor1
parents:
diff changeset
6826 v5 = abs((signed)pY);
Ritor1
parents:
diff changeset
6827 v6 = abs((signed)pX);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 317
diff changeset
6828 v7 = int_get_vector_length(v6, v5, 0);
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6829 if ( v7 < pOutdoor->pBModels[i].sBoundingRadius )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6830 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6831 if ( pOutdoor->pBModels[i].uNumFaces > 0 )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6832 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6833 for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++)
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6834 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6835 v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134];
0
Ritor1
parents:
diff changeset
6836 v12 = v11->sCogTriggeredID;
Ritor1
parents:
diff changeset
6837 if ( v12 )
Ritor1
parents:
diff changeset
6838 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
6839 if ( !(v11->uAttributes & 0x100000) )
0
Ritor1
parents:
diff changeset
6840 {
428
24936a5ff8ca level hints
Gloval
parents: 424
diff changeset
6841 v13 = GetEventHintString(v12);
0
Ritor1
parents:
diff changeset
6842 v14 = v13;
Ritor1
parents:
diff changeset
6843 if ( v13 )
Ritor1
parents:
diff changeset
6844 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1090
diff changeset
6845 if ( _stricmp(v13, "") )
0
Ritor1
parents:
diff changeset
6846 v17 = v14;
Ritor1
parents:
diff changeset
6847 }
Ritor1
parents:
diff changeset
6848 }
Ritor1
parents:
diff changeset
6849 }
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6850 }
0
Ritor1
parents:
diff changeset
6851 }
Ritor1
parents:
diff changeset
6852 result = v17;
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6853 }
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
6854 }
0
Ritor1
parents:
diff changeset
6855 }
Ritor1
parents:
diff changeset
6856 return result;
Ritor1
parents:
diff changeset
6857 }
Ritor1
parents:
diff changeset
6858
Ritor1
parents:
diff changeset
6859 //----- (00444D80) --------------------------------------------------------
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
6860 int GetTravelTime()
0
Ritor1
parents:
diff changeset
6861 {
Ritor1
parents:
diff changeset
6862 signed int v0; // esi@1
Ritor1
parents:
diff changeset
6863
Ritor1
parents:
diff changeset
6864 v0 = uDefaultTravelTime_ByFoot;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
6865 if ( CheckHiredNPCSpeciality(Guide) )
0
Ritor1
parents:
diff changeset
6866 --v0;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
6867 if ( CheckHiredNPCSpeciality(Tracker) )
0
Ritor1
parents:
diff changeset
6868 v0 -= 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
6869 if ( CheckHiredNPCSpeciality(Pathfinder) )
0
Ritor1
parents:
diff changeset
6870 v0 -= 3;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
6871 if ( CheckHiredNPCSpeciality(Explorer) )
0
Ritor1
parents:
diff changeset
6872 --v0;
Ritor1
parents:
diff changeset
6873 if ( v0 < 1 )
Ritor1
parents:
diff changeset
6874 v0 = 1;
Ritor1
parents:
diff changeset
6875 return v0;
Ritor1
parents:
diff changeset
6876 }
Ritor1
parents:
diff changeset
6877 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
Ritor1
parents:
diff changeset
6878
Ritor1
parents:
diff changeset
6879 //----- (004451A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
6880 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
Ritor1
parents:
diff changeset
6881 {
Ritor1
parents:
diff changeset
6882 int v3; // esi@1
Ritor1
parents:
diff changeset
6883 int v4; // edi@1
Ritor1
parents:
diff changeset
6884
Ritor1
parents:
diff changeset
6885 v3 = a2;
Ritor1
parents:
diff changeset
6886 v4 = a1;
Ritor1
parents:
diff changeset
6887 if ( !pGUIWindow2 )
Ritor1
parents:
diff changeset
6888 {
Ritor1
parents:
diff changeset
6889 if ( pParty->uFlags & 2 )
Ritor1
parents:
diff changeset
6890 pGame->Draw();
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6891 pAudioPlayer->StopChannels(-1, -1);
0
Ritor1
parents:
diff changeset
6892 pMiscTimer->Pause();
Ritor1
parents:
diff changeset
6893 pEventTimer->Pause();
Ritor1
parents:
diff changeset
6894 dword_5C3418 = v4;
Ritor1
parents:
diff changeset
6895 dword_5C341C = v3;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
6896 _591094_decoration = activeLevelDecoration;
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
6897 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
6898 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
6899 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
6900 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
6901 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
0
Ritor1
parents:
diff changeset
6902 }
Ritor1
parents:
diff changeset
6903 }
Ritor1
parents:
diff changeset
6904
Ritor1
parents:
diff changeset
6905 //----- (004452BB) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
6906 void sub_4452BB()
0
Ritor1
parents:
diff changeset
6907 {
Ritor1
parents:
diff changeset
6908 pGUIWindow2->Release();
Ritor1
parents:
diff changeset
6909 pGUIWindow2 = 0;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
6910 activeLevelDecoration = _591094_decoration;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
6911 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
6912 activeLevelDecoration = NULL;
0
Ritor1
parents:
diff changeset
6913 pEventTimer->Resume();
Ritor1
parents:
diff changeset
6914 }
Ritor1
parents:
diff changeset
6915
Ritor1
parents:
diff changeset
6916 //----- (004465DF) --------------------------------------------------------
Ritor1
parents:
diff changeset
6917 int sub_4465DF_check_season(int a1)
Ritor1
parents:
diff changeset
6918 {
Ritor1
parents:
diff changeset
6919 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
6920 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
6921 int v3; // ecx@2
Ritor1
parents:
diff changeset
6922 int v4; // ecx@3
Ritor1
parents:
diff changeset
6923 char v6; // zf@9
Ritor1
parents:
diff changeset
6924
Ritor1
parents:
diff changeset
6925 v1 = pParty->uCurrentMonth + 1;
Ritor1
parents:
diff changeset
6926 v2 = pParty->uDaysPlayed + 1;
Ritor1
parents:
diff changeset
6927 if ( a1 )
Ritor1
parents:
diff changeset
6928 {
Ritor1
parents:
diff changeset
6929 v3 = a1 - 1;
Ritor1
parents:
diff changeset
6930 if ( v3 )
Ritor1
parents:
diff changeset
6931 {
Ritor1
parents:
diff changeset
6932 v4 = v3 - 1;
Ritor1
parents:
diff changeset
6933 if ( v4 )
Ritor1
parents:
diff changeset
6934 {
Ritor1
parents:
diff changeset
6935 if ( v4 != 1 )
Ritor1
parents:
diff changeset
6936 return 0;
Ritor1
parents:
diff changeset
6937 if ( v1 != 12 )
Ritor1
parents:
diff changeset
6938 {
Ritor1
parents:
diff changeset
6939 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 )
Ritor1
parents:
diff changeset
6940 return 1;
Ritor1
parents:
diff changeset
6941 v6 = v1 == 3;
Ritor1
parents:
diff changeset
6942 LABEL_24:
Ritor1
parents:
diff changeset
6943 if ( !v6 || (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
6944 return 0;
Ritor1
parents:
diff changeset
6945 return 1;
Ritor1
parents:
diff changeset
6946 }
Ritor1
parents:
diff changeset
6947 }
Ritor1
parents:
diff changeset
6948 else
Ritor1
parents:
diff changeset
6949 {
Ritor1
parents:
diff changeset
6950 if ( v1 != 9 )
Ritor1
parents:
diff changeset
6951 {
Ritor1
parents:
diff changeset
6952 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 )
Ritor1
parents:
diff changeset
6953 return 1;
Ritor1
parents:
diff changeset
6954 v6 = v1 == 12;
Ritor1
parents:
diff changeset
6955 goto LABEL_24;
Ritor1
parents:
diff changeset
6956 }
Ritor1
parents:
diff changeset
6957 }
Ritor1
parents:
diff changeset
6958 }
Ritor1
parents:
diff changeset
6959 else
Ritor1
parents:
diff changeset
6960 {
Ritor1
parents:
diff changeset
6961 if ( v1 != 6 )
Ritor1
parents:
diff changeset
6962 {
Ritor1
parents:
diff changeset
6963 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 )
Ritor1
parents:
diff changeset
6964 return 1;
Ritor1
parents:
diff changeset
6965 v6 = v1 == 9;
Ritor1
parents:
diff changeset
6966 goto LABEL_24;
Ritor1
parents:
diff changeset
6967 }
Ritor1
parents:
diff changeset
6968 }
Ritor1
parents:
diff changeset
6969 }
Ritor1
parents:
diff changeset
6970 else
Ritor1
parents:
diff changeset
6971 {
Ritor1
parents:
diff changeset
6972 if ( v1 != 3 )
Ritor1
parents:
diff changeset
6973 {
Ritor1
parents:
diff changeset
6974 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 )
Ritor1
parents:
diff changeset
6975 return 1;
Ritor1
parents:
diff changeset
6976 v6 = v1 == 6;
Ritor1
parents:
diff changeset
6977 goto LABEL_24;
Ritor1
parents:
diff changeset
6978 }
Ritor1
parents:
diff changeset
6979 }
Ritor1
parents:
diff changeset
6980 if ( (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
6981 return 1;
Ritor1
parents:
diff changeset
6982 return 0;
Ritor1
parents:
diff changeset
6983 }
Ritor1
parents:
diff changeset
6984
Ritor1
parents:
diff changeset
6985 //----- (0044861E) --------------------------------------------------------
Ritor1
parents:
diff changeset
6986 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
Ritor1
parents:
diff changeset
6987 {
Ritor1
parents:
diff changeset
6988 unsigned int v2; // eax@2
Ritor1
parents:
diff changeset
6989 unsigned __int16 v3; // di@2
Ritor1
parents:
diff changeset
6990 signed int v4; // esi@5
Ritor1
parents:
diff changeset
6991 BLVFace *v5; // eax@7
Ritor1
parents:
diff changeset
6992 unsigned int *v6; // eax@8
Ritor1
parents:
diff changeset
6993 char *v7; // eax@9
Ritor1
parents:
diff changeset
6994 int v8; // edi@16
Ritor1
parents:
diff changeset
6995 char *v9; // esi@16
Ritor1
parents:
diff changeset
6996 ODMFace *v10; // eax@17
Ritor1
parents:
diff changeset
6997 unsigned int *v11; // eax@19
Ritor1
parents:
diff changeset
6998 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
6999 const char *Str2; // [sp+10h] [bp-14h]@1
Ritor1
parents:
diff changeset
7000 unsigned int v14; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
7001 signed int v15; // [sp+18h] [bp-Ch]@14
Ritor1
parents:
diff changeset
7002 int v16; // [sp+1Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
7003 signed int v17; // [sp+20h] [bp-4h]@4
Ritor1
parents:
diff changeset
7004 signed int v18; // [sp+20h] [bp-4h]@16
Ritor1
parents:
diff changeset
7005
Ritor1
parents:
diff changeset
7006 Str2 = pFilename;
Ritor1
parents:
diff changeset
7007 v14 = uFaceCog;
Ritor1
parents:
diff changeset
7008 if ( uFaceCog )
Ritor1
parents:
diff changeset
7009 {
Ritor1
parents:
diff changeset
7010 v2 = pBitmaps_LOD->LoadTexture(pFilename);
Ritor1
parents:
diff changeset
7011 v3 = v2;
Ritor1
parents:
diff changeset
7012 v12 = v2;
Ritor1
parents:
diff changeset
7013 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 )
Ritor1
parents:
diff changeset
7014 {
Ritor1
parents:
diff changeset
7015 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1);
Ritor1
parents:
diff changeset
7016
Ritor1
parents:
diff changeset
7017 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
7018 {
Ritor1
parents:
diff changeset
7019 v17 = 1;
Ritor1
parents:
diff changeset
7020 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
7021 {
Ritor1
parents:
diff changeset
7022 v4 = 1;
Ritor1
parents:
diff changeset
7023 do
Ritor1
parents:
diff changeset
7024 {
Ritor1
parents:
diff changeset
7025 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 )
Ritor1
parents:
diff changeset
7026 {
Ritor1
parents:
diff changeset
7027 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C];
Ritor1
parents:
diff changeset
7028 if ( BYTE1(v5->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
7029 {
Ritor1
parents:
diff changeset
7030 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
7031 Str2);
Ritor1
parents:
diff changeset
7032 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID;
Ritor1
parents:
diff changeset
7033 if ( *(_WORD *)v6 )
Ritor1
parents:
diff changeset
7034 {
Ritor1
parents:
diff changeset
7035 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6);
Ritor1
parents:
diff changeset
7036 }
Ritor1
parents:
diff changeset
7037 else
Ritor1
parents:
diff changeset
7038 {
Ritor1
parents:
diff changeset
7039 *(_WORD *)v6 = v3;
Ritor1
parents:
diff changeset
7040 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
7041 v7[1] &= 0xBFu;
Ritor1
parents:
diff changeset
7042 }
Ritor1
parents:
diff changeset
7043 }
Ritor1
parents:
diff changeset
7044 else
Ritor1
parents:
diff changeset
7045 {
Ritor1
parents:
diff changeset
7046 v5->uBitmapID = v3;
Ritor1
parents:
diff changeset
7047 }
Ritor1
parents:
diff changeset
7048 }
Ritor1
parents:
diff changeset
7049 ++v17;
Ritor1
parents:
diff changeset
7050 ++v4;
Ritor1
parents:
diff changeset
7051 }
Ritor1
parents:
diff changeset
7052 while ( v17 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
7053 }
Ritor1
parents:
diff changeset
7054 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7055 }
Ritor1
parents:
diff changeset
7056 else
Ritor1
parents:
diff changeset
7057 {
Ritor1
parents:
diff changeset
7058 v15 = 0;
Ritor1
parents:
diff changeset
7059 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
7060 {
Ritor1
parents:
diff changeset
7061 v16 = 0;
Ritor1
parents:
diff changeset
7062 do
Ritor1
parents:
diff changeset
7063 {
Ritor1
parents:
diff changeset
7064 v8 = 0;
Ritor1
parents:
diff changeset
7065 v9 = (char *)&pOutdoor->pBModels[v16].pVertices;
Ritor1
parents:
diff changeset
7066 v18 = 0;
Ritor1
parents:
diff changeset
7067 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 )
Ritor1
parents:
diff changeset
7068 {
Ritor1
parents:
diff changeset
7069 do
Ritor1
parents:
diff changeset
7070 {
Ritor1
parents:
diff changeset
7071 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4));
Ritor1
parents:
diff changeset
7072 if ( v10->sCogNumber == v14 )
Ritor1
parents:
diff changeset
7073 {
Ritor1
parents:
diff changeset
7074 if ( BYTE1(v10->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
7075 {
Ritor1
parents:
diff changeset
7076 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
7077 Str2);
Ritor1
parents:
diff changeset
7078 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272);
Ritor1
parents:
diff changeset
7079 if ( *(_WORD *)v11 )
Ritor1
parents:
diff changeset
7080 {
Ritor1
parents:
diff changeset
7081 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11);
Ritor1
parents:
diff changeset
7082 }
Ritor1
parents:
diff changeset
7083 else
Ritor1
parents:
diff changeset
7084 {
Ritor1
parents:
diff changeset
7085 *(_WORD *)v11 = v12;
Ritor1
parents:
diff changeset
7086 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu;
Ritor1
parents:
diff changeset
7087 }
Ritor1
parents:
diff changeset
7088 }
Ritor1
parents:
diff changeset
7089 else
Ritor1
parents:
diff changeset
7090 {
Ritor1
parents:
diff changeset
7091 v10->uTextureID = v12;
Ritor1
parents:
diff changeset
7092 }
Ritor1
parents:
diff changeset
7093 }
Ritor1
parents:
diff changeset
7094 ++v18;
Ritor1
parents:
diff changeset
7095 v8 += 308;
Ritor1
parents:
diff changeset
7096 }
Ritor1
parents:
diff changeset
7097 while ( v18 < *((_DWORD *)v9 + 2) );
Ritor1
parents:
diff changeset
7098 }
Ritor1
parents:
diff changeset
7099 ++v15;
Ritor1
parents:
diff changeset
7100 ++v16;
Ritor1
parents:
diff changeset
7101 }
Ritor1
parents:
diff changeset
7102 while ( v15 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
7103 }
Ritor1
parents:
diff changeset
7104 }
Ritor1
parents:
diff changeset
7105 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7106 }
Ritor1
parents:
diff changeset
7107 }
Ritor1
parents:
diff changeset
7108 }
Ritor1
parents:
diff changeset
7109
Ritor1
parents:
diff changeset
7110 //----- (0044882F) --------------------------------------------------------
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7111 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
0
Ritor1
parents:
diff changeset
7112 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7113 for (size_t i = 0; i < uNumLevelDecorations; i++)
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7114 {
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7115 if (pLevelDecorations[i].uCog == uCog)
0
Ritor1
parents:
diff changeset
7116 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7117 if (pFileName && strcmp(pFileName, "0"))
0
Ritor1
parents:
diff changeset
7118 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7119 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName);
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7120 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID);
0
Ritor1
parents:
diff changeset
7121 }
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7122
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7123 if (bHide)
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7124 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE;
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7125 else
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7126 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE;
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7127
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
7128 pParty->uFlags |= 2u;
0
Ritor1
parents:
diff changeset
7129 }
Ritor1
parents:
diff changeset
7130 }
Ritor1
parents:
diff changeset
7131 }
Ritor1
parents:
diff changeset
7132
Ritor1
parents:
diff changeset
7133 //----- (0044892E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7134 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
Ritor1
parents:
diff changeset
7135 {
Ritor1
parents:
diff changeset
7136 signed int v3; // esi@2
Ritor1
parents:
diff changeset
7137 signed int v4; // ecx@4
Ritor1
parents:
diff changeset
7138 char *v5; // eax@6
Ritor1
parents:
diff changeset
7139 int v6; // edi@13
Ritor1
parents:
diff changeset
7140 char *v7; // esi@13
Ritor1
parents:
diff changeset
7141 signed int v8; // ecx@13
Ritor1
parents:
diff changeset
7142 ODMFace *v9; // eax@14
Ritor1
parents:
diff changeset
7143 int v10; // [sp+0h] [bp-Ch]@1
Ritor1
parents:
diff changeset
7144 signed int v11; // [sp+4h] [bp-8h]@11
Ritor1
parents:
diff changeset
7145 int v12; // [sp+8h] [bp-4h]@12
Ritor1
parents:
diff changeset
7146
Ritor1
parents:
diff changeset
7147 v10 = sCogNumber;
Ritor1
parents:
diff changeset
7148 if ( sCogNumber )
Ritor1
parents:
diff changeset
7149 {
Ritor1
parents:
diff changeset
7150 v3 = 1;
Ritor1
parents:
diff changeset
7151 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
7152 {
Ritor1
parents:
diff changeset
7153 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
7154 {
Ritor1
parents:
diff changeset
7155 v4 = 1;
Ritor1
parents:
diff changeset
7156 do
Ritor1
parents:
diff changeset
7157 {
Ritor1
parents:
diff changeset
7158 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 )
Ritor1
parents:
diff changeset
7159 {
Ritor1
parents:
diff changeset
7160 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
7161 if ( on )
Ritor1
parents:
diff changeset
7162 *(_DWORD *)v5 |= bit;
Ritor1
parents:
diff changeset
7163 else
Ritor1
parents:
diff changeset
7164 *(_DWORD *)v5 &= ~bit;
Ritor1
parents:
diff changeset
7165 }
Ritor1
parents:
diff changeset
7166 ++v3;
Ritor1
parents:
diff changeset
7167 ++v4;
Ritor1
parents:
diff changeset
7168 }
Ritor1
parents:
diff changeset
7169 while ( v3 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
7170 }
Ritor1
parents:
diff changeset
7171 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7172 }
Ritor1
parents:
diff changeset
7173 else
Ritor1
parents:
diff changeset
7174 {
Ritor1
parents:
diff changeset
7175 v11 = 0;
Ritor1
parents:
diff changeset
7176 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
7177 {
Ritor1
parents:
diff changeset
7178 v12 = 0;
Ritor1
parents:
diff changeset
7179 do
Ritor1
parents:
diff changeset
7180 {
Ritor1
parents:
diff changeset
7181 v6 = 0;
Ritor1
parents:
diff changeset
7182 v7 = (char *)&pOutdoor->pBModels[v12].pVertices;
Ritor1
parents:
diff changeset
7183 v8 = 0;
Ritor1
parents:
diff changeset
7184 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 )
Ritor1
parents:
diff changeset
7185 {
Ritor1
parents:
diff changeset
7186 do
Ritor1
parents:
diff changeset
7187 {
Ritor1
parents:
diff changeset
7188 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4));
Ritor1
parents:
diff changeset
7189 if ( v9->sCogNumber == v10 )
Ritor1
parents:
diff changeset
7190 {
Ritor1
parents:
diff changeset
7191 if ( on )
Ritor1
parents:
diff changeset
7192 v9->uAttributes |= bit;
Ritor1
parents:
diff changeset
7193 else
Ritor1
parents:
diff changeset
7194 v9->uAttributes &= ~bit;
Ritor1
parents:
diff changeset
7195 }
Ritor1
parents:
diff changeset
7196 ++v8;
Ritor1
parents:
diff changeset
7197 v6 += 308;
Ritor1
parents:
diff changeset
7198 }
Ritor1
parents:
diff changeset
7199 while ( v8 < *((_DWORD *)v7 + 2) );
Ritor1
parents:
diff changeset
7200 }
Ritor1
parents:
diff changeset
7201 ++v11;
Ritor1
parents:
diff changeset
7202 ++v12;
Ritor1
parents:
diff changeset
7203 }
Ritor1
parents:
diff changeset
7204 while ( v11 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
7205 }
Ritor1
parents:
diff changeset
7206 }
Ritor1
parents:
diff changeset
7207 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7208 }
Ritor1
parents:
diff changeset
7209 }
Ritor1
parents:
diff changeset
7210
Ritor1
parents:
diff changeset
7211 //----- (00448A98) --------------------------------------------------------
Ritor1
parents:
diff changeset
7212 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle)
Ritor1
parents:
diff changeset
7213 {
Ritor1
parents:
diff changeset
7214 unsigned int v3; // ebx@1
Ritor1
parents:
diff changeset
7215 unsigned int v4; // ebp@1
Ritor1
parents:
diff changeset
7216 signed int v5; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7217 Actor *v6; // esi@4
0
Ritor1
parents:
diff changeset
7218 size_t v7; // ecx@10
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7219 Actor *v8; // eax@11
0
Ritor1
parents:
diff changeset
7220 unsigned __int16 v9; // dx@14
Ritor1
parents:
diff changeset
7221
Ritor1
parents:
diff changeset
7222 v4 = uGroupID;
Ritor1
parents:
diff changeset
7223 v5 = Standing;
Ritor1
parents:
diff changeset
7224 v3 = uFlag;
Ritor1
parents:
diff changeset
7225 if ( uGroupID )
Ritor1
parents:
diff changeset
7226 {
Ritor1
parents:
diff changeset
7227 if ( bToggle )
Ritor1
parents:
diff changeset
7228 {
Ritor1
parents:
diff changeset
7229 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
7230 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7231 v6 = pActors.data();//[0].uAttributes;
0
Ritor1
parents:
diff changeset
7232 do
Ritor1
parents:
diff changeset
7233 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7234 if ( v6->uGroup == v4 )
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7235 {
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7236 v6->uAttributes |= v3;
0
Ritor1
parents:
diff changeset
7237 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
7238 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7239 v6->uAIState = Disabled;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7240 v6->UpdateAnimation();
0
Ritor1
parents:
diff changeset
7241 }
Ritor1
parents:
diff changeset
7242 }
Ritor1
parents:
diff changeset
7243 ++v5;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7244 ++v6;
0
Ritor1
parents:
diff changeset
7245 }
Ritor1
parents:
diff changeset
7246 while ( v5 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
7247 }
Ritor1
parents:
diff changeset
7248 }
Ritor1
parents:
diff changeset
7249 else
Ritor1
parents:
diff changeset
7250 {
Ritor1
parents:
diff changeset
7251 v7 = uNumActors;
Ritor1
parents:
diff changeset
7252 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
7253 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7254 v8 = pActors.data();//[0].uAIState;
0
Ritor1
parents:
diff changeset
7255 do
Ritor1
parents:
diff changeset
7256 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7257 if ( v8->uGroup == v4 )
0
Ritor1
parents:
diff changeset
7258 {
Ritor1
parents:
diff changeset
7259 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
7260 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7261 v9 = v8->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7262 if ( v8->uAIState != Dead )
0
Ritor1
parents:
diff changeset
7263 {
Ritor1
parents:
diff changeset
7264 if ( v9 != 4 && v9 != 11 )
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7265 v8->uAIState = Standing;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7266 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7267 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7268 LODWORD(v8->uAttributes) &= ~v3;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7269 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7270 ++v8;
0
Ritor1
parents:
diff changeset
7271 --v7;
Ritor1
parents:
diff changeset
7272 }
Ritor1
parents:
diff changeset
7273 while ( v7 );
Ritor1
parents:
diff changeset
7274 }
Ritor1
parents:
diff changeset
7275 }
Ritor1
parents:
diff changeset
7276 }
Ritor1
parents:
diff changeset
7277 }
Ritor1
parents:
diff changeset
7278
Ritor1
parents:
diff changeset
7279 //----- (00448B45) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
7280 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
0
Ritor1
parents:
diff changeset
7281 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7282 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7283 GameUI_Footer_TimeLeft = 0;
0
Ritor1
parents:
diff changeset
7284 }
Ritor1
parents:
diff changeset
7285
Ritor1
parents:
diff changeset
7286 //----- (00448B67) --------------------------------------------------------
790
Nomad
parents: 789 788
diff changeset
7287 void OnTimer(int __unused)
Nomad
parents: 789 788
diff changeset
7288 {
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7289 if (pEventTimer->bPaused)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7290 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7291
790
Nomad
parents: 789 788
diff changeset
7292 if (__unused)
Nomad
parents: 789 788
diff changeset
7293 _5773C0_unused = 0;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7294
790
Nomad
parents: 789 788
diff changeset
7295 auto v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7296 if (!v13)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7297 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7298
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7299 //uint _v2v3 = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7300 //v3 = HIDWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7301 //v2 = LODWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7302
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7303 _5773B8_event_timer = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7304
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7305 for (uint i = 0; i < dword_5B65C8_timers_count; ++i)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7306 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7307 //v4 = (char *)&array_5B5928_timers[0].field_C;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7308 auto timer = array_5B5928_timers + i;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7309 //while ( 1 )
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7310 //{
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7311 //v5 = *(short *)v4;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7312 if (timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7313 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7314 if (v13 < timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7315 timer->time_left_to_fire -= v13;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7316 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7317 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7318 timer->time_left_to_fire = timer->fire_interval;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7319 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7320 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7321 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7322 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7323 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7324 if (timer->next_fire_time < pParty->uTimePlayed)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7325 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7326 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7327 if (timer->field_10)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7328 next_trigger_time = 336 * 60 * 60 * 24; // 1 year
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7329 else if (timer->field_12)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7330 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7331 else if (timer->field_14)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7332 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7333
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7334 timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7335 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7336 timer->next_fire_time = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7337
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7338 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
0
Ritor1
parents:
diff changeset
7339 }
Ritor1
parents:
diff changeset
7340 }
Ritor1
parents:
diff changeset
7341 }
Ritor1
parents:
diff changeset
7342 }
Ritor1
parents:
diff changeset
7343
Ritor1
parents:
diff changeset
7344 //----- (00481D77) --------------------------------------------------------
Ritor1
parents:
diff changeset
7345 void _outdoor_project(RenderVertexSoft *v)
Ritor1
parents:
diff changeset
7346 {
Ritor1
parents:
diff changeset
7347 double v1; // st7@1
Ritor1
parents:
diff changeset
7348 double v2; // st7@1
Ritor1
parents:
diff changeset
7349
Ritor1
parents:
diff changeset
7350 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
7351 v->_rhw = v1;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
7352 v2 = v1 * (double)pODMRenderParams->int_fov_rad;
0
Ritor1
parents:
diff changeset
7353 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
7354 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
7355 }
Ritor1
parents:
diff changeset
7356
Ritor1
parents:
diff changeset
7357 //----- (00448CF4) --------------------------------------------------------
Ritor1
parents:
diff changeset
7358 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName)
Ritor1
parents:
diff changeset
7359 {
Ritor1
parents:
diff changeset
7360 __int16 v8; // di@1
Ritor1
parents:
diff changeset
7361 __int16 v9; // si@1
Ritor1
parents:
diff changeset
7362 unsigned int v10; // eax@1
Ritor1
parents:
diff changeset
7363 size_t v11; // ebx@2
Ritor1
parents:
diff changeset
7364 signed int v12; // esi@2
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7365 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3
0
Ritor1
parents:
diff changeset
7366 AIDirection a3; // [sp+Ch] [bp-50h]@2
Ritor1
parents:
diff changeset
7367 AIDirection v15; // [sp+28h] [bp-34h]@2
Ritor1
parents:
diff changeset
7368 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
7369
Ritor1
parents:
diff changeset
7370 v8 = typeindex;
Ritor1
parents:
diff changeset
7371 v9 = level;
Ritor1
parents:
diff changeset
7372
Ritor1
parents:
diff changeset
7373 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
7374 //SpawnPointMM7::SpawnPointMM7(&v16);
Ritor1
parents:
diff changeset
7375
Ritor1
parents:
diff changeset
7376 v16.vPosition.x = x;
Ritor1
parents:
diff changeset
7377 v16.vPosition.y = y;
Ritor1
parents:
diff changeset
7378 v16.vPosition.z = z;
Ritor1
parents:
diff changeset
7379 v16.uGroup = group;
Ritor1
parents:
diff changeset
7380 v16.uRadius = 32;
Ritor1
parents:
diff changeset
7381 v16.uKind = 3;
Ritor1
parents:
diff changeset
7382 v16.uIndex = v8 + 2 * v9 + v9;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
7383 v10 = pMapStats->GetMapInfo(pCurrentMapName);
0
Ritor1
parents:
diff changeset
7384 if ( v10 )
Ritor1
parents:
diff changeset
7385 {
Ritor1
parents:
diff changeset
7386 v11 = uNumActors;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7387 SpawnEncounter(&pMapStats->pInfos[v10], &v16, 0, count, 0);
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7388 memcpy(&v15, Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &a3, 1), sizeof(v15));
0
Ritor1
parents:
diff changeset
7389 v12 = v11;
Ritor1
parents:
diff changeset
7390 if ( (signed int)v11 < (signed int)uNumActors )
Ritor1
parents:
diff changeset
7391 {
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7392 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor )
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7393 {
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7394 pActor->PrepareSprites(0);
0
Ritor1
parents:
diff changeset
7395 ++v12;
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7396 pActor->uYawAngle = v15.uYawAngle;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7397 pActor->dword_000334_unique_name = uUniqueName;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7398 }
0
Ritor1
parents:
diff changeset
7399 }
Ritor1
parents:
diff changeset
7400 }
Ritor1
parents:
diff changeset
7401 }
Ritor1
parents:
diff changeset
7402
Ritor1
parents:
diff changeset
7403
Ritor1
parents:
diff changeset
7404 //----- (0044987B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7405 void sub_44987B(const char *pMapName, MapStartPoint start_point)
0
Ritor1
parents:
diff changeset
7406 {
Ritor1
parents:
diff changeset
7407 const char *v2; // edi@1
Ritor1
parents:
diff changeset
7408
Ritor1
parents:
diff changeset
7409 v2 = pMapName;
Ritor1
parents:
diff changeset
7410 pAudioPlayer->StopChannels(-1, -1);
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 433
diff changeset
7411 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
7412 if ( _stricmp(pCurrentMapName, v2) )
0
Ritor1
parents:
diff changeset
7413 SaveGame(1, 0);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7414
978
9334a8c59c8d uGameState
Ritor1
parents: 973
diff changeset
7415 uGameState = GAME_STATE_2;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
7416 strcpy(pCurrentMapName, v2);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7417 uLevel_StartingPointType = start_point;
0
Ritor1
parents:
diff changeset
7418 }
Ritor1
parents:
diff changeset
7419 // 6BE35C: using guessed type int uLevel_StartingPointType;
Ritor1
parents:
diff changeset
7420
Ritor1
parents:
diff changeset
7421 //----- (004498D5) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7422 void TeleportToStartingPoint(MapStartPoint point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7423 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7424 //unsigned int v1; // ecx@2
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7425 //int v2; // ecx@3
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7426 //int v3; // ecx@4
0
Ritor1
parents:
diff changeset
7427 unsigned __int16 v4; // ax@11
Ritor1
parents:
diff changeset
7428 signed int v5; // ecx@12
Ritor1
parents:
diff changeset
7429 LevelDecoration *v6; // edx@13
Ritor1
parents:
diff changeset
7430 signed int v7; // ecx@17
Ritor1
parents:
diff changeset
7431 int v8; // eax@17
Ritor1
parents:
diff changeset
7432 int v9; // ecx@17
Ritor1
parents:
diff changeset
7433 const char *v10; // [sp-4h] [bp-84h]@6
Ritor1
parents:
diff changeset
7434 char pName[128]; // [sp+8h] [bp-78h]@11
Ritor1
parents:
diff changeset
7435
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7436 switch (point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7437 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7438 case MapStartPoint_Party: v10 = "Party Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7439 case MapStartPoint_North: v10 = "North Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7440 case MapStartPoint_South: v10 = "South Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7441 case MapStartPoint_East: v10 = "East Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7442 case MapStartPoint_West: v10 = "West Start"; break;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7443 default:
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7444 Error("Invalid enum value: %u", point);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7445 }
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7446
0
Ritor1
parents:
diff changeset
7447 strcpy(pName, v10);
Ritor1
parents:
diff changeset
7448 v4 = pDecorationList->GetDecorIdByName(pName);
Ritor1
parents:
diff changeset
7449 if ( v4 )
Ritor1
parents:
diff changeset
7450 {
Ritor1
parents:
diff changeset
7451 v5 = 0;
Ritor1
parents:
diff changeset
7452 if ( (signed int)uNumLevelDecorations > 0 )
Ritor1
parents:
diff changeset
7453 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7454 v6 = pLevelDecorations.data();
0
Ritor1
parents:
diff changeset
7455 while ( v6->uDecorationDescID != (signed __int16)v4 )
Ritor1
parents:
diff changeset
7456 {
Ritor1
parents:
diff changeset
7457 ++v5;
Ritor1
parents:
diff changeset
7458 ++v6;
Ritor1
parents:
diff changeset
7459 if ( v5 >= (signed int)uNumLevelDecorations )
Ritor1
parents:
diff changeset
7460 goto LABEL_20;
Ritor1
parents:
diff changeset
7461 }
Ritor1
parents:
diff changeset
7462 v7 = v5;
Ritor1
parents:
diff changeset
7463 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x;
Ritor1
parents:
diff changeset
7464 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y;
Ritor1
parents:
diff changeset
7465 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z;
Ritor1
parents:
diff changeset
7466 pParty->uFallStartY = pParty->vPosition.z;
Ritor1
parents:
diff changeset
7467 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90;
Ritor1
parents:
diff changeset
7468 v9 = pLevelDecorations[v7].field_10_y_rot;
Ritor1
parents:
diff changeset
7469 pParty->sRotationY = v8;
Ritor1
parents:
diff changeset
7470 if ( v9 )
Ritor1
parents:
diff changeset
7471 pParty->sRotationY = v9;
Ritor1
parents:
diff changeset
7472 pParty->sRotationX = 0;
Ritor1
parents:
diff changeset
7473 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
7474 }
Ritor1
parents:
diff changeset
7475 LABEL_20:
Ritor1
parents:
diff changeset
7476 if ( dword_5B65C0 )
Ritor1
parents:
diff changeset
7477 {
Ritor1
parents:
diff changeset
7478 if ( _5B65A8_npcdata_uflags_or_other )
Ritor1
parents:
diff changeset
7479 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other;
Ritor1
parents:
diff changeset
7480 if ( _5B65AC_npcdata_fame_or_other )
Ritor1
parents:
diff changeset
7481 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other;
Ritor1
parents:
diff changeset
7482 if ( _5B65B0_npcdata_rep_or_other )
Ritor1
parents:
diff changeset
7483 {
Ritor1
parents:
diff changeset
7484 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
7485 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
7486 }
1516
f3cd08b89476 Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents: 1515
diff changeset
7487 if ( _5B65B4_npcdata_loword_house_or_other != -1 )
0
Ritor1
parents:
diff changeset
7488 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
Ritor1
parents:
diff changeset
7489 if ( _5B65B8_npcdata_hiword_house_or_other )
Ritor1
parents:
diff changeset
7490 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other;
Ritor1
parents:
diff changeset
7491 if ( dword_5B65BC )
Ritor1
parents:
diff changeset
7492 pParty->uFallSpeed = dword_5B65BC;
Ritor1
parents:
diff changeset
7493 }
Ritor1
parents:
diff changeset
7494 _5B65B4_npcdata_loword_house_or_other = -1;
Ritor1
parents:
diff changeset
7495 dword_5B65C0 = 0;
Ritor1
parents:
diff changeset
7496 dword_5B65BC = 0;
Ritor1
parents:
diff changeset
7497 _5B65B8_npcdata_hiword_house_or_other = 0;
Ritor1
parents:
diff changeset
7498 _5B65B0_npcdata_rep_or_other = 0;
Ritor1
parents:
diff changeset
7499 _5B65AC_npcdata_fame_or_other = 0;
Ritor1
parents:
diff changeset
7500 _5B65A8_npcdata_uflags_or_other = 0;
Ritor1
parents:
diff changeset
7501 }
Ritor1
parents:
diff changeset
7502 }
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
7503
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
7504
0
Ritor1
parents:
diff changeset
7505
Ritor1
parents:
diff changeset
7506 //----- (00449A49) --------------------------------------------------------
Ritor1
parents:
diff changeset
7507 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2)
Ritor1
parents:
diff changeset
7508 {
Ritor1
parents:
diff changeset
7509 int v2; // eax@1
Ritor1
parents:
diff changeset
7510 int v3; // ebx@1
Ritor1
parents:
diff changeset
7511 signed int v4; // esi@2
Ritor1
parents:
diff changeset
7512 int v5; // edx@2
Ritor1
parents:
diff changeset
7513 BLVDoor *v6; // ecx@8
Ritor1
parents:
diff changeset
7514 unsigned int v7; // edx@18
Ritor1
parents:
diff changeset
7515 signed int v8; // esi@19
Ritor1
parents:
diff changeset
7516 int v9; // eax@19
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
7517 //char Args; // [sp+Ch] [bp-78h]@6
0
Ritor1
parents:
diff changeset
7518
Ritor1
parents:
diff changeset
7519 LOWORD(v2) = LOWORD(pIndoor->pDoors);
Ritor1
parents:
diff changeset
7520 v3 = a2;
Ritor1
parents:
diff changeset
7521 if ( !pIndoor->pDoors )
Ritor1
parents:
diff changeset
7522 return v2;
Ritor1
parents:
diff changeset
7523 v4 = 0;
Ritor1
parents:
diff changeset
7524 v5 = (int)&pIndoor->pDoors->uDoorID;
Ritor1
parents:
diff changeset
7525 do
Ritor1
parents:
diff changeset
7526 {
Ritor1
parents:
diff changeset
7527 if ( *(int *)v5 == uDoorID )
Ritor1
parents:
diff changeset
7528 break;
Ritor1
parents:
diff changeset
7529 ++v4;
Ritor1
parents:
diff changeset
7530 v5 += 80;
Ritor1
parents:
diff changeset
7531 }
Ritor1
parents:
diff changeset
7532 while ( v4 < 200 );
Ritor1
parents:
diff changeset
7533 if ( v4 >= 200 )
Ritor1
parents:
diff changeset
7534 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
7535 Error("Unable to find Door ID: %i!", uDoorID);
0
Ritor1
parents:
diff changeset
7536 }
Ritor1
parents:
diff changeset
7537 v6 = &pIndoor->pDoors[v4];
Ritor1
parents:
diff changeset
7538 if ( v3 == 2 )
Ritor1
parents:
diff changeset
7539 {
Ritor1
parents:
diff changeset
7540 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
7541 if ( (short)v2 == 3 || (short)v2 == 1 )
Ritor1
parents:
diff changeset
7542 return v2;
Ritor1
parents:
diff changeset
7543 if ( (short)v2 )
Ritor1
parents:
diff changeset
7544 goto LABEL_14;
Ritor1
parents:
diff changeset
7545 }
Ritor1
parents:
diff changeset
7546 else
Ritor1
parents:
diff changeset
7547 {
Ritor1
parents:
diff changeset
7548 if ( !v3 )
Ritor1
parents:
diff changeset
7549 {
Ritor1
parents:
diff changeset
7550 LABEL_14:
Ritor1
parents:
diff changeset
7551 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
7552 if ( (short)v2 && (short)v2 != 3 )
Ritor1
parents:
diff changeset
7553 {
Ritor1
parents:
diff changeset
7554 v6->uState = BLVDoor::Closing;
Ritor1
parents:
diff changeset
7555 if ( (short)v2 == 2 )
Ritor1
parents:
diff changeset
7556 {
Ritor1
parents:
diff changeset
7557 LABEL_17:
Ritor1
parents:
diff changeset
7558 v6->uTimeSinceTriggered = 0;
Ritor1
parents:
diff changeset
7559 return v2;
Ritor1
parents:
diff changeset
7560 }
Ritor1
parents:
diff changeset
7561 v7 = v6->uTimeSinceTriggered;
Ritor1
parents:
diff changeset
7562 v2 = 15360;
Ritor1
parents:
diff changeset
7563 if ( v7 != 15360 )
Ritor1
parents:
diff changeset
7564 {
Ritor1
parents:
diff changeset
7565 v8 = v6->uOpenSpeed;
Ritor1
parents:
diff changeset
7566 v9 = v6->uCloseSpeed;
Ritor1
parents:
diff changeset
7567 LABEL_26:
Ritor1
parents:
diff changeset
7568 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8;
Ritor1
parents:
diff changeset
7569 goto LABEL_27;
Ritor1
parents:
diff changeset
7570 }
Ritor1
parents:
diff changeset
7571 goto LABEL_27;
Ritor1
parents:
diff changeset
7572 }
Ritor1
parents:
diff changeset
7573 return v2;
Ritor1
parents:
diff changeset
7574 }
Ritor1
parents:
diff changeset
7575 if ( v3 != 1 )
Ritor1
parents:
diff changeset
7576 return v2;
Ritor1
parents:
diff changeset
7577 }
Ritor1
parents:
diff changeset
7578 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
7579 if ( (short)v2 != 2 && (short)v2 != 1 )
Ritor1
parents:
diff changeset
7580 {
Ritor1
parents:
diff changeset
7581 v6->uState = BLVDoor::Opening;
Ritor1
parents:
diff changeset
7582 if ( !(short)v2 )
Ritor1
parents:
diff changeset
7583 goto LABEL_17;
Ritor1
parents:
diff changeset
7584 v7 = v6->uTimeSinceTriggered;
Ritor1
parents:
diff changeset
7585 v2 = 15360;
Ritor1
parents:
diff changeset
7586 if ( v7 != 15360 )
Ritor1
parents:
diff changeset
7587 {
Ritor1
parents:
diff changeset
7588 v8 = v6->uCloseSpeed;
Ritor1
parents:
diff changeset
7589 v9 = v6->uOpenSpeed;
Ritor1
parents:
diff changeset
7590 goto LABEL_26;
Ritor1
parents:
diff changeset
7591 }
Ritor1
parents:
diff changeset
7592 LABEL_27:
Ritor1
parents:
diff changeset
7593 v6->uTimeSinceTriggered = v2;
Ritor1
parents:
diff changeset
7594 }
Ritor1
parents:
diff changeset
7595 return v2;
Ritor1
parents:
diff changeset
7596 }
Ritor1
parents:
diff changeset
7597
Ritor1
parents:
diff changeset
7598 //----- (00449B57) --------------------------------------------------------
521
663c4f618f56 Awards tab corrrection
Gloval
parents: 520
diff changeset
7599 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 )
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
7600 {
1113
39eaa6b00141 something to bool cast (performance warning) mostly fixed
Grumpy7
parents: 1112
diff changeset
7601 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0;
0
Ritor1
parents:
diff changeset
7602 }
Ritor1
parents:
diff changeset
7603
Ritor1
parents:
diff changeset
7604 //----- (00449B7E) --------------------------------------------------------
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7605 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
0
Ritor1
parents:
diff changeset
7606 {
Ritor1
parents:
diff changeset
7607 signed int v3; // esi@1
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7608 unsigned char set_bit; // edx@1
0
Ritor1
parents:
diff changeset
7609
Ritor1
parents:
diff changeset
7610 v3 = a2 - 1;
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7611 set_bit = 0x80 >> v3 % 8;
0
Ritor1
parents:
diff changeset
7612 if ( bToggle )
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7613 pArray[v3 / 8] |= set_bit;
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7614 else
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
7615 pArray[v3 / 8] &= ~set_bit;
0
Ritor1
parents:
diff changeset
7616 }
Ritor1
parents:
diff changeset
7617
Ritor1
parents:
diff changeset
7618 //----- (0044C175) --------------------------------------------------------
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1119
diff changeset
7619 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds )
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7620 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
7621 strcpy(GameUI_Footer_TimedString.data(), pString);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7622 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount();
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7623
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7624 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
0
Ritor1
parents:
diff changeset
7625 i > 450;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
7626 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
1470
c987b5ed09af footer array fix
zipi
parents: 1459
diff changeset
7627 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
0
Ritor1
parents:
diff changeset
7628 }
Ritor1
parents:
diff changeset
7629
Ritor1
parents:
diff changeset
7630 //----- (0044C1D0) --------------------------------------------------------
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
7631 void ShowNothingHereStatus()
0
Ritor1
parents:
diff changeset
7632 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7633 if ( !GameUI_Footer_TimeLeft )
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7634 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here
0
Ritor1
parents:
diff changeset
7635 }
Ritor1
parents:
diff changeset
7636
Ritor1
parents:
diff changeset
7637 //----- (0044C28B) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7638 int const_2()
0
Ritor1
parents:
diff changeset
7639 {
Ritor1
parents:
diff changeset
7640 return 2;
Ritor1
parents:
diff changeset
7641 }
Ritor1
parents:
diff changeset
7642
Ritor1
parents:
diff changeset
7643 //----- (0044C28F) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7644 bool TeleportToNWCDungeon()
0
Ritor1
parents:
diff changeset
7645 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
7646 if (!_stricmp("nwc.blv", pCurrentMapName))
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7647 return false;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7648
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7649 _5B65A8_npcdata_uflags_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7650 _5B65AC_npcdata_fame_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7651 _5B65B0_npcdata_rep_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7652 _5B65B4_npcdata_loword_house_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7653 _5B65B8_npcdata_hiword_house_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7654 dword_5B65BC = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7655 dword_5B65C0 = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7656
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7657 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7658 sub_44987B("nwc.blv", MapStartPoint_Party);
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7659 pCurrentScreen = SCREEN_GAME;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
7660 return true;
0
Ritor1
parents:
diff changeset
7661 }
Ritor1
parents:
diff changeset
7662
Ritor1
parents:
diff changeset
7663 //----- (00401000) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
7664 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int))
0
Ritor1
parents:
diff changeset
7665 {
Ritor1
parents:
diff changeset
7666 void *v4; // esi@2
Ritor1
parents:
diff changeset
7667 int v5; // edi@2
Ritor1
parents:
diff changeset
7668
Ritor1
parents:
diff changeset
7669 if ( numObjs - 1 >= 0 )
Ritor1
parents:
diff changeset
7670 {
Ritor1
parents:
diff changeset
7671 v4 = a1;
Ritor1
parents:
diff changeset
7672 v5 = numObjs;
Ritor1
parents:
diff changeset
7673 do
Ritor1
parents:
diff changeset
7674 {
Ritor1
parents:
diff changeset
7675 constructor((int)v4);
Ritor1
parents:
diff changeset
7676 v4 = (char *)v4 + objSize;
Ritor1
parents:
diff changeset
7677 --v5;
Ritor1
parents:
diff changeset
7678 }
Ritor1
parents:
diff changeset
7679 while ( v5 );
Ritor1
parents:
diff changeset
7680 }
Ritor1
parents:
diff changeset
7681 }
Ritor1
parents:
diff changeset
7682
Ritor1
parents:
diff changeset
7683 //----- (0040261D) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7684 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
0
Ritor1
parents:
diff changeset
7685 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7686 if (count < 100)
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7687 {
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7688 pIDs[count] = uID;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7689 pXs[count] = x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7690 pYs[count] = y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7691 pZs[count] = z;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7692 field_324[count] = a3;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7693 field_3EC[count] = a8;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7694 field_450[count++] = a7;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
7695 }
0
Ritor1
parents:
diff changeset
7696 }
Ritor1
parents:
diff changeset
7697
Ritor1
parents:
diff changeset
7698 //----- (00402CAE) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
7699 int stru193_math::Cos(int angle)
0
Ritor1
parents:
diff changeset
7700 {
Ritor1
parents:
diff changeset
7701 int v2; // eax@1
Ritor1
parents:
diff changeset
7702
Ritor1
parents:
diff changeset
7703 //a2: (angle - uIntegerHalfPi) for sin(angle)
Ritor1
parents:
diff changeset
7704 // (angle) for cos(angle)
Ritor1
parents:
diff changeset
7705
Ritor1
parents:
diff changeset
7706 v2 = uDoublePiMask & angle;
Ritor1
parents:
diff changeset
7707
Ritor1
parents:
diff changeset
7708 if ( v2 > uIntegerPi )
Ritor1
parents:
diff changeset
7709 v2 = uIntegerDoublePi - v2;
Ritor1
parents:
diff changeset
7710 if ( v2 >= uIntegerHalfPi )
Ritor1
parents:
diff changeset
7711 return -pCosTable[uIntegerPi - v2];
Ritor1
parents:
diff changeset
7712 else
Ritor1
parents:
diff changeset
7713 return pCosTable[v2];
Ritor1
parents:
diff changeset
7714 }
Ritor1
parents:
diff changeset
7715