annotate mm7_3.cpp @ 1439:468f434a8d8a

Слияние
author Ritor1
date Mon, 22 Jul 2013 18:00:58 +0600
parents bc99e1a48bea 3161094869e0
children b67a3e0d6fc3
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
119
be3c07c98861 Outdoor minimap fixed (didn't test wizard eye thou)
Nomad
parents: 112
diff changeset
5 #include <assert.h>
be3c07c98861 Outdoor minimap fixed (didn't test wizard eye thou)
Nomad
parents: 112
diff changeset
6
1323
bfde0563ecdc removed weather.h from indoor.h
Grumpy7
parents: 1306
diff changeset
7 #include "Weather.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
8 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
9 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
10 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
11 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
12 #include "OutdoorCamera.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
13 #include "LightmapBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
14 #include "DecalBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
15 #include "ParticleEngine.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
16 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
17 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
18 #include "stru6.h"
1263
73269755dd89 arcomage renaming&cleaning
Gloval
parents: 1254
diff changeset
19 #include "FactionTable.h"
0
Ritor1
parents:
diff changeset
20 #include "MapInfo.h"
Ritor1
parents:
diff changeset
21 #include "Game.h"
Ritor1
parents:
diff changeset
22 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
23 #include "GUIFont.h"
Ritor1
parents:
diff changeset
24 #include "GUIProgressBar.h"
Ritor1
parents:
diff changeset
25 #include "Party.h"
Ritor1
parents:
diff changeset
26 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
27 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1264
diff changeset
28 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
29 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
30 #include "Overlays.h"
Ritor1
parents:
diff changeset
31 #include "LOD.h"
Ritor1
parents:
diff changeset
32 #include "Actor.h"
Ritor1
parents:
diff changeset
33 #include "Allocator.h"
Ritor1
parents:
diff changeset
34 #include "Events.h"
Ritor1
parents:
diff changeset
35 #include "Viewport.h"
Ritor1
parents:
diff changeset
36 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
37 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
38 #include "ObjectList.h"
Ritor1
parents:
diff changeset
39 #include "PaletteManager.h"
Ritor1
parents:
diff changeset
40 #include "DecorationList.h"
Ritor1
parents:
diff changeset
41 #include "stru123.h"
Ritor1
parents:
diff changeset
42 #include "Time.h"
Ritor1
parents:
diff changeset
43 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
44 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
45 #include "stru220.h"
Ritor1
parents:
diff changeset
46 #include "Events2D.h"
Ritor1
parents:
diff changeset
47 #include "stru176.h"
Ritor1
parents:
diff changeset
48 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 185
diff changeset
49 #include "texts.h"
0
Ritor1
parents:
diff changeset
50 #include "Log.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
51 #include "Lights.h"
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
52
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
53 #include "MM7.h"
0
Ritor1
parents:
diff changeset
54
Ritor1
parents:
diff changeset
55 //----- (0046E44E) --------------------------------------------------------
Ritor1
parents:
diff changeset
56 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
Ritor1
parents:
diff changeset
57 {
717
Ritor1
parents: 688
diff changeset
58 BLVSector *pSector; // edi@1
0
Ritor1
parents:
diff changeset
59 signed int v2; // ebx@1
717
Ritor1
parents: 688
diff changeset
60 BLVFace *pFace; // esi@2
Ritor1
parents: 688
diff changeset
61 __int16 pNextSector; // si@10
Ritor1
parents: 688
diff changeset
62 int pArrayNum; // ecx@12
0
Ritor1
parents:
diff changeset
63 unsigned __int8 v6; // sf@12
Ritor1
parents:
diff changeset
64 unsigned __int8 v7; // of@12
Ritor1
parents:
diff changeset
65 int result; // eax@14
717
Ritor1
parents: 688
diff changeset
66 //BLVSector *v9; // ebx@15
0
Ritor1
parents:
diff changeset
67 int v10; // ecx@15
717
Ritor1
parents: 688
diff changeset
68 int pFloor; // eax@16
Ritor1
parents: 688
diff changeset
69 //BLVFace *v12; // ebp@16
0
Ritor1
parents:
diff changeset
70 int v13; // eax@24
Ritor1
parents:
diff changeset
71 int v14; // esi@24
Ritor1
parents:
diff changeset
72 int v15; // eax@24
Ritor1
parents:
diff changeset
73 int v16; // edx@25
Ritor1
parents:
diff changeset
74 int v17; // eax@29
Ritor1
parents:
diff changeset
75 unsigned int v18; // eax@33
Ritor1
parents:
diff changeset
76 int v19; // eax@35
Ritor1
parents:
diff changeset
77 int v20; // edx@35
Ritor1
parents:
diff changeset
78 int v21; // eax@35
Ritor1
parents:
diff changeset
79 int v22; // ecx@36
Ritor1
parents:
diff changeset
80 int v23; // eax@40
Ritor1
parents:
diff changeset
81 unsigned int v24; // eax@44
Ritor1
parents:
diff changeset
82 int a3; // [sp+10h] [bp-48h]@28
Ritor1
parents:
diff changeset
83 int v26; // [sp+14h] [bp-44h]@15
Ritor1
parents:
diff changeset
84 int i; // [sp+18h] [bp-40h]@1
Ritor1
parents:
diff changeset
85 int a10; // [sp+1Ch] [bp-3Ch]@1
Ritor1
parents:
diff changeset
86 int v29; // [sp+20h] [bp-38h]@14
Ritor1
parents:
diff changeset
87 int v30; // [sp+24h] [bp-34h]@35
Ritor1
parents:
diff changeset
88 int v31; // [sp+28h] [bp-30h]@24
Ritor1
parents:
diff changeset
89 int v32; // [sp+2Ch] [bp-2Ch]@15
717
Ritor1
parents: 688
diff changeset
90 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
Ritor1
parents: 688
diff changeset
91
Ritor1
parents: 688
diff changeset
92 pSector = &pIndoor->pSectors[stru_721530.uSectorID];
0
Ritor1
parents:
diff changeset
93 v2 = 0;
Ritor1
parents:
diff changeset
94 a10 = b1;
717
Ritor1
parents: 688
diff changeset
95 pSectorsArray[0] = stru_721530.uSectorID;
Ritor1
parents: 688
diff changeset
96 for ( i = 1; v2 < pSector->uNumPortals; ++v2 )
Ritor1
parents: 688
diff changeset
97 {
Ritor1
parents: 688
diff changeset
98 pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
Ritor1
parents: 688
diff changeset
99 if ( stru_721530.sMaxX <= pFace->pBounding.x2
Ritor1
parents: 688
diff changeset
100 && stru_721530.sMinX >= pFace->pBounding.x1
Ritor1
parents: 688
diff changeset
101 && stru_721530.sMaxY <= pFace->pBounding.y2
Ritor1
parents: 688
diff changeset
102 && stru_721530.sMinY >= pFace->pBounding.y1
Ritor1
parents: 688
diff changeset
103 && stru_721530.sMaxZ <= pFace->pBounding.z2
Ritor1
parents: 688
diff changeset
104 && stru_721530.sMinZ >= pFace->pBounding.z1
Ritor1
parents: 688
diff changeset
105 && abs((pFace->pFacePlane_old.dist
Ritor1
parents: 688
diff changeset
106 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 688
diff changeset
107 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 688
diff changeset
108 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
Ritor1
parents: 688
diff changeset
109 {
Ritor1
parents: 688
diff changeset
110 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
Ritor1
parents: 688
diff changeset
111 pArrayNum = i++;
Ritor1
parents: 688
diff changeset
112 v7 = i < 10;
0
Ritor1
parents:
diff changeset
113 v6 = i - 10 < 0;
717
Ritor1
parents: 688
diff changeset
114 pSectorsArray[pArrayNum] = pNextSector;
0
Ritor1
parents:
diff changeset
115 if ( !(v6 ^ v7) )
Ritor1
parents:
diff changeset
116 break;
Ritor1
parents:
diff changeset
117 }
Ritor1
parents:
diff changeset
118 }
Ritor1
parents:
diff changeset
119 result = 0;
Ritor1
parents:
diff changeset
120 v29 = 0;
Ritor1
parents:
diff changeset
121 if ( i > 0 )
Ritor1
parents:
diff changeset
122 {
Ritor1
parents:
diff changeset
123 while ( 1 )
Ritor1
parents:
diff changeset
124 {
717
Ritor1
parents: 688
diff changeset
125 pSector = &pIndoor->pSectors[pSectorsArray[result]];
0
Ritor1
parents:
diff changeset
126 v10 = 0;
717
Ritor1
parents: 688
diff changeset
127 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
0
Ritor1
parents:
diff changeset
128 v26 = 0;
Ritor1
parents:
diff changeset
129 if ( v32 > 0 )
Ritor1
parents:
diff changeset
130 break;
Ritor1
parents:
diff changeset
131 LABEL_46:
Ritor1
parents:
diff changeset
132 result = v29++ + 1;
Ritor1
parents:
diff changeset
133 if ( v29 >= i )
Ritor1
parents:
diff changeset
134 return result;
Ritor1
parents:
diff changeset
135 }
Ritor1
parents:
diff changeset
136 while ( 1 )
Ritor1
parents:
diff changeset
137 {
717
Ritor1
parents: 688
diff changeset
138 pFloor = pSector->pFloors[v10];
Ritor1
parents: 688
diff changeset
139 pFace = &pIndoor->pFaces[pFloor];
Ritor1
parents: 688
diff changeset
140 if ( pFace->Portal()
Ritor1
parents: 688
diff changeset
141 || stru_721530.sMaxX > pFace->pBounding.x2
Ritor1
parents: 688
diff changeset
142 || stru_721530.sMinX < pFace->pBounding.x1
Ritor1
parents: 688
diff changeset
143 || stru_721530.sMaxY > pFace->pBounding.y2
Ritor1
parents: 688
diff changeset
144 || stru_721530.sMinY < pFace->pBounding.y1
Ritor1
parents: 688
diff changeset
145 || stru_721530.sMaxZ > pFace->pBounding.z2
Ritor1
parents: 688
diff changeset
146 || stru_721530.sMinZ < pFace->pBounding.z1
Ritor1
parents: 688
diff changeset
147 || pFloor == stru_721530.field_84 )
0
Ritor1
parents:
diff changeset
148 goto LABEL_45;
717
Ritor1
parents: 688
diff changeset
149 v13 = pFace->pFacePlane_old.vNormal.y;
Ritor1
parents: 688
diff changeset
150 v14 = pFace->pFacePlane_old.dist;
0
Ritor1
parents:
diff changeset
151 v31 = v13;
717
Ritor1
parents: 688
diff changeset
152 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13
Ritor1
parents: 688
diff changeset
153 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16;
0
Ritor1
parents:
diff changeset
154 if ( v15 > 0 )
Ritor1
parents:
diff changeset
155 {
717
Ritor1
parents: 688
diff changeset
156 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z
Ritor1
parents: 688
diff changeset
157 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16;
0
Ritor1
parents:
diff changeset
158 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
159 {
Ritor1
parents:
diff changeset
160 if ( v16 <= v15 )
Ritor1
parents:
diff changeset
161 {
Ritor1
parents:
diff changeset
162 a3 = stru_721530.field_6C;
717
Ritor1
parents: 688
diff changeset
163 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
Ritor1
parents: 688
diff changeset
164 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
165 {
Ritor1
parents:
diff changeset
166 v17 = a3;
Ritor1
parents:
diff changeset
167 }
Ritor1
parents:
diff changeset
168 else
Ritor1
parents:
diff changeset
169 {
Ritor1
parents:
diff changeset
170 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
717
Ritor1
parents: 688
diff changeset
171 if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) )
0
Ritor1
parents:
diff changeset
172 goto LABEL_34;
Ritor1
parents:
diff changeset
173 v17 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
174 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
175 }
Ritor1
parents:
diff changeset
176 if ( v17 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
177 {
Ritor1
parents:
diff changeset
178 stru_721530.field_7C = v17;
717
Ritor1
parents: 688
diff changeset
179 v18 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
180 LOBYTE(v18) = v18 | 6;
Ritor1
parents:
diff changeset
181 stru_721530.uFaceID = v18;
Ritor1
parents:
diff changeset
182 }
Ritor1
parents:
diff changeset
183 }
Ritor1
parents:
diff changeset
184 }
Ritor1
parents:
diff changeset
185 }
Ritor1
parents:
diff changeset
186 LABEL_34:
Ritor1
parents:
diff changeset
187 if ( !(stru_721530.field_0 & 1)
717
Ritor1
parents: 688
diff changeset
188 || (v19 = pFace->pFacePlane_old.vNormal.x,
Ritor1
parents: 688
diff changeset
189 v20 = pFace->pFacePlane_old.vNormal.y,
0
Ritor1
parents:
diff changeset
190 v30 = v19,
717
Ritor1
parents: 688
diff changeset
191 v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20
Ritor1
parents: 688
diff changeset
192 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16,
0
Ritor1
parents:
diff changeset
193 v21 <= 0)
717
Ritor1
parents: 688
diff changeset
194 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
Ritor1
parents: 688
diff changeset
195 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
0
Ritor1
parents:
diff changeset
196 v21 > stru_721530.prolly_normal_d)
Ritor1
parents:
diff changeset
197 && v22 > stru_721530.prolly_normal_d
Ritor1
parents:
diff changeset
198 || v22 > v21 )
Ritor1
parents:
diff changeset
199 goto LABEL_45;
Ritor1
parents:
diff changeset
200 a3 = stru_721530.field_6C;
717
Ritor1
parents: 688
diff changeset
201 if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z,
Ritor1
parents: 688
diff changeset
202 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 v23 = a3;
Ritor1
parents:
diff changeset
205 goto LABEL_43;
Ritor1
parents:
diff changeset
206 }
Ritor1
parents:
diff changeset
207 a3 = stru_721530.field_6C + stru_721530.field_8;
717
Ritor1
parents: 688
diff changeset
208 if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) )
0
Ritor1
parents:
diff changeset
209 {
Ritor1
parents:
diff changeset
210 v23 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
211 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
212 LABEL_43:
Ritor1
parents:
diff changeset
213 if ( v23 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
214 {
Ritor1
parents:
diff changeset
215 stru_721530.field_7C = v23;
717
Ritor1
parents: 688
diff changeset
216 v24 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
217 LOBYTE(v24) = v24 | 6;
Ritor1
parents:
diff changeset
218 stru_721530.uFaceID = v24;
Ritor1
parents:
diff changeset
219 }
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 LABEL_45:
Ritor1
parents:
diff changeset
222 v10 = v26++ + 1;
Ritor1
parents:
diff changeset
223 if ( v26 >= v32 )
Ritor1
parents:
diff changeset
224 goto LABEL_46;
Ritor1
parents:
diff changeset
225 }
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227 return result;
Ritor1
parents:
diff changeset
228 }
Ritor1
parents:
diff changeset
229 // 46E44E: using guessed type int var_28[10];
Ritor1
parents:
diff changeset
230
Ritor1
parents:
diff changeset
231 //----- (0046E889) --------------------------------------------------------
Ritor1
parents:
diff changeset
232 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0)
Ritor1
parents:
diff changeset
233 {
Ritor1
parents:
diff changeset
234 int result; // eax@1
Ritor1
parents:
diff changeset
235 BSPModel *v2; // ecx@3
Ritor1
parents:
diff changeset
236 int v3; // ebx@9
Ritor1
parents:
diff changeset
237 ODMFace *v4; // eax@11
Ritor1
parents:
diff changeset
238 int v5; // edi@17
Ritor1
parents:
diff changeset
239 int v6; // esi@17
Ritor1
parents:
diff changeset
240 unsigned int v7; // ecx@17
Ritor1
parents:
diff changeset
241 int v8; // eax@19
Ritor1
parents:
diff changeset
242 int v9; // ecx@20
Ritor1
parents:
diff changeset
243 int v10; // eax@24
Ritor1
parents:
diff changeset
244 int v11; // ST18_4@25
Ritor1
parents:
diff changeset
245 int v12; // ST1C_4@25
Ritor1
parents:
diff changeset
246 int v13; // ST0C_4@25
Ritor1
parents:
diff changeset
247 unsigned int v14; // eax@28
Ritor1
parents:
diff changeset
248 int v15; // eax@30
Ritor1
parents:
diff changeset
249 int v16; // ecx@31
Ritor1
parents:
diff changeset
250 unsigned int v17; // eax@36
Ritor1
parents:
diff changeset
251 int v18; // ST18_4@41
Ritor1
parents:
diff changeset
252 int v19; // ST1C_4@41
Ritor1
parents:
diff changeset
253 int v20; // ST0C_4@41
Ritor1
parents:
diff changeset
254 int v21; // eax@42
Ritor1
parents:
diff changeset
255 unsigned int v22; // eax@43
Ritor1
parents:
diff changeset
256 //BLVFace f; // [sp+Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
257 int v24; // [sp+6Ch] [bp-1Ch]@9
Ritor1
parents:
diff changeset
258 int a11; // [sp+70h] [bp-18h]@1
Ritor1
parents:
diff changeset
259 unsigned int v26; // [sp+74h] [bp-14h]@2
Ritor1
parents:
diff changeset
260 unsigned int v27; // [sp+78h] [bp-10h]@10
Ritor1
parents:
diff changeset
261 BSPModel *v28; // [sp+7Ch] [bp-Ch]@3
Ritor1
parents:
diff changeset
262 int a10; // [sp+80h] [bp-8h]@1
Ritor1
parents:
diff changeset
263 int a2; // [sp+84h] [bp-4h]@23
Ritor1
parents:
diff changeset
264
Ritor1
parents:
diff changeset
265 a11 = ecx0;
Ritor1
parents:
diff changeset
266
Ritor1
parents:
diff changeset
267 BLVFace f; // [sp+Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
268 //BLVFace::BLVFace(&f);
Ritor1
parents:
diff changeset
269
Ritor1
parents:
diff changeset
270 result = 0;
Ritor1
parents:
diff changeset
271 a10 = 0;
Ritor1
parents:
diff changeset
272 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
273 {
Ritor1
parents:
diff changeset
274 v26 = 0;
Ritor1
parents:
diff changeset
275 while ( 1 )
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 v2 = &pOutdoor->pBModels[v26 / 0xBC];
Ritor1
parents:
diff changeset
278 v28 = &pOutdoor->pBModels[v26 / 0xBC];
Ritor1
parents:
diff changeset
279 if ( stru_721530.sMaxX <= pOutdoor->pBModels[v26 / 0xBC].sMaxX )
Ritor1
parents:
diff changeset
280 {
Ritor1
parents:
diff changeset
281 if ( stru_721530.sMinX >= v2->sMinX )
Ritor1
parents:
diff changeset
282 {
Ritor1
parents:
diff changeset
283 if ( stru_721530.sMaxY <= v2->sMaxY )
Ritor1
parents:
diff changeset
284 {
Ritor1
parents:
diff changeset
285 if ( stru_721530.sMinY >= v2->sMinY )
Ritor1
parents:
diff changeset
286 {
Ritor1
parents:
diff changeset
287 if ( stru_721530.sMaxZ <= v2->sMaxZ )
Ritor1
parents:
diff changeset
288 {
Ritor1
parents:
diff changeset
289 if ( stru_721530.sMinZ >= v2->sMinZ )
Ritor1
parents:
diff changeset
290 {
Ritor1
parents:
diff changeset
291 v3 = 0;
Ritor1
parents:
diff changeset
292 v24 = v2->uNumFaces;
Ritor1
parents:
diff changeset
293 if ( v24 > 0 )
Ritor1
parents:
diff changeset
294 break;
Ritor1
parents:
diff changeset
295 }
Ritor1
parents:
diff changeset
296 }
Ritor1
parents:
diff changeset
297 }
Ritor1
parents:
diff changeset
298 }
Ritor1
parents:
diff changeset
299 }
Ritor1
parents:
diff changeset
300 }
Ritor1
parents:
diff changeset
301 LABEL_39:
Ritor1
parents:
diff changeset
302 ++a10;
Ritor1
parents:
diff changeset
303 v26 += 188;
Ritor1
parents:
diff changeset
304 result = a10;
Ritor1
parents:
diff changeset
305 if ( a10 >= (signed int)pOutdoor->uNumBModels )
Ritor1
parents:
diff changeset
306 return result;
Ritor1
parents:
diff changeset
307 }
Ritor1
parents:
diff changeset
308 v27 = 0;
Ritor1
parents:
diff changeset
309 while ( 1 )
Ritor1
parents:
diff changeset
310 {
Ritor1
parents:
diff changeset
311 v4 = &v2->pFaces[v27 / 0x134];
Ritor1
parents:
diff changeset
312 if ( stru_721530.sMaxX > v4->pBoundingBox.x2
Ritor1
parents:
diff changeset
313 || stru_721530.sMinX < v4->pBoundingBox.x1
Ritor1
parents:
diff changeset
314 || stru_721530.sMaxY > v4->pBoundingBox.y2
Ritor1
parents:
diff changeset
315 || stru_721530.sMinY < v4->pBoundingBox.y1
Ritor1
parents:
diff changeset
316 || stru_721530.sMaxZ > v4->pBoundingBox.z2
Ritor1
parents:
diff changeset
317 || stru_721530.sMinZ < v4->pBoundingBox.z1 )
Ritor1
parents:
diff changeset
318 goto LABEL_38;
Ritor1
parents:
diff changeset
319 f.pFacePlane_old.vNormal.x = v4->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
320 f.pFacePlane_old.vNormal.y = v4->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
321 v5 = v4->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
322 f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
323 v6 = v4->pFacePlane.dist;
Ritor1
parents:
diff changeset
324 f.pFacePlane_old.dist = v4->pFacePlane.dist;
Ritor1
parents:
diff changeset
325 v7 = v4->uAttributes;
Ritor1
parents:
diff changeset
326 f.uAttributes = v7;
Ritor1
parents:
diff changeset
327 f.pBounding.x1 = v4->pBoundingBox.x1;
Ritor1
parents:
diff changeset
328 f.pBounding.y1 = v4->pBoundingBox.y1;
Ritor1
parents:
diff changeset
329 f.pBounding.z1 = v4->pBoundingBox.z1;
Ritor1
parents:
diff changeset
330 f.pBounding.x2 = v4->pBoundingBox.x2;
Ritor1
parents:
diff changeset
331 f.pBounding.y2 = v4->pBoundingBox.y2;
Ritor1
parents:
diff changeset
332 f.pBounding.z2 = v4->pBoundingBox.z2;
Ritor1
parents:
diff changeset
333 f.zCalc1 = v4->zCalc1;
Ritor1
parents:
diff changeset
334 f.zCalc2 = v4->zCalc2;
Ritor1
parents:
diff changeset
335 f.zCalc3 = v4->zCalc3;
Ritor1
parents:
diff changeset
336 f.pXInterceptDisplacements = v4->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
337 f.pYInterceptDisplacements = v4->pYInterceptDisplacements;
Ritor1
parents:
diff changeset
338 f.pZInterceptDisplacements = v4->pZInterceptDisplacements;
Ritor1
parents:
diff changeset
339 f.uPolygonType = (PolygonType)v4->uPolygonType;
Ritor1
parents:
diff changeset
340 f.uNumVertices = v4->uNumVertices;
Ritor1
parents:
diff changeset
341 f.uBitmapID = v4->uTextureID;
Ritor1
parents:
diff changeset
342 f.pVertexIDs = v4->pVertexIDs;
Ritor1
parents:
diff changeset
343 if ( !(v7 & 0x20000000) )
Ritor1
parents:
diff changeset
344 {
Ritor1
parents:
diff changeset
345 if ( !(v7 & 1) )
Ritor1
parents:
diff changeset
346 break;
Ritor1
parents:
diff changeset
347 }
Ritor1
parents:
diff changeset
348 LABEL_37:
Ritor1
parents:
diff changeset
349 v2 = v28;
Ritor1
parents:
diff changeset
350 LABEL_38:
Ritor1
parents:
diff changeset
351 v27 += 308;
Ritor1
parents:
diff changeset
352 ++v3;
Ritor1
parents:
diff changeset
353 if ( v3 >= v24 )
Ritor1
parents:
diff changeset
354 goto LABEL_39;
Ritor1
parents:
diff changeset
355 }
Ritor1
parents:
diff changeset
356 v8 = (v5 * stru_721530.normal.z
Ritor1
parents:
diff changeset
357 + v6
Ritor1
parents:
diff changeset
358 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y
Ritor1
parents:
diff changeset
359 + f.pFacePlane_old.vNormal.x * stru_721530.normal.x) >> 16;
Ritor1
parents:
diff changeset
360 if ( v8 > 0 )
Ritor1
parents:
diff changeset
361 {
Ritor1
parents:
diff changeset
362 v9 = (v5 * stru_721530.normal2.z
Ritor1
parents:
diff changeset
363 + v6
Ritor1
parents:
diff changeset
364 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y
Ritor1
parents:
diff changeset
365 + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x) >> 16;
Ritor1
parents:
diff changeset
366 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
367 {
Ritor1
parents:
diff changeset
368 if ( v9 <= v8 )
Ritor1
parents:
diff changeset
369 {
Ritor1
parents:
diff changeset
370 a2 = stru_721530.field_6C;
Ritor1
parents:
diff changeset
371 if ( sub_4754BF(
Ritor1
parents:
diff changeset
372 stru_721530.prolly_normal_d,
Ritor1
parents:
diff changeset
373 &a2,
Ritor1
parents:
diff changeset
374 stru_721530.normal.x,
Ritor1
parents:
diff changeset
375 stru_721530.normal.y,
Ritor1
parents:
diff changeset
376 stru_721530.normal.z,
Ritor1
parents:
diff changeset
377 stru_721530.field_58.x,
Ritor1
parents:
diff changeset
378 stru_721530.field_58.y,
Ritor1
parents:
diff changeset
379 stru_721530.field_58.z,
Ritor1
parents:
diff changeset
380 &f,
Ritor1
parents:
diff changeset
381 a10,
Ritor1
parents:
diff changeset
382 a11) )
Ritor1
parents:
diff changeset
383 {
Ritor1
parents:
diff changeset
384 v10 = a2;
Ritor1
parents:
diff changeset
385 }
Ritor1
parents:
diff changeset
386 else
Ritor1
parents:
diff changeset
387 {
Ritor1
parents:
diff changeset
388 v11 = stru_721530.field_58.y;
Ritor1
parents:
diff changeset
389 v12 = stru_721530.field_58.z;
Ritor1
parents:
diff changeset
390 v13 = stru_721530.normal.y;
Ritor1
parents:
diff changeset
391 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C;
Ritor1
parents:
diff changeset
392 if ( !sub_475F30(
Ritor1
parents:
diff changeset
393 &a2,
Ritor1
parents:
diff changeset
394 &f,
Ritor1
parents:
diff changeset
395 stru_721530.normal.x,
Ritor1
parents:
diff changeset
396 v13,
Ritor1
parents:
diff changeset
397 stru_721530.normal.z,
Ritor1
parents:
diff changeset
398 stru_721530.field_58.x,
Ritor1
parents:
diff changeset
399 v11,
Ritor1
parents:
diff changeset
400 v12,
Ritor1
parents:
diff changeset
401 a10) )
Ritor1
parents:
diff changeset
402 goto LABEL_29;
Ritor1
parents:
diff changeset
403 v10 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
404 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
405 }
Ritor1
parents:
diff changeset
406 if ( v10 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
407 {
Ritor1
parents:
diff changeset
408 stru_721530.field_7C = v10;
Ritor1
parents:
diff changeset
409 v14 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
410 LOBYTE(v14) = v14 | 6;
Ritor1
parents:
diff changeset
411 stru_721530.uFaceID = v14;
Ritor1
parents:
diff changeset
412 }
Ritor1
parents:
diff changeset
413 }
Ritor1
parents:
diff changeset
414 }
Ritor1
parents:
diff changeset
415 }
Ritor1
parents:
diff changeset
416 LABEL_29:
Ritor1
parents:
diff changeset
417 if ( stru_721530.field_0 & 1 )
Ritor1
parents:
diff changeset
418 {
Ritor1
parents:
diff changeset
419 v15 = (f.pFacePlane_old.vNormal.z * stru_721530.field_34.z
Ritor1
parents:
diff changeset
420 + f.pFacePlane_old.dist
Ritor1
parents:
diff changeset
421 + f.pFacePlane_old.vNormal.y * stru_721530.field_34.y
Ritor1
parents:
diff changeset
422 + f.pFacePlane_old.vNormal.x * stru_721530.field_34.x) >> 16;
Ritor1
parents:
diff changeset
423 if ( v15 > 0 )
Ritor1
parents:
diff changeset
424 {
Ritor1
parents:
diff changeset
425 v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54
Ritor1
parents:
diff changeset
426 + f.pFacePlane_old.dist
Ritor1
parents:
diff changeset
427 + f.pFacePlane_old.vNormal.y * stru_721530.field_50
Ritor1
parents:
diff changeset
428 + f.pFacePlane_old.vNormal.x * stru_721530.field_4C) >> 16;
Ritor1
parents:
diff changeset
429 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
430 {
Ritor1
parents:
diff changeset
431 if ( v16 <= v15 )
Ritor1
parents:
diff changeset
432 {
Ritor1
parents:
diff changeset
433 a2 = stru_721530.field_6C;
Ritor1
parents:
diff changeset
434 if ( sub_4754BF(
Ritor1
parents:
diff changeset
435 stru_721530.field_8,
Ritor1
parents:
diff changeset
436 &a2,
Ritor1
parents:
diff changeset
437 stru_721530.field_34.x,
Ritor1
parents:
diff changeset
438 stru_721530.field_34.y,
Ritor1
parents:
diff changeset
439 stru_721530.field_34.z,
Ritor1
parents:
diff changeset
440 stru_721530.field_58.x,
Ritor1
parents:
diff changeset
441 stru_721530.field_58.y,
Ritor1
parents:
diff changeset
442 stru_721530.field_58.z,
Ritor1
parents:
diff changeset
443 &f,
Ritor1
parents:
diff changeset
444 a10,
Ritor1
parents:
diff changeset
445 a11) )
Ritor1
parents:
diff changeset
446 {
Ritor1
parents:
diff changeset
447 if ( a2 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
448 {
Ritor1
parents:
diff changeset
449 stru_721530.field_7C = a2;
Ritor1
parents:
diff changeset
450 v17 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
451 LOBYTE(v17) = v17 | 6;
Ritor1
parents:
diff changeset
452 stru_721530.uFaceID = v17;
Ritor1
parents:
diff changeset
453 }
Ritor1
parents:
diff changeset
454 }
Ritor1
parents:
diff changeset
455 else
Ritor1
parents:
diff changeset
456 {
Ritor1
parents:
diff changeset
457 v18 = stru_721530.field_58.y;
Ritor1
parents:
diff changeset
458 v19 = stru_721530.field_58.z;
Ritor1
parents:
diff changeset
459 v20 = stru_721530.field_34.y;
Ritor1
parents:
diff changeset
460 a2 = stru_721530.field_6C + stru_721530.field_8;
Ritor1
parents:
diff changeset
461 if ( sub_475F30(
Ritor1
parents:
diff changeset
462 &a2,
Ritor1
parents:
diff changeset
463 &f,
Ritor1
parents:
diff changeset
464 stru_721530.field_34.x,
Ritor1
parents:
diff changeset
465 v20,
Ritor1
parents:
diff changeset
466 stru_721530.field_34.z,
Ritor1
parents:
diff changeset
467 stru_721530.field_58.x,
Ritor1
parents:
diff changeset
468 v18,
Ritor1
parents:
diff changeset
469 v19,
Ritor1
parents:
diff changeset
470 a10) )
Ritor1
parents:
diff changeset
471 {
Ritor1
parents:
diff changeset
472 v2 = v28;
Ritor1
parents:
diff changeset
473 v21 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
474 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
475 if ( a2 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
476 {
Ritor1
parents:
diff changeset
477 stru_721530.field_7C = v21;
Ritor1
parents:
diff changeset
478 v22 = 8 * (v3 | (a10 << 6));
Ritor1
parents:
diff changeset
479 LOBYTE(v22) = v22 | 6;
Ritor1
parents:
diff changeset
480 stru_721530.uFaceID = v22;
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482 goto LABEL_38;
Ritor1
parents:
diff changeset
483 }
Ritor1
parents:
diff changeset
484 }
Ritor1
parents:
diff changeset
485 }
Ritor1
parents:
diff changeset
486 }
Ritor1
parents:
diff changeset
487 }
Ritor1
parents:
diff changeset
488 }
Ritor1
parents:
diff changeset
489 goto LABEL_37;
Ritor1
parents:
diff changeset
490 }
Ritor1
parents:
diff changeset
491 return result;
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493
Ritor1
parents:
diff changeset
494 //----- (0046ED1B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
495 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
496 {
Ritor1
parents:
diff changeset
497 uint uFaceID = -1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
498 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
499
Ritor1
parents:
diff changeset
500 if (floor_level != -30000 && floor_level <= z + 50)
Ritor1
parents:
diff changeset
501 {
Ritor1
parents:
diff changeset
502 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
503 return floor_level;
Ritor1
parents:
diff changeset
504 }
Ritor1
parents:
diff changeset
505
Ritor1
parents:
diff changeset
506 uint uSectorID = pIndoor->GetSector(x, y, z);
Ritor1
parents:
diff changeset
507 *pSectorID = uSectorID;
Ritor1
parents:
diff changeset
508
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
509 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
510 if (uSectorID && floor_level != -30000)
Ritor1
parents:
diff changeset
511 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
512 else return -30000;
Ritor1
parents:
diff changeset
513 return floor_level;
Ritor1
parents:
diff changeset
514 }
Ritor1
parents:
diff changeset
515
Ritor1
parents:
diff changeset
516 //----- (0046ED8A) --------------------------------------------------------
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
517 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this)
0
Ritor1
parents:
diff changeset
518 {
Ritor1
parents:
diff changeset
519 int v1; // ebx@2
Ritor1
parents:
diff changeset
520 ObjectDesc *v2; // edx@4
Ritor1
parents:
diff changeset
521 int v3; // esi@5
Ritor1
parents:
diff changeset
522 int v4; // ecx@5
Ritor1
parents:
diff changeset
523 int v5; // eax@7
Ritor1
parents:
diff changeset
524 int v6; // edi@9
Ritor1
parents:
diff changeset
525 int v7; // edx@9
Ritor1
parents:
diff changeset
526 int v8; // edi@11
Ritor1
parents:
diff changeset
527 int v9; // ebx@11
Ritor1
parents:
diff changeset
528 int v10; // ecx@12
Ritor1
parents:
diff changeset
529 int v11; // esi@13
Ritor1
parents:
diff changeset
530 signed int v12; // [sp+0h] [bp-14h]@1
Ritor1
parents:
diff changeset
531 int v13; // [sp+4h] [bp-10h]@9
Ritor1
parents:
diff changeset
532 char *v14; // [sp+8h] [bp-Ch]@2
Ritor1
parents:
diff changeset
533 unsigned int v15; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
534
Ritor1
parents:
diff changeset
535 v15 = 0;
Ritor1
parents:
diff changeset
536 v12 = _this;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
537 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
538 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
539 v1 = (int)&pSpriteObjects[0].uObjectDescID;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
540 v14 = (char *)&pSpriteObjects[0].uObjectDescID;
0
Ritor1
parents:
diff changeset
541 do
Ritor1
parents:
diff changeset
542 {
Ritor1
parents:
diff changeset
543 if ( *(short *)v1 )
Ritor1
parents:
diff changeset
544 {
Ritor1
parents:
diff changeset
545 v2 = &pObjectList->pObjects[*(short *)v1];
Ritor1
parents:
diff changeset
546 if ( !(v2->uFlags & 2) )
Ritor1
parents:
diff changeset
547 {
Ritor1
parents:
diff changeset
548 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
549 v4 = *(int *)(v1 + 2);
Ritor1
parents:
diff changeset
550 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
551 {
Ritor1
parents:
diff changeset
552 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
553 {
Ritor1
parents:
diff changeset
554 v5 = *(int *)(v1 + 6);
Ritor1
parents:
diff changeset
555 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
556 {
Ritor1
parents:
diff changeset
557 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
558 {
Ritor1
parents:
diff changeset
559 v6 = v2->uHeight;
Ritor1
parents:
diff changeset
560 v7 = *(int *)(v1 + 10);
Ritor1
parents:
diff changeset
561 v13 = v6;
Ritor1
parents:
diff changeset
562 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
563 {
Ritor1
parents:
diff changeset
564 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
565 {
Ritor1
parents:
diff changeset
566 v8 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
567 v9 = v5 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
568 if ( abs(((v4 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
569 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16) <= v3
Ritor1
parents:
diff changeset
570 + stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
571 {
Ritor1
parents:
diff changeset
572 v10 = (v8 * stru_721530.field_58.x + v9 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
573 if ( v10 > 0 )
Ritor1
parents:
diff changeset
574 {
Ritor1
parents:
diff changeset
575 v11 = stru_721530.normal.z
Ritor1
parents:
diff changeset
576 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v10) >> 16);
Ritor1
parents:
diff changeset
577 if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) )
Ritor1
parents:
diff changeset
580 {
Ritor1
parents:
diff changeset
581 if ( v10 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
582 sub_46DEF2(v12, v15);
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 }
Ritor1
parents:
diff changeset
588 }
Ritor1
parents:
diff changeset
589 }
Ritor1
parents:
diff changeset
590 }
Ritor1
parents:
diff changeset
591 }
Ritor1
parents:
diff changeset
592 }
Ritor1
parents:
diff changeset
593 }
Ritor1
parents:
diff changeset
594 }
Ritor1
parents:
diff changeset
595 ++v15;
Ritor1
parents:
diff changeset
596 v1 = (int)(v14 + 112);
Ritor1
parents:
diff changeset
597 v14 += 112;
Ritor1
parents:
diff changeset
598 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
599 while ( (signed int)v15 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
600 }
Ritor1
parents:
diff changeset
601 }
Ritor1
parents:
diff changeset
602
Ritor1
parents:
diff changeset
603 //----- (0046EF01) --------------------------------------------------------
Ritor1
parents:
diff changeset
604 int __thiscall _46EF01_collision_chech_player(int a1)
Ritor1
parents:
diff changeset
605 {
Ritor1
parents:
diff changeset
606 int v1; // edx@1
Ritor1
parents:
diff changeset
607 int result; // eax@1
Ritor1
parents:
diff changeset
608 int v3; // ebx@7
Ritor1
parents:
diff changeset
609 int v4; // esi@7
Ritor1
parents:
diff changeset
610 int v5; // edi@8
Ritor1
parents:
diff changeset
611 int v6; // ecx@9
Ritor1
parents:
diff changeset
612 int v7; // edi@12
Ritor1
parents:
diff changeset
613 int v8; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
614 unsigned int v9; // [sp+10h] [bp-Ch]@1
Ritor1
parents:
diff changeset
615 int v10; // [sp+14h] [bp-8h]@7
Ritor1
parents:
diff changeset
616 int v11; // [sp+18h] [bp-4h]@7
Ritor1
parents:
diff changeset
617
Ritor1
parents:
diff changeset
618 v8 = a1;
Ritor1
parents:
diff changeset
619 v1 = 2 * pParty->field_14;
Ritor1
parents:
diff changeset
620 result = pParty->vPosition.x;
Ritor1
parents:
diff changeset
621 v9 = pParty->uPartyHeight;
Ritor1
parents:
diff changeset
622 if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14 )
Ritor1
parents:
diff changeset
623 {
Ritor1
parents:
diff changeset
624 if ( stru_721530.sMinX >= pParty->vPosition.x - v1 )
Ritor1
parents:
diff changeset
625 {
Ritor1
parents:
diff changeset
626 if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 )
Ritor1
parents:
diff changeset
627 {
Ritor1
parents:
diff changeset
628 if ( stru_721530.sMinY >= pParty->vPosition.y - v1 )
Ritor1
parents:
diff changeset
629 {
Ritor1
parents:
diff changeset
630 if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) )
Ritor1
parents:
diff changeset
631 {
Ritor1
parents:
diff changeset
632 if ( stru_721530.sMinZ >= pParty->vPosition.z )
Ritor1
parents:
diff changeset
633 {
Ritor1
parents:
diff changeset
634 v3 = stru_721530.prolly_normal_d + v1;
Ritor1
parents:
diff changeset
635 v11 = pParty->vPosition.x - stru_721530.normal.x;
Ritor1
parents:
diff changeset
636 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
637 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
638 v10 = pParty->vPosition.y - stru_721530.normal.y;
Ritor1
parents:
diff changeset
639 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
640 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16);
Ritor1
parents:
diff changeset
641 if ( result <= v3 )
Ritor1
parents:
diff changeset
642 {
Ritor1
parents:
diff changeset
643 result = v10 * stru_721530.field_58.y;
Ritor1
parents:
diff changeset
644 v5 = (v10 * stru_721530.field_58.y + v11 * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
645 if ( v5 > 0 )
Ritor1
parents:
diff changeset
646 {
Ritor1
parents:
diff changeset
647 v6 = ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
Ritor1
parents:
diff changeset
648 result = pParty->vPosition.z;
Ritor1
parents:
diff changeset
649 if ( v6 >= pParty->vPosition.z )
Ritor1
parents:
diff changeset
650 {
Ritor1
parents:
diff changeset
651 result = v9 + pParty->vPosition.z;
Ritor1
parents:
diff changeset
652 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 )
Ritor1
parents:
diff changeset
653 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
654 result = integer_sqrt(v3 * v3 - v4 * v4);
0
Ritor1
parents:
diff changeset
655 v7 = v5 - result;
Ritor1
parents:
diff changeset
656 if ( v7 < 0 )
Ritor1
parents:
diff changeset
657 v7 = 0;
Ritor1
parents:
diff changeset
658 if ( v7 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
659 {
Ritor1
parents:
diff changeset
660 stru_721530.field_7C = v7;
Ritor1
parents:
diff changeset
661 stru_721530.uFaceID = 4;
Ritor1
parents:
diff changeset
662 }
Ritor1
parents:
diff changeset
663 }
Ritor1
parents:
diff changeset
664 }
Ritor1
parents:
diff changeset
665 }
Ritor1
parents:
diff changeset
666 }
Ritor1
parents:
diff changeset
667 }
Ritor1
parents:
diff changeset
668 }
Ritor1
parents:
diff changeset
669 }
Ritor1
parents:
diff changeset
670 }
Ritor1
parents:
diff changeset
671 }
Ritor1
parents:
diff changeset
672 }
Ritor1
parents:
diff changeset
673 return result;
Ritor1
parents:
diff changeset
674 }
Ritor1
parents:
diff changeset
675
Ritor1
parents:
diff changeset
676 //----- (0046F04E) --------------------------------------------------------
Ritor1
parents:
diff changeset
677 signed int __cdecl _46F04E_collide_against_portals()
Ritor1
parents:
diff changeset
678 {
Ritor1
parents:
diff changeset
679 BLVSector *v0; // ecx@1
Ritor1
parents:
diff changeset
680 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
681 int v2; // eax@2
Ritor1
parents:
diff changeset
682 BLVFace *v3; // eax@3
Ritor1
parents:
diff changeset
683 int v4; // ecx@9
Ritor1
parents:
diff changeset
684 int v5; // edx@9
Ritor1
parents:
diff changeset
685 signed int result; // eax@21
Ritor1
parents:
diff changeset
686 BLVFace *v7; // eax@22
Ritor1
parents:
diff changeset
687 signed int v8; // [sp+0h] [bp-14h]@1
Ritor1
parents:
diff changeset
688 BLVSector *v9; // [sp+4h] [bp-10h]@1
Ritor1
parents:
diff changeset
689 unsigned int v10; // [sp+8h] [bp-Ch]@1
Ritor1
parents:
diff changeset
690 int a3; // [sp+Ch] [bp-8h]@13
Ritor1
parents:
diff changeset
691 int v12; // [sp+10h] [bp-4h]@15
Ritor1
parents:
diff changeset
692
Ritor1
parents:
diff changeset
693 v8 = 0;
Ritor1
parents:
diff changeset
694 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
695 v1 = 0xFFFFFFu;
Ritor1
parents:
diff changeset
696 v10 = 0xFFFFFFu;
Ritor1
parents:
diff changeset
697 v9 = v0;
Ritor1
parents:
diff changeset
698 if ( v0->uNumPortals > 0 )
Ritor1
parents:
diff changeset
699 {
Ritor1
parents:
diff changeset
700 do
Ritor1
parents:
diff changeset
701 {
Ritor1
parents:
diff changeset
702 v2 = v0->pPortals[v8];
Ritor1
parents:
diff changeset
703 if ( v2 != stru_721530.field_80 )
Ritor1
parents:
diff changeset
704 {
Ritor1
parents:
diff changeset
705 v3 = &pIndoor->pFaces[v2];
Ritor1
parents:
diff changeset
706 if ( stru_721530.sMaxX <= v3->pBounding.x2 )
Ritor1
parents:
diff changeset
707 {
Ritor1
parents:
diff changeset
708 if ( stru_721530.sMinX >= v3->pBounding.x1
Ritor1
parents:
diff changeset
709 && stru_721530.sMaxY <= v3->pBounding.y2
Ritor1
parents:
diff changeset
710 && stru_721530.sMinY >= v3->pBounding.y1
Ritor1
parents:
diff changeset
711 && stru_721530.sMaxZ <= v3->pBounding.z2
Ritor1
parents:
diff changeset
712 && stru_721530.sMinZ >= v3->pBounding.z1 )
Ritor1
parents:
diff changeset
713 {
Ritor1
parents:
diff changeset
714 v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
715 + v3->pFacePlane_old.dist
Ritor1
parents:
diff changeset
716 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
717 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
718 v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
719 + v3->pFacePlane_old.dist
Ritor1
parents:
diff changeset
720 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
721 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
722 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d)
Ritor1
parents:
diff changeset
723 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d)
Ritor1
parents:
diff changeset
724 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v3))
Ritor1
parents:
diff changeset
725 && a3 < (signed int)v10 )
Ritor1
parents:
diff changeset
726 {
Ritor1
parents:
diff changeset
727 v0 = v9;
Ritor1
parents:
diff changeset
728 v10 = a3;
Ritor1
parents:
diff changeset
729 v12 = v9->pPortals[v8];
Ritor1
parents:
diff changeset
730 }
Ritor1
parents:
diff changeset
731 else
Ritor1
parents:
diff changeset
732 {
Ritor1
parents:
diff changeset
733 v0 = v9;
Ritor1
parents:
diff changeset
734 }
Ritor1
parents:
diff changeset
735 }
Ritor1
parents:
diff changeset
736 }
Ritor1
parents:
diff changeset
737 }
Ritor1
parents:
diff changeset
738 ++v8;
Ritor1
parents:
diff changeset
739 }
Ritor1
parents:
diff changeset
740 while ( v8 < v0->uNumPortals );
Ritor1
parents:
diff changeset
741 v1 = v10;
Ritor1
parents:
diff changeset
742 }
Ritor1
parents:
diff changeset
743 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C )
Ritor1
parents:
diff changeset
744 {
Ritor1
parents:
diff changeset
745 stru_721530.field_80 = v12;
Ritor1
parents:
diff changeset
746 v7 = &pIndoor->pFaces[v12];
Ritor1
parents:
diff changeset
747 if ( v7->uSectorID == stru_721530.uSectorID )
Ritor1
parents:
diff changeset
748 stru_721530.uSectorID = v7->uBackSectorID;
Ritor1
parents:
diff changeset
749 else
Ritor1
parents:
diff changeset
750 stru_721530.uSectorID = v7->uSectorID;
Ritor1
parents:
diff changeset
751 stru_721530.field_7C = 268435455;
Ritor1
parents:
diff changeset
752 result = 0;
Ritor1
parents:
diff changeset
753 }
Ritor1
parents:
diff changeset
754 else
Ritor1
parents:
diff changeset
755 {
Ritor1
parents:
diff changeset
756 result = 1;
Ritor1
parents:
diff changeset
757 }
Ritor1
parents:
diff changeset
758 return result;
Ritor1
parents:
diff changeset
759 }
Ritor1
parents:
diff changeset
760
Ritor1
parents:
diff changeset
761 //----- (0047050A) --------------------------------------------------------
Ritor1
parents:
diff changeset
762 int stru141::_47050A(int a2)
Ritor1
parents:
diff changeset
763 {
Ritor1
parents:
diff changeset
764 stru141 *v2; // esi@1
Ritor1
parents:
diff changeset
765 signed int v3; // eax@1
Ritor1
parents:
diff changeset
766 int v4; // ecx@1
Ritor1
parents:
diff changeset
767 int v5; // edx@1
Ritor1
parents:
diff changeset
768 int v6; // edx@1
Ritor1
parents:
diff changeset
769 int v7; // eax@1
Ritor1
parents:
diff changeset
770 int v8; // eax@3
Ritor1
parents:
diff changeset
771 signed int result; // eax@4
Ritor1
parents:
diff changeset
772 int v10; // eax@5
Ritor1
parents:
diff changeset
773 int v11; // eax@5
Ritor1
parents:
diff changeset
774 int v12; // ebx@5
Ritor1
parents:
diff changeset
775 int v13; // edx@5
Ritor1
parents:
diff changeset
776 int v14; // edi@5
Ritor1
parents:
diff changeset
777 int v15; // ecx@5
Ritor1
parents:
diff changeset
778 int v16; // eax@5
Ritor1
parents:
diff changeset
779 int v17; // eax@5
Ritor1
parents:
diff changeset
780 int v18; // eax@7
Ritor1
parents:
diff changeset
781 int v19; // edx@9
Ritor1
parents:
diff changeset
782 int v20; // edi@9
Ritor1
parents:
diff changeset
783 int v21; // eax@9
Ritor1
parents:
diff changeset
784 int v22; // eax@11
Ritor1
parents:
diff changeset
785 int v23; // edx@13
Ritor1
parents:
diff changeset
786 int v24; // eax@13
Ritor1
parents:
diff changeset
787 int v25; // eax@14
Ritor1
parents:
diff changeset
788 int v26; // eax@16
Ritor1
parents:
diff changeset
789 int v27; // eax@17
Ritor1
parents:
diff changeset
790 int v28; // [sp+14h] [bp+8h]@5
Ritor1
parents:
diff changeset
791
Ritor1
parents:
diff changeset
792 v2 = this;
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
793 v3 = integer_sqrt(this->field_24 * this->field_24 + this->field_20 * this->field_20 + this->field_1C * this->field_1C);
0
Ritor1
parents:
diff changeset
794 v4 = v3 | 1;
Ritor1
parents:
diff changeset
795 v5 = v2->field_1C;
Ritor1
parents:
diff changeset
796 v2->field_64 = v3 | 1;
Ritor1
parents:
diff changeset
797 v2->field_58.x = 65536 / (v3 | 1) * v5;
Ritor1
parents:
diff changeset
798 v2->field_58.y = 65536 / (v3 | 1) * v2->field_20;
Ritor1
parents:
diff changeset
799 v6 = 65536 / (v3 | 1) * v2->field_24;
Ritor1
parents:
diff changeset
800 v2->field_68 = 65536 / (v3 | 1);
Ritor1
parents:
diff changeset
801 v7 = a2;
Ritor1
parents:
diff changeset
802 v2->field_58.z = v6;
Ritor1
parents:
diff changeset
803 if ( !a2 )
Ritor1
parents:
diff changeset
804 v7 = pEventTimer->dt_in_some_format;
Ritor1
parents:
diff changeset
805 v8 = ((unsigned __int64)(v7 * (signed __int64)v4) >> 16) - v2->field_70;
Ritor1
parents:
diff changeset
806 v2->field_6C = v8;
Ritor1
parents:
diff changeset
807 if ( v8 > 0 )
Ritor1
parents:
diff changeset
808 {
Ritor1
parents:
diff changeset
809 v10 = ((unsigned __int64)(v8 * (signed __int64)v2->field_58.x) >> 16) + v2->normal.x;
Ritor1
parents:
diff changeset
810 v2->field_4C = v10;
Ritor1
parents:
diff changeset
811 v2->normal2.x = v10;
Ritor1
parents:
diff changeset
812 v11 = ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.y) >> 16) + v2->normal.y;
Ritor1
parents:
diff changeset
813 v2->field_50 = v11;
Ritor1
parents:
diff changeset
814 v2->normal2.y = v11;
Ritor1
parents:
diff changeset
815 v2->normal2.z = ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.z) >> 16) + v2->normal.z;
Ritor1
parents:
diff changeset
816 v12 = v2->field_34.z;
Ritor1
parents:
diff changeset
817 v13 = v2->normal.x;
Ritor1
parents:
diff changeset
818 v14 = v2->normal2.x;
Ritor1
parents:
diff changeset
819 v15 = v2->prolly_normal_d;
Ritor1
parents:
diff changeset
820 v16 = v12 + ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.z) >> 16);
Ritor1
parents:
diff changeset
821 v28 = v16;
Ritor1
parents:
diff changeset
822 v2->field_54 = v16;
Ritor1
parents:
diff changeset
823 v17 = v13;
Ritor1
parents:
diff changeset
824 if ( v13 >= v14 )
Ritor1
parents:
diff changeset
825 v17 = v14;
Ritor1
parents:
diff changeset
826 v2->sMaxX = v17 - v15;
Ritor1
parents:
diff changeset
827 v18 = v15 + v13;
Ritor1
parents:
diff changeset
828 if ( v13 <= v14 )
Ritor1
parents:
diff changeset
829 v18 = v15 + v14;
Ritor1
parents:
diff changeset
830 v19 = v2->normal.y;
Ritor1
parents:
diff changeset
831 v20 = v2->normal2.y;
Ritor1
parents:
diff changeset
832 v2->sMinX = v18;
Ritor1
parents:
diff changeset
833 v21 = v19;
Ritor1
parents:
diff changeset
834 if ( v19 >= v20 )
Ritor1
parents:
diff changeset
835 v21 = v20;
Ritor1
parents:
diff changeset
836 v2->sMaxY = v21 - v15;
Ritor1
parents:
diff changeset
837 v22 = v15 + v19;
Ritor1
parents:
diff changeset
838 if ( v19 <= v20 )
Ritor1
parents:
diff changeset
839 v22 = v20 + v15;
Ritor1
parents:
diff changeset
840 v23 = v2->normal2.z;
Ritor1
parents:
diff changeset
841 v2->sMinY = v22;
Ritor1
parents:
diff changeset
842 v24 = v2->normal.z;
Ritor1
parents:
diff changeset
843 if ( v24 >= v23 )
Ritor1
parents:
diff changeset
844 v25 = v23 - v15;
Ritor1
parents:
diff changeset
845 else
Ritor1
parents:
diff changeset
846 v25 = v24 - v15;
Ritor1
parents:
diff changeset
847 v2->sMaxZ = v25;
Ritor1
parents:
diff changeset
848 v26 = v2->field_8;
Ritor1
parents:
diff changeset
849 if ( v12 <= v28 )
Ritor1
parents:
diff changeset
850 v27 = v28 + v26;
Ritor1
parents:
diff changeset
851 else
Ritor1
parents:
diff changeset
852 v27 = v12 + v26;
Ritor1
parents:
diff changeset
853 v2->uFaceID = 0;
Ritor1
parents:
diff changeset
854 v2->field_80 = -1;
Ritor1
parents:
diff changeset
855 v2->field_88 = -1;
Ritor1
parents:
diff changeset
856 v2->sMinZ = v27;
Ritor1
parents:
diff changeset
857 v2->field_7C = 0xFFFFFFu;
Ritor1
parents:
diff changeset
858 result = 0;
Ritor1
parents:
diff changeset
859 }
Ritor1
parents:
diff changeset
860 else
Ritor1
parents:
diff changeset
861 {
Ritor1
parents:
diff changeset
862 result = 1;
Ritor1
parents:
diff changeset
863 }
Ritor1
parents:
diff changeset
864 return result;
Ritor1
parents:
diff changeset
865 }
Ritor1
parents:
diff changeset
866
Ritor1
parents:
diff changeset
867 //----- (004706C6) --------------------------------------------------------
Ritor1
parents:
diff changeset
868 void __cdecl UpdateActors_ODM()
Ritor1
parents:
diff changeset
869 {
Ritor1
parents:
diff changeset
870 Actor *v0; // esi@2
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
871 AIState uAIState; // ax@2
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
872 //unsigned int v2; // ecx@6
0
Ritor1
parents:
diff changeset
873 int v3; // ebx@6
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
874 //int v4; // eax@8
0
Ritor1
parents:
diff changeset
875 int v5; // eax@10
Ritor1
parents:
diff changeset
876 int v6; // ecx@10
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
877 //signed int v7; // ebx@10
0
Ritor1
parents:
diff changeset
878 signed int v8; // ebx@17
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
879 //unsigned __int8 v9; // zf@17
0
Ritor1
parents:
diff changeset
880 unsigned __int8 v10; // sf@17
Ritor1
parents:
diff changeset
881 unsigned __int16 v11; // ax@21
Ritor1
parents:
diff changeset
882 int v12; // eax@29
Ritor1
parents:
diff changeset
883 unsigned __int64 v13; // qax@29
Ritor1
parents:
diff changeset
884 int v14; // eax@30
Ritor1
parents:
diff changeset
885 unsigned __int64 v15; // qax@30
Ritor1
parents:
diff changeset
886 int v16; // eax@33
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
887 //int v17; // edi@34
0
Ritor1
parents:
diff changeset
888 int v18; // edx@42
Ritor1
parents:
diff changeset
889 int v19; // ecx@42
Ritor1
parents:
diff changeset
890 __int16 v20; // ax@42
Ritor1
parents:
diff changeset
891 int v21; // ebx@42
Ritor1
parents:
diff changeset
892 int v22; // edi@42
Ritor1
parents:
diff changeset
893 int v23; // ecx@42
Ritor1
parents:
diff changeset
894 __int16 v24; // ax@42
Ritor1
parents:
diff changeset
895 int v25; // eax@45
Ritor1
parents:
diff changeset
896 signed int v26; // ecx@50
Ritor1
parents:
diff changeset
897 int v27; // eax@52
Ritor1
parents:
diff changeset
898 int v28; // eax@54
Ritor1
parents:
diff changeset
899 signed int v29; // ebx@57
Ritor1
parents:
diff changeset
900 signed int v30; // eax@57
Ritor1
parents:
diff changeset
901 int v31; // edi@57
Ritor1
parents:
diff changeset
902 signed int i; // ebx@57
Ritor1
parents:
diff changeset
903 unsigned int v33; // ecx@58
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
904 //int v34; // ebx@64
0
Ritor1
parents:
diff changeset
905 int v35; // edi@64
Ritor1
parents:
diff changeset
906 int v36; // eax@64
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
907 //unsigned __int16 v37; // cx@66
0
Ritor1
parents:
diff changeset
908 signed int v38; // edx@71
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
909 unsigned int v39; // edi@71
0
Ritor1
parents:
diff changeset
910 BSPModel *v40; // eax@75
Ritor1
parents:
diff changeset
911 ODMFace *v41; // edi@75
Ritor1
parents:
diff changeset
912 int v42; // ebx@76
Ritor1
parents:
diff changeset
913 int v43; // ecx@77
Ritor1
parents:
diff changeset
914 int v44; // edx@77
Ritor1
parents:
diff changeset
915 __int16 v45; // dx@82
Ritor1
parents:
diff changeset
916 int v46; // ecx@82
Ritor1
parents:
diff changeset
917 signed int v47; // ebx@85
Ritor1
parents:
diff changeset
918 int v48; // edi@85
Ritor1
parents:
diff changeset
919 int v49; // edi@85
Ritor1
parents:
diff changeset
920 int v50; // eax@85
Ritor1
parents:
diff changeset
921 unsigned __int64 v51; // qax@85
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
922 //unsigned __int8 v52; // zf@87
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
923 //unsigned __int8 v53; // sf@87
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
924 // unsigned __int8 v54; // of@104
0
Ritor1
parents:
diff changeset
925 int v55; // eax@107
Ritor1
parents:
diff changeset
926 unsigned int v56; // edi@107
Ritor1
parents:
diff changeset
927 int v57; // ST10_4@107
Ritor1
parents:
diff changeset
928 unsigned int v58; // edi@107
Ritor1
parents:
diff changeset
929 unsigned int v59; // ebx@107
Ritor1
parents:
diff changeset
930 signed int v60; // eax@107
Ritor1
parents:
diff changeset
931 int v61; // eax@124
Ritor1
parents:
diff changeset
932 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42
153
86a2637ba125 UpdateActors
Ritor1
parents: 152
diff changeset
933 int v63; // [sp+18h] [bp-38h]@64
0
Ritor1
parents:
diff changeset
934 int v64; // [sp+1Ch] [bp-34h]@64
Ritor1
parents:
diff changeset
935 int v65; // [sp+20h] [bp-30h]@2
Ritor1
parents:
diff changeset
936 int v66; // [sp+24h] [bp-2Ch]@2
Ritor1
parents:
diff changeset
937 bool v67; // [sp+28h] [bp-28h]@10
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
938 //unsigned int v68; // [sp+2Ch] [bp-24h]@10
0
Ritor1
parents:
diff changeset
939 unsigned int v69; // [sp+30h] [bp-20h]@6
Ritor1
parents:
diff changeset
940 unsigned int v70; // [sp+34h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
941 int v71; // [sp+38h] [bp-18h]@62
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
942 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
943 int v72b;
0
Ritor1
parents:
diff changeset
944 int v73; // [sp+40h] [bp-10h]@17
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
945 int uIsFlying; // [sp+44h] [bp-Ch]@8
0
Ritor1
parents:
diff changeset
946 unsigned int v75; // [sp+48h] [bp-8h]@1
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
947 int uIsOnWater; // [sp+4Ch] [bp-4h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
948
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
949 for(v75=0;(signed int)v75 < (signed int)uNumActors;++v75)
0
Ritor1
parents:
diff changeset
950 {
Ritor1
parents:
diff changeset
951 v0 = &pActors[v75];
Ritor1
parents:
diff changeset
952 v66 = v0->vPosition.x;
Ritor1
parents:
diff changeset
953 v65 = v0->vPosition.y;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
954 uAIState = v0->uAIState;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
955 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
956 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
957 continue;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
958 }
0
Ritor1
parents:
diff changeset
959 v3 = 0;
Ritor1
parents:
diff changeset
960 v69 = 0;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
961 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
0
Ritor1
parents:
diff changeset
962 v3 = 1;
Ritor1
parents:
diff changeset
963 v0->uSectorID = 0;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
964 uIsFlying = v0->pMonsterInfo.uFlying;
0
Ritor1
parents:
diff changeset
965 if ( !v0->CanAct() )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
966 uIsFlying = 0;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
967 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
968 v5 = ODM_GetFloorLevel(
0
Ritor1
parents:
diff changeset
969 v0->vPosition.x,
Ritor1
parents:
diff changeset
970 v0->vPosition.y,
Ritor1
parents:
diff changeset
971 v0->vPosition.z,
Ritor1
parents:
diff changeset
972 v0->uActorHeight,
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
973 &uIsOnWater,
0
Ritor1
parents:
diff changeset
974 (int *)&v69,
Ritor1
parents:
diff changeset
975 v3);
Ritor1
parents:
diff changeset
976 v6 = v0->vPosition.z;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
977 uIsAboveFloor = 0;
0
Ritor1
parents:
diff changeset
978 v67 = v69 == 0;
Ritor1
parents:
diff changeset
979 if ( v6 > v5 + 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
980 uIsAboveFloor = 1;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
981 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor )
0
Ritor1
parents:
diff changeset
982 {
Ritor1
parents:
diff changeset
983 v0->uAIState = Removed;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
984 continue;
0
Ritor1
parents:
diff changeset
985 }
305
cc8e4dc397ec MonsterPopup_Draw crash fix
Nomad
parents: 303
diff changeset
986 if ( v0->uCurrentActionAnimation == ANIM_Walking )
0
Ritor1
parents:
diff changeset
987 {
Ritor1
parents:
diff changeset
988 v8 = v0->uMovementSpeed;
Ritor1
parents:
diff changeset
989 v73 = v0->uMovementSpeed;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
990 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
991 {
Ritor1
parents:
diff changeset
992 v8 = (signed __int64)((double)v73 * 0.5);
Ritor1
parents:
diff changeset
993 v73 = (signed __int64)((double)v73 * 0.5);
Ritor1
parents:
diff changeset
994 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
995 if ( uAIState == Fleeing || uAIState == Pursuing )
0
Ritor1
parents:
diff changeset
996 {
Ritor1
parents:
diff changeset
997 v8 *= 2;
Ritor1
parents:
diff changeset
998 v73 = v8;
Ritor1
parents:
diff changeset
999 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1000 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 )
0
Ritor1
parents:
diff changeset
1001 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6);
Ritor1
parents:
diff changeset
1002 if ( v8 > 1000 )
Ritor1
parents:
diff changeset
1003 v8 = 1000;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1004 v12 = stru_5C6E00->Cos(v0->uYawAngle);
0
Ritor1
parents:
diff changeset
1005 v13 = v12 * (signed __int64)v8;
Ritor1
parents:
diff changeset
1006 v73 = v13 >> 16;
Ritor1
parents:
diff changeset
1007 v0->vVelocity.x = WORD1(v13);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1008 v69 = stru_5C6E00->Sin(v0->uYawAngle);
0
Ritor1
parents:
diff changeset
1009 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16;
Ritor1
parents:
diff changeset
1010 v0->vVelocity.y = v69 * v8 >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1011 if ( uIsFlying )
0
Ritor1
parents:
diff changeset
1012 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1013 v14 = stru_5C6E00->Sin(v0->uPitchAngle);
0
Ritor1
parents:
diff changeset
1014 v69 = v14;
Ritor1
parents:
diff changeset
1015 v15 = v14 * (signed __int64)v8;
Ritor1
parents:
diff changeset
1016 v73 = v15 >> 16;
Ritor1
parents:
diff changeset
1017 v0->vVelocity.z = WORD1(v15);
Ritor1
parents:
diff changeset
1018 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1019 //v7 = v68;
0
Ritor1
parents:
diff changeset
1020 }
Ritor1
parents:
diff changeset
1021 else
Ritor1
parents:
diff changeset
1022 {
Ritor1
parents:
diff changeset
1023 v73 = v0->vVelocity.x;
Ritor1
parents:
diff changeset
1024 v69 = 55000;
Ritor1
parents:
diff changeset
1025 v73 = (unsigned __int64)(55000i64 * v73) >> 16;
Ritor1
parents:
diff changeset
1026 v0->vVelocity.x = v73;
Ritor1
parents:
diff changeset
1027 v73 = v0->vVelocity.y;
Ritor1
parents:
diff changeset
1028 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16;
Ritor1
parents:
diff changeset
1029 v0->vVelocity.y = v73;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1030 if ( uIsFlying )
0
Ritor1
parents:
diff changeset
1031 {
Ritor1
parents:
diff changeset
1032 v69 = 55000;
Ritor1
parents:
diff changeset
1033 v73 = v0->vVelocity.z;
Ritor1
parents:
diff changeset
1034 v73 = (unsigned __int64)(55000i64 * v73) >> 16;
Ritor1
parents:
diff changeset
1035 v0->vVelocity.z = v73;
Ritor1
parents:
diff changeset
1036 }
Ritor1
parents:
diff changeset
1037 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1038 if ( v0->vPosition.z < v5 )
0
Ritor1
parents:
diff changeset
1039 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1040 v16 = uIsFlying;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1041 v0->vPosition.z = v5;
0
Ritor1
parents:
diff changeset
1042 v0->vVelocity.z = v16 != 0 ? 0x14 : 0;
Ritor1
parents:
diff changeset
1043 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1044 //v17 = 0;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1045 if ( !uIsAboveFloor || uIsFlying )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1046 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1047 if ( v70 && !uIsAboveFloor && v67 )
0
Ritor1
parents:
diff changeset
1048 {
Ritor1
parents:
diff changeset
1049 v18 = v0->vPosition.y;
Ritor1
parents:
diff changeset
1050 v19 = v0->vPosition.x;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1051 v0->vPosition.z = v5;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
1052 ODM_GetTerrainNormalAt(v19, v18, &v62);
0
Ritor1
parents:
diff changeset
1053 v20 = GetGravityStrength();
Ritor1
parents:
diff changeset
1054 v21 = v62.y;
Ritor1
parents:
diff changeset
1055 v22 = v62.z;
Ritor1
parents:
diff changeset
1056 v23 = v62.y * v0->vVelocity.y;
Ritor1
parents:
diff changeset
1057 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
Ritor1
parents:
diff changeset
1058 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1059 v72b = v21;
0
Ritor1
parents:
diff changeset
1060 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1061 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1062 v24 = v72b;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1063 v72b = v22;
0
Ritor1
parents:
diff changeset
1064 v0->vVelocity.y += v24;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1065 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1066 v0->vVelocity.z += v72b;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1067 //v17 = 0;
0
Ritor1
parents:
diff changeset
1068 }
Ritor1
parents:
diff changeset
1069 }
Ritor1
parents:
diff changeset
1070 else
Ritor1
parents:
diff changeset
1071 {
Ritor1
parents:
diff changeset
1072 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
Ritor1
parents:
diff changeset
1073 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1074 if ( pParty->armageddon_timer != 0 && v0->CanAct() )
0
Ritor1
parents:
diff changeset
1075 {
Ritor1
parents:
diff changeset
1076 v0->vVelocity.x += rand() % 100 - 50;
Ritor1
parents:
diff changeset
1077 v0->vVelocity.y += rand() % 100 - 50;
Ritor1
parents:
diff changeset
1078 v0->vVelocity.z += rand() % 100 - 20;
Ritor1
parents:
diff changeset
1079 v25 = rand();
Ritor1
parents:
diff changeset
1080 v0->uAIState = Stunned;
Ritor1
parents:
diff changeset
1081 v0->uYawAngle += v25 % 32 - 16;
Ritor1
parents:
diff changeset
1082 v0->UpdateAnimation();
Ritor1
parents:
diff changeset
1083 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1084 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
1085 {
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1086 v0->vVelocity.y = 0;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1087 v0->vVelocity.x = 0;
0
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089 stru_721530.field_0 = 1;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1090 if ( !uIsFlying )
0
Ritor1
parents:
diff changeset
1091 v26 = 40;
Ritor1
parents:
diff changeset
1092 else
Ritor1
parents:
diff changeset
1093 v26 = v0->uActorRadius;
Ritor1
parents:
diff changeset
1094 v27 = v0->uActorHeight;
Ritor1
parents:
diff changeset
1095 stru_721530.field_84 = -1;
Ritor1
parents:
diff changeset
1096 stru_721530.field_8 = v26;
Ritor1
parents:
diff changeset
1097 stru_721530.prolly_normal_d = v26;
Ritor1
parents:
diff changeset
1098 stru_721530.field_C = v27;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1099 stru_721530.field_70 = 0;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1100 v69 = 0;
0
Ritor1
parents:
diff changeset
1101 while ( 1 )
Ritor1
parents:
diff changeset
1102 {
Ritor1
parents:
diff changeset
1103 stru_721530.field_34.x = v0->vPosition.x;
Ritor1
parents:
diff changeset
1104 stru_721530.normal.x = stru_721530.field_34.x;
Ritor1
parents:
diff changeset
1105 stru_721530.field_34.y = v0->vPosition.y;
Ritor1
parents:
diff changeset
1106 stru_721530.normal.y = stru_721530.field_34.y;
Ritor1
parents:
diff changeset
1107 v28 = v0->vPosition.z;
Ritor1
parents:
diff changeset
1108 stru_721530.normal.z = v28 + v26 + 1;
Ritor1
parents:
diff changeset
1109 stru_721530.field_34.z = v28 - v26 + stru_721530.field_C - 1;
Ritor1
parents:
diff changeset
1110 if ( stru_721530.field_34.z < stru_721530.normal.z )
Ritor1
parents:
diff changeset
1111 stru_721530.field_34.z = v28 + v26 + 1;
Ritor1
parents:
diff changeset
1112 stru_721530.field_1C = v0->vVelocity.x;
Ritor1
parents:
diff changeset
1113 stru_721530.uSectorID = 0;
Ritor1
parents:
diff changeset
1114 stru_721530.field_20 = v0->vVelocity.y;
Ritor1
parents:
diff changeset
1115 stru_721530.field_24 = v0->vVelocity.z;
Ritor1
parents:
diff changeset
1116 if ( stru_721530._47050A(0) )
Ritor1
parents:
diff changeset
1117 break;
Ritor1
parents:
diff changeset
1118 _46E889_collide_against_bmodels(1u);
Ritor1
parents:
diff changeset
1119 v29 = WorldPosToGridCellZ(v0->vPosition.y);
Ritor1
parents:
diff changeset
1120 v30 = WorldPosToGridCellX(v0->vPosition.x);
Ritor1
parents:
diff changeset
1121 _46E26D_collide_against_sprites(v30, v29);
Ritor1
parents:
diff changeset
1122 _46EF01_collision_chech_player(0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
1123 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75));
0
Ritor1
parents:
diff changeset
1124 v31 = 0;
Ritor1
parents:
diff changeset
1125 for ( i = 0; v31 < ai_arrays_size; ++v31 )
Ritor1
parents:
diff changeset
1126 {
390
35a62d1948d4 More sound fixes
Nomad
parents: 377
diff changeset
1127 v33 = ai_near_actors_ids[v31];
0
Ritor1
parents:
diff changeset
1128 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) )
Ritor1
parents:
diff changeset
1129 ++i;
Ritor1
parents:
diff changeset
1130 }
Ritor1
parents:
diff changeset
1131 v71 = i > 1;
Ritor1
parents:
diff changeset
1132 if ( stru_721530.field_7C < stru_721530.field_6C )
Ritor1
parents:
diff changeset
1133 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1134 //v34 = 0;
0
Ritor1
parents:
diff changeset
1135 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
1136 v36 = ODM_GetFloorLevel(
0
Ritor1
parents:
diff changeset
1137 stru_721530.normal2.x,
Ritor1
parents:
diff changeset
1138 stru_721530.normal2.y,
Ritor1
parents:
diff changeset
1139 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
Ritor1
parents:
diff changeset
1140 v0->uActorHeight,
Ritor1
parents:
diff changeset
1141 (int *)&v63,
Ritor1
parents:
diff changeset
1142 &v64,
Ritor1
parents:
diff changeset
1143 0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1144 if ( uIsOnWater )
0
Ritor1
parents:
diff changeset
1145 {
Ritor1
parents:
diff changeset
1146 if ( v35 < v36 + 60 )
Ritor1
parents:
diff changeset
1147 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1148 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled )
0
Ritor1
parents:
diff changeset
1149 {
Ritor1
parents:
diff changeset
1150 if ( v64 )
Ritor1
parents:
diff changeset
1151 v61 = v36 + 30;
Ritor1
parents:
diff changeset
1152 else
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1153 v61 = v5 + 60;
0
Ritor1
parents:
diff changeset
1154 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61);
Ritor1
parents:
diff changeset
1155 v0->uAIState = Removed;
Ritor1
parents:
diff changeset
1156 return;
Ritor1
parents:
diff changeset
1157 }
Ritor1
parents:
diff changeset
1158 }
Ritor1
parents:
diff changeset
1159 }
Ritor1
parents:
diff changeset
1160 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1161 {
Ritor1
parents:
diff changeset
1162 v0->vPosition.x = LOWORD(stru_721530.normal2.x);
Ritor1
parents:
diff changeset
1163 v0->vPosition.y = LOWORD(stru_721530.normal2.y);
Ritor1
parents:
diff changeset
1164 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
Ritor1
parents:
diff changeset
1165 break;
Ritor1
parents:
diff changeset
1166 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1167 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
0
Ritor1
parents:
diff changeset
1168 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1169 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
0
Ritor1
parents:
diff changeset
1170 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1171 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
0
Ritor1
parents:
diff changeset
1172 v38 = stru_721530.uFaceID;
Ritor1
parents:
diff changeset
1173 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16;
Ritor1
parents:
diff changeset
1174 stru_721530.field_70 += stru_721530.field_7C;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1175 v39 = PID_ID(v38);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1176 switch ( PID_TYPE(v38) )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1177 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1178 case OBJECT_Actor:
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1179 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1180 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1181 //if(pParty->bTurnBasedModeOn == 1)
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1182 //v34 = 0;
0
Ritor1
parents:
diff changeset
1183 if ( v0->pMonsterInfo.uHostilityType )
Ritor1
parents:
diff changeset
1184 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1185 if ( v71 == 0 )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1186 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1187 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1188 }
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1189 else
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1190 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1191 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1192 }
0
Ritor1
parents:
diff changeset
1193 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1194 else if ( v71 != 0 )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1195 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1196 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1197 }
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1198 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
0
Ritor1
parents:
diff changeset
1199 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1200 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0);
0
Ritor1
parents:
diff changeset
1201 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1202 else
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1203 {
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1204 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1205 }
0
Ritor1
parents:
diff changeset
1206 }
Ritor1
parents:
diff changeset
1207 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1208 case OBJECT_Player:
0
Ritor1
parents:
diff changeset
1209 if ( !v0->GetActorsRelation(0) )
Ritor1
parents:
diff changeset
1210 {
Ritor1
parents:
diff changeset
1211 v38 = stru_721530.uFaceID;
1060
b79139c3b5c8 some AI cleaning
zipi
parents: 1053
diff changeset
1212 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1213 break;
0
Ritor1
parents:
diff changeset
1214 }
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1215 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1216 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0;
0
Ritor1
parents:
diff changeset
1217 v0->vVelocity.y = 0;
Ritor1
parents:
diff changeset
1218 v0->vVelocity.x = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1219 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) )
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1220 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0)
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1221 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
0
Ritor1
parents:
diff changeset
1222 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1223 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1224 case OBJECT_Decoration:
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
1225 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
0
Ritor1
parents:
diff changeset
1226 v48 = stru_5C6E00->Atan2(
Ritor1
parents:
diff changeset
1227 v0->vPosition.x - pLevelDecorations[v39].vPosition.x,
Ritor1
parents:
diff changeset
1228 v0->vPosition.y - pLevelDecorations[v39].vPosition.y);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1229 v71 = stru_5C6E00->Cos(v48);
0
Ritor1
parents:
diff changeset
1230 v70 = (unsigned __int64)(v71 * (signed __int64)v47) >> 16;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1231 v49 = v48;
0
Ritor1
parents:
diff changeset
1232 v0->vVelocity.x = (unsigned int)(v71 * v47) >> 16;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1233 v50 = stru_5C6E00->Sin(v48);
0
Ritor1
parents:
diff changeset
1234 v71 = v50;
Ritor1
parents:
diff changeset
1235 v51 = v50 * (signed __int64)v47;
Ritor1
parents:
diff changeset
1236 v70 = v51 >> 16;
Ritor1
parents:
diff changeset
1237 v0->vVelocity.y = WORD1(v51);
Ritor1
parents:
diff changeset
1238 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1239 case OBJECT_BModel:
0
Ritor1
parents:
diff changeset
1240 v40 = &pOutdoor->pBModels[v38 >> 9];
Ritor1
parents:
diff changeset
1241 v41 = &v40->pFaces[v39 & 0x3F];
Ritor1
parents:
diff changeset
1242 if ( !(BYTE3(v41->uAttributes) & 0x20) )
Ritor1
parents:
diff changeset
1243 {
Ritor1
parents:
diff changeset
1244 v42 = v41->uPolygonType;
Ritor1
parents:
diff changeset
1245 if ( v42 == 3 )
Ritor1
parents:
diff changeset
1246 {
Ritor1
parents:
diff changeset
1247 v43 = v0->vVelocity.y;
Ritor1
parents:
diff changeset
1248 v44 = v0->vVelocity.x;
Ritor1
parents:
diff changeset
1249 v0->vVelocity.z = 0;
Ritor1
parents:
diff changeset
1250 v0->vPosition.z = LOWORD(v40->pVertices.pVertices[v41->pVertexIDs[0]].z) + 1;
Ritor1
parents:
diff changeset
1251 if ( v44 * v44 + v43 * v43 < 400 )
Ritor1
parents:
diff changeset
1252 {
Ritor1
parents:
diff changeset
1253 v0->vVelocity.y = 0;
Ritor1
parents:
diff changeset
1254 v0->vVelocity.x = 0;
Ritor1
parents:
diff changeset
1255 }
Ritor1
parents:
diff changeset
1256 }
Ritor1
parents:
diff changeset
1257 else
Ritor1
parents:
diff changeset
1258 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1259 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z
0
Ritor1
parents:
diff changeset
1260 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1261 if ( stru_721530.field_64 >> 3 > v72b )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1262 v72b = stru_721530.field_64 >> 3;
0
Ritor1
parents:
diff changeset
1263 v73 = v41->pFacePlane.vNormal.x;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1264 v73 = (unsigned __int64)(v72b * (signed __int64)v73) >> 16;
0
Ritor1
parents:
diff changeset
1265 v71 = v41->pFacePlane.vNormal.y;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1266 v71 = (unsigned __int64)(v72b * (signed __int64)v71) >> 16;
0
Ritor1
parents:
diff changeset
1267 v70 = v41->pFacePlane.vNormal.z;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1268 v70 = (unsigned __int64)(v72b * (signed __int64)(signed int)v70) >> 16;
0
Ritor1
parents:
diff changeset
1269 v0->vVelocity.x += v73;
Ritor1
parents:
diff changeset
1270 v0->vVelocity.y += v71;
Ritor1
parents:
diff changeset
1271 v0->vVelocity.z += v70;
Ritor1
parents:
diff changeset
1272 if ( v42 != 4 )
Ritor1
parents:
diff changeset
1273 {
Ritor1
parents:
diff changeset
1274 v45 = v0->vPosition.z;
Ritor1
parents:
diff changeset
1275 v46 = stru_721530.prolly_normal_d
Ritor1
parents:
diff changeset
1276 - ((v41->pFacePlane.dist
Ritor1
parents:
diff changeset
1277 + v41->pFacePlane.vNormal.x * v0->vPosition.x
Ritor1
parents:
diff changeset
1278 + v41->pFacePlane.vNormal.y * v0->vPosition.y
Ritor1
parents:
diff changeset
1279 + v41->pFacePlane.vNormal.z * v0->vPosition.z) >> 16);
Ritor1
parents:
diff changeset
1280 if ( v46 > 0 )
Ritor1
parents:
diff changeset
1281 {
Ritor1
parents:
diff changeset
1282 v0->vPosition.x += (unsigned int)(v46 * v41->pFacePlane.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
1283 v0->vPosition.y += (unsigned int)(v46 * v41->pFacePlane.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
1284 v0->vPosition.z = v45 + ((unsigned int)(v46 * v41->pFacePlane.vNormal.z) >> 16);
Ritor1
parents:
diff changeset
1285 }
Ritor1
parents:
diff changeset
1286 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y);
Ritor1
parents:
diff changeset
1287 }
Ritor1
parents:
diff changeset
1288 }
Ritor1
parents:
diff changeset
1289 }
Ritor1
parents:
diff changeset
1290 break;
Ritor1
parents:
diff changeset
1291 }
Ritor1
parents:
diff changeset
1292 v70 = v0->vVelocity.x;
Ritor1
parents:
diff changeset
1293 v71 = 58500;
Ritor1
parents:
diff changeset
1294 v70 = (unsigned __int64)(58500i64 * (signed int)v70) >> 16;
Ritor1
parents:
diff changeset
1295 v0->vVelocity.x = v70;
Ritor1
parents:
diff changeset
1296 v70 = v0->vVelocity.y;
Ritor1
parents:
diff changeset
1297 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16;
Ritor1
parents:
diff changeset
1298 v71 = 58500;
Ritor1
parents:
diff changeset
1299 v0->vVelocity.y = v70;
Ritor1
parents:
diff changeset
1300 v70 = v0->vVelocity.z;
Ritor1
parents:
diff changeset
1301 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16;
Ritor1
parents:
diff changeset
1302 ++v69;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1303 //v54 = v69 < 100;
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1304 //v10 = (v69 - 100) < 0;
0
Ritor1
parents:
diff changeset
1305 v0->vVelocity.z = v70;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1306 if ( v69 >= 100 )
0
Ritor1
parents:
diff changeset
1307 break;
Ritor1
parents:
diff changeset
1308 v26 = stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
1309 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1310 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1;
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
1311 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
1312 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x)
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1313 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y)
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1314 && v58
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1315 || v67 != 0 )
0
Ritor1
parents:
diff changeset
1316 {
Ritor1
parents:
diff changeset
1317 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
Ritor1
parents:
diff changeset
1318 {
Ritor1
parents:
diff changeset
1319 v58 = v58 == 0;
Ritor1
parents:
diff changeset
1320 v59 = v59 == 0;
Ritor1
parents:
diff changeset
1321 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1322 if ( !uIsFlying && v58 && !v59 )
0
Ritor1
parents:
diff changeset
1323 {
Ritor1
parents:
diff changeset
1324 v0->vPosition.x = v66;
Ritor1
parents:
diff changeset
1325 v0->vPosition.y = v65;
Ritor1
parents:
diff changeset
1326 if ( v0->CanAct() )
Ritor1
parents:
diff changeset
1327 {
Ritor1
parents:
diff changeset
1328 v0->uYawAngle -= 32;
Ritor1
parents:
diff changeset
1329 v0->uCurrentActionTime = 0;
Ritor1
parents:
diff changeset
1330 v0->uCurrentActionLength = 128;
Ritor1
parents:
diff changeset
1331 v0->uAIState = Fleeing;
Ritor1
parents:
diff changeset
1332 }
Ritor1
parents:
diff changeset
1333 }
Ritor1
parents:
diff changeset
1334 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
1335 }
0
Ritor1
parents:
diff changeset
1336 }
Ritor1
parents:
diff changeset
1337
Ritor1
parents:
diff changeset
1338 //----- (0047253E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1339 void UpdateObjects()
Ritor1
parents:
diff changeset
1340 {
Ritor1
parents:
diff changeset
1341 unsigned int v0; // ebx@0
Ritor1
parents:
diff changeset
1342 //unsigned int v1; // edi@1
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1343 //char *v2; // esi@2
0
Ritor1
parents:
diff changeset
1344 //__int16 v3; // dx@5
Ritor1
parents:
diff changeset
1345 ObjectDesc *v4; // eax@5
Ritor1
parents:
diff changeset
1346 int v5; // ecx@6
Ritor1
parents:
diff changeset
1347 __int16 v6; // cx@7
Ritor1
parents:
diff changeset
1348 signed int v7; // eax@9
Ritor1
parents:
diff changeset
1349 __int16 v8; // cx@14
Ritor1
parents:
diff changeset
1350 __int16 v9; // dx@14
Ritor1
parents:
diff changeset
1351 unsigned int v10; // ecx@16
Ritor1
parents:
diff changeset
1352 signed int v11; // eax@17
Ritor1
parents:
diff changeset
1353 int v12; // edi@27
Ritor1
parents:
diff changeset
1354 int v13; // eax@27
Ritor1
parents:
diff changeset
1355 int v14; // ebx@27
Ritor1
parents:
diff changeset
1356 unsigned int v15; // ecx@27
Ritor1
parents:
diff changeset
1357 unsigned int v16; // edx@30
Ritor1
parents:
diff changeset
1358 unsigned int v17; // edx@32
Ritor1
parents:
diff changeset
1359 int v18; // [sp+4h] [bp-10h]@27
Ritor1
parents:
diff changeset
1360 int v19; // [sp+8h] [bp-Ch]@27
Ritor1
parents:
diff changeset
1361 //signed int v20; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1362
Ritor1
parents:
diff changeset
1363 //v1 = 0;
Ritor1
parents:
diff changeset
1364 //v20 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1365 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
1366 {
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
1367 auto item = &pSpriteObjects[i];
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1368 //v2 = (char *)&item->uSpriteFrameID;
0
Ritor1
parents:
diff changeset
1369 //do
Ritor1
parents:
diff changeset
1370 //{
Ritor1
parents:
diff changeset
1371 //LOWORD(v0) = item->uAttributes;
Ritor1
parents:
diff changeset
1372 if (item->uAttributes & 0x40)
Ritor1
parents:
diff changeset
1373 item->uAttributes &= 0xFFBF;
Ritor1
parents:
diff changeset
1374 else
Ritor1
parents:
diff changeset
1375 {
Ritor1
parents:
diff changeset
1376 //v3 = item->uObjectDescID;
Ritor1
parents:
diff changeset
1377 v4 = &pObjectList->pObjects[item->uObjectDescID];
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1378 if (item->AttachedToActor())
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1379 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1380 v5 = PID_ID(item->spell_target_pid);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1381 item->vPosition.x = pActors[v5].vPosition.x;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1382 item->vPosition.y = pActors[v5].vPosition.y;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1383 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1384 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1385 continue;
0
Ritor1
parents:
diff changeset
1386 if ( v6 >= 0 )
Ritor1
parents:
diff changeset
1387 {
Ritor1
parents:
diff changeset
1388 v7 = v4->uLifetime;
Ritor1
parents:
diff changeset
1389 if (item->uAttributes & 2)
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1390 v7 = item->field_20;
0
Ritor1
parents:
diff changeset
1391 if ( v6 < v7 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1392 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1393 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1394 v10 = i;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1395 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1396 continue;
0
Ritor1
parents:
diff changeset
1397 }
Ritor1
parents:
diff changeset
1398
Ritor1
parents:
diff changeset
1399 if ( item->uObjectDescID )
Ritor1
parents:
diff changeset
1400 {
Ritor1
parents:
diff changeset
1401 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
Ritor1
parents:
diff changeset
1402 item->uSpriteFrameID = v8;
Ritor1
parents:
diff changeset
1403 v9 = v4->uFlags;
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1404 if ( v9 & 4 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1405 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1406 if ( v8 < 0 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1407 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1408 v10 = i;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1409 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1410 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1411 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1412 v11 = v4->uLifetime;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1413 if (item->uAttributes & 2)
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1414 v11 = item->field_20;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1415 }
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1416 if ( !(v9 & 4) || v8 < v11 )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1417 {
0
Ritor1
parents:
diff changeset
1418 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1419 SpriteObject::UpdateObject_fn0_BLV(i);
0
Ritor1
parents:
diff changeset
1420 else
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1421 SpriteObject::UpdateObject_fn0_ODM(i);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1422 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1423 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1424 v12 = abs(pParty->vPosition.x - item->vPosition.x);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1425 v18 = abs(pParty->vPosition.y - item->vPosition.y);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1426 v19 = abs(pParty->vPosition.z - item->vPosition.z);
0
Ritor1
parents:
diff changeset
1427 v13 = v12;
Ritor1
parents:
diff changeset
1428 v14 = v18;
Ritor1
parents:
diff changeset
1429 v15 = v19;
Ritor1
parents:
diff changeset
1430 if ( v12 < v18 )
Ritor1
parents:
diff changeset
1431 {
Ritor1
parents:
diff changeset
1432 v13 = v18;
Ritor1
parents:
diff changeset
1433 v14 = v12;
Ritor1
parents:
diff changeset
1434 }
Ritor1
parents:
diff changeset
1435 if ( v13 < v19 )
Ritor1
parents:
diff changeset
1436 {
Ritor1
parents:
diff changeset
1437 v16 = v13;
Ritor1
parents:
diff changeset
1438 v13 = v19;
Ritor1
parents:
diff changeset
1439 v15 = v16;
Ritor1
parents:
diff changeset
1440 }
Ritor1
parents:
diff changeset
1441 if ( v14 < (signed int)v15 )
Ritor1
parents:
diff changeset
1442 {
Ritor1
parents:
diff changeset
1443 v17 = v15;
Ritor1
parents:
diff changeset
1444 v15 = v14;
Ritor1
parents:
diff changeset
1445 v14 = v17;
Ritor1
parents:
diff changeset
1446 }
Ritor1
parents:
diff changeset
1447 v0 = (unsigned int)(11 * v14) >> 5;
Ritor1
parents:
diff changeset
1448 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1449 continue;
0
Ritor1
parents:
diff changeset
1450 v10 = i;
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1451 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1452 continue;
0
Ritor1
parents:
diff changeset
1453 }
Ritor1
parents:
diff changeset
1454 v10 = i;
Ritor1
parents:
diff changeset
1455 if ( !(v9 & 0x40) )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1456 {
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1457 SpriteObject::OnInteraction(v10);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1458 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1459 }
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
1460 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
0
Ritor1
parents:
diff changeset
1461 }
Ritor1
parents:
diff changeset
1462 }
Ritor1
parents:
diff changeset
1463 //v2 += 112;
Ritor1
parents:
diff changeset
1464 //v1 = v20++ + 1;
Ritor1
parents:
diff changeset
1465 //}
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1466 //while ( v20 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
1467 }
Ritor1
parents:
diff changeset
1468 }
Ritor1
parents:
diff changeset
1469
Ritor1
parents:
diff changeset
1470 //----- (0047272C) --------------------------------------------------------
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1471 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
1472 {
Ritor1
parents:
diff changeset
1473 signed int v5; // ebx@1
Ritor1
parents:
diff changeset
1474 int result; // eax@1
Ritor1
parents:
diff changeset
1475 int v7; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
1476 signed int v8; // [sp+14h] [bp-4h]@1
Ritor1
parents:
diff changeset
1477
Ritor1
parents:
diff changeset
1478 v5 = x - 2;
Ritor1
parents:
diff changeset
1479 v7 = x;
Ritor1
parents:
diff changeset
1480 v8 = y;
Ritor1
parents:
diff changeset
1481 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1482 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1483 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1484 {
Ritor1
parents:
diff changeset
1485 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1486 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1487 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1488 {
Ritor1
parents:
diff changeset
1489 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1490 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1491 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1492 {
Ritor1
parents:
diff changeset
1493 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1494 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1495 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1496 {
Ritor1
parents:
diff changeset
1497 *pSectorID = pIndoor->GetSector(v7, v8, z + 140);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1498 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1499 }
Ritor1
parents:
diff changeset
1500 }
Ritor1
parents:
diff changeset
1501 }
Ritor1
parents:
diff changeset
1502 }
Ritor1
parents:
diff changeset
1503 return result;
Ritor1
parents:
diff changeset
1504 }
Ritor1
parents:
diff changeset
1505
Ritor1
parents:
diff changeset
1506 //----- (00472866) --------------------------------------------------------
Ritor1
parents:
diff changeset
1507 void BLV_ProcessPartyActions()
Ritor1
parents:
diff changeset
1508 {
Ritor1
parents:
diff changeset
1509 int v1; // ebx@1
Ritor1
parents:
diff changeset
1510 int v2; // edi@1
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1511 //int v6; // eax@18
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1512 //signed __int64 v8; // qax@27
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1513 //int v9; // eax@27
0
Ritor1
parents:
diff changeset
1514 double v10; // st7@27
Ritor1
parents:
diff changeset
1515 unsigned int v12; // eax@49
Ritor1
parents:
diff changeset
1516 double v13; // st7@50
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1517 //int v14; // eax@51
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1518 //signed __int64 v15; // qax@53
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1519 //double v16; // st7@54
0
Ritor1
parents:
diff changeset
1520 int v17; // eax@62
Ritor1
parents:
diff changeset
1521 double v18; // st7@62
Ritor1
parents:
diff changeset
1522 int v19; // ST40_4@62
Ritor1
parents:
diff changeset
1523 int v20; // eax@65
Ritor1
parents:
diff changeset
1524 double v21; // st7@65
Ritor1
parents:
diff changeset
1525 int v22; // ST40_4@65
Ritor1
parents:
diff changeset
1526 int v23; // eax@66
Ritor1
parents:
diff changeset
1527 double v24; // st7@66
Ritor1
parents:
diff changeset
1528 int v25; // ST40_4@66
Ritor1
parents:
diff changeset
1529 int v26; // eax@67
Ritor1
parents:
diff changeset
1530 double v27; // st7@67
Ritor1
parents:
diff changeset
1531 int v28; // ST40_4@67
Ritor1
parents:
diff changeset
1532 unsigned int v35; // eax@74
Ritor1
parents:
diff changeset
1533 int v36; // ecx@88
Ritor1
parents:
diff changeset
1534 int new_party_z; // esi@96
Ritor1
parents:
diff changeset
1535 int v38; // eax@96
Ritor1
parents:
diff changeset
1536 int v39; // ecx@106
Ritor1
parents:
diff changeset
1537 int v40; // eax@106
Ritor1
parents:
diff changeset
1538 Player **v41; // esi@113
Ritor1
parents:
diff changeset
1539 int v42; // eax@120
Ritor1
parents:
diff changeset
1540 signed int v43; // ecx@123
Ritor1
parents:
diff changeset
1541 BLVFace *v44; // esi@126
Ritor1
parents:
diff changeset
1542 PolygonType v45; // al@126
Ritor1
parents:
diff changeset
1543 int v46; // ecx@133
Ritor1
parents:
diff changeset
1544 char v47; // zf@133
Ritor1
parents:
diff changeset
1545 int v48; // eax@133
Ritor1
parents:
diff changeset
1546 int v49; // ST40_4@136
Ritor1
parents:
diff changeset
1547 int v50; // ST40_4@140
Ritor1
parents:
diff changeset
1548 int v51; // eax@140
Ritor1
parents:
diff changeset
1549 int v52; // eax@140
Ritor1
parents:
diff changeset
1550 signed int v53; // edi@146
Ritor1
parents:
diff changeset
1551 int v54; // ebx@146
Ritor1
parents:
diff changeset
1552 int v55; // ST30_4@146
Ritor1
parents:
diff changeset
1553 AudioPlayer *v56; // ecx@162
Ritor1
parents:
diff changeset
1554 SoundID v57; // [sp-20h] [bp-80h]@163
Ritor1
parents:
diff changeset
1555 signed int v58; // [sp-1Ch] [bp-7Ch]@161
Ritor1
parents:
diff changeset
1556 unsigned int v59; // [sp-18h] [bp-78h]@161
Ritor1
parents:
diff changeset
1557 signed int v60; // [sp-14h] [bp-74h]@161
Ritor1
parents:
diff changeset
1558 signed int v61; // [sp-10h] [bp-70h]@161
Ritor1
parents:
diff changeset
1559 int v62; // [sp-Ch] [bp-6Ch]@161
Ritor1
parents:
diff changeset
1560 int v63; // [sp-8h] [bp-68h]@75
Ritor1
parents:
diff changeset
1561 unsigned int v64; // [sp-8h] [bp-68h]@161
Ritor1
parents:
diff changeset
1562 int v65; // [sp-4h] [bp-64h]@75
Ritor1
parents:
diff changeset
1563 int v66; // [sp-4h] [bp-64h]@161
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1564 //int v68; // [sp+10h] [bp-50h]@45
0
Ritor1
parents:
diff changeset
1565 int v69; // [sp+10h] [bp-50h]@140
Ritor1
parents:
diff changeset
1566 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1567 //signed int v71; // [sp+18h] [bp-48h]@1
0
Ritor1
parents:
diff changeset
1568 signed int v72; // [sp+1Ch] [bp-44h]@1
Ritor1
parents:
diff changeset
1569 signed int v73; // [sp+20h] [bp-40h]@100
Ritor1
parents:
diff changeset
1570 int v74; // [sp+20h] [bp-40h]@140
Ritor1
parents:
diff changeset
1571 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
Ritor1
parents:
diff changeset
1572 unsigned int uSectorID; // [sp+28h] [bp-38h]@1
Ritor1
parents:
diff changeset
1573 int v78; // [sp+2Ch] [bp-34h]@1
Ritor1
parents:
diff changeset
1574 unsigned int uFaceID; // [sp+30h] [bp-30h]@1
Ritor1
parents:
diff changeset
1575 int v80; // [sp+34h] [bp-2Ch]@1
Ritor1
parents:
diff changeset
1576 int v81; // [sp+38h] [bp-28h]@47
Ritor1
parents:
diff changeset
1577 int v82; // [sp+3Ch] [bp-24h]@47
Ritor1
parents:
diff changeset
1578 int _view_angle; // [sp+40h] [bp-20h]@47
Ritor1
parents:
diff changeset
1579 int bJumping; // [sp+44h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
1580 int new_party_y; // [sp+48h] [bp-18h]@1
Ritor1
parents:
diff changeset
1581 int new_party_x; // [sp+4Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
1582 int party_z; // [sp+50h] [bp-10h]@1
717
Ritor1
parents: 688
diff changeset
1583 //int v89; // [sp+58h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
1584 int angle; // [sp+5Ch] [bp-4h]@47
Ritor1
parents:
diff changeset
1585
Ritor1
parents:
diff changeset
1586 uFaceEvent = 0;
717
Ritor1
parents: 688
diff changeset
1587 //v89 = pParty->uFallSpeed;
0
Ritor1
parents:
diff changeset
1588 v1 = 0;
Ritor1
parents:
diff changeset
1589 v2 = 0;
Ritor1
parents:
diff changeset
1590 new_party_x = pParty->vPosition.x;
717
Ritor1
parents: 688
diff changeset
1591 new_party_y = pParty->vPosition.y;
0
Ritor1
parents:
diff changeset
1592 party_z = pParty->vPosition.z;
Ritor1
parents:
diff changeset
1593 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
Ritor1
parents:
diff changeset
1594 v72 = 0;
Ritor1
parents:
diff changeset
1595 v78 = 0;
Ritor1
parents:
diff changeset
1596 bJumping = 0;
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
1597
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
1598 uFaceID = -1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1599 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
1600
0
Ritor1
parents:
diff changeset
1601 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
1602 {
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1603 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
1604 if (pParty->FlyActive())
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1605 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1606 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1607
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1608 if ( floor_level == -30000 || uFaceID == -1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1609 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1610 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
1611 if ( floor_level == -30000 || uFaceID == -1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1612 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1613 __debugbreak(); // level built with errors
0
Ritor1
parents:
diff changeset
1614 pParty->vPosition.x = blv_prev_party_x;
Ritor1
parents:
diff changeset
1615 pParty->vPosition.y = blv_prev_party_z;
Ritor1
parents:
diff changeset
1616 pParty->vPosition.z = blv_prev_party_y;
Ritor1
parents:
diff changeset
1617 pParty->uFallStartY = blv_prev_party_y;
Ritor1
parents:
diff changeset
1618 return;
Ritor1
parents:
diff changeset
1619 }
Ritor1
parents:
diff changeset
1620 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1621
0
Ritor1
parents:
diff changeset
1622 blv_prev_party_x = pParty->vPosition.x;
Ritor1
parents:
diff changeset
1623 blv_prev_party_z = pParty->vPosition.y;
Ritor1
parents:
diff changeset
1624 blv_prev_party_y = pParty->vPosition.z;
Ritor1
parents:
diff changeset
1625 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
1626 {
Ritor1
parents:
diff changeset
1627 auto v67 = GetTickCount() / 500;
Ritor1
parents:
diff changeset
1628 if (dword_720CDC != v67 )
Ritor1
parents:
diff changeset
1629 {
1285
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1630 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x;
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1631 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y;
62f4cdaa726b shot from a bow and more
Ritor1
parents: 1284
diff changeset
1632 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
1633 if ( dword_4F8580[0] > 60 )
Ritor1
parents:
diff changeset
1634 dword_4F8580[0] = 1;
Ritor1
parents:
diff changeset
1635 }
Ritor1
parents:
diff changeset
1636 dword_720CDC = v67;
Ritor1
parents:
diff changeset
1637 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1638
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1639 uint fall_start;
0
Ritor1
parents:
diff changeset
1640 if (!pParty->FeatherFallActive())
Ritor1
parents:
diff changeset
1641 {
Ritor1
parents:
diff changeset
1642 bFeatherFall = false;
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1643 if (!pParty->pPlayers[0].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && // grants feather fall
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1644 !pParty->pPlayers[1].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) &&
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1645 !pParty->pPlayers[2].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) &&
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1646 !pParty->pPlayers[3].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY))
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1647 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1648 fall_start = pParty->uFallStartY;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1649 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1650 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1651 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1652 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1653 fall_start = floor_level;
0
Ritor1
parents:
diff changeset
1654 bFeatherFall = true;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1655 pParty->uFallStartY = floor_level;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1656 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1657
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1658
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1659 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1660 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1661 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
1662 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
1663 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
1664 else for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1665 { // receive falling damage
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1666 auto player = pParty->pPlayers + i;
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1667 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS))
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1668 {
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1669 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL);
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1670 v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1671 player->SetRecoveryTime((signed __int64)v10);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1672 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1673 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1674 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1675
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1676 if ( party_z > floor_level + 1 )
0
Ritor1
parents:
diff changeset
1677 bJumping = 1;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1678
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1679 bool jumping_up = false;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1680
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1681 if ( party_z - floor_level <= 32 )
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1682 {
0
Ritor1
parents:
diff changeset
1683 pParty->uFallStartY = party_z;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1684 jumping_up = true;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1685 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1686
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1687 if (bWalkSound && pParty->walk_sound_timer)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1688 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1689 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1690 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1691 else pParty->walk_sound_timer = 0;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1692 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1693
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1694
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1695 if (party_z <= floor_level + 1)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1696 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1697 party_z = floor_level + 1;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1698 pParty->uFallStartY = floor_level + 1;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1699
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1700 if (!bJumping && pParty->floor_face_pid != uFaceID)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1701 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1702 auto pFace = &pIndoor->pFaces[uFaceID];
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1703 if (pFace->uAttributes & FACE_PRESSURE_PLATE)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1704 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1705 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1706 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1707 if (!bJumping)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1708 pParty->floor_face_pid = uFaceID;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1709
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1710 bool on_water = false;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1711 if ( pIndoor->pFaces[uFaceID].Fluid())
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1712 on_water = true;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1713
0
Ritor1
parents:
diff changeset
1714 v81 = pParty->uWalkSpeed;
Ritor1
parents:
diff changeset
1715 angle = pParty->sRotationY;
Ritor1
parents:
diff changeset
1716 _view_angle = pParty->sRotationX;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1717 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
0
Ritor1
parents:
diff changeset
1718 / 180)) >> 16;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1719 //LABEL_87:
0
Ritor1
parents:
diff changeset
1720 while ( pPartyActionQueue->uNumActions )
Ritor1
parents:
diff changeset
1721 {
Ritor1
parents:
diff changeset
1722 switch ( pPartyActionQueue->Next() )
Ritor1
parents:
diff changeset
1723 {
Ritor1
parents:
diff changeset
1724 case PARTY_TurnLeft:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1725 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1726 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1727 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1728 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1729 break;
0
Ritor1
parents:
diff changeset
1730 case PARTY_TurnRight:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1731 if (uTurnSpeed)
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1732 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1733 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1734 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1735 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1736
0
Ritor1
parents:
diff changeset
1737 case PARTY_FastTurnLeft:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1738 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1739 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
0
Ritor1
parents:
diff changeset
1740 else
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1741 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1742 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1743
0
Ritor1
parents:
diff changeset
1744 case PARTY_FastTurnRight:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1745 if (uTurnSpeed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1746 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1747 else
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1748 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1749 break;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1750
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1751 case PARTY_StrafeLeft:
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1752 v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1753 v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
717
Ritor1
parents: 688
diff changeset
1754 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1755 break;
0
Ritor1
parents:
diff changeset
1756 case PARTY_StrafeRight:
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1757 v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1758 v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
717
Ritor1
parents: 688
diff changeset
1759 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1760 break;
0
Ritor1
parents:
diff changeset
1761 case PARTY_WalkForward:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1762 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1763 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
717
Ritor1
parents: 688
diff changeset
1764 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1765 break;
0
Ritor1
parents:
diff changeset
1766 case PARTY_WalkBackward:
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1767 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1768 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
0
Ritor1
parents:
diff changeset
1769 v78 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1770 break;
0
Ritor1
parents:
diff changeset
1771 case PARTY_RunForward:
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1772 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1773 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
0
Ritor1
parents:
diff changeset
1774 v72 = 1;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1775 break;
0
Ritor1
parents:
diff changeset
1776 case PARTY_RunBackward:
Ritor1
parents:
diff changeset
1777 //v32 = stru_5C6E00->SinCos(angle);
Ritor1
parents:
diff changeset
1778 //v33 = (double)v81;
Ritor1
parents:
diff changeset
1779 //v88 = (double)v81;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1780 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
0
Ritor1
parents:
diff changeset
1781 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1782 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
0
Ritor1
parents:
diff changeset
1783 v72 = 1;
807
Ritor1
parents: 795
diff changeset
1784 break;
0
Ritor1
parents:
diff changeset
1785 case PARTY_LookUp:
Ritor1
parents:
diff changeset
1786 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
Ritor1
parents:
diff changeset
1787 if ( _view_angle > 128 )
Ritor1
parents:
diff changeset
1788 _view_angle = 128;
Ritor1
parents:
diff changeset
1789 v35 = uActiveCharacter;
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1790 if ( uActiveCharacter )
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1791 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
717
Ritor1
parents: 688
diff changeset
1792 break;
0
Ritor1
parents:
diff changeset
1793 case PARTY_LookDown:
Ritor1
parents:
diff changeset
1794 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
Ritor1
parents:
diff changeset
1795 if ( _view_angle < -128 )
Ritor1
parents:
diff changeset
1796 _view_angle = -128;
Ritor1
parents:
diff changeset
1797 v35 = uActiveCharacter;
Ritor1
parents:
diff changeset
1798 if ( uActiveCharacter )
717
Ritor1
parents: 688
diff changeset
1799 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
0
Ritor1
parents:
diff changeset
1800 break;
Ritor1
parents:
diff changeset
1801 case PARTY_CenterView:
Ritor1
parents:
diff changeset
1802 _view_angle = 0;
Ritor1
parents:
diff changeset
1803 break;
Ritor1
parents:
diff changeset
1804 case PARTY_Jump:
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1805 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
0
Ritor1
parents:
diff changeset
1806 {
Ritor1
parents:
diff changeset
1807 bJumping = 1;
717
Ritor1
parents: 688
diff changeset
1808 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
0
Ritor1
parents:
diff changeset
1809 }
Ritor1
parents:
diff changeset
1810 break;
Ritor1
parents:
diff changeset
1811 default:
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 807
diff changeset
1812 break;
0
Ritor1
parents:
diff changeset
1813 }
Ritor1
parents:
diff changeset
1814 }
Ritor1
parents:
diff changeset
1815 v36 = 0;
Ritor1
parents:
diff changeset
1816 pParty->sRotationY = angle;
Ritor1
parents:
diff changeset
1817 pParty->sRotationX = _view_angle;
Ritor1
parents:
diff changeset
1818 if ( bJumping )
Ritor1
parents:
diff changeset
1819 {
717
Ritor1
parents: 688
diff changeset
1820 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
0
Ritor1
parents:
diff changeset
1821 }
Ritor1
parents:
diff changeset
1822 else
Ritor1
parents:
diff changeset
1823 {
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1824 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
0
Ritor1
parents:
diff changeset
1825 {
717
Ritor1
parents: 688
diff changeset
1826 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
0
Ritor1
parents:
diff changeset
1827 goto LABEL_92;
Ritor1
parents:
diff changeset
1828 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
1829 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
0
Ritor1
parents:
diff changeset
1830 goto LABEL_92;
717
Ritor1
parents: 688
diff changeset
1831 pParty->uFallSpeed = 0;
Ritor1
parents: 688
diff changeset
1832 }
Ritor1
parents: 688
diff changeset
1833 if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
Ritor1
parents: 688
diff changeset
1834 {
Ritor1
parents: 688
diff changeset
1835 if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
0
Ritor1
parents:
diff changeset
1836 {
Ritor1
parents:
diff changeset
1837 v41 = &pPlayers[1];
Ritor1
parents:
diff changeset
1838 do
Ritor1
parents:
diff changeset
1839 {
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
1840 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1841 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
0
Ritor1
parents:
diff changeset
1842 ++v41;
Ritor1
parents:
diff changeset
1843 }
Ritor1
parents:
diff changeset
1844 while ( (signed int)v41 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
1845 }
Ritor1
parents:
diff changeset
1846 goto LABEL_93;
Ritor1
parents:
diff changeset
1847 }
Ritor1
parents:
diff changeset
1848 LABEL_92:
Ritor1
parents:
diff changeset
1849 pParty->uFallStartY = party_z;
Ritor1
parents:
diff changeset
1850 LABEL_93:
Ritor1
parents:
diff changeset
1851 if ( v2 * v2 + v1 * v1 < 400 )
Ritor1
parents:
diff changeset
1852 {
Ritor1
parents:
diff changeset
1853 v1 = 0;
Ritor1
parents:
diff changeset
1854 v2 = 0;
Ritor1
parents:
diff changeset
1855 }
Ritor1
parents:
diff changeset
1856 stru_721530.field_84 = -1;
Ritor1
parents:
diff changeset
1857 stru_721530.field_70 = 0;
Ritor1
parents:
diff changeset
1858 stru_721530.prolly_normal_d = pParty->field_14;
Ritor1
parents:
diff changeset
1859 stru_721530.field_8 = pParty->field_14 >> 1;
Ritor1
parents:
diff changeset
1860 auto v83 = 0;
Ritor1
parents:
diff changeset
1861 stru_721530.field_0 = 1;
Ritor1
parents:
diff changeset
1862 stru_721530.field_C = pParty->uPartyHeight - 32;
Ritor1
parents:
diff changeset
1863 while ( 1 )
Ritor1
parents:
diff changeset
1864 {
Ritor1
parents:
diff changeset
1865 new_party_z = party_z;
Ritor1
parents:
diff changeset
1866 stru_721530.field_34.x = new_party_x;
Ritor1
parents:
diff changeset
1867 stru_721530.normal.x = new_party_x;
Ritor1
parents:
diff changeset
1868 stru_721530.field_1C = v2;
Ritor1
parents:
diff changeset
1869 stru_721530.field_34.y = new_party_y;
Ritor1
parents:
diff changeset
1870 stru_721530.normal.y = new_party_y;
Ritor1
parents:
diff changeset
1871 stru_721530.field_20 = v1;
Ritor1
parents:
diff changeset
1872 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
Ritor1
parents:
diff changeset
1873 stru_721530.field_34.z = stru_721530.field_C + party_z + 1;
717
Ritor1
parents: 688
diff changeset
1874 stru_721530.field_24 = pParty->uFallSpeed;
0
Ritor1
parents:
diff changeset
1875 stru_721530.uSectorID = uSectorID;
Ritor1
parents:
diff changeset
1876 v38 = 0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1877 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
0
Ritor1
parents:
diff changeset
1878 v38 = 13312;
Ritor1
parents:
diff changeset
1879 if ( stru_721530._47050A(v38) )
Ritor1
parents:
diff changeset
1880 break;
Ritor1
parents:
diff changeset
1881 v73 = 0;
Ritor1
parents:
diff changeset
1882 do
Ritor1
parents:
diff changeset
1883 {
Ritor1
parents:
diff changeset
1884 _46E44E_collide_against_faces_and_portals(1u);
Ritor1
parents:
diff changeset
1885 _46E0B2_collide_against_decorations();
Ritor1
parents:
diff changeset
1886 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
Ritor1
parents:
diff changeset
1887 _46DF1A_collide_against_actor(v80, 0);
Ritor1
parents:
diff changeset
1888 if ( _46F04E_collide_against_portals() )
Ritor1
parents:
diff changeset
1889 break;
Ritor1
parents:
diff changeset
1890 ++v73;
Ritor1
parents:
diff changeset
1891 }
Ritor1
parents:
diff changeset
1892 while ( v73 < 100 );
Ritor1
parents:
diff changeset
1893 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1894 {
Ritor1
parents:
diff changeset
1895 v39 = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
1896 uSectorID = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
1897 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
1898 }
Ritor1
parents:
diff changeset
1899 else
Ritor1
parents:
diff changeset
1900 {
Ritor1
parents:
diff changeset
1901 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x;
Ritor1
parents:
diff changeset
1902 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
Ritor1
parents:
diff changeset
1903 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
Ritor1
parents:
diff changeset
1904 }
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1905 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
1906 if ( v42 == -30000 || v42 - new_party_z > 128 )
Ritor1
parents:
diff changeset
1907 return;
Ritor1
parents:
diff changeset
1908 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
1909 {
Ritor1
parents:
diff changeset
1910 new_party_x = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
1911 new_party_y = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
1912 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
1913 break;
Ritor1
parents:
diff changeset
1914 }
Ritor1
parents:
diff changeset
1915 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
1916 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
1917 v43 = stru_721530.uFaceID;
Ritor1
parents:
diff changeset
1918 uSectorID = stru_721530.uSectorID;
Ritor1
parents:
diff changeset
1919 stru_721530.field_70 += stru_721530.field_7C;
Ritor1
parents:
diff changeset
1920 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1921 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
1922 {
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1923 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1924 && (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
1925 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
0
Ritor1
parents:
diff changeset
1926 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1927 goto LABEL_152;
Ritor1
parents:
diff changeset
1928 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1929 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
1930 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
1931 v53 = integer_sqrt(v2 * v2 + v1 * v1);
0
Ritor1
parents:
diff changeset
1932 v80 = v53;
717
Ritor1
parents: 688
diff changeset
1933 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
0
Ritor1
parents:
diff changeset
1934 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1935 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
1936 v55 = stru_5C6E00->Sin(v54);
0
Ritor1
parents:
diff changeset
1937 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
Ritor1
parents:
diff changeset
1938 }
Ritor1
parents:
diff changeset
1939 else
Ritor1
parents:
diff changeset
1940 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1941 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
0
Ritor1
parents:
diff changeset
1942 {
Ritor1
parents:
diff changeset
1943 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
Ritor1
parents:
diff changeset
1944 v45 = v44->uPolygonType;
Ritor1
parents:
diff changeset
1945 if ( v45 == 3 )
Ritor1
parents:
diff changeset
1946 {
717
Ritor1
parents: 688
diff changeset
1947 if ( pParty->uFallSpeed < 0 )
Ritor1
parents: 688
diff changeset
1948 pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
1949 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
Ritor1
parents:
diff changeset
1950 if ( pParty->uFallStartY - v87 < 512 )
Ritor1
parents:
diff changeset
1951 pParty->uFallStartY = v87;
Ritor1
parents:
diff changeset
1952 if ( v2 * v2 + v1 * v1 < 400 )
Ritor1
parents:
diff changeset
1953 {
Ritor1
parents:
diff changeset
1954 v1 = 0;
Ritor1
parents:
diff changeset
1955 v2 = 0;
Ritor1
parents:
diff changeset
1956 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1957 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
717
Ritor1
parents: 688
diff changeset
1958 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
Ritor1
parents: 688
diff changeset
1959 goto LABEL_152;
Ritor1
parents: 688
diff changeset
1960 }
Ritor1
parents: 688
diff changeset
1961 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
0
Ritor1
parents:
diff changeset
1962 v47 = v45 == 4;
Ritor1
parents:
diff changeset
1963 v48 = v44->pFacePlane_old.vNormal.x;
Ritor1
parents:
diff changeset
1964 if ( !v47 )
Ritor1
parents:
diff changeset
1965 {
Ritor1
parents:
diff changeset
1966 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
Ritor1
parents:
diff changeset
1967 if ( stru_721530.field_64 >> 3 > v80 )
Ritor1
parents:
diff changeset
1968 v80 = stru_721530.field_64 >> 3;
Ritor1
parents:
diff changeset
1969 v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
1970 v81 = v44->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
1971 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
Ritor1
parents:
diff changeset
1972 v82 = v44->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
1973 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
Ritor1
parents:
diff changeset
1974 v2 += v50;
717
Ritor1
parents: 688
diff changeset
1975 pParty->uFallSpeed += v82;
0
Ritor1
parents:
diff changeset
1976 v74 = v44->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
1977 v51 = v44->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
1978 v69 = v44->pFacePlane_old.vNormal.x;
Ritor1
parents:
diff changeset
1979 v80 = v51;
Ritor1
parents:
diff changeset
1980 v1 += v81;
Ritor1
parents:
diff changeset
1981 v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16);
Ritor1
parents:
diff changeset
1982 if ( v52 > 0 )
Ritor1
parents:
diff changeset
1983 {
Ritor1
parents:
diff changeset
1984 new_party_x += v52 * v69 >> 16;
Ritor1
parents:
diff changeset
1985 new_party_y += v52 * v80 >> 16;
Ritor1
parents:
diff changeset
1986 v87 += v52 * v74 >> 16;
Ritor1
parents:
diff changeset
1987 }
Ritor1
parents:
diff changeset
1988 v43 = stru_721530.uFaceID;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1989 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
0
Ritor1
parents:
diff changeset
1990 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
Ritor1
parents:
diff changeset
1991 goto LABEL_152;
Ritor1
parents:
diff changeset
1992 }
Ritor1
parents:
diff changeset
1993 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
Ritor1
parents:
diff changeset
1994 if ( stru_721530.field_64 >> 3 > v80 )
Ritor1
parents:
diff changeset
1995 v80 = stru_721530.field_64 >> 3;
Ritor1
parents:
diff changeset
1996 v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
1997 v81 = v44->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
1998 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
Ritor1
parents:
diff changeset
1999 v82 = v44->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
2000 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
Ritor1
parents:
diff changeset
2001 v2 += v49;
Ritor1
parents:
diff changeset
2002 v1 += v81;
717
Ritor1
parents: 688
diff changeset
2003 pParty->uFallSpeed += v82;
0
Ritor1
parents:
diff changeset
2004 if ( v2 * v2 + v1 * v1 >= 400 )
717
Ritor1
parents: 688
diff changeset
2005 {
Ritor1
parents: 688
diff changeset
2006 v43 = stru_721530.uFaceID;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2007 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
717
Ritor1
parents: 688
diff changeset
2008 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
Ritor1
parents: 688
diff changeset
2009 goto LABEL_152;
Ritor1
parents: 688
diff changeset
2010 }
0
Ritor1
parents:
diff changeset
2011 v2 = 0;
Ritor1
parents:
diff changeset
2012 v1 = 0;
717
Ritor1
parents: 688
diff changeset
2013 pParty->uFallSpeed = 0;
0
Ritor1
parents:
diff changeset
2014 }
Ritor1
parents:
diff changeset
2015 }
Ritor1
parents:
diff changeset
2016 LABEL_152:
Ritor1
parents:
diff changeset
2017 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
Ritor1
parents:
diff changeset
2018 v1 = (unsigned __int64)(58500i64 * v1) >> 16;
Ritor1
parents:
diff changeset
2019 ++v83;
717
Ritor1
parents: 688
diff changeset
2020 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
0
Ritor1
parents:
diff changeset
2021 if ( v83 >= 100 )
Ritor1
parents:
diff changeset
2022 {
Ritor1
parents:
diff changeset
2023 new_party_z = v87;
Ritor1
parents:
diff changeset
2024 break;
Ritor1
parents:
diff changeset
2025 }
Ritor1
parents:
diff changeset
2026 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2027 if ( bWalkSound && !pParty->walk_sound_timer)
0
Ritor1
parents:
diff changeset
2028 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
2029 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
2030 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z)
Ritor1
parents: 688
diff changeset
2031 * (pParty->vPosition.z - new_party_z)) <= 16 )
0
Ritor1
parents:
diff changeset
2032 goto LABEL_188;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2033 if ( v72 && (!bJumping || jumping_up) )
0
Ritor1
parents:
diff changeset
2034 {
Ritor1
parents:
diff changeset
2035 v66 = 0;
Ritor1
parents:
diff changeset
2036 v64 = 0;
Ritor1
parents:
diff changeset
2037 v62 = 0;
Ritor1
parents:
diff changeset
2038 v61 = 0;
Ritor1
parents:
diff changeset
2039 v60 = -1;
Ritor1
parents:
diff changeset
2040 v59 = 1;
Ritor1
parents:
diff changeset
2041 v58 = 804;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2042 if ( !on_water )
0
Ritor1
parents:
diff changeset
2043 {
Ritor1
parents:
diff changeset
2044 v56 = pAudioPlayer;
Ritor1
parents:
diff changeset
2045 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
2046 v57 = (SoundID)50;
Ritor1
parents:
diff changeset
2047 else
Ritor1
parents:
diff changeset
2048 v57 = (SoundID)64;
Ritor1
parents:
diff changeset
2049 goto LABEL_175;
Ritor1
parents:
diff changeset
2050 }
Ritor1
parents:
diff changeset
2051 v57 = (SoundID)63;
Ritor1
parents:
diff changeset
2052 v56 = pAudioPlayer;
Ritor1
parents:
diff changeset
2053 goto LABEL_175;
Ritor1
parents:
diff changeset
2054 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2055 if ( v78 && (!bJumping || jumping_up) )
0
Ritor1
parents:
diff changeset
2056 {
Ritor1
parents:
diff changeset
2057 v66 = 0;
Ritor1
parents:
diff changeset
2058 v64 = 0;
Ritor1
parents:
diff changeset
2059 v62 = 0;
Ritor1
parents:
diff changeset
2060 v61 = 0;
Ritor1
parents:
diff changeset
2061 v60 = -1;
Ritor1
parents:
diff changeset
2062 v59 = 1;
Ritor1
parents:
diff changeset
2063 v58 = 804;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2064 if ( on_water )
0
Ritor1
parents:
diff changeset
2065 {
Ritor1
parents:
diff changeset
2066 v57 = (SoundID)102;
717
Ritor1
parents: 688
diff changeset
2067 v56 = pAudioPlayer;
Ritor1
parents: 688
diff changeset
2068 goto LABEL_175;
0
Ritor1
parents:
diff changeset
2069 }
Ritor1
parents:
diff changeset
2070 v56 = pAudioPlayer;
Ritor1
parents:
diff changeset
2071 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
2072 v57 = (SoundID)89;
Ritor1
parents:
diff changeset
2073 else
Ritor1
parents:
diff changeset
2074 v57 = (SoundID)103;
Ritor1
parents:
diff changeset
2075 LABEL_175:
Ritor1
parents:
diff changeset
2076 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66);
Ritor1
parents:
diff changeset
2077 }
Ritor1
parents:
diff changeset
2078 else
Ritor1
parents:
diff changeset
2079 {
Ritor1
parents:
diff changeset
2080 LABEL_188:
Ritor1
parents:
diff changeset
2081 pAudioPlayer->_4AA258(804);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2082 pParty->walk_sound_timer = 64;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2083 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2084 }
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2085 if ( !bJumping || jumping_up )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2086 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2087 else
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2088 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2089 pParty->uFlags &= ~0x200;
0
Ritor1
parents:
diff changeset
2090 pParty->vPosition.x = new_party_x;
Ritor1
parents:
diff changeset
2091 pParty->vPosition.z = new_party_z;
Ritor1
parents:
diff changeset
2092 pParty->vPosition.y = new_party_y;
717
Ritor1
parents: 688
diff changeset
2093 //pParty->uFallSpeed = v89;
0
Ritor1
parents:
diff changeset
2094 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2095 pParty->uFlags |= 0x200;
0
Ritor1
parents:
diff changeset
2096 if (uFaceEvent)
Ritor1
parents:
diff changeset
2097 EventProcessor(uFaceEvent, 0, 1);
Ritor1
parents:
diff changeset
2098 }
Ritor1
parents:
diff changeset
2099
Ritor1
parents:
diff changeset
2100 //----- (00473893) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2101 void ODM_ProcessPartyActions()
0
Ritor1
parents:
diff changeset
2102 {
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2103 //int _zero; // esi@1
0
Ritor1
parents:
diff changeset
2104 int v1; // edi@1
Ritor1
parents:
diff changeset
2105 int v2; // ebx@1
Ritor1
parents:
diff changeset
2106 int v3; // eax@14
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2107 //Player **v4; // esi@21
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2108 //int v5; // eax@24
0
Ritor1
parents:
diff changeset
2109 int v6; // esi@45
Ritor1
parents:
diff changeset
2110 ODMFace *v7; // ecx@45
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2111 //unsigned int v8; // eax@71
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2112 //double v9; // st7@72
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2113 //signed __int64 v10; // qax@74
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2114 //double v11; // st7@75
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2115 //int v12; // ecx@77
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2116 //int v13; // eax@84
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2117 //double v14; // st7@84
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2118 //int v15; // eax@87
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2119 //double v16; // st7@87
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2120 //int v17; // eax@88
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2121 //double v18; // st7@88
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2122 //int v19; // eax@89
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2123 //double v20; // st7@89
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2124 //int v21; // eax@92
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2125 //double v22; // st7@92
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2126 //int v23; // eax@96
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2127 //double v24; // st7@96
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2128 //int v25; // eax@97
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2129 //double v26; // st7@97
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2130 //int v27; // eax@98
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2131 //double v28; // st7@98
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2132 //signed __int64 v29; // qax@98
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2133 //unsigned int v30; // eax@103
0
Ritor1
parents:
diff changeset
2134 int v31; // eax@130
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2135 //int v32; // ecx@141
0
Ritor1
parents:
diff changeset
2136 signed int v33; // eax@143
Ritor1
parents:
diff changeset
2137 int v34; // esi@143
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2138 int v35; // esi@147
0
Ritor1
parents:
diff changeset
2139 int v36; // eax@155
Ritor1
parents:
diff changeset
2140 signed int v37; // esi@159
Ritor1
parents:
diff changeset
2141 signed int v38; // eax@159
Ritor1
parents:
diff changeset
2142 signed int i; // esi@159
Ritor1
parents:
diff changeset
2143 int v40; // esi@162
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2144 //Player **v41; // esi@172
0
Ritor1
parents:
diff changeset
2145 bool v42; // eax@180
Ritor1
parents:
diff changeset
2146 signed int v43; // ecx@184
Ritor1
parents:
diff changeset
2147 signed int v44; // edx@184
Ritor1
parents:
diff changeset
2148 int v45; // ecx@200
Ritor1
parents:
diff changeset
2149 BSPModel *v46; // eax@203
Ritor1
parents:
diff changeset
2150 ODMFace *v47; // esi@203
Ritor1
parents:
diff changeset
2151 int v48; // eax@203
Ritor1
parents:
diff changeset
2152 char v49; // zf@203
Ritor1
parents:
diff changeset
2153 char v50; // sf@203
Ritor1
parents:
diff changeset
2154 unsigned __int8 v51; // of@203
Ritor1
parents:
diff changeset
2155 int v52; // eax@203
Ritor1
parents:
diff changeset
2156 unsigned __int8 v53; // dl@205
Ritor1
parents:
diff changeset
2157 BSPModel *v54; // eax@215
Ritor1
parents:
diff changeset
2158 int v55; // eax@217
Ritor1
parents:
diff changeset
2159 signed int v56; // ebx@228
Ritor1
parents:
diff changeset
2160 int v57; // eax@228
Ritor1
parents:
diff changeset
2161 BSPModel *v58; // eax@228
Ritor1
parents:
diff changeset
2162 unsigned __int64 v59; // qax@228
Ritor1
parents:
diff changeset
2163 BSPModel *v60; // eax@228
Ritor1
parents:
diff changeset
2164 unsigned __int64 v61; // qax@228
Ritor1
parents:
diff changeset
2165 int v62; // eax@241
Ritor1
parents:
diff changeset
2166 signed int v63; // ST04_4@255
Ritor1
parents:
diff changeset
2167 signed int v64; // eax@255
Ritor1
parents:
diff changeset
2168 unsigned int v65; // ebx@263
Ritor1
parents:
diff changeset
2169 unsigned int v66; // esi@263
Ritor1
parents:
diff changeset
2170 int v67; // eax@263
Ritor1
parents:
diff changeset
2171 signed int v68; // ecx@263
Ritor1
parents:
diff changeset
2172 int v69; // eax@263
Ritor1
parents:
diff changeset
2173 int v70; // ebx@271
Ritor1
parents:
diff changeset
2174 int v71; // esi@271
Ritor1
parents:
diff changeset
2175 int v72; // edi@271
Ritor1
parents:
diff changeset
2176 int v73; // eax@271
Ritor1
parents:
diff changeset
2177 Player **v74; // esi@283
Ritor1
parents:
diff changeset
2178 int v75; // eax@284
Ritor1
parents:
diff changeset
2179 unsigned int v76; // edi@293
Ritor1
parents:
diff changeset
2180 bool v77; // edx@297
Ritor1
parents:
diff changeset
2181 bool v78; // ecx@303
Ritor1
parents:
diff changeset
2182 int v79; // ecx@314
Ritor1
parents:
diff changeset
2183 __int16 v80; // dx@317
Ritor1
parents:
diff changeset
2184 int v81; // ebx@318
Ritor1
parents:
diff changeset
2185 int v82; // ecx@318
Ritor1
parents:
diff changeset
2186 int v83; // eax@321
Ritor1
parents:
diff changeset
2187 Player **v84; // esi@333
Ritor1
parents:
diff changeset
2188 int v85; // eax@334
Ritor1
parents:
diff changeset
2189 int v86; // [sp-20h] [bp-B4h]@246
Ritor1
parents:
diff changeset
2190 int v87; // [sp-20h] [bp-B4h]@248
Ritor1
parents:
diff changeset
2191 signed int v88; // [sp-1Ch] [bp-B0h]@246
Ritor1
parents:
diff changeset
2192 unsigned int v89; // [sp-18h] [bp-ACh]@246
Ritor1
parents:
diff changeset
2193 signed int v90; // [sp-14h] [bp-A8h]@246
Ritor1
parents:
diff changeset
2194 signed int v91; // [sp-10h] [bp-A4h]@246
Ritor1
parents:
diff changeset
2195 int v92; // [sp-Ch] [bp-A0h]@246
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2196 //int v93; // [sp-8h] [bp-9Ch]@104
0
Ritor1
parents:
diff changeset
2197 unsigned int v94; // [sp-8h] [bp-9Ch]@246
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2198 //int v95; // [sp-4h] [bp-98h]@104
0
Ritor1
parents:
diff changeset
2199 int v96; // [sp-4h] [bp-98h]@246
Ritor1
parents:
diff changeset
2200 int v97; // [sp+Ch] [bp-88h]@180
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2201 Vec3_int_ v98;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2202 //int v98; // [sp+10h] [bp-84h]@147
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2203 //int v99; // [sp+14h] [bp-80h]@147
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2204 //int v100; // [sp+18h] [bp-7Ch]@147
0
Ritor1
parents:
diff changeset
2205 bool v101; // [sp+1Ch] [bp-78h]@33
Ritor1
parents:
diff changeset
2206 int v102; // [sp+20h] [bp-74h]@1
Ritor1
parents:
diff changeset
2207 int v103; // [sp+24h] [bp-70h]@1
Ritor1
parents:
diff changeset
2208 int bFeatherFall; // [sp+28h] [bp-6Ch]@4
Ritor1
parents:
diff changeset
2209 int v105; // [sp+2Ch] [bp-68h]@24
Ritor1
parents:
diff changeset
2210 int bWaterWalk; // [sp+30h] [bp-64h]@1
Ritor1
parents:
diff changeset
2211 bool v107; // [sp+34h] [bp-60h]@30
Ritor1
parents:
diff changeset
2212 int v108; // [sp+38h] [bp-5Ch]@1
Ritor1
parents:
diff changeset
2213 int v109; // [sp+3Ch] [bp-58h]@28
Ritor1
parents:
diff changeset
2214 int v110; // [sp+40h] [bp-54h]@180
Ritor1
parents:
diff changeset
2215 int v111; // [sp+44h] [bp-50h]@14
Ritor1
parents:
diff changeset
2216 int bJumping; // [sp+48h] [bp-4Ch]@1
Ritor1
parents:
diff changeset
2217 int v113; // [sp+4Ch] [bp-48h]@1
Ritor1
parents:
diff changeset
2218 unsigned int v114; // [sp+50h] [bp-44h]@1
Ritor1
parents:
diff changeset
2219 int _walk_speed; // [sp+54h] [bp-40h]@48
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2220 int pX; // [sp+58h] [bp-3Ch]@1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2221 int pY; // [sp+5Ch] [bp-38h]@1
0
Ritor1
parents:
diff changeset
2222 int v118; // [sp+60h] [bp-34h]@1
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2223 //Player **v119; // [sp+64h] [bp-30h]@4
0
Ritor1
parents:
diff changeset
2224 int _angle_x; // [sp+68h] [bp-2Ch]@48
Ritor1
parents:
diff changeset
2225 int v121; // [sp+6Ch] [bp-28h]@1
Ritor1
parents:
diff changeset
2226 unsigned int v122; // [sp+70h] [bp-24h]@180
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2227 int pZ; // [sp+74h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
2228 int v124; // [sp+78h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
2229 int _angle_y; // [sp+7Ch] [bp-18h]@48
Ritor1
parents:
diff changeset
2230 int v126; // [sp+80h] [bp-14h]@48
Ritor1
parents:
diff changeset
2231 BSPModel *v127; // [sp+84h] [bp-10h]@1
Ritor1
parents:
diff changeset
2232 int v128; // [sp+88h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2233 int v129; // [sp+8Ch] [bp-8h]@92
Ritor1
parents:
diff changeset
2234 int v130; // [sp+90h] [bp-4h]@14
Ritor1
parents:
diff changeset
2235
Ritor1
parents:
diff changeset
2236 v121 = pParty->uFallSpeed;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2237 pZ = pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
2238 v1 = 0;
Ritor1
parents:
diff changeset
2239 v103 = 0;
Ritor1
parents:
diff changeset
2240 v2 = 0;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2241 //*(float *)&v128 = 0.0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2242 v128 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2243 v129 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2244 pX = pParty->vPosition.x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2245 pY = pParty->vPosition.y;
0
Ritor1
parents:
diff changeset
2246 v113 = pParty->field_6F0;
Ritor1
parents:
diff changeset
2247 bJumping = 0;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2248 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
0
Ritor1
parents:
diff changeset
2249 v114 = 0;
Ritor1
parents:
diff changeset
2250 v124 = 0;
Ritor1
parents:
diff changeset
2251 v108 = 0;
Ritor1
parents:
diff changeset
2252 v102 = 0;
Ritor1
parents:
diff changeset
2253 v127 = 0;
Ritor1
parents:
diff changeset
2254 bWaterWalk = 0;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2255 if (!pParty->FeatherFallActive())
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2256 //SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2257 //|| SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 )
0
Ritor1
parents:
diff changeset
2258 {
Ritor1
parents:
diff changeset
2259 bFeatherFall = 0;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2260 /*v119 = &pPlayers[1];
0
Ritor1
parents:
diff changeset
2261 while ( !(*v119)->WearsItem(536, 16) )
Ritor1
parents:
diff changeset
2262 {
Ritor1
parents:
diff changeset
2263 ++v119;
Ritor1
parents:
diff changeset
2264 if ( (signed int)v119 > (signed int)&pPlayers[4] )
Ritor1
parents:
diff changeset
2265 goto LABEL_9;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2266 }*/
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2267 for (int i = 0; i < 4; ++i)
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
2268 if (pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY)) // seems like flying boots
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2269 {
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2270 bFeatherFall = 1;
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2271 break;
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2272 }
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2273 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2274 else
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2275 {
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2276 bFeatherFall = 1;
279a315ff122 * first cast_spell clean
zipi
parents: 882
diff changeset
2277 }
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2278 //LABEL_9:
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2279 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2280 if (pParty->WaterWalkActive())
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2281 {
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2282 //LOBYTE(pParty->uFlags) &= 0x7Fu;
0
Ritor1
parents:
diff changeset
2283 bWaterWalk = 1;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2284 *(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
2285 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
2286 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
0
Ritor1
parents:
diff changeset
2287 bWaterWalk = 0;
Ritor1
parents:
diff changeset
2288 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2289 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
0
Ritor1
parents:
diff changeset
2290 v111 = v3;
Ritor1
parents:
diff changeset
2291 if ( bFeatherFall )
Ritor1
parents:
diff changeset
2292 pParty->uFallStartY = v3;
Ritor1
parents:
diff changeset
2293 else
Ritor1
parents:
diff changeset
2294 v3 = pParty->uFallStartY;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2295 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )
0
Ritor1
parents:
diff changeset
2296 {
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2297 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2298 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2299 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2300 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2301 else for (int _i = 0; _i < 4; ++_i) // receive falling damage
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2302 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2303 auto player = pParty->pPlayers + _i;
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2304
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
2305 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2306 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2307 player->ReceiveDamage(
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2308 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2309 DMGT_PHISYCAL);
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2310 v105 = 20 - player->GetParameterBonus(player->GetActualEndurance());
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2311 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2312 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2313 //}
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2314 //while ( (signed int)v4 <= (signed int)&pPlayers[4] );
0
Ritor1
parents:
diff changeset
2315 }
Ritor1
parents:
diff changeset
2316 }
Ritor1
parents:
diff changeset
2317 v109 = -1;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2318 if ( pParty->bFlying )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2319 v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2320 v107 = v108 == 0;
0
Ritor1
parents:
diff changeset
2321 v105 = v111 + 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2322 if ( pZ <= v111 + 1 )
0
Ritor1
parents:
diff changeset
2323 {
Ritor1
parents:
diff changeset
2324 v109 = -1;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2325 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
2326 }
Ritor1
parents:
diff changeset
2327 else
Ritor1
parents:
diff changeset
2328 {
Ritor1
parents:
diff changeset
2329 bJumping = 1;
Ritor1
parents:
diff changeset
2330 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2331 v101 = pZ - v111 <= 32;
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2332 if ( bWalkSound && pParty->walk_sound_timer)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2333 {
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2334 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed)
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2335 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2336 else pParty->walk_sound_timer = 0;
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2337 }
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2338 if (!bUnderwater
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2339 && SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2340 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0) )
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2341 pParty->bFlying = false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2342 if (!bJumping)
0
Ritor1
parents:
diff changeset
2343 {
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2344 if ( pParty->floor_face_pid != PID(OBJECT_BModel, v108) )
0
Ritor1
parents:
diff changeset
2345 {
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2346 if (v108)
0
Ritor1
parents:
diff changeset
2347 {
Ritor1
parents:
diff changeset
2348 if ( v108 >> 6 < pOutdoor->uNumBModels )
Ritor1
parents:
diff changeset
2349 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2350 v7 = pOutdoor->pBModels[v108 >> 6].pFaces;
0
Ritor1
parents:
diff changeset
2351 v6 = v108 & 0x3F;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2352 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
0
Ritor1
parents:
diff changeset
2353 {
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
2354 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
0
Ritor1
parents:
diff changeset
2355 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2356 }*/
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2357 if ( BYTE3(v7[v6].uAttributes) & 4 )
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2358 {
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2359 pParty->floor_face_pid = PID(OBJECT_BModel, v108);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2360 v103 = v7[v6].sCogTriggeredID;
0
Ritor1
parents:
diff changeset
2361 }
Ritor1
parents:
diff changeset
2362 }
Ritor1
parents:
diff changeset
2363 }
Ritor1
parents:
diff changeset
2364 }
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
2365 pParty->floor_face_pid = PID(OBJECT_BModel, v108);
0
Ritor1
parents:
diff changeset
2366 }
Ritor1
parents:
diff changeset
2367 _walk_speed = pParty->uWalkSpeed;
Ritor1
parents:
diff changeset
2368 _angle_y = pParty->sRotationY;
Ritor1
parents:
diff changeset
2369 _angle_x = pParty->sRotationX;
Ritor1
parents:
diff changeset
2370 v126 = pEventTimer->dt_in_some_format;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2371 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
0
Ritor1
parents:
diff changeset
2372 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
Ritor1
parents:
diff changeset
2373 * stru_5C6E00->uIntegerPi)
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2374 / 180)) >> 16);*/
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2375 __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
2376 while (pPartyActionQueue->uNumActions)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2377 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2378 switch (pPartyActionQueue->Next())
0
Ritor1
parents:
diff changeset
2379 {
Ritor1
parents:
diff changeset
2380 case PARTY_FlyUp:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2381 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2382 if (!pParty->FlyActive() && !bUnderwater)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2383 break;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2384
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2385 pParty->bFlying = false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2386 if (bUnderwater ||
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2387 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2388 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )
0
Ritor1
parents:
diff changeset
2389 {
Ritor1
parents:
diff changeset
2390 if ( pParty->vPosition.z < 4000 || bJumping )
Ritor1
parents:
diff changeset
2391 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2392 pZ += 30;
0
Ritor1
parents:
diff changeset
2393 v113 += 30;
Ritor1
parents:
diff changeset
2394 pParty->bFlying = 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2395 if ( pZ > 4000 )
0
Ritor1
parents:
diff changeset
2396 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2397 pZ = 4000;
0
Ritor1
parents:
diff changeset
2398 v113 = 4000;
Ritor1
parents:
diff changeset
2399 }
Ritor1
parents:
diff changeset
2400 v1 = 0;
Ritor1
parents:
diff changeset
2401 v2 = 0;
Ritor1
parents:
diff changeset
2402 v121 = 0;
Ritor1
parents:
diff changeset
2403 *(float *)&v128 = 0.0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2404 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )
0
Ritor1
parents:
diff changeset
2405 {
Ritor1
parents:
diff changeset
2406 pParty->field_6E0 = 0;
Ritor1
parents:
diff changeset
2407 pParty->field_6E4 = 0;
Ritor1
parents:
diff changeset
2408 pPartyActionQueue->uNumActions = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
2409 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
2410 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2411 pParty->field_6F0 = pZ;
0
Ritor1
parents:
diff changeset
2412 pParty->bFlying = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2413 pZ = v109 - pParty->uPartyHeight - 31;
0
Ritor1
parents:
diff changeset
2414 v113 = pParty->field_6F0;
Ritor1
parents:
diff changeset
2415 }
Ritor1
parents:
diff changeset
2416 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
2417 v127 = (BSPModel *)1;
Ritor1
parents:
diff changeset
2418 }
Ritor1
parents:
diff changeset
2419 }
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2420 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2421 break;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2422
0
Ritor1
parents:
diff changeset
2423 case PARTY_FlyDown:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2424 if (pParty->FlyActive() || bUnderwater)
0
Ritor1
parents:
diff changeset
2425 {
Ritor1
parents:
diff changeset
2426 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2427 if ( bUnderwater
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2428 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2429 || 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
2430 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2431 pZ -= 30;
0
Ritor1
parents:
diff changeset
2432 v113 -= 30;
Ritor1
parents:
diff changeset
2433 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
2434 v121 = 0;
Ritor1
parents:
diff changeset
2435 pParty->bFlying = 1;
Ritor1
parents:
diff changeset
2436 v127 = (BSPModel *)1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2437 if ( pZ <= v111 )
0
Ritor1
parents:
diff changeset
2438 {
Ritor1
parents:
diff changeset
2439 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2440 pPartyActionQueue->uNumActions = 0;
Ritor1
parents:
diff changeset
2441 }
Ritor1
parents:
diff changeset
2442 }
Ritor1
parents:
diff changeset
2443 }
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2444 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2445
0
Ritor1
parents:
diff changeset
2446 case PARTY_TurnLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2447 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2448 _angle_y += uTurnSpeed; //descrete turn
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2449 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2450 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2451
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2452 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2453 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2454
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2455 case PARTY_TurnRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2456 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2457 _angle_y -= uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2458 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2459 _angle_y -= dturn * fTurnSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2460
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2461 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2462 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2463
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2464 case PARTY_FastTurnLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2465 if (uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2466 _angle_y += uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2467 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2468 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2469
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2470 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2471 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2472
0
Ritor1
parents:
diff changeset
2473 case PARTY_FastTurnRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2474 if (!uTurnSpeed)
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2475 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2476 else
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2477 _angle_y -= uTurnSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2478
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2479 _angle_y &= stru_5C6E00->uDoublePiMask;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2480 break;
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2481
0
Ritor1
parents:
diff changeset
2482 case PARTY_StrafeLeft:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2483 {
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2484 *(float *)&v128 = pParty->uWalkSpeed;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2485
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2486 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2487 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2488 v2 -= 3 * dx / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2489
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2490 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2491 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2492 v1 += 3 * dy / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2493
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2494 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2495 v124 = 1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2496 }
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2497 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2498
0
Ritor1
parents:
diff changeset
2499 case PARTY_StrafeRight:
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2500 {
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2501 *(float *)&v128 = pParty->uWalkSpeed;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2502
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2503 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2504 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2505 v2 += 3 * dx / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2506
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2507 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2508 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2509 v1 -= 3 * dy / 4;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2510
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2511 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2512 v124 = 1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2513 }
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2514 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2515
0
Ritor1
parents:
diff changeset
2516 case PARTY_WalkForward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2517 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2518 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2519
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2520 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2521 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2522
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2523 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
433
0eaed3e0d75f Walk speed x12 (debugging purposes)
Nomad
parents: 431
diff changeset
2524 v2 += dx * 12;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2525
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2526 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
433
0eaed3e0d75f Walk speed x12 (debugging purposes)
Nomad
parents: 431
diff changeset
2527 v1 += dy * 12;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2528
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2529 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2530 v124 = 1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2531 }
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2532 break;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2533
0
Ritor1
parents:
diff changeset
2534 case PARTY_RunForward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2535 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2536 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2537
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2538 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2539 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2540
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2541 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2542 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2543
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2544 if (pParty->bFlying)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2545 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2546 v2 += 4 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2547 v1 += 4 * dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2548
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2549 v128 = v1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2550 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2551 else if (partyAtHighSlope && !v108)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2552 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2553 v2 += dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2554 v1 += dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2555
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2556 v128 = v1;
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2557 v124 = 1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2558 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2559 else
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2560 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2561 v2 += 2 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2562 v1 += 2 * dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2563
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2564 v128 = v1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2565 v114 = 1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2566 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2567 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2568 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2569
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2570
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2571 case PARTY_WalkBackward:
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2572 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2573 *(float *)&v128 = _walk_speed;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2574
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2575 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2576 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2577
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2578 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2579 v2 -= dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2580
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2581 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2582 v1 -= dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2583
0
Ritor1
parents:
diff changeset
2584 v128 = v1;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2585 v124 = 1;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2586 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2587 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2588
139
7eeea515f5ff Refactored strafe
Nomad
parents: 138
diff changeset
2589
0
Ritor1
parents:
diff changeset
2590 case PARTY_RunBackward:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2591 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2592 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2593 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2594
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2595 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2596 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2597
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2598 if (pParty->bFlying)
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2599 {
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2600 v2 -= 4 * dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2601 v1 -= 4 * dy;
0
Ritor1
parents:
diff changeset
2602 v128 = v1;
Ritor1
parents:
diff changeset
2603 }
Ritor1
parents:
diff changeset
2604 else
Ritor1
parents:
diff changeset
2605 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2606 v2 -= dx;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2607 v1 -= dy;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2608
0
Ritor1
parents:
diff changeset
2609 v128 = v1;
Ritor1
parents:
diff changeset
2610 v124 = 1;
Ritor1
parents:
diff changeset
2611 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2612 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2613 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2614
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2615
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2616 case PARTY_CenterView:
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2617 _angle_x = 0;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2618 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2619
0
Ritor1
parents:
diff changeset
2620 case PARTY_LookUp:
Ritor1
parents:
diff changeset
2621 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
Ritor1
parents:
diff changeset
2622 if ( _angle_x > 128 )
Ritor1
parents:
diff changeset
2623 _angle_x = 128;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2624 if (uActiveCharacter)
187
49728858c35e On player voices
Nomad
parents: 186
diff changeset
2625 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0);
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2626 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2627
0
Ritor1
parents:
diff changeset
2628 case PARTY_LookDown:
Ritor1
parents:
diff changeset
2629 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
Ritor1
parents:
diff changeset
2630 if ( _angle_x < -128 )
Ritor1
parents:
diff changeset
2631 _angle_x = -128;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2632 if (uActiveCharacter)
187
49728858c35e On player voices
Nomad
parents: 186
diff changeset
2633 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0);
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2634 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2635
0
Ritor1
parents:
diff changeset
2636 case PARTY_Jump:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2637 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
0
Ritor1
parents:
diff changeset
2638 {
Ritor1
parents:
diff changeset
2639 v126 = pParty->field_24 << 6;
Ritor1
parents:
diff changeset
2640 bJumping = 1;
Ritor1
parents:
diff changeset
2641 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121);
Ritor1
parents:
diff changeset
2642 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2643 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2644
0
Ritor1
parents:
diff changeset
2645 default:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2646 assert(false);
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2647
0
Ritor1
parents:
diff changeset
2648 case PARTY_Land:
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2649 if (pParty->bFlying)
0
Ritor1
parents:
diff changeset
2650 {
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2651 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
2652 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
2653 }
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2654 pParty->bFlying = false;
0
Ritor1
parents:
diff changeset
2655 pPartyActionQueue->uNumActions = 0;
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2656 break;
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2657 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2658 }
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 139
diff changeset
2659
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2660 //LABEL_123:
0
Ritor1
parents:
diff changeset
2661 pParty->sRotationY = _angle_y;
Ritor1
parents:
diff changeset
2662 pParty->sRotationX = _angle_x;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2663 if ( pZ < v111 || pParty->bFlying)
0
Ritor1
parents:
diff changeset
2664 {
Ritor1
parents:
diff changeset
2665 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
2666 {
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2667 //LABEL_130:
0
Ritor1
parents:
diff changeset
2668 v31 = GetTickCount();
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2669 v126 = stru_5C6E00->Cos(v31);
0
Ritor1
parents:
diff changeset
2670 v129 = (unsigned __int64)(4i64 * v126) >> 16;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2671 pZ = v113 + v129;
0
Ritor1
parents:
diff changeset
2672 if ( v127 )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2673 pZ = v113;
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2674 if (pParty->FlyActive())
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2675 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2676 pParty->uFallStartY = pZ;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2677 //goto LABEL_141;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2678 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2679 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2680 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2681 if ( v130 && v121 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2682 sub_42F960_create_object(pX, pY, v111);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2683 v121 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2684 pZ = v111;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2685 pParty->uFallStartY = v111;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2686 v113 = pZ;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2687 if (pParty->FlyActive())
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2688 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
2689
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2690 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2691 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2692 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2693 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2694 v113 = pZ;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2695 if (pParty->FlyActive())
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
2696 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
2697 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2698 //LABEL_141:
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2699 if (bJumping && !pParty->bFlying)
0
Ritor1
parents:
diff changeset
2700 {
Ritor1
parents:
diff changeset
2701 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
Ritor1
parents:
diff changeset
2702 v34 = v121 + 2 * v33;
Ritor1
parents:
diff changeset
2703 v121 += 2 * v33;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2704 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2705 else if (!partyAtHighSlope)
0
Ritor1
parents:
diff changeset
2706 {
Ritor1
parents:
diff changeset
2707 v34 = v121;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2708 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2709 else if (!bJumping)
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2710 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2711 if ( !v108 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2712 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2713 // rolling down the hill
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2714 // 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
2715 // and falling to the gravity, gradually sliding downwards. nice trick
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2716 pZ = v111;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2717 ODM_GetTerrainNormalAt(pX, pY, &v98);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2718 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2719 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
2720 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2721 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2722 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2723 v128 = v1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2724 v121 = v34;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2725 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2726 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2727 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2728 v34 = v121;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2729
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2730 //LABEL_164:
1070
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2731 if(bJumping)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2732 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2733 if ( !bUnderwater && v34 <= 0)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2734 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2735 if ( v34 < -500
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2736 && !pParty->bFlying
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2737 && pParty->vPosition.z - v111 > 1000
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2738 && !pParty->FeatherFallActive())
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2739 { // falling scream
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2740 for (int i = 0; i < 4; ++i)
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2741 {
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2742 auto player = pParty->pPlayers + i;
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1072
diff changeset
2743 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
2744 player->PlaySound(SPEECH_66, 0);
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2745 }
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2746 }
944e8d715a3e previous mistake in ODM_ProcessPartyActions fixed
zipi
parents: 1062
diff changeset
2747 }
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2748 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2749 else
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2750 {
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2751 //LABEL_150:
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2752 pParty->uFallStartY = pZ;
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2753 }
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2754
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
2755 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
0
Ritor1
parents:
diff changeset
2756 {
Ritor1
parents:
diff changeset
2757 *(float *)&v128 = 0.0;
Ritor1
parents:
diff changeset
2758 v2 = 0;
Ritor1
parents:
diff changeset
2759 }
Ritor1
parents:
diff changeset
2760 stru_721530.field_84 = -1;
Ritor1
parents:
diff changeset
2761 stru_721530.field_70 = 0;
Ritor1
parents:
diff changeset
2762 stru_721530.prolly_normal_d = pParty->field_14;
Ritor1
parents:
diff changeset
2763 stru_721530.field_8 = pParty->field_14 >> 1;
Ritor1
parents:
diff changeset
2764 v126 = 0;
Ritor1
parents:
diff changeset
2765 stru_721530.field_0 = 1;
Ritor1
parents:
diff changeset
2766 stru_721530.field_C = pParty->uPartyHeight - 32;
Ritor1
parents:
diff changeset
2767 do
Ritor1
parents:
diff changeset
2768 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2769 stru_721530.field_34.x = pX;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2770 stru_721530.normal.x = pX;
0
Ritor1
parents:
diff changeset
2771 stru_721530.field_1C = v2;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2772 stru_721530.field_34.y = pY;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2773 stru_721530.normal.y = pY;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2774 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2775 stru_721530.field_34.z = stru_721530.field_C + pZ + 1;
0
Ritor1
parents:
diff changeset
2776 stru_721530.field_20 = v128;
Ritor1
parents:
diff changeset
2777 stru_721530.field_24 = v121;
Ritor1
parents:
diff changeset
2778 v36 = 0;
Ritor1
parents:
diff changeset
2779 stru_721530.uSectorID = 0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
2780 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
0
Ritor1
parents:
diff changeset
2781 v36 = 13312;
Ritor1
parents:
diff changeset
2782 if ( stru_721530._47050A(v36) )
Ritor1
parents:
diff changeset
2783 break;
Ritor1
parents:
diff changeset
2784 _46E889_collide_against_bmodels(1u);
Ritor1
parents:
diff changeset
2785 v37 = WorldPosToGridCellZ(pParty->vPosition.y);
Ritor1
parents:
diff changeset
2786 v38 = WorldPosToGridCellX(pParty->vPosition.x);
Ritor1
parents:
diff changeset
2787 _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
2788 _46ED8A_collide_against_sprite_objects(4u);
0
Ritor1
parents:
diff changeset
2789 for ( i = 0; i < (signed int)uNumActors; ++i )
Ritor1
parents:
diff changeset
2790 _46DF1A_collide_against_actor(i, 0);
Ritor1
parents:
diff changeset
2791 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
2792 {
Ritor1
parents:
diff changeset
2793 _angle_x = stru_721530.normal2.x;
Ritor1
parents:
diff changeset
2794 _angle_y = stru_721530.normal2.y;
Ritor1
parents:
diff changeset
2795 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents:
diff changeset
2796 }
Ritor1
parents:
diff changeset
2797 else
Ritor1
parents:
diff changeset
2798 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2799 _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2800 _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
0
Ritor1
parents:
diff changeset
2801 v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2802 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ;
0
Ritor1
parents:
diff changeset
2803 }
Ritor1
parents:
diff changeset
2804 v122 = v40;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2805 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2806 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &v130, &v97, 0);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2807 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &v130, &v110, 0);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2808 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2809 v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
0
Ritor1
parents:
diff changeset
2810 v107 = 0;
Ritor1
parents:
diff changeset
2811 v118 = v42;
Ritor1
parents:
diff changeset
2812 if ( !v97 && !v110 && !v108 )
Ritor1
parents:
diff changeset
2813 v107 = 1;
Ritor1
parents:
diff changeset
2814 v43 = 1;
Ritor1
parents:
diff changeset
2815 v44 = 1;
Ritor1
parents:
diff changeset
2816 if ( bUnderwater || !v107 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2817 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2818 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2819 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2820 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2821 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2822 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2823 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2824 if ( v127 && v129 > pZ )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2825 v44 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2826 if ( v118 && v119 > pZ )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2827 v43 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2828 if ( v44 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2829 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2830 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2831 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2832 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2833 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2834 else if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2835 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2836 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2837 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2838 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2839 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2840 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2841 v43 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2842 pX = _angle_x;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2843 if ( v43 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2844 pY = _angle_y;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2845 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2846 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2847 }
0
Ritor1
parents:
diff changeset
2848 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
2849 {
Ritor1
parents:
diff changeset
2850 if ( !v107 )
Ritor1
parents:
diff changeset
2851 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2852 pX = stru_721530.normal2.x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2853 pY = stru_721530.normal2.y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2854 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2855 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
0
Ritor1
parents:
diff changeset
2856 break;
Ritor1
parents:
diff changeset
2857 }
Ritor1
parents:
diff changeset
2858 stru_721530.field_70 += stru_721530.field_7C;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2859 pX = _angle_x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2860 pY = _angle_y;
0
Ritor1
parents:
diff changeset
2861 v45 = stru_721530.uFaceID;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2862 pZ = v40;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2863 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
141
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2864 {
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2865 if (pParty->Invisible())
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2866 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
cca78efb377e Constants -> enums
Nomad
parents: 140
diff changeset
2867
0
Ritor1
parents:
diff changeset
2868 viewparams->bRedrawGameUI = 1;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2869 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2870 v127 = (BSPModel *)58500;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2871 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2872 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2873 ++v126;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2874 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2875 continue;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2876 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2877 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
2878 {
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
2879 v56 = integer_sqrt(v2 * v2 + v128 * v128);
0
Ritor1
parents:
diff changeset
2880 v118 = v56;
Ritor1
parents:
diff changeset
2881 v57 = stru_5C6E00->Atan2(
Ritor1
parents:
diff changeset
2882 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
Ritor1
parents:
diff changeset
2883 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
Ritor1
parents:
diff changeset
2884 v129 = v57;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2885 v58 = (BSPModel *)stru_5C6E00->Cos(v57);
0
Ritor1
parents:
diff changeset
2886 v127 = v58;
Ritor1
parents:
diff changeset
2887 v59 = (signed int)v58 * (signed __int64)v56;
Ritor1
parents:
diff changeset
2888 v122 = v59 >> 16;
Ritor1
parents:
diff changeset
2889 v2 = v59 >> 16;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2890 v60 = (BSPModel *)stru_5C6E00->Sin(v129);
0
Ritor1
parents:
diff changeset
2891 v127 = v60;
Ritor1
parents:
diff changeset
2892 v61 = (signed int)v60 * (signed __int64)v118;
Ritor1
parents:
diff changeset
2893 v122 = v61 >> 16;
Ritor1
parents:
diff changeset
2894 v128 = v61 >> 16;
Ritor1
parents:
diff changeset
2895 }
Ritor1
parents:
diff changeset
2896 else
Ritor1
parents:
diff changeset
2897 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
2898 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
0
Ritor1
parents:
diff changeset
2899 {
Ritor1
parents:
diff changeset
2900 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2901 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
Ritor1
parents:
diff changeset
2902 v127 = v46;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2903 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
0
Ritor1
parents:
diff changeset
2904 v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1;
Ritor1
parents:
diff changeset
2905 v51 = __OFSUB__(v48, 32);
Ritor1
parents:
diff changeset
2906 v49 = v48 == 32;
Ritor1
parents:
diff changeset
2907 v50 = v48 - 32 < 0;
Ritor1
parents:
diff changeset
2908 v52 = v47->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
2909 v129 = (unsigned __int8)(v50 ^ v51 | v49);
122
48bea61a12a5 Camera rotation fixed (even more!)
Nomad
parents: 120
diff changeset
2910 v119 = v52 < 46378;
0
Ritor1
parents:
diff changeset
2911 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
2912 v119 = 0;
Ritor1
parents:
diff changeset
2913 v53 = v47->uPolygonType;
Ritor1
parents:
diff changeset
2914 if ( v53 == 3 )
Ritor1
parents:
diff changeset
2915 {
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2916 if ( v121 < 0 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2917 v121 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2918 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2919 if ( v2 * v2 + v128 * v128 < 400 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2920 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2921 v2 = 0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2922 *(float *)&v128 = 0.0;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2923 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2924 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2925 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2926 pParty->floor_face_pid = v45;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2927 v103 = v47->sCogTriggeredID;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2928 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2929 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2930 v127 = (BSPModel *)58500;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2931 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2932 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2933 ++v126;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2934 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2935 continue;
0
Ritor1
parents:
diff changeset
2936 }
Ritor1
parents:
diff changeset
2937 if ( !v129 && (v53 != 4 || v119) )
Ritor1
parents:
diff changeset
2938 {
Ritor1
parents:
diff changeset
2939 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
2940 if ( stru_721530.field_64 >> 3 > v118 )
Ritor1
parents:
diff changeset
2941 v118 = stru_721530.field_64 >> 3;
Ritor1
parents:
diff changeset
2942 v129 = v47->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
2943 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
Ritor1
parents:
diff changeset
2944 _walk_speed = v47->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
2945 _walk_speed = (unsigned __int64)(v118 * (signed __int64)_walk_speed) >> 16;
Ritor1
parents:
diff changeset
2946 v54 = 0;
Ritor1
parents:
diff changeset
2947 if ( !v119 )
Ritor1
parents:
diff changeset
2948 {
Ritor1
parents:
diff changeset
2949 v127 = (BSPModel *)v47->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
2950 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16);
Ritor1
parents:
diff changeset
2951 v54 = v127;
Ritor1
parents:
diff changeset
2952 }
Ritor1
parents:
diff changeset
2953 v121 += (int)v54;
Ritor1
parents:
diff changeset
2954 v128 += _walk_speed;
Ritor1
parents:
diff changeset
2955 v2 += v129;
Ritor1
parents:
diff changeset
2956 v55 = stru_721530.prolly_normal_d
Ritor1
parents:
diff changeset
2957 - ((signed int)(v47->pFacePlane.dist
Ritor1
parents:
diff changeset
2958 + v122 * v47->pFacePlane.vNormal.z
Ritor1
parents:
diff changeset
2959 + _angle_y * v47->pFacePlane.vNormal.y
Ritor1
parents:
diff changeset
2960 + _angle_x * v47->pFacePlane.vNormal.x) >> 16);
Ritor1
parents:
diff changeset
2961 if ( v55 > 0 )
Ritor1
parents:
diff changeset
2962 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2963 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2964 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16);
0
Ritor1
parents:
diff changeset
2965 if ( !v119 )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
2966 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
0
Ritor1
parents:
diff changeset
2967 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2968 //LABEL_220:
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2969 v45 = stru_721530.uFaceID;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2970 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2971 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2972 pParty->floor_face_pid = v45;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2973 v103 = v47->sCogTriggeredID;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2974 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2975 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2976 v127 = (BSPModel *)58500;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2977 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2978 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2979 ++v126;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2980 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2981 continue;
0
Ritor1
parents:
diff changeset
2982 }
Ritor1
parents:
diff changeset
2983 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
2984 if ( stru_721530.field_64 >> 3 > v118 )
Ritor1
parents:
diff changeset
2985 v118 = stru_721530.field_64 >> 3;
Ritor1
parents:
diff changeset
2986 v122 = v47->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
2987 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16;
Ritor1
parents:
diff changeset
2988 v127 = (BSPModel *)v47->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
2989 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16);
Ritor1
parents:
diff changeset
2990 v129 = v47->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
2991 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
Ritor1
parents:
diff changeset
2992 v121 += v129;
Ritor1
parents:
diff changeset
2993 v2 += v122;
Ritor1
parents:
diff changeset
2994 v128 += (int)v127;
Ritor1
parents:
diff changeset
2995 if ( v2 * v2 + v128 * v128 >= 400 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2996 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2997 v45 = stru_721530.uFaceID;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2998 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
2999 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3000 pParty->floor_face_pid = v45;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3001 v103 = v47->sCogTriggeredID;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3002 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3003 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3004 v127 = (BSPModel *)58500;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3005 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3006 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3007 ++v126;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3008 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3009 continue;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3010 }
0
Ritor1
parents:
diff changeset
3011 v2 = 0;
Ritor1
parents:
diff changeset
3012 v121 = 0;
Ritor1
parents:
diff changeset
3013 *(float *)&v128 = 0.0;
Ritor1
parents:
diff changeset
3014 }
Ritor1
parents:
diff changeset
3015 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3016 //LABEL_234:
0
Ritor1
parents:
diff changeset
3017 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
Ritor1
parents:
diff changeset
3018 v127 = (BSPModel *)58500;
Ritor1
parents:
diff changeset
3019 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
Ritor1
parents:
diff changeset
3020 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
Ritor1
parents:
diff changeset
3021 ++v126;
Ritor1
parents:
diff changeset
3022 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
Ritor1
parents:
diff changeset
3023 }
Ritor1
parents:
diff changeset
3024 while ( v126 < 100 );
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
3025 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
0
Ritor1
parents:
diff changeset
3026 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3027 v122 = abs(pParty->vPosition.x - pX);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3028 v126 = abs(pParty->vPosition.y - pY);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3029 v62 = abs(pParty->vPosition.z - pZ);
295
640a176c030f sub_42ECB5
Nomad
parents: 268
diff changeset
3030 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3031 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3032 pAudioPlayer->_4AA258(804);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3033 pParty->walk_sound_timer = 64;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3034 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3035 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3036 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3037 if ( v114 && (!bJumping || v101) )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3038 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3039 if ( !v107
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3040 && !(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
3041 {
1398
Ritor1
parents: 1345
diff changeset
3042 pAudioPlayer->PlaySound((SoundID)64, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3043 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3044 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3045 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3046 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3047 v64 = WorldPosToGridCellX(pParty->vPosition.x);
1398
Ritor1
parents: 1345
diff changeset
3048 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, 1);
Ritor1
parents: 1345
diff changeset
3049 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3050 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3051 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3052 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3053 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3054 if ( v124 && (!bJumping || v101) )
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3055 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3056 if ( v107
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3057 || 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
3058 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3059 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3060 v64 = WorldPosToGridCellX(pParty->vPosition.x);
1398
Ritor1
parents: 1345
diff changeset
3061 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, 0);
Ritor1
parents: 1345
diff changeset
3062 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3063 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3064 else
1398
Ritor1
parents: 1345
diff changeset
3065 pAudioPlayer->PlaySound((SoundID)103, 804, 1, -1, 0, 0, 0, 0);
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3066 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3067 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3068 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3069 pAudioPlayer->_4AA258(804);
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3070 pParty->walk_sound_timer = 64;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3071 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3072 }
0
Ritor1
parents:
diff changeset
3073 }
Ritor1
parents:
diff changeset
3074 }
Ritor1
parents:
diff changeset
3075 if ( !bJumping || v101 )
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3076 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3077 else
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3078 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
0
Ritor1
parents:
diff changeset
3079 v126 = WorldPosToGridCellX(pParty->vPosition.x);
Ritor1
parents:
diff changeset
3080 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3081 v114 = WorldPosToGridCellX(pX);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3082 v66 = WorldPosToGridCellZ(pY) - 1;
0
Ritor1
parents:
diff changeset
3083 v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1);
Ritor1
parents:
diff changeset
3084 v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1;
Ritor1
parents:
diff changeset
3085 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66);
Ritor1
parents:
diff changeset
3086 v68 = 0;
Ritor1
parents:
diff changeset
3087 v69 = ((unsigned int)~v67 >> 1) & 1;
Ritor1
parents:
diff changeset
3088 if ( v114 == v126 && v66 == v65 && v122 && v69 )
Ritor1
parents:
diff changeset
3089 v68 = 1;
Ritor1
parents:
diff changeset
3090 if ( !v107 )
Ritor1
parents:
diff changeset
3091 v68 = 1;
Ritor1
parents:
diff changeset
3092 if ( v68 )
Ritor1
parents:
diff changeset
3093 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3094 v70 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3095 v71 = pX;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3096 v72 = pY;
0
Ritor1
parents:
diff changeset
3097 pParty->uFallSpeed = v121;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3098 v73 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3099 pParty->vPosition.x = pX;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3100 pParty->vPosition.y = pY;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3101 pParty->vPosition.z = pZ;
0
Ritor1
parents:
diff changeset
3102 pParty->field_6F0 = v113;
723
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 v73 = 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 if ( !v103
Ritor1
parents:
diff changeset
3110 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71)
Ritor1
parents:
diff changeset
3111 && pParty->vPosition.y == v72
Ritor1
parents:
diff changeset
3112 && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) )
Ritor1
parents:
diff changeset
3113 {
Ritor1
parents:
diff changeset
3114 if ( v73 < v111 )
Ritor1
parents:
diff changeset
3115 {
Ritor1
parents:
diff changeset
3116 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
3117 v73 = v105;
Ritor1
parents:
diff changeset
3118 pParty->vPosition.z = v105;
Ritor1
parents:
diff changeset
3119 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )
Ritor1
parents:
diff changeset
3120 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3121 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3122 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3123 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
3124 }
Ritor1
parents:
diff changeset
3125 else
Ritor1
parents:
diff changeset
3126 {
Ritor1
parents:
diff changeset
3127 v74 = &pPlayers[1];
Ritor1
parents:
diff changeset
3128 do
Ritor1
parents:
diff changeset
3129 {
Ritor1
parents:
diff changeset
3130 v110 = (*v74)->GetMaxHealth();
1398
Ritor1
parents: 1345
diff changeset
3131 (*v74)->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
3132 DMGT_PHISYCAL);
0
Ritor1
parents:
diff changeset
3133 v75 = (*v74)->GetActualEndurance();
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
3134 v110 = 20 - (*v74)->GetParameterBonus(v75);
0
Ritor1
parents:
diff changeset
3135 (*v74)->SetRecoveryTime(
Ritor1
parents:
diff changeset
3136 (signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
Ritor1
parents:
diff changeset
3137 ++v74;
Ritor1
parents:
diff changeset
3138 }
Ritor1
parents:
diff changeset
3139 while ( (signed int)v74 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
3140 v73 = pParty->vPosition.z;
Ritor1
parents:
diff changeset
3141 }
Ritor1
parents:
diff changeset
3142 }
Ritor1
parents:
diff changeset
3143 pParty->uFallStartY = v70;
Ritor1
parents:
diff changeset
3144 }
Ritor1
parents:
diff changeset
3145 if ( v102 && v73 < v109 )
Ritor1
parents:
diff changeset
3146 {
Ritor1
parents:
diff changeset
3147 if ( (signed int)(pParty->uPartyHeight + v73) >= v109 )
Ritor1
parents:
diff changeset
3148 {
Ritor1
parents:
diff changeset
3149 pParty->vPosition.z = v109 - pParty->uPartyHeight - 1;
Ritor1
parents:
diff changeset
3150 pParty->field_6F0 = v109 - pParty->uPartyHeight - 1;
Ritor1
parents:
diff changeset
3151 }
Ritor1
parents:
diff changeset
3152 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3153 pParty->uFlags &= ~0x204;
0
Ritor1
parents:
diff changeset
3154 }
Ritor1
parents:
diff changeset
3155 return;
Ritor1
parents:
diff changeset
3156 }
Ritor1
parents:
diff changeset
3157 v76 = pParty->bFlying;
Ritor1
parents:
diff changeset
3158 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !v127 )
Ritor1
parents:
diff changeset
3159 v77 = 1;
Ritor1
parents:
diff changeset
3160 else
Ritor1
parents:
diff changeset
3161 v77 = v122 != 0;
Ritor1
parents:
diff changeset
3162 v114 = 0;
Ritor1
parents:
diff changeset
3163 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk )
Ritor1
parents:
diff changeset
3164 {
Ritor1
parents:
diff changeset
3165 if ( v127 )
Ritor1
parents:
diff changeset
3166 {
Ritor1
parents:
diff changeset
3167 v78 = v69 != 0;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3168 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3169 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3170 {
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3171 v114 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3172 v78 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3173 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3174 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3175 else
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3176 v78 = 1;
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3177 //LABEL_306:
0
Ritor1
parents:
diff changeset
3178 if ( v77 )
Ritor1
parents:
diff changeset
3179 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3180 pParty->vPosition.x = pX;
0
Ritor1
parents:
diff changeset
3181 }
Ritor1
parents:
diff changeset
3182 if ( v78 )
Ritor1
parents:
diff changeset
3183 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3184 pParty->vPosition.y = pY;
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3185 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3186 if ( v78 || v77)
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3187 {
0
Ritor1
parents:
diff changeset
3188 if ( bWaterWalk )
Ritor1
parents:
diff changeset
3189 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3190 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
3191 //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
3192 //*(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
3193 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
3194 *(short *)v79 |= 1u;
0
Ritor1
parents:
diff changeset
3195 if ( !v122 || !v69 )
Ritor1
parents:
diff changeset
3196 {
Ritor1
parents:
diff changeset
3197 if ( !v76 )
Ritor1
parents:
diff changeset
3198 {
Ritor1
parents:
diff changeset
3199 v80 = *(short *)v79;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3200 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
3201 *(short *)v79 = v80 & 0xFFFE;
Ritor1
parents:
diff changeset
3202 }
Ritor1
parents:
diff changeset
3203 }
Ritor1
parents:
diff changeset
3204 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3205 }
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3206 else if ( bWalkSound && pParty->walk_sound_timer <= 0 )
0
Ritor1
parents:
diff changeset
3207 {
Ritor1
parents:
diff changeset
3208 pAudioPlayer->_4AA258(804);
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
3209 pParty->walk_sound_timer = 64;
0
Ritor1
parents:
diff changeset
3210 }
1061
89422dd58318 ODM_ProcessPartyActions cleaned of labels
zipi
parents: 1060
diff changeset
3211 //LABEL_318:
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3212 v81 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3213 v82 = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3214 pParty->vPosition.z = pZ;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3215 if ( pZ > 8160 )
0
Ritor1
parents:
diff changeset
3216 {
Ritor1
parents:
diff changeset
3217 v82 = 8160;
Ritor1
parents:
diff changeset
3218 pParty->uFallStartY = 8160;
Ritor1
parents:
diff changeset
3219 pParty->vPosition.z = 8160;
Ritor1
parents:
diff changeset
3220 }
Ritor1
parents:
diff changeset
3221 LOWORD(pParty->uFlags) &= 0xFDFBu;
Ritor1
parents:
diff changeset
3222 pParty->uFallSpeed = v121;
Ritor1
parents:
diff changeset
3223 pParty->field_6F0 = v113;
Ritor1
parents:
diff changeset
3224 if ( v114 )
Ritor1
parents:
diff changeset
3225 {
Ritor1
parents:
diff changeset
3226 v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
Ritor1
parents:
diff changeset
3227 v82 = pParty->vPosition.z;
Ritor1
parents:
diff changeset
3228 if ( pParty->vPosition.z <= v83 )
Ritor1
parents:
diff changeset
3229 pParty->uFlags |= 4u;
Ritor1
parents:
diff changeset
3230 }
Ritor1
parents:
diff changeset
3231 if ( !v103
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3232 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
3233 && pParty->vPosition.y == pY
0
Ritor1
parents:
diff changeset
3234 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
Ritor1
parents:
diff changeset
3235 {
Ritor1
parents:
diff changeset
3236 if ( v82 < v111 )
Ritor1
parents:
diff changeset
3237 {
Ritor1
parents:
diff changeset
3238 v82 = v105;
Ritor1
parents:
diff changeset
3239 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
3240 pParty->vPosition.z = v105;
Ritor1
parents:
diff changeset
3241 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )
Ritor1
parents:
diff changeset
3242 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3243 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3244 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3245 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
0
Ritor1
parents:
diff changeset
3246 }
Ritor1
parents:
diff changeset
3247 else
Ritor1
parents:
diff changeset
3248 {
Ritor1
parents:
diff changeset
3249 v84 = &pPlayers[1];
Ritor1
parents:
diff changeset
3250 do
Ritor1
parents:
diff changeset
3251 {
Ritor1
parents:
diff changeset
3252 v110 = (*v84)->GetMaxHealth();
Ritor1
parents:
diff changeset
3253 (*v84)->ReceiveDamage(
Ritor1
parents:
diff changeset
3254 (signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
3255 DMGT_PHISYCAL);
0
Ritor1
parents:
diff changeset
3256 v85 = (*v84)->GetActualEndurance();
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
3257 v110 = 20 - (*v84)->GetParameterBonus(v85);
0
Ritor1
parents:
diff changeset
3258 (*v84)->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
Ritor1
parents:
diff changeset
3259 ++v84;
Ritor1
parents:
diff changeset
3260 }
Ritor1
parents:
diff changeset
3261 while ( (signed int)v84 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
3262 v82 = pParty->vPosition.z;
Ritor1
parents:
diff changeset
3263 }
Ritor1
parents:
diff changeset
3264 }
Ritor1
parents:
diff changeset
3265 pParty->uFallStartY = v81;
Ritor1
parents:
diff changeset
3266 }
Ritor1
parents:
diff changeset
3267 if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 )
Ritor1
parents:
diff changeset
3268 {
Ritor1
parents:
diff changeset
3269 pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1;
Ritor1
parents:
diff changeset
3270 pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1;
Ritor1
parents:
diff changeset
3271 }
Ritor1
parents:
diff changeset
3272 }
Ritor1
parents:
diff changeset
3273 }
Ritor1
parents:
diff changeset
3274
Ritor1
parents:
diff changeset
3275 //----- (0047531C) --------------------------------------------------------
Ritor1
parents:
diff changeset
3276 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
3277 {
Ritor1
parents:
diff changeset
3278 BLVFace *v10; // ebx@1
Ritor1
parents:
diff changeset
3279 int v11; // ST1C_4@3
Ritor1
parents:
diff changeset
3280 int v12; // edi@3
Ritor1
parents:
diff changeset
3281 int v13; // esi@3
Ritor1
parents:
diff changeset
3282 int v14; // edi@4
Ritor1
parents:
diff changeset
3283 signed __int64 v15; // qtt@6
Ritor1
parents:
diff changeset
3284 __int16 v16; // si@7
Ritor1
parents:
diff changeset
3285 int *v18; // [sp+Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
3286 int v19; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
3287 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
3288 int a9b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3289 int a9a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3290 int a10b; // [sp+3Ch] [bp+24h]@3
Ritor1
parents:
diff changeset
3291 signed int a10a; // [sp+3Ch] [bp+24h]@4
Ritor1
parents:
diff changeset
3292 int a10c; // [sp+3Ch] [bp+24h]@5
Ritor1
parents:
diff changeset
3293
Ritor1
parents:
diff changeset
3294 v10 = a9;
Ritor1
parents:
diff changeset
3295 v18 = a2;
Ritor1
parents:
diff changeset
3296 v19 = a1;
Ritor1
parents:
diff changeset
3297 if ( a10 && BYTE3(a9->uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
3298 return 0;
Ritor1
parents:
diff changeset
3299 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
3300 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
3301 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
3302 v12 = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
3303 a9a = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
3304 v13 = (a1 << 16)
Ritor1
parents:
diff changeset
3305 - a3 * v10->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3306 - a4 * v10->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3307 - a5 * v10->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
3308 - v10->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
3309 if ( abs((a1 << 16)
Ritor1
parents:
diff changeset
3310 - a3 * v10->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3311 - a4 * v10->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3312 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 )
Ritor1
parents:
diff changeset
3313 {
Ritor1
parents:
diff changeset
3314 a10c = abs(v13) >> 14;
Ritor1
parents:
diff changeset
3315 if ( a10c > abs(v12) )
Ritor1
parents:
diff changeset
3316 return 0;
Ritor1
parents:
diff changeset
3317 LODWORD(v15) = v13 << 16;
Ritor1
parents:
diff changeset
3318 HIDWORD(v15) = v13 >> 16;
Ritor1
parents:
diff changeset
3319 v14 = v19;
Ritor1
parents:
diff changeset
3320 a10a = v15 / a9a;
Ritor1
parents:
diff changeset
3321 }
Ritor1
parents:
diff changeset
3322 else
Ritor1
parents:
diff changeset
3323 {
Ritor1
parents:
diff changeset
3324 a10a = 0;
Ritor1
parents:
diff changeset
3325 v14 = abs(v13) >> 16;
Ritor1
parents:
diff changeset
3326 }
Ritor1
parents:
diff changeset
3327 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16);
Ritor1
parents:
diff changeset
3328 LOWORD(a7a) = (short)a3
Ritor1
parents:
diff changeset
3329 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16)
Ritor1
parents:
diff changeset
3330 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents:
diff changeset
3331 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents:
diff changeset
3332 if ( !sub_475665(
Ritor1
parents:
diff changeset
3333 v10,
Ritor1
parents:
diff changeset
3334 a7a,
Ritor1
parents:
diff changeset
3335 (short)a5
Ritor1
parents:
diff changeset
3336 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16)
Ritor1
parents:
diff changeset
3337 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) )
Ritor1
parents:
diff changeset
3338 return 0;
Ritor1
parents:
diff changeset
3339 *v18 = a10a >> 16;
Ritor1
parents:
diff changeset
3340 if ( a10a >> 16 < 0 )
Ritor1
parents:
diff changeset
3341 *v18 = 0;
Ritor1
parents:
diff changeset
3342 return 1;
Ritor1
parents:
diff changeset
3343 }
Ritor1
parents:
diff changeset
3344
Ritor1
parents:
diff changeset
3345 //----- (004754BF) --------------------------------------------------------
Ritor1
parents:
diff changeset
3346 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
3347 {
Ritor1
parents:
diff changeset
3348 BLVFace *v11; // ebx@1
Ritor1
parents:
diff changeset
3349 int v12; // ST1C_4@3
Ritor1
parents:
diff changeset
3350 int v13; // edi@3
Ritor1
parents:
diff changeset
3351 int v14; // esi@3
Ritor1
parents:
diff changeset
3352 int v15; // edi@4
Ritor1
parents:
diff changeset
3353 signed __int64 v16; // qtt@6
Ritor1
parents:
diff changeset
3354 __int16 v17; // si@7
Ritor1
parents:
diff changeset
3355 int *v19; // [sp+Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
3356 int v20; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
3357 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
3358 int a1b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3359 int a1a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
3360 int a11b; // [sp+40h] [bp+28h]@3
Ritor1
parents:
diff changeset
3361 signed int a11a; // [sp+40h] [bp+28h]@4
Ritor1
parents:
diff changeset
3362 int a11c; // [sp+40h] [bp+28h]@5
Ritor1
parents:
diff changeset
3363
Ritor1
parents:
diff changeset
3364 v11 = a9;
Ritor1
parents:
diff changeset
3365 v19 = a2;
Ritor1
parents:
diff changeset
3366 v20 = a1;
Ritor1
parents:
diff changeset
3367 if ( a11 && BYTE3(a9->uAttributes) & 0x20 )
Ritor1
parents:
diff changeset
3368 return 0;
Ritor1
parents:
diff changeset
3369 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
3370 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
3371 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
3372 v13 = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
3373 a1a = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
3374 v14 = (a1 << 16)
Ritor1
parents:
diff changeset
3375 - a3 * v11->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3376 - a4 * v11->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3377 - a5 * v11->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
3378 - v11->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
3379 if ( abs((a1 << 16)
Ritor1
parents:
diff changeset
3380 - a3 * v11->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
3381 - a4 * v11->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
3382 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 )
Ritor1
parents:
diff changeset
3383 {
Ritor1
parents:
diff changeset
3384 a11c = abs(v14) >> 14;
Ritor1
parents:
diff changeset
3385 if ( a11c > abs(v13) )
Ritor1
parents:
diff changeset
3386 return 0;
Ritor1
parents:
diff changeset
3387 LODWORD(v16) = v14 << 16;
Ritor1
parents:
diff changeset
3388 HIDWORD(v16) = v14 >> 16;
Ritor1
parents:
diff changeset
3389 v15 = v20;
Ritor1
parents:
diff changeset
3390 a11a = v16 / a1a;
Ritor1
parents:
diff changeset
3391 }
Ritor1
parents:
diff changeset
3392 else
Ritor1
parents:
diff changeset
3393 {
Ritor1
parents:
diff changeset
3394 a11a = 0;
Ritor1
parents:
diff changeset
3395 v15 = abs(v14) >> 16;
Ritor1
parents:
diff changeset
3396 }
Ritor1
parents:
diff changeset
3397 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16);
Ritor1
parents:
diff changeset
3398 LOWORD(a7a) = (short)a3
Ritor1
parents:
diff changeset
3399 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16)
Ritor1
parents:
diff changeset
3400 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents:
diff changeset
3401 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents:
diff changeset
3402 if ( !sub_4759C9(
Ritor1
parents:
diff changeset
3403 v11,
Ritor1
parents:
diff changeset
3404 a10,
Ritor1
parents:
diff changeset
3405 a7a,
Ritor1
parents:
diff changeset
3406 (short)a5
Ritor1
parents:
diff changeset
3407 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16)
Ritor1
parents:
diff changeset
3408 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) )
Ritor1
parents:
diff changeset
3409 return 0;
Ritor1
parents:
diff changeset
3410 *v19 = a11a >> 16;
Ritor1
parents:
diff changeset
3411 if ( a11a >> 16 < 0 )
Ritor1
parents:
diff changeset
3412 *v19 = 0;
Ritor1
parents:
diff changeset
3413 return 1;
Ritor1
parents:
diff changeset
3414 }
Ritor1
parents:
diff changeset
3415
Ritor1
parents:
diff changeset
3416 //----- (00475665) --------------------------------------------------------
Ritor1
parents:
diff changeset
3417 signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3)
Ritor1
parents:
diff changeset
3418 {
Ritor1
parents:
diff changeset
3419 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
3420 Vec3_short_ *v4; // edx@3
Ritor1
parents:
diff changeset
3421 signed int v5; // eax@4
Ritor1
parents:
diff changeset
3422 int v6; // esi@4
Ritor1
parents:
diff changeset
3423 signed int v7; // eax@7
Ritor1
parents:
diff changeset
3424 Vec3_short_ *v8; // edx@8
Ritor1
parents:
diff changeset
3425 signed int v9; // eax@9
Ritor1
parents:
diff changeset
3426 int v10; // esi@9
Ritor1
parents:
diff changeset
3427 signed int v11; // eax@11
Ritor1
parents:
diff changeset
3428 Vec3_short_ *v12; // edx@12
Ritor1
parents:
diff changeset
3429 signed int v13; // eax@13
Ritor1
parents:
diff changeset
3430 int v14; // esi@13
Ritor1
parents:
diff changeset
3431 int v15; // esi@14
Ritor1
parents:
diff changeset
3432 bool v16; // edi@14
Ritor1
parents:
diff changeset
3433 int v17; // ecx@16
Ritor1
parents:
diff changeset
3434 signed int v18; // edx@16
Ritor1
parents:
diff changeset
3435 int v19; // eax@17
Ritor1
parents:
diff changeset
3436 signed int v20; // ebx@18
Ritor1
parents:
diff changeset
3437 int v21; // edi@20
Ritor1
parents:
diff changeset
3438 signed int v22; // ST14_4@22
Ritor1
parents:
diff changeset
3439 signed __int64 v23; // qtt@22
Ritor1
parents:
diff changeset
3440 signed int result; // eax@25
Ritor1
parents:
diff changeset
3441 int v25; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
3442 int v26; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3443 signed int v27; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
3444 signed int v28; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
3445 signed int v29; // [sp+30h] [bp+Ch]@7
Ritor1
parents:
diff changeset
3446 signed int v30; // [sp+30h] [bp+Ch]@11
Ritor1
parents:
diff changeset
3447 signed int v31; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
3448
Ritor1
parents:
diff changeset
3449 v3 = _this->uAttributes;
Ritor1
parents:
diff changeset
3450 if ( BYTE1(v3) & 1 )
Ritor1
parents:
diff changeset
3451 {
Ritor1
parents:
diff changeset
3452 v28 = 0;
Ritor1
parents:
diff changeset
3453 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
3454 v27 = SHIWORD(a2);
Ritor1
parents:
diff changeset
3455 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3456 {
Ritor1
parents:
diff changeset
3457 v4 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3458 do
Ritor1
parents:
diff changeset
3459 {
Ritor1
parents:
diff changeset
3460 v5 = v28;
Ritor1
parents:
diff changeset
3461 v6 = 2 * v28;
Ritor1
parents:
diff changeset
3462 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x;
Ritor1
parents:
diff changeset
3463 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y;
Ritor1
parents:
diff changeset
3464 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1]
Ritor1
parents:
diff changeset
3465 + v4[_this->pVertexIDs[v5 + 1]].x;
Ritor1
parents:
diff changeset
3466 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y;
Ritor1
parents:
diff changeset
3467 }
Ritor1
parents:
diff changeset
3468 while ( v28 < _this->uNumVertices );
Ritor1
parents:
diff changeset
3469 }
Ritor1
parents:
diff changeset
3470 }
Ritor1
parents:
diff changeset
3471 else
Ritor1
parents:
diff changeset
3472 {
Ritor1
parents:
diff changeset
3473 if ( BYTE1(v3) & 2 )
Ritor1
parents:
diff changeset
3474 {
Ritor1
parents:
diff changeset
3475 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
3476 v7 = a3;
Ritor1
parents:
diff changeset
3477 v29 = 0;
Ritor1
parents:
diff changeset
3478 v27 = v7;
Ritor1
parents:
diff changeset
3479 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3480 {
Ritor1
parents:
diff changeset
3481 v8 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3482 do
Ritor1
parents:
diff changeset
3483 {
Ritor1
parents:
diff changeset
3484 v9 = v29;
Ritor1
parents:
diff changeset
3485 v10 = 2 * v29;
Ritor1
parents:
diff changeset
3486 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x;
Ritor1
parents:
diff changeset
3487 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z;
Ritor1
parents:
diff changeset
3488 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x;
Ritor1
parents:
diff changeset
3489 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z;
Ritor1
parents:
diff changeset
3490 }
Ritor1
parents:
diff changeset
3491 while ( v29 < _this->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 v26 = SHIWORD(a2);
Ritor1
parents:
diff changeset
3497 v11 = a3;
Ritor1
parents:
diff changeset
3498 v30 = 0;
Ritor1
parents:
diff changeset
3499 v27 = v11;
Ritor1
parents:
diff changeset
3500 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
3501 {
Ritor1
parents:
diff changeset
3502 v12 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
3503 do
Ritor1
parents:
diff changeset
3504 {
Ritor1
parents:
diff changeset
3505 v13 = v30;
Ritor1
parents:
diff changeset
3506 v14 = 2 * v30;
Ritor1
parents:
diff changeset
3507 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y;
Ritor1
parents:
diff changeset
3508 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z;
Ritor1
parents:
diff changeset
3509 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y;
Ritor1
parents:
diff changeset
3510 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z;
Ritor1
parents:
diff changeset
3511 }
Ritor1
parents:
diff changeset
3512 while ( v30 < _this->uNumVertices );
Ritor1
parents:
diff changeset
3513 }
Ritor1
parents:
diff changeset
3514 }
Ritor1
parents:
diff changeset
3515 }
Ritor1
parents:
diff changeset
3516 v15 = 2 * _this->uNumVertices;
Ritor1
parents:
diff changeset
3517 v31 = 0;
Ritor1
parents:
diff changeset
3518 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0];
Ritor1
parents:
diff changeset
3519 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0];
Ritor1
parents:
diff changeset
3520 v25 = 0;
Ritor1
parents:
diff changeset
3521 v16 = word_720B40_intercepts_zs[0] >= v27;
Ritor1
parents:
diff changeset
3522 if ( v15 <= 0 )
Ritor1
parents:
diff changeset
3523 goto LABEL_29;
Ritor1
parents:
diff changeset
3524 do
Ritor1
parents:
diff changeset
3525 {
Ritor1
parents:
diff changeset
3526 if ( v31 >= 2 )
Ritor1
parents:
diff changeset
3527 break;
Ritor1
parents:
diff changeset
3528 v17 = v25;
Ritor1
parents:
diff changeset
3529 v18 = word_720B40_intercepts_zs[v25 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3530 if ( v16 ^ (v18 >= v27) )
0
Ritor1
parents:
diff changeset
3531 {
Ritor1
parents:
diff changeset
3532 v19 = word_720C10_intercepts_xs[v17 + 1];
Ritor1
parents:
diff changeset
3533 if ( v19 >= v26 )
Ritor1
parents:
diff changeset
3534 v20 = 0;
Ritor1
parents:
diff changeset
3535 else
Ritor1
parents:
diff changeset
3536 v20 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3537 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26);
0
Ritor1
parents:
diff changeset
3538 if ( v21 != 3 )
Ritor1
parents:
diff changeset
3539 {
Ritor1
parents:
diff changeset
3540 if ( !v21
Ritor1
parents:
diff changeset
3541 || (v22 = v19 - word_720C10_intercepts_xs[v17],
Ritor1
parents:
diff changeset
3542 LODWORD(v23) = v22 << 16,
Ritor1
parents:
diff changeset
3543 HIDWORD(v23) = v22 >> 16,
Ritor1
parents:
diff changeset
3544 word_720C10_intercepts_xs[v17]
Ritor1
parents:
diff changeset
3545 + ((signed int)(((unsigned __int64)(v23
Ritor1
parents:
diff changeset
3546 / (v18 - word_720B40_intercepts_zs[v17])
Ritor1
parents:
diff changeset
3547 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16)
Ritor1
parents:
diff changeset
3548 + 32768) >> 16) >= v26) )
Ritor1
parents:
diff changeset
3549 ++v31;
Ritor1
parents:
diff changeset
3550 }
Ritor1
parents:
diff changeset
3551 }
Ritor1
parents:
diff changeset
3552 ++v25;
Ritor1
parents:
diff changeset
3553 v16 = v18 >= v27;
Ritor1
parents:
diff changeset
3554 }
Ritor1
parents:
diff changeset
3555 while ( v25 < v15 );
Ritor1
parents:
diff changeset
3556 result = 1;
Ritor1
parents:
diff changeset
3557 if ( v31 != 1 )
Ritor1
parents:
diff changeset
3558 LABEL_29:
Ritor1
parents:
diff changeset
3559 result = 0;
Ritor1
parents:
diff changeset
3560 return result;
Ritor1
parents:
diff changeset
3561 }
Ritor1
parents:
diff changeset
3562
Ritor1
parents:
diff changeset
3563 //----- (004759C9) --------------------------------------------------------
Ritor1
parents:
diff changeset
3564 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4)
Ritor1
parents:
diff changeset
3565 {
Ritor1
parents:
diff changeset
3566 unsigned int v4; // eax@1
Ritor1
parents:
diff changeset
3567 int v5; // edx@4
Ritor1
parents:
diff changeset
3568 __int16 v6; // si@4
Ritor1
parents:
diff changeset
3569 int v7; // edx@9
Ritor1
parents:
diff changeset
3570 __int16 v8; // si@9
Ritor1
parents:
diff changeset
3571 int v9; // edx@13
Ritor1
parents:
diff changeset
3572 __int16 v10; // si@13
Ritor1
parents:
diff changeset
3573 int v11; // esi@14
Ritor1
parents:
diff changeset
3574 bool v12; // edi@14
Ritor1
parents:
diff changeset
3575 int v13; // ecx@16
Ritor1
parents:
diff changeset
3576 signed int v14; // edx@16
Ritor1
parents:
diff changeset
3577 int v15; // eax@17
Ritor1
parents:
diff changeset
3578 signed int v16; // ebx@18
Ritor1
parents:
diff changeset
3579 int v17; // edi@20
Ritor1
parents:
diff changeset
3580 signed int v18; // ST14_4@22
Ritor1
parents:
diff changeset
3581 signed __int64 v19; // qtt@22
Ritor1
parents:
diff changeset
3582 bool result; // eax@25
Ritor1
parents:
diff changeset
3583 int v21; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
3584 signed int v22; // [sp+18h] [bp-Ch]@1
Ritor1
parents:
diff changeset
3585 int v23; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3586 signed int v24; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
3587 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3
Ritor1
parents:
diff changeset
3588 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8
Ritor1
parents:
diff changeset
3589 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12
Ritor1
parents:
diff changeset
3590 signed int a4d; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
3591
Ritor1
parents:
diff changeset
3592 v4 = a1->uAttributes;
Ritor1
parents:
diff changeset
3593 v22 = 0;
Ritor1
parents:
diff changeset
3594 if ( BYTE1(v4) & 1 )
Ritor1
parents:
diff changeset
3595 {
Ritor1
parents:
diff changeset
3596 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
3597 v24 = SHIWORD(a3);
Ritor1
parents:
diff changeset
3598 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3599 {
Ritor1
parents:
diff changeset
3600 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3601 do
Ritor1
parents:
diff changeset
3602 {
Ritor1
parents:
diff changeset
3603 v5 = 2 * v22;
Ritor1
parents:
diff changeset
3604 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
3605 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
3606 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x);
Ritor1
parents:
diff changeset
3607 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y);
Ritor1
parents:
diff changeset
3608 ++v22;
Ritor1
parents:
diff changeset
3609 }
Ritor1
parents:
diff changeset
3610 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3611 }
Ritor1
parents:
diff changeset
3612 }
Ritor1
parents:
diff changeset
3613 else
Ritor1
parents:
diff changeset
3614 {
Ritor1
parents:
diff changeset
3615 if ( BYTE1(v4) & 2 )
Ritor1
parents:
diff changeset
3616 {
Ritor1
parents:
diff changeset
3617 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
3618 v24 = a4;
Ritor1
parents:
diff changeset
3619 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3620 {
Ritor1
parents:
diff changeset
3621 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3622 do
Ritor1
parents:
diff changeset
3623 {
Ritor1
parents:
diff changeset
3624 v7 = 2 * v22;
Ritor1
parents:
diff changeset
3625 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
3626 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
3627 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x);
Ritor1
parents:
diff changeset
3628 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z);
Ritor1
parents:
diff changeset
3629 ++v22;
Ritor1
parents:
diff changeset
3630 }
Ritor1
parents:
diff changeset
3631 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3632 }
Ritor1
parents:
diff changeset
3633 }
Ritor1
parents:
diff changeset
3634 else
Ritor1
parents:
diff changeset
3635 {
Ritor1
parents:
diff changeset
3636 v23 = SHIWORD(a3);
Ritor1
parents:
diff changeset
3637 v24 = a4;
Ritor1
parents:
diff changeset
3638 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
3639 {
Ritor1
parents:
diff changeset
3640 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
3641 do
Ritor1
parents:
diff changeset
3642 {
Ritor1
parents:
diff changeset
3643 v9 = 2 * v22;
Ritor1
parents:
diff changeset
3644 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
3645 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
3646 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y);
Ritor1
parents:
diff changeset
3647 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z);
Ritor1
parents:
diff changeset
3648 ++v22;
Ritor1
parents:
diff changeset
3649 }
Ritor1
parents:
diff changeset
3650 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
3651 }
Ritor1
parents:
diff changeset
3652 }
Ritor1
parents:
diff changeset
3653 }
Ritor1
parents:
diff changeset
3654 v11 = 2 * a1->uNumVertices;
Ritor1
parents:
diff changeset
3655 a4d = 0;
Ritor1
parents:
diff changeset
3656 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0];
Ritor1
parents:
diff changeset
3657 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0];
Ritor1
parents:
diff changeset
3658 v21 = 0;
Ritor1
parents:
diff changeset
3659 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24;
Ritor1
parents:
diff changeset
3660 if ( v11 <= 0 )
Ritor1
parents:
diff changeset
3661 goto LABEL_29;
Ritor1
parents:
diff changeset
3662 do
Ritor1
parents:
diff changeset
3663 {
Ritor1
parents:
diff changeset
3664 if ( a4d >= 2 )
Ritor1
parents:
diff changeset
3665 break;
Ritor1
parents:
diff changeset
3666 v13 = v21;
Ritor1
parents:
diff changeset
3667 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3668 if ( v12 ^ (v14 >= v24) )
0
Ritor1
parents:
diff changeset
3669 {
Ritor1
parents:
diff changeset
3670 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1];
Ritor1
parents:
diff changeset
3671 if ( v15 >= v23 )
Ritor1
parents:
diff changeset
3672 v16 = 0;
Ritor1
parents:
diff changeset
3673 else
Ritor1
parents:
diff changeset
3674 v16 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3675 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23);
0
Ritor1
parents:
diff changeset
3676 if ( v17 != 3 )
Ritor1
parents:
diff changeset
3677 {
Ritor1
parents:
diff changeset
3678 if ( !v17
Ritor1
parents:
diff changeset
3679 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13],
Ritor1
parents:
diff changeset
3680 LODWORD(v19) = v18 << 16,
Ritor1
parents:
diff changeset
3681 HIDWORD(v19) = v18 >> 16,
Ritor1
parents:
diff changeset
3682 word_720A70_intercepts_xs_plus_xs[v13]
Ritor1
parents:
diff changeset
3683 + ((signed int)(((unsigned __int64)(v19
Ritor1
parents:
diff changeset
3684 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13])
Ritor1
parents:
diff changeset
3685 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16)
Ritor1
parents:
diff changeset
3686 + 32768) >> 16) >= v23) )
Ritor1
parents:
diff changeset
3687 ++a4d;
Ritor1
parents:
diff changeset
3688 }
Ritor1
parents:
diff changeset
3689 }
Ritor1
parents:
diff changeset
3690 ++v21;
Ritor1
parents:
diff changeset
3691 v12 = v14 >= v24;
Ritor1
parents:
diff changeset
3692 }
Ritor1
parents:
diff changeset
3693 while ( v21 < v11 );
Ritor1
parents:
diff changeset
3694 result = 1;
Ritor1
parents:
diff changeset
3695 if ( a4d != 1 )
Ritor1
parents:
diff changeset
3696 LABEL_29:
Ritor1
parents:
diff changeset
3697 result = 0;
Ritor1
parents:
diff changeset
3698 return result;
Ritor1
parents:
diff changeset
3699 }
Ritor1
parents:
diff changeset
3700
Ritor1
parents:
diff changeset
3701 //----- (00475D85) --------------------------------------------------------
Ritor1
parents:
diff changeset
3702 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4)
Ritor1
parents:
diff changeset
3703 {
Ritor1
parents:
diff changeset
3704 BLVFace *v4; // ebx@1
Ritor1
parents:
diff changeset
3705 int v5; // ST24_4@2
Ritor1
parents:
diff changeset
3706 int v6; // ST28_4@2
Ritor1
parents:
diff changeset
3707 int v7; // edi@2
Ritor1
parents:
diff changeset
3708 int v8; // eax@5
Ritor1
parents:
diff changeset
3709 signed int v9; // esi@5
Ritor1
parents:
diff changeset
3710 signed __int64 v10; // qtt@10
Ritor1
parents:
diff changeset
3711 Vec3_int_ *v11; // esi@11
Ritor1
parents:
diff changeset
3712 int v12; // ST14_4@11
Ritor1
parents:
diff changeset
3713 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1
Ritor1
parents:
diff changeset
3714 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
3715 int v16; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
3716 int v17; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
3717 int a4b; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
3718 int a4c; // [sp+30h] [bp+Ch]@9
Ritor1
parents:
diff changeset
3719 signed int a4a; // [sp+30h] [bp+Ch]@10
Ritor1
parents:
diff changeset
3720
Ritor1
parents:
diff changeset
3721 v4 = a4;
Ritor1
parents:
diff changeset
3722 v15 = a2;
Ritor1
parents:
diff changeset
3723 v14 = a1;
Ritor1
parents:
diff changeset
3724 if ( BYTE3(a4->uAttributes) & 0x20
Ritor1
parents:
diff changeset
3725 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
3726 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
3727 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
3728 v7 = v5 + v6 + a4b,
Ritor1
parents:
diff changeset
3729 (v16 = v5 + v6 + a4b) == 0)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
3730 || v7 > 0 && !v4->Portal())
0
Ritor1
parents:
diff changeset
3731 return 0;
Ritor1
parents:
diff changeset
3732 v8 = v4->pFacePlane_old.vNormal.z * a1->z;
Ritor1
parents:
diff changeset
3733 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x);
Ritor1
parents:
diff changeset
3734 if ( v7 <= 0 )
Ritor1
parents:
diff changeset
3735 {
Ritor1
parents:
diff changeset
3736 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
3737 return 0;
Ritor1
parents:
diff changeset
3738 }
Ritor1
parents:
diff changeset
3739 else
Ritor1
parents:
diff changeset
3740 {
Ritor1
parents:
diff changeset
3741 if ( v9 < 0 )
Ritor1
parents:
diff changeset
3742 return 0;
Ritor1
parents:
diff changeset
3743 }
Ritor1
parents:
diff changeset
3744 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
3745 if ( a4c > abs(v7)
Ritor1
parents:
diff changeset
3746 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16)
Ritor1
parents:
diff changeset
3747 || (v11 = v14,
Ritor1
parents:
diff changeset
3748 LOWORD(v12) = LOWORD(v14->x)
Ritor1
parents:
diff changeset
3749 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3750 HIWORD(v12) = LOWORD(v11->y)
Ritor1
parents:
diff changeset
3751 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3752 !sub_475665(
Ritor1
parents:
diff changeset
3753 v4,
Ritor1
parents:
diff changeset
3754 v12,
Ritor1
parents:
diff changeset
3755 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
3756 return 0;
Ritor1
parents:
diff changeset
3757 *a3 = a4a >> 16;
Ritor1
parents:
diff changeset
3758 return 1;
Ritor1
parents:
diff changeset
3759 }
Ritor1
parents:
diff changeset
3760
Ritor1
parents:
diff changeset
3761 //----- (00475F30) --------------------------------------------------------
Ritor1
parents:
diff changeset
3762 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
3763 {
Ritor1
parents:
diff changeset
3764 BLVFace *v9; // ebx@1
Ritor1
parents:
diff changeset
3765 int v10; // ST20_4@2
Ritor1
parents:
diff changeset
3766 int v11; // ST28_4@2
Ritor1
parents:
diff changeset
3767 int v12; // ST24_4@2
Ritor1
parents:
diff changeset
3768 char v13; // zf@2
Ritor1
parents:
diff changeset
3769 int v14; // edi@2
Ritor1
parents:
diff changeset
3770 int v15; // eax@5
Ritor1
parents:
diff changeset
3771 signed int v16; // esi@5
Ritor1
parents:
diff changeset
3772 int v17; // ST20_4@9
Ritor1
parents:
diff changeset
3773 signed __int64 v18; // qtt@10
Ritor1
parents:
diff changeset
3774 int v19; // ST14_4@11
Ritor1
parents:
diff changeset
3775 int *v21; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
3776 int v22; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
3777 int v23; // [sp+1Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
3778 signed int v24; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
3779
Ritor1
parents:
diff changeset
3780 v9 = a2;
Ritor1
parents:
diff changeset
3781 v21 = a1;
Ritor1
parents:
diff changeset
3782 if ( BYTE3(a2->uAttributes) & 0x20
Ritor1
parents:
diff changeset
3783 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
3784 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
3785 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
3786 v13 = v10 + v12 + v11 == 0,
Ritor1
parents:
diff changeset
3787 v14 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
3788 v22 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
3789 v13)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
3790 || v14 > 0 && !a2->Portal())
0
Ritor1
parents:
diff changeset
3791 return 0;
Ritor1
parents:
diff changeset
3792 v15 = a4 * a2->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
3793 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z);
Ritor1
parents:
diff changeset
3794 if ( v14 <= 0 )
Ritor1
parents:
diff changeset
3795 {
Ritor1
parents:
diff changeset
3796 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 )
Ritor1
parents:
diff changeset
3797 return 0;
Ritor1
parents:
diff changeset
3798 }
Ritor1
parents:
diff changeset
3799 else
Ritor1
parents:
diff changeset
3800 {
Ritor1
parents:
diff changeset
3801 if ( v16 < 0 )
Ritor1
parents:
diff changeset
3802 return 0;
Ritor1
parents:
diff changeset
3803 }
Ritor1
parents:
diff changeset
3804 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14;
Ritor1
parents:
diff changeset
3805 if ( v17 > abs(v14)
Ritor1
parents:
diff changeset
3806 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16)
Ritor1
parents:
diff changeset
3807 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3808 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
3809 !sub_4759C9(
Ritor1
parents:
diff changeset
3810 v9,
Ritor1
parents:
diff changeset
3811 a9,
Ritor1
parents:
diff changeset
3812 v19,
Ritor1
parents:
diff changeset
3813 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
3814 return 0;
Ritor1
parents:
diff changeset
3815 *v21 = v24 >> 16;
Ritor1
parents:
diff changeset
3816 return 1;
Ritor1
parents:
diff changeset
3817 }
Ritor1
parents:
diff changeset
3818
Ritor1
parents:
diff changeset
3819 //----- (004760D5) --------------------------------------------------------
Ritor1
parents:
diff changeset
3820 PartyAction ActionQueue::Next()
Ritor1
parents:
diff changeset
3821 {
Ritor1
parents:
diff changeset
3822 if (!uNumActions)
Ritor1
parents:
diff changeset
3823 return PARTY_INVALID;
Ritor1
parents:
diff changeset
3824
Ritor1
parents:
diff changeset
3825 auto result = pActions[0];
Ritor1
parents:
diff changeset
3826 for (unsigned int i = 0; i < uNumActions - 1; ++i)
Ritor1
parents:
diff changeset
3827 pActions[i] = pActions[i + 1];
Ritor1
parents:
diff changeset
3828 --uNumActions;
Ritor1
parents:
diff changeset
3829
Ritor1
parents:
diff changeset
3830 return result;
Ritor1
parents:
diff changeset
3831 }
Ritor1
parents:
diff changeset
3832
Ritor1
parents:
diff changeset
3833 //----- (004775ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
3834 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2)
Ritor1
parents:
diff changeset
3835 {
Ritor1
parents:
diff changeset
3836 char *v2; // edi@1
Ritor1
parents:
diff changeset
3837 int v3; // eax@1
Ritor1
parents:
diff changeset
3838 char *v4; // edx@2
Ritor1
parents:
diff changeset
3839 char *v5; // esi@3
Ritor1
parents:
diff changeset
3840 double v6; // st7@6
Ritor1
parents:
diff changeset
3841 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
3842 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
3843 int v9; // esi@6
Ritor1
parents:
diff changeset
3844 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
3845 int v11; // ecx@6
Ritor1
parents:
diff changeset
3846 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
3847 int v13; // ecx@6
Ritor1
parents:
diff changeset
3848 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
3849 double v15; // st7@8
Ritor1
parents:
diff changeset
3850 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
3851 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
3852 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
3853 int v19; // edi@8
Ritor1
parents:
diff changeset
3854 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
3855 int v21; // ecx@8
Ritor1
parents:
diff changeset
3856 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
3857 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
3858 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
3859 int *v25; // edi@8
Ritor1
parents:
diff changeset
3860 int v26; // esi@8
Ritor1
parents:
diff changeset
3861 int *v27; // edi@10
Ritor1
parents:
diff changeset
3862 int v28; // esi@10
Ritor1
parents:
diff changeset
3863 int result; // eax@12
Ritor1
parents:
diff changeset
3864 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
3865 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
3866 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
3867 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
3868 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
3869 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
3870 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
3871 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
3872 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
3873 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
3874 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
3875
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3876 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
3877 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3878 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
3879 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3880 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
3881 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3882 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3883 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3884 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
3885 v35 = this;
Ritor1
parents:
diff changeset
3886 if ( v3 > 0 )
Ritor1
parents:
diff changeset
3887 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3888 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3889 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
3890 v34 = v3;
Ritor1
parents:
diff changeset
3891 while ( 1 )
Ritor1
parents:
diff changeset
3892 {
Ritor1
parents:
diff changeset
3893 v5 = v4 - 15;
Ritor1
parents:
diff changeset
3894 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 )
Ritor1
parents:
diff changeset
3895 goto LABEL_11;
Ritor1
parents:
diff changeset
3896 if ( *(float *)v5 <= (double)a2 )
Ritor1
parents:
diff changeset
3897 break;
Ritor1
parents:
diff changeset
3898 if ( *(float *)(v4 + 1) <= (double)a2 )
Ritor1
parents:
diff changeset
3899 {
Ritor1
parents:
diff changeset
3900 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
3901 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3902 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
3903 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
3904 v36 = v15;
Ritor1
parents:
diff changeset
3905 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
3906 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
3907 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
3908 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3909 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3910 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
3911 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3912 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3913 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
3914 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
3915 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3916 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3917 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
3918 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3919 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
3920 v25 = v40;
Ritor1
parents:
diff changeset
3921 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3922 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3923 ++v25;
Ritor1
parents:
diff changeset
3924 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3925 v26 += 4;
Ritor1
parents:
diff changeset
3926 ++v25;
Ritor1
parents:
diff changeset
3927 ++v38;
Ritor1
parents:
diff changeset
3928 v40 += 4;
Ritor1
parents:
diff changeset
3929 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
3930 v25[1] = *(int *)(v26 + 4);
Ritor1
parents:
diff changeset
3931 goto LABEL_9;
Ritor1
parents:
diff changeset
3932 }
Ritor1
parents:
diff changeset
3933 LABEL_10:
Ritor1
parents:
diff changeset
3934 v27 = v40;
Ritor1
parents:
diff changeset
3935 ++v38;
Ritor1
parents:
diff changeset
3936 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
3937 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
3938 ++v27;
Ritor1
parents:
diff changeset
3939 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3940 v28 += 4;
Ritor1
parents:
diff changeset
3941 ++v27;
Ritor1
parents:
diff changeset
3942 v40 += 4;
Ritor1
parents:
diff changeset
3943 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
3944 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
3945 LABEL_11:
Ritor1
parents:
diff changeset
3946 v4 += 16;
Ritor1
parents:
diff changeset
3947 --v34;
Ritor1
parents:
diff changeset
3948 if ( !v34 )
Ritor1
parents:
diff changeset
3949 goto LABEL_12;
Ritor1
parents:
diff changeset
3950 }
Ritor1
parents:
diff changeset
3951 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
3952 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3953 v36 = v6;
Ritor1
parents:
diff changeset
3954 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
3955 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
3956 *(float *)&v37 = (double)v7 * v6;
Ritor1
parents:
diff changeset
3957 v8 = *(float *)&v37 + 6.7553994e15;
Ritor1
parents:
diff changeset
3958 v9 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
3959 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
3960 v10 = *(float *)&v37 + 6.7553994e15;
Ritor1
parents:
diff changeset
3961 v11 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3962 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
3963 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
Ritor1
parents:
diff changeset
3964 v12 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3965 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
3966 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
3967 v14 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
3968 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
3969 LABEL_9:
Ritor1
parents:
diff changeset
3970 //this = v35;
Ritor1
parents:
diff changeset
3971 v5 = (char *)&v30 + 4;
Ritor1
parents:
diff changeset
3972 goto LABEL_10;
Ritor1
parents:
diff changeset
3973 }
Ritor1
parents:
diff changeset
3974 LABEL_12:
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
3975 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
3976 }
Ritor1
parents:
diff changeset
3977
Ritor1
parents:
diff changeset
3978 //----- (00477927) --------------------------------------------------------
Ritor1
parents:
diff changeset
3979 int stru6_stru1_indoor_sw_billboard::_477927(float a2)
Ritor1
parents:
diff changeset
3980 {
Ritor1
parents:
diff changeset
3981 char *v2; // edi@1
Ritor1
parents:
diff changeset
3982 int v3; // eax@1
Ritor1
parents:
diff changeset
3983 char *v4; // edx@2
Ritor1
parents:
diff changeset
3984 char *v5; // esi@3
Ritor1
parents:
diff changeset
3985 double v6; // st7@6
Ritor1
parents:
diff changeset
3986 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
3987 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
3988 int v9; // esi@6
Ritor1
parents:
diff changeset
3989 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
3990 int v11; // ecx@6
Ritor1
parents:
diff changeset
3991 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
3992 int v13; // ecx@6
Ritor1
parents:
diff changeset
3993 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
3994 double v15; // st7@8
Ritor1
parents:
diff changeset
3995 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
3996 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
3997 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
3998 int v19; // edi@8
Ritor1
parents:
diff changeset
3999 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
4000 int v21; // ecx@8
Ritor1
parents:
diff changeset
4001 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
4002 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
4003 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
4004 int *v25; // edi@8
Ritor1
parents:
diff changeset
4005 int v26; // esi@8
Ritor1
parents:
diff changeset
4006 int *v27; // edi@10
Ritor1
parents:
diff changeset
4007 int v28; // esi@10
Ritor1
parents:
diff changeset
4008 int result; // eax@12
Ritor1
parents:
diff changeset
4009 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
4010 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
4011 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
4012 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
4013 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
4014 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
4015 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
4016 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
4017 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
4018 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
4019 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
4020
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4021 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
4022 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4023 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
4024 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4025 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
4026 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4027 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4028 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4029 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
4030 v35 = this;
Ritor1
parents:
diff changeset
4031 if ( v3 > 0 )
Ritor1
parents:
diff changeset
4032 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4033 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4034 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
4035 v34 = v3;
Ritor1
parents:
diff changeset
4036 while ( 1 )
Ritor1
parents:
diff changeset
4037 {
Ritor1
parents:
diff changeset
4038 v5 = v4 - 15;
Ritor1
parents:
diff changeset
4039 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 )
Ritor1
parents:
diff changeset
4040 goto LABEL_11;
Ritor1
parents:
diff changeset
4041 if ( *(float *)v5 >= (double)a2 )
Ritor1
parents:
diff changeset
4042 break;
Ritor1
parents:
diff changeset
4043 if ( *(float *)(v4 + 1) >= (double)a2 )
Ritor1
parents:
diff changeset
4044 {
Ritor1
parents:
diff changeset
4045 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
4046 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
4047 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
4048 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
4049 v36 = v15;
Ritor1
parents:
diff changeset
4050 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
4051 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
4052 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
4053 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4054 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
4055 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
4056 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4057 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
4058 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
4059 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
4060 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4061 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
4062 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
4063 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4064 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
4065 v25 = v40;
Ritor1
parents:
diff changeset
4066 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
4067 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
4068 ++v25;
Ritor1
parents:
diff changeset
4069 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
4070 v26 += 4;
Ritor1
parents:
diff changeset
4071 ++v25;
Ritor1
parents:
diff changeset
4072 ++v38;
Ritor1
parents:
diff changeset
4073 v40 += 4;
Ritor1
parents:
diff changeset
4074 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
4075 v25[1] = *(int *)(v26 + 4);
Ritor1
parents:
diff changeset
4076 goto LABEL_9;
Ritor1
parents:
diff changeset
4077 }
Ritor1
parents:
diff changeset
4078 LABEL_10:
Ritor1
parents:
diff changeset
4079 v27 = v40;
Ritor1
parents:
diff changeset
4080 ++v38;
Ritor1
parents:
diff changeset
4081 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
4082 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
4083 ++v27;
Ritor1
parents:
diff changeset
4084 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
4085 v28 += 4;
Ritor1
parents:
diff changeset
4086 ++v27;
Ritor1
parents:
diff changeset
4087 v40 += 4;
Ritor1
parents:
diff changeset
4088 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
4089 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
4090 LABEL_11:
Ritor1
parents:
diff changeset
4091 v4 += 16;
Ritor1
parents:
diff changeset
4092 --v34;
Ritor1
parents:
diff changeset
4093 if ( !v34 )
Ritor1
parents:
diff changeset
4094 goto LABEL_12;
Ritor1
parents:
diff changeset
4095 }
Ritor1
parents:
diff changeset
4096 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
4097 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
Ritor1
parents:
diff changeset
4098 v36 = v6;
Ritor1
parents:
diff changeset
4099 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
4100 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
4101 *(float *)&v37 = (double)v7 * v6;
Ritor1
parents:
diff changeset
4102 v8 = *(float *)&v37 + 6.7553994e15;
Ritor1
parents:
diff changeset
4103 v9 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
4104 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
4105 v10 = *(float *)&v37 + 6.7553994e15;
Ritor1
parents:
diff changeset
4106 v11 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
4107 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
4108 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
Ritor1
parents:
diff changeset
4109 v12 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4110 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
4111 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
4112 v14 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
4113 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
4114 LABEL_9:
Ritor1
parents:
diff changeset
4115 //this = v35;
Ritor1
parents:
diff changeset
4116 v5 = (char *)&v30 + 4;
Ritor1
parents:
diff changeset
4117 goto LABEL_10;
Ritor1
parents:
diff changeset
4118 }
Ritor1
parents:
diff changeset
4119 LABEL_12:
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4120 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
4121 }
Ritor1
parents:
diff changeset
4122
Ritor1
parents:
diff changeset
4123 //----- (00477C61) --------------------------------------------------------
Ritor1
parents:
diff changeset
4124 int stru6_stru1_indoor_sw_billboard::sub_477C61()
Ritor1
parents:
diff changeset
4125 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4126 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1
0
Ritor1
parents:
diff changeset
4127 int v2; // ecx@2
Ritor1
parents:
diff changeset
4128 int v3; // eax@3
Ritor1
parents:
diff changeset
4129 double v4; // st7@4
Ritor1
parents:
diff changeset
4130 double v5; // st7@5
Ritor1
parents:
diff changeset
4131 double v6; // st6@5
Ritor1
parents:
diff changeset
4132 double v7; // st5@6
Ritor1
parents:
diff changeset
4133 float v8; // ST30_4@8
Ritor1
parents:
diff changeset
4134 float v9; // ST24_4@8
Ritor1
parents:
diff changeset
4135 double v10; // st7@8
Ritor1
parents:
diff changeset
4136 double v11; // st6@8
Ritor1
parents:
diff changeset
4137 double v12; // st5@8
Ritor1
parents:
diff changeset
4138 float v13; // ST24_4@13
Ritor1
parents:
diff changeset
4139 int v14; // esi@13
Ritor1
parents:
diff changeset
4140 char *v15; // esi@15
Ritor1
parents:
diff changeset
4141 signed int v16; // eax@16
Ritor1
parents:
diff changeset
4142 __int16 v17; // fps@16
Ritor1
parents:
diff changeset
4143 unsigned __int8 v18; // c2@16
Ritor1
parents:
diff changeset
4144 unsigned __int8 v19; // c3@16
Ritor1
parents:
diff changeset
4145 double v20; // st6@16
Ritor1
parents:
diff changeset
4146 float v21; // ST18_4@17
Ritor1
parents:
diff changeset
4147 float v22; // ST2C_4@17
Ritor1
parents:
diff changeset
4148 float v23; // ST34_4@17
Ritor1
parents:
diff changeset
4149 float v24; // ST24_4@17
Ritor1
parents:
diff changeset
4150 double v25; // st7@17
Ritor1
parents:
diff changeset
4151 double v26; // st6@17
Ritor1
parents:
diff changeset
4152 float v27; // ST34_4@18
Ritor1
parents:
diff changeset
4153 float v28; // ST30_4@18
Ritor1
parents:
diff changeset
4154 int v29; // eax@19
Ritor1
parents:
diff changeset
4155 signed int v31; // [sp+8h] [bp-28h]@15
Ritor1
parents:
diff changeset
4156 float v32; // [sp+Ch] [bp-24h]@16
Ritor1
parents:
diff changeset
4157 float v33; // [sp+14h] [bp-1Ch]@16
Ritor1
parents:
diff changeset
4158 float v34; // [sp+18h] [bp-18h]@16
Ritor1
parents:
diff changeset
4159 float v35; // [sp+1Ch] [bp-14h]@17
Ritor1
parents:
diff changeset
4160 float v36; // [sp+20h] [bp-10h]@4
Ritor1
parents:
diff changeset
4161 float v37; // [sp+24h] [bp-Ch]@4
Ritor1
parents:
diff changeset
4162 float v38; // [sp+24h] [bp-Ch]@16
Ritor1
parents:
diff changeset
4163 float v39; // [sp+28h] [bp-8h]@9
Ritor1
parents:
diff changeset
4164 float v40; // [sp+28h] [bp-8h]@16
Ritor1
parents:
diff changeset
4165 float v41; // [sp+2Ch] [bp-4h]@6
Ritor1
parents:
diff changeset
4166 float v42; // [sp+2Ch] [bp-4h]@9
Ritor1
parents:
diff changeset
4167
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4168 //v1 = this;
0
Ritor1
parents:
diff changeset
4169 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4170 {
Ritor1
parents:
diff changeset
4171 v2 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4172 if ( this->uNumVertices > 0 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4173 {
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
4174 v3 = (int)&this->field_14[1];
0
Ritor1
parents:
diff changeset
4175 do
Ritor1
parents:
diff changeset
4176 {
Ritor1
parents:
diff changeset
4177 v4 = *(float *)(v3 - 4);
Ritor1
parents:
diff changeset
4178 LODWORD(v37) = *(int *)v3;
Ritor1
parents:
diff changeset
4179 LODWORD(v36) = *(int *)(v3 + 4);
Ritor1
parents:
diff changeset
4180 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
4181 {
Ritor1
parents:
diff changeset
4182 v5 = v4 - (double)pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4183 v6 = v37 - (double)pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4184 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4185 {
Ritor1
parents:
diff changeset
4186 v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5;
Ritor1
parents:
diff changeset
4187 v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6;
Ritor1
parents:
diff changeset
4188 }
Ritor1
parents:
diff changeset
4189 else
Ritor1
parents:
diff changeset
4190 {
Ritor1
parents:
diff changeset
4191 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6;
Ritor1
parents:
diff changeset
4192 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
Ritor1
parents:
diff changeset
4193 }
Ritor1
parents:
diff changeset
4194 v8 = v7;
Ritor1
parents:
diff changeset
4195 v9 = v36 - (double)pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4196 v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9;
Ritor1
parents:
diff changeset
4197 v11 = v8;
Ritor1
parents:
diff changeset
4198 v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41;
Ritor1
parents:
diff changeset
4199 }
Ritor1
parents:
diff changeset
4200 else
Ritor1
parents:
diff changeset
4201 {
Ritor1
parents:
diff changeset
4202 v42 = v4 - (double)pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4203 v39 = v37 - (double)pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4204 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4205 {
Ritor1
parents:
diff changeset
4206 v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42;
Ritor1
parents:
diff changeset
4207 v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39;
Ritor1
parents:
diff changeset
4208 }
Ritor1
parents:
diff changeset
4209 else
Ritor1
parents:
diff changeset
4210 {
Ritor1
parents:
diff changeset
4211 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
Ritor1
parents:
diff changeset
4212 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
Ritor1
parents:
diff changeset
4213 }
Ritor1
parents:
diff changeset
4214 v12 = v36 - (double)pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4215 }
Ritor1
parents:
diff changeset
4216 v13 = v12;
Ritor1
parents:
diff changeset
4217 ++v2;
Ritor1
parents:
diff changeset
4218 *(int *)(v3 + 84) = LODWORD(v13);
Ritor1
parents:
diff changeset
4219 v14 = *(int *)(v3 + 8);
Ritor1
parents:
diff changeset
4220 *(float *)(v3 + 76) = v10;
Ritor1
parents:
diff changeset
4221 *(int *)(v3 + 88) = v14;
Ritor1
parents:
diff changeset
4222 *(float *)(v3 + 80) = v11;
Ritor1
parents:
diff changeset
4223 v3 += 16;
Ritor1
parents:
diff changeset
4224 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4225 while ( v2 < this->uNumVertices );
0
Ritor1
parents:
diff changeset
4226 }
Ritor1
parents:
diff changeset
4227 }
Ritor1
parents:
diff changeset
4228 else
Ritor1
parents:
diff changeset
4229 {
Ritor1
parents:
diff changeset
4230 v15 = (char *)&this->field_14[1];
Ritor1
parents:
diff changeset
4231 v31 = 3;
Ritor1
parents:
diff changeset
4232 do
Ritor1
parents:
diff changeset
4233 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4234 v40 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationX) * 0.0000152587890625;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4235 v32 = (double)stru_5C6E00->Sin(pIndoorCamera->sRotationX) * 0.0000152587890625;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4236 v34 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationY) * 0.0000152587890625;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4237 v16 = stru_5C6E00->Sin(pIndoorCamera->sRotationY);
0
Ritor1
parents:
diff changeset
4238 LODWORD(v38) = *(int *)v15;
Ritor1
parents:
diff changeset
4239 v33 = (double)v16 * 0.0000152587890625;
Ritor1
parents:
diff changeset
4240 //UNDEF(v17);
Ritor1
parents:
diff changeset
4241 v20 = *((float *)v15 - 1) - (double)pIndoorCamera->pos.x;
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1083
diff changeset
4242 //if ( v19 | v18 )
8b59f13c9c3e a few spells fixed
zipi
parents: 1083
diff changeset
4243 if(pIndoorCamera->pos.x == 0)
0
Ritor1
parents:
diff changeset
4244 {
Ritor1
parents:
diff changeset
4245 v27 = v20;
Ritor1
parents:
diff changeset
4246 LODWORD(v35) = *((int *)v15 + 1);
Ritor1
parents:
diff changeset
4247 v28 = v38 - (double)pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
4248 v25 = v33 * v28 + v34 * v27;
Ritor1
parents:
diff changeset
4249 v26 = v34 * v28 - v33 * v27;
Ritor1
parents:
diff changeset
4250 }
Ritor1
parents:
diff changeset
4251 else
Ritor1
parents:
diff changeset
4252 {
Ritor1
parents:
diff changeset
4253 v21 = v20;
Ritor1
parents:
diff changeset
4254 v22 = v38 - (double)pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
4255 v23 = v33 * v22 + v34 * v21;
Ritor1
parents:
diff changeset
4256 v24 = *((float *)v15 + 1) - (double)pIndoorCamera->pos.z;
Ritor1
parents:
diff changeset
4257 v25 = v32 * v24 + v40 * v23;
Ritor1
parents:
diff changeset
4258 v26 = v34 * v22 - v33 * v21;
Ritor1
parents:
diff changeset
4259 v35 = v40 * v24 - v32 * v23;
Ritor1
parents:
diff changeset
4260 }
Ritor1
parents:
diff changeset
4261 *((int *)v15 + 21) = LODWORD(v35);
Ritor1
parents:
diff changeset
4262 v29 = *((int *)v15 + 2);
Ritor1
parents:
diff changeset
4263 *((float *)v15 + 19) = v25;
Ritor1
parents:
diff changeset
4264 *((int *)v15 + 22) = v29;
Ritor1
parents:
diff changeset
4265 *((float *)v15 + 20) = v26;
Ritor1
parents:
diff changeset
4266 v15 += 16;
Ritor1
parents:
diff changeset
4267 --v31;
Ritor1
parents:
diff changeset
4268 }
Ritor1
parents:
diff changeset
4269 while ( v31 );
Ritor1
parents:
diff changeset
4270 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4271 this->uNumVertices = 3;
0
Ritor1
parents:
diff changeset
4272 return 1;
Ritor1
parents:
diff changeset
4273 }
Ritor1
parents:
diff changeset
4274
Ritor1
parents:
diff changeset
4275 //----- (00477F63) --------------------------------------------------------
Ritor1
parents:
diff changeset
4276 bool stru6_stru1_indoor_sw_billboard::sub_477F63()
Ritor1
parents:
diff changeset
4277 {
Ritor1
parents:
diff changeset
4278 signed int v1; // ebx@1
Ritor1
parents:
diff changeset
4279 stru6_stru1_indoor_sw_billboard *v2; // esi@1
Ritor1
parents:
diff changeset
4280 double v3; // st7@2
Ritor1
parents:
diff changeset
4281 int v4; // edx@4
Ritor1
parents:
diff changeset
4282 char *v5; // ecx@5
Ritor1
parents:
diff changeset
4283 int v6; // edi@5
Ritor1
parents:
diff changeset
4284 float v7; // ST08_4@13
Ritor1
parents:
diff changeset
4285 signed int v9; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4286 float v10; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
4287
Ritor1
parents:
diff changeset
4288 auto a1 = this;
Ritor1
parents:
diff changeset
4289
Ritor1
parents:
diff changeset
4290 v1 = 0;
Ritor1
parents:
diff changeset
4291 v2 = a1;
Ritor1
parents:
diff changeset
4292 v9 = 0;
Ritor1
parents:
diff changeset
4293 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4294 {
Ritor1
parents:
diff changeset
4295 v10 = 16192.0;
Ritor1
parents:
diff changeset
4296 v3 = (double)pBLVRenderParams->field_40 * 0.000015258789;
Ritor1
parents:
diff changeset
4297 }
Ritor1
parents:
diff changeset
4298 else
Ritor1
parents:
diff changeset
4299 {
Ritor1
parents:
diff changeset
4300 v10 = (double)pOutdoorCamera->shading_dist_mist;
Ritor1
parents:
diff changeset
4301 v3 = 8.0;
Ritor1
parents:
diff changeset
4302 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4303 v4 = a1->uNumVertices;
0
Ritor1
parents:
diff changeset
4304 if ( v4 <= 0 )
Ritor1
parents:
diff changeset
4305 goto LABEL_16;
Ritor1
parents:
diff changeset
4306 v5 = (char *)&a1->field_14[20];
Ritor1
parents:
diff changeset
4307 v6 = v4;
Ritor1
parents:
diff changeset
4308 do
Ritor1
parents:
diff changeset
4309 {
Ritor1
parents:
diff changeset
4310 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 )
Ritor1
parents:
diff changeset
4311 {
Ritor1
parents:
diff changeset
4312 if ( v3 < *(float *)v5 )
Ritor1
parents:
diff changeset
4313 v9 = 1;
Ritor1
parents:
diff changeset
4314 else
Ritor1
parents:
diff changeset
4315 v1 = 1;
Ritor1
parents:
diff changeset
4316 }
Ritor1
parents:
diff changeset
4317 v5 += 16;
Ritor1
parents:
diff changeset
4318 --v6;
Ritor1
parents:
diff changeset
4319 }
Ritor1
parents:
diff changeset
4320 while ( v6 );
Ritor1
parents:
diff changeset
4321 if ( !v1 )
Ritor1
parents:
diff changeset
4322 {
Ritor1
parents:
diff changeset
4323 if ( v9 )
Ritor1
parents:
diff changeset
4324 {
Ritor1
parents:
diff changeset
4325 v2->_477927(v10);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4326 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4327 }
Ritor1
parents:
diff changeset
4328 LABEL_16:
Ritor1
parents:
diff changeset
4329 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
4330 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4331 }
Ritor1
parents:
diff changeset
4332 v7 = v3;
Ritor1
parents:
diff changeset
4333 _4775ED(v7);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4334 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
4335 }
Ritor1
parents:
diff changeset
4336
Ritor1
parents:
diff changeset
4337 //----- (0047802A) --------------------------------------------------------
Ritor1
parents:
diff changeset
4338 int stru6_stru1_indoor_sw_billboard::sub_47802A()
Ritor1
parents:
diff changeset
4339 {
Ritor1
parents:
diff changeset
4340 double v6; // st7@4
Ritor1
parents:
diff changeset
4341 double v12; // st7@16
Ritor1
parents:
diff changeset
4342 signed int v16; // [sp+38h] [bp-Ch]@1
Ritor1
parents:
diff changeset
4343 int a6; // [sp+3Ch] [bp-8h]@5
Ritor1
parents:
diff changeset
4344 int a5; // [sp+40h] [bp-4h]@5
Ritor1
parents:
diff changeset
4345
Ritor1
parents:
diff changeset
4346 auto a1 = this;
Ritor1
parents:
diff changeset
4347
Ritor1
parents:
diff changeset
4348 v16 = 0;
Ritor1
parents:
diff changeset
4349 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
4350 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4351 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
4352 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4353 v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4354 if ( pRenderer->pRenderD3D )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4355 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4356 pGame->pIndoorCameraD3D->Project(
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4357 round(a1->field_B4[i*4]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4358 round(a1->field_B4[i*4+1]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4359 round(a1->field_B4[i*4+2]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4360 &a5,
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4361 &a6);
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4362 a1->field_B4[i*4+16] = (double)a5;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4363 a1->field_B4[i*4+17] = (double)a6;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4364 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
4365 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4366 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4367 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4368 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
4369 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
4370 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
4371 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4372 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
4373 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
4374 && (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
4375 && (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
4376 && (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
4377 v16 = 1;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4378 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4379 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4380 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4381 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
4382 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
4383 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4384 v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
4385 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
4386 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
4387 *((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
4388 *((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
4389 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
4390 && (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
4391 && (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
4392 && (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
4393 v16 = 1;
0
Ritor1
parents:
diff changeset
4394 }
Ritor1
parents:
diff changeset
4395 }
Ritor1
parents:
diff changeset
4396 return v16;
Ritor1
parents:
diff changeset
4397 }
Ritor1
parents:
diff changeset
4398
Ritor1
parents:
diff changeset
4399 //----- (004783FA) --------------------------------------------------------
Ritor1
parents:
diff changeset
4400 void __cdecl sub_4783FA_construct_global_73D150()
Ritor1
parents:
diff changeset
4401 {
Ritor1
parents:
diff changeset
4402 char *v0; // eax@1
Ritor1
parents:
diff changeset
4403 signed int v1; // ecx@1
Ritor1
parents:
diff changeset
4404
Ritor1
parents:
diff changeset
4405 v0 = (char *)&array_73D150[0].flt_2C;
Ritor1
parents:
diff changeset
4406 v1 = 20;
Ritor1
parents:
diff changeset
4407 do
Ritor1
parents:
diff changeset
4408 {
Ritor1
parents:
diff changeset
4409 *(float *)v0 = 0.0;
Ritor1
parents:
diff changeset
4410 v0 += 48;
Ritor1
parents:
diff changeset
4411 --v1;
Ritor1
parents:
diff changeset
4412 }
Ritor1
parents:
diff changeset
4413 while ( v1 );
Ritor1
parents:
diff changeset
4414 }
Ritor1
parents:
diff changeset
4415
Ritor1
parents:
diff changeset
4416 //----- (0047840D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4417 char Render::DrawBuildingsD3D()
Ritor1
parents:
diff changeset
4418 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4419 //IndoorCameraD3D *v0; // eax@3
0
Ritor1
parents:
diff changeset
4420 char result; // al@3
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4421 BSPModel *v2; // ebx@4
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4422 int v3; // eax@6
0
Ritor1
parents:
diff changeset
4423 ODMFace *pFace; // esi@6
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4424 Vec3_int_ *v5; // ecx@8
0
Ritor1
parents:
diff changeset
4425 int v6; // eax@8
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4426 struct Polygon *v7; // ebx@8
0
Ritor1
parents:
diff changeset
4427 LightmapBuilder *v8; // eax@8
Ritor1
parents:
diff changeset
4428 int v9; // ecx@8
Ritor1
parents:
diff changeset
4429 char v10; // zf@8
Ritor1
parents:
diff changeset
4430 Texture *pFaceTexture; // eax@10
Ritor1
parents:
diff changeset
4431 signed int v12; // ecx@10
Ritor1
parents:
diff changeset
4432 unsigned int v13; // eax@14
Ritor1
parents:
diff changeset
4433 unsigned int v14; // eax@18
Ritor1
parents:
diff changeset
4434 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
4435 unsigned int v16; // edi@22
Ritor1
parents:
diff changeset
4436 int v17; // eax@24
Ritor1
parents:
diff changeset
4437 int v18; // edi@34
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4438 RenderVertexSoft *v19; // eax@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4439 unsigned short *v20; // ecx@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4440 unsigned short *v20b; // ecx@35
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4441 unsigned short *v20c; // ecx@35
0
Ritor1
parents:
diff changeset
4442 Vec3_int_ *v21; // edx@36
Ritor1
parents:
diff changeset
4443 int v22; // edx@36
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4444 RenderVertexSoft *v23; // edi@37
0
Ritor1
parents:
diff changeset
4445 int v24; // eax@50
Ritor1
parents:
diff changeset
4446 int v25; // ecx@55
Ritor1
parents:
diff changeset
4447 int v26; // eax@57
Ritor1
parents:
diff changeset
4448 int v27; // eax@57
Ritor1
parents:
diff changeset
4449 int v28; // eax@58
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4450 //int v29; // edx@58
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4451 //double v30; // st7@59
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4452 //LightmapBuilder *v31; // edi@63
0
Ritor1
parents:
diff changeset
4453 signed int v32; // eax@73
Ritor1
parents:
diff changeset
4454 int v33; // eax@78
Ritor1
parents:
diff changeset
4455 unsigned int v34; // eax@80
Ritor1
parents:
diff changeset
4456 std::string v35; // [sp-18h] [bp-70h]@2
Ritor1
parents:
diff changeset
4457 int v36; // [sp-14h] [bp-6Ch]@69
Ritor1
parents:
diff changeset
4458 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69
Ritor1
parents:
diff changeset
4459 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
4460 //LightmapBuilder *v39; // [sp-8h] [bp-60h]@2
0
Ritor1
parents:
diff changeset
4461 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
4462 //std::string *v41; // [sp+Ch] [bp-4Ch]@2
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4463 int v41b;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4464 int v42; // [sp+10h] [bp-48h]@6
0
Ritor1
parents:
diff changeset
4465 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8
Ritor1
parents:
diff changeset
4466 float v44; // [sp+18h] [bp-40h]@10
Ritor1
parents:
diff changeset
4467 float v45; // [sp+1Ch] [bp-3Ch]@10
Ritor1
parents:
diff changeset
4468 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
4469 //IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3
0
Ritor1
parents:
diff changeset
4470 unsigned int v48; // [sp+28h] [bp-30h]@8
Ritor1
parents:
diff changeset
4471 int v49; // [sp+2Ch] [bp-2Ch]@10
Ritor1
parents:
diff changeset
4472 int v50; // [sp+30h] [bp-28h]@34
Ritor1
parents:
diff changeset
4473 int v51; // [sp+34h] [bp-24h]@35
Ritor1
parents:
diff changeset
4474 int v52; // [sp+38h] [bp-20h]@36
Ritor1
parents:
diff changeset
4475 int v53; // [sp+3Ch] [bp-1Ch]@8
Ritor1
parents:
diff changeset
4476 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6
Ritor1
parents:
diff changeset
4477 int a1; // [sp+44h] [bp-14h]@3
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4478 BSPModel *v56; // [sp+48h] [bp-10h]@4
0
Ritor1
parents:
diff changeset
4479 int uNumVertices; // [sp+4Ch] [bp-Ch]@34
Ritor1
parents:
diff changeset
4480 int unused; // [sp+50h] [bp-8h]@3
Ritor1
parents:
diff changeset
4481 int a3; // [sp+57h] [bp-1h]@2
Ritor1
parents:
diff changeset
4482
Ritor1
parents:
diff changeset
4483 if ( !pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4484 {
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4485 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
4486 }
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4487
0
Ritor1
parents:
diff changeset
4488 unused = 0;
Ritor1
parents:
diff changeset
4489 a1 = 0;
Ritor1
parents:
diff changeset
4490 result = LOBYTE(pOutdoor->pBModels);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4491 v41b = pOutdoor->uNumBModels;
0
Ritor1
parents:
diff changeset
4492 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
4493 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4494 v2 = pOutdoor->pBModels;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4495 v56 = pOutdoor->pBModels;
0
Ritor1
parents:
diff changeset
4496 while ( 1 )
Ritor1
parents:
diff changeset
4497 {
Ritor1
parents:
diff changeset
4498 if ( IsBModelVisible(a1, &unused) )
Ritor1
parents:
diff changeset
4499 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4500 v2->field_40 |= 1u;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4501 v3 = v2->uNumFaces;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4502 pFace = v2->pFaces;
0
Ritor1
parents:
diff changeset
4503 v54 = 0;
Ritor1
parents:
diff changeset
4504 v46 = pFace;
Ritor1
parents:
diff changeset
4505 v42 = v3;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4506 if ( v3 > 0 )
0
Ritor1
parents:
diff changeset
4507 break;
Ritor1
parents:
diff changeset
4508 }
Ritor1
parents:
diff changeset
4509 LABEL_86:
Ritor1
parents:
diff changeset
4510 ++a1;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4511 ++v2;// += 47;
0
Ritor1
parents:
diff changeset
4512 result = a1;
Ritor1
parents:
diff changeset
4513 v56 = v2;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4514 if ( a1 >= v41b )
0
Ritor1
parents:
diff changeset
4515 return result;
Ritor1
parents:
diff changeset
4516 }
Ritor1
parents:
diff changeset
4517 while ( 1 )
Ritor1
parents:
diff changeset
4518 {
Ritor1
parents:
diff changeset
4519 if (pFace->Invisible())
Ritor1
parents:
diff changeset
4520 goto LABEL_85;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4521 //v5 = (int)*(v2 - 1);
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4522 v5 = v2->pVertices.pVertices;
0
Ritor1
parents:
diff changeset
4523 v6 = pFace->pVertexIDs[0];
Ritor1
parents:
diff changeset
4524 v53 = 0;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4525 v7 = &array_77EC08[pOutdoorCamera->uNumPolygons];
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4526 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8);
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4527 v8 = (LightmapBuilder *)v5[v6].z;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4528 v7->flags = 0;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4529 v7->field_32 = 0;
0
Ritor1
parents:
diff changeset
4530 pLightmapBuilder = v8;
Ritor1
parents:
diff changeset
4531 v9 = pFace->uTextureID;
Ritor1
parents:
diff changeset
4532 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0;
Ritor1
parents:
diff changeset
4533 v48 = pFace->uTextureID;
Ritor1
parents:
diff changeset
4534 if ( !v10 )
Ritor1
parents:
diff changeset
4535 {
Ritor1
parents:
diff changeset
4536 v48 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed);
Ritor1
parents:
diff changeset
4537 v9 = v48;
Ritor1
parents:
diff changeset
4538 }
945
0d96349d8c87 Restoring inlined methods
Nomad
parents: 940
diff changeset
4539 pFaceTexture = pBitmaps_LOD->GetTexture(v9);
0
Ritor1
parents:
diff changeset
4540 v7->pTexture = pFaceTexture;
945
0d96349d8c87 Restoring inlined methods
Nomad
parents: 940
diff changeset
4541 v12 = pFaceTexture->uTextureWidth;
0
Ritor1
parents:
diff changeset
4542 v49 = v12;
Ritor1
parents:
diff changeset
4543 v49 = pFaceTexture->uTextureHeight;
Ritor1
parents:
diff changeset
4544 v10 = (pFace->uAttributes & 0x10) == 0;
Ritor1
parents:
diff changeset
4545 v45 = 1.0 / (double)v12;
Ritor1
parents:
diff changeset
4546 v44 = 1.0 / (double)v49;
Ritor1
parents:
diff changeset
4547 if ( !v10 )
Ritor1
parents:
diff changeset
4548 *(int *)&v7->flags |= 2u;
Ritor1
parents:
diff changeset
4549 if ( BYTE2(pFace->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
4550 HIBYTE(v7->flags) |= 4u;
Ritor1
parents:
diff changeset
4551 v13 = pFace->uAttributes;
Ritor1
parents:
diff changeset
4552 if ( v13 & 4 )
Ritor1
parents:
diff changeset
4553 {
Ritor1
parents:
diff changeset
4554 HIBYTE(v7->flags) |= 4u;
Ritor1
parents:
diff changeset
4555 }
Ritor1
parents:
diff changeset
4556 else
Ritor1
parents:
diff changeset
4557 {
Ritor1
parents:
diff changeset
4558 if ( v13 & 0x20 )
Ritor1
parents:
diff changeset
4559 HIBYTE(v7->flags) |= 8u;
Ritor1
parents:
diff changeset
4560 }
Ritor1
parents:
diff changeset
4561 v14 = pFace->uAttributes;
Ritor1
parents:
diff changeset
4562 if ( BYTE1(v14) & 8 )
Ritor1
parents:
diff changeset
4563 {
Ritor1
parents:
diff changeset
4564 *(int *)&v7->flags |= 0x2000u;
Ritor1
parents:
diff changeset
4565 }
Ritor1
parents:
diff changeset
4566 else
Ritor1
parents:
diff changeset
4567 {
Ritor1
parents:
diff changeset
4568 if ( v14 & 0x40 )
Ritor1
parents:
diff changeset
4569 HIBYTE(v7->flags) |= 0x10u;
Ritor1
parents:
diff changeset
4570 }
Ritor1
parents:
diff changeset
4571 v15 = GetTickCount();
Ritor1
parents:
diff changeset
4572 v7->sTextureDeltaU = pFace->sTextureDeltaU;
Ritor1
parents:
diff changeset
4573 v7->sTextureDeltaV = pFace->sTextureDeltaV;
Ritor1
parents:
diff changeset
4574 v16 = v15 >> 4;
Ritor1
parents:
diff changeset
4575 if ( pFace->pFacePlane.vNormal.z && (v40 = pFace->pFacePlane.vNormal.z, abs(v40) >= 59082) )
Ritor1
parents:
diff changeset
4576 {
Ritor1
parents:
diff changeset
4577 v17 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4578 if ( BYTE1(v17) & 4 )
Ritor1
parents:
diff changeset
4579 goto LABEL_29;
Ritor1
parents:
diff changeset
4580 if ( BYTE1(v17) & 8 )
Ritor1
parents:
diff changeset
4581 {
Ritor1
parents:
diff changeset
4582 LABEL_26:
Ritor1
parents:
diff changeset
4583 v7->sTextureDeltaV -= v16 & v7->pTexture->uHeightMinus1;
Ritor1
parents:
diff changeset
4584 goto LABEL_30;
Ritor1
parents:
diff changeset
4585 }
Ritor1
parents:
diff changeset
4586 }
Ritor1
parents:
diff changeset
4587 else
Ritor1
parents:
diff changeset
4588 {
Ritor1
parents:
diff changeset
4589 v17 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4590 if ( BYTE1(v17) & 4 )
Ritor1
parents:
diff changeset
4591 goto LABEL_26;
Ritor1
parents:
diff changeset
4592 if ( BYTE1(v17) & 8 )
Ritor1
parents:
diff changeset
4593 {
Ritor1
parents:
diff changeset
4594 LABEL_29:
Ritor1
parents:
diff changeset
4595 v7->sTextureDeltaV += v16 & v7->pTexture->uHeightMinus1;
Ritor1
parents:
diff changeset
4596 goto LABEL_30;
Ritor1
parents:
diff changeset
4597 }
Ritor1
parents:
diff changeset
4598 }
Ritor1
parents:
diff changeset
4599 LABEL_30:
Ritor1
parents:
diff changeset
4600 if ( BYTE1(v17) & 0x10 )
Ritor1
parents:
diff changeset
4601 {
Ritor1
parents:
diff changeset
4602 v7->sTextureDeltaU -= v16 & v7->pTexture->uWidthMinus1;
Ritor1
parents:
diff changeset
4603 }
Ritor1
parents:
diff changeset
4604 else
Ritor1
parents:
diff changeset
4605 {
Ritor1
parents:
diff changeset
4606 if ( BYTE1(v17) & 0x20 )
Ritor1
parents:
diff changeset
4607 v7->sTextureDeltaU += v16 & v7->pTexture->uWidthMinus1;
Ritor1
parents:
diff changeset
4608 }
Ritor1
parents:
diff changeset
4609 v18 = pFace->uNumVertices;
Ritor1
parents:
diff changeset
4610 v50 = 0;
Ritor1
parents:
diff changeset
4611 v49 = 0;
Ritor1
parents:
diff changeset
4612 uNumVertices = v18;
Ritor1
parents:
diff changeset
4613 if ( v18 > 0 )
Ritor1
parents:
diff changeset
4614 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4615 //v19 = (char *)&array_73D150[0].vWorldPosition.z;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4616 //v20 = (char *)pFace->pTextureUIDs;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4617 v19 = array_73D150;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4618 v20 = pFace->pTextureUIDs;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4619 v20b = pFace->pVertexIDs;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4620 v20c = pFace->pTextureVIDs;
0
Ritor1
parents:
diff changeset
4621 v51 = v18;
Ritor1
parents:
diff changeset
4622 do
Ritor1
parents:
diff changeset
4623 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4624 /* v21 = &(*(v56 - 1))[*((short *)v20 - 20)];
0
Ritor1
parents:
diff changeset
4625 *((float *)v19 - 2) = (double)v21->x;
Ritor1
parents:
diff changeset
4626 *((float *)v19 - 1) = (double)v21->y;
Ritor1
parents:
diff changeset
4627 *(float *)v19 = (double)v21->z;
Ritor1
parents:
diff changeset
4628 v19 += 48;
Ritor1
parents:
diff changeset
4629 v52 = v7->sTextureDeltaU + *(short *)v20;
Ritor1
parents:
diff changeset
4630 *((float *)v19 - 5) = (double)v52 * v45;
Ritor1
parents:
diff changeset
4631 v22 = v7->sTextureDeltaV + *((short *)v20 + 20);
Ritor1
parents:
diff changeset
4632 v20 += 2;
Ritor1
parents:
diff changeset
4633 v10 = v51-- == 1;
Ritor1
parents:
diff changeset
4634 v52 = v22;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4635 *((float *)v19 - 4) = (double)v22 * v44;*/
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4636
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4637 //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20));
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4638 v21 = &v56->pVertices.pVertices[*v20b];
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4639 //*((float *)v19 - 2) = (double)v21->x;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4640 //*((float *)v19 - 1) = (double)v21->y;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4641 v19->vWorldPosition.x = (double)v21->x;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4642 v19->vWorldPosition.y = (double)v21->y;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4643 v19->vWorldPosition.z = (double)v21->z;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4644 ++v19;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4645 v52 = v7->sTextureDeltaU + (signed __int16)*v20;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4646 //*((float *)v19 - 5) = (double)v52 * v45;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4647 (v19-1)->u = (double)v52 * v45;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4648 v22 = v7->sTextureDeltaV + (signed __int16)*v20c;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4649 ++v20;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4650 ++v20b;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4651 ++v20c;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4652 v10 = v51-- == 1;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4653 v52 = v22;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4654 //*((float *)v19 - 4) = (double)v22 * v44;
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4655 (v19-1)->v = (double)v22 * v44;
0
Ritor1
parents:
diff changeset
4656 }
Ritor1
parents:
diff changeset
4657 while ( !v10 );
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4658 //v23 = (char *)&array_73D150[0].vWorldViewPosition;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4659 v23 = array_73D150;
0
Ritor1
parents:
diff changeset
4660 v51 = uNumVertices;
Ritor1
parents:
diff changeset
4661 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder;
Ritor1
parents:
diff changeset
4662 do
Ritor1
parents:
diff changeset
4663 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4664 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) )
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4665 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z )
0
Ritor1
parents:
diff changeset
4666 ++v53;
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4667 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u);
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4668 pGame->pIndoorCameraD3D->ViewTransform(v23, 1u);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4669 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x )
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4670 {
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4671 if ( v23->vWorldViewPosition.x >= 8.0 )
0
Ritor1
parents:
diff changeset
4672 v49 = 1;
Ritor1
parents:
diff changeset
4673 else
Ritor1
parents:
diff changeset
4674 v50 = 1;
Ritor1
parents:
diff changeset
4675 }
Ritor1
parents:
diff changeset
4676 else
Ritor1
parents:
diff changeset
4677 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4678 pGame->pIndoorCameraD3D->Project(v23, 1u, 0);
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4679 }
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4680 ++v23;// += 48;
0
Ritor1
parents:
diff changeset
4681 --v51;
Ritor1
parents:
diff changeset
4682 }
Ritor1
parents:
diff changeset
4683 while ( v51 );
Ritor1
parents:
diff changeset
4684 v18 = uNumVertices;
Ritor1
parents:
diff changeset
4685 }
Ritor1
parents:
diff changeset
4686 if ( v53 == v18 )
Ritor1
parents:
diff changeset
4687 LOBYTE(v7->field_32) |= 1u;
Ritor1
parents:
diff changeset
4688 v24 = pOutdoor->vSunlight.x;
Ritor1
parents:
diff changeset
4689 v7->pODMFace = pFace;
Ritor1
parents:
diff changeset
4690 v7->uNumVertices = v18;
Ritor1
parents:
diff changeset
4691 v7->field_59 = 5;
Ritor1
parents:
diff changeset
4692 pLightmapBuilder = (LightmapBuilder *)-v24;
Ritor1
parents:
diff changeset
4693 v51 = pFace->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4694 v51 = (unsigned __int64)(-v24 * (signed __int64)v51) >> 16;
Ritor1
parents:
diff changeset
4695 v53 = pFace->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4696 pLightmapBuilder = (LightmapBuilder *)-pOutdoor->vSunlight.y;
Ritor1
parents:
diff changeset
4697 v53 = (unsigned __int64)(-pOutdoor->vSunlight.y * (signed __int64)v53) >> 16;
Ritor1
parents:
diff changeset
4698 v52 = pFace->pFacePlane.vNormal.z;
Ritor1
parents:
diff changeset
4699 v52 = (unsigned __int64)(-pOutdoor->vSunlight.z * (signed __int64)v52) >> 16;
Ritor1
parents:
diff changeset
4700 pLightmapBuilder = (LightmapBuilder *)(v51 + v53 + v52);
Ritor1
parents:
diff changeset
4701 v51 = 20 * (int)pLightmapBuilder;
Ritor1
parents:
diff changeset
4702 result = 20 - (20 * (signed int)pLightmapBuilder >> 16);
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4703 v7->dimming_level = result;
0
Ritor1
parents:
diff changeset
4704 if ( result < 0 )
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4705 v7->dimming_level = 0;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4706 if ( v7->dimming_level > 31 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4707 v7->dimming_level = 31;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4708 if ( pOutdoorCamera->uNumPolygons >= 1999 + 5000)
0
Ritor1
parents:
diff changeset
4709 return result;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4710 ++pOutdoorCamera->uNumPolygons;
0
Ritor1
parents:
diff changeset
4711 ++pOutdoorCamera->field_44;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4712 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) )
0
Ritor1
parents:
diff changeset
4713 {
Ritor1
parents:
diff changeset
4714 LOBYTE(v25) = (char)v54;
Ritor1
parents:
diff changeset
4715 v26 = a1;
Ritor1
parents:
diff changeset
4716 pFace->bVisible = 1;
Ritor1
parents:
diff changeset
4717 v7->uBModelFaceID = v25;
Ritor1
parents:
diff changeset
4718 LOWORD(v25) = (unsigned __int8)v25;
Ritor1
parents:
diff changeset
4719 v7->uBModelID = v26;
Ritor1
parents:
diff changeset
4720 v27 = 8 * (v25 | (v26 << 6));
Ritor1
parents:
diff changeset
4721 LOBYTE(v27) = v27 | 6;
Ritor1
parents:
diff changeset
4722 v7->field_50 = v27;
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4723
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4724 for (v28 = 0; v28 < v18; ++v28)
0
Ritor1
parents:
diff changeset
4725 {
Ritor1
parents:
diff changeset
4726 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
4727 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
4728
0
Ritor1
parents:
diff changeset
4729 pFace = v46;
Ritor1
parents:
diff changeset
4730 }
Ritor1
parents:
diff changeset
4731
Ritor1
parents:
diff changeset
4732 static stru154 static_RenderBuildingsD3D_stru_73C834;
Ritor1
parents:
diff changeset
4733 /*static bool __init_flag = false;
Ritor1
parents:
diff changeset
4734 if (!__init_flag)
Ritor1
parents:
diff changeset
4735 {
Ritor1
parents:
diff changeset
4736 __init_flag = true;
Ritor1
parents:
diff changeset
4737
Ritor1
parents:
diff changeset
4738 static_RenderBuildingsD3D_byte_73C84C_init_flag |= 1u;
Ritor1
parents:
diff changeset
4739 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834);
Ritor1
parents:
diff changeset
4740 atexit(loc_4789D4);
Ritor1
parents:
diff changeset
4741 }*/
Ritor1
parents:
diff changeset
4742
Ritor1
parents:
diff changeset
4743 v40 = (int)pFace;
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4744 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(pFace);
0
Ritor1
parents:
diff changeset
4745 pDecalBuilder->ApplyDecals_OutdoorFace(pFace);
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4746 pGame->pLightmapBuilder->std__vector_000004_size = 0;
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4747
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4748 int v31 = 0;
0
Ritor1
parents:
diff changeset
4749 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 )
Ritor1
parents:
diff changeset
4750 {
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4751 v31 = v50 ? 3 : v49 != 0 ? 5 : 0;
866
7bd9beae3b8d GameUI_WritePointedObjectStatusString crash fixed
zipi
parents: 865
diff changeset
4752 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices);
0
Ritor1
parents:
diff changeset
4753 if ( pDecalBuilder->uNumDecals > 0 )
Ritor1
parents:
diff changeset
4754 {
Ritor1
parents:
diff changeset
4755 v40 = -1;
Ritor1
parents:
diff changeset
4756 v38 = 0;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4757 v37 = array_50AC10;
0
Ritor1
parents:
diff changeset
4758 v36 = uNumVertices;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
4759 pDecalBuilder->ApplyDecals(31 - v7->dimming_level,
0
Ritor1
parents:
diff changeset
4760 2,
Ritor1
parents:
diff changeset
4761 &static_RenderBuildingsD3D_stru_73C834,
Ritor1
parents:
diff changeset
4762 uNumVertices,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4763 array_50AC10,
0
Ritor1
parents:
diff changeset
4764 0,
Ritor1
parents:
diff changeset
4765 (char)v31,
Ritor1
parents:
diff changeset
4766 -1);
Ritor1
parents:
diff changeset
4767 }
Ritor1
parents:
diff changeset
4768 }
Ritor1
parents:
diff changeset
4769 if ( stru_F8AD28.uNumLightsApplied > 0 )
1395
8d4ec56416ef Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents: 1391
diff changeset
4770 pGame->pLightmapBuilder->ApplyLights(
0
Ritor1
parents:
diff changeset
4771 &stru_F8AD28,
Ritor1
parents:
diff changeset
4772 &static_RenderBuildingsD3D_stru_73C834,
Ritor1
parents:
diff changeset
4773 uNumVertices,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
4774 array_50AC10,
0
Ritor1
parents:
diff changeset
4775 0,
Ritor1
parents:
diff changeset
4776 (char)v31);
Ritor1
parents:
diff changeset
4777 if ( v50 )
Ritor1
parents:
diff changeset
4778 {
Ritor1
parents:
diff changeset
4779 v32 = sr_424CD7(uNumVertices);
Ritor1
parents:
diff changeset
4780 goto LABEL_76;
Ritor1
parents:
diff changeset
4781 }
Ritor1
parents:
diff changeset
4782 if ( v49 )
Ritor1
parents:
diff changeset
4783 {
Ritor1
parents:
diff changeset
4784 v32 = sr_424EE0_MakeFanFromTriangle(uNumVertices);
Ritor1
parents:
diff changeset
4785 LABEL_76:
Ritor1
parents:
diff changeset
4786 v7->uNumVertices = v32;
Ritor1
parents:
diff changeset
4787 uNumVertices = v32;
Ritor1
parents:
diff changeset
4788 OutdoorCamera::Project(v32);
Ritor1
parents:
diff changeset
4789 }
Ritor1
parents:
diff changeset
4790 if ( uNumVertices )
Ritor1
parents:
diff changeset
4791 {
Ritor1
parents:
diff changeset
4792 v33 = *(int *)&v7->flags;
Ritor1
parents:
diff changeset
4793 if ( v33 & 2 )
Ritor1
parents:
diff changeset
4794 {
Ritor1
parents:
diff changeset
4795 if ( BYTE1(v33) & 0x3C )
Ritor1
parents:
diff changeset
4796 v34 = pRenderer->pHDWaterBitmapIDs[0];
Ritor1
parents:
diff changeset
4797 else
265
96bc024a5fed Render overflows
Nomad
parents: 257
diff changeset
4798 v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
0
Ritor1
parents:
diff changeset
4799 v40 = (int)pBitmaps_LOD->pHardwareTextures[v34];
Ritor1
parents:
diff changeset
4800 }
Ritor1
parents:
diff changeset
4801 else
Ritor1
parents:
diff changeset
4802 {
Ritor1
parents:
diff changeset
4803 v40 = (int)pBitmaps_LOD->pHardwareTextures[v48];
Ritor1
parents:
diff changeset
4804 }
Ritor1
parents:
diff changeset
4805 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40);
Ritor1
parents:
diff changeset
4806 }
Ritor1
parents:
diff changeset
4807 goto LABEL_85;
Ritor1
parents:
diff changeset
4808 }
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4809 --pOutdoorCamera->uNumPolygons;
0
Ritor1
parents:
diff changeset
4810 --pOutdoorCamera->field_44;
Ritor1
parents:
diff changeset
4811 LABEL_85:
Ritor1
parents:
diff changeset
4812 v54 = (Vec3_int_ *)((char *)v54 + 1);
Ritor1
parents:
diff changeset
4813 v2 = v56;
Ritor1
parents:
diff changeset
4814 ++pFace;
Ritor1
parents:
diff changeset
4815 v46 = pFace;
Ritor1
parents:
diff changeset
4816 if ( (signed int)v54 >= (signed int)v42 )
Ritor1
parents:
diff changeset
4817 goto LABEL_86;
Ritor1
parents:
diff changeset
4818 }
Ritor1
parents:
diff changeset
4819 }
Ritor1
parents:
diff changeset
4820 return result;
Ritor1
parents:
diff changeset
4821 }
Ritor1
parents:
diff changeset
4822 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag;
Ritor1
parents:
diff changeset
4823
Ritor1
parents:
diff changeset
4824
Ritor1
parents:
diff changeset
4825 //----- (00479089) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4826 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable)
0
Ritor1
parents:
diff changeset
4827 {
Ritor1
parents:
diff changeset
4828 BSPModel *v2; // eax@1
Ritor1
parents:
diff changeset
4829 int v3; // edi@1
Ritor1
parents:
diff changeset
4830 int v4; // ebx@1
Ritor1
parents:
diff changeset
4831 int v5; // ST28_4@1
Ritor1
parents:
diff changeset
4832 int v6; // ecx@1
Ritor1
parents:
diff changeset
4833 int v7; // ebx@3
Ritor1
parents:
diff changeset
4834 int v8; // eax@3
Ritor1
parents:
diff changeset
4835 int v9; // eax@3
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4836 //int v10; // ebx@3
0
Ritor1
parents:
diff changeset
4837 signed int v11; // esi@6
Ritor1
parents:
diff changeset
4838 int v12; // esi@8
Ritor1
parents:
diff changeset
4839 bool result; // eax@9
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4840 //unsigned int v14; // [sp+Ch] [bp-20h]@1
0
Ritor1
parents:
diff changeset
4841 int v15; // [sp+Ch] [bp-20h]@5
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4842 //int *v16; // [sp+10h] [bp-1Ch]@1
0
Ritor1
parents:
diff changeset
4843 int v17; // [sp+1Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
4844 int v18; // [sp+20h] [bp-Ch]@1
Ritor1
parents:
diff changeset
4845 int v19; // [sp+20h] [bp-Ch]@3
Ritor1
parents:
diff changeset
4846 int angle; // [sp+24h] [bp-8h]@1
Ritor1
parents:
diff changeset
4847 int v21; // [sp+28h] [bp-4h]@1
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4848 //int v22; // [sp+28h] [bp-4h]@3
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4849
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4850 //v16 = unused;
0
Ritor1
parents:
diff changeset
4851 angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4852 //v14 = uModelID;
0
Ritor1
parents:
diff changeset
4853 v2 = &pOutdoor->pBModels[uModelID];
Ritor1
parents:
diff changeset
4854 v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
4855 v4 = v2->vBoundingCenter.y - pIndoorCamera->pos.y;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4856 v5 = stru_5C6E00->Cos(pIndoorCamera->sRotationY);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4857 v21 = stru_5C6E00->Sin(pIndoorCamera->sRotationY);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4858 v18 = stru_5C6E00->Cos(pIndoorCamera->sRotationX);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4859 stru_5C6E00->Sin(pIndoorCamera->sRotationX);
0
Ritor1
parents:
diff changeset
4860 v6 = v5;
Ritor1
parents:
diff changeset
4861 v17 = v3 * v5 + v4 * v21;
Ritor1
parents:
diff changeset
4862 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
4863 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16;
Ritor1
parents:
diff changeset
4864 v19 = v4 * v6 - v3 * v21;
Ritor1
parents:
diff changeset
4865 v7 = abs(v4);
Ritor1
parents:
diff changeset
4866 v8 = abs(v3);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 317
diff changeset
4867 v9 = int_get_vector_length(v8, v7, 0);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4868 //v10 = v14 * 188;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4869 //v22 = v9;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4870 *reachable = false;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4871 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 )
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4872 *reachable = true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4873 v15 = stru_5C6E00->Sin(angle);
0
Ritor1
parents:
diff changeset
4874 if ( v19 >= 0 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4875 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
4876 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4877 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16);
0
Ritor1
parents:
diff changeset
4878 v12 = v11 >> 16;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4879 if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 )
0
Ritor1
parents:
diff changeset
4880 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
4881 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4882 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 )
0
Ritor1
parents:
diff changeset
4883 {
Ritor1
parents:
diff changeset
4884 result = v12 < 0;
Ritor1
parents:
diff changeset
4885 LOBYTE(result) = v12 >= 0;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4886 return result;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4887 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4888 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4889 return true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4890 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4891 return false;
0
Ritor1
parents:
diff changeset
4892 }
Ritor1
parents:
diff changeset
4893
Ritor1
parents:
diff changeset
4894 //----- (00479295) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4895 int Polygon::_479295()
0
Ritor1
parents:
diff changeset
4896 {
Ritor1
parents:
diff changeset
4897 ODMFace *v2; // esi@1
Ritor1
parents:
diff changeset
4898 int v3; // ecx@4
Ritor1
parents:
diff changeset
4899 int v4; // eax@4
Ritor1
parents:
diff changeset
4900 int v5; // edx@4
Ritor1
parents:
diff changeset
4901 int v6; // ST14_4@5
Ritor1
parents:
diff changeset
4902 int v7; // ST04_4@5
Ritor1
parents:
diff changeset
4903 stru149 *v8; // ecx@5
Ritor1
parents:
diff changeset
4904 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8
Ritor1
parents:
diff changeset
4905 int v11; // [sp+18h] [bp-4h]@4
Ritor1
parents:
diff changeset
4906
Ritor1
parents:
diff changeset
4907 v2 = this->pODMFace;
Ritor1
parents:
diff changeset
4908 if ( !v2->pFacePlane.vNormal.z )
Ritor1
parents:
diff changeset
4909 {
Ritor1
parents:
diff changeset
4910 v3 = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4911 v4 = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4912 LABEL_9:
Ritor1
parents:
diff changeset
4913 v5 = 0;
Ritor1
parents:
diff changeset
4914 v11 = 65536;
Ritor1
parents:
diff changeset
4915 goto LABEL_5;
Ritor1
parents:
diff changeset
4916 }
Ritor1
parents:
diff changeset
4917 if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 )
Ritor1
parents:
diff changeset
4918 {
Ritor1
parents:
diff changeset
4919 thisa.x = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
4920 thisa.y = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
4921 thisa.z = 0;
Ritor1
parents:
diff changeset
4922 thisa.Normalize_float();
Ritor1
parents:
diff changeset
4923 v4 = thisa.x;
Ritor1
parents:
diff changeset
4924 v3 = thisa.y;
Ritor1
parents:
diff changeset
4925 goto LABEL_9;
Ritor1
parents:
diff changeset
4926 }
Ritor1
parents:
diff changeset
4927 v3 = 0;
Ritor1
parents:
diff changeset
4928 v4 = 65536;
Ritor1
parents:
diff changeset
4929 v11 = 0;
Ritor1
parents:
diff changeset
4930 v5 = -65536;
Ritor1
parents:
diff changeset
4931 LABEL_5:
Ritor1
parents:
diff changeset
4932 v6 = v11;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4933 sTextureDeltaU = v2->sTextureDeltaU;
0
Ritor1
parents:
diff changeset
4934 v7 = v3;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4935 v8 = ptr_38;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
4936 sTextureDeltaV = v2->sTextureDeltaV;
0
Ritor1
parents:
diff changeset
4937 v8->_48616B(v4, v7, 0, 0, v5, v6);
Ritor1
parents:
diff changeset
4938 return 1;
Ritor1
parents:
diff changeset
4939 }
Ritor1
parents:
diff changeset
4940
Ritor1
parents:
diff changeset
4941
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4942 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
4943 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4944 #pragma pack(push, 1)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4945 struct TGAHeader
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4946 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4947 unsigned char tgaSkip;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4948 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
4949 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
4950
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4951 short colourmapstart; // first colour map entry in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4952 short colourmaplength; // number of colours in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4953 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
4954
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4955 //unsigned char tgaDontCare2[9];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4956 short xstart; // image x origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4957 short ystart; // image y origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4958
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4959 unsigned short tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4960 unsigned short tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4961 unsigned char tgaBPP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4962
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4963 char descriptor; // image descriptor bits: 00vhaaaa
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4964 // h horizontal flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4965 // v vertical flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4966 // a alpha bits
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4967 };
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4968 #pragma pack(pop)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4969
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4970 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4971 *out_width = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4972 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4973 *out_height = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4974
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4975 DWORD w;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4976 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
4977 if (file == INVALID_HANDLE_VALUE)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4978 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4979
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4980 TGAHeader header;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4981 ReadFile(file, &header, sizeof(header), &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4982 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4983
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4984 if (header.tgaBPP != 24 || header.tgaType != 2)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4985 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4986 CloseHandle(file);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4987 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4988 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4989
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4990 int imgSize = header.tgaWidth * header.tgaHeight * 3;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4991 auto pixels = new unsigned char[imgSize];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4992 ReadFile(file, pixels, imgSize, &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4993 CloseHandle(file);
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 if (w != imgSize)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4996 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4997 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4998 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4999 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5000
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5001 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5002 *out_width = header.tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5003 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5004 *out_height = header.tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5005
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5006 auto pixels_16bit = new unsigned short[imgSize / 3];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5007 for (int i = 0; i < imgSize / 3; ++i)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5008 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5009 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5010 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5011 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11);
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 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5014 return pixels_16bit;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5015 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5016
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5017 unsigned short *skybox_xn, *skybox_xp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5018 *skybox_yn, *skybox_yp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5019 *skybox_zn, *skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5020 int skybox_width, skybox_height;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5021
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5022 IDirect3DTexture2 *skybox_texture;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5023 IDirectDrawSurface4 *skybox_surface;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5024
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5025 bool Skybox_Initialize(const wchar_t *skybox_name)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5026 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5027 wchar_t xn_filename[1024], xp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5028 yn_filename[1024], yp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5029 zn_filename[1024], zp_filename[1024];
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
5030 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
5031 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
5032 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
5033
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5034 int xn_width, xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5035 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5036 if (!skybox_xn)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5037 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5038
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5039 int xp_width, xp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5040 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5041 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
5042 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5043 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5044 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5045 return false;
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 int yn_width, yn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5049 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5050 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
5051 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5052 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5053 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5054 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5055 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5056 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5057
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5058 int yp_width, yp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5059 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5060 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
5061 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5062 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5063 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5064 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5065 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5066 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5067 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5068
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5069 int zn_width, zn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5070 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5071 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
5072 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5073 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5074 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5075 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5076 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5077 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5078 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5079 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5080
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5081 int zp_width, zp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5082 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5083 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
5084 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5085 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5086 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5087 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5088 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5089 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5090 if (skybox_zp) delete [] skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5091 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5092 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5093
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5094 skybox_width = xn_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5095 skybox_height = xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5096
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5097
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5098 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
5099 false, false, pRenderer->uMinDeviceTextureDim))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5100 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5101
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5102 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5103 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5104
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5105 struct vector
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 float x, y, z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5108 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5109
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5110 struct matrix
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5111 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5112 float m[4][4];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5113 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5114
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5115 void VectorNormalize(vector *v)
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 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
5118 v->x *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5119 v->y *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5120 v->z *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5121 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5122
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5123 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5124 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5125 memset(pout, 0, sizeof(matrix));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5126 pout->m[3][0] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5127 pout->m[3][1] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5128 pout->m[3][2] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5129 pout->m[3][3] = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5130
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5131 vector v;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5132 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
5133 VectorNormalize(&v);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5134
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5135 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
5136 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
5137 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
5138 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
5139 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
5140 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
5141 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
5142 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
5143 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
5144 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
5145
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5146 void VectorTransform(const matrix *m, const vector *v, vector *out)
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 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
5149 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
5150 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
5151 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5152
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5153 bool DrawSkyD3D_Skybox()
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5154 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5155 static bool initialized = false,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5156 initialization_failed = false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5157 if (initialization_failed)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5158 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5159
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5160 static int last_camera_rot_y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5161 last_camera_rot_x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5162 if (!initialized)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5163 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5164 if (!Skybox_Initialize(L"data/skybox/stars"))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5165 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5166 initialization_failed = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5167 return false;
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 initialized = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5170
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5171 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
5172 last_camera_rot_x = pParty->sRotationX + 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5173 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5174
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 r(y) =
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5177 cos y 0 sin y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5178 0 1 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5179 -sin y 0 cos y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5180 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5181
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5182 x cos y - z sin y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5183 y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5184 x sin y + z cos y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5185 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5186
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5187
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 r(x) = // should be r(right) actually
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5190 1 0 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5191 0 cos x -sin x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5192 0 sin x cos x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5193 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5194
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5195
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5196 x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5197 y cos x + z sin x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5198 -y sin x + z cos x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5199 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5200
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5201 */
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 if (last_camera_rot_y == pParty->sRotationY &&
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5204 last_camera_rot_x == pParty->sRotationX)
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 draw:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5207 struct RenderVertexD3D3 v[6];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5208
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5209 v[0].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5210 v[0].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5211 v[0].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5212 v[0].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5213 v[0].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5214 v[0].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5215 v[0].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5216 v[0].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5217
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5218 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5219 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
5220 v[1].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5221 v[1].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5222 v[1].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5223 v[1].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5224 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5225 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5226
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5227 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5228 v[2].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5229 v[2].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5230 v[2].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5231 v[2].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5232 v[2].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5233 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5234 v[2].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5235
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5236 memcpy(&v[3], &v[0], sizeof(*v));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5237
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5238 v[4].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
5239 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
5240 v[4].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5241 v[4].rhw = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5242 v[4].diffuse = 0xFFFFFFFF;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5243 v[4].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5244 v[4].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5245 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5246
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5247 memcpy(&v[5], &v[1], sizeof(*v));
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 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5250 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5251 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
5252 //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
5253
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5254 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5255 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5256
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5257
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5258 DDSURFACEDESC2 desc;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5259 desc.dwSize = sizeof(desc);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5260 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
5261 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5262
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5263 last_camera_rot_y = pParty->sRotationY;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5264 last_camera_rot_x = pParty->sRotationX;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5265
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5266 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5267 float fov_x = 3.141592f * (pOutdoorCamera->uCameraFovInDegrees + 0) / 360.0f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5268 float fov_y = fov_x / aspect;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5269
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5270 float ray_dx = fov_x / (float)pViewport->uScreenWidth,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5271 ray_dy = fov_y / (float)pViewport->uScreenHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5272 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
5273 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5274 for (int y = 0; y < pViewport->uScreenHeight; ++y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5275 for (int x = 0; x < pViewport->uScreenWidth; ++x)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5276 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5277 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
5278 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
5279
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5280 float _dir_x_ = 1,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5281 _dir_y_ = 0,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5282 _dir_z_ = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5283
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5284 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
5285 //float dir_y_ = _dir_y_;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5286 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
5287
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5288 //float dir_x = dir_x_; // rotation around x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5289 //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
5290 //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
5291
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5292 vector right; // rotate around right actually to avoid space distortion
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5293 right.x = /*dir_y * 0*/ - dir_z_ * 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5294 right.y = /*dir_z_ * 0 - dir_x_ * */0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5295 right.z = dir_x_ * 1/* - dir_y_ * 0*/;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5296 //VectorNormalize(&right);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5297
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5298 matrix rightMatrix;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5299 MatrixRotationAxis(&rightMatrix, &right, angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5300
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5301 vector v1, v2;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5302 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
5303 VectorTransform(&rightMatrix, &v1, &v2);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5304
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5305 float dir_x = v2.x,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5306 dir_y = v2.y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5307 dir_z = v2.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5308
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5309 float abs_dir_x = fabsf(dir_x),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5310 abs_dir_y = fabsf(dir_y),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5311 abs_dir_z = fabsf(dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5312
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5313 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
5314 if (abs_dir_x >= abs_dir_y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5315 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5316 if (abs_dir_x >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5317 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5318 if (dir_x >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5319 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5320 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
5321 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5322
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5323 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5324 v = 1.0f - (instersect_y + 0.5f);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5325
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5326 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5327 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5328
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5329 color = skybox_xp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5330 //color = ty * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5331 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5332 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5333 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5334 float instersect_y = dir_y / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5335 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5336
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5337 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5338 v = instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5339
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5340 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5341 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5342
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5343 color = skybox_xn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5344 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5345 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5346 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5347 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5348 goto DIR_ZP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5349 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5350 goto DIR_ZN;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5351 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5352 else if (abs_dir_y >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5353 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5354 if (dir_y >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5355 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5356 float instersect_x = dir_x / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5357 float instersect_z = dir_z / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5358
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5359 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5360 v = instersect_z + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5361
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5362 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5363 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5364
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5365 color = skybox_yp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5366 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5367 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5368 /*else should never be seen i guess
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5369 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5370 __debugbreak();
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5371 // -y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5372 //Log::Warning(L"(%03u, %03u): -y", x, y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5373 }*/
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5374 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5375 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5376 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5377 DIR_ZP:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5378 // +z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5379 float instersect_x = dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5380 float instersect_y = dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5381 //float intersect_z = 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5382
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5383 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5384 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5385
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5386 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5387 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5388
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5389 color = skybox_zp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5390 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5391 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5392 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5393 DIR_ZN:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5394 // -z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5395 float instersect_x = -dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5396 float instersect_y = -dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5397 //float intersect_z = -0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5398
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5399 float u = 1.0f - instersect_x - 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5400 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5401
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5402 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5403 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5404
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5405 color = skybox_zn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5406 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5407
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5408 //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
5409 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5410 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5411
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5412 ErrD3D((skybox_surface)->Unlock(0));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5413 goto draw;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5414 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5415
0
Ritor1
parents:
diff changeset
5416 //----- (00479543) --------------------------------------------------------
Ritor1
parents:
diff changeset
5417 void Render::DrawSkyD3D()
Ritor1
parents:
diff changeset
5418 {
Ritor1
parents:
diff changeset
5419 int v0; // esi@2
Ritor1
parents:
diff changeset
5420 int v1; // eax@2
Ritor1
parents:
diff changeset
5421 int v8; // eax@4
Ritor1
parents:
diff changeset
5422 int v9; // eax@4
Ritor1
parents:
diff changeset
5423 int v10; // ebx@4
Ritor1
parents:
diff changeset
5424 signed __int64 v11; // qax@6
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5425 //double v12; // st7@6
0
Ritor1
parents:
diff changeset
5426 int v13; // edi@6
Ritor1
parents:
diff changeset
5427 int v14; // ecx@6
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5428 //int v15; // eax@8
0
Ritor1
parents:
diff changeset
5429 int v16; // eax@12
Ritor1
parents:
diff changeset
5430 signed __int64 v17; // qtt@13
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5431 signed int pShading; // ecx@13
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
5432 struct Polygon pSky; // [sp+14h] [bp-150h]@1
0
Ritor1
parents:
diff changeset
5433 float v28; // [sp+12Ch] [bp-38h]@2
Ritor1
parents:
diff changeset
5434 int v29; // [sp+130h] [bp-34h]@4
Ritor1
parents:
diff changeset
5435 int v30; // [sp+134h] [bp-30h]@1
Ritor1
parents:
diff changeset
5436 int v32; // [sp+13Ch] [bp-28h]@6
Ritor1
parents:
diff changeset
5437 int v33; // [sp+140h] [bp-24h]@2
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5438 int v34; // [sp+144h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
5439 int v35; // [sp+148h] [bp-1Ch]@4
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5440 int v36; // [sp+14Ch] [bp-18h]@2
0
Ritor1
parents:
diff changeset
5441 int v37; // [sp+154h] [bp-10h]@8
Ritor1
parents:
diff changeset
5442 int v38; // [sp+158h] [bp-Ch]@1
Ritor1
parents:
diff changeset
5443 int v39; // [sp+15Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
5444 int v40; // [sp+160h] [bp-4h]@7
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5445
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5446 extern bool new_sky;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5447 if (new_sky)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5448 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5449 if (DrawSkyD3D_Skybox())
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5450 return;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5451 }
0
Ritor1
parents:
diff changeset
5452
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5453 v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z)
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5454 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5455 v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad /
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5456 (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5457 (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5458
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5459 pSky._48607B(&stru_8019C8);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5460 pSky.ptr_38->sky_48694B();
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5461 pSky.uTileBitmapID = pOutdoor->uSky_TextureID;//
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5462 pSky.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
5463 if (pOutdoor->uSky_TextureID == -1)
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5464 return;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
5465
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5466 pSky.dimming_level = 0;//
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5467 pSky.uNumVertices = 4;//
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5468
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5469 //centering()---------------------------------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5470 pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5471 pSky.v_18.y = 0;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5472 pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5473 //---------------------------------------------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5474
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5475 pSky.field_24 = 0x2000000;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5476
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5477 pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5478 pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5479
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5480 //sky position( )----------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5481 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5482 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5483
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5484 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5485 array_50AC10[1].vWorldViewProjY = v38;
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5486
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5487 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5488 array_50AC10[2].vWorldViewProjY = v38;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5489
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
5490 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5491 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5492 //--------------------------------------------------------------------------
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5493
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5494 //pParty->sRotationY / 2048.0f
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5495 // move sky( )--------------include-----------------------------
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5496 float t = (GetTickCount() % 96000) / 96000.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5497 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5498 array_50AC10[0].v = t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5499
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5500 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5501 array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5502
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5503 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5504 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5505
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5506 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f;
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5507 array_50AC10[3].v = t - pParty->sRotationX / 512.0f;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5508 //--------------------------------------------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5509
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5510 //rotate skydome( )--------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5511 v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;// 230
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5512 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);//214
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5513
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5514 for (uint i = 0; i < pSky.uNumVertices; ++i)
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5515 {
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5516 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5517 v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5518 v8 = v39 + pSky.ptr_38->field_C;//0
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5519
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5520 v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5521 v36 = v39 + pSky.ptr_38->field_18;//65536
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5522
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5523 v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;//27917
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5524 v10 = pSky.v_18.x + v9;//24701
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5525 v39 = pSky.v_18.x + v9;//24701
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5526 if ( pSky.v_18.x + v9 > 0 )
577
Ritor1
parents: 526
diff changeset
5527 {
Ritor1
parents: 526
diff changeset
5528 v10 = 0;
Ritor1
parents: 526
diff changeset
5529 v39 = 0;
Ritor1
parents: 526
diff changeset
5530 }
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5531 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
577
Ritor1
parents: 526
diff changeset
5532 v38 = v10;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5533 //v12 = array_50AC10[i].vWorldViewProjY - 1.0;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5534 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5535 v34 = -pSky.field_24;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5536 v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0;
577
Ritor1
parents: 526
diff changeset
5537 v14 = v33 * (v30 - v32);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5538
577
Ritor1
parents: 526
diff changeset
5539 while ( 1 )
Ritor1
parents: 526
diff changeset
5540 {
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5541 v40 = v14;
577
Ritor1
parents: 526
diff changeset
5542 if ( !v10 )
Ritor1
parents: 526
diff changeset
5543 {
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5544 v37 = pSky.v_18.z;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5545 v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16;
0
Ritor1
parents:
diff changeset
5546 --v32;
Ritor1
parents:
diff changeset
5547 v14 += v33;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5548 v10 = pSky.v_18.x + v16;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5549 v39 = pSky.v_18.x + v16;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5550 v38 = pSky.v_18.x + v16;
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5551 break;
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
5552 }
577
Ritor1
parents: 526
diff changeset
5553 v37 = abs(v34 >> 14);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5554 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y )
577
Ritor1
parents: 526
diff changeset
5555 {
Ritor1
parents: 526
diff changeset
5556 if ( v39 <= 0 )
Ritor1
parents: 526
diff changeset
5557 break;
Ritor1
parents: 526
diff changeset
5558 }
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5559 v14 = v40;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5560 v37 = pSky.v_18.z;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5561 v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16;
577
Ritor1
parents: 526
diff changeset
5562 --v32;
Ritor1
parents: 526
diff changeset
5563 v14 += v33;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5564 v10 = pSky.v_18.x + v16;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5565 v39 = pSky.v_18.x + v16;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5566 v38 = pSky.v_18.x + v16;
577
Ritor1
parents: 526
diff changeset
5567 break;
Ritor1
parents: 526
diff changeset
5568 }
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5569
577
Ritor1
parents: 526
diff changeset
5570 LODWORD(v17) = v34 << 16;
Ritor1
parents: 526
diff changeset
5571 HIDWORD(v17) = v34 >> 16;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5572 pShading = v17 / v38;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5573 if ( pShading < 0 )
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5574 pShading = pOutdoorCamera->shading_dist_mist;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5575
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5576 v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5577 v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5578 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5579 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, pShading) / 8;
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5580
579
Ritor1
parents: 578
diff changeset
5581 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5582 //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0);
840
6dd2b94efce7 DrawFan
Ritor1
parents: 838
diff changeset
5583 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5584 //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0);
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5585 //array_50AC10[i]._rhw = 1.0f / (v18 >> 16);
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5586 //array_50AC10[i].u = (double)v35 / (65536.0 * pSky.pTexture->uTextureWidth);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5587 //array_50AC10[i].v = (double)v36 / (65536.0 * pSky.pTexture->uTextureHeight);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5588 //-----------------------------------------------------------------------------------------
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5589
895
a5456f17ab36 Sky looks slightly better.
Nomad
parents: 889
diff changeset
5590 array_50AC10[i]._rhw = 1.0f;
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5591 }
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5592 //if ( i == _this.uNumVertices - 1 )
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5593 //{
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5594 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5595
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5596 array_50AC10[0].vWorldViewProjY = v38;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5597 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5598 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5599 array_50AC10[3].vWorldViewProjY = v38;
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5600
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5601 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
5602 //}
0
Ritor1
parents:
diff changeset
5603 }
Ritor1
parents:
diff changeset
5604
Ritor1
parents:
diff changeset
5605 //----- (0047A384) --------------------------------------------------------
Ritor1
parents:
diff changeset
5606 void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa)
Ritor1
parents:
diff changeset
5607 {
Ritor1
parents:
diff changeset
5608 int v2; // ebx@3
Ritor1
parents:
diff changeset
5609 unsigned int v3; // eax@3
Ritor1
parents:
diff changeset
5610 MapInfo *v4; // edi@4
Ritor1
parents:
diff changeset
5611 //int v5; // eax@8
Ritor1
parents:
diff changeset
5612 //SpawnPointMM7 *v6; // edx@14
Ritor1
parents:
diff changeset
5613 size_t v7; // eax@19
Ritor1
parents:
diff changeset
5614 char *v8; // eax@19
Ritor1
parents:
diff changeset
5615 char *v9; // eax@21
Ritor1
parents:
diff changeset
5616 char Source[120]; // [sp+Ch] [bp-84h]@19
Ritor1
parents:
diff changeset
5617 const char *pFilename; // [sp+84h] [bp-Ch]@1
Ritor1
parents:
diff changeset
5618 //unsigned int v12; // [sp+88h] [bp-8h]@12
Ritor1
parents:
diff changeset
5619 //int v13; // [sp+8Ch] [bp-4h]@11
Ritor1
parents:
diff changeset
5620
Ritor1
parents:
diff changeset
5621 pFilename = pLevelFilename;
Ritor1
parents:
diff changeset
5622 thisa->AllocSoftwareDrawBuffers();
Ritor1
parents:
diff changeset
5623 pOutdoorCamera->_485F64();
Ritor1
parents:
diff changeset
5624 pWeather->bRenderSnow = 0;
Ritor1
parents:
diff changeset
5625 pRenderer->ClearZBuffer(0, 479);
Ritor1
parents:
diff changeset
5626 thisa = (OutdoorCamera *)1;
Ritor1
parents:
diff changeset
5627 GetAlertStatus();
Ritor1
parents:
diff changeset
5628 if ( qword_A750D8 )
Ritor1
parents:
diff changeset
5629 qword_A750D8 = 0i64;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5630 v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
0
Ritor1
parents:
diff changeset
5631 v3 = 0;
Ritor1
parents:
diff changeset
5632 if ( v2 )
Ritor1
parents:
diff changeset
5633 {
Ritor1
parents:
diff changeset
5634 v4 = &pMapStats->pInfos[v2];
Ritor1
parents:
diff changeset
5635 v3 = v4->uRespawnIntervalDays;
Ritor1
parents:
diff changeset
5636 }
Ritor1
parents:
diff changeset
5637 else
Ritor1
parents:
diff changeset
5638 {
Ritor1
parents:
diff changeset
5639 v4 = (MapInfo *)thisa;
Ritor1
parents:
diff changeset
5640 }
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5641 day_attrib &= ~DAY_ATTRIB_FOG;
0
Ritor1
parents:
diff changeset
5642 dword_6BE13C_uCurrentlyLoadedLocationID = v2;
Ritor1
parents:
diff changeset
5643 pOutdoor->Initialize(
Ritor1
parents:
diff changeset
5644 pFilename,
Ritor1
parents:
diff changeset
5645 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1,
Ritor1
parents:
diff changeset
5646 v3,
Ritor1
parents:
diff changeset
5647 (int)&thisa);
Ritor1
parents:
diff changeset
5648 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) )
Ritor1
parents:
diff changeset
5649 {
Ritor1
parents:
diff changeset
5650 InitializeActors();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
5651 InitializeSpriteObjects();
0
Ritor1
parents:
diff changeset
5652 }
Ritor1
parents:
diff changeset
5653 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu;
Ritor1
parents:
diff changeset
5654 //v5 = 0;
Ritor1
parents:
diff changeset
5655 if ( !v2 )
Ritor1
parents:
diff changeset
5656 thisa = 0;
Ritor1
parents:
diff changeset
5657 if ( thisa == (OutdoorCamera *)1 )
Ritor1
parents:
diff changeset
5658 {
Ritor1
parents:
diff changeset
5659 //v13 = 0;
Ritor1
parents:
diff changeset
5660 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i)
Ritor1
parents:
diff changeset
5661 {
Ritor1
parents:
diff changeset
5662 //v12 = 0;
Ritor1
parents:
diff changeset
5663 //while ( 1 )
Ritor1
parents:
diff changeset
5664 //{
Ritor1
parents:
diff changeset
5665 auto spawn = pOutdoor->pSpawnPoints + i;
Ritor1
parents:
diff changeset
5666 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18];
Ritor1
parents:
diff changeset
5667 if (spawn->uKind == 3 )
Ritor1
parents:
diff changeset
5668 SpawnEncounter(v4, spawn, 0, 0, 0);
Ritor1
parents:
diff changeset
5669 else
Ritor1
parents:
diff changeset
5670 v4->SpawnRandomTreasure(spawn);
Ritor1
parents:
diff changeset
5671 //++v13;
Ritor1
parents:
diff changeset
5672 //v12 += 24;
Ritor1
parents:
diff changeset
5673 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints )
Ritor1
parents:
diff changeset
5674 // break;
Ritor1
parents:
diff changeset
5675 //v5 = 0;
Ritor1
parents:
diff changeset
5676 //}
Ritor1
parents:
diff changeset
5677 }
Ritor1
parents:
diff changeset
5678 RespawnGlobalDecorations();
Ritor1
parents:
diff changeset
5679 }
Ritor1
parents:
diff changeset
5680 pOutdoor->PrepareDecorations();
Ritor1
parents:
diff changeset
5681 pOutdoor->_47F223_LooksLikeGenerateMonsterLoot();
Ritor1
parents:
diff changeset
5682 pOutdoor->InitalizeActors(v2);
Ritor1
parents:
diff changeset
5683 pOutdoor->MessWithLUN();
Ritor1
parents:
diff changeset
5684 v7 = strlen("levels\\");
Ritor1
parents:
diff changeset
5685 strcpy(Source, &pFilename[v7]);
Ritor1
parents:
diff changeset
5686 strcpy(pOutdoor->pLevelFilename, Source);
Ritor1
parents:
diff changeset
5687 pWeather->Initialize();
Ritor1
parents:
diff changeset
5688 pIndoorCamera->sRotationY = pParty->sRotationY;
Ritor1
parents:
diff changeset
5689 pIndoorCamera->sRotationX = pParty->sRotationX;
Ritor1
parents:
diff changeset
5690 pOutdoorCamera->RotationToInts();
Ritor1
parents:
diff changeset
5691 pOutdoor->UpdateSunlightVectors();
Ritor1
parents:
diff changeset
5692 pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov;
Ritor1
parents:
diff changeset
5693 pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C;
Ritor1
parents:
diff changeset
5694 v8 = (char *)&array_77EC08[0].ptr_38;
Ritor1
parents:
diff changeset
5695 do
Ritor1
parents:
diff changeset
5696 {
Ritor1
parents:
diff changeset
5697 *(int *)v8 = (int)&stru_8019C8;
Ritor1
parents:
diff changeset
5698 v8 += 268;
Ritor1
parents:
diff changeset
5699 }
Ritor1
parents:
diff changeset
5700 while ( (signed int)v8 < (signed int)&unk_801A00 );
Ritor1
parents:
diff changeset
5701 v9 = (char *)&array_77EC08[0].prolly_tail;
Ritor1
parents:
diff changeset
5702 do
Ritor1
parents:
diff changeset
5703 {
Ritor1
parents:
diff changeset
5704 *((int *)v9 - 1) = 0;
Ritor1
parents:
diff changeset
5705 *(int *)v9 = 0;
Ritor1
parents:
diff changeset
5706 *((int *)v9 - 5) = 0;
Ritor1
parents:
diff changeset
5707 v9 += 268;
Ritor1
parents:
diff changeset
5708 }
Ritor1
parents:
diff changeset
5709 while ( (signed int)v9 < (signed int)&unk_801A0C );
Ritor1
parents:
diff changeset
5710 MM7Initialization();
Ritor1
parents:
diff changeset
5711 }
Ritor1
parents:
diff changeset
5712
Ritor1
parents:
diff changeset
5713 //----- (0047A825) --------------------------------------------------------
Ritor1
parents:
diff changeset
5714 bool LevelDecoration::_47A825()
Ritor1
parents:
diff changeset
5715 {
Ritor1
parents:
diff changeset
5716 bool v1; // ebx@1
Ritor1
parents:
diff changeset
5717 LevelDecoration *v2; // edi@1
Ritor1
parents:
diff changeset
5718
Ritor1
parents:
diff changeset
5719 v1 = 0;
Ritor1
parents:
diff changeset
5720 v2 = this;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5721 if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 178) )
0
Ritor1
parents:
diff changeset
5722 {
Ritor1
parents:
diff changeset
5723 v1 = 0;
Ritor1
parents:
diff changeset
5724 }
Ritor1
parents:
diff changeset
5725 else
Ritor1
parents:
diff changeset
5726 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5727 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 164)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5728 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 165)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5729 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 166)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5730 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 167)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5731 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 168)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5732 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 169)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5733 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 170)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5734 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 171)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5735 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 172)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5736 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 173)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5737 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 174)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5738 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 175)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5739 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 176)
4bd56919f075 avard quest guild bits
Gloval
parents: 469
diff changeset
5740 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 177) )
0
Ritor1
parents:
diff changeset
5741 {
Ritor1
parents:
diff changeset
5742 v1 = 1;
Ritor1
parents:
diff changeset
5743 LOBYTE(v2->field_2) &= 0xDFu;
Ritor1
parents:
diff changeset
5744 return v1;
Ritor1
parents:
diff changeset
5745 }
Ritor1
parents:
diff changeset
5746 }
Ritor1
parents:
diff changeset
5747 LOBYTE(v2->field_2) |= 0x20u;
Ritor1
parents:
diff changeset
5748 return v1;
Ritor1
parents:
diff changeset
5749 }
Ritor1
parents:
diff changeset
5750
Ritor1
parents:
diff changeset
5751 //----- (0047BC6F) --------------------------------------------------------
Ritor1
parents:
diff changeset
5752 unsigned __int16 *__fastcall GetBillboardPalette(RenderBillboard *a1, int a2, signed int a3, int a4)
Ritor1
parents:
diff changeset
5753 {
Ritor1
parents:
diff changeset
5754 int v4; // ebx@1
Ritor1
parents:
diff changeset
5755 int v6; // edx@4
Ritor1
parents:
diff changeset
5756 int v7; // ecx@5
Ritor1
parents:
diff changeset
5757 signed int v8; // eax@6
Ritor1
parents:
diff changeset
5758 signed __int64 v9; // qtt@11
Ritor1
parents:
diff changeset
5759 signed int v10; // eax@12
Ritor1
parents:
diff changeset
5760 int v11; // esi@17
Ritor1
parents:
diff changeset
5761 signed __int64 v12; // qtt@19
Ritor1
parents:
diff changeset
5762 double v13; // ST10_8@19
Ritor1
parents:
diff changeset
5763 int v14; // edi@25
Ritor1
parents:
diff changeset
5764 signed int v15; // edx@26
Ritor1
parents:
diff changeset
5765 signed __int64 v16; // qtt@29
Ritor1
parents:
diff changeset
5766 signed int v17; // eax@30
Ritor1
parents:
diff changeset
5767 int v18; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
5768 float a3a; // [sp+20h] [bp+8h]@19
Ritor1
parents:
diff changeset
5769
Ritor1
parents:
diff changeset
5770 v4 = a2;
Ritor1
parents:
diff changeset
5771 v18 = a2;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5772 if ( pParty->armageddon_timer )
0
Ritor1
parents:
diff changeset
5773 return PaletteManager::Get(a2);
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5774 if ( !pWeather->bNight )
0
Ritor1
parents:
diff changeset
5775 {
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5776 if (day_attrib & DAY_ATTRIB_FOG)
0
Ritor1
parents:
diff changeset
5777 {
Ritor1
parents:
diff changeset
5778 v14 = day_fogrange_1 << 16;
Ritor1
parents:
diff changeset
5779 if ( a3 >= day_fogrange_1 << 16 )
Ritor1
parents:
diff changeset
5780 {
Ritor1
parents:
diff changeset
5781 if ( a3 <= day_fogrange_2 << 16 )
Ritor1
parents:
diff changeset
5782 {
Ritor1
parents:
diff changeset
5783 LODWORD(v16) = (a3 - v14) << 16;
Ritor1
parents:
diff changeset
5784 HIDWORD(v16) = (a3 - v14) >> 16;
Ritor1
parents:
diff changeset
5785 v15 = (unsigned __int64)(27 * v16 / ((day_fogrange_2 - day_fogrange_1) << 16)) >> 16;
Ritor1
parents:
diff changeset
5786 }
Ritor1
parents:
diff changeset
5787 else
Ritor1
parents:
diff changeset
5788 {
Ritor1
parents:
diff changeset
5789 v15 = 27;
Ritor1
parents:
diff changeset
5790 }
Ritor1
parents:
diff changeset
5791 }
Ritor1
parents:
diff changeset
5792 else
Ritor1
parents:
diff changeset
5793 {
Ritor1
parents:
diff changeset
5794 v15 = 0;
Ritor1
parents:
diff changeset
5795 }
Ritor1
parents:
diff changeset
5796 v17 = _43F55F_get_billboard_light_level(a1, v15);
Ritor1
parents:
diff changeset
5797 if ( v17 > 27 )
Ritor1
parents:
diff changeset
5798 v17 = 27;
Ritor1
parents:
diff changeset
5799 if ( !a3 )
Ritor1
parents:
diff changeset
5800 v17 = 27;
Ritor1
parents:
diff changeset
5801 v7 = v18;
Ritor1
parents:
diff changeset
5802 v6 = v17;
Ritor1
parents:
diff changeset
5803 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1);
Ritor1
parents:
diff changeset
5804 }
Ritor1
parents:
diff changeset
5805 v11 = a4;
Ritor1
parents:
diff changeset
5806 if ( a4 < 0 )
Ritor1
parents:
diff changeset
5807 v11 = 0;
Ritor1
parents:
diff changeset
5808 LODWORD(v12) = a3 << 16;
Ritor1
parents:
diff changeset
5809 HIDWORD(v12) = a3 >> 16;
Ritor1
parents:
diff changeset
5810 a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20)
Ritor1
parents:
diff changeset
5811 * pOutdoor->fFogDensity;
Ritor1
parents:
diff changeset
5812 v13 = a3a + 6.7553994e15;
Ritor1
parents:
diff changeset
5813 v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11);
Ritor1
parents:
diff changeset
5814 if ( v10 > 27 )
Ritor1
parents:
diff changeset
5815 v10 = 27;
Ritor1
parents:
diff changeset
5816 if ( v10 < a4 )
Ritor1
parents:
diff changeset
5817 v10 = a4;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5818 if ( v10 > pOutdoor->max_terrain_dimming_level )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5819 v10 = pOutdoor->max_terrain_dimming_level;
0
Ritor1
parents:
diff changeset
5820 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1);
Ritor1
parents:
diff changeset
5821 }
Ritor1
parents:
diff changeset
5822 v6 = 0;
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5823 if (pWeather->bNight)
0
Ritor1
parents:
diff changeset
5824 {
Ritor1
parents:
diff changeset
5825 v8 = 67108864;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
5826 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
5827 v8 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower << 26;
0
Ritor1
parents:
diff changeset
5828 if ( a3 <= v8 )
Ritor1
parents:
diff changeset
5829 {
Ritor1
parents:
diff changeset
5830 if ( a3 > 0 )
Ritor1
parents:
diff changeset
5831 {
Ritor1
parents:
diff changeset
5832 LODWORD(v9) = a3 << 16;
Ritor1
parents:
diff changeset
5833 HIDWORD(v9) = a3 >> 16;
Ritor1
parents:
diff changeset
5834 v6 = (unsigned __int64)(27 * v9 / v8) >> 16;
Ritor1
parents:
diff changeset
5835 }
Ritor1
parents:
diff changeset
5836 }
Ritor1
parents:
diff changeset
5837 else
Ritor1
parents:
diff changeset
5838 {
Ritor1
parents:
diff changeset
5839 v6 = 27;
Ritor1
parents:
diff changeset
5840 }
Ritor1
parents:
diff changeset
5841 v10 = _43F55F_get_billboard_light_level(a1, v6);
Ritor1
parents:
diff changeset
5842 if ( v10 > 27 || !a3 )
Ritor1
parents:
diff changeset
5843 v10 = 27;
Ritor1
parents:
diff changeset
5844 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1);
Ritor1
parents:
diff changeset
5845 }
Ritor1
parents:
diff changeset
5846 v7 = 0;
Ritor1
parents:
diff changeset
5847 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1);
Ritor1
parents:
diff changeset
5848 }
Ritor1
parents:
diff changeset
5849
Ritor1
parents:
diff changeset
5850 //----- (0047C370) --------------------------------------------------------
Ritor1
parents:
diff changeset
5851 unsigned int __cdecl GetLevelFogColor()
Ritor1
parents:
diff changeset
5852 {
Ritor1
parents:
diff changeset
5853 unsigned int result; // eax@2
Ritor1
parents:
diff changeset
5854 signed __int64 v1; // qax@5
Ritor1
parents:
diff changeset
5855 int v2; // eax@6
Ritor1
parents:
diff changeset
5856
Ritor1
parents:
diff changeset
5857 if ( bUnderwater )
Ritor1
parents:
diff changeset
5858 {
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5859 result = 0xFF258F5C;
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5860 }
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5861 else
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5862 {
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5863 if (day_attrib & DAY_ATTRIB_FOG)
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5864 {
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5865 if ( pWeather->bNight ) // night-time fog
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5866 {
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5867 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5868 v2 = -(pWeather->bNight != 1);
0
Ritor1
parents:
diff changeset
5869 result = (v2 & 0xE0E0E1) - 0xE0E0E1;
Ritor1
parents:
diff changeset
5870 }
Ritor1
parents:
diff changeset
5871 else
Ritor1
parents:
diff changeset
5872 {
Ritor1
parents:
diff changeset
5873 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0);
Ritor1
parents:
diff changeset
5874 result = v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8);
Ritor1
parents:
diff changeset
5875 }
Ritor1
parents:
diff changeset
5876 }
Ritor1
parents:
diff changeset
5877 else
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5878 return 0;
0
Ritor1
parents:
diff changeset
5879 }
Ritor1
parents:
diff changeset
5880 return result;
Ritor1
parents:
diff changeset
5881 }
Ritor1
parents:
diff changeset
5882 // 6BE030: using guessed type int day_attrib;
Ritor1
parents:
diff changeset
5883 // 6BE3C4: using guessed type char bUnderwater;
Ritor1
parents:
diff changeset
5884
Ritor1
parents:
diff changeset
5885 //----- (0047C3D7) --------------------------------------------------------
Ritor1
parents:
diff changeset
5886 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3)
Ritor1
parents:
diff changeset
5887 {
Ritor1
parents:
diff changeset
5888 int v3; // ecx@1
Ritor1
parents:
diff changeset
5889 double v5; // st7@10
Ritor1
parents:
diff changeset
5890 signed int v6; // esi@10
Ritor1
parents:
diff changeset
5891 signed int v7; // ecx@11
Ritor1
parents:
diff changeset
5892 double v8; // st6@12
Ritor1
parents:
diff changeset
5893 double v9; // st7@15
Ritor1
parents:
diff changeset
5894 double v10; // st6@16
Ritor1
parents:
diff changeset
5895 float v11; // ST14_4@17
Ritor1
parents:
diff changeset
5896 double v12; // ST08_8@17
Ritor1
parents:
diff changeset
5897
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5898 v3 = pWeather->bNight;
0
Ritor1
parents:
diff changeset
5899 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
5900 v3 = 0;
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
5901 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5902 return 0xFF000000;
0
Ritor1
parents:
diff changeset
5903 if ( v3 )
Ritor1
parents:
diff changeset
5904 {
Ritor1
parents:
diff changeset
5905 v5 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
5906 v6 = 216;
Ritor1
parents:
diff changeset
5907 if ( a3 < v5 )
Ritor1
parents:
diff changeset
5908 goto LABEL_11;
Ritor1
parents:
diff changeset
5909 v8 = (double)day_fogrange_2;
Ritor1
parents:
diff changeset
5910 if ( a3 > v8 )
Ritor1
parents:
diff changeset
5911 {
Ritor1
parents:
diff changeset
5912 LABEL_13:
Ritor1
parents:
diff changeset
5913 v7 = v6;
Ritor1
parents:
diff changeset
5914 goto LABEL_19;
Ritor1
parents:
diff changeset
5915 }
Ritor1
parents:
diff changeset
5916 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0);
Ritor1
parents:
diff changeset
5917 }
Ritor1
parents:
diff changeset
5918 else
Ritor1
parents:
diff changeset
5919 {
Ritor1
parents:
diff changeset
5920 v9 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
5921 v6 = 216;
Ritor1
parents:
diff changeset
5922 if ( a3 < v9 )
Ritor1
parents:
diff changeset
5923 {
Ritor1
parents:
diff changeset
5924 LABEL_11:
Ritor1
parents:
diff changeset
5925 v7 = 0;
Ritor1
parents:
diff changeset
5926 goto LABEL_19;
Ritor1
parents:
diff changeset
5927 }
Ritor1
parents:
diff changeset
5928 v10 = (double)day_fogrange_2;
Ritor1
parents:
diff changeset
5929 if ( a3 > v10 )
Ritor1
parents:
diff changeset
5930 goto LABEL_13;
Ritor1
parents:
diff changeset
5931 v11 = (a3 - v9) * 216.0 / (v10 - v9);
Ritor1
parents:
diff changeset
5932 v12 = v11 + 6.7553994e15;
Ritor1
parents:
diff changeset
5933 v7 = LODWORD(v12);
Ritor1
parents:
diff changeset
5934 }
Ritor1
parents:
diff changeset
5935 if ( v7 > v6 )
Ritor1
parents:
diff changeset
5936 {
Ritor1
parents:
diff changeset
5937 LABEL_20:
Ritor1
parents:
diff changeset
5938 v7 = v6;
Ritor1
parents:
diff changeset
5939 goto LABEL_21;
Ritor1
parents:
diff changeset
5940 }
Ritor1
parents:
diff changeset
5941 LABEL_19:
Ritor1
parents:
diff changeset
5942 if ( a3 == 0.0 )
Ritor1
parents:
diff changeset
5943 goto LABEL_20;
Ritor1
parents:
diff changeset
5944 LABEL_21:
Ritor1
parents:
diff changeset
5945 if ( a2 )
Ritor1
parents:
diff changeset
5946 v7 = 248;
Ritor1
parents:
diff changeset
5947 return (-1 - v7) << 24;
Ritor1
parents:
diff changeset
5948 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5949
0
Ritor1
parents:
diff changeset
5950 //----- (0047C4FC) --------------------------------------------------------
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5951 signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5952 {
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5953 //int v5; // esi@1
0
Ritor1
parents:
diff changeset
5954 signed int v6; // edx@1
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5955 //signed int result; // eax@2
0
Ritor1
parents:
diff changeset
5956 int v8; // eax@3
Ritor1
parents:
diff changeset
5957 double v9; // st7@12
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5958 //double v10; // ST0C_8@18
0
Ritor1
parents:
diff changeset
5959 int v11; // ecx@28
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5960 //signed int v12; // edi@28
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5961 //double v13; // ST0C_8@33
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5962 //double v14; // ST0C_8@34
0
Ritor1
parents:
diff changeset
5963 double v15; // st7@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5964 //double v16; // ST0C_8@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5965 //double v17; // ST0C_8@44
0
Ritor1
parents:
diff changeset
5966 int v18; // ST14_4@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5967 //double v19; // ST0C_8@44
0
Ritor1
parents:
diff changeset
5968 signed int v20; // [sp+10h] [bp-4h]@10
Ritor1
parents:
diff changeset
5969 float a3a; // [sp+1Ch] [bp+8h]@33
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5970 //float a3b; // [sp+1Ch] [bp+8h]@34
0
Ritor1
parents:
diff changeset
5971 float a3c; // [sp+1Ch] [bp+8h]@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5972 //float a3d; // [sp+1Ch] [bp+8h]@44
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5973 //float a4b; // [sp+20h] [bp+Ch]@18
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5974 //int a4a; // [sp+20h] [bp+Ch]@33
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5975 //float a4c; // [sp+20h] [bp+Ch]@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5976 //float a4d; // [sp+20h] [bp+Ch]@44
0
Ritor1
parents:
diff changeset
5977 int a5a; // [sp+24h] [bp+10h]@44
Ritor1
parents:
diff changeset
5978
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5979 //v5 = a2;
0
Ritor1
parents:
diff changeset
5980 v6 = 0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5981
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5982 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5983 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5984
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5985 if (pParty->armageddon_timer)
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5986 return 0xFFFF0000;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5987
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
5988 v8 = pWeather->bNight;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5989 if (bUnderwater)
0
Ritor1
parents:
diff changeset
5990 v8 = 0;
Ritor1
parents:
diff changeset
5991 if ( v8 )
Ritor1
parents:
diff changeset
5992 {
Ritor1
parents:
diff changeset
5993 v20 = 1;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5994 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
5995 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
0
Ritor1
parents:
diff changeset
5996 v9 = (double)v20 * 1024.0;
Ritor1
parents:
diff changeset
5997 if ( a4 )
Ritor1
parents:
diff changeset
5998 goto LABEL_19;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
5999 if ( distance <= v9 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6000 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6001 if ( distance > 0.0 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6002 {
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
6003 //a4b = distance * 216.0 / v9;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
6004 //v10 = a4b + 6.7553994e15;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
6005 //v6 = LODWORD(v10);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
6006 v6 = floorf(0.5f + distance * 216.0 / v9);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
6007 if (v6 > 216 )
0
Ritor1
parents:
diff changeset
6008 goto LABEL_19;
Ritor1
parents:
diff changeset
6009 }
Ritor1
parents:
diff changeset
6010 }
Ritor1
parents:
diff changeset
6011 else
Ritor1
parents:
diff changeset
6012 {
Ritor1
parents:
diff changeset
6013 v6 = 216;
Ritor1
parents:
diff changeset
6014 }
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6015 if ( distance != 0.0 )
0
Ritor1
parents:
diff changeset
6016 {
Ritor1
parents:
diff changeset
6017 LABEL_20:
Ritor1
parents:
diff changeset
6018 if ( a5 )
Ritor1
parents:
diff changeset
6019 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
6020 if ( v6 > 216 )
Ritor1
parents:
diff changeset
6021 v6 = 216;
Ritor1
parents:
diff changeset
6022 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
Ritor1
parents:
diff changeset
6023 }
Ritor1
parents:
diff changeset
6024 LABEL_19:
Ritor1
parents:
diff changeset
6025 v6 = 216;
Ritor1
parents:
diff changeset
6026 goto LABEL_20;
Ritor1
parents:
diff changeset
6027 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6028
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6029
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6030
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6031 if (fabsf(distance) < 1.0e-6f)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6032 return 0xFFF8F8F8;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6033
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6034 // dim in measured in 8-steps
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6035 v11 = 8 * (max_dimm - min_dimm);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6036 //v12 = v11;
0
Ritor1
parents:
diff changeset
6037 if ( v11 >= 0 )
Ritor1
parents:
diff changeset
6038 {
Ritor1
parents:
diff changeset
6039 if ( v11 > 216 )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6040 v11 = 216;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6041 }
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6042 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6043 v11 = 0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6044
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6045 float fog_density_mult = 216.0f;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6046 if (a4)
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6047 fog_density_mult += distance / (double)pOutdoorCamera->shading_dist_shade * 32.0;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6048
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6049 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6050 /*if ( a4 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6051 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6052 //a3b = pOutdoor->fFogDensity * 216.0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6053 //v14 = a3b + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6054 //a4a = floorf(a3b + 0.5f);//LODWORD(v14);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6055 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6056 else
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6057 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6058 //a3a = (distance / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6059 //v13 = a3a + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6060 //a4a = floorf(a3a + 0.5f);//LODWORD(v13);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6061 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6062 v6 = a4a + v11;*/
0
Ritor1
parents:
diff changeset
6063 if ( a5 )
Ritor1
parents:
diff changeset
6064 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
6065 if ( v6 > 216 )
Ritor1
parents:
diff changeset
6066 v6 = 216;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6067 if ( v6 < v11 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6068 v6 = v11;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6069 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
6070 v6 = 8 * pOutdoor->max_terrain_dimming_level;
0
Ritor1
parents:
diff changeset
6071 if ( !bUnderwater )
Ritor1
parents:
diff changeset
6072 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6073 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6074 {
0
Ritor1
parents:
diff changeset
6075 v15 = (double)(255 - v6) * 0.0039215689;
Ritor1
parents:
diff changeset
6076 a3c = v15;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6077 //a4c = v15 * 16.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6078 //v16 = a4c + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6079 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6080 //a4d = a3c * 194.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6081 //v17 = a4d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6082 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6083 //a3d = a3c * 153.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6084 //v19 = a3d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6085 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
6086 }
0
Ritor1
parents:
diff changeset
6087 }
Ritor1
parents:
diff changeset
6088 // 6BE3C4: using guessed type char bUnderwater;
Ritor1
parents:
diff changeset
6089
Ritor1
parents:
diff changeset
6090 //----- (0047F44B) --------------------------------------------------------
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6091 unsigned int __stdcall WorldPosToGridCellX(signed int sWorldPosX)
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6092 {
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6093 return (sWorldPosX / 512) + 64;
0
Ritor1
parents:
diff changeset
6094 }
Ritor1
parents:
diff changeset
6095 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
Ritor1
parents:
diff changeset
6096
Ritor1
parents:
diff changeset
6097 //----- (0047F458) --------------------------------------------------------
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6098 unsigned int __stdcall WorldPosToGridCellZ(signed int sWorldPosZ)
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6099 {
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
6100 return 64 - (sWorldPosZ / 512);
0
Ritor1
parents:
diff changeset
6101 }
Ritor1
parents:
diff changeset
6102
Ritor1
parents:
diff changeset
6103 //----- (0047F469) --------------------------------------------------------
Ritor1
parents:
diff changeset
6104 int __stdcall GridCellToWorldPosX(int a1)
Ritor1
parents:
diff changeset
6105 {
Ritor1
parents:
diff changeset
6106 return (a1 - 64) << 9;
Ritor1
parents:
diff changeset
6107 }
Ritor1
parents:
diff changeset
6108
Ritor1
parents:
diff changeset
6109 //----- (0047F476) --------------------------------------------------------
Ritor1
parents:
diff changeset
6110 int __stdcall GridCellToWorldPosZ(int a1)
Ritor1
parents:
diff changeset
6111 {
Ritor1
parents:
diff changeset
6112 return (64 - a1) << 9;
Ritor1
parents:
diff changeset
6113 }
Ritor1
parents:
diff changeset
6114
Ritor1
parents:
diff changeset
6115 //----- (0047F4D3) --------------------------------------------------------
Ritor1
parents:
diff changeset
6116 void __fastcall sub_47F4D3(int band1, int band2, int band3)
Ritor1
parents:
diff changeset
6117 {
Ritor1
parents:
diff changeset
6118 int v3; // edi@1
Ritor1
parents:
diff changeset
6119 //stru220 *v4; // esi@1
Ritor1
parents:
diff changeset
6120 double v5; // ST2C_8@3
Ritor1
parents:
diff changeset
6121 double v6; // st7@3
Ritor1
parents:
diff changeset
6122 //double v7; // [sp+18h] [bp-28h]@3
Ritor1
parents:
diff changeset
6123 //double v8; // [sp+20h] [bp-20h]@2
Ritor1
parents:
diff changeset
6124 int v9; // [sp+34h] [bp-Ch]@1
Ritor1
parents:
diff changeset
6125 int v10; // [sp+38h] [bp-8h]@1
Ritor1
parents:
diff changeset
6126 //signed int band3a; // [sp+48h] [bp+8h]@2
Ritor1
parents:
diff changeset
6127
Ritor1
parents:
diff changeset
6128 v9 = band2 * 512;
Ritor1
parents:
diff changeset
6129 pOutdoorCamera->outdoor_grid_band_3 = band3;
Ritor1
parents:
diff changeset
6130 v10 = band1 * 512;
Ritor1
parents:
diff changeset
6131 v3 = band3 * 512;
Ritor1
parents:
diff changeset
6132 pOutdoorCamera->uPickDepth = band3 * 512;
Ritor1
parents:
diff changeset
6133 //v4 = stru_76E5C8; // v4: 0 -> 65536
Ritor1
parents:
diff changeset
6134 for (uint i = 0; i < 16384; ++i)
Ritor1
parents:
diff changeset
6135 //do
Ritor1
parents:
diff changeset
6136 {
226
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6137 auto v4 = stru_76E5C8[i];
0
Ritor1
parents:
diff changeset
6138 //band3a = 256;
Ritor1
parents:
diff changeset
6139 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8);
Ritor1
parents:
diff changeset
6140 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128
Ritor1
parents:
diff changeset
6141 {
Ritor1
parents:
diff changeset
6142 v5 = pow(j * 512 + 256, 2.0);
Ritor1
parents:
diff changeset
6143 v6 = pow(i * 4 + 256, 2.0);
Ritor1
parents:
diff changeset
6144 //*((float *)&v5 + 1) = sqrt(v6 + v5);
Ritor1
parents:
diff changeset
6145 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
6146 if (v7 >= v10)
Ritor1
parents:
diff changeset
6147 {
Ritor1
parents:
diff changeset
6148 if (v7 >= v9)
226
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6149 v4.field_0 = ((v7 >= v3) - 1) & 2;
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6150 else
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6151 v4.field_0 = 2;
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6152 }
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6153 else
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6154 {
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6155 v4.field_0 = 1;
0
Ritor1
parents:
diff changeset
6156 }
Ritor1
parents:
diff changeset
6157 //band3a += 512;
226
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6158 v4.distance = v7;
c2f2d2644304 DrawDialogueUI NPCData
zipi
parents: 220
diff changeset
6159 //++v4;
0
Ritor1
parents:
diff changeset
6160 }
Ritor1
parents:
diff changeset
6161 //while ( band3a < 65792 );
Ritor1
parents:
diff changeset
6162 }
Ritor1
parents:
diff changeset
6163 //while ( (signed int)v4 < (signed int)arary_77E5C8 );
Ritor1
parents:
diff changeset
6164 }
Ritor1
parents:
diff changeset
6165
Ritor1
parents:
diff changeset
6166 //----- (004811A3) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6167 void Polygon::DrawBorderTiles()
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6168 {
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6169 //__debugbreak();
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6170
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6171 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false);
0
Ritor1
parents:
diff changeset
6172 pRenderer->DrawTerrainPolygon(uNumVertices, this,
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6173 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6174
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6175 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
6176 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true);
0
Ritor1
parents:
diff changeset
6177 }
Ritor1
parents:
diff changeset
6178
Ritor1
parents:
diff changeset
6179
Ritor1
parents:
diff changeset
6180 //----- (00481EB7) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6181 void __cdecl ResetPolygons()
0
Ritor1
parents:
diff changeset
6182 {
Ritor1
parents:
diff changeset
6183 int v0; // ecx@1
Ritor1
parents:
diff changeset
6184 char *v1; // eax@2
Ritor1
parents:
diff changeset
6185
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6186 v0 = pOutdoorCamera->uNumPolygons;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6187 if ( pOutdoorCamera->uNumPolygons > 0 )
0
Ritor1
parents:
diff changeset
6188 {
Ritor1
parents:
diff changeset
6189 v1 = (char *)&array_77EC08[0].prolly_tail;
Ritor1
parents:
diff changeset
6190 do
Ritor1
parents:
diff changeset
6191 {
Ritor1
parents:
diff changeset
6192 *((int *)v1 - 1) = 0;
Ritor1
parents:
diff changeset
6193 *(int *)v1 = 0;
Ritor1
parents:
diff changeset
6194 *((int *)v1 - 5) = 0;
Ritor1
parents:
diff changeset
6195 v1 += 268;
Ritor1
parents:
diff changeset
6196 --v0;
Ritor1
parents:
diff changeset
6197 }
Ritor1
parents:
diff changeset
6198 while ( v0 );
Ritor1
parents:
diff changeset
6199 }
Ritor1
parents:
diff changeset
6200 }
Ritor1
parents:
diff changeset
6201
Ritor1
parents:
diff changeset
6202 //----- (00481ED9) --------------------------------------------------------
Ritor1
parents:
diff changeset
6203 void __cdecl sub_481ED9_MessWithOutdoorCamera()
Ritor1
parents:
diff changeset
6204 {
Ritor1
parents:
diff changeset
6205 stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0);
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6206 pOutdoorCamera->uNumPolygons = 0;
0
Ritor1
parents:
diff changeset
6207 pOutdoorCamera->uNumEdges = 0;
Ritor1
parents:
diff changeset
6208 pOutdoorCamera->uNumSpans = 0;
Ritor1
parents:
diff changeset
6209 pOutdoorCamera->uNumSurfs = 0;
Ritor1
parents:
diff changeset
6210 pOutdoorCamera->uNumBillboards = 0;
Ritor1
parents:
diff changeset
6211 pOutdoorCamera->field_44 = 0;
Ritor1
parents:
diff changeset
6212 }
Ritor1
parents:
diff changeset
6213
Ritor1
parents:
diff changeset
6214 //----- (00481EFA) --------------------------------------------------------
Ritor1
parents:
diff changeset
6215 bool __fastcall sub_481EFA(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, RenderVertexSoft *a4, int a5)
Ritor1
parents:
diff changeset
6216 {
Ritor1
parents:
diff changeset
6217 RenderVertexSoft *v5; // esi@1
Ritor1
parents:
diff changeset
6218 RenderVertexSoft *v6; // edx@1
Ritor1
parents:
diff changeset
6219 bool v7; // edi@2
Ritor1
parents:
diff changeset
6220 bool v8; // ecx@5
Ritor1
parents:
diff changeset
6221 bool v9; // esi@8
Ritor1
parents:
diff changeset
6222 bool v10; // eax@11
Ritor1
parents:
diff changeset
6223 double v11; // st7@14
Ritor1
parents:
diff changeset
6224 signed int v12; // esi@15
Ritor1
parents:
diff changeset
6225 signed int v13; // edx@18
Ritor1
parents:
diff changeset
6226 signed int v14; // ecx@21
Ritor1
parents:
diff changeset
6227 signed int v15; // eax@24
Ritor1
parents:
diff changeset
6228 RenderVertexSoft *v17; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
6229
Ritor1
parents:
diff changeset
6230 v5 = a2;
Ritor1
parents:
diff changeset
6231 v6 = a1;
Ritor1
parents:
diff changeset
6232 v17 = v5;
Ritor1
parents:
diff changeset
6233 v7 = a1->vWorldViewPosition.x < 8.0;
Ritor1
parents:
diff changeset
6234 v8 = v5->vWorldViewPosition.x < 8.0;
Ritor1
parents:
diff changeset
6235 v9 = a3->vWorldViewPosition.x < 8.0;
Ritor1
parents:
diff changeset
6236 v10 = a4->vWorldViewPosition.x < 8.0;
Ritor1
parents:
diff changeset
6237 return !(v8 & v9 & v10 & v7)
Ritor1
parents:
diff changeset
6238 && ((v11 = (double)pOutdoorCamera->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1),
Ritor1
parents:
diff changeset
6239 v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1),
Ritor1
parents:
diff changeset
6240 v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1),
Ritor1
parents:
diff changeset
6241 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1),
Ritor1
parents:
diff changeset
6242 !(v13 & v14 & v15 & v12));
Ritor1
parents:
diff changeset
6243 }
Ritor1
parents:
diff changeset
6244
Ritor1
parents:
diff changeset
6245 //----- (00481FC9) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6246 int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, struct Polygon *a4)//Rotate camera
63
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6247 {
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6248 float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6249
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6250 if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y)
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6251 a4->flags |= 0x10;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6252 var_c = a1->vWorldViewPosition.x - a2->vWorldViewPosition.x;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6253 var_14 = a1->vWorldViewPosition.y - a2->vWorldViewPosition.y;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6254 arg_0 = a1->vWorldViewPosition.z - a2->vWorldViewPosition.z;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6255 var_10 = a3->vWorldViewPosition.x - a2->vWorldViewPosition.x;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6256 var_8 = a3->vWorldViewPosition.y - a2->vWorldViewPosition.y;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6257 var_4 = a3->vWorldViewPosition.z - a2->vWorldViewPosition.z;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6258 arg_4 = a3->vWorldPosition.y - a2->vWorldPosition.y;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6259 if (((a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.x - a2->vWorldPosition.x) - (a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.y - a2->vWorldPosition.y)) * (pIndoorCamera->pos.y - a2->vWorldPosition.z) +
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6260 ((a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.y - a2->vWorldPosition.y) - (a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.z - a2->vWorldPosition.z)) * (pIndoorCamera->pos.x - a2->vWorldPosition.x) +
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6261 ((a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.z - a2->vWorldPosition.z) - (a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.x - a2->vWorldPosition.x)) * (pIndoorCamera->pos.z - a2->vWorldPosition.y) < 0)
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6262 {
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6263 arg_4 = var_4 * var_14 - var_8 * arg_0;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6264 a4->v_18.x = floorf(arg_4 + 0.5f);
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6265 arg_4 = var_10 * arg_0 - var_4 * var_c;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6266 a4->v_18.y = floorf(arg_4 + 0.5f);
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6267 arg_4 = var_8 * var_c - var_10 * var_14;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6268 a4->v_18.z = floorf(arg_4 + 0.5f);
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6269 a4->_486089_normalize_v_18();
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6270 arg_4 = -(a4->v_18.x * a2->vWorldViewPosition.x) - a4->v_18.y * a2->vWorldViewPosition.y - a4->v_18.z * a2->vWorldViewPosition.z;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6271 a4->field_24 = floorf(arg_4 + 0.5f);
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6272 return true;
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6273 }
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6274 else
a96ebf3123d2 23.01.13 (Rotate)
Ritor1
parents: 37
diff changeset
6275 return false;
0
Ritor1
parents:
diff changeset
6276 }
Ritor1
parents:
diff changeset
6277
Ritor1
parents:
diff changeset
6278 //----- (004823F4) --------------------------------------------------------
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6279 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6280 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6281 //unsigned int v2; // ebx@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6282 //unsigned int v3; // edi@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6283 //int v4; // eax@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6284 //int v6; // esi@5
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6285 //int v7; // ecx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6286 //int v8; // edx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6287 //int v9; // eax@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6288 //int v10; // esi@10
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6289 //int v11; // [sp+14h] [bp-8h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6290 //int v12; // [sp+18h] [bp-4h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6291
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6292 //v12 = a1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6293 //v11 = a2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6294 auto grid_x = WorldPosToGridCellX(pos_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6295 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6296
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6297 auto party_grid_x1 = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6298 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6299 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6300 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6301 auto party_grid_z1 = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6302 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6303 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6304 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6305 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6306 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6307 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6308 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6309 //dword_76D554_terrain_cell_world_pos_around_party_y = v4;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6310 if (party_x1z1_y == party_x2z1_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6311 party_x2z1_y == party_x2z2_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6312 party_x2z2_y == party_x1z2_y )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6313 return false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6314
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6315 auto dx = abs(pos_x - party_grid_x1),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6316 dz = abs(party_grid_z1 - pos_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6317
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6318 int y1, y2, y3;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6319 if (dz >= dx)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6320 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6321 y1 = party_x1z2_y; // lower-left triangle
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6322 y2 = party_x2z2_y; // y3 | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6323 y3 = party_x1z1_y; // | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6324 /* | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6325 |______ \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6326 y1 y2 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6327 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6328 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6329 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6330 y1 = party_x2z1_y; // upper-right
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6331 y2 = party_x1z1_y; // y2_______ y1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6332 y3 = party_x2z2_y; // \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6333 /* \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6334 \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6335 y3 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6336 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6337
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6338 int y_min = min(y1, min(y2, y3)),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6339 y_max = max(y1, max(y2, y3));
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6340 return y_max - y_min > 512;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6341
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6342 /*if ( y1 >= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6343 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6344 y_min = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6345 if ( y2 < y3 )
0
Ritor1
parents:
diff changeset
6346 goto LABEL_13;
Ritor1
parents:
diff changeset
6347 LABEL_12:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6348 y_min = y3;
0
Ritor1
parents:
diff changeset
6349 goto LABEL_13;
Ritor1
parents:
diff changeset
6350 }
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6351 else if ( y1 >= y3 )
0
Ritor1
parents:
diff changeset
6352 goto LABEL_12;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6353 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6354 y_min = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6355
0
Ritor1
parents:
diff changeset
6356 LABEL_13:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6357 if ( y1 <= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6358 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6359 if ( y2 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6360 y3 = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6361 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6362 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6363 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6364 if ( y1 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6365 y3 = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6366 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
6367 return y3 - v10 > 512;*/
0
Ritor1
parents:
diff changeset
6368 }
Ritor1
parents:
diff changeset
6369
Ritor1
parents:
diff changeset
6370 //----- (0048257A) --------------------------------------------------------
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6371 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater)
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6372 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6373 //unsigned int v4; // ebx@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6374 //unsigned int v5; // edi@1
0
Ritor1
parents:
diff changeset
6375 int result; // eax@9
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6376 //int v7; // ebx@10
0
Ritor1
parents:
diff changeset
6377 int v8; // ebx@11
Ritor1
parents:
diff changeset
6378 int v9; // eax@11
Ritor1
parents:
diff changeset
6379 int v10; // ecx@11
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6380 //int v11; // [sp+Ch] [bp-Ch]@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6381 //int v12; // [sp+10h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
6382 int v13; // [sp+10h] [bp-8h]@11
Ritor1
parents:
diff changeset
6383 signed int v14; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
6384 int v15; // [sp+24h] [bp+Ch]@11
Ritor1
parents:
diff changeset
6385
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6386 //v11 = a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6387 //v12 = a2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6388 auto grid_x = WorldPosToGridCellX(a1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6389 auto grid_z = WorldPosToGridCellZ(a2) - 1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6390
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6391 auto grid_x1 = GridCellToWorldPosX(grid_x),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6392 grid_x2 = GridCellToWorldPosX(grid_x + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6393 auto grid_z1 = GridCellToWorldPosZ(grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6394 grid_z2 = GridCellToWorldPosZ(grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6395
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6396 auto y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6397 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6398 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6399 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6400 //v4 = WorldPosToGridCellX(a1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6401 //v5 = WorldPosToGridCellZ(v12) - 1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6402 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6403 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6404 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6405 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6406 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6407 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6408 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6409 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6410 //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
6411 //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
6412 //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
6413 //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
6414 *pIsOnWater = false;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6415 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 )
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 790
diff changeset
6416 *pIsOnWater = true;
0
Ritor1
parents:
diff changeset
6417 v14 = 0;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6418 if ( !bFloatAboveWater && *pIsOnWater )
0
Ritor1
parents:
diff changeset
6419 v14 = -60;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6420 if ( y_x1z1 != y_x2z1 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6421 y_x2z1 != y_x2z2 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6422 y_x2z2 != y_x1z2 )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6423 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6424 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6425 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6426 v8 = y_x1z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6427 v9 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6428 v10 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6429 v15 = a1 - grid_x1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6430 v13 = a2 - grid_z2;
0
Ritor1
parents:
diff changeset
6431 }
Ritor1
parents:
diff changeset
6432 else
Ritor1
parents:
diff changeset
6433 {
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6434 v8 = y_x2z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6435 v9 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6436 v10 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6437 v15 = grid_x2 - a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6438 v13 = grid_z1 - a2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6439 }
871
710cf848ad24 Particle engine made working.
Nomad
parents: 838
diff changeset
6440 return v14 + v8 + fixpoint_sub0(v13, (v10 - v8) * 128) + fixpoint_sub0(v15, (v9 - v8) * 128);
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6441 }
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6442 else
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
6443 return y_x1z1;
0
Ritor1
parents:
diff changeset
6444 }
Ritor1
parents:
diff changeset
6445
Ritor1
parents:
diff changeset
6446 //----- (00482A90) --------------------------------------------------------
Ritor1
parents:
diff changeset
6447 signed int __cdecl const_1_0()
Ritor1
parents:
diff changeset
6448 {
Ritor1
parents:
diff changeset
6449 return 1;
Ritor1
parents:
diff changeset
6450 }
Ritor1
parents:
diff changeset
6451
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6452
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6453
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6454
0
Ritor1
parents:
diff changeset
6455
Ritor1
parents:
diff changeset
6456 //----- (00485F53) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6457 void __thiscall sr_485F53(Vec2_int_ *v)
0
Ritor1
parents:
diff changeset
6458 {
Ritor1
parents:
diff changeset
6459 ++v->y;
Ritor1
parents:
diff changeset
6460 if ( v->y > 1000 )
Ritor1
parents:
diff changeset
6461 v->y = 0;
Ritor1
parents:
diff changeset
6462 }
Ritor1
parents:
diff changeset
6463
Ritor1
parents:
diff changeset
6464 //----- (0048607B) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6465 void Polygon::_48607B(stru149 *a2)
0
Ritor1
parents:
diff changeset
6466 {
Ritor1
parents:
diff changeset
6467 this->pTexture = 0;
Ritor1
parents:
diff changeset
6468 this->ptr_38 = a2;
Ritor1
parents:
diff changeset
6469 }
Ritor1
parents:
diff changeset
6470
Ritor1
parents:
diff changeset
6471 //----- (00486089) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6472 void Polygon::_486089_normalize_v_18()
0
Ritor1
parents:
diff changeset
6473 {
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
6474 //Polygon *v1; // esi@1
0
Ritor1
parents:
diff changeset
6475 double v2; // st7@1
Ritor1
parents:
diff changeset
6476 double v3; // st6@1
Ritor1
parents:
diff changeset
6477 float v4; // ST18_4@2
Ritor1
parents:
diff changeset
6478 double v5; // st5@1
Ritor1
parents:
diff changeset
6479 float v6; // ST14_4@2
Ritor1
parents:
diff changeset
6480 double v7; // st7@1
Ritor1
parents:
diff changeset
6481 float v8; // ST24_4@2
Ritor1
parents:
diff changeset
6482 float v9; // ST20_4@2
Ritor1
parents:
diff changeset
6483 double v10; // ST0C_8@2
Ritor1
parents:
diff changeset
6484 float v11; // ST18_4@2
Ritor1
parents:
diff changeset
6485 double v12; // ST0C_8@2
Ritor1
parents:
diff changeset
6486 float v13; // ST14_4@2
Ritor1
parents:
diff changeset
6487 double v14; // ST0C_8@2
Ritor1
parents:
diff changeset
6488 float v15; // [sp+20h] [bp-8h]@1
Ritor1
parents:
diff changeset
6489
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6490 //v1 = this;
0
Ritor1
parents:
diff changeset
6491 v2 = (double)this->v_18.x;
Ritor1
parents:
diff changeset
6492 v15 = v2;
Ritor1
parents:
diff changeset
6493 v3 = (double)this->v_18.y;
Ritor1
parents:
diff changeset
6494 v5 = (double)this->v_18.z;
Ritor1
parents:
diff changeset
6495 v7 = sqrt(v5 * v5 + v3 * v3 + v2 * v2);
Ritor1
parents:
diff changeset
6496 if ( v7 == 0.0 )
Ritor1
parents:
diff changeset
6497 {
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6498 this->v_18.x = 0;
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6499 this->v_18.y = 0;
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6500 this->v_18.z = 65536;
0
Ritor1
parents:
diff changeset
6501 }
Ritor1
parents:
diff changeset
6502 else
Ritor1
parents:
diff changeset
6503 {
Ritor1
parents:
diff changeset
6504 v8 = 1.0 / v7;
Ritor1
parents:
diff changeset
6505 v9 = v8 * v15 * 65536.0;
Ritor1
parents:
diff changeset
6506 v10 = v9 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6507 this->v_18.x = LODWORD(v10);
0
Ritor1
parents:
diff changeset
6508 v4 = v3;
Ritor1
parents:
diff changeset
6509 v11 = v8 * v4 * 65536.0;
Ritor1
parents:
diff changeset
6510 v12 = v11 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6511 this->v_18.y = LODWORD(v12);
0
Ritor1
parents:
diff changeset
6512 v6 = v5;
Ritor1
parents:
diff changeset
6513 v13 = v8 * v6 * 65536.0;
Ritor1
parents:
diff changeset
6514 v14 = v13 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
6515 this->v_18.z = LODWORD(v14);
0
Ritor1
parents:
diff changeset
6516 }
Ritor1
parents:
diff changeset
6517 }
Ritor1
parents:
diff changeset
6518
Ritor1
parents:
diff changeset
6519 //----- (0048616B) --------------------------------------------------------
Ritor1
parents:
diff changeset
6520 int stru149::_48616B(int a2, int a3, int a4, int a5, int a6, int a7)
Ritor1
parents:
diff changeset
6521 {
Ritor1
parents:
diff changeset
6522 int v7; // ebx@1
Ritor1
parents:
diff changeset
6523 int v8; // esi@1
Ritor1
parents:
diff changeset
6524 int v9; // edi@1
Ritor1
parents:
diff changeset
6525 int v10; // eax@1
Ritor1
parents:
diff changeset
6526 int v11; // edx@1
Ritor1
parents:
diff changeset
6527 int v12; // esi@2
Ritor1
parents:
diff changeset
6528 int v13; // eax@2
Ritor1
parents:
diff changeset
6529 int v14; // ST10_4@3
Ritor1
parents:
diff changeset
6530 int v15; // esi@3
Ritor1
parents:
diff changeset
6531 int v16; // eax@5
Ritor1
parents:
diff changeset
6532 int v17; // ST0C_4@6
Ritor1
parents:
diff changeset
6533 int v18; // eax@8
Ritor1
parents:
diff changeset
6534 int v19; // ST0C_4@9
Ritor1
parents:
diff changeset
6535 int v20; // eax@10
Ritor1
parents:
diff changeset
6536 int v21; // edx@10
Ritor1
parents:
diff changeset
6537 int v22; // eax@10
Ritor1
parents:
diff changeset
6538 int result; // eax@10
Ritor1
parents:
diff changeset
6539 int v24; // [sp+14h] [bp-14h]@1
Ritor1
parents:
diff changeset
6540 int v25; // [sp+18h] [bp-10h]@1
Ritor1
parents:
diff changeset
6541 int v26; // [sp+1Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
6542 int v27; // [sp+24h] [bp-4h]@1
Ritor1
parents:
diff changeset
6543 int v28; // [sp+30h] [bp+8h]@10
Ritor1
parents:
diff changeset
6544 int v29; // [sp+3Ch] [bp+14h]@10
Ritor1
parents:
diff changeset
6545
Ritor1
parents:
diff changeset
6546 v25 = pOutdoorCamera->camera_rotation_x_int_cosine;
Ritor1
parents:
diff changeset
6547 v7 = pOutdoorCamera->camera_rotation_y_int_sine;
Ritor1
parents:
diff changeset
6548 v27 = pOutdoorCamera->camera_rotation_x_int_sine;
Ritor1
parents:
diff changeset
6549 v8 = -pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
6550 v9 = pOutdoorCamera->camera_rotation_y_int_cosine;
Ritor1
parents:
diff changeset
6551 v26 = -pIndoorCamera->pos.z;
Ritor1
parents:
diff changeset
6552 v24 = -pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
6553 v10 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
6554 v11 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
6555 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
6556 {
Ritor1
parents:
diff changeset
6557 v14 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
6558 v15 = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6559 this->field_0_party_dir_x = ((unsigned __int64)(v11 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16)
0
Ritor1
parents:
diff changeset
6560 + ((unsigned __int64)(-65536
Ritor1
parents:
diff changeset
6561 * pIndoorCamera->pos.z
Ritor1
parents:
diff changeset
6562 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16);
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6563 this->field_4_party_dir_y = v15;
0
Ritor1
parents:
diff changeset
6564 v12 = v25;
Ritor1
parents:
diff changeset
6565 v13 = ((unsigned __int64)((v26 << 16) * (signed __int64)v25) >> 16)
Ritor1
parents:
diff changeset
6566 - ((unsigned __int64)(v14 * (signed __int64)v27) >> 16);
Ritor1
parents:
diff changeset
6567 }
Ritor1
parents:
diff changeset
6568 else
Ritor1
parents:
diff changeset
6569 {
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6570 this->field_4_party_dir_y = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24;
0
Ritor1
parents:
diff changeset
6571 v12 = v25;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6572 this->field_0_party_dir_x = v11;
0
Ritor1
parents:
diff changeset
6573 v13 = v26 << 16;
Ritor1
parents:
diff changeset
6574 }
Ritor1
parents:
diff changeset
6575 this->field_8 = v13;
Ritor1
parents:
diff changeset
6576 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
6577 {
Ritor1
parents:
diff changeset
6578 v17 = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6579 this->field_C = ((unsigned __int64)(v17 * (signed __int64)v12) >> 16)
Ritor1
parents:
diff changeset
6580 + ((unsigned __int64)(a4 * (signed __int64)v27) >> 16);
Ritor1
parents:
diff changeset
6581 this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6582 - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6583 v16 = ((unsigned __int64)(a4 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v17 * (signed __int64)v27) >> 16);
Ritor1
parents:
diff changeset
6584 }
Ritor1
parents:
diff changeset
6585 else
Ritor1
parents:
diff changeset
6586 {
Ritor1
parents:
diff changeset
6587 this->field_C = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6588 + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6589 this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6590 - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6591 v16 = a4;
Ritor1
parents:
diff changeset
6592 }
Ritor1
parents:
diff changeset
6593 this->field_14 = v16;
Ritor1
parents:
diff changeset
6594 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
6595 {
Ritor1
parents:
diff changeset
6596 v19 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6597 this->field_18 = ((unsigned __int64)(v19 * (signed __int64)v12) >> 16)
Ritor1
parents:
diff changeset
6598 + ((unsigned __int64)(a7 * (signed __int64)v27) >> 16);
Ritor1
parents:
diff changeset
6599 this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6600 - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6601 v18 = ((unsigned __int64)(a7 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v27) >> 16);
Ritor1
parents:
diff changeset
6602 }
Ritor1
parents:
diff changeset
6603 else
Ritor1
parents:
diff changeset
6604 {
Ritor1
parents:
diff changeset
6605 this->field_18 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6606 + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6607 this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16)
Ritor1
parents:
diff changeset
6608 - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16);
Ritor1
parents:
diff changeset
6609 v18 = a7;
Ritor1
parents:
diff changeset
6610 }
Ritor1
parents:
diff changeset
6611 this->field_18 = -this->field_18;
Ritor1
parents:
diff changeset
6612 this->field_1C = -this->field_1C;
Ritor1
parents:
diff changeset
6613 this->field_20 = v18;
Ritor1
parents:
diff changeset
6614 v20 = this->field_C;
Ritor1
parents:
diff changeset
6615 this->field_20 = -this->field_20;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6616 v21 = ((unsigned __int64)(v20 * (signed __int64)this->field_0_party_dir_x) >> 16)
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6617 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16)
0
Ritor1
parents:
diff changeset
6618 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16);
Ritor1
parents:
diff changeset
6619 v28 = this->field_18;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6620 v22 = this->field_0_party_dir_x;
0
Ritor1
parents:
diff changeset
6621 this->field_24 = v21;
Ritor1
parents:
diff changeset
6622 v29 = (unsigned __int64)(v28 * (signed __int64)v22) >> 16;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6623 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16;
0
Ritor1
parents:
diff changeset
6624 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
Ritor1
parents:
diff changeset
6625 return result;
Ritor1
parents:
diff changeset
6626 }
Ritor1
parents:
diff changeset
6627
Ritor1
parents:
diff changeset
6628 //----- (0048694B) --------------------------------------------------------
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
6629 int stru149::sky_48694B()
0
Ritor1
parents:
diff changeset
6630 {
Ritor1
parents:
diff changeset
6631 int v1; // eax@1
Ritor1
parents:
diff changeset
6632 int v2; // ST04_4@1
Ritor1
parents:
diff changeset
6633 int v3; // ST00_4@1
Ritor1
parents:
diff changeset
6634 int v4; // eax@1
Ritor1
parents:
diff changeset
6635 int v5; // ST0C_4@1
Ritor1
parents:
diff changeset
6636 int result; // eax@1
Ritor1
parents:
diff changeset
6637
Ritor1
parents:
diff changeset
6638 v1 = this->field_C;
Ritor1
parents:
diff changeset
6639 this->field_18 = -this->field_18;
Ritor1
parents:
diff changeset
6640 this->field_1C = -this->field_1C;
Ritor1
parents:
diff changeset
6641 this->field_20 = -this->field_20;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6642 v2 = (unsigned __int64)(v1 * (signed __int64)this->field_0_party_dir_x) >> 16;
0
Ritor1
parents:
diff changeset
6643 v3 = this->field_18;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6644 v4 = this->field_0_party_dir_x;
0
Ritor1
parents:
diff changeset
6645 this->field_24 = v2
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6646 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16)
0
Ritor1
parents:
diff changeset
6647 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16);
Ritor1
parents:
diff changeset
6648 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16;
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
6649 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16;
0
Ritor1
parents:
diff changeset
6650 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
Ritor1
parents:
diff changeset
6651 return result;
Ritor1
parents:
diff changeset
6652 }
Ritor1
parents:
diff changeset
6653
Ritor1
parents:
diff changeset
6654
Ritor1
parents:
diff changeset
6655 //----- (00440DF5) --------------------------------------------------------
Ritor1
parents:
diff changeset
6656 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr)
Ritor1
parents:
diff changeset
6657 {
Ritor1
parents:
diff changeset
6658 int result; // eax@1
Ritor1
parents:
diff changeset
6659
Ritor1
parents:
diff changeset
6660 pElements[uNumElements].field_6_rnd_value = a2;
Ritor1
parents:
diff changeset
6661 pElements[uNumElements].field_8_rnd_value = a3;
Ritor1
parents:
diff changeset
6662 pElements[uNumElements].field_A_rnd_value = a4;
Ritor1
parents:
diff changeset
6663 pElements[uNumElements].field_C_time_left = rand() % 64 + 256;
Ritor1
parents:
diff changeset
6664 pElements[uNumElements].field_E_time_to_live = pElements[uNumElements].field_C_time_left;
Ritor1
parents:
diff changeset
6665 result = 3 * uNumElements;
Ritor1
parents:
diff changeset
6666 pElements[uNumElements++].bgr16 = bgr;
Ritor1
parents:
diff changeset
6667 if (uNumElements >= 100 )
Ritor1
parents:
diff changeset
6668 uNumElements = 0;
Ritor1
parents:
diff changeset
6669 return result;
Ritor1
parents:
diff changeset
6670 }
Ritor1
parents:
diff changeset
6671
Ritor1
parents:
diff changeset
6672 //----- (00440E91) --------------------------------------------------------
Ritor1
parents:
diff changeset
6673 void stru167_wrap::_440E91(__int16 x, int y, int z, int a5, __int16 bgr)
Ritor1
parents:
diff changeset
6674 {
Ritor1
parents:
diff changeset
6675 stru167_wrap *v6; // edi@1
Ritor1
parents:
diff changeset
6676 int i; // esi@1
Ritor1
parents:
diff changeset
6677 int v8; // ST08_4@2
Ritor1
parents:
diff changeset
6678 int v9; // ST04_4@2
Ritor1
parents:
diff changeset
6679 int v10; // eax@2
Ritor1
parents:
diff changeset
6680
Ritor1
parents:
diff changeset
6681 v6 = this;
Ritor1
parents:
diff changeset
6682 for ( i = 0; i < rand() % 6 + 5; ++i )
Ritor1
parents:
diff changeset
6683 {
Ritor1
parents:
diff changeset
6684 v8 = z + rand() % 33;
Ritor1
parents:
diff changeset
6685 v9 = rand() % 33 + y - 16;
Ritor1
parents:
diff changeset
6686 v10 = rand();
Ritor1
parents:
diff changeset
6687 Push(v10 % 33 + x - 16, v9, v8, a5, bgr);
Ritor1
parents:
diff changeset
6688 }
Ritor1
parents:
diff changeset
6689 }
Ritor1
parents:
diff changeset
6690
Ritor1
parents:
diff changeset
6691 //----- (00440F07) --------------------------------------------------------
Ritor1
parents:
diff changeset
6692 void stru167_wrap::_440F07()
Ritor1
parents:
diff changeset
6693 {
Ritor1
parents:
diff changeset
6694 for (uint i = 0; i < 100; ++i)
Ritor1
parents:
diff changeset
6695 {
Ritor1
parents:
diff changeset
6696 if (pElements[i].field_C_time_left > 0)
Ritor1
parents:
diff changeset
6697 {
Ritor1
parents:
diff changeset
6698 pElements[i].field_A_rnd_value += rand() % 5 + 4;
Ritor1
parents:
diff changeset
6699 pElements[i].field_6_rnd_value += rand() % 5 - 2;
Ritor1
parents:
diff changeset
6700 pElements[i].field_8_rnd_value += rand() % 5 - 2;
Ritor1
parents:
diff changeset
6701 pElements[i].field_C_time_left -= (short)pEventTimer->uTimeElapsed;
Ritor1
parents:
diff changeset
6702 }
Ritor1
parents:
diff changeset
6703 }
Ritor1
parents:
diff changeset
6704 }
Ritor1
parents:
diff changeset
6705
Ritor1
parents:
diff changeset
6706 //----- (0044100D) --------------------------------------------------------
994
3431f6abc786 GameUI clean
Nomad
parents: 978
diff changeset
6707 bool sub_44100D()
0
Ritor1
parents:
diff changeset
6708 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6709 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6710 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
6711 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
0
Ritor1
parents:
diff changeset
6712 }
Ritor1
parents:
diff changeset
6713 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
6714
Ritor1
parents:
diff changeset
6715 //----- (00441A4E) --------------------------------------------------------
910
Ritor1
parents: 897
diff changeset
6716 __int16 __fastcall sub_441A4E(int a1)//for blessing
0
Ritor1
parents:
diff changeset
6717 {
Ritor1
parents:
diff changeset
6718 __int16 result; // ax@1
Ritor1
parents:
diff changeset
6719 int v2; // ebx@1
Ritor1
parents:
diff changeset
6720 char *v3; // esi@1
Ritor1
parents:
diff changeset
6721 int v4; // edi@4
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6722 bool v5; // ecx@4
0
Ritor1
parents:
diff changeset
6723 SpriteFrame *v6; // eax@6
Ritor1
parents:
diff changeset
6724 SpriteFrame *v7; // edi@6
Ritor1
parents:
diff changeset
6725 int v8; // eax@6
Ritor1
parents:
diff changeset
6726 unsigned __int16 v9; // ax@6
Ritor1
parents:
diff changeset
6727 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1
Ritor1
parents:
diff changeset
6728 int v11; // [sp+5Ch] [bp-Ch]@6
Ritor1
parents:
diff changeset
6729 int v12; // [sp+60h] [bp-8h]@1
Ritor1
parents:
diff changeset
6730 int v13; // [sp+64h] [bp-4h]@6
Ritor1
parents:
diff changeset
6731
Ritor1
parents:
diff changeset
6732 v10.uParentBillboardID = -1;
Ritor1
parents:
diff changeset
6733 v10.pTarget = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
6734 v10.pTargetZ = pRenderer->pActiveZBuffer;
Ritor1
parents:
diff changeset
6735 v10.uTargetPitch = pRenderer->field_10;
Ritor1
parents:
diff changeset
6736 result = 0;
Ritor1
parents:
diff changeset
6737 v2 = a1;
Ritor1
parents:
diff changeset
6738 v10.uViewportX = 0;
Ritor1
parents:
diff changeset
6739 v10.uViewportY = 0;
Ritor1
parents:
diff changeset
6740 v10.uViewportZ = 639;
Ritor1
parents:
diff changeset
6741 v10.uViewportW = 479;
Ritor1
parents:
diff changeset
6742 v12 = 0;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6743 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6744 //do
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6745 for ( uint i = 0; i < 50; ++i )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6746 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6747 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6748 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6749 result = pOtherOverlayList->pOverlays[i].field_0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6750 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6751 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6752 //v4 = result;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6753 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6754 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6755 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6756 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6757 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
6758 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 )
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6759 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6760 if ( !pOtherOverlayList->pOverlays[i].field_0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6761 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6762 v6 = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID,
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6763 pOtherOverlayList->pOverlays[i].field_4);
0
Ritor1
parents:
diff changeset
6764 v7 = v6;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6765 v11 = pOtherOverlayList->pOverlays[i].field_E;
0
Ritor1
parents:
diff changeset
6766 v13 = v6->scale;
Ritor1
parents:
diff changeset
6767 v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6768 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6769 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
6770 v10._screenspace_x_scaler_packedfloat = v13;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
6771 v10._screenspace_y_scaler_packedfloat = v13;
0
Ritor1
parents:
diff changeset
6772 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1);
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6773 v8 = pOtherOverlayList->pOverlays[i].field_2;
0
Ritor1
parents:
diff changeset
6774 v10.sZValue = 0;
Ritor1
parents:
diff changeset
6775 v10.uFlags = 0;
Ritor1
parents:
diff changeset
6776 v9 = pOverlayList->pOverlays[v8].uOverlayType;
Ritor1
parents:
diff changeset
6777 if ( !v9 || v9 == 2 )
Ritor1
parents:
diff changeset
6778 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1;
Ritor1
parents:
diff changeset
6779 result = pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
Ritor1
parents:
diff changeset
6780 ++v12;
Ritor1
parents:
diff changeset
6781 if ( v12 == 5 )
Ritor1
parents:
diff changeset
6782 break;
Ritor1
parents:
diff changeset
6783 }
Ritor1
parents:
diff changeset
6784 }
Ritor1
parents:
diff changeset
6785 }
Ritor1
parents:
diff changeset
6786 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6787 //v3 += 20;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6788 }
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
6789 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays );
0
Ritor1
parents:
diff changeset
6790 return result;
Ritor1
parents:
diff changeset
6791 }
Ritor1
parents:
diff changeset
6792
Ritor1
parents:
diff changeset
6793 //----- (00443801) --------------------------------------------------------
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6794 void Initialize2DA()
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6795 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6796
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6797 int i;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6798 char* test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6799 unsigned char c;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6800 bool break_loop;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6801 unsigned int temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6802 char* tmp_pos;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6803 int decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6804
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6805 if ( p2DEventsTXT_Raw )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6806 pAllocator->FreeChunk(p2DEventsTXT_Raw);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6807 p2DEventsTXT_Raw = NULL;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6808 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6809 strtok(p2DEventsTXT_Raw, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6810 strtok(NULL, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6811
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6812 for (i=0;i<525;++i)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6813 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6814 test_string = strtok(NULL, "\r") + 1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6815 break_loop = false;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6816 decode_step=0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6817 do
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6818 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6819 c = *(unsigned char*)test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6820 temp_str_len = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6821 while((c!='\t')&&(c>0))
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6822 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6823 ++temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6824 c=test_string[temp_str_len];
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6825 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6826 tmp_pos=test_string+temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6827 if (*tmp_pos == 0)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6828 break_loop = true;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6829 *tmp_pos = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6830 if (temp_str_len)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6831 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6832 switch (decode_step)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6833 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6834 case 2:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6835 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6836 if ( !_strnicmp(test_string, "wea", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6837 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6838 p2DEvents[i].uType = BildingType_WeaponShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6839 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6840 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6841 if ( !_strnicmp(test_string, "arm", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6842 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6843 p2DEvents[i].uType = BildingType_ArmorShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6844 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6845 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6846 if ( !_strnicmp(test_string, "mag", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6847 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6848 p2DEvents[i].uType = BildingType_MagicShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6849 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6850 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6851 if ( !_strnicmp(test_string, "alc", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6852 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6853 p2DEvents[i].uType = BildingType_AlchemistShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6854 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6855 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6856 if ( !_strnicmp(test_string, "sta", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6857 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6858 p2DEvents[i].uType = BildingType_Stables;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6859 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6860 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6861 if ( !_strnicmp(test_string, "boa", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6862 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6863 p2DEvents[i].uType = BildingType_Boats;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6864 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6865 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6866 if ( !_strnicmp(test_string, "tem", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6867 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6868 p2DEvents[i].uType = BildingType_Temple;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6869 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6870 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6871 if ( !_strnicmp(test_string, "tra", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6872 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6873 p2DEvents[i].uType = BildingType_Training;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6874 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6875 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6876 if ( !_strnicmp(test_string, "tow", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6877 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6878 p2DEvents[i].uType = BildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6879 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6880 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6881
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6882 if ( !_strnicmp(test_string, "tav", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6883 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6884 p2DEvents[i].uType = BildingType_Tavern;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6885 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6886 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6887 if ( !_strnicmp(test_string, "ban", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6888 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6889 p2DEvents[i].uType = BildingType_Bank;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6890 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6891 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6892 if ( !_strnicmp(test_string, "fir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6893 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6894 p2DEvents[i].uType = BildingType_FireGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6895 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6896 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6897 if ( !_strnicmp(test_string, "air", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6898 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6899 p2DEvents[i].uType = BildingType_AirGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6900 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6901 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6902 if ( !_strnicmp(test_string, "wat", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6903 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6904 p2DEvents[i].uType = BildingType_WaterGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6905 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6906 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6907 if ( !_strnicmp(test_string, "ear", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6908 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6909 p2DEvents[i].uType = BildingType_EarthGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6910 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6911 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6912 if ( !_strnicmp(test_string, "spi", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6913 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6914 p2DEvents[i].uType = BildingType_SpiritGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6915 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6916 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6917 if ( !_strnicmp(test_string, "min", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6918 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6919 p2DEvents[i].uType = BildingType_MindGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6920 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6921 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6922 if ( !_strnicmp(test_string, "bod", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6923 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6924 p2DEvents[i].uType = BildingType_BodyGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6925 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6926 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6927 if ( !_strnicmp(test_string, "lig", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6928 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6929 p2DEvents[i].uType = BildingType_LightGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6930 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6931 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6932 if ( !_strnicmp(test_string, "dar", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6933 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6934 p2DEvents[i].uType = BildingType_DarkGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6935 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6936 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6937 if ( !_strnicmp(test_string, "ele", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6938 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6939 p2DEvents[i].uType = BildingType_14;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6940 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6941 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6942 if ( !_strnicmp(test_string, "sel", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6943 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6944 p2DEvents[i].uType = BildingType_15;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6945 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6946 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6947 if ( !_strnicmp(test_string, "mir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6948 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6949 p2DEvents[i].uType = BildingType_16;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6950 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6951 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6952 if ( !_strnicmp(test_string, "mer", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6953 {
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6954 p2DEvents[i].uType = BildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6955 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6956 }
495
90fdb47bfcba guilds ...
Gloval
parents: 488
diff changeset
6957 p2DEvents[i].uType = BildingType_18;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6958 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6959 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6960
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6961 case 4:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6962 p2DEvents[i].uAnimationID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6963 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6964 case 5:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6965 p2DEvents[i].pName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6966 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6967 case 6:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6968 p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6969 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6970 case 7:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6971 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6972 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6973 case 8:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6974 p2DEvents[i].field_14 = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6975 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6976 case 9:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6977 p2DEvents[i]._state = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6978 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6979 case 10:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6980 p2DEvents[i]._rep = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6981 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6982 case 11:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6983 p2DEvents[i]._per = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6984 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6985 case 12:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6986 p2DEvents[i].fPriceMultiplier = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6987 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6988 case 13:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6989 p2DEvents[i].flt_24 = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6990 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6991 case 15:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6992 p2DEvents[i].field_1C = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6993 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6994 case 18:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6995 p2DEvents[i].uOpenTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6996 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6997 case 19:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6998 p2DEvents[i].uCloseTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
6999 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7000 case 20:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7001 p2DEvents[i].uExitPicID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7002 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7003 case 21:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7004 p2DEvents[i].uExitMapID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7005 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7006 case 22:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7007 p2DEvents[i]._quest_related = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7008 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7009 case 23:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7010 p2DEvents[i].pEnterText = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7011 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7012 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7013 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7014 ++decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7015 test_string=tmp_pos+1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7016 } while ((decode_step<24)&&!break_loop);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7017 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
7018
0
Ritor1
parents:
diff changeset
7019 }
Ritor1
parents:
diff changeset
7020
Ritor1
parents:
diff changeset
7021 //----- (00443E31) --------------------------------------------------------
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
7022 void LoadLevel_InitializeLevelStr()
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
7023 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7024
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7025 char Args[100];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7026 int string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7027 int max_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7028 int current_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7029 int prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7030
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7031 if (sizeof(pLevelStrOffsets) != 2000)
0
Ritor1
parents:
diff changeset
7032 Log::Warning(L"pLevelStrOffsets: deserialization warning");
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7033 memset(pLevelStrOffsets.data(), 0, 2000);
0
Ritor1
parents:
diff changeset
7034
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7035 max_string_length = 0;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7036 string_num = 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7037 prev_string_offset = 0;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7038 pLevelStrOffsets[0]=0;
0
Ritor1
parents:
diff changeset
7039 for (uint i = 0; i < uLevelStrFileSize; ++i)
Ritor1
parents:
diff changeset
7040 {
Ritor1
parents:
diff changeset
7041 if ( !pLevelStr[i] )
Ritor1
parents:
diff changeset
7042 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7043 pLevelStrOffsets[string_num] = i + 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7044 ++string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7045 if ( i - prev_string_offset > max_string_length )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7046 max_string_length = i - prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7047 prev_string_offset = i;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7048 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7049 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7050
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7051 uLevelStrNumStrings = string_num - 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7052 if ( max_string_length > 800 )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7053 {
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7054 sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1);
0
Ritor1
parents:
diff changeset
7055 Abortf(Args);
Ritor1
parents:
diff changeset
7056 }
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7057
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7058 if ( uLevelStrNumStrings > 0 )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7059 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7060 for(uint i = 0; i <uLevelStrNumStrings ; ++i)
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7061 {
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7062 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7063 ++pLevelStrOffsets[i];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
7064 }
0
Ritor1
parents:
diff changeset
7065 }
Ritor1
parents:
diff changeset
7066 }
Ritor1
parents:
diff changeset
7067
Ritor1
parents:
diff changeset
7068 //----- (00443F95) --------------------------------------------------------
Ritor1
parents:
diff changeset
7069 void __cdecl OnMapLeave()
Ritor1
parents:
diff changeset
7070 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7071 _evt_raw *test_event;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7072 if ( uLevelEVT_NumEvents > 0 )
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7073 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7074 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7075 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7076 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7077 if ( test_event->_e_type == EVENT_OnMapLeave )
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7078 {
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7079 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7080 }
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
7081 }
0
Ritor1
parents:
diff changeset
7082 }
Ritor1
parents:
diff changeset
7083 }
Ritor1
parents:
diff changeset
7084
Ritor1
parents:
diff changeset
7085 //----- (00443FDC) --------------------------------------------------------
Ritor1
parents:
diff changeset
7086 void OnMapLoad()
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7087 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7088 stru176 *v3; // esi@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7089 __int16 v4; // cx@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7090 __int16 v5; // di@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7091 int v6; // eax@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7092 signed __int64 v8; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7093 unsigned int v9; // ecx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7094 signed __int64 v10; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7095 signed __int64 v11; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7096 int v12; // ST50_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7097 signed __int64 v13; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7098 signed __int64 v14; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7099 int v15; // ST58_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7100 signed __int64 v16; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7101 int hours; // ebx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7102 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7103 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7104 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7105 int minutes; // [sp+2Ch] [bp-24h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7106 int years; // [sp+34h] [bp-1Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7107 int weeks; // [sp+38h] [bp-18h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7108 int v26; // [sp+3Ch] [bp-14h]@15
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7109 int days; // [sp+3Ch] [bp-14h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7110 int months; // [sp+40h] [bp-10h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7111 __int16 v29; // [sp+46h] [bp-Ah]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7112 __int16 v30; // [sp+48h] [bp-8h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7113 __int16 v31; // [sp+4Ah] [bp-6h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7114 __int16 v32; // [sp+4Ch] [bp-4h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7115 __int16 v33; // [sp+4Eh] [bp-2h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7116
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7117 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7118 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7119 auto pEvent = pLevelEVT_Index[i];
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7120
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7121 auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7122
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7123 if (_evt->_e_type == EVENT_PlaySound)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7124 {
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
7125 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7126 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7127 else if (_evt->_e_type == EVENT_OnMapReload)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7128 {
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7129 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7130 }
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7131 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7132 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7133 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
810
f5156b8c61ad savegame refactoring
Gloval
parents: 795
diff changeset
7134 v20 = pOutdoor->loc_time.uLastVisitDay;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7135 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7136 v20 = pIndoor->stru1.uLastVisitDay;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7137
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7138 v3->timer_evt_type = _evt->_e_type;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7139 v3->timer_evt_ID = pEvent.uEventID;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7140 v3->timer_evt_seq_num = pEvent.event_sequence_num;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7141
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7142 v3->field_10 = _evt->v5;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7143 v3->field_12 = _evt->v6;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7144 v3->field_14 = _evt->v7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7145 v3->field_16 = _evt->v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7146 v3->field_18 = _evt->v9;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7147 v3->field_1A = _evt->v10;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7148
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7149
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7150 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7151
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7152 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7153 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7154 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7155 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7156 if ( v20 )
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7157 v18 = pParty->uTimePlayed - v20;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7158 else
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7159 v18 = 0i64;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7160 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7161
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7162 if ( v26 / 7 / 4 / 12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7163 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7164 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7165 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7166 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7167 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7168 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7169 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7170 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7171 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7172 v26 / 7 != 0 && v3->field_14 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7173 v26 != 0 || !v20)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7174 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7175 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7176 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7177 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7178 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7179 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7180 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7181 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7182 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7183 v9 = v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7184 v10 = (signed int)v8 / 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7185 minutes = v10 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7186 v11 = (signed int)(v10 / 60);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7187 v12 = v11 % 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7188 v13 = (signed int)(v11 / 24);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7189 days = v13 % 7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7190 v14 = (signed int)(v13 / 7);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7191 v15 = v14 % 4;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7192 v16 = (signed int)(v14 / 4);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7193 years = v16 / 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7194
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7195 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7196 auto _2 = ((__int64)v9 << 32) | _1;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7197
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7198 seconds = _2 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7199 //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
7200 // v9)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7201 // % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7202
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7203 hours = v12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7204 weeks = v15;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7205 months = v16 % 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7206 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7207 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7208 ++years;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7209 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7210 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7211 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7212 if ( v3->field_12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7213 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7214 ++months;
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7215 }
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7216 else
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7217 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7218 if ( v3->field_14 )
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7219 {
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7220 ++weeks;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7221 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7222 else
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7223 {
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7224 ++days;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7225 minutes = v3->field_18;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7226 hours = v3->field_16;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7227 seconds = v3->field_1A;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7228 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7229 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7230 }
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7231 v3->next_fire_time = (signed __int64)((double)((seconds
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7232 + 60 * minutes
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7233 + 3600 * hours
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7234 + 0x93A80 * weeks
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7235 + 0x15180 * days
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7236 + 0x24EA00 * (months + 12i64 * years)) << 7)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7237 * 0.033333335);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7238
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7239 ++dword_5B65C8_timers_count;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7240 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7241 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
7242 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
7243 }
0
Ritor1
parents:
diff changeset
7244
Ritor1
parents:
diff changeset
7245 //----- (00444360) --------------------------------------------------------
Ritor1
parents:
diff changeset
7246 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
Ritor1
parents:
diff changeset
7247 {
Ritor1
parents:
diff changeset
7248 char pContainerName[120]; // [sp+8h] [bp-98h]@1
Ritor1
parents:
diff changeset
7249
Ritor1
parents:
diff changeset
7250 sprintf(pContainerName, "%s.evt", pLevelName);
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7251 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 0x2400u);
0
Ritor1
parents:
diff changeset
7252
Ritor1
parents:
diff changeset
7253 sprintf(pContainerName, "%s.str", pLevelName);
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7254 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 0x2400u);
0
Ritor1
parents:
diff changeset
7255 if (uLevelStrFileSize)
Ritor1
parents:
diff changeset
7256 LoadLevel_InitializeLevelStr();
Ritor1
parents:
diff changeset
7257 }
Ritor1
parents:
diff changeset
7258
Ritor1
parents:
diff changeset
7259 //----- (00444564) --------------------------------------------------------
Ritor1
parents:
diff changeset
7260 const char *__cdecl sub_444564()
Ritor1
parents:
diff changeset
7261 {
Ritor1
parents:
diff changeset
7262 double v0; // st7@3
Ritor1
parents:
diff changeset
7263 int v1; // ebx@3
Ritor1
parents:
diff changeset
7264 int v2; // edi@3
Ritor1
parents:
diff changeset
7265 int v3; // eax@3
Ritor1
parents:
diff changeset
7266 int v5; // edi@6
Ritor1
parents:
diff changeset
7267 int v6; // eax@6
Ritor1
parents:
diff changeset
7268 int v7; // eax@6
Ritor1
parents:
diff changeset
7269 unsigned __int8 v9; // zf@7
Ritor1
parents:
diff changeset
7270 unsigned __int8 v10; // sf@7
Ritor1
parents:
diff changeset
7271 ODMFace *v11; // eax@9
Ritor1
parents:
diff changeset
7272 __int16 v12; // cx@9
Ritor1
parents:
diff changeset
7273 const char *v13; // eax@11
Ritor1
parents:
diff changeset
7274 const char *v14; // edi@11
Ritor1
parents:
diff changeset
7275 const char *result; // eax@15
Ritor1
parents:
diff changeset
7276 unsigned int v16; // [sp+0h] [bp-20h]@3
Ritor1
parents:
diff changeset
7277 const char *v17; // [sp+4h] [bp-1Ch]@3
Ritor1
parents:
diff changeset
7278 unsigned int pY; // [sp+8h] [bp-18h]@3
Ritor1
parents:
diff changeset
7279 float v19; // [sp+Ch] [bp-14h]@1
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7280 int v20;
0
Ritor1
parents:
diff changeset
7281 int v21; // [sp+14h] [bp-Ch]@1
Ritor1
parents:
diff changeset
7282 unsigned int v22; // [sp+18h] [bp-8h]@8
Ritor1
parents:
diff changeset
7283 int pX; // [sp+1Ch] [bp-4h]@3
Ritor1
parents:
diff changeset
7284
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
7285 v20 = viewparams->sViewCenterX;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
7286 v21 = viewparams->sViewCenterY;
0
Ritor1
parents:
diff changeset
7287 v19 = (double)viewparams->field_2C * 0.000015258789;
Ritor1
parents:
diff changeset
7288 if ( viewparams->field_2C == 384 )
Ritor1
parents:
diff changeset
7289 {
711
a5e587c8e30e some cleaning
Gloval
parents: 708
diff changeset
7290 v20 = viewparams->indoor_center_x;
a5e587c8e30e some cleaning
Gloval
parents: 708
diff changeset
7291 v21 = viewparams->indoor_center_y;
0
Ritor1
parents:
diff changeset
7292 }
Ritor1
parents:
diff changeset
7293 v17 = 0;
Ritor1
parents:
diff changeset
7294 v16 = pOutdoor->uNumBModels;
Ritor1
parents:
diff changeset
7295 pMouse->GetClickPos((unsigned int *)&pX, &pY);
Ritor1
parents:
diff changeset
7296 v0 = 1.0 / v19;
Ritor1
parents:
diff changeset
7297 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
Ritor1
parents:
diff changeset
7298 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0);
Ritor1
parents:
diff changeset
7299 v2 = abs(v1 + 22528) / 512;
Ritor1
parents:
diff changeset
7300 v3 = abs((signed)LODWORD(v19) - 22528);
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7301 result = 0;
0
Ritor1
parents:
diff changeset
7302 if ( pOutdoor->_47F04C(v2, v3 / 512)
Ritor1
parents:
diff changeset
7303 && uCurrentlyLoadedLevelType == LEVEL_Outdoor
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7304 && (signed int)v16 > 0 )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7305 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7306 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
7307 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7308 pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1;
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7309 pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19);
0
Ritor1
parents:
diff changeset
7310 v5 = abs((signed)pY);
Ritor1
parents:
diff changeset
7311 v6 = abs((signed)pX);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 317
diff changeset
7312 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
7313 if ( v7 < pOutdoor->pBModels[i].sBoundingRadius )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7314 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7315 if ( pOutdoor->pBModels[i].uNumFaces > 0 )
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7316 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7317 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
7318 {
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7319 v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134];
0
Ritor1
parents:
diff changeset
7320 v12 = v11->sCogTriggeredID;
Ritor1
parents:
diff changeset
7321 if ( v12 )
Ritor1
parents:
diff changeset
7322 {
Ritor1
parents:
diff changeset
7323 if ( !(BYTE2(v11->uAttributes) & 0x10) )
Ritor1
parents:
diff changeset
7324 {
428
24936a5ff8ca level hints
Gloval
parents: 424
diff changeset
7325 v13 = GetEventHintString(v12);
0
Ritor1
parents:
diff changeset
7326 v14 = v13;
Ritor1
parents:
diff changeset
7327 if ( v13 )
Ritor1
parents:
diff changeset
7328 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1090
diff changeset
7329 if ( _stricmp(v13, "") )
0
Ritor1
parents:
diff changeset
7330 v17 = v14;
Ritor1
parents:
diff changeset
7331 }
Ritor1
parents:
diff changeset
7332 }
Ritor1
parents:
diff changeset
7333 }
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7334 }
0
Ritor1
parents:
diff changeset
7335 }
Ritor1
parents:
diff changeset
7336 result = v17;
695
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7337 }
af0332a32034 sub_444564 clean and fix right click on map screen
zipi
parents: 693
diff changeset
7338 }
0
Ritor1
parents:
diff changeset
7339 }
Ritor1
parents:
diff changeset
7340 return result;
Ritor1
parents:
diff changeset
7341 }
Ritor1
parents:
diff changeset
7342
Ritor1
parents:
diff changeset
7343 //----- (00444D80) --------------------------------------------------------
Ritor1
parents:
diff changeset
7344 signed int __cdecl GetTravelTime()
Ritor1
parents:
diff changeset
7345 {
Ritor1
parents:
diff changeset
7346 signed int v0; // esi@1
Ritor1
parents:
diff changeset
7347
Ritor1
parents:
diff changeset
7348 v0 = uDefaultTravelTime_ByFoot;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
7349 if ( CheckHiredNPCSpeciality(Guide) )
0
Ritor1
parents:
diff changeset
7350 --v0;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
7351 if ( CheckHiredNPCSpeciality(Tracker) )
0
Ritor1
parents:
diff changeset
7352 v0 -= 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
7353 if ( CheckHiredNPCSpeciality(Pathfinder) )
0
Ritor1
parents:
diff changeset
7354 v0 -= 3;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
7355 if ( CheckHiredNPCSpeciality(Explorer) )
0
Ritor1
parents:
diff changeset
7356 --v0;
Ritor1
parents:
diff changeset
7357 if ( v0 < 1 )
Ritor1
parents:
diff changeset
7358 v0 = 1;
Ritor1
parents:
diff changeset
7359 return v0;
Ritor1
parents:
diff changeset
7360 }
Ritor1
parents:
diff changeset
7361 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
Ritor1
parents:
diff changeset
7362
Ritor1
parents:
diff changeset
7363 //----- (004451A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
7364 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
Ritor1
parents:
diff changeset
7365 {
Ritor1
parents:
diff changeset
7366 int v3; // esi@1
Ritor1
parents:
diff changeset
7367 int v4; // edi@1
Ritor1
parents:
diff changeset
7368
Ritor1
parents:
diff changeset
7369 v3 = a2;
Ritor1
parents:
diff changeset
7370 v4 = a1;
Ritor1
parents:
diff changeset
7371 if ( !pGUIWindow2 )
Ritor1
parents:
diff changeset
7372 {
Ritor1
parents:
diff changeset
7373 if ( pParty->uFlags & 2 )
Ritor1
parents:
diff changeset
7374 pGame->Draw();
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7375 pAudioPlayer->StopChannels(-1, -1);
0
Ritor1
parents:
diff changeset
7376 pMiscTimer->Pause();
Ritor1
parents:
diff changeset
7377 pEventTimer->Pause();
Ritor1
parents:
diff changeset
7378 dword_5C3418 = v4;
Ritor1
parents:
diff changeset
7379 dword_5C341C = v3;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
7380 _591094_decoration = activeLevelDecoration;
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
7381 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
7382 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
7383 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
7384 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
7385 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
0
Ritor1
parents:
diff changeset
7386 }
Ritor1
parents:
diff changeset
7387 }
Ritor1
parents:
diff changeset
7388
Ritor1
parents:
diff changeset
7389 //----- (004452BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
7390 void __cdecl sub_4452BB()
Ritor1
parents:
diff changeset
7391 {
Ritor1
parents:
diff changeset
7392 pGUIWindow2->Release();
Ritor1
parents:
diff changeset
7393 pGUIWindow2 = 0;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
7394 activeLevelDecoration = _591094_decoration;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7395 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
7396 activeLevelDecoration = NULL;
0
Ritor1
parents:
diff changeset
7397 pEventTimer->Resume();
Ritor1
parents:
diff changeset
7398 }
Ritor1
parents:
diff changeset
7399
Ritor1
parents:
diff changeset
7400 //----- (004465DF) --------------------------------------------------------
Ritor1
parents:
diff changeset
7401 int sub_4465DF_check_season(int a1)
Ritor1
parents:
diff changeset
7402 {
Ritor1
parents:
diff changeset
7403 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
7404 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
7405 int v3; // ecx@2
Ritor1
parents:
diff changeset
7406 int v4; // ecx@3
Ritor1
parents:
diff changeset
7407 char v6; // zf@9
Ritor1
parents:
diff changeset
7408
Ritor1
parents:
diff changeset
7409 v1 = pParty->uCurrentMonth + 1;
Ritor1
parents:
diff changeset
7410 v2 = pParty->uDaysPlayed + 1;
Ritor1
parents:
diff changeset
7411 if ( a1 )
Ritor1
parents:
diff changeset
7412 {
Ritor1
parents:
diff changeset
7413 v3 = a1 - 1;
Ritor1
parents:
diff changeset
7414 if ( v3 )
Ritor1
parents:
diff changeset
7415 {
Ritor1
parents:
diff changeset
7416 v4 = v3 - 1;
Ritor1
parents:
diff changeset
7417 if ( v4 )
Ritor1
parents:
diff changeset
7418 {
Ritor1
parents:
diff changeset
7419 if ( v4 != 1 )
Ritor1
parents:
diff changeset
7420 return 0;
Ritor1
parents:
diff changeset
7421 if ( v1 != 12 )
Ritor1
parents:
diff changeset
7422 {
Ritor1
parents:
diff changeset
7423 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 )
Ritor1
parents:
diff changeset
7424 return 1;
Ritor1
parents:
diff changeset
7425 v6 = v1 == 3;
Ritor1
parents:
diff changeset
7426 LABEL_24:
Ritor1
parents:
diff changeset
7427 if ( !v6 || (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
7428 return 0;
Ritor1
parents:
diff changeset
7429 return 1;
Ritor1
parents:
diff changeset
7430 }
Ritor1
parents:
diff changeset
7431 }
Ritor1
parents:
diff changeset
7432 else
Ritor1
parents:
diff changeset
7433 {
Ritor1
parents:
diff changeset
7434 if ( v1 != 9 )
Ritor1
parents:
diff changeset
7435 {
Ritor1
parents:
diff changeset
7436 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 )
Ritor1
parents:
diff changeset
7437 return 1;
Ritor1
parents:
diff changeset
7438 v6 = v1 == 12;
Ritor1
parents:
diff changeset
7439 goto LABEL_24;
Ritor1
parents:
diff changeset
7440 }
Ritor1
parents:
diff changeset
7441 }
Ritor1
parents:
diff changeset
7442 }
Ritor1
parents:
diff changeset
7443 else
Ritor1
parents:
diff changeset
7444 {
Ritor1
parents:
diff changeset
7445 if ( v1 != 6 )
Ritor1
parents:
diff changeset
7446 {
Ritor1
parents:
diff changeset
7447 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 )
Ritor1
parents:
diff changeset
7448 return 1;
Ritor1
parents:
diff changeset
7449 v6 = v1 == 9;
Ritor1
parents:
diff changeset
7450 goto LABEL_24;
Ritor1
parents:
diff changeset
7451 }
Ritor1
parents:
diff changeset
7452 }
Ritor1
parents:
diff changeset
7453 }
Ritor1
parents:
diff changeset
7454 else
Ritor1
parents:
diff changeset
7455 {
Ritor1
parents:
diff changeset
7456 if ( v1 != 3 )
Ritor1
parents:
diff changeset
7457 {
Ritor1
parents:
diff changeset
7458 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 )
Ritor1
parents:
diff changeset
7459 return 1;
Ritor1
parents:
diff changeset
7460 v6 = v1 == 6;
Ritor1
parents:
diff changeset
7461 goto LABEL_24;
Ritor1
parents:
diff changeset
7462 }
Ritor1
parents:
diff changeset
7463 }
Ritor1
parents:
diff changeset
7464 if ( (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
7465 return 1;
Ritor1
parents:
diff changeset
7466 return 0;
Ritor1
parents:
diff changeset
7467 }
Ritor1
parents:
diff changeset
7468
Ritor1
parents:
diff changeset
7469 //----- (0044861E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7470 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
Ritor1
parents:
diff changeset
7471 {
Ritor1
parents:
diff changeset
7472 unsigned int v2; // eax@2
Ritor1
parents:
diff changeset
7473 unsigned __int16 v3; // di@2
Ritor1
parents:
diff changeset
7474 signed int v4; // esi@5
Ritor1
parents:
diff changeset
7475 BLVFace *v5; // eax@7
Ritor1
parents:
diff changeset
7476 unsigned int *v6; // eax@8
Ritor1
parents:
diff changeset
7477 char *v7; // eax@9
Ritor1
parents:
diff changeset
7478 int v8; // edi@16
Ritor1
parents:
diff changeset
7479 char *v9; // esi@16
Ritor1
parents:
diff changeset
7480 ODMFace *v10; // eax@17
Ritor1
parents:
diff changeset
7481 unsigned int *v11; // eax@19
Ritor1
parents:
diff changeset
7482 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
7483 const char *Str2; // [sp+10h] [bp-14h]@1
Ritor1
parents:
diff changeset
7484 unsigned int v14; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
7485 signed int v15; // [sp+18h] [bp-Ch]@14
Ritor1
parents:
diff changeset
7486 int v16; // [sp+1Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
7487 signed int v17; // [sp+20h] [bp-4h]@4
Ritor1
parents:
diff changeset
7488 signed int v18; // [sp+20h] [bp-4h]@16
Ritor1
parents:
diff changeset
7489
Ritor1
parents:
diff changeset
7490 Str2 = pFilename;
Ritor1
parents:
diff changeset
7491 v14 = uFaceCog;
Ritor1
parents:
diff changeset
7492 if ( uFaceCog )
Ritor1
parents:
diff changeset
7493 {
Ritor1
parents:
diff changeset
7494 v2 = pBitmaps_LOD->LoadTexture(pFilename);
Ritor1
parents:
diff changeset
7495 v3 = v2;
Ritor1
parents:
diff changeset
7496 v12 = v2;
Ritor1
parents:
diff changeset
7497 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 )
Ritor1
parents:
diff changeset
7498 {
Ritor1
parents:
diff changeset
7499 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1);
Ritor1
parents:
diff changeset
7500
Ritor1
parents:
diff changeset
7501 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
7502 {
Ritor1
parents:
diff changeset
7503 v17 = 1;
Ritor1
parents:
diff changeset
7504 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
7505 {
Ritor1
parents:
diff changeset
7506 v4 = 1;
Ritor1
parents:
diff changeset
7507 do
Ritor1
parents:
diff changeset
7508 {
Ritor1
parents:
diff changeset
7509 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 )
Ritor1
parents:
diff changeset
7510 {
Ritor1
parents:
diff changeset
7511 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C];
Ritor1
parents:
diff changeset
7512 if ( BYTE1(v5->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
7513 {
Ritor1
parents:
diff changeset
7514 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
7515 Str2);
Ritor1
parents:
diff changeset
7516 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID;
Ritor1
parents:
diff changeset
7517 if ( *(_WORD *)v6 )
Ritor1
parents:
diff changeset
7518 {
Ritor1
parents:
diff changeset
7519 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6);
Ritor1
parents:
diff changeset
7520 }
Ritor1
parents:
diff changeset
7521 else
Ritor1
parents:
diff changeset
7522 {
Ritor1
parents:
diff changeset
7523 *(_WORD *)v6 = v3;
Ritor1
parents:
diff changeset
7524 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
7525 v7[1] &= 0xBFu;
Ritor1
parents:
diff changeset
7526 }
Ritor1
parents:
diff changeset
7527 }
Ritor1
parents:
diff changeset
7528 else
Ritor1
parents:
diff changeset
7529 {
Ritor1
parents:
diff changeset
7530 v5->uBitmapID = v3;
Ritor1
parents:
diff changeset
7531 }
Ritor1
parents:
diff changeset
7532 }
Ritor1
parents:
diff changeset
7533 ++v17;
Ritor1
parents:
diff changeset
7534 ++v4;
Ritor1
parents:
diff changeset
7535 }
Ritor1
parents:
diff changeset
7536 while ( v17 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
7537 }
Ritor1
parents:
diff changeset
7538 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7539 }
Ritor1
parents:
diff changeset
7540 else
Ritor1
parents:
diff changeset
7541 {
Ritor1
parents:
diff changeset
7542 v15 = 0;
Ritor1
parents:
diff changeset
7543 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
7544 {
Ritor1
parents:
diff changeset
7545 v16 = 0;
Ritor1
parents:
diff changeset
7546 do
Ritor1
parents:
diff changeset
7547 {
Ritor1
parents:
diff changeset
7548 v8 = 0;
Ritor1
parents:
diff changeset
7549 v9 = (char *)&pOutdoor->pBModels[v16].pVertices;
Ritor1
parents:
diff changeset
7550 v18 = 0;
Ritor1
parents:
diff changeset
7551 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 )
Ritor1
parents:
diff changeset
7552 {
Ritor1
parents:
diff changeset
7553 do
Ritor1
parents:
diff changeset
7554 {
Ritor1
parents:
diff changeset
7555 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4));
Ritor1
parents:
diff changeset
7556 if ( v10->sCogNumber == v14 )
Ritor1
parents:
diff changeset
7557 {
Ritor1
parents:
diff changeset
7558 if ( BYTE1(v10->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
7559 {
Ritor1
parents:
diff changeset
7560 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
7561 Str2);
Ritor1
parents:
diff changeset
7562 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272);
Ritor1
parents:
diff changeset
7563 if ( *(_WORD *)v11 )
Ritor1
parents:
diff changeset
7564 {
Ritor1
parents:
diff changeset
7565 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11);
Ritor1
parents:
diff changeset
7566 }
Ritor1
parents:
diff changeset
7567 else
Ritor1
parents:
diff changeset
7568 {
Ritor1
parents:
diff changeset
7569 *(_WORD *)v11 = v12;
Ritor1
parents:
diff changeset
7570 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu;
Ritor1
parents:
diff changeset
7571 }
Ritor1
parents:
diff changeset
7572 }
Ritor1
parents:
diff changeset
7573 else
Ritor1
parents:
diff changeset
7574 {
Ritor1
parents:
diff changeset
7575 v10->uTextureID = v12;
Ritor1
parents:
diff changeset
7576 }
Ritor1
parents:
diff changeset
7577 }
Ritor1
parents:
diff changeset
7578 ++v18;
Ritor1
parents:
diff changeset
7579 v8 += 308;
Ritor1
parents:
diff changeset
7580 }
Ritor1
parents:
diff changeset
7581 while ( v18 < *((_DWORD *)v9 + 2) );
Ritor1
parents:
diff changeset
7582 }
Ritor1
parents:
diff changeset
7583 ++v15;
Ritor1
parents:
diff changeset
7584 ++v16;
Ritor1
parents:
diff changeset
7585 }
Ritor1
parents:
diff changeset
7586 while ( v15 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
7587 }
Ritor1
parents:
diff changeset
7588 }
Ritor1
parents:
diff changeset
7589 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7590 }
Ritor1
parents:
diff changeset
7591 }
Ritor1
parents:
diff changeset
7592 }
Ritor1
parents:
diff changeset
7593
Ritor1
parents:
diff changeset
7594 //----- (0044882F) --------------------------------------------------------
Ritor1
parents:
diff changeset
7595 void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName)
Ritor1
parents:
diff changeset
7596 {
Ritor1
parents:
diff changeset
7597 signed int v3; // ebp@1
Ritor1
parents:
diff changeset
7598 char *v4; // esi@2
Ritor1
parents:
diff changeset
7599 unsigned __int16 v5; // ax@6
Ritor1
parents:
diff changeset
7600 unsigned int v6; // [sp+4h] [bp-8h]@1
Ritor1
parents:
diff changeset
7601 int v7; // [sp+8h] [bp-4h]@1
Ritor1
parents:
diff changeset
7602
Ritor1
parents:
diff changeset
7603 v3 = 0;
Ritor1
parents:
diff changeset
7604 v7 = a2;
Ritor1
parents:
diff changeset
7605 v6 = uCog;
Ritor1
parents:
diff changeset
7606 if ( (signed int)uNumLevelDecorations > 0 )
Ritor1
parents:
diff changeset
7607 {
Ritor1
parents:
diff changeset
7608 v4 = (char *)&pLevelDecorations[0].field_2;
Ritor1
parents:
diff changeset
7609 do
Ritor1
parents:
diff changeset
7610 {
Ritor1
parents:
diff changeset
7611 if ( *((_WORD *)v4 + 9) == v6 )
Ritor1
parents:
diff changeset
7612 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1090
diff changeset
7613 if ( pFileName && _stricmp(pFileName, "0") )
0
Ritor1
parents:
diff changeset
7614 {
Ritor1
parents:
diff changeset
7615 v5 = pDecorationList->GetDecorIdByName(pFileName);
Ritor1
parents:
diff changeset
7616 *((_WORD *)v4 - 1) = v5;
Ritor1
parents:
diff changeset
7617 pDecorationList->InitializeDecorationSprite((signed __int16)v5);
Ritor1
parents:
diff changeset
7618 }
Ritor1
parents:
diff changeset
7619 if ( v7 )
Ritor1
parents:
diff changeset
7620 *v4 &= 0xDFu;
Ritor1
parents:
diff changeset
7621 else
Ritor1
parents:
diff changeset
7622 *v4 |= 0x20u;
Ritor1
parents:
diff changeset
7623 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7624 }
Ritor1
parents:
diff changeset
7625 ++v3;
Ritor1
parents:
diff changeset
7626 v4 += 32;
Ritor1
parents:
diff changeset
7627 }
Ritor1
parents:
diff changeset
7628 while ( v3 < (signed int)uNumLevelDecorations );
Ritor1
parents:
diff changeset
7629 }
Ritor1
parents:
diff changeset
7630 }
Ritor1
parents:
diff changeset
7631
Ritor1
parents:
diff changeset
7632 //----- (0044892E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7633 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
Ritor1
parents:
diff changeset
7634 {
Ritor1
parents:
diff changeset
7635 signed int v3; // esi@2
Ritor1
parents:
diff changeset
7636 signed int v4; // ecx@4
Ritor1
parents:
diff changeset
7637 char *v5; // eax@6
Ritor1
parents:
diff changeset
7638 int v6; // edi@13
Ritor1
parents:
diff changeset
7639 char *v7; // esi@13
Ritor1
parents:
diff changeset
7640 signed int v8; // ecx@13
Ritor1
parents:
diff changeset
7641 ODMFace *v9; // eax@14
Ritor1
parents:
diff changeset
7642 int v10; // [sp+0h] [bp-Ch]@1
Ritor1
parents:
diff changeset
7643 signed int v11; // [sp+4h] [bp-8h]@11
Ritor1
parents:
diff changeset
7644 int v12; // [sp+8h] [bp-4h]@12
Ritor1
parents:
diff changeset
7645
Ritor1
parents:
diff changeset
7646 v10 = sCogNumber;
Ritor1
parents:
diff changeset
7647 if ( sCogNumber )
Ritor1
parents:
diff changeset
7648 {
Ritor1
parents:
diff changeset
7649 v3 = 1;
Ritor1
parents:
diff changeset
7650 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
7651 {
Ritor1
parents:
diff changeset
7652 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
7653 {
Ritor1
parents:
diff changeset
7654 v4 = 1;
Ritor1
parents:
diff changeset
7655 do
Ritor1
parents:
diff changeset
7656 {
Ritor1
parents:
diff changeset
7657 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 )
Ritor1
parents:
diff changeset
7658 {
Ritor1
parents:
diff changeset
7659 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
7660 if ( on )
Ritor1
parents:
diff changeset
7661 *(_DWORD *)v5 |= bit;
Ritor1
parents:
diff changeset
7662 else
Ritor1
parents:
diff changeset
7663 *(_DWORD *)v5 &= ~bit;
Ritor1
parents:
diff changeset
7664 }
Ritor1
parents:
diff changeset
7665 ++v3;
Ritor1
parents:
diff changeset
7666 ++v4;
Ritor1
parents:
diff changeset
7667 }
Ritor1
parents:
diff changeset
7668 while ( v3 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
7669 }
Ritor1
parents:
diff changeset
7670 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7671 }
Ritor1
parents:
diff changeset
7672 else
Ritor1
parents:
diff changeset
7673 {
Ritor1
parents:
diff changeset
7674 v11 = 0;
Ritor1
parents:
diff changeset
7675 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
7676 {
Ritor1
parents:
diff changeset
7677 v12 = 0;
Ritor1
parents:
diff changeset
7678 do
Ritor1
parents:
diff changeset
7679 {
Ritor1
parents:
diff changeset
7680 v6 = 0;
Ritor1
parents:
diff changeset
7681 v7 = (char *)&pOutdoor->pBModels[v12].pVertices;
Ritor1
parents:
diff changeset
7682 v8 = 0;
Ritor1
parents:
diff changeset
7683 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 )
Ritor1
parents:
diff changeset
7684 {
Ritor1
parents:
diff changeset
7685 do
Ritor1
parents:
diff changeset
7686 {
Ritor1
parents:
diff changeset
7687 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4));
Ritor1
parents:
diff changeset
7688 if ( v9->sCogNumber == v10 )
Ritor1
parents:
diff changeset
7689 {
Ritor1
parents:
diff changeset
7690 if ( on )
Ritor1
parents:
diff changeset
7691 v9->uAttributes |= bit;
Ritor1
parents:
diff changeset
7692 else
Ritor1
parents:
diff changeset
7693 v9->uAttributes &= ~bit;
Ritor1
parents:
diff changeset
7694 }
Ritor1
parents:
diff changeset
7695 ++v8;
Ritor1
parents:
diff changeset
7696 v6 += 308;
Ritor1
parents:
diff changeset
7697 }
Ritor1
parents:
diff changeset
7698 while ( v8 < *((_DWORD *)v7 + 2) );
Ritor1
parents:
diff changeset
7699 }
Ritor1
parents:
diff changeset
7700 ++v11;
Ritor1
parents:
diff changeset
7701 ++v12;
Ritor1
parents:
diff changeset
7702 }
Ritor1
parents:
diff changeset
7703 while ( v11 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
7704 }
Ritor1
parents:
diff changeset
7705 }
Ritor1
parents:
diff changeset
7706 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
7707 }
Ritor1
parents:
diff changeset
7708 }
Ritor1
parents:
diff changeset
7709
Ritor1
parents:
diff changeset
7710 //----- (00448A98) --------------------------------------------------------
Ritor1
parents:
diff changeset
7711 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle)
Ritor1
parents:
diff changeset
7712 {
Ritor1
parents:
diff changeset
7713 unsigned int v3; // ebx@1
Ritor1
parents:
diff changeset
7714 unsigned int v4; // ebp@1
Ritor1
parents:
diff changeset
7715 signed int v5; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7716 Actor *v6; // esi@4
0
Ritor1
parents:
diff changeset
7717 size_t v7; // ecx@10
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7718 Actor *v8; // eax@11
0
Ritor1
parents:
diff changeset
7719 unsigned __int16 v9; // dx@14
Ritor1
parents:
diff changeset
7720
Ritor1
parents:
diff changeset
7721 v4 = uGroupID;
Ritor1
parents:
diff changeset
7722 v5 = Standing;
Ritor1
parents:
diff changeset
7723 v3 = uFlag;
Ritor1
parents:
diff changeset
7724 if ( uGroupID )
Ritor1
parents:
diff changeset
7725 {
Ritor1
parents:
diff changeset
7726 if ( bToggle )
Ritor1
parents:
diff changeset
7727 {
Ritor1
parents:
diff changeset
7728 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
7729 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7730 v6 = pActors.data();//[0].uAttributes;
0
Ritor1
parents:
diff changeset
7731 do
Ritor1
parents:
diff changeset
7732 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7733 if ( v6->uGroup == v4 )
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7734 {
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7735 v6->uAttributes |= v3;
0
Ritor1
parents:
diff changeset
7736 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
7737 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7738 v6->uAIState = Disabled;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7739 v6->UpdateAnimation();
0
Ritor1
parents:
diff changeset
7740 }
Ritor1
parents:
diff changeset
7741 }
Ritor1
parents:
diff changeset
7742 ++v5;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7743 ++v6;
0
Ritor1
parents:
diff changeset
7744 }
Ritor1
parents:
diff changeset
7745 while ( v5 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
7746 }
Ritor1
parents:
diff changeset
7747 }
Ritor1
parents:
diff changeset
7748 else
Ritor1
parents:
diff changeset
7749 {
Ritor1
parents:
diff changeset
7750 v7 = uNumActors;
Ritor1
parents:
diff changeset
7751 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
7752 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7753 v8 = pActors.data();//[0].uAIState;
0
Ritor1
parents:
diff changeset
7754 do
Ritor1
parents:
diff changeset
7755 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7756 if ( v8->uGroup == v4 )
0
Ritor1
parents:
diff changeset
7757 {
Ritor1
parents:
diff changeset
7758 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
7759 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7760 v9 = v8->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7761 if ( v8->uAIState != Dead )
0
Ritor1
parents:
diff changeset
7762 {
Ritor1
parents:
diff changeset
7763 if ( v9 != 4 && v9 != 11 )
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7764 v8->uAIState = Standing;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7765 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7766 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7767 LODWORD(v8->uAttributes) &= ~v3;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7768 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7769 ++v8;
0
Ritor1
parents:
diff changeset
7770 --v7;
Ritor1
parents:
diff changeset
7771 }
Ritor1
parents:
diff changeset
7772 while ( v7 );
Ritor1
parents:
diff changeset
7773 }
Ritor1
parents:
diff changeset
7774 }
Ritor1
parents:
diff changeset
7775 }
Ritor1
parents:
diff changeset
7776 }
Ritor1
parents:
diff changeset
7777
Ritor1
parents:
diff changeset
7778 //----- (00448B45) --------------------------------------------------------
Ritor1
parents:
diff changeset
7779 void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
Ritor1
parents:
diff changeset
7780 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7781 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7782 GameUI_Footer_TimeLeft = 0;
0
Ritor1
parents:
diff changeset
7783 }
Ritor1
parents:
diff changeset
7784
Ritor1
parents:
diff changeset
7785 //----- (00448B67) --------------------------------------------------------
790
Nomad
parents: 789 788
diff changeset
7786 void OnTimer(int __unused)
Nomad
parents: 789 788
diff changeset
7787 {
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7788 if (pEventTimer->bPaused)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7789 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7790
790
Nomad
parents: 789 788
diff changeset
7791 if (__unused)
Nomad
parents: 789 788
diff changeset
7792 _5773C0_unused = 0;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7793
790
Nomad
parents: 789 788
diff changeset
7794 auto v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7795 if (!v13)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7796 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7797
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7798 //uint _v2v3 = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7799 //v3 = HIDWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7800 //v2 = LODWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7801
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7802 _5773B8_event_timer = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7803
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7804 for (uint i = 0; i < dword_5B65C8_timers_count; ++i)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7805 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7806 //v4 = (char *)&array_5B5928_timers[0].field_C;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7807 auto timer = array_5B5928_timers + i;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7808 //while ( 1 )
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7809 //{
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7810 //v5 = *(short *)v4;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7811 if (timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7812 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7813 if (v13 < timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7814 timer->time_left_to_fire -= v13;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7815 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7816 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7817 timer->time_left_to_fire = timer->fire_interval;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7818 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7819 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7820 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7821 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7822 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7823 if (timer->next_fire_time < pParty->uTimePlayed)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7824 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7825 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7826 if (timer->field_10)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7827 next_trigger_time = 336 * 60 * 60 * 24; // 1 year
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7828 else if (timer->field_12)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7829 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7830 else if (timer->field_14)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7831 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7832
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7833 timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7834 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
7835 timer->next_fire_time = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
7836
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
7837 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
0
Ritor1
parents:
diff changeset
7838 }
Ritor1
parents:
diff changeset
7839 }
Ritor1
parents:
diff changeset
7840 }
Ritor1
parents:
diff changeset
7841 }
Ritor1
parents:
diff changeset
7842
Ritor1
parents:
diff changeset
7843 //----- (00481D77) --------------------------------------------------------
Ritor1
parents:
diff changeset
7844 void _outdoor_project(RenderVertexSoft *v)
Ritor1
parents:
diff changeset
7845 {
Ritor1
parents:
diff changeset
7846 double v1; // st7@1
Ritor1
parents:
diff changeset
7847 double v2; // st7@1
Ritor1
parents:
diff changeset
7848
Ritor1
parents:
diff changeset
7849 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
7850 v->_rhw = v1;
0
Ritor1
parents:
diff changeset
7851 v2 = v1 * (double)pOutdoorCamera->int_fov_rad;
Ritor1
parents:
diff changeset
7852 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
7853 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
7854 }
Ritor1
parents:
diff changeset
7855
Ritor1
parents:
diff changeset
7856 //----- (00448CF4) --------------------------------------------------------
Ritor1
parents:
diff changeset
7857 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
7858 {
Ritor1
parents:
diff changeset
7859 __int16 v8; // di@1
Ritor1
parents:
diff changeset
7860 __int16 v9; // si@1
Ritor1
parents:
diff changeset
7861 unsigned int v10; // eax@1
Ritor1
parents:
diff changeset
7862 size_t v11; // ebx@2
Ritor1
parents:
diff changeset
7863 signed int v12; // esi@2
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7864 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3
0
Ritor1
parents:
diff changeset
7865 AIDirection a3; // [sp+Ch] [bp-50h]@2
Ritor1
parents:
diff changeset
7866 AIDirection v15; // [sp+28h] [bp-34h]@2
Ritor1
parents:
diff changeset
7867 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
7868
Ritor1
parents:
diff changeset
7869 v8 = typeindex;
Ritor1
parents:
diff changeset
7870 v9 = level;
Ritor1
parents:
diff changeset
7871
Ritor1
parents:
diff changeset
7872 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
7873 //SpawnPointMM7::SpawnPointMM7(&v16);
Ritor1
parents:
diff changeset
7874
Ritor1
parents:
diff changeset
7875 v16.vPosition.x = x;
Ritor1
parents:
diff changeset
7876 v16.vPosition.y = y;
Ritor1
parents:
diff changeset
7877 v16.vPosition.z = z;
Ritor1
parents:
diff changeset
7878 v16.uGroup = group;
Ritor1
parents:
diff changeset
7879 v16.uRadius = 32;
Ritor1
parents:
diff changeset
7880 v16.uKind = 3;
Ritor1
parents:
diff changeset
7881 v16.uIndex = v8 + 2 * v9 + v9;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
7882 v10 = pMapStats->GetMapInfo(pCurrentMapName.data());
0
Ritor1
parents:
diff changeset
7883 if ( v10 )
Ritor1
parents:
diff changeset
7884 {
Ritor1
parents:
diff changeset
7885 v11 = uNumActors;
Ritor1
parents:
diff changeset
7886 SpawnEncounter((MapInfo *)&pMapStats->pInfos[v10], &v16, 0, count, 0);
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7887 memcpy(&v15, Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &a3, 1), sizeof(v15));
0
Ritor1
parents:
diff changeset
7888 v12 = v11;
Ritor1
parents:
diff changeset
7889 if ( (signed int)v11 < (signed int)uNumActors )
Ritor1
parents:
diff changeset
7890 {
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7891 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor )
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7892 {
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7893 pActor->PrepareSprites(0);
0
Ritor1
parents:
diff changeset
7894 ++v12;
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7895 pActor->uYawAngle = v15.uYawAngle;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7896 pActor->dword_000334_unique_name = uUniqueName;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
7897 }
0
Ritor1
parents:
diff changeset
7898 }
Ritor1
parents:
diff changeset
7899 }
Ritor1
parents:
diff changeset
7900 }
Ritor1
parents:
diff changeset
7901
Ritor1
parents:
diff changeset
7902 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
7903
Ritor1
parents:
diff changeset
7904 //----- (0044987B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7905 void sub_44987B(const char *pMapName, MapStartPoint start_point)
0
Ritor1
parents:
diff changeset
7906 {
Ritor1
parents:
diff changeset
7907 const char *v2; // edi@1
Ritor1
parents:
diff changeset
7908
Ritor1
parents:
diff changeset
7909 v2 = pMapName;
Ritor1
parents:
diff changeset
7910 pAudioPlayer->StopChannels(-1, -1);
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 433
diff changeset
7911 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
7912 if ( _stricmp(pCurrentMapName.data(), v2) )
0
Ritor1
parents:
diff changeset
7913 SaveGame(1, 0);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7914
978
9334a8c59c8d uGameState
Ritor1
parents: 973
diff changeset
7915 uGameState = GAME_STATE_2;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
7916 strcpy(pCurrentMapName.data(), v2);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7917 uLevel_StartingPointType = start_point;
0
Ritor1
parents:
diff changeset
7918 }
Ritor1
parents:
diff changeset
7919 // 6BE35C: using guessed type int uLevel_StartingPointType;
Ritor1
parents:
diff changeset
7920
Ritor1
parents:
diff changeset
7921 //----- (004498D5) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7922 void TeleportToStartingPoint(MapStartPoint point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7923 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7924 //unsigned int v1; // ecx@2
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7925 //int v2; // ecx@3
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7926 //int v3; // ecx@4
0
Ritor1
parents:
diff changeset
7927 unsigned __int16 v4; // ax@11
Ritor1
parents:
diff changeset
7928 signed int v5; // ecx@12
Ritor1
parents:
diff changeset
7929 LevelDecoration *v6; // edx@13
Ritor1
parents:
diff changeset
7930 signed int v7; // ecx@17
Ritor1
parents:
diff changeset
7931 int v8; // eax@17
Ritor1
parents:
diff changeset
7932 int v9; // ecx@17
Ritor1
parents:
diff changeset
7933 const char *v10; // [sp-4h] [bp-84h]@6
Ritor1
parents:
diff changeset
7934 char pName[128]; // [sp+8h] [bp-78h]@11
Ritor1
parents:
diff changeset
7935
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7936 switch (point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7937 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7938 case MapStartPoint_Party: v10 = "Party Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7939 case MapStartPoint_North: v10 = "North Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7940 case MapStartPoint_South: v10 = "South Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7941 case MapStartPoint_East: v10 = "East Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7942 case MapStartPoint_West: v10 = "West Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7943 }
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
7944
0
Ritor1
parents:
diff changeset
7945 strcpy(pName, v10);
Ritor1
parents:
diff changeset
7946 v4 = pDecorationList->GetDecorIdByName(pName);
Ritor1
parents:
diff changeset
7947 if ( v4 )
Ritor1
parents:
diff changeset
7948 {
Ritor1
parents:
diff changeset
7949 v5 = 0;
Ritor1
parents:
diff changeset
7950 if ( (signed int)uNumLevelDecorations > 0 )
Ritor1
parents:
diff changeset
7951 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7952 v6 = pLevelDecorations.data();
0
Ritor1
parents:
diff changeset
7953 while ( v6->uDecorationDescID != (signed __int16)v4 )
Ritor1
parents:
diff changeset
7954 {
Ritor1
parents:
diff changeset
7955 ++v5;
Ritor1
parents:
diff changeset
7956 ++v6;
Ritor1
parents:
diff changeset
7957 if ( v5 >= (signed int)uNumLevelDecorations )
Ritor1
parents:
diff changeset
7958 goto LABEL_20;
Ritor1
parents:
diff changeset
7959 }
Ritor1
parents:
diff changeset
7960 v7 = v5;
Ritor1
parents:
diff changeset
7961 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x;
Ritor1
parents:
diff changeset
7962 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y;
Ritor1
parents:
diff changeset
7963 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z;
Ritor1
parents:
diff changeset
7964 pParty->uFallStartY = pParty->vPosition.z;
Ritor1
parents:
diff changeset
7965 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90;
Ritor1
parents:
diff changeset
7966 v9 = pLevelDecorations[v7].field_10_y_rot;
Ritor1
parents:
diff changeset
7967 pParty->sRotationY = v8;
Ritor1
parents:
diff changeset
7968 if ( v9 )
Ritor1
parents:
diff changeset
7969 pParty->sRotationY = v9;
Ritor1
parents:
diff changeset
7970 pParty->sRotationX = 0;
Ritor1
parents:
diff changeset
7971 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
7972 }
Ritor1
parents:
diff changeset
7973 LABEL_20:
Ritor1
parents:
diff changeset
7974 if ( dword_5B65C0 )
Ritor1
parents:
diff changeset
7975 {
Ritor1
parents:
diff changeset
7976 if ( _5B65A8_npcdata_uflags_or_other )
Ritor1
parents:
diff changeset
7977 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other;
Ritor1
parents:
diff changeset
7978 if ( _5B65AC_npcdata_fame_or_other )
Ritor1
parents:
diff changeset
7979 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other;
Ritor1
parents:
diff changeset
7980 if ( _5B65B0_npcdata_rep_or_other )
Ritor1
parents:
diff changeset
7981 {
Ritor1
parents:
diff changeset
7982 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
7983 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
7984 }
Ritor1
parents:
diff changeset
7985 if ( _5B65B4_npcdata_loword_house_or_other )
Ritor1
parents:
diff changeset
7986 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
Ritor1
parents:
diff changeset
7987 if ( _5B65B8_npcdata_hiword_house_or_other )
Ritor1
parents:
diff changeset
7988 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other;
Ritor1
parents:
diff changeset
7989 if ( dword_5B65BC )
Ritor1
parents:
diff changeset
7990 pParty->uFallSpeed = dword_5B65BC;
Ritor1
parents:
diff changeset
7991 }
Ritor1
parents:
diff changeset
7992 _5B65B4_npcdata_loword_house_or_other = -1;
Ritor1
parents:
diff changeset
7993 dword_5B65C0 = 0;
Ritor1
parents:
diff changeset
7994 dword_5B65BC = 0;
Ritor1
parents:
diff changeset
7995 _5B65B8_npcdata_hiword_house_or_other = 0;
Ritor1
parents:
diff changeset
7996 _5B65B0_npcdata_rep_or_other = 0;
Ritor1
parents:
diff changeset
7997 _5B65AC_npcdata_fame_or_other = 0;
Ritor1
parents:
diff changeset
7998 _5B65A8_npcdata_uflags_or_other = 0;
Ritor1
parents:
diff changeset
7999 }
Ritor1
parents:
diff changeset
8000 }
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8001
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8002
0
Ritor1
parents:
diff changeset
8003
Ritor1
parents:
diff changeset
8004 //----- (00449A49) --------------------------------------------------------
Ritor1
parents:
diff changeset
8005 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2)
Ritor1
parents:
diff changeset
8006 {
Ritor1
parents:
diff changeset
8007 int v2; // eax@1
Ritor1
parents:
diff changeset
8008 int v3; // ebx@1
Ritor1
parents:
diff changeset
8009 signed int v4; // esi@2
Ritor1
parents:
diff changeset
8010 int v5; // edx@2
Ritor1
parents:
diff changeset
8011 BLVDoor *v6; // ecx@8
Ritor1
parents:
diff changeset
8012 unsigned int v7; // edx@18
Ritor1
parents:
diff changeset
8013 signed int v8; // esi@19
Ritor1
parents:
diff changeset
8014 int v9; // eax@19
Ritor1
parents:
diff changeset
8015 char Args; // [sp+Ch] [bp-78h]@6
Ritor1
parents:
diff changeset
8016
Ritor1
parents:
diff changeset
8017 LOWORD(v2) = LOWORD(pIndoor->pDoors);
Ritor1
parents:
diff changeset
8018 v3 = a2;
Ritor1
parents:
diff changeset
8019 if ( !pIndoor->pDoors )
Ritor1
parents:
diff changeset
8020 return v2;
Ritor1
parents:
diff changeset
8021 v4 = 0;
Ritor1
parents:
diff changeset
8022 v5 = (int)&pIndoor->pDoors->uDoorID;
Ritor1
parents:
diff changeset
8023 do
Ritor1
parents:
diff changeset
8024 {
Ritor1
parents:
diff changeset
8025 if ( *(int *)v5 == uDoorID )
Ritor1
parents:
diff changeset
8026 break;
Ritor1
parents:
diff changeset
8027 ++v4;
Ritor1
parents:
diff changeset
8028 v5 += 80;
Ritor1
parents:
diff changeset
8029 }
Ritor1
parents:
diff changeset
8030 while ( v4 < 200 );
Ritor1
parents:
diff changeset
8031 if ( v4 >= 200 )
Ritor1
parents:
diff changeset
8032 {
Ritor1
parents:
diff changeset
8033 sprintf(&Args, "Unable to find Door ID: %i!", uDoorID);
Ritor1
parents:
diff changeset
8034 Abortf(&Args);
Ritor1
parents:
diff changeset
8035 }
Ritor1
parents:
diff changeset
8036 v6 = &pIndoor->pDoors[v4];
Ritor1
parents:
diff changeset
8037 if ( v3 == 2 )
Ritor1
parents:
diff changeset
8038 {
Ritor1
parents:
diff changeset
8039 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
8040 if ( (short)v2 == 3 || (short)v2 == 1 )
Ritor1
parents:
diff changeset
8041 return v2;
Ritor1
parents:
diff changeset
8042 if ( (short)v2 )
Ritor1
parents:
diff changeset
8043 goto LABEL_14;
Ritor1
parents:
diff changeset
8044 }
Ritor1
parents:
diff changeset
8045 else
Ritor1
parents:
diff changeset
8046 {
Ritor1
parents:
diff changeset
8047 if ( !v3 )
Ritor1
parents:
diff changeset
8048 {
Ritor1
parents:
diff changeset
8049 LABEL_14:
Ritor1
parents:
diff changeset
8050 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
8051 if ( (short)v2 && (short)v2 != 3 )
Ritor1
parents:
diff changeset
8052 {
Ritor1
parents:
diff changeset
8053 v6->uState = BLVDoor::Closing;
Ritor1
parents:
diff changeset
8054 if ( (short)v2 == 2 )
Ritor1
parents:
diff changeset
8055 {
Ritor1
parents:
diff changeset
8056 LABEL_17:
Ritor1
parents:
diff changeset
8057 v6->uTimeSinceTriggered = 0;
Ritor1
parents:
diff changeset
8058 return v2;
Ritor1
parents:
diff changeset
8059 }
Ritor1
parents:
diff changeset
8060 v7 = v6->uTimeSinceTriggered;
Ritor1
parents:
diff changeset
8061 v2 = 15360;
Ritor1
parents:
diff changeset
8062 if ( v7 != 15360 )
Ritor1
parents:
diff changeset
8063 {
Ritor1
parents:
diff changeset
8064 v8 = v6->uOpenSpeed;
Ritor1
parents:
diff changeset
8065 v9 = v6->uCloseSpeed;
Ritor1
parents:
diff changeset
8066 LABEL_26:
Ritor1
parents:
diff changeset
8067 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8;
Ritor1
parents:
diff changeset
8068 goto LABEL_27;
Ritor1
parents:
diff changeset
8069 }
Ritor1
parents:
diff changeset
8070 goto LABEL_27;
Ritor1
parents:
diff changeset
8071 }
Ritor1
parents:
diff changeset
8072 return v2;
Ritor1
parents:
diff changeset
8073 }
Ritor1
parents:
diff changeset
8074 if ( v3 != 1 )
Ritor1
parents:
diff changeset
8075 return v2;
Ritor1
parents:
diff changeset
8076 }
Ritor1
parents:
diff changeset
8077 LOWORD(v2) = v6->uState;
Ritor1
parents:
diff changeset
8078 if ( (short)v2 != 2 && (short)v2 != 1 )
Ritor1
parents:
diff changeset
8079 {
Ritor1
parents:
diff changeset
8080 v6->uState = BLVDoor::Opening;
Ritor1
parents:
diff changeset
8081 if ( !(short)v2 )
Ritor1
parents:
diff changeset
8082 goto LABEL_17;
Ritor1
parents:
diff changeset
8083 v7 = v6->uTimeSinceTriggered;
Ritor1
parents:
diff changeset
8084 v2 = 15360;
Ritor1
parents:
diff changeset
8085 if ( v7 != 15360 )
Ritor1
parents:
diff changeset
8086 {
Ritor1
parents:
diff changeset
8087 v8 = v6->uCloseSpeed;
Ritor1
parents:
diff changeset
8088 v9 = v6->uOpenSpeed;
Ritor1
parents:
diff changeset
8089 goto LABEL_26;
Ritor1
parents:
diff changeset
8090 }
Ritor1
parents:
diff changeset
8091 LABEL_27:
Ritor1
parents:
diff changeset
8092 v6->uTimeSinceTriggered = v2;
Ritor1
parents:
diff changeset
8093 }
Ritor1
parents:
diff changeset
8094 return v2;
Ritor1
parents:
diff changeset
8095 }
Ritor1
parents:
diff changeset
8096
Ritor1
parents:
diff changeset
8097 //----- (00449B57) --------------------------------------------------------
521
663c4f618f56 Awards tab corrrection
Gloval
parents: 520
diff changeset
8098 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 )
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8099 {
1113
39eaa6b00141 something to bool cast (performance warning) mostly fixed
Grumpy7
parents: 1112
diff changeset
8100 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0;
0
Ritor1
parents:
diff changeset
8101 }
Ritor1
parents:
diff changeset
8102
Ritor1
parents:
diff changeset
8103 //----- (00449B7E) --------------------------------------------------------
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8104 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
0
Ritor1
parents:
diff changeset
8105 {
Ritor1
parents:
diff changeset
8106 signed int v3; // esi@1
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8107 unsigned char set_bit; // edx@1
0
Ritor1
parents:
diff changeset
8108
Ritor1
parents:
diff changeset
8109 v3 = a2 - 1;
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8110 set_bit = 0x80 >> v3 % 8;
0
Ritor1
parents:
diff changeset
8111 if ( bToggle )
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8112 pArray[v3 / 8] |= set_bit;
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8113 else
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
8114 pArray[v3 / 8] &= ~set_bit;
0
Ritor1
parents:
diff changeset
8115 }
Ritor1
parents:
diff changeset
8116
Ritor1
parents:
diff changeset
8117 //----- (0044C175) --------------------------------------------------------
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1119
diff changeset
8118 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds )
502b8b2e36b4 font cleaning
Gloval
parents: 1119
diff changeset
8119 {
0
Ritor1
parents:
diff changeset
8120 unsigned int v2; // esi@1
Ritor1
parents:
diff changeset
8121 int i; // eax@1
Ritor1
parents:
diff changeset
8122
Ritor1
parents:
diff changeset
8123 v2 = uNumSeconds;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
8124 strcpy(GameUI_Footer_TimedString.data(), pString);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
8125 GameUI_Footer_TimeLeft = 1000 * v2 + GetTickCount();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
8126 for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
0
Ritor1
parents:
diff changeset
8127 i > 450;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
8128 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
8129 byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
0
Ritor1
parents:
diff changeset
8130 }
Ritor1
parents:
diff changeset
8131
Ritor1
parents:
diff changeset
8132 //----- (0044C1D0) --------------------------------------------------------
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8133 void ShowNothingHereStatus()
0
Ritor1
parents:
diff changeset
8134 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
8135 if ( !GameUI_Footer_TimeLeft )
0
Ritor1
parents:
diff changeset
8136 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
Ritor1
parents:
diff changeset
8137 }
Ritor1
parents:
diff changeset
8138
Ritor1
parents:
diff changeset
8139 //----- (0044C28B) --------------------------------------------------------
Ritor1
parents:
diff changeset
8140 signed int __cdecl const_2()
Ritor1
parents:
diff changeset
8141 {
Ritor1
parents:
diff changeset
8142 return 2;
Ritor1
parents:
diff changeset
8143 }
Ritor1
parents:
diff changeset
8144
Ritor1
parents:
diff changeset
8145 //----- (0044C28F) --------------------------------------------------------
Ritor1
parents:
diff changeset
8146 bool __cdecl sub_44C28F_open_nwc_dungeon()
Ritor1
parents:
diff changeset
8147 {
Ritor1
parents:
diff changeset
8148 bool result; // eax@1
Ritor1
parents:
diff changeset
8149
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
8150 result = _stricmp("nwc.blv", pCurrentMapName.data());
0
Ritor1
parents:
diff changeset
8151 if ( result )
Ritor1
parents:
diff changeset
8152 {
Ritor1
parents:
diff changeset
8153 _5B65A8_npcdata_uflags_or_other = 0;
Ritor1
parents:
diff changeset
8154 _5B65AC_npcdata_fame_or_other = 0;
Ritor1
parents:
diff changeset
8155 _5B65B0_npcdata_rep_or_other = 0;
Ritor1
parents:
diff changeset
8156 _5B65B4_npcdata_loword_house_or_other = 0;
Ritor1
parents:
diff changeset
8157 _5B65B8_npcdata_hiword_house_or_other = 0;
Ritor1
parents:
diff changeset
8158 dword_5B65BC = 0;
Ritor1
parents:
diff changeset
8159 dword_5B65C0 = 0;
Ritor1
parents:
diff changeset
8160 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
8161 sub_44987B("nwc.blv", MapStartPoint_Party);
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
8162 pCurrentScreen = SCREEN_GAME;
0
Ritor1
parents:
diff changeset
8163 result = 1;
Ritor1
parents:
diff changeset
8164 }
Ritor1
parents:
diff changeset
8165 return result;
Ritor1
parents:
diff changeset
8166 }
Ritor1
parents:
diff changeset
8167
Ritor1
parents:
diff changeset
8168 //----- (0044C2F4) --------------------------------------------------------
1113
39eaa6b00141 something to bool cast (performance warning) mostly fixed
Grumpy7
parents: 1112
diff changeset
8169 bool LevelDecoration::IsInteractive()
0
Ritor1
parents:
diff changeset
8170 {
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8171 switch (uDecorationDescID)
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8172 {
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8173 case 4: // trash pile
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8174 case 5: // campfire
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8175 case 6: // cauldron
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8176 case 11: // fruit plate
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8177 case 13: // trash pile
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8178 case 14: // dirt
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8179 case 24: // keg
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8180 case 184: // fire
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8181 case 187: // fire
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8182 case 190: // fire
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8183 return true;
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8184 }
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8185
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8186 if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8187 return true;
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8188 if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8189 return true;
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8190
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8191 return false;
0
Ritor1
parents:
diff changeset
8192 }
Ritor1
parents:
diff changeset
8193
Ritor1
parents:
diff changeset
8194 //----- (0044C362) --------------------------------------------------------
Ritor1
parents:
diff changeset
8195 void Vec3_int_::Normalize_float()
Ritor1
parents:
diff changeset
8196 {
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
8197 //Vec3_int_ *v1; // esi@1
0
Ritor1
parents:
diff changeset
8198 double v2; // st6@1
Ritor1
parents:
diff changeset
8199 float v3; // ST20_4@1
Ritor1
parents:
diff changeset
8200 double v4; // st5@1
Ritor1
parents:
diff changeset
8201 float v5; // ST18_4@1
Ritor1
parents:
diff changeset
8202 double v6; // st4@1
Ritor1
parents:
diff changeset
8203 float v7; // ST14_4@1
Ritor1
parents:
diff changeset
8204 float v8; // ST24_4@1
Ritor1
parents:
diff changeset
8205 float v9; // ST20_4@1
Ritor1
parents:
diff changeset
8206 double v10; // ST0C_8@1
Ritor1
parents:
diff changeset
8207 float v11; // ST18_4@1
Ritor1
parents:
diff changeset
8208 double v12; // ST0C_8@1
Ritor1
parents:
diff changeset
8209 float v13; // ST14_4@1
Ritor1
parents:
diff changeset
8210 double v14; // ST0C_8@1
Ritor1
parents:
diff changeset
8211
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8212 assert(false);
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
8213 //v1 = this;
0
Ritor1
parents:
diff changeset
8214 v2 = (double)this->x * 0.000015258789;
Ritor1
parents:
diff changeset
8215 v3 = v2;
Ritor1
parents:
diff changeset
8216 v4 = (double)this->y * 0.000015258789;
Ritor1
parents:
diff changeset
8217 v5 = v4;
Ritor1
parents:
diff changeset
8218 v6 = (double)this->z * 0.000015258789;
Ritor1
parents:
diff changeset
8219 v7 = v6;
Ritor1
parents:
diff changeset
8220 v8 = 1.0 / sqrt(v6 * v6 + v4 * v4 + v2 * v2);
Ritor1
parents:
diff changeset
8221 v9 = v8 * v3 * 65536.0;
Ritor1
parents:
diff changeset
8222 v10 = v9 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
8223 this->x = LODWORD(v10);
0
Ritor1
parents:
diff changeset
8224 v11 = v8 * v5 * 65536.0;
Ritor1
parents:
diff changeset
8225 v12 = v11 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
8226 this->y = LODWORD(v12);
0
Ritor1
parents:
diff changeset
8227 v13 = v8 * v7 * 65536.0;
Ritor1
parents:
diff changeset
8228 v14 = v13 + 6.7553994e15;
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
8229 this->z = LODWORD(v14);
0
Ritor1
parents:
diff changeset
8230 }
Ritor1
parents:
diff changeset
8231
Ritor1
parents:
diff changeset
8232 //----- (00401000) --------------------------------------------------------
Ritor1
parents:
diff changeset
8233 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int))
Ritor1
parents:
diff changeset
8234 {
Ritor1
parents:
diff changeset
8235 void *v4; // esi@2
Ritor1
parents:
diff changeset
8236 int v5; // edi@2
Ritor1
parents:
diff changeset
8237
Ritor1
parents:
diff changeset
8238 if ( numObjs - 1 >= 0 )
Ritor1
parents:
diff changeset
8239 {
Ritor1
parents:
diff changeset
8240 v4 = a1;
Ritor1
parents:
diff changeset
8241 v5 = numObjs;
Ritor1
parents:
diff changeset
8242 do
Ritor1
parents:
diff changeset
8243 {
Ritor1
parents:
diff changeset
8244 constructor((int)v4);
Ritor1
parents:
diff changeset
8245 v4 = (char *)v4 + objSize;
Ritor1
parents:
diff changeset
8246 --v5;
Ritor1
parents:
diff changeset
8247 }
Ritor1
parents:
diff changeset
8248 while ( v5 );
Ritor1
parents:
diff changeset
8249 }
Ritor1
parents:
diff changeset
8250 }
Ritor1
parents:
diff changeset
8251
Ritor1
parents:
diff changeset
8252 // 4F75D8: using guessed type int ai_arrays_size;
Ritor1
parents:
diff changeset
8253
1295
86a83e12d795 moving files
Ritor1
parents: 1294
diff changeset
8254 // 4F75D8: using guessed type int ai_arrays_size;
0
Ritor1
parents:
diff changeset
8255
Ritor1
parents:
diff changeset
8256 //----- (0040261D) --------------------------------------------------------
Ritor1
parents:
diff changeset
8257 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
Ritor1
parents:
diff changeset
8258 {
Ritor1
parents:
diff changeset
8259 int result; // eax@1
Ritor1
parents:
diff changeset
8260
Ritor1
parents:
diff changeset
8261 result = this->count;
Ritor1
parents:
diff changeset
8262 if ( this->count < 100 )
Ritor1
parents:
diff changeset
8263 {
Ritor1
parents:
diff changeset
8264 this->pIDs[result] = uID;
Ritor1
parents:
diff changeset
8265 this->pXs[this->count] = x;
Ritor1
parents:
diff changeset
8266 this->pYs[this->count] = y;
Ritor1
parents:
diff changeset
8267 this->pZs[this->count] = z;
Ritor1
parents:
diff changeset
8268 this->field_324[this->count] = a3;
Ritor1
parents:
diff changeset
8269 this->field_3EC[this->count] = a8;
Ritor1
parents:
diff changeset
8270 result = this->count;
Ritor1
parents:
diff changeset
8271 this->field_450[this->count++] = a7;
Ritor1
parents:
diff changeset
8272 }
Ritor1
parents:
diff changeset
8273 return result;
Ritor1
parents:
diff changeset
8274 }
Ritor1
parents:
diff changeset
8275
Ritor1
parents:
diff changeset
8276 //----- (00402CAE) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
8277 int stru193_math::Cos(int angle)
0
Ritor1
parents:
diff changeset
8278 {
Ritor1
parents:
diff changeset
8279 int v2; // eax@1
Ritor1
parents:
diff changeset
8280
Ritor1
parents:
diff changeset
8281 //a2: (angle - uIntegerHalfPi) for sin(angle)
Ritor1
parents:
diff changeset
8282 // (angle) for cos(angle)
Ritor1
parents:
diff changeset
8283
Ritor1
parents:
diff changeset
8284 v2 = uDoublePiMask & angle;
Ritor1
parents:
diff changeset
8285
Ritor1
parents:
diff changeset
8286 if ( v2 > uIntegerPi )
Ritor1
parents:
diff changeset
8287 v2 = uIntegerDoublePi - v2;
Ritor1
parents:
diff changeset
8288 if ( v2 >= uIntegerHalfPi )
Ritor1
parents:
diff changeset
8289 return -pCosTable[uIntegerPi - v2];
Ritor1
parents:
diff changeset
8290 else
Ritor1
parents:
diff changeset
8291 return pCosTable[v2];
Ritor1
parents:
diff changeset
8292 }
Ritor1
parents:
diff changeset
8293