annotate mm7_4.cpp @ 1384:b51332ab228f

changed a few member variables in Player to slightly less confusing names
author Grumpy7
date Tue, 16 Jul 2013 20:51:29 +0200
parents 5572e7b02f45
children 613c77e51e38
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1110
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1110
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1110
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1110
diff changeset
4
198
e6e348d66a75 Some work on spellbook
Nomad
parents: 194
diff changeset
5 #include <assert.h>
0
Ritor1
parents:
diff changeset
6
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
7 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
8 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
9 #include "VideoPlayer.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
10 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
11 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
12 #include "OutdoorCamera.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
13 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
14 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
15 #include "stru11.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
16 #include "stru12.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
17
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
18 #include "LightmapBuilder.h"
341
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
19 #include "MM7.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 "Party.h"
Ritor1
parents:
diff changeset
25 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
26 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1275
diff changeset
27 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
28 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
29 #include "LOD.h"
Ritor1
parents:
diff changeset
30 #include "Actor.h"
Ritor1
parents:
diff changeset
31 #include "Allocator.h"
Ritor1
parents:
diff changeset
32 #include "Events.h"
Ritor1
parents:
diff changeset
33 #include "Viewport.h"
Ritor1
parents:
diff changeset
34 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
35 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
36 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
37 #include "ObjectList.h"
Ritor1
parents:
diff changeset
38 #include "DecorationList.h"
Ritor1
parents:
diff changeset
39 #include "Time.h"
Ritor1
parents:
diff changeset
40 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
41 #include "PlayerFrameTable.h"
Ritor1
parents:
diff changeset
42 #include "Awards.h"
Ritor1
parents:
diff changeset
43 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
44 #include "Events2D.h"
Ritor1
parents:
diff changeset
45 #include "stru159.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 180
diff changeset
46 #include "texts.h"
0
Ritor1
parents:
diff changeset
47 #include "Log.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1295
diff changeset
48 #include "UI\UIHouses.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
49 #include "Lights.h"
0
Ritor1
parents:
diff changeset
50
Ritor1
parents:
diff changeset
51 //----- (0046CC4B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
52 void __cdecl check_event_triggers()
0
Ritor1
parents:
diff changeset
53 {
Ritor1
parents:
diff changeset
54 int v0; // eax@1
Ritor1
parents:
diff changeset
55 LevelDecoration *v1; // esi@2
Ritor1
parents:
diff changeset
56 signed int v2; // edi@2
Ritor1
parents:
diff changeset
57 int v3; // ebx@2
Ritor1
parents:
diff changeset
58 int v4; // eax@3
Ritor1
parents:
diff changeset
59 int v5; // ebx@3
Ritor1
parents:
diff changeset
60 unsigned int v6; // ecx@3
Ritor1
parents:
diff changeset
61 unsigned int v7; // edx@6
Ritor1
parents:
diff changeset
62 unsigned int v8; // edx@8
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
63 Actor *v9; // edi@13
0
Ritor1
parents:
diff changeset
64 int v10; // ebx@14
Ritor1
parents:
diff changeset
65 int v11; // eax@14
Ritor1
parents:
diff changeset
66 int v12; // ebx@14
Ritor1
parents:
diff changeset
67 unsigned int v13; // ecx@14
Ritor1
parents:
diff changeset
68 int v14; // edx@15
Ritor1
parents:
diff changeset
69 unsigned int v15; // edx@17
Ritor1
parents:
diff changeset
70 unsigned int v16; // edx@19
Ritor1
parents:
diff changeset
71 char *v17; // edi@25
Ritor1
parents:
diff changeset
72 int v18; // ebx@26
Ritor1
parents:
diff changeset
73 int v19; // eax@26
Ritor1
parents:
diff changeset
74 int v20; // ebx@26
Ritor1
parents:
diff changeset
75 unsigned int v21; // ecx@26
Ritor1
parents:
diff changeset
76 int v22; // edx@27
Ritor1
parents:
diff changeset
77 unsigned int v23; // edx@29
Ritor1
parents:
diff changeset
78 unsigned int v24; // edx@31
Ritor1
parents:
diff changeset
79 int v25; // [sp+0h] [bp-24h]@3
Ritor1
parents:
diff changeset
80 int v26; // [sp+0h] [bp-24h]@14
Ritor1
parents:
diff changeset
81 int v27; // [sp+0h] [bp-24h]@26
Ritor1
parents:
diff changeset
82 int v28; // [sp+4h] [bp-20h]@3
Ritor1
parents:
diff changeset
83 int v29; // [sp+4h] [bp-20h]@14
Ritor1
parents:
diff changeset
84 int v30; // [sp+4h] [bp-20h]@26
Ritor1
parents:
diff changeset
85 signed int v31; // [sp+8h] [bp-1Ch]@2
Ritor1
parents:
diff changeset
86 int v32; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
87 int v33; // [sp+10h] [bp-14h]@2
Ritor1
parents:
diff changeset
88 int i; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
89 int v35; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
90 int v36; // [sp+1Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
91 signed int v37; // [sp+1Ch] [bp-8h]@12
Ritor1
parents:
diff changeset
92 signed int v38; // [sp+20h] [bp-4h]@24
Ritor1
parents:
diff changeset
93
Ritor1
parents:
diff changeset
94 v0 = 0;
Ritor1
parents:
diff changeset
95 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i )
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]];
Ritor1
parents:
diff changeset
98 v2 = v1->field_18;
Ritor1
parents:
diff changeset
99 v3 = v1->vPosition.y;
Ritor1
parents:
diff changeset
100 v33 = v1->vPosition.x;
Ritor1
parents:
diff changeset
101 v32 = v1->vPosition.y;
Ritor1
parents:
diff changeset
102 v35 = v1->vPosition.z;
Ritor1
parents:
diff changeset
103 v31 = v1->field_18;
Ritor1
parents:
diff changeset
104 if ( v1->field_2 & 1 )
Ritor1
parents:
diff changeset
105 {
Ritor1
parents:
diff changeset
106 v36 = abs(v1->vPosition.x - pParty->vPosition.x);
Ritor1
parents:
diff changeset
107 v25 = abs(v3 - pParty->vPosition.y);
Ritor1
parents:
diff changeset
108 v28 = abs(v35 - pParty->vPosition.z);
Ritor1
parents:
diff changeset
109 v4 = v36;
Ritor1
parents:
diff changeset
110 v5 = v25;
Ritor1
parents:
diff changeset
111 v6 = v28;
Ritor1
parents:
diff changeset
112 if ( v36 < v25 )
Ritor1
parents:
diff changeset
113 {
Ritor1
parents:
diff changeset
114 v4 = v25;
Ritor1
parents:
diff changeset
115 v5 = v36;
Ritor1
parents:
diff changeset
116 }
Ritor1
parents:
diff changeset
117 if ( v4 < v28 )
Ritor1
parents:
diff changeset
118 {
Ritor1
parents:
diff changeset
119 v7 = v4;
Ritor1
parents:
diff changeset
120 v4 = v28;
Ritor1
parents:
diff changeset
121 v6 = v7;
Ritor1
parents:
diff changeset
122 }
Ritor1
parents:
diff changeset
123 if ( v5 < (signed int)v6 )
Ritor1
parents:
diff changeset
124 {
Ritor1
parents:
diff changeset
125 v8 = v6;
Ritor1
parents:
diff changeset
126 v6 = v5;
Ritor1
parents:
diff changeset
127 v5 = v8;
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 )
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
130 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1);
0
Ritor1
parents:
diff changeset
131 }
Ritor1
parents:
diff changeset
132 if ( v1->field_2 & 2 )
Ritor1
parents:
diff changeset
133 {
Ritor1
parents:
diff changeset
134 v37 = 0;
Ritor1
parents:
diff changeset
135 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
136 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
137 v9 = pActors.data();//[0].vPosition.y;
0
Ritor1
parents:
diff changeset
138 do
Ritor1
parents:
diff changeset
139 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
140 v10 = abs(v33 - v9->vPosition.x);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
141 v29 = abs(v32 - v9->vPosition.y);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
142 v26 = abs(v35 - v9->vPosition.z);
0
Ritor1
parents:
diff changeset
143 v11 = v10;
Ritor1
parents:
diff changeset
144 v12 = v29;
Ritor1
parents:
diff changeset
145 v13 = v26;
Ritor1
parents:
diff changeset
146 if ( v11 < v29 )
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 v14 = v11;
Ritor1
parents:
diff changeset
149 v11 = v29;
Ritor1
parents:
diff changeset
150 v12 = v14;
Ritor1
parents:
diff changeset
151 }
Ritor1
parents:
diff changeset
152 if ( v11 < v26 )
Ritor1
parents:
diff changeset
153 {
Ritor1
parents:
diff changeset
154 v15 = v11;
Ritor1
parents:
diff changeset
155 v11 = v26;
Ritor1
parents:
diff changeset
156 v13 = v15;
Ritor1
parents:
diff changeset
157 }
Ritor1
parents:
diff changeset
158 if ( v12 < (signed int)v13 )
Ritor1
parents:
diff changeset
159 {
Ritor1
parents:
diff changeset
160 v16 = v13;
Ritor1
parents:
diff changeset
161 v13 = v12;
Ritor1
parents:
diff changeset
162 v12 = v16;
Ritor1
parents:
diff changeset
163 }
Ritor1
parents:
diff changeset
164 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 )
Ritor1
parents:
diff changeset
165 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
166 ++v37;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
167 ++v9;
0
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169 while ( v37 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
170 }
Ritor1
parents:
diff changeset
171 }
Ritor1
parents:
diff changeset
172 if ( v1->field_2 & 4 )
Ritor1
parents:
diff changeset
173 {
Ritor1
parents:
diff changeset
174 v38 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
175 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
176 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
177 v17 = (char *)&pSpriteObjects[0].vPosition.y;
0
Ritor1
parents:
diff changeset
178 do
Ritor1
parents:
diff changeset
179 {
Ritor1
parents:
diff changeset
180 v18 = abs(v33 - *((int *)v17 - 1));
Ritor1
parents:
diff changeset
181 v30 = abs(v32 - *(int *)v17);
Ritor1
parents:
diff changeset
182 v27 = abs(v35 - *((int *)v17 + 1));
Ritor1
parents:
diff changeset
183 v19 = v18;
Ritor1
parents:
diff changeset
184 v20 = v30;
Ritor1
parents:
diff changeset
185 v21 = v27;
Ritor1
parents:
diff changeset
186 if ( v19 < v30 )
Ritor1
parents:
diff changeset
187 {
Ritor1
parents:
diff changeset
188 v22 = v19;
Ritor1
parents:
diff changeset
189 v19 = v30;
Ritor1
parents:
diff changeset
190 v20 = v22;
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 if ( v19 < v27 )
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 v23 = v19;
Ritor1
parents:
diff changeset
195 v19 = v27;
Ritor1
parents:
diff changeset
196 v21 = v23;
Ritor1
parents:
diff changeset
197 }
Ritor1
parents:
diff changeset
198 if ( v20 < (signed int)v21 )
Ritor1
parents:
diff changeset
199 {
Ritor1
parents:
diff changeset
200 v24 = v21;
Ritor1
parents:
diff changeset
201 v21 = v20;
Ritor1
parents:
diff changeset
202 v20 = v24;
Ritor1
parents:
diff changeset
203 }
Ritor1
parents:
diff changeset
204 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 )
Ritor1
parents:
diff changeset
205 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
206 ++v38;
Ritor1
parents:
diff changeset
207 v17 += 112;
Ritor1
parents:
diff changeset
208 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
209 while ( v38 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
210 }
Ritor1
parents:
diff changeset
211 }
Ritor1
parents:
diff changeset
212 v0 = i + 1;
Ritor1
parents:
diff changeset
213 }
Ritor1
parents:
diff changeset
214 }
Ritor1
parents:
diff changeset
215 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
Ritor1
parents:
diff changeset
216
Ritor1
parents:
diff changeset
217 //----- (0046D8E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
218 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4)
Ritor1
parents:
diff changeset
219 {
Ritor1
parents:
diff changeset
220 int v4; // ebx@1
Ritor1
parents:
diff changeset
221 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
222 BSPModel *v6; // edi@3
Ritor1
parents:
diff changeset
223 ODMFace *v7; // esi@10
Ritor1
parents:
diff changeset
224 unsigned __int8 v8; // al@10
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 659
diff changeset
225 signed __int16 *v9; // eax@18
0
Ritor1
parents:
diff changeset
226 int v10; // edx@19
Ritor1
parents:
diff changeset
227 int v11; // ecx@21
Ritor1
parents:
diff changeset
228 int v12; // ecx@23
Ritor1
parents:
diff changeset
229 signed int v13; // eax@25
Ritor1
parents:
diff changeset
230 int v14; // edx@27
Ritor1
parents:
diff changeset
231 int v15; // edx@29
Ritor1
parents:
diff changeset
232 int v16; // ST18_4@29
Ritor1
parents:
diff changeset
233 signed int v17; // edx@29
Ritor1
parents:
diff changeset
234 signed __int64 v18; // qtt@29
Ritor1
parents:
diff changeset
235 int v19; // eax@35
Ritor1
parents:
diff changeset
236 signed int v20; // ecx@37
Ritor1
parents:
diff changeset
237 signed int v22; // ebx@42
Ritor1
parents:
diff changeset
238 unsigned int v23; // esi@43
Ritor1
parents:
diff changeset
239 int v24; // edx@44
Ritor1
parents:
diff changeset
240 int v25; // eax@44
Ritor1
parents:
diff changeset
241 int v26; // [sp+Ch] [bp-38h]@7
Ritor1
parents:
diff changeset
242 int v27; // [sp+10h] [bp-34h]@21
Ritor1
parents:
diff changeset
243 int v28; // [sp+18h] [bp-2Ch]@21
Ritor1
parents:
diff changeset
244 int v29; // [sp+1Ch] [bp-28h]@2
Ritor1
parents:
diff changeset
245 unsigned int v30; // [sp+20h] [bp-24h]@8
Ritor1
parents:
diff changeset
246 signed int v31; // [sp+24h] [bp-20h]@1
Ritor1
parents:
diff changeset
247 signed int v32; // [sp+28h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
248 int v33; // [sp+2Ch] [bp-18h]@7
Ritor1
parents:
diff changeset
249 bool v34; // [sp+30h] [bp-14h]@21
Ritor1
parents:
diff changeset
250 bool v35; // [sp+34h] [bp-10h]@23
Ritor1
parents:
diff changeset
251 signed int v36; // [sp+38h] [bp-Ch]@17
Ritor1
parents:
diff changeset
252 signed int v37; // [sp+38h] [bp-Ch]@21
Ritor1
parents:
diff changeset
253 signed int v38; // [sp+38h] [bp-Ch]@42
Ritor1
parents:
diff changeset
254 signed int v39; // [sp+3Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
255 signed int v40; // [sp+40h] [bp-4h]@1
Ritor1
parents:
diff changeset
256
Ritor1
parents:
diff changeset
257 dword_720ED0[0] = -1;
Ritor1
parents:
diff changeset
258 dword_720E80[0] = -1;
Ritor1
parents:
diff changeset
259 v4 = a1;
Ritor1
parents:
diff changeset
260 v5 = 0;
Ritor1
parents:
diff changeset
261 v40 = a2;
Ritor1
parents:
diff changeset
262 v31 = v4;
Ritor1
parents:
diff changeset
263 v39 = 1;
Ritor1
parents:
diff changeset
264 dword_720F20[0] = 10000;
Ritor1
parents:
diff changeset
265 v32 = 0;
Ritor1
parents:
diff changeset
266 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
267 {
Ritor1
parents:
diff changeset
268 v29 = 0;
Ritor1
parents:
diff changeset
269 do
Ritor1
parents:
diff changeset
270 {
Ritor1
parents:
diff changeset
271 v6 = &pOutdoor->pBModels[v29];
Ritor1
parents:
diff changeset
272 if ( v4 <= pOutdoor->pBModels[v29].sMaxX )
Ritor1
parents:
diff changeset
273 {
Ritor1
parents:
diff changeset
274 if ( v4 >= v6->sMinX )
Ritor1
parents:
diff changeset
275 {
Ritor1
parents:
diff changeset
276 if ( v40 <= v6->sMaxY )
Ritor1
parents:
diff changeset
277 {
Ritor1
parents:
diff changeset
278 if ( v40 >= v6->sMinY )
Ritor1
parents:
diff changeset
279 {
Ritor1
parents:
diff changeset
280 v33 = v5;
Ritor1
parents:
diff changeset
281 v26 = v6->uNumFaces;
Ritor1
parents:
diff changeset
282 if ( (signed int)v6->uNumFaces > (signed int)v5 )
Ritor1
parents:
diff changeset
283 {
Ritor1
parents:
diff changeset
284 v30 = v5;
Ritor1
parents:
diff changeset
285 while ( 1 )
Ritor1
parents:
diff changeset
286 {
Ritor1
parents:
diff changeset
287 v7 = (ODMFace *)((char *)v6->pFaces + v30);
Ritor1
parents:
diff changeset
288 v8 = v7->uPolygonType;
Ritor1
parents:
diff changeset
289 if ( (v8 == 5 || v8 == 6)
Ritor1
parents:
diff changeset
290 && !(BYTE3(v7->uAttributes) & 0x20)
Ritor1
parents:
diff changeset
291 && v4 <= v7->pBoundingBox.x2
Ritor1
parents:
diff changeset
292 && v4 >= v7->pBoundingBox.x1
Ritor1
parents:
diff changeset
293 && v40 <= v7->pBoundingBox.y2
Ritor1
parents:
diff changeset
294 && v40 >= v7->pBoundingBox.y1 )
Ritor1
parents:
diff changeset
295 {
Ritor1
parents:
diff changeset
296 v36 = v5;
Ritor1
parents:
diff changeset
297 if ( v7->uNumVertices )
Ritor1
parents:
diff changeset
298 {
Ritor1
parents:
diff changeset
299 v9 = v7->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
300 do
Ritor1
parents:
diff changeset
301 {
Ritor1
parents:
diff changeset
302 v10 = 2 * v36;
Ritor1
parents:
diff changeset
303 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x);
Ritor1
parents:
diff changeset
304 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y);
Ritor1
parents:
diff changeset
305 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x);
Ritor1
parents:
diff changeset
306 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y);
Ritor1
parents:
diff changeset
307 ++v9;
Ritor1
parents:
diff changeset
308 }
Ritor1
parents:
diff changeset
309 while ( v36 < v7->uNumVertices );
Ritor1
parents:
diff changeset
310 v4 = v31;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 v27 = 2 * v7->uNumVertices;
Ritor1
parents:
diff changeset
313 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0];
Ritor1
parents:
diff changeset
314 word_720CE0_ys[v27] = word_720CE0_ys[0];
Ritor1
parents:
diff changeset
315 v11 = 0;
Ritor1
parents:
diff changeset
316 v34 = word_720CE0_ys[0] >= v40;
Ritor1
parents:
diff changeset
317 v37 = 0;
Ritor1
parents:
diff changeset
318 v28 = 0;
Ritor1
parents:
diff changeset
319 if ( v27 > 0 )
Ritor1
parents:
diff changeset
320 {
Ritor1
parents:
diff changeset
321 do
Ritor1
parents:
diff changeset
322 {
Ritor1
parents:
diff changeset
323 if ( v37 >= 2 )
Ritor1
parents:
diff changeset
324 break;
Ritor1
parents:
diff changeset
325 v12 = v11;
Ritor1
parents:
diff changeset
326 v4 = v31;
Ritor1
parents:
diff changeset
327 v35 = word_720CE0_ys[v12 + 1] >= v40;
Ritor1
parents:
diff changeset
328 if ( v34 != v35 )
Ritor1
parents:
diff changeset
329 {
Ritor1
parents:
diff changeset
330 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
331 v14 = v13 | (word_720DB0_xs[v12] < v31);
0
Ritor1
parents:
diff changeset
332 if ( v14 != 3 )
Ritor1
parents:
diff changeset
333 {
Ritor1
parents:
diff changeset
334 if ( !v14
Ritor1
parents:
diff changeset
335 || (v15 = word_720CE0_ys[v12],
Ritor1
parents:
diff changeset
336 v16 = word_720CE0_ys[v12 + 1] - v15,
Ritor1
parents:
diff changeset
337 v17 = v40 - v15,
Ritor1
parents:
diff changeset
338 LODWORD(v18) = v17 << 16,
Ritor1
parents:
diff changeset
339 HIDWORD(v18) = v17 >> 16,
Ritor1
parents:
diff changeset
340 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1]
Ritor1
parents:
diff changeset
341 - (signed int)word_720DB0_xs[v12])
Ritor1
parents:
diff changeset
342 * v18
Ritor1
parents:
diff changeset
343 / v16) >> 16)
Ritor1
parents:
diff changeset
344 + word_720DB0_xs[v12]) >= v31) )
Ritor1
parents:
diff changeset
345 ++v37;
Ritor1
parents:
diff changeset
346 }
Ritor1
parents:
diff changeset
347 }
Ritor1
parents:
diff changeset
348 v11 = v28 + 1;
Ritor1
parents:
diff changeset
349 v34 = v35;
Ritor1
parents:
diff changeset
350 ++v28;
Ritor1
parents:
diff changeset
351 }
Ritor1
parents:
diff changeset
352 while ( v28 < v27 );
Ritor1
parents:
diff changeset
353 if ( v37 == 1 )
Ritor1
parents:
diff changeset
354 {
Ritor1
parents:
diff changeset
355 if ( v39 >= 20 )
Ritor1
parents:
diff changeset
356 break;
Ritor1
parents:
diff changeset
357 if ( v7->uPolygonType == 5 )
Ritor1
parents:
diff changeset
358 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z;
Ritor1
parents:
diff changeset
359 else
Ritor1
parents:
diff changeset
360 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16)
Ritor1
parents:
diff changeset
361 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16)
Ritor1
parents:
diff changeset
362 + HIWORD(v7->zCalc3);
Ritor1
parents:
diff changeset
363 v20 = v39++;
Ritor1
parents:
diff changeset
364 dword_720F20[v20] = v19;
Ritor1
parents:
diff changeset
365 dword_720ED0[v20] = v32;
Ritor1
parents:
diff changeset
366 dword_720E80[v20] = v33;
Ritor1
parents:
diff changeset
367 }
Ritor1
parents:
diff changeset
368 }
Ritor1
parents:
diff changeset
369 }
Ritor1
parents:
diff changeset
370 ++v33;
Ritor1
parents:
diff changeset
371 v30 += 308;
Ritor1
parents:
diff changeset
372 if ( v33 >= v26 )
Ritor1
parents:
diff changeset
373 break;
Ritor1
parents:
diff changeset
374 v5 = 0;
Ritor1
parents:
diff changeset
375 }
Ritor1
parents:
diff changeset
376 }
Ritor1
parents:
diff changeset
377 }
Ritor1
parents:
diff changeset
378 }
Ritor1
parents:
diff changeset
379 }
Ritor1
parents:
diff changeset
380 }
Ritor1
parents:
diff changeset
381 ++v32;
Ritor1
parents:
diff changeset
382 ++v29;
Ritor1
parents:
diff changeset
383 v5 = 0;
Ritor1
parents:
diff changeset
384 }
Ritor1
parents:
diff changeset
385 while ( v32 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
386 if ( !v39 )
Ritor1
parents:
diff changeset
387 {
Ritor1
parents:
diff changeset
388 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
389 return dword_720F20[0];
Ritor1
parents:
diff changeset
390 }
Ritor1
parents:
diff changeset
391 }
Ritor1
parents:
diff changeset
392 v22 = 0;
Ritor1
parents:
diff changeset
393 v38 = v5;
Ritor1
parents:
diff changeset
394 if ( v39 <= (signed int)v5 )
Ritor1
parents:
diff changeset
395 goto LABEL_54;
Ritor1
parents:
diff changeset
396 v23 = 0;
Ritor1
parents:
diff changeset
397 do
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 v24 = dword_720F20[v5 / 4];
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
400 v25 = *(int *)((char *)dword_720F20.data() + v23);
0
Ritor1
parents:
diff changeset
401 if ( v24 == v25 )
Ritor1
parents:
diff changeset
402 goto LABEL_50;
Ritor1
parents:
diff changeset
403 if ( v25 > a3 + 15 )
Ritor1
parents:
diff changeset
404 {
Ritor1
parents:
diff changeset
405 if ( v24 >= v25 )
Ritor1
parents:
diff changeset
406 goto LABEL_51;
Ritor1
parents:
diff changeset
407 LABEL_50:
Ritor1
parents:
diff changeset
408 v22 = v38;
Ritor1
parents:
diff changeset
409 v23 = v5;
Ritor1
parents:
diff changeset
410 goto LABEL_51;
Ritor1
parents:
diff changeset
411 }
Ritor1
parents:
diff changeset
412 if ( v24 > v25 && v24 <= a3 + 15 )
Ritor1
parents:
diff changeset
413 goto LABEL_50;
Ritor1
parents:
diff changeset
414 LABEL_51:
Ritor1
parents:
diff changeset
415 ++v38;
Ritor1
parents:
diff changeset
416 v5 += 4;
Ritor1
parents:
diff changeset
417 }
Ritor1
parents:
diff changeset
418 while ( v38 < v39 );
Ritor1
parents:
diff changeset
419 if ( v22 )
Ritor1
parents:
diff changeset
420 {
Ritor1
parents:
diff changeset
421 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
Ritor1
parents:
diff changeset
422 return dword_720F20[v22];
Ritor1
parents:
diff changeset
423 }
Ritor1
parents:
diff changeset
424 LABEL_54:
Ritor1
parents:
diff changeset
425 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
426 return dword_720F20[v22];
Ritor1
parents:
diff changeset
427 }
Ritor1
parents:
diff changeset
428
Ritor1
parents:
diff changeset
429 //----- (0046DEF2) --------------------------------------------------------
Ritor1
parents:
diff changeset
430 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
431 {
Ritor1
parents:
diff changeset
432 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
433
Ritor1
parents:
diff changeset
434 result = uLayingItemID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
435 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 )
0
Ritor1
parents:
diff changeset
436 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
Ritor1
parents:
diff changeset
437 return result;
Ritor1
parents:
diff changeset
438 }
Ritor1
parents:
diff changeset
439
Ritor1
parents:
diff changeset
440 //----- (0046E0B2) --------------------------------------------------------
Ritor1
parents:
diff changeset
441 void __cdecl _46E0B2_collide_against_decorations()
Ritor1
parents:
diff changeset
442 {
Ritor1
parents:
diff changeset
443 BLVSector *v0; // ebp@1
Ritor1
parents:
diff changeset
444 LevelDecoration *v1; // edi@2
Ritor1
parents:
diff changeset
445 DecorationDesc *v2; // esi@3
Ritor1
parents:
diff changeset
446 int v3; // edx@4
Ritor1
parents:
diff changeset
447 int v4; // eax@4
Ritor1
parents:
diff changeset
448 int v5; // ecx@6
Ritor1
parents:
diff changeset
449 int v6; // ebx@8
Ritor1
parents:
diff changeset
450 int v7; // esi@8
Ritor1
parents:
diff changeset
451 int v8; // ebx@10
Ritor1
parents:
diff changeset
452 int v9; // esi@11
Ritor1
parents:
diff changeset
453 int v10; // edi@12
Ritor1
parents:
diff changeset
454 int v11; // eax@12
Ritor1
parents:
diff changeset
455 int v12; // esi@14
Ritor1
parents:
diff changeset
456 unsigned int v13; // eax@17
Ritor1
parents:
diff changeset
457 signed int i; // [sp+4h] [bp-14h]@1
Ritor1
parents:
diff changeset
458 int v15; // [sp+8h] [bp-10h]@10
Ritor1
parents:
diff changeset
459 int v16; // [sp+Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
460 int v17; // [sp+10h] [bp-8h]@10
Ritor1
parents:
diff changeset
461 int v18; // [sp+14h] [bp-4h]@8
Ritor1
parents:
diff changeset
462
Ritor1
parents:
diff changeset
463 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
464 for ( i = 0; i < v0->uNumDecorations; ++i )
Ritor1
parents:
diff changeset
465 {
Ritor1
parents:
diff changeset
466 v1 = &pLevelDecorations[v0->pDecorationIDs[i]];
Ritor1
parents:
diff changeset
467 if ( !(v1->field_2 & 0x20) )
Ritor1
parents:
diff changeset
468 {
Ritor1
parents:
diff changeset
469 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
470 if (!v2->CanMoveThrough())
0
Ritor1
parents:
diff changeset
471 {
Ritor1
parents:
diff changeset
472 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
473 v4 = v1->vPosition.x;
Ritor1
parents:
diff changeset
474 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
475 {
Ritor1
parents:
diff changeset
476 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
477 {
Ritor1
parents:
diff changeset
478 v5 = v1->vPosition.y;
Ritor1
parents:
diff changeset
479 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
480 {
Ritor1
parents:
diff changeset
481 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
482 {
Ritor1
parents:
diff changeset
483 v6 = v2->uDecorationHeight;
Ritor1
parents:
diff changeset
484 v7 = v1->vPosition.z;
Ritor1
parents:
diff changeset
485 v18 = v6;
Ritor1
parents:
diff changeset
486 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
487 {
Ritor1
parents:
diff changeset
488 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
489 {
Ritor1
parents:
diff changeset
490 v16 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
491 v15 = v5 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
492 v8 = stru_721530.prolly_normal_d + v3;
Ritor1
parents:
diff changeset
493 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
494 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
495 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 )
Ritor1
parents:
diff changeset
496 {
Ritor1
parents:
diff changeset
497 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
498 if ( v9 > 0 )
Ritor1
parents:
diff changeset
499 {
Ritor1
parents:
diff changeset
500 v10 = v1->vPosition.z;
Ritor1
parents:
diff changeset
501 v11 = stru_721530.normal.z
Ritor1
parents:
diff changeset
502 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16);
Ritor1
parents:
diff changeset
503 if ( v11 >= v10 )
Ritor1
parents:
diff changeset
504 {
Ritor1
parents:
diff changeset
505 if ( v11 <= v18 + v10 )
Ritor1
parents:
diff changeset
506 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
507 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17);
0
Ritor1
parents:
diff changeset
508 if ( v12 < 0 )
Ritor1
parents:
diff changeset
509 v12 = 0;
Ritor1
parents:
diff changeset
510 if ( v12 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
511 {
Ritor1
parents:
diff changeset
512 stru_721530.field_7C = v12;
Ritor1
parents:
diff changeset
513 v13 = 8 * v0->pDecorationIDs[i];
Ritor1
parents:
diff changeset
514 LOBYTE(v13) = v13 | 5;
Ritor1
parents:
diff changeset
515 stru_721530.uFaceID = v13;
Ritor1
parents:
diff changeset
516 }
Ritor1
parents:
diff changeset
517 }
Ritor1
parents:
diff changeset
518 }
Ritor1
parents:
diff changeset
519 }
Ritor1
parents:
diff changeset
520 }
Ritor1
parents:
diff changeset
521 }
Ritor1
parents:
diff changeset
522 }
Ritor1
parents:
diff changeset
523 }
Ritor1
parents:
diff changeset
524 }
Ritor1
parents:
diff changeset
525 }
Ritor1
parents:
diff changeset
526 }
Ritor1
parents:
diff changeset
527 }
Ritor1
parents:
diff changeset
528 }
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531
Ritor1
parents:
diff changeset
532 //----- (00486F92) --------------------------------------------------------
Ritor1
parents:
diff changeset
533 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans()
Ritor1
parents:
diff changeset
534 {
Ritor1
parents:
diff changeset
535 Span *v0; // ebx@1
Ritor1
parents:
diff changeset
536 int v1; // eax@2
Ritor1
parents:
diff changeset
537 Edge *v2; // ecx@3
Ritor1
parents:
diff changeset
538 Edge *v3; // edx@3
Ritor1
parents:
diff changeset
539 Edge *v4; // esi@6
Ritor1
parents:
diff changeset
540 Edge *v5; // eax@7
Ritor1
parents:
diff changeset
541 Edge *v6; // ecx@8
Ritor1
parents:
diff changeset
542 Surf *v7; // esi@11
Ritor1
parents:
diff changeset
543 double v8; // st7@13
Ritor1
parents:
diff changeset
544 Surf *v9; // edi@13
Ritor1
parents:
diff changeset
545 double v10; // st6@13
Ritor1
parents:
diff changeset
546 double v11; // st7@14
Ritor1
parents:
diff changeset
547 signed __int64 v12; // qax@14
Ritor1
parents:
diff changeset
548 stru148 *v13; // eax@15
Ritor1
parents:
diff changeset
549 Span *v14; // ecx@17
Ritor1
parents:
diff changeset
550 double v15; // st7@28
Ritor1
parents:
diff changeset
551 signed __int64 v16; // qax@28
Ritor1
parents:
diff changeset
552 stru148 *v17; // eax@29
Ritor1
parents:
diff changeset
553 Span *v18; // ecx@31
Ritor1
parents:
diff changeset
554 Edge *i; // eax@40
Ritor1
parents:
diff changeset
555 Edge *v20; // ecx@43
Ritor1
parents:
diff changeset
556 Edge *v21; // esi@44
Ritor1
parents:
diff changeset
557 double v22; // st7@45
Ritor1
parents:
diff changeset
558 Edge *v23; // edx@48
Ritor1
parents:
diff changeset
559 unsigned int v24; // [sp+10h] [bp-10h]@2
Ritor1
parents:
diff changeset
560 float v25; // [sp+14h] [bp-Ch]@3
Ritor1
parents:
diff changeset
561 Edge *v26; // [sp+18h] [bp-8h]@8
Ritor1
parents:
diff changeset
562 unsigned int v27; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
563
Ritor1
parents:
diff changeset
564 v0 = pSpans;
Ritor1
parents:
diff changeset
565 stru_80C9D8.pSurf = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
566 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
567 stru_80C9A4.pSurf = &stru_80C980;
Ritor1
parents:
diff changeset
568 stru_80C980.pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
569 stru_80C980.pNext = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
570 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
571 stru_80C980.field_8 = 0.0;
Ritor1
parents:
diff changeset
572 stru_80C980.field_4 = 0.0;
Ritor1
parents:
diff changeset
573 stru_80C9D8.pNext = &stru_80C9A4;
Ritor1
parents:
diff changeset
574 stru_80C9D8.pPrev = 0;
Ritor1
parents:
diff changeset
575 stru_80C9D8.field_8 = 1;
Ritor1
parents:
diff changeset
576 stru_80C9A4.pNext = 0;
Ritor1
parents:
diff changeset
577 stru_80C9A4.pPrev = &stru_80C9D8;
Ritor1
parents:
diff changeset
578 stru_80C9A4.field_8 = 0;
Ritor1
parents:
diff changeset
579 LODWORD(stru_80C980.field_0) = 0xC97423F0u;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
580 v27 = pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
581 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
582 {
Ritor1
parents:
diff changeset
583 LABEL_51:
Ritor1
parents:
diff changeset
584 v0->field_8 = -1;
Ritor1
parents:
diff changeset
585 }
Ritor1
parents:
diff changeset
586 else
Ritor1
parents:
diff changeset
587 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
588 v1 = 52 * pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
589 v24 = 52 * pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
590 while ( 1 )
Ritor1
parents:
diff changeset
591 {
Ritor1
parents:
diff changeset
592 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1);
Ritor1
parents:
diff changeset
593 v3 = &stru_80C9D8;
Ritor1
parents:
diff changeset
594 v25 = (double)(signed int)v27;
Ritor1
parents:
diff changeset
595 if ( v2 != &defaultEdge )
Ritor1
parents:
diff changeset
596 {
Ritor1
parents:
diff changeset
597 do
Ritor1
parents:
diff changeset
598 {
Ritor1
parents:
diff changeset
599 while ( 1 )
Ritor1
parents:
diff changeset
600 {
Ritor1
parents:
diff changeset
601 v4 = v3->pNext;
Ritor1
parents:
diff changeset
602 if ( v2->field_0 <= (double)v4->field_0 )
Ritor1
parents:
diff changeset
603 break;
Ritor1
parents:
diff changeset
604 v3 = v3->pNext;
Ritor1
parents:
diff changeset
605 }
Ritor1
parents:
diff changeset
606 v5 = v2->pNext;
Ritor1
parents:
diff changeset
607 v2->pNext = v4;
Ritor1
parents:
diff changeset
608 v2->pPrev = v3;
Ritor1
parents:
diff changeset
609 v3->pNext->pPrev = v2;
Ritor1
parents:
diff changeset
610 v3->pNext = v2;
Ritor1
parents:
diff changeset
611 v3 = v2;
Ritor1
parents:
diff changeset
612 v2 = v5;
Ritor1
parents:
diff changeset
613 }
Ritor1
parents:
diff changeset
614 while ( v5 != &defaultEdge );
Ritor1
parents:
diff changeset
615 }
Ritor1
parents:
diff changeset
616 v6 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
617 stru_80C980.field_20 = 0;
Ritor1
parents:
diff changeset
618 stru_80C980.field_22 = 1;
Ritor1
parents:
diff changeset
619 v26 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
620 if ( stru_80C9D8.pNext )
Ritor1
parents:
diff changeset
621 {
Ritor1
parents:
diff changeset
622 while ( 1 )
Ritor1
parents:
diff changeset
623 {
Ritor1
parents:
diff changeset
624 v7 = v6->pSurf;
Ritor1
parents:
diff changeset
625 if ( v6->field_8 )
Ritor1
parents:
diff changeset
626 {
Ritor1
parents:
diff changeset
627 ++v7->field_22;
Ritor1
parents:
diff changeset
628 if ( v7->field_22 == 1 )
Ritor1
parents:
diff changeset
629 {
Ritor1
parents:
diff changeset
630 v8 = v6->field_0 + 2.0;
Ritor1
parents:
diff changeset
631 v9 = stru_80C980.pNext;
Ritor1
parents:
diff changeset
632 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0;
Ritor1
parents:
diff changeset
633 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4
Ritor1
parents:
diff changeset
634 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8
Ritor1
parents:
diff changeset
635 + stru_80C980.pNext->field_0 )
Ritor1
parents:
diff changeset
636 {
Ritor1
parents:
diff changeset
637 do
Ritor1
parents:
diff changeset
638 v9 = v9->pNext;
Ritor1
parents:
diff changeset
639 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 );
Ritor1
parents:
diff changeset
640 v7->pNext = v9;
Ritor1
parents:
diff changeset
641 v7->pPrev = v9->pPrev;
Ritor1
parents:
diff changeset
642 v9->pPrev->pNext = v7;
Ritor1
parents:
diff changeset
643 v9->pPrev = v7;
Ritor1
parents:
diff changeset
644 }
Ritor1
parents:
diff changeset
645 else
Ritor1
parents:
diff changeset
646 {
Ritor1
parents:
diff changeset
647 v11 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
648 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20);
Ritor1
parents:
diff changeset
649 v0->field_C = v12;
Ritor1
parents:
diff changeset
650 if ( (signed __int16)v12 > 0 )
Ritor1
parents:
diff changeset
651 {
Ritor1
parents:
diff changeset
652 v0->field_A = v27;
Ritor1
parents:
diff changeset
653 v0->field_8 = v9->field_20;
Ritor1
parents:
diff changeset
654 v13 = v9->pParent;
Ritor1
parents:
diff changeset
655 v0->pParent = v13;
Ritor1
parents:
diff changeset
656 if ( v13 )
Ritor1
parents:
diff changeset
657 {
Ritor1
parents:
diff changeset
658 if ( v13->prolly_head )
Ritor1
parents:
diff changeset
659 {
Ritor1
parents:
diff changeset
660 v14 = v13->prolly_tail;
Ritor1
parents:
diff changeset
661 if ( !v14 )
Ritor1
parents:
diff changeset
662 return;
Ritor1
parents:
diff changeset
663 v14->pNext = v0;
Ritor1
parents:
diff changeset
664 }
Ritor1
parents:
diff changeset
665 else
Ritor1
parents:
diff changeset
666 {
Ritor1
parents:
diff changeset
667 v13->prolly_head = v0;
Ritor1
parents:
diff changeset
668 }
Ritor1
parents:
diff changeset
669 v13->prolly_tail = v0;
Ritor1
parents:
diff changeset
670 }
Ritor1
parents:
diff changeset
671 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
672 return;
Ritor1
parents:
diff changeset
673 ++v0;
Ritor1
parents:
diff changeset
674 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
675 }
Ritor1
parents:
diff changeset
676 v6 = v26;
Ritor1
parents:
diff changeset
677 v7->field_20 = (signed __int64)v11;
Ritor1
parents:
diff changeset
678 v7->pNext = v9;
Ritor1
parents:
diff changeset
679 v9->pPrev = v7;
Ritor1
parents:
diff changeset
680 stru_80C980.pNext = v7;
Ritor1
parents:
diff changeset
681 v7->pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683 }
Ritor1
parents:
diff changeset
684 }
Ritor1
parents:
diff changeset
685 else
Ritor1
parents:
diff changeset
686 {
Ritor1
parents:
diff changeset
687 --v7->field_22;
Ritor1
parents:
diff changeset
688 if ( !v7->field_22 )
Ritor1
parents:
diff changeset
689 {
Ritor1
parents:
diff changeset
690 if ( stru_80C980.pNext == v7 )
Ritor1
parents:
diff changeset
691 {
Ritor1
parents:
diff changeset
692 v15 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
693 v16 = (signed __int64)(v15 - (double)v7->field_20);
Ritor1
parents:
diff changeset
694 v0->field_C = v16;
Ritor1
parents:
diff changeset
695 if ( (signed __int16)v16 > 0 )
Ritor1
parents:
diff changeset
696 {
Ritor1
parents:
diff changeset
697 v0->field_A = v27;
Ritor1
parents:
diff changeset
698 v0->field_8 = v7->field_20;
Ritor1
parents:
diff changeset
699 v17 = v7->pParent;
Ritor1
parents:
diff changeset
700 v0->pParent = v17;
Ritor1
parents:
diff changeset
701 if ( v17 )
Ritor1
parents:
diff changeset
702 {
Ritor1
parents:
diff changeset
703 if ( v17->prolly_head )
Ritor1
parents:
diff changeset
704 {
Ritor1
parents:
diff changeset
705 v18 = v17->prolly_tail;
Ritor1
parents:
diff changeset
706 if ( !v18 )
Ritor1
parents:
diff changeset
707 return;
Ritor1
parents:
diff changeset
708 v18->pNext = v0;
Ritor1
parents:
diff changeset
709 }
Ritor1
parents:
diff changeset
710 else
Ritor1
parents:
diff changeset
711 {
Ritor1
parents:
diff changeset
712 v17->prolly_head = v0;
Ritor1
parents:
diff changeset
713 }
Ritor1
parents:
diff changeset
714 v17->prolly_tail = v0;
Ritor1
parents:
diff changeset
715 }
Ritor1
parents:
diff changeset
716 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
717 return;
Ritor1
parents:
diff changeset
718 ++v0;
Ritor1
parents:
diff changeset
719 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
720 }
Ritor1
parents:
diff changeset
721 v7->pNext->field_20 = (signed __int64)v15;
Ritor1
parents:
diff changeset
722 v6 = v26;
Ritor1
parents:
diff changeset
723 }
Ritor1
parents:
diff changeset
724 v7->pNext->pPrev = v7->pPrev;
Ritor1
parents:
diff changeset
725 v7->pPrev->pNext = v7->pNext;
Ritor1
parents:
diff changeset
726 }
Ritor1
parents:
diff changeset
727 }
Ritor1
parents:
diff changeset
728 v26 = v6->pNext;
Ritor1
parents:
diff changeset
729 if ( !v26 )
Ritor1
parents:
diff changeset
730 break;
Ritor1
parents:
diff changeset
731 v6 = v6->pNext;
Ritor1
parents:
diff changeset
732 }
Ritor1
parents:
diff changeset
733 }
Ritor1
parents:
diff changeset
734 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 )
Ritor1
parents:
diff changeset
735 {
Ritor1
parents:
diff changeset
736 i->pPrev->pNext = i->pNext;
Ritor1
parents:
diff changeset
737 i->pNext->pPrev = i->pPrev;
Ritor1
parents:
diff changeset
738 }
Ritor1
parents:
diff changeset
739 v20 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
740 if ( stru_80C9D8.pNext != &stru_80C9A4 )
Ritor1
parents:
diff changeset
741 break;
Ritor1
parents:
diff changeset
742 LABEL_50:
Ritor1
parents:
diff changeset
743 ++v27;
Ritor1
parents:
diff changeset
744 v1 = v24 + 52;
Ritor1
parents:
diff changeset
745 v24 += 52;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
746 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
747 goto LABEL_51;
Ritor1
parents:
diff changeset
748 }
Ritor1
parents:
diff changeset
749 while ( 1 )
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 v21 = v20->pNext;
Ritor1
parents:
diff changeset
752 if ( !v21 )
Ritor1
parents:
diff changeset
753 break;
Ritor1
parents:
diff changeset
754 v22 = v20->field_4 + v20->field_0;
Ritor1
parents:
diff changeset
755 v20->field_0 = v22;
Ritor1
parents:
diff changeset
756 if ( v22 < stru_80C9D8.field_0 )
Ritor1
parents:
diff changeset
757 v20->field_0 = stru_80C9D8.field_0 + 0.0000001;
Ritor1
parents:
diff changeset
758 while ( 1 )
Ritor1
parents:
diff changeset
759 {
Ritor1
parents:
diff changeset
760 v23 = v20->pPrev;
Ritor1
parents:
diff changeset
761 if ( v20->field_0 >= (double)v23->field_0 )
Ritor1
parents:
diff changeset
762 break;
Ritor1
parents:
diff changeset
763 v23->pNext = v20->pNext;
Ritor1
parents:
diff changeset
764 v20->pNext->pPrev = v23;
Ritor1
parents:
diff changeset
765 v23->pPrev->pNext = v20;
Ritor1
parents:
diff changeset
766 v20->pPrev = v23->pPrev;
Ritor1
parents:
diff changeset
767 v20->pNext = v23;
Ritor1
parents:
diff changeset
768 v23->pPrev = v20;
Ritor1
parents:
diff changeset
769 }
Ritor1
parents:
diff changeset
770 v20 = v21;
Ritor1
parents:
diff changeset
771 if ( v21 == &stru_80C9A4 )
Ritor1
parents:
diff changeset
772 goto LABEL_50;
Ritor1
parents:
diff changeset
773 }
Ritor1
parents:
diff changeset
774 }
Ritor1
parents:
diff changeset
775 }
Ritor1
parents:
diff changeset
776 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
777
Ritor1
parents:
diff changeset
778 //----- (00487DA9) --------------------------------------------------------
Ritor1
parents:
diff changeset
779 void __cdecl sub_487DA9()
Ritor1
parents:
diff changeset
780 {
Ritor1
parents:
diff changeset
781 char *v0; // eax@1
Ritor1
parents:
diff changeset
782
Ritor1
parents:
diff changeset
783 v0 = &array_77EC08[0].field_108;
Ritor1
parents:
diff changeset
784 do
Ritor1
parents:
diff changeset
785 {
Ritor1
parents:
diff changeset
786 *v0 = 0;
Ritor1
parents:
diff changeset
787 v0 += 268;
Ritor1
parents:
diff changeset
788 }
Ritor1
parents:
diff changeset
789 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] );
Ritor1
parents:
diff changeset
790 }
Ritor1
parents:
diff changeset
791
Ritor1
parents:
diff changeset
792 //----- (00487DBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
793 void Software_ResetNewEdges()
Ritor1
parents:
diff changeset
794 {
Ritor1
parents:
diff changeset
795 int v0; // ecx@1
Ritor1
parents:
diff changeset
796 Edge **v1; // eax@1
Ritor1
parents:
diff changeset
797 signed int v2; // eax@3
Ritor1
parents:
diff changeset
798
Ritor1
parents:
diff changeset
799 v0 = 0;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
800 v1 = ptr_80CA10.data();
0
Ritor1
parents:
diff changeset
801 do
Ritor1
parents:
diff changeset
802 {
Ritor1
parents:
diff changeset
803 ++v0;
Ritor1
parents:
diff changeset
804 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
Ritor1
parents:
diff changeset
805 *v1 = 0;
Ritor1
parents:
diff changeset
806 ++v1;
Ritor1
parents:
diff changeset
807 }
Ritor1
parents:
diff changeset
808 while ( (signed int)v1 < (signed int)&unk_80D190 );
Ritor1
parents:
diff changeset
809 v2 = 2000;
Ritor1
parents:
diff changeset
810 do
Ritor1
parents:
diff changeset
811 {
Ritor1
parents:
diff changeset
812 pSurfs->field_22 = 0;
Ritor1
parents:
diff changeset
813 --v2;
Ritor1
parents:
diff changeset
814 }
Ritor1
parents:
diff changeset
815 while ( v2 );
Ritor1
parents:
diff changeset
816 }
Ritor1
parents:
diff changeset
817 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
818
Ritor1
parents:
diff changeset
819 //----- (0048958E) --------------------------------------------------------
Ritor1
parents:
diff changeset
820 stru12_MemoryBlock::stru12_MemoryBlock(int a2)
Ritor1
parents:
diff changeset
821 {
Ritor1
parents:
diff changeset
822 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
823 void *v3; // eax@1
Ritor1
parents:
diff changeset
824 void *v4; // ecx@1
Ritor1
parents:
diff changeset
825 stru12_MemoryBlock *result; // eax@1
Ritor1
parents:
diff changeset
826
Ritor1
parents:
diff changeset
827 v2 = this;
Ritor1
parents:
diff changeset
828 v3 = operator new(8 * a2 + 16);
Ritor1
parents:
diff changeset
829 v2->pBlockBase = v3;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
830 v4 = (char *)v3 + PID_TYPE(-(signed int)v3);
0
Ritor1
parents:
diff changeset
831 result = v2;
Ritor1
parents:
diff changeset
832 v2->pAlignedBlock = v4;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834
Ritor1
parents:
diff changeset
835 //----- (004895B7) --------------------------------------------------------
Ritor1
parents:
diff changeset
836 stru12::stru12(stru11 *pStru11)
Ritor1
parents:
diff changeset
837 {
Ritor1
parents:
diff changeset
838 stru12 *v2; // esi@1
Ritor1
parents:
diff changeset
839
Ritor1
parents:
diff changeset
840 v2 = this;
Ritor1
parents:
diff changeset
841 this->field_44 = 0x41000000u;
Ritor1
parents:
diff changeset
842 this->field_4C = 0x46000000u;
Ritor1
parents:
diff changeset
843 //this->vdestructor_ptr = stru12::_4898E6;
Ritor1
parents:
diff changeset
844 this->field_48 = 0;
Ritor1
parents:
diff changeset
845 this->field_50 = 0;
Ritor1
parents:
diff changeset
846 this->field_54 = 0x33D6BF95u;
Ritor1
parents:
diff changeset
847 this->field_58 = 0;
Ritor1
parents:
diff changeset
848
Ritor1
parents:
diff changeset
849 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
850 v2->pMemBlocks[i] = new stru12_MemoryBlock(640);
Ritor1
parents:
diff changeset
851 }
Ritor1
parents:
diff changeset
852
Ritor1
parents:
diff changeset
853 //----- (00489810) --------------------------------------------------------
Ritor1
parents:
diff changeset
854 stru12::~stru12()
Ritor1
parents:
diff changeset
855 {
Ritor1
parents:
diff changeset
856 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
857 delete pMemBlocks[i];
Ritor1
parents:
diff changeset
858 }
Ritor1
parents:
diff changeset
859
Ritor1
parents:
diff changeset
860 //----- (004898BF) --------------------------------------------------------
Ritor1
parents:
diff changeset
861 stru12_MemoryBlock::~stru12_MemoryBlock()
Ritor1
parents:
diff changeset
862 {
Ritor1
parents:
diff changeset
863 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
864 void *v3; // ST00_4@1
Ritor1
parents:
diff changeset
865
Ritor1
parents:
diff changeset
866 v2 = this;
Ritor1
parents:
diff changeset
867 v3 = this->pBlockBase;
Ritor1
parents:
diff changeset
868 this->pAlignedBlock = 0;
Ritor1
parents:
diff changeset
869 free(v3);
Ritor1
parents:
diff changeset
870 v2->pBlockBase = 0;
Ritor1
parents:
diff changeset
871 /*if ( a2 & 1 )
Ritor1
parents:
diff changeset
872 free(v2);*/
Ritor1
parents:
diff changeset
873 }
Ritor1
parents:
diff changeset
874
Ritor1
parents:
diff changeset
875 //----- (004898E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
876 void stru12::_4898E6()
Ritor1
parents:
diff changeset
877 {
Ritor1
parents:
diff changeset
878 void *v1; // eax@1
Ritor1
parents:
diff changeset
879 void *v2; // edx@1
Ritor1
parents:
diff changeset
880 char *v3; // edi@2
Ritor1
parents:
diff changeset
881 double v4; // st7@2
Ritor1
parents:
diff changeset
882 char *v5; // ebx@2
Ritor1
parents:
diff changeset
883 double v6; // st6@3
Ritor1
parents:
diff changeset
884 double v7; // st5@3
Ritor1
parents:
diff changeset
885 double v8; // st4@3
Ritor1
parents:
diff changeset
886 int v9; // esi@3
Ritor1
parents:
diff changeset
887 double v10; // st3@3
Ritor1
parents:
diff changeset
888 float v11; // ST34_4@5
Ritor1
parents:
diff changeset
889 double v12; // st6@10
Ritor1
parents:
diff changeset
890 double v13; // ST0C_8@10
Ritor1
parents:
diff changeset
891 char *v14; // [sp+14h] [bp-44h]@2
Ritor1
parents:
diff changeset
892 char *v15; // [sp+18h] [bp-40h]@2
Ritor1
parents:
diff changeset
893 char *v16; // [sp+1Ch] [bp-3Ch]@2
Ritor1
parents:
diff changeset
894 char *v17; // [sp+20h] [bp-38h]@2
Ritor1
parents:
diff changeset
895 char *v18; // [sp+24h] [bp-34h]@2
Ritor1
parents:
diff changeset
896 float v19; // [sp+30h] [bp-28h]@3
Ritor1
parents:
diff changeset
897 float v20; // [sp+38h] [bp-20h]@3
Ritor1
parents:
diff changeset
898 char *v21; // [sp+3Ch] [bp-1Ch]@2
Ritor1
parents:
diff changeset
899 int v22; // [sp+40h] [bp-18h]@1
Ritor1
parents:
diff changeset
900 char *v23; // [sp+44h] [bp-14h]@2
Ritor1
parents:
diff changeset
901 char *v24; // [sp+48h] [bp-10h]@2
Ritor1
parents:
diff changeset
902 int v25; // [sp+4Ch] [bp-Ch]@2
Ritor1
parents:
diff changeset
903 float v26; // [sp+50h] [bp-8h]@3
Ritor1
parents:
diff changeset
904 float v27; // [sp+54h] [bp-4h]@3
Ritor1
parents:
diff changeset
905
731
de482c901171 Moved unused CPU detection stuff to a separate file.
Nomad
parents: 730
diff changeset
906 __debugbreak();
0
Ritor1
parents:
diff changeset
907 v22 = 0;
Ritor1
parents:
diff changeset
908 v1 = this->pMemBlocks[1]->pAlignedBlock;
Ritor1
parents:
diff changeset
909 v2 = this->pMemBlocks[6]->pAlignedBlock;
Ritor1
parents:
diff changeset
910 if ( this->field_8C > 0 )
Ritor1
parents:
diff changeset
911 {
Ritor1
parents:
diff changeset
912 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
913 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
914 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
915 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
916 v25 = (int)v1 - (int)v2;
Ritor1
parents:
diff changeset
917 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
918 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
919 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
920 v4 = 1.0;
Ritor1
parents:
diff changeset
921 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
922 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
923 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
924 do
Ritor1
parents:
diff changeset
925 {
Ritor1
parents:
diff changeset
926 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
927 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
928 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z;
Ritor1
parents:
diff changeset
929 v7 = pIndoorCamera->fRotationYCosine;
Ritor1
parents:
diff changeset
930 v8 = pIndoorCamera->fRotationYSine;
Ritor1
parents:
diff changeset
931 v20 = pIndoorCamera->fRotationXCosine;
Ritor1
parents:
diff changeset
932 v19 = pIndoorCamera->fRotationXSine;
Ritor1
parents:
diff changeset
933 v9 = (int)((char *)v2 + (int)v21);
Ritor1
parents:
diff changeset
934 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26;
Ritor1
parents:
diff changeset
935 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
936 {
Ritor1
parents:
diff changeset
937 v11 = v10;
Ritor1
parents:
diff changeset
938 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6;
Ritor1
parents:
diff changeset
939 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
940 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19;
Ritor1
parents:
diff changeset
941 }
Ritor1
parents:
diff changeset
942 else
Ritor1
parents:
diff changeset
943 {
Ritor1
parents:
diff changeset
944 *(float *)v9 = v10;
Ritor1
parents:
diff changeset
945 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
946 *(float *)((char *)v2 + (int)v5) = v6;
Ritor1
parents:
diff changeset
947 }
Ritor1
parents:
diff changeset
948 if ( *(float *)v9 >= 8.0 )
Ritor1
parents:
diff changeset
949 {
Ritor1
parents:
diff changeset
950 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 )
Ritor1
parents:
diff changeset
951 {
Ritor1
parents:
diff changeset
952 *(int *)v2 = 0;
Ritor1
parents:
diff changeset
953 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad;
Ritor1
parents:
diff changeset
954 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX
Ritor1
parents:
diff changeset
955 - v12 * *(float *)((char *)v2 + (int)v3);
Ritor1
parents:
diff changeset
956 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY
Ritor1
parents:
diff changeset
957 - v12 * *(float *)((char *)v2 + (int)v5);
Ritor1
parents:
diff changeset
958 *(float *)((char *)v2 + (int)v16) = v4
Ritor1
parents:
diff changeset
959 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
Ritor1
parents:
diff changeset
960 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001);
Ritor1
parents:
diff changeset
961 v13 = *(float *)v9 + 6.7553994e15;
Ritor1
parents:
diff changeset
962 v4 = 1.0;
Ritor1
parents:
diff changeset
963 *(int *)((char *)v2 + (int)v14) = LODWORD(v13);
Ritor1
parents:
diff changeset
964 }
Ritor1
parents:
diff changeset
965 else
Ritor1
parents:
diff changeset
966 {
Ritor1
parents:
diff changeset
967 *(int *)v2 = 2;
Ritor1
parents:
diff changeset
968 }
Ritor1
parents:
diff changeset
969 }
Ritor1
parents:
diff changeset
970 else
Ritor1
parents:
diff changeset
971 {
Ritor1
parents:
diff changeset
972 *(int *)v2 = 1;
Ritor1
parents:
diff changeset
973 }
Ritor1
parents:
diff changeset
974 ++v22;
Ritor1
parents:
diff changeset
975 v2 = (char *)v2 + 4;
Ritor1
parents:
diff changeset
976 }
Ritor1
parents:
diff changeset
977 while ( v22 < this->field_8C );
Ritor1
parents:
diff changeset
978 }
Ritor1
parents:
diff changeset
979 this->field_8C = 0;
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981
Ritor1
parents:
diff changeset
982 //----- (0048A959) --------------------------------------------------------
Ritor1
parents:
diff changeset
983 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
Ritor1
parents:
diff changeset
984 {
Ritor1
parents:
diff changeset
985 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
Ritor1
parents:
diff changeset
986 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
Ritor1
parents:
diff changeset
987 b = (uColor & 0x000000FF) / 255.0f;
Ritor1
parents:
diff changeset
988
Ritor1
parents:
diff changeset
989 float h, s, v;
Ritor1
parents:
diff changeset
990 RGB2HSV(&h, &s, r, g, b, &v);
Ritor1
parents:
diff changeset
991
Ritor1
parents:
diff changeset
992 if ( h_replace != -1.0 )
Ritor1
parents:
diff changeset
993 h = h_replace;
Ritor1
parents:
diff changeset
994 if ( s_replace != -1.0 )
Ritor1
parents:
diff changeset
995 s = s_replace;
Ritor1
parents:
diff changeset
996 if ( v_replace != -1.0 )
Ritor1
parents:
diff changeset
997 v = v_replace;
Ritor1
parents:
diff changeset
998 HSV2RGB(&r, &g, &b, h, s, v);
Ritor1
parents:
diff changeset
999
Ritor1
parents:
diff changeset
1000 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) |
Ritor1
parents:
diff changeset
1001 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) |
Ritor1
parents:
diff changeset
1002 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF);
Ritor1
parents:
diff changeset
1003 }
Ritor1
parents:
diff changeset
1004
Ritor1
parents:
diff changeset
1005 //----- (0048B561) --------------------------------------------------------
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1006 int fixpoint_from_float(float val)
0
Ritor1
parents:
diff changeset
1007 {
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1008 // float X.Yf -> int XXXX YYYY
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1009 int left = floorf((val - 0.5f) + 0.5f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1010 int right = floorf((val - left) * 65536.0f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1011 return (left << 16) | right;
0
Ritor1
parents:
diff changeset
1012 }
Ritor1
parents:
diff changeset
1013
Ritor1
parents:
diff changeset
1014 //----- (00491E3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1015 void __cdecl sub_491E3A()
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 Player *v0; // ebx@1
Ritor1
parents:
diff changeset
1018 signed int v1; // esi@3
Ritor1
parents:
diff changeset
1019 char *v2; // eax@4
Ritor1
parents:
diff changeset
1020 unsigned int v3; // eax@7
Ritor1
parents:
diff changeset
1021 unsigned int v4; // edx@8
Ritor1
parents:
diff changeset
1022 char *v5; // ecx@9
Ritor1
parents:
diff changeset
1023 int v6; // edi@17
Ritor1
parents:
diff changeset
1024 Texture *v7; // ebx@18
Ritor1
parents:
diff changeset
1025 struct IDirect3DTexture2 **v8; // eax@19
Ritor1
parents:
diff changeset
1026 struct IDirect3DTexture2 *v9; // eax@20
Ritor1
parents:
diff changeset
1027 struct IDirectDrawSurface **v10; // eax@22
Ritor1
parents:
diff changeset
1028 struct IDirectDrawSurface *v11; // eax@23
Ritor1
parents:
diff changeset
1029 int v12; // eax@26
Ritor1
parents:
diff changeset
1030
Ritor1
parents:
diff changeset
1031 v0 = pParty->pPlayers;
Ritor1
parents:
diff changeset
1032 do
Ritor1
parents:
diff changeset
1033 {
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1034 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
1035 {
Ritor1
parents:
diff changeset
1036 v1 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1037 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1038 {
Ritor1
parents:
diff changeset
1039 LABEL_7:
Ritor1
parents:
diff changeset
1040 v3 = 0;
Ritor1
parents:
diff changeset
1041 }
Ritor1
parents:
diff changeset
1042 else
Ritor1
parents:
diff changeset
1043 {
Ritor1
parents:
diff changeset
1044 v2 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1045 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 )
0
Ritor1
parents:
diff changeset
1046 {
Ritor1
parents:
diff changeset
1047 ++v1;
Ritor1
parents:
diff changeset
1048 v2 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1049 if ( v1 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1050 goto LABEL_7;
Ritor1
parents:
diff changeset
1051 }
Ritor1
parents:
diff changeset
1052 v3 = v1;
Ritor1
parents:
diff changeset
1053 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1054 pSoundList->UnloadSound(v3, 1);
0
Ritor1
parents:
diff changeset
1055 v4 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1056 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1057 {
Ritor1
parents:
diff changeset
1058 LABEL_12:
Ritor1
parents:
diff changeset
1059 v4 = 0;
Ritor1
parents:
diff changeset
1060 }
Ritor1
parents:
diff changeset
1061 else
Ritor1
parents:
diff changeset
1062 {
Ritor1
parents:
diff changeset
1063 v5 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1064 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 )
0
Ritor1
parents:
diff changeset
1065 {
Ritor1
parents:
diff changeset
1066 ++v4;
Ritor1
parents:
diff changeset
1067 v5 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1068 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1069 goto LABEL_12;
Ritor1
parents:
diff changeset
1070 }
Ritor1
parents:
diff changeset
1071 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1072 pSoundList->UnloadSound(v4, 1);
0
Ritor1
parents:
diff changeset
1073 }
Ritor1
parents:
diff changeset
1074 ++v0;
Ritor1
parents:
diff changeset
1075 }
Ritor1
parents:
diff changeset
1076 while ( (signed int)v0 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
1077 v6 = pIcons_LOD->uNumLoadedFiles - 1;
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1078 if ( v6 >= pIcons_LOD->pFacesLock )
0
Ritor1
parents:
diff changeset
1079 {
Ritor1
parents:
diff changeset
1080 v7 = &pIcons_LOD->pTextures[v6];
Ritor1
parents:
diff changeset
1081 do
Ritor1
parents:
diff changeset
1082 {
Ritor1
parents:
diff changeset
1083 v7->Release();
Ritor1
parents:
diff changeset
1084 v8 = pIcons_LOD->pHardwareTextures;
Ritor1
parents:
diff changeset
1085 if ( v8 )
Ritor1
parents:
diff changeset
1086 {
Ritor1
parents:
diff changeset
1087 v9 = v8[v6];
Ritor1
parents:
diff changeset
1088 if ( v9 )
Ritor1
parents:
diff changeset
1089 {
Ritor1
parents:
diff changeset
1090 v9->Release();
Ritor1
parents:
diff changeset
1091 pIcons_LOD->pHardwareTextures[v6] = 0;
Ritor1
parents:
diff changeset
1092 }
Ritor1
parents:
diff changeset
1093 }
Ritor1
parents:
diff changeset
1094 v10 = pIcons_LOD->pHardwareSurfaces;
Ritor1
parents:
diff changeset
1095 if ( v10 )
Ritor1
parents:
diff changeset
1096 {
Ritor1
parents:
diff changeset
1097 v11 = v10[v6];
Ritor1
parents:
diff changeset
1098 if ( v11 )
Ritor1
parents:
diff changeset
1099 {
Ritor1
parents:
diff changeset
1100 v11->Release();
Ritor1
parents:
diff changeset
1101 pIcons_LOD->pHardwareSurfaces[v6] = 0;
Ritor1
parents:
diff changeset
1102 }
Ritor1
parents:
diff changeset
1103 }
Ritor1
parents:
diff changeset
1104 --v6;
Ritor1
parents:
diff changeset
1105 --v7;
Ritor1
parents:
diff changeset
1106 }
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1107 while ( v6 >= pIcons_LOD->pFacesLock );
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1108 }
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1109 v12 = pIcons_LOD->pFacesLock;
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1110 pIcons_LOD->pFacesLock = 0;
0
Ritor1
parents:
diff changeset
1111 pIcons_LOD->uNumLoadedFiles = v12;
Ritor1
parents:
diff changeset
1112 }
Ritor1
parents:
diff changeset
1113 // 4ED498: using guessed type char byte_4ED498;
Ritor1
parents:
diff changeset
1114
Ritor1
parents:
diff changeset
1115 //----- (00493938) --------------------------------------------------------
Ritor1
parents:
diff changeset
1116 int __cdecl _493938_regenerate()
Ritor1
parents:
diff changeset
1117 {
Ritor1
parents:
diff changeset
1118 int v0; // edi@1
Ritor1
parents:
diff changeset
1119 signed __int64 v1; // qax@1
Ritor1
parents:
diff changeset
1120 int v2; // ecx@1
Ritor1
parents:
diff changeset
1121 int result; // eax@1
Ritor1
parents:
diff changeset
1122 int v4; // eax@2
Ritor1
parents:
diff changeset
1123 int v5; // edi@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1124 int *v6; // ecx@5
0
Ritor1
parents:
diff changeset
1125 char v7; // sf@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1126 int *v8; // ecx@10
0
Ritor1
parents:
diff changeset
1127 int v9; // edi@15
Ritor1
parents:
diff changeset
1128 signed int v10; // eax@15
Ritor1
parents:
diff changeset
1129 __int16 *v11; // edx@16
Ritor1
parents:
diff changeset
1130 int v12; // eax@20
Ritor1
parents:
diff changeset
1131 int v13; // ebx@20
Ritor1
parents:
diff changeset
1132 unsigned int *v14; // esi@21
Ritor1
parents:
diff changeset
1133 unsigned int v15; // ecx@21
Ritor1
parents:
diff changeset
1134 unsigned int v16; // eax@21
Ritor1
parents:
diff changeset
1135 int v17; // edx@21
Ritor1
parents:
diff changeset
1136 int v18; // eax@21
Ritor1
parents:
diff changeset
1137 signed int v19; // eax@21
Ritor1
parents:
diff changeset
1138 signed int v20; // ebx@25
Ritor1
parents:
diff changeset
1139 Player *v21; // esi@25
Ritor1
parents:
diff changeset
1140 ITEM_EQUIP_TYPE v22; // edi@30
Ritor1
parents:
diff changeset
1141 //int v23; // edx@31
Ritor1
parents:
diff changeset
1142 signed int v24; // ecx@32
Ritor1
parents:
diff changeset
1143 signed int v25; // eax@33
Ritor1
parents:
diff changeset
1144 int v26; // eax@35
Ritor1
parents:
diff changeset
1145 int v27; // eax@36
Ritor1
parents:
diff changeset
1146 int v28; // eax@37
Ritor1
parents:
diff changeset
1147 int v29; // eax@40
Ritor1
parents:
diff changeset
1148 int v30; // eax@41
Ritor1
parents:
diff changeset
1149 signed int v31; // ecx@53
Ritor1
parents:
diff changeset
1150 char *v32; // eax@53
Ritor1
parents:
diff changeset
1151 char *v33; // edi@82
Ritor1
parents:
diff changeset
1152 int v34; // ecx@88
Ritor1
parents:
diff changeset
1153 int v35; // eax@88
Ritor1
parents:
diff changeset
1154 char *v36; // edi@99
Ritor1
parents:
diff changeset
1155 int v37; // edi@104
Ritor1
parents:
diff changeset
1156 int v38; // edi@106
Ritor1
parents:
diff changeset
1157 int v39; // edi@111
Ritor1
parents:
diff changeset
1158 int v40; // ecx@113
Ritor1
parents:
diff changeset
1159 char v41[400]; // [sp+4h] [bp-22Ch]@20
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1160 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
0
Ritor1
parents:
diff changeset
1161 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
Ritor1
parents:
diff changeset
1162 int v44; // [sp+210h] [bp-20h]@22
Ritor1
parents:
diff changeset
1163 int v45; // [sp+214h] [bp-1Ch]@25
Ritor1
parents:
diff changeset
1164 int v46; // [sp+218h] [bp-18h]@25
Ritor1
parents:
diff changeset
1165 int v47; // [sp+21Ch] [bp-14h]@25
Ritor1
parents:
diff changeset
1166 int v48; // [sp+220h] [bp-10h]@25
Ritor1
parents:
diff changeset
1167 int v49; // [sp+224h] [bp-Ch]@24
Ritor1
parents:
diff changeset
1168 int v50; // [sp+228h] [bp-8h]@25
Ritor1
parents:
diff changeset
1169 int v51; // [sp+22Ch] [bp-4h]@2
Ritor1
parents:
diff changeset
1170
Ritor1
parents:
diff changeset
1171 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
Ritor1
parents:
diff changeset
1172 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375);
Ritor1
parents:
diff changeset
1173 v2 = (signed int)v1 / 60;
Ritor1
parents:
diff changeset
1174 result = (signed int)v1 / 60 + 5;
Ritor1
parents:
diff changeset
1175 if ( v0 >= result )
Ritor1
parents:
diff changeset
1176 {
Ritor1
parents:
diff changeset
1177 v51 = 0;
Ritor1
parents:
diff changeset
1178 v4 = (v0 - v2) / 5;
Ritor1
parents:
diff changeset
1179 if (pParty->FlyActive())
Ritor1
parents:
diff changeset
1180 {
Ritor1
parents:
diff changeset
1181 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
1182 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1183 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1184 { // colliding with something in the air - fall down
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1185 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1186 //__debugbreak();
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1187 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000];
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1188 v7 = *v6 < v5;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1189 *v6 -= v5;
0
Ritor1
parents:
diff changeset
1190 if ( v7 )
Ritor1
parents:
diff changeset
1191 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1192 *v6 = 0;
0
Ritor1
parents:
diff changeset
1193 pParty->uFlags &= 0xFFFFFFBFu;
Ritor1
parents:
diff changeset
1194 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
1195 v51 = 1;
Ritor1
parents:
diff changeset
1196 }
Ritor1
parents:
diff changeset
1197 }
Ritor1
parents:
diff changeset
1198 }
Ritor1
parents:
diff changeset
1199 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1200
0
Ritor1
parents:
diff changeset
1201 if (pParty->WaterWalkActive())
Ritor1
parents:
diff changeset
1202 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1203 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1204 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1205 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1206 { // taking on water
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1207 //__debugbreak();
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1208 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000];
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1209 v7 = *v8 < v4;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1210 *v8 -= v4;
0
Ritor1
parents:
diff changeset
1211 if ( v7 )
Ritor1
parents:
diff changeset
1212 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1213 *v8 = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1214 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
1215 v51 = 1;
Ritor1
parents:
diff changeset
1216 }
Ritor1
parents:
diff changeset
1217 }
Ritor1
parents:
diff changeset
1218 }
Ritor1
parents:
diff changeset
1219 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1220
0
Ritor1
parents:
diff changeset
1221 if (pParty->ImmolationActive())
Ritor1
parents:
diff changeset
1222 {
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1223 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
1224 v9 = 0;
Ritor1
parents:
diff changeset
1225 a3.z = 0;
Ritor1
parents:
diff changeset
1226 a3.y = 0;
Ritor1
parents:
diff changeset
1227 a3.x = 0;
Ritor1
parents:
diff changeset
1228 a1.stru_24.Reset();
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1229 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1230 a1.spell_skill = pParty->ImmolationSkillLevel();
0
Ritor1
parents:
diff changeset
1231 v10 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1232 a1.uType = 1070;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1233 a1.spell_id = SPELL_FIRE_IMMOLATION;
0
Ritor1
parents:
diff changeset
1234 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1235 {
Ritor1
parents:
diff changeset
1236 LABEL_19:
Ritor1
parents:
diff changeset
1237 LOWORD(v10) = 0;
Ritor1
parents:
diff changeset
1238 }
Ritor1
parents:
diff changeset
1239 else
Ritor1
parents:
diff changeset
1240 {
Ritor1
parents:
diff changeset
1241 v11 = &pObjectList->pObjects->uObjectID;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 917
diff changeset
1242 while ( stru_4E3ACC[8].uType != *v11 )
0
Ritor1
parents:
diff changeset
1243 {
Ritor1
parents:
diff changeset
1244 ++v10;
Ritor1
parents:
diff changeset
1245 v11 += 28;
Ritor1
parents:
diff changeset
1246 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1247 goto LABEL_19;
Ritor1
parents:
diff changeset
1248 }
Ritor1
parents:
diff changeset
1249 }
Ritor1
parents:
diff changeset
1250 a1.uObjectDescID = v10;
Ritor1
parents:
diff changeset
1251 a1.field_60_distance_related_prolly_lod = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1252 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
1253 LOBYTE(v12) = v12 | OBJECT_Player;
0
Ritor1
parents:
diff changeset
1254 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
1255 a1.uSectorID = 0;
Ritor1
parents:
diff changeset
1256 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1257 a1.spell_caster_pid = v12;
0
Ritor1
parents:
diff changeset
1258 a1.uFacing = 0;
Ritor1
parents:
diff changeset
1259 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
1260 v13 = sub_46A89E((int)v41, 100, 307);
Ritor1
parents:
diff changeset
1261 if ( v13 > 0 )
Ritor1
parents:
diff changeset
1262 {
Ritor1
parents:
diff changeset
1263 do
Ritor1
parents:
diff changeset
1264 {
Ritor1
parents:
diff changeset
1265 v14 = (unsigned int *)&v41[4 * v9];
Ritor1
parents:
diff changeset
1266 v15 = *v14;
Ritor1
parents:
diff changeset
1267 v16 = *v14;
Ritor1
parents:
diff changeset
1268 a1.vPosition.x = pActors[v16].vPosition.x;
Ritor1
parents:
diff changeset
1269 v17 = pActors[v16].vPosition.y;
Ritor1
parents:
diff changeset
1270 a1.vPosition.z = pActors[v16].vPosition.z;
Ritor1
parents:
diff changeset
1271 v18 = 8 * v15;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
1272 LOBYTE(v18) = PID(OBJECT_Actor,v15);
0
Ritor1
parents:
diff changeset
1273 a1.vPosition.y = v17;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
1274 a1.spell_target_pid = v18;
0
Ritor1
parents:
diff changeset
1275 v19 = a1.Create(0, 0, 0, 0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
1276 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3);
0
Ritor1
parents:
diff changeset
1277 ++v9;
Ritor1
parents:
diff changeset
1278 }
Ritor1
parents:
diff changeset
1279 while ( v9 < v13 );
Ritor1
parents:
diff changeset
1280 }
Ritor1
parents:
diff changeset
1281 }
Ritor1
parents:
diff changeset
1282 v44 = 0;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
1283 if (PartyHasDragon())
0
Ritor1
parents:
diff changeset
1284 v44 = 1;
Ritor1
parents:
diff changeset
1285 v49 = 0;
Ritor1
parents:
diff changeset
1286 LABEL_25:
Ritor1
parents:
diff changeset
1287 v20 = 0;
Ritor1
parents:
diff changeset
1288 v21 = &pParty->pPlayers[v49];
Ritor1
parents:
diff changeset
1289 v50 = 0;
Ritor1
parents:
diff changeset
1290 v47 = 0;
Ritor1
parents:
diff changeset
1291 v45 = 0;
Ritor1
parents:
diff changeset
1292 v48 = 0;
Ritor1
parents:
diff changeset
1293 v46 = 0;
255
0a37a56e9f02 sprintfex & classes enum
Nomad
parents: 254
diff changeset
1294 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK )
0
Ritor1
parents:
diff changeset
1295 v50 = 1;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
1296 if ( v21->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
1297 v48 = 1;
Ritor1
parents:
diff changeset
1298 v22 = (ITEM_EQUIP_TYPE)0;
Ritor1
parents:
diff changeset
1299 while ( 1 )
Ritor1
parents:
diff changeset
1300 {
Ritor1
parents:
diff changeset
1301 if ( v21->HasItemEquipped(v22) )
Ritor1
parents:
diff changeset
1302 {
Ritor1
parents:
diff changeset
1303 //v23 = v21->pEquipment.pIndices;
Ritor1
parents:
diff changeset
1304 auto _idx = v21->pEquipment.pIndices[v22];
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
1305 v24 = v21->pInventoryItemList[_idx].uItemID;
0
Ritor1
parents:
diff changeset
1306 if ( v24 > 134 )
Ritor1
parents:
diff changeset
1307 {
Ritor1
parents:
diff changeset
1308 if ( v24 == 529 )
Ritor1
parents:
diff changeset
1309 goto LABEL_43;
Ritor1
parents:
diff changeset
1310 if ( v24 == 535 )
Ritor1
parents:
diff changeset
1311 goto LABEL_44;
Ritor1
parents:
diff changeset
1312 if ( v24 == 515 )
Ritor1
parents:
diff changeset
1313 {
Ritor1
parents:
diff changeset
1314 v47 = 1;
Ritor1
parents:
diff changeset
1315 }
Ritor1
parents:
diff changeset
1316 else
Ritor1
parents:
diff changeset
1317 {
Ritor1
parents:
diff changeset
1318 if ( v24 == 532 )
Ritor1
parents:
diff changeset
1319 goto LABEL_50;
Ritor1
parents:
diff changeset
1320 }
Ritor1
parents:
diff changeset
1321 }
Ritor1
parents:
diff changeset
1322 else
Ritor1
parents:
diff changeset
1323 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
1324 v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
1325 if ( v25 <= 50 )
Ritor1
parents:
diff changeset
1326 {
Ritor1
parents:
diff changeset
1327 if ( v25 != 50 )
Ritor1
parents:
diff changeset
1328 {
Ritor1
parents:
diff changeset
1329 v26 = v25 - 37;
Ritor1
parents:
diff changeset
1330 if ( v26 )
Ritor1
parents:
diff changeset
1331 {
Ritor1
parents:
diff changeset
1332 v27 = v26 - 1;
Ritor1
parents:
diff changeset
1333 if ( !v27 )
Ritor1
parents:
diff changeset
1334 goto LABEL_50;
Ritor1
parents:
diff changeset
1335 v28 = v27 - 6;
Ritor1
parents:
diff changeset
1336 if ( v28 )
Ritor1
parents:
diff changeset
1337 {
Ritor1
parents:
diff changeset
1338 if ( v28 != 3 )
Ritor1
parents:
diff changeset
1339 goto LABEL_51;
Ritor1
parents:
diff changeset
1340 LABEL_50:
Ritor1
parents:
diff changeset
1341 v50 = 1;
Ritor1
parents:
diff changeset
1342 goto LABEL_51;
Ritor1
parents:
diff changeset
1343 }
Ritor1
parents:
diff changeset
1344 }
Ritor1
parents:
diff changeset
1345 }
Ritor1
parents:
diff changeset
1346 LABEL_44:
Ritor1
parents:
diff changeset
1347 v20 = 1;
Ritor1
parents:
diff changeset
1348 goto LABEL_51;
Ritor1
parents:
diff changeset
1349 }
Ritor1
parents:
diff changeset
1350 v29 = v25 - 54;
Ritor1
parents:
diff changeset
1351 if ( !v29 )
Ritor1
parents:
diff changeset
1352 goto LABEL_44;
Ritor1
parents:
diff changeset
1353 v30 = v29 - 1;
Ritor1
parents:
diff changeset
1354 if ( !v30 )
Ritor1
parents:
diff changeset
1355 goto LABEL_50;
Ritor1
parents:
diff changeset
1356 if ( v30 == 11 )
Ritor1
parents:
diff changeset
1357 {
Ritor1
parents:
diff changeset
1358 LABEL_43:
Ritor1
parents:
diff changeset
1359 v20 = 1;
Ritor1
parents:
diff changeset
1360 v50 = 1;
Ritor1
parents:
diff changeset
1361 goto LABEL_51;
Ritor1
parents:
diff changeset
1362 }
Ritor1
parents:
diff changeset
1363 }
Ritor1
parents:
diff changeset
1364 }
Ritor1
parents:
diff changeset
1365 LABEL_51:
Ritor1
parents:
diff changeset
1366 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1);
Ritor1
parents:
diff changeset
1367 if ( (signed int)v22 >= 16 )
Ritor1
parents:
diff changeset
1368 {
Ritor1
parents:
diff changeset
1369 if ( v48 )
Ritor1
parents:
diff changeset
1370 {
Ritor1
parents:
diff changeset
1371 v31 = 0;
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
1372 v32 = (char *)v21->pInventoryItemList;
0
Ritor1
parents:
diff changeset
1373 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 )
Ritor1
parents:
diff changeset
1374 {
Ritor1
parents:
diff changeset
1375 ++v31;
Ritor1
parents:
diff changeset
1376 v32 += 36;
Ritor1
parents:
diff changeset
1377 if ( v31 >= 138 )
Ritor1
parents:
diff changeset
1378 goto LABEL_59;
Ritor1
parents:
diff changeset
1379 }
Ritor1
parents:
diff changeset
1380 v48 = 0;
Ritor1
parents:
diff changeset
1381 v45 = 1;
Ritor1
parents:
diff changeset
1382 }
Ritor1
parents:
diff changeset
1383 LABEL_59:
Ritor1
parents:
diff changeset
1384 if ( v21->pConditions[17] )
Ritor1
parents:
diff changeset
1385 v46 = 1;
Ritor1
parents:
diff changeset
1386 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1387 {
Ritor1
parents:
diff changeset
1388 ++v21->sHealth;
Ritor1
parents:
diff changeset
1389 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
1390 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
1391 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
1392 {
Ritor1
parents:
diff changeset
1393 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
1394 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
1395 }
Ritor1
parents:
diff changeset
1396 v51 = 1;
Ritor1
parents:
diff changeset
1397 }
Ritor1
parents:
diff changeset
1398 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0
Ritor1
parents:
diff changeset
1399 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime))
Ritor1
parents:
diff changeset
1400 && !v21->pConditions[14]
Ritor1
parents:
diff changeset
1401 && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1402 {
Ritor1
parents:
diff changeset
1403 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower;
Ritor1
parents:
diff changeset
1404 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
1405 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
1406 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
1407 {
Ritor1
parents:
diff changeset
1408 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
1409 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
1410 }
Ritor1
parents:
diff changeset
1411 v51 = 1;
Ritor1
parents:
diff changeset
1412 }
Ritor1
parents:
diff changeset
1413 if ( v50 )
Ritor1
parents:
diff changeset
1414 {
Ritor1
parents:
diff changeset
1415 v33 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
1416 ++*(int *)v33;
Ritor1
parents:
diff changeset
1417 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
1418 *(int *)v33 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
1419 v51 = 1;
Ritor1
parents:
diff changeset
1420 }
Ritor1
parents:
diff changeset
1421 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1422 {
Ritor1
parents:
diff changeset
1423 v34 = LODWORD(v21->pConditions[13]);
Ritor1
parents:
diff changeset
1424 --v21->sHealth;
Ritor1
parents:
diff changeset
1425 v35 = v21->sHealth;
Ritor1
parents:
diff changeset
1426 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 )
Ritor1
parents:
diff changeset
1427 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1428 if ( v35 < 1 )
Ritor1
parents:
diff changeset
1429 {
Ritor1
parents:
diff changeset
1430 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
Ritor1
parents:
diff changeset
1431 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1432 {
Ritor1
parents:
diff changeset
1433 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1434 }
Ritor1
parents:
diff changeset
1435 else
Ritor1
parents:
diff changeset
1436 {
Ritor1
parents:
diff changeset
1437 if ( !v21->pConditions[14] )
Ritor1
parents:
diff changeset
1438 v21->pConditions[14] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1439 }
Ritor1
parents:
diff changeset
1440 }
Ritor1
parents:
diff changeset
1441 v51 = 1;
Ritor1
parents:
diff changeset
1442 }
Ritor1
parents:
diff changeset
1443 if ( v45 )
Ritor1
parents:
diff changeset
1444 {
Ritor1
parents:
diff changeset
1445 v36 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
1446 ++*(int *)v36;
Ritor1
parents:
diff changeset
1447 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
1448 *(int *)v36 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
1449 }
Ritor1
parents:
diff changeset
1450 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1451 {
Ritor1
parents:
diff changeset
1452 v37 = v21->sHealth;
Ritor1
parents:
diff changeset
1453 if ( v37 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
1454 v21->sHealth = v37 - 2;
Ritor1
parents:
diff changeset
1455 v38 = v21->sMana;
Ritor1
parents:
diff changeset
1456 if ( v38 > v21->GetMaxMana() / 2 )
Ritor1
parents:
diff changeset
1457 v21->sMana = v38 - 2;
Ritor1
parents:
diff changeset
1458 }
Ritor1
parents:
diff changeset
1459 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1460 {
Ritor1
parents:
diff changeset
1461 v39 = v21->sHealth;
Ritor1
parents:
diff changeset
1462 if ( v39 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
1463 v21->sHealth = v39 - 1;
Ritor1
parents:
diff changeset
1464 v40 = v21->sMana;
Ritor1
parents:
diff changeset
1465 if ( v40 > 0 )
Ritor1
parents:
diff changeset
1466 v21->sMana = v40 - 1;
Ritor1
parents:
diff changeset
1467 }
Ritor1
parents:
diff changeset
1468 ++v49;
Ritor1
parents:
diff changeset
1469 if ( v49 >= 4 )
Ritor1
parents:
diff changeset
1470 {
Ritor1
parents:
diff changeset
1471 result = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
1472 pParty->uLastRegenerationTime = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1473 if ( !viewparams->bRedrawGameUI )
Ritor1
parents:
diff changeset
1474 {
Ritor1
parents:
diff changeset
1475 result = v51;
Ritor1
parents:
diff changeset
1476 viewparams->bRedrawGameUI = v51;
Ritor1
parents:
diff changeset
1477 }
Ritor1
parents:
diff changeset
1478 return result;
Ritor1
parents:
diff changeset
1479 }
Ritor1
parents:
diff changeset
1480 goto LABEL_25;
Ritor1
parents:
diff changeset
1481 }
Ritor1
parents:
diff changeset
1482 }
Ritor1
parents:
diff changeset
1483 }
Ritor1
parents:
diff changeset
1484 return result;
Ritor1
parents:
diff changeset
1485 }
Ritor1
parents:
diff changeset
1486
Ritor1
parents:
diff changeset
1487 //----- (00493F79) --------------------------------------------------------
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1488 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
0
Ritor1
parents:
diff changeset
1489 {
Ritor1
parents:
diff changeset
1490 signed __int64 v2; // ST2C_8@1
Ritor1
parents:
diff changeset
1491 signed __int64 v3; // qax@1
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1492 //signed __int64 v4; // ST1C_8@1
0
Ritor1
parents:
diff changeset
1493 unsigned __int64 v5; // qax@1
Ritor1
parents:
diff changeset
1494 unsigned int v6; // ebx@1
Ritor1
parents:
diff changeset
1495
Ritor1
parents:
diff changeset
1496 v2 = (signed __int64)((double)a2 * 0.234375);
Ritor1
parents:
diff changeset
1497 v3 = v2 / 60 / 60;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1498 //v4 = v3;
0
Ritor1
parents:
diff changeset
1499 v5 = (unsigned int)v3 / 0x18;
Ritor1
parents:
diff changeset
1500 v6 = (unsigned int)(v5 / 7) >> 2;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1501 _this->field_0_expire_second = v2 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1502 _this->field_4_expire_minute = v2 / 60 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1503 _this->field_8_expire_hour = v3 % 24;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1504 _this->field_10_expire_week = v5 / 7 & 3;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1505 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1506 _this->field_14_exprie_month = v6 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
1507 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
1508 }
Ritor1
parents:
diff changeset
1509
Ritor1
parents:
diff changeset
1510 //----- (00494035) --------------------------------------------------------
1031
f93d17337113 UI stuff.
Nomad
parents: 1029
diff changeset
1511 void _494035_timed_effects__water_walking_damage__etc()
0
Ritor1
parents:
diff changeset
1512 {
Ritor1
parents:
diff changeset
1513 signed __int64 v0; // qax@1
Ritor1
parents:
diff changeset
1514 signed __int64 v1; // ST30_8@1
Ritor1
parents:
diff changeset
1515 signed __int64 v2; // ST38_8@1
Ritor1
parents:
diff changeset
1516 unsigned __int64 v3; // qax@1
Ritor1
parents:
diff changeset
1517 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
1518 //signed int v5; // eax@4
Ritor1
parents:
diff changeset
1519 //char *v6; // ecx@5
Ritor1
parents:
diff changeset
1520 //Player *v7; // esi@8
Ritor1
parents:
diff changeset
1521 //char *v8; // ecx@12
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1522 //Player *pPlayer; // esi@15
0
Ritor1
parents:
diff changeset
1523 //void *v10; // esi@25
Ritor1
parents:
diff changeset
1524 unsigned int v11; // ecx@27
Ritor1
parents:
diff changeset
1525 signed int v12; // edi@29
Ritor1
parents:
diff changeset
1526 Player *v13; // ecx@30
Ritor1
parents:
diff changeset
1527 Player *v14; // esi@35
Ritor1
parents:
diff changeset
1528 double v15; // st7@35
Ritor1
parents:
diff changeset
1529 Player **v16; // esi@43
Ritor1
parents:
diff changeset
1530 Player *v17; // edi@44
Ritor1
parents:
diff changeset
1531 double v18; // st7@44
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1532 //float v19; // ST28_4@48
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1533 //double v20; // ST38_8@48
0
Ritor1
parents:
diff changeset
1534 Player *v21; // esi@51
Ritor1
parents:
diff changeset
1535 signed int v22; // edi@53
Ritor1
parents:
diff changeset
1536 int v23; // eax@59
Ritor1
parents:
diff changeset
1537 int v24; // ecx@60
Ritor1
parents:
diff changeset
1538 int v25; // eax@63
Ritor1
parents:
diff changeset
1539 int v26; // ecx@64
Ritor1
parents:
diff changeset
1540 int v27; // eax@67
Ritor1
parents:
diff changeset
1541 int v28; // ecx@68
Ritor1
parents:
diff changeset
1542 int v29; // eax@71
Ritor1
parents:
diff changeset
1543 int v30; // ecx@72
Ritor1
parents:
diff changeset
1544 int v31; // eax@75
Ritor1
parents:
diff changeset
1545 int v32; // ecx@76
Ritor1
parents:
diff changeset
1546 int v33; // eax@79
Ritor1
parents:
diff changeset
1547 int v34; // ecx@80
Ritor1
parents:
diff changeset
1548 int v35; // eax@83
Ritor1
parents:
diff changeset
1549 int v36; // ecx@84
Ritor1
parents:
diff changeset
1550 int v37; // eax@87
Ritor1
parents:
diff changeset
1551 int v38; // ecx@88
Ritor1
parents:
diff changeset
1552 int v39; // eax@91
Ritor1
parents:
diff changeset
1553 int v40; // ecx@92
Ritor1
parents:
diff changeset
1554 int v41; // eax@95
Ritor1
parents:
diff changeset
1555 int v42; // ecx@96
Ritor1
parents:
diff changeset
1556 bool v43; // ebx@102
Ritor1
parents:
diff changeset
1557 //SpellBuff *v44; // edi@104
Ritor1
parents:
diff changeset
1558 //signed int v45; // ebp@104
Ritor1
parents:
diff changeset
1559 bool v46; // edi@111
Ritor1
parents:
diff changeset
1560 //SpellBuff *v47; // esi@113
Ritor1
parents:
diff changeset
1561 //Player **v48; // esi@119
Ritor1
parents:
diff changeset
1562 //signed int v49; // edi@121
Ritor1
parents:
diff changeset
1563 //char *v50; // esi@122
Ritor1
parents:
diff changeset
1564 signed int v51; // edx@128
Ritor1
parents:
diff changeset
1565 signed int v52; // ecx@130
Ritor1
parents:
diff changeset
1566 int v53; // eax@131
Ritor1
parents:
diff changeset
1567 Player *v54; // eax@141
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1568 //unsigned int v55; // [sp-8h] [bp-38h]@18
0
Ritor1
parents:
diff changeset
1569 unsigned int v56; // [sp-8h] [bp-38h]@55
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1570 //int v57; // [sp-4h] [bp-34h]@18
0
Ritor1
parents:
diff changeset
1571 int v58; // [sp-4h] [bp-34h]@33
Ritor1
parents:
diff changeset
1572 int v59; // [sp-4h] [bp-34h]@55
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1573 //unsigned int v60; // [sp+10h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
1574 unsigned int v61; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
1575 Player **v62; // [sp+14h] [bp-1Ch]@50
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1576 //unsigned int a2; // [sp+18h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
1577 signed int a2a; // [sp+18h] [bp-18h]@47
Ritor1
parents:
diff changeset
1578 signed int v65; // [sp+1Ch] [bp-14h]@47
Ritor1
parents:
diff changeset
1579
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1580 //a2 = pParty->uCurrentHour;
0
Ritor1
parents:
diff changeset
1581 v61 = pParty->uDaysPlayed;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1582 //auto prev_time = pEventTimer->uTimeElapsed;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1583 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1584 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60;
0
Ritor1
parents:
diff changeset
1585 v1 = v0;
Ritor1
parents:
diff changeset
1586 v0 /= 60i64;
Ritor1
parents:
diff changeset
1587 v2 = v0;
Ritor1
parents:
diff changeset
1588 v3 = (unsigned int)v0 / 24;
Ritor1
parents:
diff changeset
1589 v4 = (unsigned int)(v3 / 7) >> 2;
Ritor1
parents:
diff changeset
1590 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
Ritor1
parents:
diff changeset
1591 pParty->uCurrentMinute = v1 % 60;
Ritor1
parents:
diff changeset
1592 pParty->uCurrentMonthWeek = v3 / 7 & 3;
Ritor1
parents:
diff changeset
1593 pParty->uCurrentHour = v2 % 24;
Ritor1
parents:
diff changeset
1594 pParty->uDaysPlayed = (unsigned int)v3 % 28;
Ritor1
parents:
diff changeset
1595 pParty->uCurrentMonth = v4 % 12;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
1596 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1597 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns
0
Ritor1
parents:
diff changeset
1598 {
Ritor1
parents:
diff changeset
1599 pParty->pHirelings[0].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1600 pParty->pHirelings[1].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1601
Ritor1
parents:
diff changeset
1602 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
Ritor1
parents:
diff changeset
1603 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1604
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1605 ++pParty->days_played_without_rest;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1606 if (pParty->days_played_without_rest > 1)
0
Ritor1
parents:
diff changeset
1607 {
Ritor1
parents:
diff changeset
1608 for (uint i = 0; i < 4; ++i)
1361
b3ac17fd12de Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents: 1358
diff changeset
1609 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0);
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1610
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1611 if (pParty->uNumFoodRations)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1612 Party::TakeFood(1);
0
Ritor1
parents:
diff changeset
1613 else
Ritor1
parents:
diff changeset
1614 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1615 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1616
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1617 if (pParty->days_played_without_rest > 3)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1618 for (uint i = 0; i < 4; ++i)
0
Ritor1
parents:
diff changeset
1619 {
1362
d6cf8ead9242 Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents: 1361
diff changeset
1620 Player* player = pParty->pPlayers + i;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1621
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1622 player->Zero();
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1623
1362
d6cf8ead9242 Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents: 1361
diff changeset
1624 if (!player->IsPertified() && !player->IsEradicated() && !player->IsDead())
0
Ritor1
parents:
diff changeset
1625 {
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
1626 if (rand() % 100 < 5 * pParty->days_played_without_rest)
1361
b3ac17fd12de Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents: 1358
diff changeset
1627 player->SetCondDeadWithBlockCheck(0);
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
1628 if (rand() % 100 < 10 * pParty->days_played_without_rest)
1361
b3ac17fd12de Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents: 1358
diff changeset
1629 player->SetCondInsaneWithBlockCheck(0);
0
Ritor1
parents:
diff changeset
1630 }
Ritor1
parents:
diff changeset
1631 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1632 }
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1633 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
Ritor1
parents:
diff changeset
1634 pOutdoor->SetFog();
Ritor1
parents:
diff changeset
1635
Ritor1
parents:
diff changeset
1636 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1637 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
1638 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1639
0
Ritor1
parents:
diff changeset
1640 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
1641 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )
Ritor1
parents:
diff changeset
1642 {
Ritor1
parents:
diff changeset
1643 v12 = 1;
Ritor1
parents:
diff changeset
1644 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128;
Ritor1
parents:
diff changeset
1645 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1646 while ( 1 )
Ritor1
parents:
diff changeset
1647 {
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1037
diff changeset
1648 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
99
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
1649 || pPlayers[v12]->HasEnchantedItemEquipped(71)
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
1650 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
1651 {
Ritor1
parents:
diff changeset
1652 v58 = 0;
Ritor1
parents:
diff changeset
1653 }
Ritor1
parents:
diff changeset
1654 else
Ritor1
parents:
diff changeset
1655 {
Ritor1
parents:
diff changeset
1656 v58 = 0;
Ritor1
parents:
diff changeset
1657 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) )
Ritor1
parents:
diff changeset
1658 {
Ritor1
parents:
diff changeset
1659 v14 = pPlayers[v12];
Ritor1
parents:
diff changeset
1660 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1;
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1661 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
1662 if ( pParty->uFlags & 4 )
Ritor1
parents:
diff changeset
1663 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1664 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
1665 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
1666 }
Ritor1
parents:
diff changeset
1667 goto LABEL_39;
Ritor1
parents:
diff changeset
1668 }
Ritor1
parents:
diff changeset
1669 v13 = pPlayers[v12];
Ritor1
parents:
diff changeset
1670 }
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
1671 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
0
Ritor1
parents:
diff changeset
1672 LABEL_39:
Ritor1
parents:
diff changeset
1673 ++v12;
Ritor1
parents:
diff changeset
1674 if ( v12 > 4 )
Ritor1
parents:
diff changeset
1675 {
Ritor1
parents:
diff changeset
1676 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
1677 break;
Ritor1
parents:
diff changeset
1678 }
Ritor1
parents:
diff changeset
1679 }
Ritor1
parents:
diff changeset
1680 }
Ritor1
parents:
diff changeset
1681 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) )
Ritor1
parents:
diff changeset
1682 {
Ritor1
parents:
diff changeset
1683 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1684 pParty->field_6FC = v11 + 128;
Ritor1
parents:
diff changeset
1685 v16 = &pPlayers[1];
Ritor1
parents:
diff changeset
1686 do
Ritor1
parents:
diff changeset
1687 {
Ritor1
parents:
diff changeset
1688 v17 = *v16;
Ritor1
parents:
diff changeset
1689 v18 = (double)(*v16)->GetMaxHealth() * 0.1;
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1690 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
1691 if ( pParty->uFlags & 0x200 )
Ritor1
parents:
diff changeset
1692 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1693 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
1694 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
1695 }
Ritor1
parents:
diff changeset
1696 ++v16;
Ritor1
parents:
diff changeset
1697 }
Ritor1
parents:
diff changeset
1698 while ( (signed int)v16 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
1699 }
Ritor1
parents:
diff changeset
1700 _493938_regenerate();
Ritor1
parents:
diff changeset
1701 v65 = 4;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1702 a2a = pEventTimer->uTimeElapsed;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1703 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1704 {
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1705 //v19 = (double)(signed int)prev_time * 0.5;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1706 //v20 = v19 + 6.7553994e15;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1707 a2a *= 0.5f;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1708 if (a2a < 1)
0
Ritor1
parents:
diff changeset
1709 a2a = 1;
Ritor1
parents:
diff changeset
1710 }
Ritor1
parents:
diff changeset
1711 v62 = &pPlayers[1];
Ritor1
parents:
diff changeset
1712 do
Ritor1
parents:
diff changeset
1713 {
Ritor1
parents:
diff changeset
1714 v21 = *v62;
Ritor1
parents:
diff changeset
1715 if ( (*v62)->uTimeToRecovery )
Ritor1
parents:
diff changeset
1716 v21->Recover(a2a);
Ritor1
parents:
diff changeset
1717 v22 = v21->sHealth;
Ritor1
parents:
diff changeset
1718 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1
Ritor1
parents:
diff changeset
1719 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1720 {
Ritor1
parents:
diff changeset
1721 if ( v22 >= 1 )
Ritor1
parents:
diff changeset
1722 goto LABEL_59;
Ritor1
parents:
diff changeset
1723 v59 = 0;
Ritor1
parents:
diff changeset
1724 v56 = 13;
Ritor1
parents:
diff changeset
1725 }
Ritor1
parents:
diff changeset
1726 else
Ritor1
parents:
diff changeset
1727 {
Ritor1
parents:
diff changeset
1728 v59 = 0;
Ritor1
parents:
diff changeset
1729 v56 = 14;
Ritor1
parents:
diff changeset
1730 }
Ritor1
parents:
diff changeset
1731 v21->SetCondition(v56, v59);
Ritor1
parents:
diff changeset
1732 LABEL_59:
Ritor1
parents:
diff changeset
1733 v23 = (int)&v21->field_E0;
Ritor1
parents:
diff changeset
1734 if ( v21->field_E0 )
Ritor1
parents:
diff changeset
1735 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1736 v24 = *(int *)v23 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1737 if ( v24 > 0 )
Ritor1
parents:
diff changeset
1738 {
Ritor1
parents:
diff changeset
1739 *(int *)v23 = v24;
Ritor1
parents:
diff changeset
1740 }
Ritor1
parents:
diff changeset
1741 else
Ritor1
parents:
diff changeset
1742 {
Ritor1
parents:
diff changeset
1743 *(int *)v23 = 0;
Ritor1
parents:
diff changeset
1744 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1745 }
Ritor1
parents:
diff changeset
1746 }
Ritor1
parents:
diff changeset
1747 v25 = (int)&v21->field_E4;
Ritor1
parents:
diff changeset
1748 if ( v21->field_E4 )
Ritor1
parents:
diff changeset
1749 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1750 v26 = *(int *)v25 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1751 if ( v26 > 0 )
Ritor1
parents:
diff changeset
1752 {
Ritor1
parents:
diff changeset
1753 *(int *)v25 = v26;
Ritor1
parents:
diff changeset
1754 }
Ritor1
parents:
diff changeset
1755 else
Ritor1
parents:
diff changeset
1756 {
Ritor1
parents:
diff changeset
1757 *(int *)v25 = 0;
Ritor1
parents:
diff changeset
1758 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1759 }
Ritor1
parents:
diff changeset
1760 }
Ritor1
parents:
diff changeset
1761 v27 = (int)&v21->field_E8;
Ritor1
parents:
diff changeset
1762 if ( v21->field_E8 )
Ritor1
parents:
diff changeset
1763 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1764 v28 = *(int *)v27 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1765 if ( v28 > 0 )
Ritor1
parents:
diff changeset
1766 {
Ritor1
parents:
diff changeset
1767 *(int *)v27 = v28;
Ritor1
parents:
diff changeset
1768 }
Ritor1
parents:
diff changeset
1769 else
Ritor1
parents:
diff changeset
1770 {
Ritor1
parents:
diff changeset
1771 *(int *)v27 = 0;
Ritor1
parents:
diff changeset
1772 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1773 }
Ritor1
parents:
diff changeset
1774 }
Ritor1
parents:
diff changeset
1775 v29 = (int)&v21->field_EC;
Ritor1
parents:
diff changeset
1776 if ( v21->field_EC )
Ritor1
parents:
diff changeset
1777 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1778 v30 = *(int *)v29 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1779 if ( v30 > 0 )
Ritor1
parents:
diff changeset
1780 {
Ritor1
parents:
diff changeset
1781 *(int *)v29 = v30;
Ritor1
parents:
diff changeset
1782 }
Ritor1
parents:
diff changeset
1783 else
Ritor1
parents:
diff changeset
1784 {
Ritor1
parents:
diff changeset
1785 *(int *)v29 = 0;
Ritor1
parents:
diff changeset
1786 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1787 }
Ritor1
parents:
diff changeset
1788 }
Ritor1
parents:
diff changeset
1789 v31 = (int)&v21->field_F0;
Ritor1
parents:
diff changeset
1790 if ( v21->field_F0 )
Ritor1
parents:
diff changeset
1791 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1792 v32 = *(int *)v31 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1793 if ( v32 > 0 )
Ritor1
parents:
diff changeset
1794 {
Ritor1
parents:
diff changeset
1795 *(int *)v31 = v32;
Ritor1
parents:
diff changeset
1796 }
Ritor1
parents:
diff changeset
1797 else
Ritor1
parents:
diff changeset
1798 {
Ritor1
parents:
diff changeset
1799 *(int *)v31 = 0;
Ritor1
parents:
diff changeset
1800 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1801 }
Ritor1
parents:
diff changeset
1802 }
Ritor1
parents:
diff changeset
1803 v33 = (int)&v21->field_F4;
Ritor1
parents:
diff changeset
1804 if ( v21->field_F4 )
Ritor1
parents:
diff changeset
1805 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1806 v34 = *(int *)v33 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1807 if ( v34 > 0 )
Ritor1
parents:
diff changeset
1808 {
Ritor1
parents:
diff changeset
1809 *(int *)v33 = v34;
Ritor1
parents:
diff changeset
1810 }
Ritor1
parents:
diff changeset
1811 else
Ritor1
parents:
diff changeset
1812 {
Ritor1
parents:
diff changeset
1813 *(int *)v33 = 0;
Ritor1
parents:
diff changeset
1814 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1815 }
Ritor1
parents:
diff changeset
1816 }
Ritor1
parents:
diff changeset
1817 v35 = (int)&v21->field_F8;
Ritor1
parents:
diff changeset
1818 if ( v21->field_F8 )
Ritor1
parents:
diff changeset
1819 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1820 v36 = *(int *)v35 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1821 if ( v36 > 0 )
Ritor1
parents:
diff changeset
1822 {
Ritor1
parents:
diff changeset
1823 *(int *)v35 = v36;
Ritor1
parents:
diff changeset
1824 }
Ritor1
parents:
diff changeset
1825 else
Ritor1
parents:
diff changeset
1826 {
Ritor1
parents:
diff changeset
1827 *(int *)v35 = 0;
Ritor1
parents:
diff changeset
1828 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1829 }
Ritor1
parents:
diff changeset
1830 }
Ritor1
parents:
diff changeset
1831 v37 = (int)&v21->field_FC;
Ritor1
parents:
diff changeset
1832 if ( v21->field_FC )
Ritor1
parents:
diff changeset
1833 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1834 v38 = *(int *)v37 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1835 if ( v38 > 0 )
Ritor1
parents:
diff changeset
1836 {
Ritor1
parents:
diff changeset
1837 *(int *)v37 = v38;
Ritor1
parents:
diff changeset
1838 }
Ritor1
parents:
diff changeset
1839 else
Ritor1
parents:
diff changeset
1840 {
Ritor1
parents:
diff changeset
1841 *(int *)v37 = 0;
Ritor1
parents:
diff changeset
1842 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1843 }
Ritor1
parents:
diff changeset
1844 }
Ritor1
parents:
diff changeset
1845 v39 = (int)&v21->field_100;
Ritor1
parents:
diff changeset
1846 if ( v21->field_100 )
Ritor1
parents:
diff changeset
1847 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1848 v40 = *(int *)v39 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1849 if ( v40 > 0 )
Ritor1
parents:
diff changeset
1850 {
Ritor1
parents:
diff changeset
1851 *(int *)v39 = v40;
Ritor1
parents:
diff changeset
1852 }
Ritor1
parents:
diff changeset
1853 else
Ritor1
parents:
diff changeset
1854 {
Ritor1
parents:
diff changeset
1855 *(int *)v39 = 0;
Ritor1
parents:
diff changeset
1856 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1857 }
Ritor1
parents:
diff changeset
1858 }
Ritor1
parents:
diff changeset
1859 v41 = (int)&v21->field_104;
Ritor1
parents:
diff changeset
1860 if ( v21->field_104 )
Ritor1
parents:
diff changeset
1861 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1862 v42 = *(int *)v41 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1863 if ( v42 > 0 )
Ritor1
parents:
diff changeset
1864 {
Ritor1
parents:
diff changeset
1865 *(int *)v41 = v42;
Ritor1
parents:
diff changeset
1866 }
Ritor1
parents:
diff changeset
1867 else
Ritor1
parents:
diff changeset
1868 {
Ritor1
parents:
diff changeset
1869 *(int *)v41 = 0;
Ritor1
parents:
diff changeset
1870 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1871 }
Ritor1
parents:
diff changeset
1872 }
Ritor1
parents:
diff changeset
1873 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] )
Ritor1
parents:
diff changeset
1874 --v65;
Ritor1
parents:
diff changeset
1875 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0;
Ritor1
parents:
diff changeset
1876
Ritor1
parents:
diff changeset
1877 for (uint k = 0; k < 24; ++k)
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1878 v21->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed);
0
Ritor1
parents:
diff changeset
1879
Ritor1
parents:
diff changeset
1880 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
1881 v21->SetCondition(1u, 0);
Ritor1
parents:
diff changeset
1882 ++v62;
Ritor1
parents:
diff changeset
1883 }
Ritor1
parents:
diff changeset
1884 while ( (signed int)v62 <= (signed int)&pPlayers[4] );
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1885 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
0
Ritor1
parents:
diff changeset
1886
Ritor1
parents:
diff changeset
1887 for (uint i = 0; i < 20; ++i)
Ritor1
parents:
diff changeset
1888 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1889 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1)
0
Ritor1
parents:
diff changeset
1890 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1891 }
Ritor1
parents:
diff changeset
1892
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1893 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 )
0
Ritor1
parents:
diff changeset
1894 {
Ritor1
parents:
diff changeset
1895 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1896 pParty->pPlayers[i].SetCondition(1, 0);
Ritor1
parents:
diff changeset
1897 }
Ritor1
parents:
diff changeset
1898
Ritor1
parents:
diff changeset
1899 for (uint i = 0; i < 2; ++i)
Ritor1
parents:
diff changeset
1900 {
Ritor1
parents:
diff changeset
1901 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]];
Ritor1
parents:
diff changeset
1902 if (pBuf->uExpireTime == 0)
Ritor1
parents:
diff changeset
1903 continue;
Ritor1
parents:
diff changeset
1904
Ritor1
parents:
diff changeset
1905 if ( !(pBuf->uFlags & 1) )
Ritor1
parents:
diff changeset
1906 {
Ritor1
parents:
diff changeset
1907 if (!pPlayers[pBuf->uCaster]->CanAct())
Ritor1
parents:
diff changeset
1908 {
Ritor1
parents:
diff changeset
1909 pBuf->Reset();
Ritor1
parents:
diff changeset
1910 if (dword_4EE07C[i] == 7 )
Ritor1
parents:
diff changeset
1911 pParty->bFlying = false;
Ritor1
parents:
diff changeset
1912 }
Ritor1
parents:
diff changeset
1913 }
Ritor1
parents:
diff changeset
1914 }
Ritor1
parents:
diff changeset
1915
Ritor1
parents:
diff changeset
1916 v51 = v65;
Ritor1
parents:
diff changeset
1917 if ( v65 )
Ritor1
parents:
diff changeset
1918 goto LABEL_135;
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1919 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
1920 {
Ritor1
parents:
diff changeset
1921 v52 = (signed int)&pPlayers[1];
Ritor1
parents:
diff changeset
1922 while ( 1 )
Ritor1
parents:
diff changeset
1923 {
Ritor1
parents:
diff changeset
1924 v53 = *(int *)v52;
Ritor1
parents:
diff changeset
1925 if ( *(_QWORD *)(*(int *)v52 + 16) )
Ritor1
parents:
diff changeset
1926 break;
Ritor1
parents:
diff changeset
1927 v52 += 4;
Ritor1
parents:
diff changeset
1928 if ( v52 > (signed int)&pPlayers[4] )
Ritor1
parents:
diff changeset
1929 goto LABEL_135;
Ritor1
parents:
diff changeset
1930 }
Ritor1
parents:
diff changeset
1931 *(int *)(v53 + 16) = 0;
Ritor1
parents:
diff changeset
1932 *(int *)(v53 + 20) = 0;
Ritor1
parents:
diff changeset
1933 v51 = 1;
Ritor1
parents:
diff changeset
1934 LABEL_135:
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1935 if ( pCurrentScreen != SCREEN_REST
0
Ritor1
parents:
diff changeset
1936 && (!v51 || dword_5C35C0) )
981
a6ef7125f6e4 Autonotes & GameState
Nomad
parents: 978
diff changeset
1937 uGameState = GAME_STATE_PARTY_DIED;
0
Ritor1
parents:
diff changeset
1938 }
Ritor1
parents:
diff changeset
1939 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
1940 {
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1941 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
1942 {
Ritor1
parents:
diff changeset
1943 v54 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
1944 if ( v54->pConditions[2]
Ritor1
parents:
diff changeset
1945 || v54->pConditions[12]
Ritor1
parents:
diff changeset
1946 || v54->pConditions[13]
Ritor1
parents:
diff changeset
1947 || v54->pConditions[14]
Ritor1
parents:
diff changeset
1948 || v54->pConditions[15]
Ritor1
parents:
diff changeset
1949 || v54->pConditions[16] )
Ritor1
parents:
diff changeset
1950 {
Ritor1
parents:
diff changeset
1951 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1952 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
1953 }
Ritor1
parents:
diff changeset
1954 }
Ritor1
parents:
diff changeset
1955 }
Ritor1
parents:
diff changeset
1956 }
Ritor1
parents:
diff changeset
1957
Ritor1
parents:
diff changeset
1958 //----- (00494820) --------------------------------------------------------
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1959 unsigned int __fastcall _494820_training_time(unsigned int a1)
0
Ritor1
parents:
diff changeset
1960 {
Ritor1
parents:
diff changeset
1961 signed int v1; // eax@1
Ritor1
parents:
diff changeset
1962
Ritor1
parents:
diff changeset
1963 v1 = 5;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1964 if ( a1 % 24 >= 5 )
0
Ritor1
parents:
diff changeset
1965 v1 = 29;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1966 return v1 - a1 % 24;
0
Ritor1
parents:
diff changeset
1967 }
Ritor1
parents:
diff changeset
1968
Ritor1
parents:
diff changeset
1969 //----- (00494836) --------------------------------------------------------
Ritor1
parents:
diff changeset
1970 int stru339_spell_sound::_494836(int uSoundID, int a6)
Ritor1
parents:
diff changeset
1971 {
Ritor1
parents:
diff changeset
1972 int v3; // esi@1
Ritor1
parents:
diff changeset
1973 int result; // eax@1
Ritor1
parents:
diff changeset
1974 stru339_spell_sound *v5; // ebx@1
Ritor1
parents:
diff changeset
1975 int *v6; // edi@2
Ritor1
parents:
diff changeset
1976 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
1977 int v8; // [sp+Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
1978 int v9; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
1979 int a2a; // [sp+1Ch] [bp+8h]@1
Ritor1
parents:
diff changeset
1980
Ritor1
parents:
diff changeset
1981 v3 = 0;
Ritor1
parents:
diff changeset
1982 result = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
1983 v5 = this;
Ritor1
parents:
diff changeset
1984 a2a = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
1985 if ( result )
Ritor1
parents:
diff changeset
1986 {
Ritor1
parents:
diff changeset
1987 v9 = 0;
Ritor1
parents:
diff changeset
1988 v6 = this->pSoundsOffsets;
Ritor1
parents:
diff changeset
1989 do
Ritor1
parents:
diff changeset
1990 {
Ritor1
parents:
diff changeset
1991 v7 = a2a++;
Ritor1
parents:
diff changeset
1992 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6);
Ritor1
parents:
diff changeset
1993 if ( !result )
Ritor1
parents:
diff changeset
1994 break;
Ritor1
parents:
diff changeset
1995 a6 += 4;
Ritor1
parents:
diff changeset
1996 result = v8 + 256;
Ritor1
parents:
diff changeset
1997 *v6 = v3;
Ritor1
parents:
diff changeset
1998 v3 += result;
Ritor1
parents:
diff changeset
1999 ++v9;
Ritor1
parents:
diff changeset
2000 *(v6 - 2) = result;
Ritor1
parents:
diff changeset
2001 ++v6;
Ritor1
parents:
diff changeset
2002 }
Ritor1
parents:
diff changeset
2003 while ( v9 < 2 );
Ritor1
parents:
diff changeset
2004 }
Ritor1
parents:
diff changeset
2005 return result;
Ritor1
parents:
diff changeset
2006 }
Ritor1
parents:
diff changeset
2007 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
2008
Ritor1
parents:
diff changeset
2009 //----- (00494AED) --------------------------------------------------------
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2010 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
0
Ritor1
parents:
diff changeset
2011 {
Ritor1
parents:
diff changeset
2012 unsigned int _uNumFrames; // edx@1
Ritor1
parents:
diff changeset
2013 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
2014 PlayerFrame *v4; // ecx@2
Ritor1
parents:
diff changeset
2015
Ritor1
parents:
diff changeset
2016 _uNumFrames = this->uNumFrames;
Ritor1
parents:
diff changeset
2017 result = 0;
Ritor1
parents:
diff changeset
2018 if ( (signed int)this->uNumFrames <= 0 )
Ritor1
parents:
diff changeset
2019 {
Ritor1
parents:
diff changeset
2020 LABEL_5:
Ritor1
parents:
diff changeset
2021 result = 0;
Ritor1
parents:
diff changeset
2022 }
Ritor1
parents:
diff changeset
2023 else
Ritor1
parents:
diff changeset
2024 {
Ritor1
parents:
diff changeset
2025 v4 = this->pFrames;
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2026 while ( v4->expression != expression )
0
Ritor1
parents:
diff changeset
2027 {
Ritor1
parents:
diff changeset
2028 ++result;
Ritor1
parents:
diff changeset
2029 ++v4;
Ritor1
parents:
diff changeset
2030 if ( (signed int)result >= (signed int)_uNumFrames )
Ritor1
parents:
diff changeset
2031 goto LABEL_5;
Ritor1
parents:
diff changeset
2032 }
Ritor1
parents:
diff changeset
2033 }
Ritor1
parents:
diff changeset
2034 return result;
Ritor1
parents:
diff changeset
2035 }
Ritor1
parents:
diff changeset
2036
Ritor1
parents:
diff changeset
2037 //----- (00494B10) --------------------------------------------------------
Ritor1
parents:
diff changeset
2038 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
2039 {
Ritor1
parents:
diff changeset
2040 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
2041 PlayerFrame *v4; // edi@1
Ritor1
parents:
diff changeset
2042 PlayerFrame *v5; // ecx@1
Ritor1
parents:
diff changeset
2043 __int16 v6; // dx@2
Ritor1
parents:
diff changeset
2044 int v7; // edx@3
Ritor1
parents:
diff changeset
2045 char *i; // eax@3
Ritor1
parents:
diff changeset
2046 int v9; // ecx@5
Ritor1
parents:
diff changeset
2047 PlayerFrame *result; // eax@6
Ritor1
parents:
diff changeset
2048
Ritor1
parents:
diff changeset
2049 v3 = uFramesetID;
Ritor1
parents:
diff changeset
2050 v4 = this->pFrames;
Ritor1
parents:
diff changeset
2051 v5 = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2052 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
2053 {
Ritor1
parents:
diff changeset
2054 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6;
Ritor1
parents:
diff changeset
2055 for ( i = (char *)&v5->uAnimTime; ; i += 10 )
Ritor1
parents:
diff changeset
2056 {
Ritor1
parents:
diff changeset
2057 v9 = *(short *)i;
Ritor1
parents:
diff changeset
2058 if ( v7 <= v9 )
Ritor1
parents:
diff changeset
2059 break;
Ritor1
parents:
diff changeset
2060 v7 -= v9;
Ritor1
parents:
diff changeset
2061 ++v3;
Ritor1
parents:
diff changeset
2062 }
Ritor1
parents:
diff changeset
2063 result = &v4[v3];
Ritor1
parents:
diff changeset
2064 }
Ritor1
parents:
diff changeset
2065 else
Ritor1
parents:
diff changeset
2066 {
Ritor1
parents:
diff changeset
2067 result = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2068 }
Ritor1
parents:
diff changeset
2069 return result;
Ritor1
parents:
diff changeset
2070 }
Ritor1
parents:
diff changeset
2071
Ritor1
parents:
diff changeset
2072 //----- (00494B5E) --------------------------------------------------------
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2073 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
0
Ritor1
parents:
diff changeset
2074 {
Ritor1
parents:
diff changeset
2075 PlayerFrameTable *v4; // edi@1
Ritor1
parents:
diff changeset
2076 int v5; // esi@1
Ritor1
parents:
diff changeset
2077 int v6; // eax@2
Ritor1
parents:
diff changeset
2078
Ritor1
parents:
diff changeset
2079 v4 = this;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2080 v5 = a4 + *pAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2081 if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime )
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2082 {
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2083 *pAnimTime = v5;
0
Ritor1
parents:
diff changeset
2084 }
Ritor1
parents:
diff changeset
2085 else
Ritor1
parents:
diff changeset
2086 {
Ritor1
parents:
diff changeset
2087 v6 = rand() % 4 + 21;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2088 *pFramesetID = v6;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2089 *pAnimTime = 8 * v5 % v4->pFrames[v6].uAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2090 }
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2091 return &v4->pFrames[*pFramesetID];
0
Ritor1
parents:
diff changeset
2092 }
Ritor1
parents:
diff changeset
2093
Ritor1
parents:
diff changeset
2094 //----- (00494BC3) --------------------------------------------------------
Ritor1
parents:
diff changeset
2095 void PlayerFrameTable::ToFile()
Ritor1
parents:
diff changeset
2096 {
Ritor1
parents:
diff changeset
2097 PlayerFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
2098 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
2099 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
2100
Ritor1
parents:
diff changeset
2101 auto Str = this;
Ritor1
parents:
diff changeset
2102
Ritor1
parents:
diff changeset
2103 v1 = Str;
Ritor1
parents:
diff changeset
2104 v2 = fopen("data\\dpft.bin", "wb");
Ritor1
parents:
diff changeset
2105 v3 = v2;
Ritor1
parents:
diff changeset
2106 if ( !v2 )
Ritor1
parents:
diff changeset
2107 Abortf("Unable to save dpft.bin!");
Ritor1
parents:
diff changeset
2108 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
2109 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
Ritor1
parents:
diff changeset
2110 fclose(v3);
Ritor1
parents:
diff changeset
2111 }
Ritor1
parents:
diff changeset
2112
Ritor1
parents:
diff changeset
2113 //----- (00494C0F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2114 void PlayerFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
2115 {
Ritor1
parents:
diff changeset
2116 uNumFrames = *(int *)pSerialized;
Ritor1
parents:
diff changeset
2117 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames");
Ritor1
parents:
diff changeset
2118 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames);
Ritor1
parents:
diff changeset
2119 }
Ritor1
parents:
diff changeset
2120
Ritor1
parents:
diff changeset
2121 //----- (00494C5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2122 int PlayerFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
2123 {
Ritor1
parents:
diff changeset
2124 PlayerFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
2125 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
2126 int v4; // esi@3
Ritor1
parents:
diff changeset
2127 void *v5; // eax@10
Ritor1
parents:
diff changeset
2128 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
2129 char *i; // eax@12
Ritor1
parents:
diff changeset
2130 __int16 v8; // ax@15
Ritor1
parents:
diff changeset
2131 const char *v9; // ST10_4@15
Ritor1
parents:
diff changeset
2132 unsigned __int16 v10; // ax@15
Ritor1
parents:
diff changeset
2133 const char *v11; // ST0C_4@15
Ritor1
parents:
diff changeset
2134 int j; // esi@15
Ritor1
parents:
diff changeset
2135 int v13; // eax@17
Ritor1
parents:
diff changeset
2136 int v14; // edx@22
Ritor1
parents:
diff changeset
2137 int v15; // ecx@23
Ritor1
parents:
diff changeset
2138 int v16; // eax@24
Ritor1
parents:
diff changeset
2139 signed int k; // eax@27
Ritor1
parents:
diff changeset
2140 PlayerFrame *v18; // edx@28
Ritor1
parents:
diff changeset
2141 int v19; // esi@28
Ritor1
parents:
diff changeset
2142 int l; // ecx@29
Ritor1
parents:
diff changeset
2143 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
2144 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
2145 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
2146 int v25; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
2147 int v26; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
2148 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
2149 int Argsa; // [sp+30Ch] [bp+8h]@28
Ritor1
parents:
diff changeset
2150
Ritor1
parents:
diff changeset
2151 v2 = this;
Ritor1
parents:
diff changeset
2152 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
2153 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
2154 File = v3;
Ritor1
parents:
diff changeset
2155 if ( !v3 )
Ritor1
parents:
diff changeset
2156 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
2157 v4 = 0;
Ritor1
parents:
diff changeset
2158 v25 = 0;
Ritor1
parents:
diff changeset
2159 v26 = 1;
Ritor1
parents:
diff changeset
2160 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
2161 {
Ritor1
parents:
diff changeset
2162 do
Ritor1
parents:
diff changeset
2163 {
Ritor1
parents:
diff changeset
2164 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
2165 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2166 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2167 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2168 if ( v24.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
2169 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
Ritor1
parents:
diff changeset
2170 ++v25;
Ritor1
parents:
diff changeset
2171 }
Ritor1
parents:
diff changeset
2172 ++v26;
Ritor1
parents:
diff changeset
2173 }
Ritor1
parents:
diff changeset
2174 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
2175 v4 = v25;
Ritor1
parents:
diff changeset
2176 }
Ritor1
parents:
diff changeset
2177 v2->uNumFrames = v4;
Ritor1
parents:
diff changeset
2178 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
Ritor1
parents:
diff changeset
2179 v2->pFrames = (PlayerFrame *)v5;
Ritor1
parents:
diff changeset
2180 if ( !v5 )
Ritor1
parents:
diff changeset
2181 Abortf("PlayerFrameTable::load - Out of Memory!");
Ritor1
parents:
diff changeset
2182 v6 = File;
Ritor1
parents:
diff changeset
2183 v2->uNumFrames = 0;
Ritor1
parents:
diff changeset
2184 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
2185 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
2186 {
Ritor1
parents:
diff changeset
2187 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
2188 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2189 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
2190 {
Ritor1
parents:
diff changeset
2191 v8 = atoi(v24.pProperties[0]);
Ritor1
parents:
diff changeset
2192 v9 = v24.pProperties[1];
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2193 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8;
0
Ritor1
parents:
diff changeset
2194 v10 = atoi(v9);
Ritor1
parents:
diff changeset
2195 v11 = v24.pProperties[2];
Ritor1
parents:
diff changeset
2196 v2->pFrames[v2->uNumFrames].uTextureID = v10;
Ritor1
parents:
diff changeset
2197 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11);
Ritor1
parents:
diff changeset
2198 v2->pFrames[v2->uNumFrames].uAnimLength = 0;
Ritor1
parents:
diff changeset
2199 v2->pFrames[v2->uNumFrames].uFlags = 0;
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2200 for ( j = 3; j < v24.uPropCount; ++j )
0
Ritor1
parents:
diff changeset
2201 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
2202 if ( !_stricmp(v24.pProperties[j], "New") )
0
Ritor1
parents:
diff changeset
2203 {
Ritor1
parents:
diff changeset
2204 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags;
Ritor1
parents:
diff changeset
2205 *(char *)v13 |= 4u;
Ritor1
parents:
diff changeset
2206 }
Ritor1
parents:
diff changeset
2207 }
Ritor1
parents:
diff changeset
2208 ++v2->uNumFrames;
Ritor1
parents:
diff changeset
2209 }
Ritor1
parents:
diff changeset
2210 }
Ritor1
parents:
diff changeset
2211 fclose(File);
Ritor1
parents:
diff changeset
2212 v14 = 0;
Ritor1
parents:
diff changeset
2213 if ( (signed int)(v2->uNumFrames - 1) > 0 )
Ritor1
parents:
diff changeset
2214 {
Ritor1
parents:
diff changeset
2215 v15 = 0;
Ritor1
parents:
diff changeset
2216 do
Ritor1
parents:
diff changeset
2217 {
Ritor1
parents:
diff changeset
2218 v16 = (int)&v2->pFrames[v15];
Ritor1
parents:
diff changeset
2219 if ( !(*(char *)(v16 + 18) & 4) )
Ritor1
parents:
diff changeset
2220 *(char *)(v16 + 8) |= 1u;
Ritor1
parents:
diff changeset
2221 ++v14;
Ritor1
parents:
diff changeset
2222 ++v15;
Ritor1
parents:
diff changeset
2223 }
Ritor1
parents:
diff changeset
2224 while ( v14 < (signed int)(v2->uNumFrames - 1) );
Ritor1
parents:
diff changeset
2225 }
Ritor1
parents:
diff changeset
2226 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 )
Ritor1
parents:
diff changeset
2227 {
Ritor1
parents:
diff changeset
2228 v18 = v2->pFrames;
Ritor1
parents:
diff changeset
2229 Argsa = (int)&v18[k];
Ritor1
parents:
diff changeset
2230 v19 = *(short *)(Argsa + 4);
Ritor1
parents:
diff changeset
2231 if ( *(char *)(Argsa + 8) & 1 )
Ritor1
parents:
diff changeset
2232 {
Ritor1
parents:
diff changeset
2233 ++k;
Ritor1
parents:
diff changeset
2234 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 )
Ritor1
parents:
diff changeset
2235 {
Ritor1
parents:
diff changeset
2236 v19 += *(short *)(l + 4);
Ritor1
parents:
diff changeset
2237 ++k;
Ritor1
parents:
diff changeset
2238 }
Ritor1
parents:
diff changeset
2239 LOWORD(v19) = v18[k].uAnimTime + v19;
Ritor1
parents:
diff changeset
2240 }
Ritor1
parents:
diff changeset
2241 ++k;
Ritor1
parents:
diff changeset
2242 }
Ritor1
parents:
diff changeset
2243 return 1;
Ritor1
parents:
diff changeset
2244 }
Ritor1
parents:
diff changeset
2245
Ritor1
parents:
diff changeset
2246 //----- (00495366) --------------------------------------------------------
Ritor1
parents:
diff changeset
2247 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2)
Ritor1
parents:
diff changeset
2248 {
Ritor1
parents:
diff changeset
2249 int v2; // edi@1
Ritor1
parents:
diff changeset
2250 int v3; // edx@2
Ritor1
parents:
diff changeset
2251 int v4; // esi@3
Ritor1
parents:
diff changeset
2252 int v5; // ebx@5
Ritor1
parents:
diff changeset
2253 signed int v7; // [sp+Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
2254 signed int v8; // [sp+10h] [bp-10h]@1
Ritor1
parents:
diff changeset
2255 int **v9; // [sp+14h] [bp-Ch]@4
Ritor1
parents:
diff changeset
2256 signed int v10; // [sp+18h] [bp-8h]@3
Ritor1
parents:
diff changeset
2257 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
2258
Ritor1
parents:
diff changeset
2259 v2 = a1;
Ritor1
parents:
diff changeset
2260 v11 = a2;
Ritor1
parents:
diff changeset
2261 v8 = 0;
Ritor1
parents:
diff changeset
2262 v7 = 0;
Ritor1
parents:
diff changeset
2263 if ( dword_AE336C == a1 )
Ritor1
parents:
diff changeset
2264 {
Ritor1
parents:
diff changeset
2265 v3 = dword_AE3370;
Ritor1
parents:
diff changeset
2266 }
Ritor1
parents:
diff changeset
2267 else
Ritor1
parents:
diff changeset
2268 {
Ritor1
parents:
diff changeset
2269 v4 = a2;
Ritor1
parents:
diff changeset
2270 dword_AE336C = a1;
Ritor1
parents:
diff changeset
2271 v10 = 0;
Ritor1
parents:
diff changeset
2272 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 )
Ritor1
parents:
diff changeset
2273 goto LABEL_17;
Ritor1
parents:
diff changeset
2274 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4);
Ritor1
parents:
diff changeset
2275 do
Ritor1
parents:
diff changeset
2276 {
Ritor1
parents:
diff changeset
2277 v5 = tolower(*(char *)*v9);
Ritor1
parents:
diff changeset
2278 if ( v5 == tolower(v2) )
Ritor1
parents:
diff changeset
2279 {
Ritor1
parents:
diff changeset
2280 if ( v8 )
Ritor1
parents:
diff changeset
2281 v7 = v10;
Ritor1
parents:
diff changeset
2282 else
Ritor1
parents:
diff changeset
2283 v8 = v10;
Ritor1
parents:
diff changeset
2284 }
Ritor1
parents:
diff changeset
2285 ++v10;
Ritor1
parents:
diff changeset
2286 v9 += 2;
Ritor1
parents:
diff changeset
2287 }
Ritor1
parents:
diff changeset
2288 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] );
Ritor1
parents:
diff changeset
2289 if ( v8 && v8 != v7 )
Ritor1
parents:
diff changeset
2290 v3 = v8 + rand() % (v7 - v8);
Ritor1
parents:
diff changeset
2291 else
Ritor1
parents:
diff changeset
2292 LABEL_17:
Ritor1
parents:
diff changeset
2293 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
Ritor1
parents:
diff changeset
2294 }
Ritor1
parents:
diff changeset
2295 dword_AE3370 = v3;
Ritor1
parents:
diff changeset
2296 return pNPCStats->pNPCNames[0][v11 + 2 * v3];
Ritor1
parents:
diff changeset
2297 }
Ritor1
parents:
diff changeset
2298 // AE336C: using guessed type int dword_AE336C;
Ritor1
parents:
diff changeset
2299 // AE3370: using guessed type int dword_AE3370;
Ritor1
parents:
diff changeset
2300
Ritor1
parents:
diff changeset
2301 //----- (00495430) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
2302 char * GetReputationString( signed int a1 )
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
2303 {
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2304 if (a1 >= 25)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2305 return pGlobalTXT_LocalizationStrings[379]; // Hated
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2306 else if (a1 >= 6)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2307 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2308 else if (a1 >= -5)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2309 return pGlobalTXT_LocalizationStrings[399]; // Neutral;
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2310 else if (a1 >= -24)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2311 return pGlobalTXT_LocalizationStrings[402]; // Friendly
0
Ritor1
parents:
diff changeset
2312 else
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
2313 return pGlobalTXT_LocalizationStrings[434]; // Respected;
0
Ritor1
parents:
diff changeset
2314 }
Ritor1
parents:
diff changeset
2315
Ritor1
parents:
diff changeset
2316 //----- (00495461) --------------------------------------------------------
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2317 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
0
Ritor1
parents:
diff changeset
2318 {
Ritor1
parents:
diff changeset
2319 unsigned __int8 v6; // bl@1
Ritor1
parents:
diff changeset
2320 Player *pPlayer; // ebx@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2321 //NPCData *v9; // eax@4
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2322 //size_t v10; // eax@6
0
Ritor1
parents:
diff changeset
2323 char *v11; // esi@7
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2324 //int v12; // edx@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2325 //ItemGen *v13; // edi@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2326 //char v14; // cl@8
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2327 //char *v15; // ecx@10
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2328 //int v16; // edx@10
0
Ritor1
parents:
diff changeset
2329 int v17; // eax@10
Ritor1
parents:
diff changeset
2330 signed __int64 v18; // qax@18
Ritor1
parents:
diff changeset
2331 unsigned int v19; // edi@32
Ritor1
parents:
diff changeset
2332 unsigned __int8 *v20; // ebx@32
Ritor1
parents:
diff changeset
2333 int v21; // ecx@34
Ritor1
parents:
diff changeset
2334 __int16 v22; // ax@34
Ritor1
parents:
diff changeset
2335 int v23; // edx@39
Ritor1
parents:
diff changeset
2336 int v24; // eax@39
Ritor1
parents:
diff changeset
2337 int v25; // eax@45
Ritor1
parents:
diff changeset
2338 float *v26; // esi@68
Ritor1
parents:
diff changeset
2339 float v27; // ST18_4@68
Ritor1
parents:
diff changeset
2340 signed int v28; // eax@68
Ritor1
parents:
diff changeset
2341 int v29; // eax@68
Ritor1
parents:
diff changeset
2342 float v30; // ST18_4@72
Ritor1
parents:
diff changeset
2343 signed int v31; // eax@72
Ritor1
parents:
diff changeset
2344 float v32; // ST18_4@74
Ritor1
parents:
diff changeset
2345 signed int v33; // eax@74
Ritor1
parents:
diff changeset
2346 double v34; // st7@75
Ritor1
parents:
diff changeset
2347 float v35; // ST18_4@76
Ritor1
parents:
diff changeset
2348 signed int v36; // eax@76
Ritor1
parents:
diff changeset
2349 float *v37; // esi@78
Ritor1
parents:
diff changeset
2350 float v38; // ST18_4@78
Ritor1
parents:
diff changeset
2351 int v39; // eax@78
Ritor1
parents:
diff changeset
2352 float v40; // ST18_4@82
Ritor1
parents:
diff changeset
2353 int v41; // eax@82
Ritor1
parents:
diff changeset
2354 float v42; // ST18_4@83
Ritor1
parents:
diff changeset
2355 int v43; // eax@83
Ritor1
parents:
diff changeset
2356 float v44; // ST18_4@85
Ritor1
parents:
diff changeset
2357 int v45; // eax@85
Ritor1
parents:
diff changeset
2358 const char *v46; // eax@86
Ritor1
parents:
diff changeset
2359 unsigned int v47; // eax@87
Ritor1
parents:
diff changeset
2360 float v48; // ST18_4@97
Ritor1
parents:
diff changeset
2361 __int64 v49; // ST14_8@107
Ritor1
parents:
diff changeset
2362 int v50; // eax@107
Ritor1
parents:
diff changeset
2363 int v51; // eax@108
Ritor1
parents:
diff changeset
2364 Player *v52; // eax@109
Ritor1
parents:
diff changeset
2365 int v53; // [sp-4h] [bp-13Ch]@107
Ritor1
parents:
diff changeset
2366 int v54; // [sp+0h] [bp-138h]@107
Ritor1
parents:
diff changeset
2367 __int16 v55[56]; // [sp+10h] [bp-128h]@34
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2368 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2369 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
0
Ritor1
parents:
diff changeset
2370 char a1[100]; // [sp+B8h] [bp-80h]@3
Ritor1
parents:
diff changeset
2371 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2372 //size_t v60; // [sp+120h] [bp-18h]@3
249
Nomad
parents: 248
diff changeset
2373 //Player *v61; // [sp+124h] [bp-14h]@3
Nomad
parents: 248
diff changeset
2374 //char *Str; // [sp+128h] [bp-10h]@1
0
Ritor1
parents:
diff changeset
2375 int v63; // [sp+12Ch] [bp-Ch]@32
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2376 //int v64; // [sp+130h] [bp-8h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2377 //NPCData *v65; // [sp+134h] [bp-4h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2378 //int packed;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2379
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2380
0
Ritor1
parents:
diff changeset
2381
Ritor1
parents:
diff changeset
2382 v6 = uPlayerID;
249
Nomad
parents: 248
diff changeset
2383 //Str = lpsz;
0
Ritor1
parents:
diff changeset
2384 if ( IsBadStringPtrA(lpsz, 1u) )
Ritor1
parents:
diff changeset
2385 return "Invalid String Passed";
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2386
0
Ritor1
parents:
diff changeset
2387 a1[0] = 0;
Ritor1
parents:
diff changeset
2388 pPlayer = &pParty->pPlayers[v6];
949
Nomad
parents: 948
diff changeset
2389 v59 = TargetColor(255, 255, 155);
249
Nomad
parents: 248
diff changeset
2390 //v61 = pPlayer;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2391 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2392
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2393 NPCData *npc = nullptr;
0
Ritor1
parents:
diff changeset
2394 if ( dword_5C35D4 )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
2395 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
2396 //__debugbreak(); // fix
1211
fd3bea473c0c fix HouseNpcdata array addresiing
Gloval
parents: 1209
diff changeset
2397 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2398 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2399 else
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
2400 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2401 //v65 = v9;
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2402 //v10 = 0;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2403 //v64 = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2404
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2405 //int i = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2406 //if ( (signed int)v60 > 0 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2407 v11 = a4;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2408
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2409 auto len = strlen(lpsz);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2410 for (int i = 0, dst = 0; i < len; ++i)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2411 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2412 //v12 = v64;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2413 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2414 //while ( 1 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2415 //{
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2416 char c = lpsz[i];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2417 if (c != '%')
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2418 pTmpBuf2[dst++] = c;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2419 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2420 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2421 //v15 = &lpsz[v12 + 1];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2422 //v16 = (unsigned __int8)lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2423 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2424 //v17 = packed - 528;// 10 * '0' + '0'
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2425 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0';
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2426
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2427 switch ( v17 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2428 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2429 case 1:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2430 v11 = npc->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2431 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2432 case 2:
0
Ritor1
parents:
diff changeset
2433 v11 = pPlayer->pName;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2434 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2435 case 3:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2436 case 4:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2437 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2438 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2439 case 5:
0
Ritor1
parents:
diff changeset
2440 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
Ritor1
parents:
diff changeset
2441 v11 = pGlobalTXT_LocalizationStrings[397];// "evening"
Ritor1
parents:
diff changeset
2442 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
Ritor1
parents:
diff changeset
2443 {
Ritor1
parents:
diff changeset
2444 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB )
Ritor1
parents:
diff changeset
2445 {
Ritor1
parents:
diff changeset
2446 if ( v18 < 20 )
Ritor1
parents:
diff changeset
2447 v11 = pGlobalTXT_LocalizationStrings[396];// "day"
Ritor1
parents:
diff changeset
2448 }
Ritor1
parents:
diff changeset
2449 else
Ritor1
parents:
diff changeset
2450 {
Ritor1
parents:
diff changeset
2451 v11 = pGlobalTXT_LocalizationStrings[395];// "morning"
Ritor1
parents:
diff changeset
2452 }
Ritor1
parents:
diff changeset
2453 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2454 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2455 case 6:
0
Ritor1
parents:
diff changeset
2456 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
2457 v11 = pGlobalTXT_LocalizationStrings[387];// "lady"
Ritor1
parents:
diff changeset
2458 else
Ritor1
parents:
diff changeset
2459 v11 = pGlobalTXT_LocalizationStrings[385];// "sir"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2460 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2461 case 7:
0
Ritor1
parents:
diff changeset
2462 if ( pPlayer->uSex )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2463 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2464 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2465 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2466 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2467 case 8:
0
Ritor1
parents:
diff changeset
2468 v19 = 0;
Ritor1
parents:
diff changeset
2469 v63 = 0;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2470 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
0
Ritor1
parents:
diff changeset
2471 do
Ritor1
parents:
diff changeset
2472 {
Ritor1
parents:
diff changeset
2473 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) )
Ritor1
parents:
diff changeset
2474 {
Ritor1
parents:
diff changeset
2475 v21 = v63;
Ritor1
parents:
diff changeset
2476 v22 = word_4EE150[v19];
Ritor1
parents:
diff changeset
2477 ++v63;
Ritor1
parents:
diff changeset
2478 v55[v21] = v22;
Ritor1
parents:
diff changeset
2479 }
Ritor1
parents:
diff changeset
2480 ++v19;
Ritor1
parents:
diff changeset
2481 }
Ritor1
parents:
diff changeset
2482 while ( v19 < 28 );
Ritor1
parents:
diff changeset
2483 if ( v63 )
Ritor1
parents:
diff changeset
2484 {
Ritor1
parents:
diff changeset
2485 v23 = rand() % v63;
Ritor1
parents:
diff changeset
2486 v24 = dword_A74CDC;
Ritor1
parents:
diff changeset
2487 if ( dword_A74CDC == -1 )
Ritor1
parents:
diff changeset
2488 {
Ritor1
parents:
diff changeset
2489 v24 = v23;
Ritor1
parents:
diff changeset
2490 dword_A74CDC = v23;
Ritor1
parents:
diff changeset
2491 }
492
Gloval
parents: 487
diff changeset
2492 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
0
Ritor1
parents:
diff changeset
2493 }
Ritor1
parents:
diff changeset
2494 else
Ritor1
parents:
diff changeset
2495 {
Ritor1
parents:
diff changeset
2496 v11 = (char *)pNPCTopics[55].pText;
Ritor1
parents:
diff changeset
2497 }
249
Nomad
parents: 248
diff changeset
2498 //pPlayer = v61;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2499 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2500 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2501 case 9:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2502 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2503 v11 = pGlobalTXT_LocalizationStrings[384];// "her"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2504 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2505 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2506 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2507 case 10:
0
Ritor1
parents:
diff changeset
2508 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
2509 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
Ritor1
parents:
diff changeset
2510 else
Ritor1
parents:
diff changeset
2511 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2512 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2513 case 11:
0
Ritor1
parents:
diff changeset
2514 v25 = GetPartyReputation();
Ritor1
parents:
diff changeset
2515 goto LABEL_46;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2516 case 12:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2517 v25 = npc->rep;
0
Ritor1
parents:
diff changeset
2518 LABEL_46:
Ritor1
parents:
diff changeset
2519 if ( v25 >= 25 )
Ritor1
parents:
diff changeset
2520 {
Ritor1
parents:
diff changeset
2521 v11 = pGlobalTXT_LocalizationStrings[379];
Ritor1
parents:
diff changeset
2522 }
Ritor1
parents:
diff changeset
2523 else
Ritor1
parents:
diff changeset
2524 {
Ritor1
parents:
diff changeset
2525 if ( v25 < 6 )
Ritor1
parents:
diff changeset
2526 {
Ritor1
parents:
diff changeset
2527 if ( v25 >= -5 )
Ritor1
parents:
diff changeset
2528 {
Ritor1
parents:
diff changeset
2529 v11 = pGlobalTXT_LocalizationStrings[399];
Ritor1
parents:
diff changeset
2530 }
Ritor1
parents:
diff changeset
2531 else
Ritor1
parents:
diff changeset
2532 {
Ritor1
parents:
diff changeset
2533 if ( v25 < -24 )
Ritor1
parents:
diff changeset
2534 v11 = pGlobalTXT_LocalizationStrings[434];
Ritor1
parents:
diff changeset
2535 else
Ritor1
parents:
diff changeset
2536 v11 = pGlobalTXT_LocalizationStrings[402];
Ritor1
parents:
diff changeset
2537 }
Ritor1
parents:
diff changeset
2538 }
Ritor1
parents:
diff changeset
2539 else
Ritor1
parents:
diff changeset
2540 {
Ritor1
parents:
diff changeset
2541 v11 = pGlobalTXT_LocalizationStrings[392];
Ritor1
parents:
diff changeset
2542 }
Ritor1
parents:
diff changeset
2543 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2544 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2545 case 13:
0
Ritor1
parents:
diff changeset
2546 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2547 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2548 case 14:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2549 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2550 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2551 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2552 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2553 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2554 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2555 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2556
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2557 case 15:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2558 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2559 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2560 _continue_strcat:
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2561 strcat(pTmpBuf2.data(), v11);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2562 dst = strlen(pTmpBuf2.data());
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2563 //v64 += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2564 i += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2565 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2566 break;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2567
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2568 case 16:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2569 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2570 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2571 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2572 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2573 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2574 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2575 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2576 case 17:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2577 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2578 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2579 if (!pay_percentage)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2580 pay_percentage = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2581
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2582 sprintf(a1, "%lu", pay_percentage);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2583 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2584 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2585 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2586
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2587 case 18:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2588 case 19:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2589 case 20:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2590 case 21:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2591 case 22:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2592 case 26:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2593 _continue_strncpy:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2594 strncpy(a1, lpsz + i + 1, 2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2595 v51 = atoi(a1);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2596 sprintf(a1, "%lu", v51);
0
Ritor1
parents:
diff changeset
2597 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2598 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2599
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2600 case 23:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2601 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2602 v47 = pMapStats->GetMapInfo(pCurrentMapName.data());
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2603 if ( v47 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2604 v11 = pMapStats->pInfos[v47].pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2605 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2606 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2607 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2608 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2609 case 24:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2610 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2611 v46 = a3->GetDisplayName();
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2612 sprintf(a1, format_4E2D80, v59, v46);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2613 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2614 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2615 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2616
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2617
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2618 case 25:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2619 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2620 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2621 v38 = *v37;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2622 v39 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2623 v29 = pPlayer->GetBaseBuyingPrice(v39, v38);
0
Ritor1
parents:
diff changeset
2624 switch ( a5 )
Ritor1
parents:
diff changeset
2625 {
Ritor1
parents:
diff changeset
2626 case 3:
Ritor1
parents:
diff changeset
2627 v44 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2628 v45 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2629 v29 = pPlayer->GetBaseSellingPrice(v45, v44);
0
Ritor1
parents:
diff changeset
2630 break;
Ritor1
parents:
diff changeset
2631 case 4:
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2632 v29 = pPlayer->GetBaseIdentifyPrice(*v37);
0
Ritor1
parents:
diff changeset
2633 break;
Ritor1
parents:
diff changeset
2634 case 5:
Ritor1
parents:
diff changeset
2635 v42 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2636 v43 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2637 v29 = pPlayer->GetBaseRepairPrice(v43, v42);
0
Ritor1
parents:
diff changeset
2638 break;
Ritor1
parents:
diff changeset
2639 case 6:
Ritor1
parents:
diff changeset
2640 v40 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2641 v41 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2642 v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2;
0
Ritor1
parents:
diff changeset
2643 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2644 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2645 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2646 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2647
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2648 case 27:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2649 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2650 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
0
Ritor1
parents:
diff changeset
2651 v27 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2652 v28 = a3->GetValue();
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
2653 v29 = pPlayer->GetBuyingPrice(v28, v27);
0
Ritor1
parents:
diff changeset
2654 if ( a5 == 3 )
Ritor1
parents:
diff changeset
2655 {
Ritor1
parents:
diff changeset
2656 v35 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2657 v36 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
2658 v29 = pPlayer->GetPriceSell(v36, v35);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
2659 if (a3->Broken())
0
Ritor1
parents:
diff changeset
2660 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2661 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
2662 }
Ritor1
parents:
diff changeset
2663 if ( a5 != 4 )
Ritor1
parents:
diff changeset
2664 {
Ritor1
parents:
diff changeset
2665 if ( a5 == 5 )
Ritor1
parents:
diff changeset
2666 {
Ritor1
parents:
diff changeset
2667 v32 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2668 v33 = a3->GetValue();
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2669 v29 = pPlayer->GetPriceRepair(v33, v32);
0
Ritor1
parents:
diff changeset
2670 }
Ritor1
parents:
diff changeset
2671 else
Ritor1
parents:
diff changeset
2672 {
Ritor1
parents:
diff changeset
2673 if ( a5 == 6 )
Ritor1
parents:
diff changeset
2674 {
Ritor1
parents:
diff changeset
2675 v30 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2676 v31 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
2677 v29 = pPlayer->GetPriceSell(v31, v30) / 2;
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
2678 if (a3->Broken())
0
Ritor1
parents:
diff changeset
2679 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2680 if (!v29)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2681 v29 = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2682 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
2683 }
Ritor1
parents:
diff changeset
2684 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2685 _continue_sprintf:
0
Ritor1
parents:
diff changeset
2686 sprintf(a1, "%lu", v29);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2687 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2688 goto _continue_strcat;
0
Ritor1
parents:
diff changeset
2689 }
Ritor1
parents:
diff changeset
2690 v34 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2691
0
Ritor1
parents:
diff changeset
2692 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2693 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2694 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2695 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2696
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2697 case 28:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2698 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2699 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2700 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2701 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2702 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2703
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2704 case 29:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2705 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2706 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2707 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2708 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2709 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2710 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2711 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2712
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2713 case 30:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2714 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2715 if ( !a6 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2716 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2717 sub_493F79(&v57, *a6);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2718 v54 = v57.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2719 v53 = v57.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2720 v50 = v57.field_14_exprie_month;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2721 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2722 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2723 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2724 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2725
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2726 case 31:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2727 case 32:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2728 case 33:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2729 case 34:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2730 v52 = &pParty->pPlayers[v17 - 31];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2731 v11 = v52->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2732 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2733
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2734 default:
0
Ritor1
parents:
diff changeset
2735 if ( v17 <= 50 || v17 > 70 )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2736 goto _continue_strncpy;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2737 if ( v17 - 51 >= 20 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2738 goto _continue_strcat;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2739 v49 = pParty->field_3C._s_times[v17-51];
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2740
0
Ritor1
parents:
diff changeset
2741 sub_493F79(&v56, v49);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2742 v54 = v56.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2743 v53 = v56.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2744 v50 = v56.field_14_exprie_month;
0
Ritor1
parents:
diff changeset
2745 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2746 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2747 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2748 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2749 }
0
Ritor1
parents:
diff changeset
2750 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2751 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
2752 }
Ritor1
parents:
diff changeset
2753
Ritor1
parents:
diff changeset
2754 //----- (0049B04D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2755 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
0
Ritor1
parents:
diff changeset
2756 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2757 //stru154 *v3; // edi@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2758 //signed int v4; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2759 //signed int result; // eax@9
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2760 //signed int v6; // [sp-8h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
2761 Vec3_float_ v; // [sp+4h] [bp-Ch]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2762 float v7;
0
Ritor1
parents:
diff changeset
2763
Ritor1
parents:
diff changeset
2764 v.x = 0.0;
Ritor1
parents:
diff changeset
2765 v.y = 0.0;
Ritor1
parents:
diff changeset
2766 v.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2767 GetFacePlane(a2, a3, &v, &v7);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2768
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2769 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2770 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2771 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2772 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2773 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
2774 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2775 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2776
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2777 face_plane.vNormal.x = v.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2778 face_plane.vNormal.y = v.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2779 face_plane.vNormal.z = v.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2780 face_plane.dist = v7;
0
Ritor1
parents:
diff changeset
2781 }
Ritor1
parents:
diff changeset
2782
Ritor1
parents:
diff changeset
2783 //----- (0049B0C9) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2784 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
0
Ritor1
parents:
diff changeset
2785 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2786 if (fabsf(pNormal->z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2787 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2788 else if (fabsf(pNormal->x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2789 fabsf(pNormal->y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2790 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
2791 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2792 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2793
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2794 face_plane.vNormal.x = pNormal->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2795 face_plane.dist = dist;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2796 face_plane.vNormal.y = pNormal->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2797 face_plane.vNormal.z = pNormal->z;
0
Ritor1
parents:
diff changeset
2798 }
Ritor1
parents:
diff changeset
2799
Ritor1
parents:
diff changeset
2800 //----- (0049B13D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2801 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
0
Ritor1
parents:
diff changeset
2802 {
Ritor1
parents:
diff changeset
2803 ODMFace *v5; // ebx@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2804 //int v6; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2805 //unsigned __int16 *v7; // ebx@2
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2806 //Vec3_int_ *v8; // eax@3
0
Ritor1
parents:
diff changeset
2807 Vec3_int_ *v9; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2808 //double v10; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2809 //int v11; // ecx@3
0
Ritor1
parents:
diff changeset
2810 Vec3_int_ *v12; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2811 //double v13; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2812 //double v14; // st6@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2813 //double v15; // st5@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2814 //int v16; // ecx@3
0
Ritor1
parents:
diff changeset
2815 Vec3_int_ *v17; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2816 //double v18; // st5@3
0
Ritor1
parents:
diff changeset
2817 Vec3_float_ *v19; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2818 //int result; // eax@8
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2819 //float v21; // ecx@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2820 //double v22; // st7@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2821 //double v23; // st6@10
0
Ritor1
parents:
diff changeset
2822 Vec3_float_ v2; // [sp+4h] [bp-64h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2823 //float v25; // [sp+18h] [bp-50h]@3
0
Ritor1
parents:
diff changeset
2824 float v26; // [sp+1Ch] [bp-4Ch]@3
Ritor1
parents:
diff changeset
2825 float v27; // [sp+20h] [bp-48h]@3
Ritor1
parents:
diff changeset
2826 float v28; // [sp+24h] [bp-44h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2827 //float v29; // [sp+2Ch] [bp-3Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2828 //float v30; // [sp+30h] [bp-38h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2829 //float v31; // [sp+34h] [bp-34h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2830 //float v32; // [sp+38h] [bp-30h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2831 //float v33; // [sp+3Ch] [bp-2Ch]@3
0
Ritor1
parents:
diff changeset
2832 Vec3_float_ v1; // [sp+40h] [bp-28h]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2833 //float v35; // [sp+4Ch] [bp-1Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2834 //float v36; // [sp+50h] [bp-18h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2835 //float v37; // [sp+54h] [bp-14h]@3
0
Ritor1
parents:
diff changeset
2836 Vec3_float_ v38; // [sp+58h] [bp-10h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2837 //int v39; // [sp+64h] [bp-4h]@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2838
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2839 //v39 = 0;
0
Ritor1
parents:
diff changeset
2840 v1.x = 0.0;
Ritor1
parents:
diff changeset
2841 v5 = pFace;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2842 //v6 = pFace->uNumVertices;
0
Ritor1
parents:
diff changeset
2843 v1.y = 0.0;
Ritor1
parents:
diff changeset
2844 v1.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2845
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2846 if (pFace->uNumVertices >= 2)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2847 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2848 int i = 0;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2849 while ( i < pFace->uNumVertices - 2 )
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2850 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2851 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2852 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2853 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
1093
c59ac5ea63f5 * stru154::GetFacePlane mistake fixed
zipi
parents: 1080
diff changeset
2854 i++;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2855 v1.x = v12->x - v9->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2856 v26 = v17->x - v12->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2857 v1.y = v12->y - v9->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2858 v27 = v17->y - v12->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2859 v1.z = v12->z - v9->z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2860 v28 = v17->z - v12->z;
0
Ritor1
parents:
diff changeset
2861 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
Ritor1
parents:
diff changeset
2862 v38.x = v19->x;
Ritor1
parents:
diff changeset
2863 v38.y = v19->y;
Ritor1
parents:
diff changeset
2864 v38.z = v19->z;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2865 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2866 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2867 v38.Normalize();
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2868
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2869 pOutNormal->x = v38.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2870 pOutNormal->y = v38.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2871 pOutNormal->z = v38.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2872
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2873 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2874 return;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2875 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2876 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2877 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2878
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2879 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2880 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2881 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2882 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
0
Ritor1
parents:
diff changeset
2883 }
Ritor1
parents:
diff changeset
2884
Ritor1
parents:
diff changeset
2885 //----- (0049D700) --------------------------------------------------------
Ritor1
parents:
diff changeset
2886 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
Ritor1
parents:
diff changeset
2887 {
Ritor1
parents:
diff changeset
2888 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
2889 int v2; // ecx@1
Ritor1
parents:
diff changeset
2890 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
2891
Ritor1
parents:
diff changeset
2892 v1 = uDim;
Ritor1
parents:
diff changeset
2893 v2 = 0;
Ritor1
parents:
diff changeset
2894 v3 = v1 - 1;
Ritor1
parents:
diff changeset
2895 while ( v3 & 1 )
Ritor1
parents:
diff changeset
2896 {
Ritor1
parents:
diff changeset
2897 v3 >>= 1;
Ritor1
parents:
diff changeset
2898 ++v2;
Ritor1
parents:
diff changeset
2899 }
Ritor1
parents:
diff changeset
2900 return v3 == 0 ? v2 : 0;
Ritor1
parents:
diff changeset
2901 }
Ritor1
parents:
diff changeset
2902
Ritor1
parents:
diff changeset
2903 //----- (004A19D8) --------------------------------------------------------
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2904 unsigned int BlendColors(unsigned int a1, unsigned int a2)
0
Ritor1
parents:
diff changeset
2905 {
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2906 /*signed __int64 v2; // ST10_8@1
0
Ritor1
parents:
diff changeset
2907 double v3; // st7@1
Ritor1
parents:
diff changeset
2908 float v4; // ST24_4@1
Ritor1
parents:
diff changeset
2909 double v5; // ST10_8@1
Ritor1
parents:
diff changeset
2910 int v6; // ST1C_4@1
Ritor1
parents:
diff changeset
2911 float v7; // ST24_4@1
Ritor1
parents:
diff changeset
2912 double v8; // ST10_8@1
Ritor1
parents:
diff changeset
2913 unsigned __int8 v9; // ST20_1@1
Ritor1
parents:
diff changeset
2914 float v10; // ST24_4@1
Ritor1
parents:
diff changeset
2915 double v11; // ST10_8@1
Ritor1
parents:
diff changeset
2916 float v12; // ST24_4@1
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2917 double v13; // ST08_8@1*/
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2918
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2919 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2920 (a2 >> 24) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2921 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2922 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2923 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2924 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2925 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2926 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f);
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2927 return (alpha << 24) | (red << 16) | (green << 8) | blue;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2928 /*v2 = a1 >> 24;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2929 v3 = (double)v2 / 255.0f;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2930 HIDWORD(v2) = 0;
0
Ritor1
parents:
diff changeset
2931 LODWORD(v2) = a2 >> 24;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2932 v4 = v3 * (double)v2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2933 v5 = v4 + 6.7553994e15;
Ritor1
parents:
diff changeset
2934 v6 = LODWORD(v5);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2935 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0;
0
Ritor1
parents:
diff changeset
2936 v8 = v7 + 6.7553994e15;
Ritor1
parents:
diff changeset
2937 v9 = LOBYTE(v8);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2938 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2939 v11 = v10 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2940 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2941 v13 = v12 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2942 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
0
Ritor1
parents:
diff changeset
2943 }
Ritor1
parents:
diff changeset
2944
Ritor1
parents:
diff changeset
2945 //----- (004A46E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2946 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor)
Ritor1
parents:
diff changeset
2947 {
Ritor1
parents:
diff changeset
2948 int v5; // eax@1
Ritor1
parents:
diff changeset
2949 int z; // eax@1
Ritor1
parents:
diff changeset
2950 unsigned int v7; // eax@9
Ritor1
parents:
diff changeset
2951 unsigned int v8; // ecx@9
Ritor1
parents:
diff changeset
2952 int v9; // eax@9
Ritor1
parents:
diff changeset
2953 unsigned int v10; // eax@10
Ritor1
parents:
diff changeset
2954 int *v11; // esi@10
Ritor1
parents:
diff changeset
2955 int *v12; // edi@10
Ritor1
parents:
diff changeset
2956 int v13; // ecx@10
Ritor1
parents:
diff changeset
2957 int v14; // edx@10
Ritor1
parents:
diff changeset
2958 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
2959 int *v16; // esi@22
Ritor1
parents:
diff changeset
2960 int *v17; // edi@22
Ritor1
parents:
diff changeset
2961 int v18; // ecx@22
Ritor1
parents:
diff changeset
2962 int v19; // edx@22
Ritor1
parents:
diff changeset
2963 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9
Ritor1
parents:
diff changeset
2964 int *pTargetZ; // [sp+10h] [bp-4h]@9
Ritor1
parents:
diff changeset
2965 unsigned int v22; // [sp+1Ch] [bp+8h]@9
Ritor1
parents:
diff changeset
2966 signed int v23; // [sp+20h] [bp+Ch]@1
Ritor1
parents:
diff changeset
2967
Ritor1
parents:
diff changeset
2968 v5 = a4;
Ritor1
parents:
diff changeset
2969 v23 = _z >> 16;
Ritor1
parents:
diff changeset
2970 z = x + v5;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2971 if ( z >= (signed int)pViewport->uViewportTL_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2972 && (signed int)x <= (signed int)pViewport->uViewportBR_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2973 && y >= (signed int)pViewport->uViewportTL_Y
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2974 && y <= (signed int)pViewport->uViewportBR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2975 {
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2976 if ( (signed int)x < (signed int)pViewport->uViewportTL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2977 x = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2978 if ( z > (signed int)pViewport->uViewportBR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2979 z = pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
2980 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
2981 v22 = z - x;
Ritor1
parents:
diff changeset
2982 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y];
Ritor1
parents:
diff changeset
2983 v7 = lightColor >> 3;
Ritor1
parents:
diff changeset
2984 v8 = lightColor & 0xF0;
Ritor1
parents:
diff changeset
2985 v9 = v7 & 0x1E0000;
Ritor1
parents:
diff changeset
2986 if ( pRenderer->uTargetGBits == 5 )
Ritor1
parents:
diff changeset
2987 {
Ritor1
parents:
diff changeset
2988 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4;
Ritor1
parents:
diff changeset
2989 v11 = (int *)pTarget;
Ritor1
parents:
diff changeset
2990 v12 = pTargetZ;
Ritor1
parents:
diff changeset
2991 v13 = v22;
Ritor1
parents:
diff changeset
2992 v14 = (v10 << 16) | v10;
Ritor1
parents:
diff changeset
2993 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
2994 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
2995 {
Ritor1
parents:
diff changeset
2996 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
2997 if ( z > v23 )
Ritor1
parents:
diff changeset
2998 {
Ritor1
parents:
diff changeset
2999 z = v14 + ((*pTarget & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
3000 *pTarget = z;
Ritor1
parents:
diff changeset
3001 }
Ritor1
parents:
diff changeset
3002 v13 = v22 - 1;
Ritor1
parents:
diff changeset
3003 v11 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
3004 v12 = pTargetZ + 1;
Ritor1
parents:
diff changeset
3005 }
Ritor1
parents:
diff changeset
3006 while ( v13 != 1 )
Ritor1
parents:
diff changeset
3007 {
Ritor1
parents:
diff changeset
3008 if ( v13 < 1 )
Ritor1
parents:
diff changeset
3009 return z;
Ritor1
parents:
diff changeset
3010 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
3011 if ( z <= v23 )
Ritor1
parents:
diff changeset
3012 {
Ritor1
parents:
diff changeset
3013 v13 -= 2;
Ritor1
parents:
diff changeset
3014 ++v11;
Ritor1
parents:
diff changeset
3015 v12 += 2;
Ritor1
parents:
diff changeset
3016 }
Ritor1
parents:
diff changeset
3017 else
Ritor1
parents:
diff changeset
3018 {
Ritor1
parents:
diff changeset
3019 v12 += 2;
Ritor1
parents:
diff changeset
3020 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1);
Ritor1
parents:
diff changeset
3021 v13 -= 2;
Ritor1
parents:
diff changeset
3022 *v11 = z;
Ritor1
parents:
diff changeset
3023 ++v11;
Ritor1
parents:
diff changeset
3024 }
Ritor1
parents:
diff changeset
3025 }
Ritor1
parents:
diff changeset
3026 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
3027 if ( z > v23 )
Ritor1
parents:
diff changeset
3028 {
Ritor1
parents:
diff changeset
3029 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
3030 *(short *)v11 = z;
Ritor1
parents:
diff changeset
3031 }
Ritor1
parents:
diff changeset
3032 }
Ritor1
parents:
diff changeset
3033 else
Ritor1
parents:
diff changeset
3034 {
Ritor1
parents:
diff changeset
3035 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4;
Ritor1
parents:
diff changeset
3036 v16 = (int *)pTarget;
Ritor1
parents:
diff changeset
3037 v17 = pTargetZ;
Ritor1
parents:
diff changeset
3038 v18 = v22;
Ritor1
parents:
diff changeset
3039 v19 = (v15 << 16) | v15;
Ritor1
parents:
diff changeset
3040 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
3041 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
3042 {
Ritor1
parents:
diff changeset
3043 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
3044 if ( z > v23 )
Ritor1
parents:
diff changeset
3045 {
Ritor1
parents:
diff changeset
3046 z = v19 + ((*pTarget & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
3047 *pTarget = z;
Ritor1
parents:
diff changeset
3048 }
Ritor1
parents:
diff changeset
3049 v18 = v22 - 1;
Ritor1
parents:
diff changeset
3050 v16 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
3051 v17 = pTargetZ + 1;
Ritor1
parents:
diff changeset
3052 }
Ritor1
parents:
diff changeset
3053 while ( v18 != 1 )
Ritor1
parents:
diff changeset
3054 {
Ritor1
parents:
diff changeset
3055 if ( v18 < 1 )
Ritor1
parents:
diff changeset
3056 return z;
Ritor1
parents:
diff changeset
3057 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
3058 if ( z <= v23 )
Ritor1
parents:
diff changeset
3059 {
Ritor1
parents:
diff changeset
3060 v18 -= 2;
Ritor1
parents:
diff changeset
3061 ++v16;
Ritor1
parents:
diff changeset
3062 v17 += 2;
Ritor1
parents:
diff changeset
3063 }
Ritor1
parents:
diff changeset
3064 else
Ritor1
parents:
diff changeset
3065 {
Ritor1
parents:
diff changeset
3066 v17 += 2;
Ritor1
parents:
diff changeset
3067 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1);
Ritor1
parents:
diff changeset
3068 v18 -= 2;
Ritor1
parents:
diff changeset
3069 *v16 = z;
Ritor1
parents:
diff changeset
3070 ++v16;
Ritor1
parents:
diff changeset
3071 }
Ritor1
parents:
diff changeset
3072 }
Ritor1
parents:
diff changeset
3073 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
3074 if ( z > v23 )
Ritor1
parents:
diff changeset
3075 {
Ritor1
parents:
diff changeset
3076 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
3077 *(short *)v16 = z;
Ritor1
parents:
diff changeset
3078 }
Ritor1
parents:
diff changeset
3079 }
Ritor1
parents:
diff changeset
3080 }
Ritor1
parents:
diff changeset
3081 return z;
Ritor1
parents:
diff changeset
3082 }
Ritor1
parents:
diff changeset
3083
Ritor1
parents:
diff changeset
3084 //----- (004A57E9) --------------------------------------------------------
Ritor1
parents:
diff changeset
3085 void __cdecl Present_ColorKey()
Ritor1
parents:
diff changeset
3086 {
Ritor1
parents:
diff changeset
3087 HRESULT v0; // eax@3
Ritor1
parents:
diff changeset
3088 HRESULT v1; // eax@3
Ritor1
parents:
diff changeset
3089 HRESULT v2; // eax@3
Ritor1
parents:
diff changeset
3090 HRESULT v3; // eax@3
Ritor1
parents:
diff changeset
3091 HRESULT v4; // eax@3
Ritor1
parents:
diff changeset
3092 RECT a2; // [sp+4h] [bp-14h]@3
Ritor1
parents:
diff changeset
3093 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
3094
Ritor1
parents:
diff changeset
3095 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
3096 {
Ritor1
parents:
diff changeset
3097 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
3098 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3099 a2.bottom = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
3100 a2.left = 0;
Ritor1
parents:
diff changeset
3101 a2.top = 0;
Ritor1
parents:
diff changeset
3102 a2.right = 640;
Ritor1
parents:
diff changeset
3103 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u));
Ritor1
parents:
diff changeset
3104 a2.right = 640;
Ritor1
parents:
diff changeset
3105 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3106 a2.top = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
3107 a2.bottom = 480;
Ritor1
parents:
diff changeset
3108 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
3109 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3110 pViewport->uViewportBR_Y + 1,
0
Ritor1
parents:
diff changeset
3111 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
3112 &a2,
Ritor1
parents:
diff changeset
3113 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3114 a2.right = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3115 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
3116 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3117 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
3118 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
3119 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3120 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
3121 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
3122 &a2,
Ritor1
parents:
diff changeset
3123 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3124 a2.left = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3125 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
3126 a2.right = 640;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3127 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
3128 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3129 pViewport->uViewportBR_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3130 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
3131 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
3132 &a2,
Ritor1
parents:
diff changeset
3133 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3134 a2.right = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3135 a2.bottom = pViewport->uViewportBR_Y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3136 a2.left = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3137 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
3138 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3139 pViewport->uViewportTL_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3140 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
3141 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
3142 &a2,
Ritor1
parents:
diff changeset
3143 17u));
Ritor1
parents:
diff changeset
3144 }
Ritor1
parents:
diff changeset
3145 }
Ritor1
parents:
diff changeset
3146 }
Ritor1
parents:
diff changeset
3147
Ritor1
parents:
diff changeset
3148 //----- (004A597D) --------------------------------------------------------
Ritor1
parents:
diff changeset
3149 void Present_NoColorKey()
Ritor1
parents:
diff changeset
3150 {
Ritor1
parents:
diff changeset
3151 //unsigned __int16 *v0; // eax@4
Ritor1
parents:
diff changeset
3152 unsigned __int16 *v1; // esi@4
Ritor1
parents:
diff changeset
3153 void *v2; // edi@4
Ritor1
parents:
diff changeset
3154 //signed int v4; // ebx@4
Ritor1
parents:
diff changeset
3155 //signed int v5; // ebx@6
Ritor1
parents:
diff changeset
3156 //void *v6; // edi@7
Ritor1
parents:
diff changeset
3157 //const void *v7; // esi@7
Ritor1
parents:
diff changeset
3158 signed int v8; // ebx@8
Ritor1
parents:
diff changeset
3159 int v9; // eax@10
Ritor1
parents:
diff changeset
3160 unsigned int v10; // esi@10
Ritor1
parents:
diff changeset
3161 unsigned __int32 v11; // edi@10
Ritor1
parents:
diff changeset
3162 //int v12; // ecx@10
Ritor1
parents:
diff changeset
3163 unsigned int v13; // ebx@10
Ritor1
parents:
diff changeset
3164 int v14; // eax@11
Ritor1
parents:
diff changeset
3165 int v15; // eax@13
Ritor1
parents:
diff changeset
3166 int v16; // eax@14
Ritor1
parents:
diff changeset
3167 int v17; // eax@16
Ritor1
parents:
diff changeset
3168 HRESULT v18; // eax@22
Ritor1
parents:
diff changeset
3169 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
Ritor1
parents:
diff changeset
3170 int v20; // [sp+88h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
3171 int v21; // [sp+8Ch] [bp-18h]@10
Ritor1
parents:
diff changeset
3172 __int32 v22; // [sp+90h] [bp-14h]@10
Ritor1
parents:
diff changeset
3173 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
Ritor1
parents:
diff changeset
3174 unsigned int v24; // [sp+98h] [bp-Ch]@4
Ritor1
parents:
diff changeset
3175 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
3176 //LPVOID v26; // [sp+A0h] [bp-4h]@4
Ritor1
parents:
diff changeset
3177
Ritor1
parents:
diff changeset
3178 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
3179 {
Ritor1
parents:
diff changeset
3180 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
3181 {
Ritor1
parents:
diff changeset
3182 memset(&Dst, 0, 0x7Cu);
Ritor1
parents:
diff changeset
3183 Dst.dwSize = 124;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
3184 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
0
Ritor1
parents:
diff changeset
3185 {
Ritor1
parents:
diff changeset
3186 //v26 = Dst.lpSurface;
Ritor1
parents:
diff changeset
3187 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
3188 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask |
Ritor1
parents:
diff changeset
3189 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16);
Ritor1
parents:
diff changeset
3190 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
3191 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
Ritor1
parents:
diff changeset
3192 v1 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
3193 v2 = Dst.lpSurface;
Ritor1
parents:
diff changeset
3194
Ritor1
parents:
diff changeset
3195
Ritor1
parents:
diff changeset
3196 /*for (uint y = 0; y < 480; ++y)
Ritor1
parents:
diff changeset
3197 {
Ritor1
parents:
diff changeset
3198 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
Ritor1
parents:
diff changeset
3199 for (uint x = 0; x < 640; ++x)
Ritor1
parents:
diff changeset
3200 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
Ritor1
parents:
diff changeset
3201 }*/
Ritor1
parents:
diff changeset
3202
Ritor1
parents:
diff changeset
3203 auto pSrc = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
3204 auto pDst = (__int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
3205
Ritor1
parents:
diff changeset
3206 for (uint y = 0; y < 8; ++y)
Ritor1
parents:
diff changeset
3207 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
3208
Ritor1
parents:
diff changeset
3209 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
3210
Ritor1
parents:
diff changeset
3211 for (uint y = 8; y < 352; ++y)
Ritor1
parents:
diff changeset
3212 {
Ritor1
parents:
diff changeset
3213 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
3214 pSrc + y * 640, 8 * sizeof(__int16));
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
3215 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2,
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
3216 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
0
Ritor1
parents:
diff changeset
3217 }
Ritor1
parents:
diff changeset
3218
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
3219 for (uint y = 352; y < 480; ++y)
0
Ritor1
parents:
diff changeset
3220 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
3221 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
3222
Ritor1
parents:
diff changeset
3223
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3224 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
3225 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)];
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3226 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
3227 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3228 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1);
0
Ritor1
parents:
diff changeset
3229 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1);
Ritor1
parents:
diff changeset
3230 v22 = 4 * ((Dst.lPitch / 4) + v9);
Ritor1
parents:
diff changeset
3231 v21 = 4 * v9 + 1280;
Ritor1
parents:
diff changeset
3232
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
3233 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
0
Ritor1
parents:
diff changeset
3234 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
Ritor1
parents:
diff changeset
3235 v10 = (int)pSrc_x1y1;
Ritor1
parents:
diff changeset
3236 v11 = (int)pDst_x1y1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3237 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
0
Ritor1
parents:
diff changeset
3238 v13 = v24;
Ritor1
parents:
diff changeset
3239
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3240 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
0
Ritor1
parents:
diff changeset
3241 {
Ritor1
parents:
diff changeset
3242 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
3243 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3244 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
0
Ritor1
parents:
diff changeset
3245 {
Ritor1
parents:
diff changeset
3246 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
Ritor1
parents:
diff changeset
3247 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
Ritor1
parents:
diff changeset
3248 }
Ritor1
parents:
diff changeset
3249 }
Ritor1
parents:
diff changeset
3250
Ritor1
parents:
diff changeset
3251 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
3252
Ritor1
parents:
diff changeset
3253 /* while ( 1 )
Ritor1
parents:
diff changeset
3254 {
Ritor1
parents:
diff changeset
3255 while ( 1 )
Ritor1
parents:
diff changeset
3256 {
Ritor1
parents:
diff changeset
3257 v14 = *(int *)v10;
Ritor1
parents:
diff changeset
3258 v10 += 4;
Ritor1
parents:
diff changeset
3259 if ( v14 == v13 )
Ritor1
parents:
diff changeset
3260 break;
Ritor1
parents:
diff changeset
3261 if ( (short)v14 == (short)v13 )
Ritor1
parents:
diff changeset
3262 {
Ritor1
parents:
diff changeset
3263 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000;
Ritor1
parents:
diff changeset
3264 v11 += 4;
Ritor1
parents:
diff changeset
3265 --uHalfWidth;
Ritor1
parents:
diff changeset
3266 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
3267 goto LABEL_21;
Ritor1
parents:
diff changeset
3268 }
Ritor1
parents:
diff changeset
3269 else
Ritor1
parents:
diff changeset
3270 {
Ritor1
parents:
diff changeset
3271 v15 = __ROL__(v14, 16);
Ritor1
parents:
diff changeset
3272 if ( (short)v15 == (short)v13 )
Ritor1
parents:
diff changeset
3273 {
Ritor1
parents:
diff changeset
3274 v17 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
3275 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17;
Ritor1
parents:
diff changeset
3276 v11 += 4;
Ritor1
parents:
diff changeset
3277 --uHalfWidth;
Ritor1
parents:
diff changeset
3278 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
3279 goto LABEL_21;
Ritor1
parents:
diff changeset
3280 }
Ritor1
parents:
diff changeset
3281 else
Ritor1
parents:
diff changeset
3282 {
Ritor1
parents:
diff changeset
3283 v16 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
3284 *(int *)v11 = v16;
Ritor1
parents:
diff changeset
3285 v11 += 4;
Ritor1
parents:
diff changeset
3286 --uHalfWidth;
Ritor1
parents:
diff changeset
3287 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
3288 goto LABEL_21;
Ritor1
parents:
diff changeset
3289 }
Ritor1
parents:
diff changeset
3290 }
Ritor1
parents:
diff changeset
3291 }
Ritor1
parents:
diff changeset
3292 v11 += 4;
Ritor1
parents:
diff changeset
3293 --uHalfWidth;
Ritor1
parents:
diff changeset
3294 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
3295 {
Ritor1
parents:
diff changeset
3296 LABEL_21:
Ritor1
parents:
diff changeset
3297 v10 += v21;
Ritor1
parents:
diff changeset
3298 v11 += v22;
Ritor1
parents:
diff changeset
3299 uHalfWidth = v20;
Ritor1
parents:
diff changeset
3300 if ( !--uNumLines )
Ritor1
parents:
diff changeset
3301 {
Ritor1
parents:
diff changeset
3302 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
3303 return;
Ritor1
parents:
diff changeset
3304 }
Ritor1
parents:
diff changeset
3305 }
Ritor1
parents:
diff changeset
3306 }*/
Ritor1
parents:
diff changeset
3307 }
Ritor1
parents:
diff changeset
3308 }
Ritor1
parents:
diff changeset
3309 }
Ritor1
parents:
diff changeset
3310 }
Ritor1
parents:
diff changeset
3311
Ritor1
parents:
diff changeset
3312 //----- (004A7063) --------------------------------------------------------
Ritor1
parents:
diff changeset
3313 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2)
Ritor1
parents:
diff changeset
3314 {
Ritor1
parents:
diff changeset
3315 float v2; // ST1C_4@1
Ritor1
parents:
diff changeset
3316 double v3; // ST14_8@1
Ritor1
parents:
diff changeset
3317 signed int v4; // ebx@1
Ritor1
parents:
diff changeset
3318 float v5; // ST1C_4@1
Ritor1
parents:
diff changeset
3319 double v6; // ST14_8@1
Ritor1
parents:
diff changeset
3320 signed int v7; // edi@1
Ritor1
parents:
diff changeset
3321 double v8; // ST0C_8@1
Ritor1
parents:
diff changeset
3322 signed int v9; // esi@1
Ritor1
parents:
diff changeset
3323 signed int v10; // ecx@1
Ritor1
parents:
diff changeset
3324 double v12; // [sp+8h] [bp-18h]@1
Ritor1
parents:
diff changeset
3325 unsigned __int64 v13; // [sp+18h] [bp-8h]@1
Ritor1
parents:
diff changeset
3326
Ritor1
parents:
diff changeset
3327 v2 = (double)(uDiffuse >> 24) * a2;
Ritor1
parents:
diff changeset
3328 v3 = v2 + 6.7553994e15;
Ritor1
parents:
diff changeset
3329 v4 = LODWORD(v3);
Ritor1
parents:
diff changeset
3330 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2;
Ritor1
parents:
diff changeset
3331 v6 = v5 + 6.7553994e15;
Ritor1
parents:
diff changeset
3332 v7 = LODWORD(v6);
Ritor1
parents:
diff changeset
3333 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2;
Ritor1
parents:
diff changeset
3334 v8 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
3335 v13 = __PAIR__(LODWORD(v6), LODWORD(v8));
Ritor1
parents:
diff changeset
3336 v9 = LODWORD(v8);
Ritor1
parents:
diff changeset
3337 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2;
Ritor1
parents:
diff changeset
3338 v12 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
3339 v10 = LODWORD(v12);
Ritor1
parents:
diff changeset
3340 if ( v4 > 255 )
Ritor1
parents:
diff changeset
3341 v4 = 255;
Ritor1
parents:
diff changeset
3342 if ( v4 < 0 )
Ritor1
parents:
diff changeset
3343 v4 = 0;
Ritor1
parents:
diff changeset
3344 if ( SHIDWORD(v13) > 255 )
Ritor1
parents:
diff changeset
3345 v7 = 255;
Ritor1
parents:
diff changeset
3346 if ( v7 < 0 )
Ritor1
parents:
diff changeset
3347 v7 = 0;
Ritor1
parents:
diff changeset
3348 if ( (signed int)v13 > 255 )
Ritor1
parents:
diff changeset
3349 v9 = 255;
Ritor1
parents:
diff changeset
3350 if ( v9 < 0 )
Ritor1
parents:
diff changeset
3351 v9 = 0;
Ritor1
parents:
diff changeset
3352 if ( SLODWORD(v12) > 255 )
Ritor1
parents:
diff changeset
3353 v10 = 255;
Ritor1
parents:
diff changeset
3354 if ( v10 < 0 )
Ritor1
parents:
diff changeset
3355 v10 = 0;
Ritor1
parents:
diff changeset
3356 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
3357 }
Ritor1
parents:
diff changeset
3358
Ritor1
parents:
diff changeset
3359 //----- (004AD504) --------------------------------------------------------
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3360 int __fastcall sub_4AD504(signed int sFaceID)
0
Ritor1
parents:
diff changeset
3361 {
Ritor1
parents:
diff changeset
3362 int result; // eax@1
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3363 signed int v2; // ebx@1
0
Ritor1
parents:
diff changeset
3364 BLVFace *v3; // esi@3
Ritor1
parents:
diff changeset
3365 Texture *v4; // edi@6
Ritor1
parents:
diff changeset
3366 int v5; // eax@7
Ritor1
parents:
diff changeset
3367 int v6; // edx@7
Ritor1
parents:
diff changeset
3368 int v7; // ecx@7
Ritor1
parents:
diff changeset
3369 int v8; // ebx@8
Ritor1
parents:
diff changeset
3370 int v9; // eax@8
Ritor1
parents:
diff changeset
3371 int v10; // ebx@8
Ritor1
parents:
diff changeset
3372 unsigned int v11; // ebx@9
Ritor1
parents:
diff changeset
3373 int v12; // esi@10
Ritor1
parents:
diff changeset
3374 int v13; // eax@13
Ritor1
parents:
diff changeset
3375 unsigned __int16 *v14; // eax@13
Ritor1
parents:
diff changeset
3376 unsigned int v15; // eax@14
Ritor1
parents:
diff changeset
3377 unsigned __int16 *v16; // ebx@14
Ritor1
parents:
diff changeset
3378 int v17; // eax@15
Ritor1
parents:
diff changeset
3379 int v18; // ebx@15
Ritor1
parents:
diff changeset
3380 int v19; // esi@15
Ritor1
parents:
diff changeset
3381 int v20; // ecx@15
Ritor1
parents:
diff changeset
3382 int v21; // eax@15
Ritor1
parents:
diff changeset
3383 stru193_math *v22; // ebx@15
Ritor1
parents:
diff changeset
3384 int v23; // eax@15
Ritor1
parents:
diff changeset
3385 char *v24; // esi@16
Ritor1
parents:
diff changeset
3386 int v25; // eax@18
Ritor1
parents:
diff changeset
3387 int v26; // eax@18
Ritor1
parents:
diff changeset
3388 int v27; // eax@20
Ritor1
parents:
diff changeset
3389 signed int v28; // esi@20
Ritor1
parents:
diff changeset
3390 signed int v29; // edx@20
Ritor1
parents:
diff changeset
3391 signed int v30; // esi@20
Ritor1
parents:
diff changeset
3392 signed int v31; // edi@20
Ritor1
parents:
diff changeset
3393 int v32; // esi@20
Ritor1
parents:
diff changeset
3394 int v33; // eax@26
Ritor1
parents:
diff changeset
3395 int *v34; // esi@27
Ritor1
parents:
diff changeset
3396 unsigned __int16 *v35; // edi@27
Ritor1
parents:
diff changeset
3397 unsigned int v36; // edx@27
Ritor1
parents:
diff changeset
3398 int v37; // ebx@27
Ritor1
parents:
diff changeset
3399 char v38; // cl@27
Ritor1
parents:
diff changeset
3400 char v39; // ch@27
Ritor1
parents:
diff changeset
3401 int v40; // ebx@29
Ritor1
parents:
diff changeset
3402 int v41; // edx@29
Ritor1
parents:
diff changeset
3403 unsigned int v42; // ebx@30
Ritor1
parents:
diff changeset
3404 int v43; // edx@30
Ritor1
parents:
diff changeset
3405 int v44; // eax@33
Ritor1
parents:
diff changeset
3406 int *v45; // esi@34
Ritor1
parents:
diff changeset
3407 unsigned __int16 *v46; // edi@34
Ritor1
parents:
diff changeset
3408 unsigned int v47; // edx@34
Ritor1
parents:
diff changeset
3409 int v48; // ebx@34
Ritor1
parents:
diff changeset
3410 char v49; // cl@34
Ritor1
parents:
diff changeset
3411 char v50; // ch@34
Ritor1
parents:
diff changeset
3412 int v51; // ebx@36
Ritor1
parents:
diff changeset
3413 int v52; // edx@36
Ritor1
parents:
diff changeset
3414 unsigned __int16 v53; // bx@37
Ritor1
parents:
diff changeset
3415 int v54; // edx@37
Ritor1
parents:
diff changeset
3416 int v55; // eax@40
Ritor1
parents:
diff changeset
3417 int v56; // eax@41
Ritor1
parents:
diff changeset
3418 int *v57; // esi@42
Ritor1
parents:
diff changeset
3419 unsigned __int16 *v58; // edi@42
Ritor1
parents:
diff changeset
3420 unsigned int v59; // edx@42
Ritor1
parents:
diff changeset
3421 int v60; // ebx@42
Ritor1
parents:
diff changeset
3422 char v61; // cl@42
Ritor1
parents:
diff changeset
3423 char v62; // ch@42
Ritor1
parents:
diff changeset
3424 unsigned int v63; // ebx@44
Ritor1
parents:
diff changeset
3425 int v64; // edx@44
Ritor1
parents:
diff changeset
3426 unsigned int v65; // ebx@44
Ritor1
parents:
diff changeset
3427 int v66; // edx@44
Ritor1
parents:
diff changeset
3428 unsigned int v67; // ebx@45
Ritor1
parents:
diff changeset
3429 int v68; // edx@45
Ritor1
parents:
diff changeset
3430 int v69; // ebx@45
Ritor1
parents:
diff changeset
3431 int v70; // edx@45
Ritor1
parents:
diff changeset
3432 int v71; // eax@48
Ritor1
parents:
diff changeset
3433 int *v72; // esi@49
Ritor1
parents:
diff changeset
3434 unsigned __int16 *v73; // edi@49
Ritor1
parents:
diff changeset
3435 unsigned int v74; // edx@49
Ritor1
parents:
diff changeset
3436 int v75; // ebx@49
Ritor1
parents:
diff changeset
3437 char v76; // cl@49
Ritor1
parents:
diff changeset
3438 char v77; // ch@49
Ritor1
parents:
diff changeset
3439 unsigned int v78; // ebx@51
Ritor1
parents:
diff changeset
3440 int v79; // edx@51
Ritor1
parents:
diff changeset
3441 unsigned int v80; // ebx@51
Ritor1
parents:
diff changeset
3442 int v81; // edx@51
Ritor1
parents:
diff changeset
3443 unsigned int v82; // ebx@52
Ritor1
parents:
diff changeset
3444 int v83; // edx@52
Ritor1
parents:
diff changeset
3445 int v84; // ebx@52
Ritor1
parents:
diff changeset
3446 int v85; // edx@52
Ritor1
parents:
diff changeset
3447 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9
Ritor1
parents:
diff changeset
3448 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9
Ritor1
parents:
diff changeset
3449 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9
Ritor1
parents:
diff changeset
3450 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9
Ritor1
parents:
diff changeset
3451 int v90; // [sp+1Ch] [bp-88h]@20
Ritor1
parents:
diff changeset
3452 BLVFace *v91; // [sp+20h] [bp-84h]@3
Ritor1
parents:
diff changeset
3453 int v92; // [sp+24h] [bp-80h]@7
Ritor1
parents:
diff changeset
3454 int i; // [sp+28h] [bp-7Ch]@7
Ritor1
parents:
diff changeset
3455 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9
Ritor1
parents:
diff changeset
3456 unsigned int v95; // [sp+30h] [bp-74h]@1
Ritor1
parents:
diff changeset
3457 Texture *v96; // [sp+34h] [bp-70h]@6
Ritor1
parents:
diff changeset
3458 int v97; // [sp+38h] [bp-6Ch]@15
Ritor1
parents:
diff changeset
3459 unsigned int v98; // [sp+3Ch] [bp-68h]@9
Ritor1
parents:
diff changeset
3460 int v99; // [sp+40h] [bp-64h]@9
Ritor1
parents:
diff changeset
3461 int v100; // [sp+44h] [bp-60h]@24
Ritor1
parents:
diff changeset
3462 int v101; // [sp+48h] [bp-5Ch]@10
Ritor1
parents:
diff changeset
3463 int v102; // [sp+4Ch] [bp-58h]@20
Ritor1
parents:
diff changeset
3464 int v103; // [sp+50h] [bp-54h]@20
Ritor1
parents:
diff changeset
3465 int v104; // [sp+54h] [bp-50h]@9
Ritor1
parents:
diff changeset
3466 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20
Ritor1
parents:
diff changeset
3467 int v106; // [sp+5Ch] [bp-48h]@24
Ritor1
parents:
diff changeset
3468 int v107; // [sp+60h] [bp-44h]@20
Ritor1
parents:
diff changeset
3469 int v108; // [sp+64h] [bp-40h]@20
Ritor1
parents:
diff changeset
3470 int v109; // [sp+68h] [bp-3Ch]@20
Ritor1
parents:
diff changeset
3471 int v110; // [sp+6Ch] [bp-38h]@15
Ritor1
parents:
diff changeset
3472 int v111; // [sp+70h] [bp-34h]@20
Ritor1
parents:
diff changeset
3473 int a1; // [sp+74h] [bp-30h]@12
Ritor1
parents:
diff changeset
3474 int a2; // [sp+78h] [bp-2Ch]@9
Ritor1
parents:
diff changeset
3475 int *v114; // [sp+7Ch] [bp-28h]@16
Ritor1
parents:
diff changeset
3476 int v115; // [sp+80h] [bp-24h]@18
Ritor1
parents:
diff changeset
3477 int v116; // [sp+84h] [bp-20h]@7
Ritor1
parents:
diff changeset
3478 unsigned int v117; // [sp+88h] [bp-1Ch]@15
Ritor1
parents:
diff changeset
3479 unsigned int v118; // [sp+8Ch] [bp-18h]@24
Ritor1
parents:
diff changeset
3480 int *v119; // [sp+90h] [bp-14h]@13
Ritor1
parents:
diff changeset
3481 int v120; // [sp+94h] [bp-10h]@15
Ritor1
parents:
diff changeset
3482 unsigned int v121; // [sp+98h] [bp-Ch]@15
Ritor1
parents:
diff changeset
3483 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
3484 unsigned int v123; // [sp+A0h] [bp-4h]@13
Ritor1
parents:
diff changeset
3485
Ritor1
parents:
diff changeset
3486 result = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3487 v2 = sFaceID;
0
Ritor1
parents:
diff changeset
3488 v95 = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3489 if ( sFaceID >= 0 )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3490 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3491 if ( sFaceID < (signed int)pIndoor->uNumFaces )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3492 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3493 v3 = &pIndoor->pFaces[sFaceID];
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3494 v91 = &pIndoor->pFaces[sFaceID];
0
Ritor1
parents:
diff changeset
3495 if ( !pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
3496 {
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
3497 result = GetPortalScreenCoord(sFaceID);
0
Ritor1
parents:
diff changeset
3498 if ( result )
Ritor1
parents:
diff changeset
3499 {
1372
Ritor1
parents: 1362
diff changeset
3500 result = PortalFrustrum(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
0
Ritor1
parents:
diff changeset
3501 if ( result )
Ritor1
parents:
diff changeset
3502 {
Ritor1
parents:
diff changeset
3503 result = (int)v3->GetTexture();
Ritor1
parents:
diff changeset
3504 v4 = (Texture *)result;
Ritor1
parents:
diff changeset
3505 v96 = (Texture *)result;
Ritor1
parents:
diff changeset
3506 if ( result )
Ritor1
parents:
diff changeset
3507 {
Ritor1
parents:
diff changeset
3508 v5 = *(short *)(result + 38);
Ritor1
parents:
diff changeset
3509 LOBYTE(v3->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
3510 v92 = v5;
Ritor1
parents:
diff changeset
3511 sub_4AE5F1(v2);
Ritor1
parents:
diff changeset
3512 ++pBLVRenderParams->field_84;
Ritor1
parents:
diff changeset
3513 v6 = stru_F8AD28.pDeltaUV[0];
Ritor1
parents:
diff changeset
3514 v116 = stru_F8AD28.pDeltaUV[1];
Ritor1
parents:
diff changeset
3515 v7 = 0;
Ritor1
parents:
diff changeset
3516 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 )
Ritor1
parents:
diff changeset
3517 {
Ritor1
parents:
diff changeset
3518 v8 = v116;
Ritor1
parents:
diff changeset
3519 stru_F8AD28._blv_lights_xs[v7] += v6;
Ritor1
parents:
diff changeset
3520 v9 = 4 * v7 + 16297672;
Ritor1
parents:
diff changeset
3521 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++];
Ritor1
parents:
diff changeset
3522 }
Ritor1
parents:
diff changeset
3523 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1);
Ritor1
parents:
diff changeset
3524 result = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
3525 a2 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
3526 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
3527 v99 = 640 * stru_F8A590._viewport_space_y;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
3528 v86 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
3529 v87 = v4->pLevelOfDetail1;
Ritor1
parents:
diff changeset
3530 v88 = v4->pLevelOfDetail2;
Ritor1
parents:
diff changeset
3531 v89 = v4->pLevelOfDetail3;
Ritor1
parents:
diff changeset
3532 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
3533 v104 = 2 * pBLVRenderParams->field_0_timer_;
Ritor1
parents:
diff changeset
3534 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
3535 {
Ritor1
parents:
diff changeset
3536 v12 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
3537 v101 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
3538 while ( 1 )
Ritor1
parents:
diff changeset
3539 {
1281
Ritor1
parents: 1237
diff changeset
3540 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12);
0
Ritor1
parents:
diff changeset
3541 sub_4AE313(a1, result, &stru_F81018.field_0);
Ritor1
parents:
diff changeset
3542 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
3543 {
Ritor1
parents:
diff changeset
3544 v15 = v95 * (v12 - pBLVRenderParams->uViewportY);
Ritor1
parents:
diff changeset
3545 v119 = &pBLVRenderParams->pTargetZBuffer[2
1281
Ritor1
parents: 1237
diff changeset
3546 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v12)
0
Ritor1
parents:
diff changeset
3547 + 320 * (v12 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
3548 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
3549 v16 = &pBLVRenderParams->pRenderTarget[v15
1281
Ritor1
parents: 1237
diff changeset
3550 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12)
0
Ritor1
parents:
diff changeset
3551 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
3552 v14 = &pBLVRenderParams->pRenderTarget[v15
1281
Ritor1
parents: 1237
diff changeset
3553 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)
0
Ritor1
parents:
diff changeset
3554 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
3555 v123 = (unsigned int)v16;
Ritor1
parents:
diff changeset
3556 }
Ritor1
parents:
diff changeset
3557 else
Ritor1
parents:
diff changeset
3558 {
1281
Ritor1
parents: 1237
diff changeset
3559 v13 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12);
0
Ritor1
parents:
diff changeset
3560 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99];
Ritor1
parents:
diff changeset
3561 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11];
1281
Ritor1
parents: 1237
diff changeset
3562 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)];
0
Ritor1
parents:
diff changeset
3563 }
Ritor1
parents:
diff changeset
3564 v117 = (unsigned int)v14;
Ritor1
parents:
diff changeset
3565 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0);
Ritor1
parents:
diff changeset
3566 v18 = stru_F81018.field_0.field_10;
Ritor1
parents:
diff changeset
3567 LOWORD(v17) = 0;
Ritor1
parents:
diff changeset
3568 v97 = stru_F8AD28.field_0 | v17;
Ritor1
parents:
diff changeset
3569 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
Ritor1
parents:
diff changeset
3570 v19 = stru_F81018.field_0.field_4 >> i;
Ritor1
parents:
diff changeset
3571 v20 = 11 - v18;
Ritor1
parents:
diff changeset
3572 v116 = stru_F81018.field_0.field_8 >> i;
Ritor1
parents:
diff changeset
3573 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18);
Ritor1
parents:
diff changeset
3574 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
3575 v122 = (unsigned __int16 *)v20;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
3576 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
3577 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122));
0
Ritor1
parents:
diff changeset
3578 v120 = v116 + 4 * v23;
Ritor1
parents:
diff changeset
3579 if ( v123 < v117 )
Ritor1
parents:
diff changeset
3580 {
Ritor1
parents:
diff changeset
3581 v24 = (char *)&stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
3582 v114 = &stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
3583 a1 += 16;
Ritor1
parents:
diff changeset
3584 while ( 1 )
Ritor1
parents:
diff changeset
3585 {
Ritor1
parents:
diff changeset
3586 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8));
Ritor1
parents:
diff changeset
3587 v25 = *((int *)v24 - 2);
Ritor1
parents:
diff changeset
3588 LOWORD(v25) = 0;
Ritor1
parents:
diff changeset
3589 v115 = v97;
Ritor1
parents:
diff changeset
3590 v26 = stru_F8AD28.field_0 | v25;
Ritor1
parents:
diff changeset
3591 if ( v97 <= (unsigned int)v26 )
Ritor1
parents:
diff changeset
3592 v115 = v26;
Ritor1
parents:
diff changeset
3593 v97 = v26;
Ritor1
parents:
diff changeset
3594 v27 = *((int *)v24 - 11);
Ritor1
parents:
diff changeset
3595 v28 = *((int *)v24 - 1);
Ritor1
parents:
diff changeset
3596 v105 = (&v86)[4 * v27];
Ritor1
parents:
diff changeset
3597 v111 = v27 + 16;
Ritor1
parents:
diff changeset
3598 v29 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
3599 v109 = v27 + v27 + 16 - v4->uWidthLn2;
Ritor1
parents:
diff changeset
3600 v107 = v29 >> v27;
Ritor1
parents:
diff changeset
3601 v30 = v28 >> i;
Ritor1
parents:
diff changeset
3602 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16);
Ritor1
parents:
diff changeset
3603 v31 = *v114 >> i;
Ritor1
parents:
diff changeset
3604 v122 = (unsigned __int16 *)(11 - v27);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
3605 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27)));
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
3606 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122));
0
Ritor1
parents:
diff changeset
3607 v108 = (signed int)(v116 - v121) >> 4;
Ritor1
parents:
diff changeset
3608 v103 = (v90 - v120) >> 4;
Ritor1
parents:
diff changeset
3609 v32 = v123 + 32;
Ritor1
parents:
diff changeset
3610 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
3611 v32 = v123 + 64;
Ritor1
parents:
diff changeset
3612 if ( v32 > v117 )
Ritor1
parents:
diff changeset
3613 v32 = v117;
Ritor1
parents:
diff changeset
3614 v118 = v32;
Ritor1
parents:
diff changeset
3615 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1));
Ritor1
parents:
diff changeset
3616 v106 = (signed int)(v32 - v123) >> 1;
Ritor1
parents:
diff changeset
3617 if ( v110 >> 16 == v100 >> 16 )
Ritor1
parents:
diff changeset
3618 {
Ritor1
parents:
diff changeset
3619 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1);
Ritor1
parents:
diff changeset
3620 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
3621 {
Ritor1
parents:
diff changeset
3622 v44 = v123;
Ritor1
parents:
diff changeset
3623 if ( v123 < v118 )
Ritor1
parents:
diff changeset
3624 {
Ritor1
parents:
diff changeset
3625 v45 = v119;
Ritor1
parents:
diff changeset
3626 v46 = v122;
Ritor1
parents:
diff changeset
3627 v47 = v121;
Ritor1
parents:
diff changeset
3628 v48 = v120;
Ritor1
parents:
diff changeset
3629 v49 = v111;
Ritor1
parents:
diff changeset
3630 v50 = v109;
Ritor1
parents:
diff changeset
3631 if ( v106 & 2 )
Ritor1
parents:
diff changeset
3632 {
Ritor1
parents:
diff changeset
3633 *v119 = v115;
Ritor1
parents:
diff changeset
3634 v45 -= 2;
Ritor1
parents:
diff changeset
3635 v44 = v123 + 4;
Ritor1
parents:
diff changeset
3636 goto LABEL_37;
Ritor1
parents:
diff changeset
3637 }
Ritor1
parents:
diff changeset
3638 do
Ritor1
parents:
diff changeset
3639 {
Ritor1
parents:
diff changeset
3640 v44 += 8;
Ritor1
parents:
diff changeset
3641 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50));
Ritor1
parents:
diff changeset
3642 v52 = v115;
Ritor1
parents:
diff changeset
3643 LOWORD(v51) = v46[v51];
Ritor1
parents:
diff changeset
3644 *v45 = v115;
Ritor1
parents:
diff changeset
3645 v45[1] = v52;
Ritor1
parents:
diff changeset
3646 v45[640] = v52;
Ritor1
parents:
diff changeset
3647 v45[641] = v52;
Ritor1
parents:
diff changeset
3648 *(short *)(v44 - 8) = v51;
Ritor1
parents:
diff changeset
3649 *(short *)(v44 - 6) = v51;
Ritor1
parents:
diff changeset
3650 *(short *)(v44 + 1272) = v51;
Ritor1
parents:
diff changeset
3651 *(short *)(v44 + 1274) = v51;
Ritor1
parents:
diff changeset
3652 v45[2] = v52;
Ritor1
parents:
diff changeset
3653 v45[3] = v52;
Ritor1
parents:
diff changeset
3654 v45[642] = v52;
Ritor1
parents:
diff changeset
3655 v45[643] = v52;
Ritor1
parents:
diff changeset
3656 v121 += v108;
Ritor1
parents:
diff changeset
3657 v120 += v103;
Ritor1
parents:
diff changeset
3658 v47 = v121;
Ritor1
parents:
diff changeset
3659 v48 = v120;
Ritor1
parents:
diff changeset
3660 LABEL_37:
Ritor1
parents:
diff changeset
3661 v45 += 4;
Ritor1
parents:
diff changeset
3662 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))];
Ritor1
parents:
diff changeset
3663 v54 = v108;
Ritor1
parents:
diff changeset
3664 *(short *)(v44 - 4) = v53;
Ritor1
parents:
diff changeset
3665 *(short *)(v44 - 2) = v53;
Ritor1
parents:
diff changeset
3666 *(short *)(v44 + 1276) = v53;
Ritor1
parents:
diff changeset
3667 *(short *)(v44 + 1278) = v53;
Ritor1
parents:
diff changeset
3668 v121 += v54;
Ritor1
parents:
diff changeset
3669 v120 += v103;
Ritor1
parents:
diff changeset
3670 v47 = v121;
Ritor1
parents:
diff changeset
3671 v48 = v120;
Ritor1
parents:
diff changeset
3672 }
Ritor1
parents:
diff changeset
3673 while ( v44 < v118 );
Ritor1
parents:
diff changeset
3674 v123 = v44;
Ritor1
parents:
diff changeset
3675 v119 = v45;
Ritor1
parents:
diff changeset
3676 }
Ritor1
parents:
diff changeset
3677 }
Ritor1
parents:
diff changeset
3678 else
Ritor1
parents:
diff changeset
3679 {
Ritor1
parents:
diff changeset
3680 v33 = v123;
Ritor1
parents:
diff changeset
3681 if ( v123 < v118 )
Ritor1
parents:
diff changeset
3682 {
Ritor1
parents:
diff changeset
3683 v34 = v119;
Ritor1
parents:
diff changeset
3684 v35 = v122;
Ritor1
parents:
diff changeset
3685 v36 = v121;
Ritor1
parents:
diff changeset
3686 v37 = v120;
Ritor1
parents:
diff changeset
3687 v38 = v111;
Ritor1
parents:
diff changeset
3688 v39 = v109;
Ritor1
parents:
diff changeset
3689 if ( v106 & 1 )
Ritor1
parents:
diff changeset
3690 {
Ritor1
parents:
diff changeset
3691 *v119 = v115;
Ritor1
parents:
diff changeset
3692 --v34;
Ritor1
parents:
diff changeset
3693 v33 = v123 + 2;
Ritor1
parents:
diff changeset
3694 goto LABEL_30;
Ritor1
parents:
diff changeset
3695 }
Ritor1
parents:
diff changeset
3696 do
Ritor1
parents:
diff changeset
3697 {
Ritor1
parents:
diff changeset
3698 v33 += 4;
Ritor1
parents:
diff changeset
3699 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
3700 v41 = v115;
Ritor1
parents:
diff changeset
3701 LOWORD(v40) = v35[v40];
Ritor1
parents:
diff changeset
3702 *v34 = v115;
Ritor1
parents:
diff changeset
3703 *(short *)(v33 - 4) = v40;
Ritor1
parents:
diff changeset
3704 v34[1] = v41;
Ritor1
parents:
diff changeset
3705 v121 += v108;
Ritor1
parents:
diff changeset
3706 v120 += v103;
Ritor1
parents:
diff changeset
3707 v36 = v121;
Ritor1
parents:
diff changeset
3708 v37 = v120;
Ritor1
parents:
diff changeset
3709 LABEL_30:
Ritor1
parents:
diff changeset
3710 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
3711 v34 += 2;
Ritor1
parents:
diff changeset
3712 v43 = v108;
Ritor1
parents:
diff changeset
3713 *(short *)(v33 - 2) = v35[*(char *)v42];
Ritor1
parents:
diff changeset
3714 v121 += v43;
Ritor1
parents:
diff changeset
3715 v120 += v103;
Ritor1
parents:
diff changeset
3716 v36 = v121;
Ritor1
parents:
diff changeset
3717 v37 = v120;
Ritor1
parents:
diff changeset
3718 }
Ritor1
parents:
diff changeset
3719 while ( v33 < v118 );
Ritor1
parents:
diff changeset
3720 v123 = v33;
Ritor1
parents:
diff changeset
3721 v119 = v34;
Ritor1
parents:
diff changeset
3722 }
Ritor1
parents:
diff changeset
3723 }
Ritor1
parents:
diff changeset
3724 }
Ritor1
parents:
diff changeset
3725 else
Ritor1
parents:
diff changeset
3726 {
Ritor1
parents:
diff changeset
3727 v55 = v110 - ((v100 - v110) >> 4);
Ritor1
parents:
diff changeset
3728 v110 = (v100 - v110) >> 4;
Ritor1
parents:
diff changeset
3729 v122 = (unsigned __int16 *)v55;
Ritor1
parents:
diff changeset
3730 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
3731 {
Ritor1
parents:
diff changeset
3732 v71 = v123;
Ritor1
parents:
diff changeset
3733 if ( v123 < v118 )
Ritor1
parents:
diff changeset
3734 {
Ritor1
parents:
diff changeset
3735 v72 = v119;
Ritor1
parents:
diff changeset
3736 v73 = v94;
Ritor1
parents:
diff changeset
3737 v74 = v121;
Ritor1
parents:
diff changeset
3738 v75 = v120;
Ritor1
parents:
diff changeset
3739 v76 = v111;
Ritor1
parents:
diff changeset
3740 v77 = v109;
Ritor1
parents:
diff changeset
3741 if ( v106 & 2 )
Ritor1
parents:
diff changeset
3742 {
Ritor1
parents:
diff changeset
3743 *v119 = v115;
Ritor1
parents:
diff changeset
3744 v72 += 2;
Ritor1
parents:
diff changeset
3745 v71 = v123 + 4;
Ritor1
parents:
diff changeset
3746 goto LABEL_52;
Ritor1
parents:
diff changeset
3747 }
Ritor1
parents:
diff changeset
3748 do
Ritor1
parents:
diff changeset
3749 {
Ritor1
parents:
diff changeset
3750 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
3751 v79 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
3752 v71 += 8;
Ritor1
parents:
diff changeset
3753 v122 = (unsigned __int16 *)v79;
Ritor1
parents:
diff changeset
3754 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78];
Ritor1
parents:
diff changeset
3755 v81 = v115;
Ritor1
parents:
diff changeset
3756 LOWORD(v80) = v73[v80];
Ritor1
parents:
diff changeset
3757 *v72 = v115;
Ritor1
parents:
diff changeset
3758 v72[1] = v81;
Ritor1
parents:
diff changeset
3759 v72[640] = v81;
Ritor1
parents:
diff changeset
3760 v72[641] = v81;
Ritor1
parents:
diff changeset
3761 *(short *)(v71 - 8) = v80;
Ritor1
parents:
diff changeset
3762 *(short *)(v71 - 6) = v80;
Ritor1
parents:
diff changeset
3763 *(short *)(v71 + 1272) = v80;
Ritor1
parents:
diff changeset
3764 *(short *)(v71 + 1274) = v80;
Ritor1
parents:
diff changeset
3765 v72[2] = v81;
Ritor1
parents:
diff changeset
3766 v72[3] = v81;
Ritor1
parents:
diff changeset
3767 v72[642] = v81;
Ritor1
parents:
diff changeset
3768 v72[643] = v81;
Ritor1
parents:
diff changeset
3769 v121 += v108;
Ritor1
parents:
diff changeset
3770 v120 += v103;
Ritor1
parents:
diff changeset
3771 v74 = v121;
Ritor1
parents:
diff changeset
3772 v75 = v120;
Ritor1
parents:
diff changeset
3773 v72 += 4;
Ritor1
parents:
diff changeset
3774 LABEL_52:
Ritor1
parents:
diff changeset
3775 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
3776 v83 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
3777 v84 = v105[v82];
Ritor1
parents:
diff changeset
3778 v122 = (unsigned __int16 *)v83;
Ritor1
parents:
diff changeset
3779 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84];
Ritor1
parents:
diff changeset
3780 v85 = v108;
Ritor1
parents:
diff changeset
3781 *(short *)(v71 - 4) = v84;
Ritor1
parents:
diff changeset
3782 *(short *)(v71 - 2) = v84;
Ritor1
parents:
diff changeset
3783 *(short *)(v71 + 1276) = v84;
Ritor1
parents:
diff changeset
3784 *(short *)(v71 + 1278) = v84;
Ritor1
parents:
diff changeset
3785 v121 += v85;
Ritor1
parents:
diff changeset
3786 v120 += v103;
Ritor1
parents:
diff changeset
3787 v74 = v121;
Ritor1
parents:
diff changeset
3788 v75 = v120;
Ritor1
parents:
diff changeset
3789 }
Ritor1
parents:
diff changeset
3790 while ( v71 < v118 );
Ritor1
parents:
diff changeset
3791 v123 = v71;
Ritor1
parents:
diff changeset
3792 v119 = v72;
Ritor1
parents:
diff changeset
3793 }
Ritor1
parents:
diff changeset
3794 }
Ritor1
parents:
diff changeset
3795 else
Ritor1
parents:
diff changeset
3796 {
Ritor1
parents:
diff changeset
3797 v56 = v123;
Ritor1
parents:
diff changeset
3798 if ( v123 < v118 )
Ritor1
parents:
diff changeset
3799 {
Ritor1
parents:
diff changeset
3800 v57 = v119;
Ritor1
parents:
diff changeset
3801 v58 = v94;
Ritor1
parents:
diff changeset
3802 v59 = v121;
Ritor1
parents:
diff changeset
3803 v60 = v120;
Ritor1
parents:
diff changeset
3804 v61 = v111;
Ritor1
parents:
diff changeset
3805 v62 = v109;
Ritor1
parents:
diff changeset
3806 if ( v106 & 1 )
Ritor1
parents:
diff changeset
3807 {
Ritor1
parents:
diff changeset
3808 *v119 = v115;
Ritor1
parents:
diff changeset
3809 ++v57;
Ritor1
parents:
diff changeset
3810 v56 = v123 + 2;
Ritor1
parents:
diff changeset
3811 goto LABEL_45;
Ritor1
parents:
diff changeset
3812 }
Ritor1
parents:
diff changeset
3813 do
Ritor1
parents:
diff changeset
3814 {
Ritor1
parents:
diff changeset
3815 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
3816 v64 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
3817 v56 += 4;
Ritor1
parents:
diff changeset
3818 v122 = (unsigned __int16 *)v64;
Ritor1
parents:
diff changeset
3819 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63];
Ritor1
parents:
diff changeset
3820 v66 = v115;
Ritor1
parents:
diff changeset
3821 LOWORD(v65) = v58[v65];
Ritor1
parents:
diff changeset
3822 *v57 = v115;
Ritor1
parents:
diff changeset
3823 *(short *)(v56 - 4) = v65;
Ritor1
parents:
diff changeset
3824 v57[1] = v66;
Ritor1
parents:
diff changeset
3825 v121 += v108;
Ritor1
parents:
diff changeset
3826 v120 += v103;
Ritor1
parents:
diff changeset
3827 v59 = v121;
Ritor1
parents:
diff changeset
3828 v60 = v120;
Ritor1
parents:
diff changeset
3829 v57 += 2;
Ritor1
parents:
diff changeset
3830 LABEL_45:
Ritor1
parents:
diff changeset
3831 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
3832 v68 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
3833 v69 = v105[v67];
Ritor1
parents:
diff changeset
3834 v122 = (unsigned __int16 *)v68;
Ritor1
parents:
diff changeset
3835 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69];
Ritor1
parents:
diff changeset
3836 v70 = v108;
Ritor1
parents:
diff changeset
3837 *(short *)(v56 - 2) = v69;
Ritor1
parents:
diff changeset
3838 v121 += v70;
Ritor1
parents:
diff changeset
3839 v120 += v103;
Ritor1
parents:
diff changeset
3840 v59 = v121;
Ritor1
parents:
diff changeset
3841 v60 = v120;
Ritor1
parents:
diff changeset
3842 }
Ritor1
parents:
diff changeset
3843 while ( v56 < v118 );
Ritor1
parents:
diff changeset
3844 v123 = v56;
Ritor1
parents:
diff changeset
3845 v119 = v57;
Ritor1
parents:
diff changeset
3846 }
Ritor1
parents:
diff changeset
3847 }
Ritor1
parents:
diff changeset
3848 }
Ritor1
parents:
diff changeset
3849 v114 += 13;
Ritor1
parents:
diff changeset
3850 v110 = v100;
Ritor1
parents:
diff changeset
3851 a1 += 16;
Ritor1
parents:
diff changeset
3852 v4 = v96;
Ritor1
parents:
diff changeset
3853 v121 = v116;
Ritor1
parents:
diff changeset
3854 v120 = v90;
Ritor1
parents:
diff changeset
3855 if ( v123 >= v117 )
Ritor1
parents:
diff changeset
3856 break;
Ritor1
parents:
diff changeset
3857 v24 = (char *)v114;
Ritor1
parents:
diff changeset
3858 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
3859 }
Ritor1
parents:
diff changeset
3860 }
Ritor1
parents:
diff changeset
3861 ++a2;
Ritor1
parents:
diff changeset
3862 v98 += v95;
Ritor1
parents:
diff changeset
3863 result = a2;
Ritor1
parents:
diff changeset
3864 v101 += 2;
Ritor1
parents:
diff changeset
3865 v99 += 640;
Ritor1
parents:
diff changeset
3866 if ( a2 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
3867 break;
Ritor1
parents:
diff changeset
3868 v12 = v101;
Ritor1
parents:
diff changeset
3869 result = a2;
Ritor1
parents:
diff changeset
3870 v11 = v98;
Ritor1
parents:
diff changeset
3871 }
Ritor1
parents:
diff changeset
3872 }
Ritor1
parents:
diff changeset
3873 }
Ritor1
parents:
diff changeset
3874 }
Ritor1
parents:
diff changeset
3875 }
Ritor1
parents:
diff changeset
3876 }
Ritor1
parents:
diff changeset
3877 }
Ritor1
parents:
diff changeset
3878 }
Ritor1
parents:
diff changeset
3879 return result;
Ritor1
parents:
diff changeset
3880 }
Ritor1
parents:
diff changeset
3881 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
3882
Ritor1
parents:
diff changeset
3883 //----- (004ADD1D) --------------------------------------------------------
Ritor1
parents:
diff changeset
3884 void __fastcall sub_4ADD1D(int uFaceID)
Ritor1
parents:
diff changeset
3885 {
Ritor1
parents:
diff changeset
3886 int v1; // edi@1
Ritor1
parents:
diff changeset
3887 BLVFace *v2; // esi@3
Ritor1
parents:
diff changeset
3888 signed int v3; // ebx@4
Ritor1
parents:
diff changeset
3889 Texture *v4; // edi@9
Ritor1
parents:
diff changeset
3890 signed int v5; // eax@9
Ritor1
parents:
diff changeset
3891 char *v6; // edi@12
Ritor1
parents:
diff changeset
3892 signed int v7; // eax@15
Ritor1
parents:
diff changeset
3893 unsigned int v8; // eax@16
Ritor1
parents:
diff changeset
3894 __int16 v9; // cx@19
Ritor1
parents:
diff changeset
3895 unsigned __int8 *v10; // eax@19
Ritor1
parents:
diff changeset
3896 unsigned __int16 *v11; // eax@19
Ritor1
parents:
diff changeset
3897 int v12; // edi@19
Ritor1
parents:
diff changeset
3898 int v13; // ebx@20
Ritor1
parents:
diff changeset
3899 stru352 *v14; // esi@20
Ritor1
parents:
diff changeset
3900 DWORD v15; // eax@22
Ritor1
parents:
diff changeset
3901 signed int v16; // ecx@22
Ritor1
parents:
diff changeset
3902 signed int v17; // ST68_4@22
Ritor1
parents:
diff changeset
3903 int v18; // eax@22
Ritor1
parents:
diff changeset
3904 int v19; // ecx@22
Ritor1
parents:
diff changeset
3905 unsigned int v20; // esi@23
Ritor1
parents:
diff changeset
3906 int v21; // edi@23
Ritor1
parents:
diff changeset
3907 int v22; // eax@23
Ritor1
parents:
diff changeset
3908 int *v23; // ebx@24
Ritor1
parents:
diff changeset
3909 int v24; // edx@24
Ritor1
parents:
diff changeset
3910 int v25; // ebx@25
Ritor1
parents:
diff changeset
3911 unsigned __int16 v26; // cx@25
Ritor1
parents:
diff changeset
3912 int v27; // edx@26
Ritor1
parents:
diff changeset
3913 unsigned __int16 v28; // cx@26
Ritor1
parents:
diff changeset
3914 unsigned __int8 v29; // sf@27
Ritor1
parents:
diff changeset
3915 unsigned __int8 v30; // of@27
Ritor1
parents:
diff changeset
3916 unsigned int v31; // esi@29
Ritor1
parents:
diff changeset
3917 int v32; // edi@29
Ritor1
parents:
diff changeset
3918 unsigned __int16 *v33; // eax@29
Ritor1
parents:
diff changeset
3919 int *v34; // ebx@30
Ritor1
parents:
diff changeset
3920 int v35; // edx@30
Ritor1
parents:
diff changeset
3921 int v36; // ebx@31
Ritor1
parents:
diff changeset
3922 unsigned __int16 v37; // cx@31
Ritor1
parents:
diff changeset
3923 int v38; // edx@32
Ritor1
parents:
diff changeset
3924 unsigned __int16 v39; // cx@32
Ritor1
parents:
diff changeset
3925 Texture *v40; // [sp-10h] [bp-6Ch]@16
Ritor1
parents:
diff changeset
3926 int v41; // [sp-Ch] [bp-68h]@15
Ritor1
parents:
diff changeset
3927 unsigned int v42; // [sp+10h] [bp-4Ch]@1
Ritor1
parents:
diff changeset
3928 signed int v43; // [sp+14h] [bp-48h]@12
Ritor1
parents:
diff changeset
3929 signed int v44; // [sp+14h] [bp-48h]@22
Ritor1
parents:
diff changeset
3930 int v45; // [sp+1Ch] [bp-40h]@22
Ritor1
parents:
diff changeset
3931 int v46; // [sp+20h] [bp-3Ch]@22
Ritor1
parents:
diff changeset
3932 int v47; // [sp+24h] [bp-38h]@19
Ritor1
parents:
diff changeset
3933 char v48; // [sp+28h] [bp-34h]@19
Ritor1
parents:
diff changeset
3934 int v49; // [sp+2Ch] [bp-30h]@19
Ritor1
parents:
diff changeset
3935 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19
Ritor1
parents:
diff changeset
3936 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19
Ritor1
parents:
diff changeset
3937 int v52; // [sp+38h] [bp-24h]@22
Ritor1
parents:
diff changeset
3938 int v53; // [sp+3Ch] [bp-20h]@22
Ritor1
parents:
diff changeset
3939 signed int v54; // [sp+40h] [bp-1Ch]@12
Ritor1
parents:
diff changeset
3940 int v55; // [sp+40h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
3941 int v56; // [sp+44h] [bp-18h]@20
Ritor1
parents:
diff changeset
3942 stru352 *i; // [sp+48h] [bp-14h]@20
Ritor1
parents:
diff changeset
3943 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23
Ritor1
parents:
diff changeset
3944 int v59; // [sp+50h] [bp-Ch]@4
Ritor1
parents:
diff changeset
3945 int v60; // [sp+50h] [bp-Ch]@19
Ritor1
parents:
diff changeset
3946 int v61; // [sp+54h] [bp-8h]@22
Ritor1
parents:
diff changeset
3947 int *v62; // [sp+58h] [bp-4h]@23
Ritor1
parents:
diff changeset
3948 int *v63; // [sp+58h] [bp-4h]@29
Ritor1
parents:
diff changeset
3949
Ritor1
parents:
diff changeset
3950 v1 = uFaceID;
Ritor1
parents:
diff changeset
3951 v42 = pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
3952 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces )
Ritor1
parents:
diff changeset
3953 {
Ritor1
parents:
diff changeset
3954 v2 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
3955 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
3956 {
Ritor1
parents:
diff changeset
3957 v3 = sub_424579(uFaceID, &stru_F8AD28);
Ritor1
parents:
diff changeset
3958 v59 = v3;
Ritor1
parents:
diff changeset
3959 }
Ritor1
parents:
diff changeset
3960 else
Ritor1
parents:
diff changeset
3961 {
1344
65379a50e4eb Portals in indoor (continue)
Ritor1
parents: 1339
diff changeset
3962 v59 = GetPortalScreenCoord(uFaceID);
0
Ritor1
parents:
diff changeset
3963 v3 = v59;
Ritor1
parents:
diff changeset
3964 }
1372
Ritor1
parents: 1362
diff changeset
3965 if ( v3 && (pRenderer->pRenderD3D || PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
0
Ritor1
parents:
diff changeset
3966 {
Ritor1
parents:
diff changeset
3967 v4 = v2->GetTexture();
Ritor1
parents:
diff changeset
3968 v5 = 0;
Ritor1
parents:
diff changeset
3969 if ( v4 )
Ritor1
parents:
diff changeset
3970 {
Ritor1
parents:
diff changeset
3971 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
3972 {
Ritor1
parents:
diff changeset
3973 if ( v3 > 0 )
Ritor1
parents:
diff changeset
3974 {
Ritor1
parents:
diff changeset
3975 v54 = v3;
Ritor1
parents:
diff changeset
3976 v43 = v3;
Ritor1
parents:
diff changeset
3977 v6 = (char *)&array_507D30[0].v;
Ritor1
parents:
diff changeset
3978 do
Ritor1
parents:
diff changeset
3979 {
Ritor1
parents:
diff changeset
3980 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1);
Ritor1
parents:
diff changeset
3981 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6;
Ritor1
parents:
diff changeset
3982 v6 += 48;
Ritor1
parents:
diff changeset
3983 --v54;
Ritor1
parents:
diff changeset
3984 }
Ritor1
parents:
diff changeset
3985 while ( v54 );
Ritor1
parents:
diff changeset
3986 v3 = v59;
Ritor1
parents:
diff changeset
3987 v5 = v43;
Ritor1
parents:
diff changeset
3988 }
Ritor1
parents:
diff changeset
3989 v7 = v5;
Ritor1
parents:
diff changeset
3990 v41 = stru_F8AD28.field_0;
Ritor1
parents:
diff changeset
3991 array_507D30[v7].u = array_507D30[v7].u * 0.25;
Ritor1
parents:
diff changeset
3992 array_507D30[v7].v = array_507D30[v7].v * 0.25;
Ritor1
parents:
diff changeset
3993 if ( BYTE1(v2->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
3994 {
Ritor1
parents:
diff changeset
3995 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
3996 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_);
Ritor1
parents:
diff changeset
3997 }
Ritor1
parents:
diff changeset
3998 else
Ritor1
parents:
diff changeset
3999 {
Ritor1
parents:
diff changeset
4000 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
4001 v8 = v2->uBitmapID;
Ritor1
parents:
diff changeset
4002 }
Ritor1
parents:
diff changeset
4003 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0);
Ritor1
parents:
diff changeset
4004 }
Ritor1
parents:
diff changeset
4005 else
Ritor1
parents:
diff changeset
4006 {
Ritor1
parents:
diff changeset
4007 v49 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
4008 v47 = v4->uHeightMinus1 << 16;
Ritor1
parents:
diff changeset
4009 v9 = 16 - v4->uWidthLn2;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
4010 v10 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
4011 LOBYTE(v2->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
4012 v48 = v9;
Ritor1
parents:
diff changeset
4013 v50 = v10;
Ritor1
parents:
diff changeset
4014 sub_4AF412();
Ritor1
parents:
diff changeset
4015 ++pBLVRenderParams->uNumFacesRenderedThisFrame;
Ritor1
parents:
diff changeset
4016 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1);
Ritor1
parents:
diff changeset
4017 v12 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4018 v51 = v11;
Ritor1
parents:
diff changeset
4019 v60 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4020 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4021 {
Ritor1
parents:
diff changeset
4022 v13 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4023 v14 = &stru_F83B80[stru_F8A590._viewport_space_y];
Ritor1
parents:
diff changeset
4024 v55 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4025 v56 = 640 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4026 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i )
Ritor1
parents:
diff changeset
4027 {
1281
Ritor1
parents: 1237
diff changeset
4028 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13), v12);
0
Ritor1
parents:
diff changeset
4029 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16);
Ritor1
parents:
diff changeset
4030 v15 = GetTickCount();
Ritor1
parents:
diff changeset
4031 v16 = v14->field_0;
Ritor1
parents:
diff changeset
4032 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11;
Ritor1
parents:
diff changeset
4033 v45 = v14->field_4 >> 3;
Ritor1
parents:
diff changeset
4034 v44 = v16 >> 3;
Ritor1
parents:
diff changeset
4035 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3;
Ritor1
parents:
diff changeset
4036 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4037 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
4038 v18 = v14->field_28;
1281
Ritor1
parents: 1237
diff changeset
4039 v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13);
0
Ritor1
parents:
diff changeset
4040 LOWORD(v18) = 0;
Ritor1
parents:
diff changeset
4041 v46 = stru_F8AD28.field_0 | v18;
1281
Ritor1
parents: 1237
diff changeset
4042 v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19;
0
Ritor1
parents:
diff changeset
4043 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4044 {
Ritor1
parents:
diff changeset
4045 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
4046 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4047 v31 = v44;
Ritor1
parents:
diff changeset
4048 v32 = v45;
Ritor1
parents:
diff changeset
4049 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
4050 + 2 * v19
Ritor1
parents:
diff changeset
4051 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4052 if ( v61 & 1 )
Ritor1
parents:
diff changeset
4053 {
Ritor1
parents:
diff changeset
4054 --v61;
Ritor1
parents:
diff changeset
4055 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
4056 + 2 * v19
Ritor1
parents:
diff changeset
4057 - pBLVRenderParams->uViewportX
Ritor1
parents:
diff changeset
4058 - 2];
Ritor1
parents:
diff changeset
4059 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
4060 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4061 v35 = v46;
Ritor1
parents:
diff changeset
4062 v63 += 2;
Ritor1
parents:
diff changeset
4063 goto LABEL_32;
Ritor1
parents:
diff changeset
4064 }
Ritor1
parents:
diff changeset
4065 while ( 1 )
Ritor1
parents:
diff changeset
4066 {
Ritor1
parents:
diff changeset
4067 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
4068 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
4069 v61 -= 2;
Ritor1
parents:
diff changeset
4070 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
4071 break;
Ritor1
parents:
diff changeset
4072 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48));
Ritor1
parents:
diff changeset
4073 v31 += v52;
Ritor1
parents:
diff changeset
4074 v37 = v51[v36];
Ritor1
parents:
diff changeset
4075 v32 += v53;
Ritor1
parents:
diff changeset
4076 v34 = v63;
Ritor1
parents:
diff changeset
4077 v35 = v46;
Ritor1
parents:
diff changeset
4078 *v33 = v37;
Ritor1
parents:
diff changeset
4079 v33[1] = v37;
Ritor1
parents:
diff changeset
4080 v33[640] = v37;
Ritor1
parents:
diff changeset
4081 v33[641] = v37;
Ritor1
parents:
diff changeset
4082 v63 += 4;
Ritor1
parents:
diff changeset
4083 v34[2] = v46;
Ritor1
parents:
diff changeset
4084 v34[3] = v46;
Ritor1
parents:
diff changeset
4085 v34[642] = v46;
Ritor1
parents:
diff changeset
4086 v34[643] = v46;
Ritor1
parents:
diff changeset
4087 LABEL_32:
Ritor1
parents:
diff changeset
4088 *v34 = v35;
Ritor1
parents:
diff changeset
4089 v34[1] = v35;
Ritor1
parents:
diff changeset
4090 v34[640] = v35;
Ritor1
parents:
diff changeset
4091 v34[641] = v35;
Ritor1
parents:
diff changeset
4092 v38 = v49 & (v31 >> 16);
Ritor1
parents:
diff changeset
4093 v33 += 4;
Ritor1
parents:
diff changeset
4094 v31 += v52;
Ritor1
parents:
diff changeset
4095 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))];
Ritor1
parents:
diff changeset
4096 v32 += v53;
Ritor1
parents:
diff changeset
4097 *(v33 - 2) = v39;
Ritor1
parents:
diff changeset
4098 *(v33 - 1) = v39;
Ritor1
parents:
diff changeset
4099 v33[638] = v39;
Ritor1
parents:
diff changeset
4100 v33[639] = v39;
Ritor1
parents:
diff changeset
4101 }
Ritor1
parents:
diff changeset
4102 }
Ritor1
parents:
diff changeset
4103 else
Ritor1
parents:
diff changeset
4104 {
Ritor1
parents:
diff changeset
4105 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
4106 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
4107 v20 = v44;
Ritor1
parents:
diff changeset
4108 v21 = v45;
Ritor1
parents:
diff changeset
4109 v22 = (int)v58;
Ritor1
parents:
diff changeset
4110 if ( v61 & 1 )
Ritor1
parents:
diff changeset
4111 {
Ritor1
parents:
diff changeset
4112 --v61;
Ritor1
parents:
diff changeset
4113 v22 = (int)(v58 - 1);
Ritor1
parents:
diff changeset
4114 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
4115 v24 = v46;
Ritor1
parents:
diff changeset
4116 ++v62;
Ritor1
parents:
diff changeset
4117 goto LABEL_26;
Ritor1
parents:
diff changeset
4118 }
Ritor1
parents:
diff changeset
4119 while ( 1 )
Ritor1
parents:
diff changeset
4120 {
Ritor1
parents:
diff changeset
4121 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
4122 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
4123 v61 -= 2;
Ritor1
parents:
diff changeset
4124 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
4125 break;
Ritor1
parents:
diff changeset
4126 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48));
Ritor1
parents:
diff changeset
4127 v20 += v52;
Ritor1
parents:
diff changeset
4128 v26 = v51[v25];
Ritor1
parents:
diff changeset
4129 v21 += v53;
Ritor1
parents:
diff changeset
4130 v23 = v62;
Ritor1
parents:
diff changeset
4131 v24 = v46;
Ritor1
parents:
diff changeset
4132 *(short *)v22 = v26;
Ritor1
parents:
diff changeset
4133 v62 += 2;
Ritor1
parents:
diff changeset
4134 v23[1] = v46;
Ritor1
parents:
diff changeset
4135 LABEL_26:
Ritor1
parents:
diff changeset
4136 *v23 = v24;
Ritor1
parents:
diff changeset
4137 v27 = v49 & (v20 >> 16);
Ritor1
parents:
diff changeset
4138 v22 += 4;
Ritor1
parents:
diff changeset
4139 v20 += v52;
Ritor1
parents:
diff changeset
4140 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))];
Ritor1
parents:
diff changeset
4141 v21 += v53;
Ritor1
parents:
diff changeset
4142 *(short *)(v22 - 2) = v28;
Ritor1
parents:
diff changeset
4143 }
Ritor1
parents:
diff changeset
4144 }
Ritor1
parents:
diff changeset
4145 ++v60;
Ritor1
parents:
diff changeset
4146 ++i;
Ritor1
parents:
diff changeset
4147 v56 += 640;
Ritor1
parents:
diff changeset
4148 v55 += 2;
Ritor1
parents:
diff changeset
4149 if ( v60 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4150 break;
Ritor1
parents:
diff changeset
4151 v13 = v55;
Ritor1
parents:
diff changeset
4152 v12 = v60;
Ritor1
parents:
diff changeset
4153 }
Ritor1
parents:
diff changeset
4154 }
Ritor1
parents:
diff changeset
4155 }
Ritor1
parents:
diff changeset
4156 }
Ritor1
parents:
diff changeset
4157 }
Ritor1
parents:
diff changeset
4158 }
Ritor1
parents:
diff changeset
4159 }
Ritor1
parents:
diff changeset
4160
Ritor1
parents:
diff changeset
4161 //----- (004AE1E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
4162 int __fastcall sub_4AE1E7(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
4163 {
Ritor1
parents:
diff changeset
4164 int v3; // ebx@1
Ritor1
parents:
diff changeset
4165 int v4; // edi@1
Ritor1
parents:
diff changeset
4166 int v5; // esi@1
Ritor1
parents:
diff changeset
4167 signed __int64 v6; // qtt@3
Ritor1
parents:
diff changeset
4168 int v7; // esi@3
Ritor1
parents:
diff changeset
4169 int v8; // eax@5
Ritor1
parents:
diff changeset
4170 int result; // eax@5
Ritor1
parents:
diff changeset
4171 int v10; // edx@5
Ritor1
parents:
diff changeset
4172 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4173 int v12; // [sp+1Ch] [bp+8h]@2
Ritor1
parents:
diff changeset
4174
Ritor1
parents:
diff changeset
4175 v3 = pBLVRenderParams->uViewportCenterY - a3;
Ritor1
parents:
diff changeset
4176 v4 = pBLVRenderParams->uViewportCenterX - a2;
Ritor1
parents:
diff changeset
4177 v11 = a1;
Ritor1
parents:
diff changeset
4178 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y
Ritor1
parents:
diff changeset
4179 + stru_F8AD28.field_7C
Ritor1
parents:
diff changeset
4180 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
4181 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) )
Ritor1
parents:
diff changeset
4182 {
Ritor1
parents:
diff changeset
4183 LODWORD(v6) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
4184 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
4185 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x);
Ritor1
parents:
diff changeset
4186 }
Ritor1
parents:
diff changeset
4187 else
Ritor1
parents:
diff changeset
4188 {
Ritor1
parents:
diff changeset
4189 v7 = 1073741824;
Ritor1
parents:
diff changeset
4190 }
Ritor1
parents:
diff changeset
4191 v8 = stru_F8AD28.vec_9C.z;
Ritor1
parents:
diff changeset
4192 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z
Ritor1
parents:
diff changeset
4193 + stru_F8AD28.vec_8C.x
Ritor1
parents:
diff changeset
4194 + v4 * stru_F8AD28.vec_8C.y)
Ritor1
parents:
diff changeset
4195 * (signed __int64)v7) >> 16)
Ritor1
parents:
diff changeset
4196 + stru_F8AD28.field_98;
Ritor1
parents:
diff changeset
4197 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16;
Ritor1
parents:
diff changeset
4198 v10 = result + stru_F8AD28.field_A8;
Ritor1
parents:
diff changeset
4199 stru_F83B80[v11].field_28 = v7;
Ritor1
parents:
diff changeset
4200 stru_F83B80[v11].field_4 = v10;
Ritor1
parents:
diff changeset
4201 return result;
Ritor1
parents:
diff changeset
4202 }
Ritor1
parents:
diff changeset
4203
Ritor1
parents:
diff changeset
4204 //----- (004AE313) --------------------------------------------------------
Ritor1
parents:
diff changeset
4205 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p)
Ritor1
parents:
diff changeset
4206 {
Ritor1
parents:
diff changeset
4207 int _dy; // ebx@1
Ritor1
parents:
diff changeset
4208 int _dx; // edi@1
Ritor1
parents:
diff changeset
4209 int v5; // ecx@1
Ritor1
parents:
diff changeset
4210 int v6; // esi@1
Ritor1
parents:
diff changeset
4211 int v7; // ST18_4@2
Ritor1
parents:
diff changeset
4212 signed __int64 v8; // qtt@3
Ritor1
parents:
diff changeset
4213 unsigned int v9; // ecx@3
Ritor1
parents:
diff changeset
4214 int result; // eax@8
Ritor1
parents:
diff changeset
4215 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4216
Ritor1
parents:
diff changeset
4217 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y;
Ritor1
parents:
diff changeset
4218 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x;
Ritor1
parents:
diff changeset
4219 ++pBLVRenderParams->field_88;
Ritor1
parents:
diff changeset
4220 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C;
Ritor1
parents:
diff changeset
4221 v6 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
4222 v11 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
4223 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) )
Ritor1
parents:
diff changeset
4224 {
Ritor1
parents:
diff changeset
4225 LODWORD(v8) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
4226 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
4227 v9 = v8 / v11;
Ritor1
parents:
diff changeset
4228 }
Ritor1
parents:
diff changeset
4229 else
Ritor1
parents:
diff changeset
4230 {
Ritor1
parents:
diff changeset
4231 v9 = 0x40000000u;
Ritor1
parents:
diff changeset
4232 }
Ritor1
parents:
diff changeset
4233 if ( (signed int)v9 >= stru_F8AD28.field_34 )
Ritor1
parents:
diff changeset
4234 p->field_0 = v9;
Ritor1
parents:
diff changeset
4235 else
Ritor1
parents:
diff changeset
4236 p->field_0 = stru_F8AD28.field_34;
Ritor1
parents:
diff changeset
4237 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y)
Ritor1
parents:
diff changeset
4238 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
4239 + stru_F8AD28.field_98
Ritor1
parents:
diff changeset
4240 + (stru_F8AD28.pDeltaUV[0] << 16);
Ritor1
parents:
diff changeset
4241 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y)
Ritor1
parents:
diff changeset
4242 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
4243 + stru_F8AD28.field_A8
Ritor1
parents:
diff changeset
4244 + (stru_F8AD28.pDeltaUV[1] << 16);
Ritor1
parents:
diff changeset
4245 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16);
Ritor1
parents:
diff changeset
4246 if ( result < 369620 || bUseLoResSprites )
Ritor1
parents:
diff changeset
4247 {
Ritor1
parents:
diff changeset
4248 if ( result < 184810 )
Ritor1
parents:
diff changeset
4249 p->field_10 = result > 92405;
Ritor1
parents:
diff changeset
4250 else
Ritor1
parents:
diff changeset
4251 p->field_10 = 2;
Ritor1
parents:
diff changeset
4252 }
Ritor1
parents:
diff changeset
4253 else
Ritor1
parents:
diff changeset
4254 {
Ritor1
parents:
diff changeset
4255 p->field_10 = 3;
Ritor1
parents:
diff changeset
4256 }
Ritor1
parents:
diff changeset
4257 return result;
Ritor1
parents:
diff changeset
4258 }
Ritor1
parents:
diff changeset
4259
Ritor1
parents:
diff changeset
4260 //----- (004AE491) --------------------------------------------------------
Ritor1
parents:
diff changeset
4261 int __fastcall sub_4AE491(signed int a1, signed int a2)
Ritor1
parents:
diff changeset
4262 {
Ritor1
parents:
diff changeset
4263 signed int v2; // eax@1
Ritor1
parents:
diff changeset
4264 signed int v3; // edi@1
Ritor1
parents:
diff changeset
4265 int v4; // ecx@1
Ritor1
parents:
diff changeset
4266 int v5; // esi@2
Ritor1
parents:
diff changeset
4267 int v6; // eax@2
Ritor1
parents:
diff changeset
4268 int v7; // ebx@2
Ritor1
parents:
diff changeset
4269 unsigned int v8; // ecx@2
Ritor1
parents:
diff changeset
4270 int v9; // edx@5
Ritor1
parents:
diff changeset
4271 int v10; // edx@7
Ritor1
parents:
diff changeset
4272 unsigned int v11; // eax@8
Ritor1
parents:
diff changeset
4273 int v13; // [sp+4h] [bp-18h]@2
Ritor1
parents:
diff changeset
4274 int v14; // [sp+8h] [bp-14h]@2
Ritor1
parents:
diff changeset
4275 signed int v15; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
4276 int v16; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
4277 int v17; // [sp+18h] [bp-4h]@1
Ritor1
parents:
diff changeset
4278
Ritor1
parents:
diff changeset
4279 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
4280 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
4281 v17 = stru_F8AD28.uCurrentAmbientLightLevel;
Ritor1
parents:
diff changeset
4282 v4 = 0;
Ritor1
parents:
diff changeset
4283 v15 = v2;
Ritor1
parents:
diff changeset
4284 v16 = 0;
Ritor1
parents:
diff changeset
4285 if ( stru_F8AD28.uNumLightsApplied > 0 )
Ritor1
parents:
diff changeset
4286 {
Ritor1
parents:
diff changeset
4287 do
Ritor1
parents:
diff changeset
4288 {
Ritor1
parents:
diff changeset
4289 v5 = v16;
Ritor1
parents:
diff changeset
4290 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]);
Ritor1
parents:
diff changeset
4291 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]);
Ritor1
parents:
diff changeset
4292 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
4293 v7 = v13;
Ritor1
parents:
diff changeset
4294 v8 = v14;
Ritor1
parents:
diff changeset
4295 if ( v6 < v13 )
Ritor1
parents:
diff changeset
4296 {
Ritor1
parents:
diff changeset
4297 v6 = v13;
Ritor1
parents:
diff changeset
4298 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
4299 }
Ritor1
parents:
diff changeset
4300 if ( v6 < v14 )
Ritor1
parents:
diff changeset
4301 {
Ritor1
parents:
diff changeset
4302 v9 = v6;
Ritor1
parents:
diff changeset
4303 v6 = v14;
Ritor1
parents:
diff changeset
4304 v8 = v9;
Ritor1
parents:
diff changeset
4305 }
Ritor1
parents:
diff changeset
4306 if ( v7 < (signed int)v8 )
Ritor1
parents:
diff changeset
4307 {
Ritor1
parents:
diff changeset
4308 v10 = v8;
Ritor1
parents:
diff changeset
4309 v8 = v7;
Ritor1
parents:
diff changeset
4310 v7 = v10;
Ritor1
parents:
diff changeset
4311 }
Ritor1
parents:
diff changeset
4312 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6;
Ritor1
parents:
diff changeset
4313 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] )
Ritor1
parents:
diff changeset
4314 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536);
Ritor1
parents:
diff changeset
4315 ++v16;
Ritor1
parents:
diff changeset
4316 v2 = v15;
Ritor1
parents:
diff changeset
4317 }
Ritor1
parents:
diff changeset
4318 while ( v16 < stru_F8AD28.uNumLightsApplied );
Ritor1
parents:
diff changeset
4319 v4 = 0;
Ritor1
parents:
diff changeset
4320 }
Ritor1
parents:
diff changeset
4321 if ( stru_F8AD28.field_3E4 != v4 )
Ritor1
parents:
diff changeset
4322 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4);
Ritor1
parents:
diff changeset
4323 if ( v17 >= v4 )
Ritor1
parents:
diff changeset
4324 {
Ritor1
parents:
diff changeset
4325 if ( v17 > 2031616 )
Ritor1
parents:
diff changeset
4326 v17 = 2031616;
Ritor1
parents:
diff changeset
4327 }
Ritor1
parents:
diff changeset
4328 else
Ritor1
parents:
diff changeset
4329 {
Ritor1
parents:
diff changeset
4330 v17 = v4;
Ritor1
parents:
diff changeset
4331 }
Ritor1
parents:
diff changeset
4332 ++pBLVRenderParams->field_8C;
Ritor1
parents:
diff changeset
4333 return v17;
Ritor1
parents:
diff changeset
4334 }
Ritor1
parents:
diff changeset
4335 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
4336
Ritor1
parents:
diff changeset
4337 //----- (004AE5F1) --------------------------------------------------------
Ritor1
parents:
diff changeset
4338 void __fastcall sub_4AE5F1(unsigned int uFaceID)
Ritor1
parents:
diff changeset
4339 {
Ritor1
parents:
diff changeset
4340 BLVFace *v1; // esi@1
Ritor1
parents:
diff changeset
4341 BLVFaceExtra *v2; // ebx@1
Ritor1
parents:
diff changeset
4342 int v3; // eax@1
Ritor1
parents:
diff changeset
4343 int v4; // edi@1
Ritor1
parents:
diff changeset
4344 Texture *v5; // edi@1
Ritor1
parents:
diff changeset
4345 int v6; // eax@1
Ritor1
parents:
diff changeset
4346 unsigned int v7; // eax@1
Ritor1
parents:
diff changeset
4347 unsigned int v8; // ecx@1
Ritor1
parents:
diff changeset
4348 unsigned int v9; // eax@1
Ritor1
parents:
diff changeset
4349 unsigned int v10; // ecx@5
Ritor1
parents:
diff changeset
4350 int v11; // edi@10
Ritor1
parents:
diff changeset
4351 int v12; // ecx@10
Ritor1
parents:
diff changeset
4352 int v13; // eax@10
Ritor1
parents:
diff changeset
4353 int v14; // edx@10
Ritor1
parents:
diff changeset
4354 int v15; // ebx@12
Ritor1
parents:
diff changeset
4355 double v16; // st7@16
Ritor1
parents:
diff changeset
4356 int v17; // eax@16
Ritor1
parents:
diff changeset
4357 char *v18; // ebx@17
Ritor1
parents:
diff changeset
4358 int v19; // ecx@19
Ritor1
parents:
diff changeset
4359 int v20; // eax@19
Ritor1
parents:
diff changeset
4360 int v21; // edx@21
Ritor1
parents:
diff changeset
4361 int v22; // eax@23
Ritor1
parents:
diff changeset
4362 int v23; // ST04_4@26
Ritor1
parents:
diff changeset
4363 int v24; // edi@26
Ritor1
parents:
diff changeset
4364 double v25; // st6@26
Ritor1
parents:
diff changeset
4365 int v26; // eax@26
Ritor1
parents:
diff changeset
4366 double v27; // st6@26
Ritor1
parents:
diff changeset
4367 int v28; // ecx@26
Ritor1
parents:
diff changeset
4368 char v29; // al@26
Ritor1
parents:
diff changeset
4369 int v30; // edx@28
Ritor1
parents:
diff changeset
4370 int v31; // ecx@28
Ritor1
parents:
diff changeset
4371 BLVLightMM7 *v32; // ecx@32
Ritor1
parents:
diff changeset
4372 int v33; // edi@33
Ritor1
parents:
diff changeset
4373 int v34; // edx@33
Ritor1
parents:
diff changeset
4374 int v35; // eax@33
Ritor1
parents:
diff changeset
4375 int v36; // edi@35
Ritor1
parents:
diff changeset
4376 int v37; // edx@37
Ritor1
parents:
diff changeset
4377 int v38; // ebx@39
Ritor1
parents:
diff changeset
4378 int v39; // edi@42
Ritor1
parents:
diff changeset
4379 int v40; // eax@42
Ritor1
parents:
diff changeset
4380 char *v41; // ebx@45
Ritor1
parents:
diff changeset
4381 signed int v42; // ecx@47
Ritor1
parents:
diff changeset
4382 int v43; // edi@47
Ritor1
parents:
diff changeset
4383 int v44; // eax@49
Ritor1
parents:
diff changeset
4384 int v45; // edx@51
Ritor1
parents:
diff changeset
4385 int v46; // eax@53
Ritor1
parents:
diff changeset
4386 int v47; // ST04_4@55
Ritor1
parents:
diff changeset
4387 int v48; // edi@55
Ritor1
parents:
diff changeset
4388 double v49; // st6@55
Ritor1
parents:
diff changeset
4389 int v50; // eax@55
Ritor1
parents:
diff changeset
4390 double v51; // st6@55
Ritor1
parents:
diff changeset
4391 int v52; // eax@55
Ritor1
parents:
diff changeset
4392 int v53; // ecx@57
Ritor1
parents:
diff changeset
4393 int v54; // ecx@58
Ritor1
parents:
diff changeset
4394 int v55; // ecx@59
Ritor1
parents:
diff changeset
4395 int v56; // edx@62
Ritor1
parents:
diff changeset
4396 int v57; // ecx@62
Ritor1
parents:
diff changeset
4397 int v58; // eax@63
Ritor1
parents:
diff changeset
4398 int v59; // edx@64
Ritor1
parents:
diff changeset
4399 int v60; // ecx@67
Ritor1
parents:
diff changeset
4400 int v61; // edx@67
Ritor1
parents:
diff changeset
4401 int v62; // eax@68
Ritor1
parents:
diff changeset
4402 int v63; // edx@69
Ritor1
parents:
diff changeset
4403 signed int v64; // ecx@72
Ritor1
parents:
diff changeset
4404 double v65; // st7@75
Ritor1
parents:
diff changeset
4405 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9
Ritor1
parents:
diff changeset
4406 Vec3_int_ v67; // [sp+18h] [bp-28h]@9
Ritor1
parents:
diff changeset
4407 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
4408 int v69; // [sp+28h] [bp-18h]@10
Ritor1
parents:
diff changeset
4409 int v70; // [sp+2Ch] [bp-14h]@10
Ritor1
parents:
diff changeset
4410 int X; // [sp+30h] [bp-10h]@10
Ritor1
parents:
diff changeset
4411 int v72; // [sp+34h] [bp-Ch]@10
Ritor1
parents:
diff changeset
4412 int v73; // [sp+38h] [bp-8h]@10
Ritor1
parents:
diff changeset
4413 int v74; // [sp+3Ch] [bp-4h]@10
Ritor1
parents:
diff changeset
4414
Ritor1
parents:
diff changeset
4415 v1 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
4416 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID];
Ritor1
parents:
diff changeset
4417 v3 = v1->uBitmapID;
Ritor1
parents:
diff changeset
4418 v4 = v1->uBitmapID;
Ritor1
parents:
diff changeset
4419 v68 = v2;
Ritor1
parents:
diff changeset
4420 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0);
Ritor1
parents:
diff changeset
4421 v6 = 8 * uFaceID;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
4422 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID);
0
Ritor1
parents:
diff changeset
4423 stru_F8AD28.field_0 = v6;
Ritor1
parents:
diff changeset
4424 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
Ritor1
parents:
diff changeset
4425 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
4426 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
4427 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
4428 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU;
Ritor1
parents:
diff changeset
4429 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV;
Ritor1
parents:
diff changeset
4430 v7 = GetTickCount();
Ritor1
parents:
diff changeset
4431 v8 = v1->uAttributes;
Ritor1
parents:
diff changeset
4432 v9 = v7 >> 3;
Ritor1
parents:
diff changeset
4433 if ( v8 & 4 )
Ritor1
parents:
diff changeset
4434 {
Ritor1
parents:
diff changeset
4435 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
4436 }
Ritor1
parents:
diff changeset
4437 else
Ritor1
parents:
diff changeset
4438 {
Ritor1
parents:
diff changeset
4439 if ( v8 & 0x20 )
Ritor1
parents:
diff changeset
4440 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
4441 }
Ritor1
parents:
diff changeset
4442 v10 = v1->uAttributes;
Ritor1
parents:
diff changeset
4443 if ( BYTE1(v10) & 8 )
Ritor1
parents:
diff changeset
4444 {
Ritor1
parents:
diff changeset
4445 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
4446 }
Ritor1
parents:
diff changeset
4447 else
Ritor1
parents:
diff changeset
4448 {
Ritor1
parents:
diff changeset
4449 if ( v10 & 0x40 )
Ritor1
parents:
diff changeset
4450 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
4451 }
Ritor1
parents:
diff changeset
4452 v1->_get_normals(&v67, &v66);
Ritor1
parents:
diff changeset
4453 stru_F8AD28.vec_14.x = v67.x;
Ritor1
parents:
diff changeset
4454 stru_F8AD28.vec_14.y = v67.y;
Ritor1
parents:
diff changeset
4455 stru_F8AD28.vec_14.z = v67.z;
Ritor1
parents:
diff changeset
4456 stru_F8AD28.vec_20.x = v66.x;
Ritor1
parents:
diff changeset
4457 stru_F8AD28.vec_20.y = v66.y;
Ritor1
parents:
diff changeset
4458 stru_F8AD28.vec_20.z = v66.z;
Ritor1
parents:
diff changeset
4459 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22;
Ritor1
parents:
diff changeset
4460 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
4461 {
Ritor1
parents:
diff changeset
4462 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4463 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74;
Ritor1
parents:
diff changeset
4464 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
4465 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X;
Ritor1
parents:
diff changeset
4466 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4467 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4468 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
4469 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4470 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4471 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
4472 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4473 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4474 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
4475 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
4476 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
4477 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4478 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4479 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4480 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4481 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4482 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
4483 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4484 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
4485 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
4486 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
4487 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4488 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4489 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4490 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4491 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4492 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4493 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4494 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
4495 v73 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4496 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
4497 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
4498 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
4499 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4500 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4501 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4502 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4503 }
Ritor1
parents:
diff changeset
4504 else
Ritor1
parents:
diff changeset
4505 {
Ritor1
parents:
diff changeset
4506 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4507 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4508 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4509 - v70;
Ritor1
parents:
diff changeset
4510 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
4511 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4512 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4513 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
4514 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4515 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4516 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4517 - v70;
Ritor1
parents:
diff changeset
4518 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
4519 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4520 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4521 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4522 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4523 - v70;
Ritor1
parents:
diff changeset
4524 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
4525 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4526 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
4527 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4528 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4529 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4530 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4531 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4532 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4533 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
4534 v70 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4535 }
Ritor1
parents:
diff changeset
4536 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
4537 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z
Ritor1
parents:
diff changeset
4538 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
4539 + stru_F8AD28.plane_4.vNormal.y * v13
Ritor1
parents:
diff changeset
4540 + stru_F8AD28.plane_4.vNormal.x * v14;
Ritor1
parents:
diff changeset
4541 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
4542 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
4543 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
4544 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
4545 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
4546 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
4547 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
4548 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
4549 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
4550 v15 = v70;
Ritor1
parents:
diff changeset
4551 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16;
Ritor1
parents:
diff changeset
4552 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
4553 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70);
Ritor1
parents:
diff changeset
4554 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
4555 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
4556 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
4557 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16;
Ritor1
parents:
diff changeset
4558 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16;
Ritor1
parents:
diff changeset
4559 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
4560 stru_F8AD28.field_A8 = -(X
Ritor1
parents:
diff changeset
4561 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16)
Ritor1
parents:
diff changeset
4562 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16));
Ritor1
parents:
diff changeset
4563 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 )
Ritor1
parents:
diff changeset
4564 {
Ritor1
parents:
diff changeset
4565 stru_F8AD28.field_3E4 = 1;
Ritor1
parents:
diff changeset
4566 stru_F8AD28.field_3E8 = *(int *)&v68->field_4;
Ritor1
parents:
diff changeset
4567 stru_F8AD28.field_3EC = *(int *)&v68->field_8;
Ritor1
parents:
diff changeset
4568 stru_F8AD28.field_3F0 = v68->field_1E;
Ritor1
parents:
diff changeset
4569 stru_F8AD28.field_3F4 = v68->field_20;
Ritor1
parents:
diff changeset
4570 }
Ritor1
parents:
diff changeset
4571 else
Ritor1
parents:
diff changeset
4572 {
Ritor1
parents:
diff changeset
4573 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
4574 }
Ritor1
parents:
diff changeset
4575 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
4576 v17 = 116 * v1->uSectorID;
Ritor1
parents:
diff changeset
4577 v69 = v17;
Ritor1
parents:
diff changeset
4578 v74 = 0;
Ritor1
parents:
diff changeset
4579 v73 = 0;
Ritor1
parents:
diff changeset
4580 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16;
Ritor1
parents:
diff changeset
4581 v70 = pMobileLightsStack->uNumLightsActive;
Ritor1
parents:
diff changeset
4582 if ( pMobileLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
4583 {
Ritor1
parents:
diff changeset
4584 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
4585 do
Ritor1
parents:
diff changeset
4586 {
Ritor1
parents:
diff changeset
4587 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
4588 break;
Ritor1
parents:
diff changeset
4589 v19 = *((short *)v18 + 2);
Ritor1
parents:
diff changeset
4590 v20 = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
4591 if ( v20 > v1->pBounding.x1 - v19 )
Ritor1
parents:
diff changeset
4592 {
Ritor1
parents:
diff changeset
4593 if ( v20 < v19 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
4594 {
Ritor1
parents:
diff changeset
4595 v21 = *(short *)v18;
Ritor1
parents:
diff changeset
4596 if ( v21 > v1->pBounding.y1 - v19 )
Ritor1
parents:
diff changeset
4597 {
Ritor1
parents:
diff changeset
4598 if ( v21 < v19 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
4599 {
Ritor1
parents:
diff changeset
4600 v22 = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
4601 if ( v22 > v1->pBounding.z1 - v19 )
Ritor1
parents:
diff changeset
4602 {
Ritor1
parents:
diff changeset
4603 if ( v22 < v19 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
4604 {
Ritor1
parents:
diff changeset
4605 X = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
4606 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
4607 + v21 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
4608 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
4609 if ( X <= v19 )
Ritor1
parents:
diff changeset
4610 {
Ritor1
parents:
diff changeset
4611 v23 = X;
Ritor1
parents:
diff changeset
4612 v24 = v74;
Ritor1
parents:
diff changeset
4613 stru_F8AD28._blv_lights_radii[v74] = v19;
Ritor1
parents:
diff changeset
4614 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19;
Ritor1
parents:
diff changeset
4615 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16;
Ritor1
parents:
diff changeset
4616 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
4617 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18;
Ritor1
parents:
diff changeset
4618 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
4619 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6];
Ritor1
parents:
diff changeset
4620 v25 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4621 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7];
Ritor1
parents:
diff changeset
4622 v26 = (unsigned __int8)v18[8];
Ritor1
parents:
diff changeset
4623 *(float *)(v24 * 4 + 16297992) = v25;
Ritor1
parents:
diff changeset
4624 v27 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
4625 v68 = (BLVFaceExtra *)v26;
Ritor1
parents:
diff changeset
4626 *(float *)(v24 * 4 + 16298072) = v27 * v16;
Ritor1
parents:
diff changeset
4627 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4628 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
4629 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23);
Ritor1
parents:
diff changeset
4630 v28 = v74;
Ritor1
parents:
diff changeset
4631 v29 = v18[9];
Ritor1
parents:
diff changeset
4632 ++v74;
Ritor1
parents:
diff changeset
4633 stru_F8AD28._blv_lights_types[v28] = v29;
Ritor1
parents:
diff changeset
4634 }
Ritor1
parents:
diff changeset
4635 }
Ritor1
parents:
diff changeset
4636 }
Ritor1
parents:
diff changeset
4637 }
Ritor1
parents:
diff changeset
4638 }
Ritor1
parents:
diff changeset
4639 }
Ritor1
parents:
diff changeset
4640 }
Ritor1
parents:
diff changeset
4641 ++v73;
Ritor1
parents:
diff changeset
4642 v18 += 18;
Ritor1
parents:
diff changeset
4643 v17 = v69;
Ritor1
parents:
diff changeset
4644 }
Ritor1
parents:
diff changeset
4645 while ( v73 < v70 );
Ritor1
parents:
diff changeset
4646 }
Ritor1
parents:
diff changeset
4647 v30 = 0;
Ritor1
parents:
diff changeset
4648 v73 = 0;
Ritor1
parents:
diff changeset
4649 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
4650 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
4651 if ( v31 > 0 )
Ritor1
parents:
diff changeset
4652 {
Ritor1
parents:
diff changeset
4653 while ( v74 < 20 )
Ritor1
parents:
diff changeset
4654 {
Ritor1
parents:
diff changeset
4655 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)];
Ritor1
parents:
diff changeset
4656 if ( !(v32->uAtributes & 8) )
Ritor1
parents:
diff changeset
4657 {
Ritor1
parents:
diff changeset
4658 v33 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
4659 v34 = v32->vPosition.x;
Ritor1
parents:
diff changeset
4660 X = v32->uBrightness;
Ritor1
parents:
diff changeset
4661 v35 = v32->uRadius;
Ritor1
parents:
diff changeset
4662 v68 = (BLVFaceExtra *)v32->uRadius;
Ritor1
parents:
diff changeset
4663 if ( v34 > v33 - v35 )
Ritor1
parents:
diff changeset
4664 {
Ritor1
parents:
diff changeset
4665 if ( v34 < v35 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
4666 {
Ritor1
parents:
diff changeset
4667 v36 = v32->vPosition.y;
Ritor1
parents:
diff changeset
4668 if ( v36 > v1->pBounding.y1 - v35 )
Ritor1
parents:
diff changeset
4669 {
Ritor1
parents:
diff changeset
4670 if ( v36 < v35 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
4671 {
Ritor1
parents:
diff changeset
4672 v37 = v32->vPosition.z;
Ritor1
parents:
diff changeset
4673 if ( v37 > v1->pBounding.z1 - v35 )
Ritor1
parents:
diff changeset
4674 {
Ritor1
parents:
diff changeset
4675 if ( v37 < v35 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
4676 {
Ritor1
parents:
diff changeset
4677 v38 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
4678 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
4679 + v37 * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
4680 + v36 * v1->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
4681 if ( v38 >= 0 )
Ritor1
parents:
diff changeset
4682 {
Ritor1
parents:
diff changeset
4683 if ( v38 <= v35 && v35 )
Ritor1
parents:
diff changeset
4684 {
Ritor1
parents:
diff changeset
4685 v39 = v74;
Ritor1
parents:
diff changeset
4686 stru_F8AD28._blv_lights_radii[v74] = v35;
Ritor1
parents:
diff changeset
4687 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68;
Ritor1
parents:
diff changeset
4688 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16;
Ritor1
parents:
diff changeset
4689 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x;
Ritor1
parents:
diff changeset
4690 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y;
Ritor1
parents:
diff changeset
4691 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z;
Ritor1
parents:
diff changeset
4692 v68 = (BLVFaceExtra *)v32->uRed;
Ritor1
parents:
diff changeset
4693 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4694 v68 = (BLVFaceExtra *)v32->uGreen;
Ritor1
parents:
diff changeset
4695 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4696 v68 = (BLVFaceExtra *)v32->uBlue;
Ritor1
parents:
diff changeset
4697 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4698 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
4699 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38);
Ritor1
parents:
diff changeset
4700 v40 = v74++;
Ritor1
parents:
diff changeset
4701 stru_F8AD28._blv_lights_types[v40] = 1;
Ritor1
parents:
diff changeset
4702 }
Ritor1
parents:
diff changeset
4703 }
Ritor1
parents:
diff changeset
4704 }
Ritor1
parents:
diff changeset
4705 }
Ritor1
parents:
diff changeset
4706 }
Ritor1
parents:
diff changeset
4707 }
Ritor1
parents:
diff changeset
4708 }
Ritor1
parents:
diff changeset
4709 }
Ritor1
parents:
diff changeset
4710 }
Ritor1
parents:
diff changeset
4711 v30 = v73++ + 1;
Ritor1
parents:
diff changeset
4712 if ( v73 >= v70 )
Ritor1
parents:
diff changeset
4713 break;
Ritor1
parents:
diff changeset
4714 v17 = v69;
Ritor1
parents:
diff changeset
4715 }
Ritor1
parents:
diff changeset
4716 }
Ritor1
parents:
diff changeset
4717 v73 = 0;
Ritor1
parents:
diff changeset
4718 if ( pStationaryLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
4719 {
Ritor1
parents:
diff changeset
4720 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
4721 do
Ritor1
parents:
diff changeset
4722 {
Ritor1
parents:
diff changeset
4723 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
4724 break;
Ritor1
parents:
diff changeset
4725 v42 = *((short *)v41 + 2);
Ritor1
parents:
diff changeset
4726 v43 = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
4727 if ( v43 > v1->pBounding.x1 - v42 )
Ritor1
parents:
diff changeset
4728 {
Ritor1
parents:
diff changeset
4729 if ( v43 < v42 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
4730 {
Ritor1
parents:
diff changeset
4731 v44 = *(short *)v41;
Ritor1
parents:
diff changeset
4732 if ( v44 > v1->pBounding.y1 - v42 )
Ritor1
parents:
diff changeset
4733 {
Ritor1
parents:
diff changeset
4734 if ( v44 < v42 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
4735 {
Ritor1
parents:
diff changeset
4736 v45 = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
4737 if ( v45 > v1->pBounding.z1 - v42 )
Ritor1
parents:
diff changeset
4738 {
Ritor1
parents:
diff changeset
4739 if ( v45 < v42 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
4740 {
Ritor1
parents:
diff changeset
4741 v46 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
4742 + *(short *)v41 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
4743 + v43 * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
4744 + v45 * v1->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
4745 v69 = v46;
Ritor1
parents:
diff changeset
4746 if ( v46 >= 0 )
Ritor1
parents:
diff changeset
4747 {
Ritor1
parents:
diff changeset
4748 if ( v46 <= v42 )
Ritor1
parents:
diff changeset
4749 {
Ritor1
parents:
diff changeset
4750 v47 = v69;
Ritor1
parents:
diff changeset
4751 v48 = v74;
Ritor1
parents:
diff changeset
4752 stru_F8AD28._blv_lights_radii[v74] = v42;
Ritor1
parents:
diff changeset
4753 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42;
Ritor1
parents:
diff changeset
4754 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
4755 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41;
Ritor1
parents:
diff changeset
4756 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
4757 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6];
Ritor1
parents:
diff changeset
4758 v49 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4759 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7];
Ritor1
parents:
diff changeset
4760 v50 = (unsigned __int8)v41[8];
Ritor1
parents:
diff changeset
4761 stru_F8AD28._blv_lights_rs[v48] = v49;
Ritor1
parents:
diff changeset
4762 v51 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
4763 v68 = (BLVFaceExtra *)v50;
Ritor1
parents:
diff changeset
4764 stru_F8AD28._blv_lights_gs[v48] = v51 * v16;
Ritor1
parents:
diff changeset
4765 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
4766 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
4767 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47);
Ritor1
parents:
diff changeset
4768 v52 = v74++;
Ritor1
parents:
diff changeset
4769 stru_F8AD28._blv_lights_types[v52] = 1;
Ritor1
parents:
diff changeset
4770 }
Ritor1
parents:
diff changeset
4771 }
Ritor1
parents:
diff changeset
4772 }
Ritor1
parents:
diff changeset
4773 }
Ritor1
parents:
diff changeset
4774 }
Ritor1
parents:
diff changeset
4775 }
Ritor1
parents:
diff changeset
4776 }
Ritor1
parents:
diff changeset
4777 }
Ritor1
parents:
diff changeset
4778 ++v73;
Ritor1
parents:
diff changeset
4779 v41 += 12;
Ritor1
parents:
diff changeset
4780 }
Ritor1
parents:
diff changeset
4781 while ( v73 < pStationaryLightsStack->uNumLightsActive );
Ritor1
parents:
diff changeset
4782 }
Ritor1
parents:
diff changeset
4783 stru_F8AD28.uNumLightsApplied = v74;
Ritor1
parents:
diff changeset
4784 v53 = v1->pBounding.x2;
Ritor1
parents:
diff changeset
4785 if ( pBLVRenderParams->vPartyPos.x <= v53 )
Ritor1
parents:
diff changeset
4786 {
Ritor1
parents:
diff changeset
4787 v55 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
4788 if ( pBLVRenderParams->vPartyPos.x >= v55 )
Ritor1
parents:
diff changeset
4789 v54 = 0;
Ritor1
parents:
diff changeset
4790 else
Ritor1
parents:
diff changeset
4791 v54 = v55 - pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4792 }
Ritor1
parents:
diff changeset
4793 else
Ritor1
parents:
diff changeset
4794 {
Ritor1
parents:
diff changeset
4795 v54 = pBLVRenderParams->vPartyPos.x - v53;
Ritor1
parents:
diff changeset
4796 }
Ritor1
parents:
diff changeset
4797 v56 = v1->pBounding.y2;
Ritor1
parents:
diff changeset
4798 v57 = v54 * v54;
Ritor1
parents:
diff changeset
4799 if ( pBLVRenderParams->vPartyPos.y <= v56 )
Ritor1
parents:
diff changeset
4800 {
Ritor1
parents:
diff changeset
4801 v59 = v1->pBounding.y1;
Ritor1
parents:
diff changeset
4802 if ( pBLVRenderParams->vPartyPos.y >= v59 )
Ritor1
parents:
diff changeset
4803 v58 = 0;
Ritor1
parents:
diff changeset
4804 else
Ritor1
parents:
diff changeset
4805 v58 = v59 - pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4806 }
Ritor1
parents:
diff changeset
4807 else
Ritor1
parents:
diff changeset
4808 {
Ritor1
parents:
diff changeset
4809 v58 = pBLVRenderParams->vPartyPos.y - v56;
Ritor1
parents:
diff changeset
4810 }
Ritor1
parents:
diff changeset
4811 v60 = v58 * v58 + v57;
Ritor1
parents:
diff changeset
4812 v61 = v1->pBounding.z2;
Ritor1
parents:
diff changeset
4813 if ( pBLVRenderParams->vPartyPos.z <= v61 )
Ritor1
parents:
diff changeset
4814 {
Ritor1
parents:
diff changeset
4815 v63 = v1->pBounding.z1;
Ritor1
parents:
diff changeset
4816 if ( pBLVRenderParams->vPartyPos.z >= v63 )
Ritor1
parents:
diff changeset
4817 v62 = 0;
Ritor1
parents:
diff changeset
4818 else
Ritor1
parents:
diff changeset
4819 v62 = v63 - pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4820 }
Ritor1
parents:
diff changeset
4821 else
Ritor1
parents:
diff changeset
4822 {
Ritor1
parents:
diff changeset
4823 v62 = pBLVRenderParams->vPartyPos.z - v61;
Ritor1
parents:
diff changeset
4824 }
Ritor1
parents:
diff changeset
4825 v64 = v62 * v62 + v60;
Ritor1
parents:
diff changeset
4826 if ( v64 )
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
4827 stru_F8AD28.field_34 = integer_sqrt(v64) << 16;
0
Ritor1
parents:
diff changeset
4828 else
Ritor1
parents:
diff changeset
4829 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
4830 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y);
Ritor1
parents:
diff changeset
4831 v65 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
4832 if ( v65 >= 655.36 )
Ritor1
parents:
diff changeset
4833 {
Ritor1
parents:
diff changeset
4834 if ( v65 >= 26214.4 )
Ritor1
parents:
diff changeset
4835 {
Ritor1
parents:
diff changeset
4836 if ( v65 >= 45875.2 )
Ritor1
parents:
diff changeset
4837 {
Ritor1
parents:
diff changeset
4838 stru_F8AD28.field_44 = 8;
Ritor1
parents:
diff changeset
4839 stru_F8AD28.field_48 = 3;
Ritor1
parents:
diff changeset
4840 }
Ritor1
parents:
diff changeset
4841 else
Ritor1
parents:
diff changeset
4842 {
Ritor1
parents:
diff changeset
4843 stru_F8AD28.field_44 = 16;
Ritor1
parents:
diff changeset
4844 stru_F8AD28.field_48 = 4;
Ritor1
parents:
diff changeset
4845 }
Ritor1
parents:
diff changeset
4846 }
Ritor1
parents:
diff changeset
4847 else
Ritor1
parents:
diff changeset
4848 {
Ritor1
parents:
diff changeset
4849 stru_F8AD28.field_44 = 32;
Ritor1
parents:
diff changeset
4850 stru_F8AD28.field_48 = 5;
Ritor1
parents:
diff changeset
4851 }
Ritor1
parents:
diff changeset
4852 }
Ritor1
parents:
diff changeset
4853 else
Ritor1
parents:
diff changeset
4854 {
Ritor1
parents:
diff changeset
4855 stru_F8AD28.field_44 = 64;
Ritor1
parents:
diff changeset
4856 stru_F8AD28.field_48 = 6;
Ritor1
parents:
diff changeset
4857 }
Ritor1
parents:
diff changeset
4858 }
Ritor1
parents:
diff changeset
4859 // 519AB4: using guessed type int uNumStationaryLightsApplied;
Ritor1
parents:
diff changeset
4860
Ritor1
parents:
diff changeset
4861 //----- (004AF412) --------------------------------------------------------
Ritor1
parents:
diff changeset
4862 int __cdecl sub_4AF412()
Ritor1
parents:
diff changeset
4863 {
Ritor1
parents:
diff changeset
4864 int v0; // ST20_4@2
Ritor1
parents:
diff changeset
4865 int v1; // ST20_4@2
Ritor1
parents:
diff changeset
4866 int v2; // ST20_4@2
Ritor1
parents:
diff changeset
4867 int v3; // esi@2
Ritor1
parents:
diff changeset
4868 int v4; // ST20_4@2
Ritor1
parents:
diff changeset
4869 int v5; // ecx@2
Ritor1
parents:
diff changeset
4870 int v6; // ebx@2
Ritor1
parents:
diff changeset
4871 int v7; // edi@2
Ritor1
parents:
diff changeset
4872 int v8; // edx@2
Ritor1
parents:
diff changeset
4873 int v9; // eax@2
Ritor1
parents:
diff changeset
4874 int result; // eax@4
Ritor1
parents:
diff changeset
4875
Ritor1
parents:
diff changeset
4876 stru_F8AD28.plane_4.vNormal.z = -65536;
Ritor1
parents:
diff changeset
4877 stru_F8AD28.vec_20.y = -65536;
Ritor1
parents:
diff changeset
4878 stru_F8AD28.plane_4.vNormal.x = 0;
Ritor1
parents:
diff changeset
4879 stru_F8AD28.plane_4.vNormal.y = 0;
Ritor1
parents:
diff changeset
4880 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16;
Ritor1
parents:
diff changeset
4881 stru_F8AD28.vec_14.x = 65536;
Ritor1
parents:
diff changeset
4882 stru_F8AD28.vec_14.y = 0;
Ritor1
parents:
diff changeset
4883 stru_F8AD28.vec_14.z = 0;
Ritor1
parents:
diff changeset
4884 stru_F8AD28.vec_20.x = 0;
Ritor1
parents:
diff changeset
4885 stru_F8AD28.vec_20.z = 0;
Ritor1
parents:
diff changeset
4886 stru_F8AD28.uDefaultAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
4887 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
4888 {
Ritor1
parents:
diff changeset
4889 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4890 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4891 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
4892 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
4893 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
4894 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4895 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4896 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
4897 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4898 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4899 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
4900 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4901 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4902 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4903 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
4904 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
4905 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4906 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4907 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4908 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4909 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4910 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4911 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
4912 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
4913 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4914 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4915 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
4916 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
4917 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4918 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
4919 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4920 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4921 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
4922 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
4923 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4924 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
4925 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
4926 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4927 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4928 }
Ritor1
parents:
diff changeset
4929 else
Ritor1
parents:
diff changeset
4930 {
Ritor1
parents:
diff changeset
4931 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4932 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4933 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
4934 * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4935 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
4936 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
4937 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4938 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
4939 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4940 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4941 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4942 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
4943 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4944 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4945 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
4946 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
4947 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
4948 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
4949 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
4950 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
4951 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4952 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4953 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
4954 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4955 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
4956 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
4957 v7 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
4958 }
Ritor1
parents:
diff changeset
4959 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
4960 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8
Ritor1
parents:
diff changeset
4961 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
4962 + stru_F8AD28.plane_4.vNormal.x * v9
Ritor1
parents:
diff changeset
4963 + stru_F8AD28.plane_4.vNormal.z * v6;
Ritor1
parents:
diff changeset
4964 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
4965 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
4966 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
4967 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
4968 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
4969 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
4970 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
4971 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
4972 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
4973 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
4974 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
4975 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
4976 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
4977 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
4978 result = 0;
Ritor1
parents:
diff changeset
4979 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
4980 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
4981 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
4982 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
4983 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
4984 stru_F8AD28.uCurrentAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
4985 stru_F8AD28.uNumLightsApplied = 0;
Ritor1
parents:
diff changeset
4986 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
4987 return result;
Ritor1
parents:
diff changeset
4988 }
Ritor1
parents:
diff changeset
4989
Ritor1
parents:
diff changeset
4990 //----- (004B1447) --------------------------------------------------------
Ritor1
parents:
diff changeset
4991 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
4992 {
Ritor1
parents:
diff changeset
4993 signed int v3; // esi@1
Ritor1
parents:
diff changeset
4994 char v4; // sf@8
Ritor1
parents:
diff changeset
4995 int v5; // eax@8
Ritor1
parents:
diff changeset
4996 unsigned __int64 v6; // qax@12
Ritor1
parents:
diff changeset
4997 DDM_DLV_Header *v7; // eax@14
Ritor1
parents:
diff changeset
4998 Player **v8; // edi@18
Ritor1
parents:
diff changeset
4999 Player *result; // eax@19
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
5000 //char *v10; // esi@20
0
Ritor1
parents:
diff changeset
5001
Ritor1
parents:
diff changeset
5002 v3 = 0;
Ritor1
parents:
diff changeset
5003 if ( a2 )
Ritor1
parents:
diff changeset
5004 {
Ritor1
parents:
diff changeset
5005 if ( a2 != 1 )
Ritor1
parents:
diff changeset
5006 {
Ritor1
parents:
diff changeset
5007 if ( a2 == 2 )
Ritor1
parents:
diff changeset
5008 v3 = 2;
Ritor1
parents:
diff changeset
5009 goto LABEL_13;
Ritor1
parents:
diff changeset
5010 }
Ritor1
parents:
diff changeset
5011 v3 = 2;
Ritor1
parents:
diff changeset
5012 }
Ritor1
parents:
diff changeset
5013 else
Ritor1
parents:
diff changeset
5014 {
Ritor1
parents:
diff changeset
5015 v3 = 1;
Ritor1
parents:
diff changeset
5016 }
Ritor1
parents:
diff changeset
5017 if ( pParty->uFine < 4000000 )
Ritor1
parents:
diff changeset
5018 {
Ritor1
parents:
diff changeset
5019 v4 = a3 + pParty->uFine < 0;
Ritor1
parents:
diff changeset
5020 v5 = a3 + pParty->uFine;
Ritor1
parents:
diff changeset
5021 pParty->uFine += a3;
Ritor1
parents:
diff changeset
5022 if ( v4 )
Ritor1
parents:
diff changeset
5023 {
Ritor1
parents:
diff changeset
5024 v5 = 0;
Ritor1
parents:
diff changeset
5025 pParty->uFine = 0;
Ritor1
parents:
diff changeset
5026 }
Ritor1
parents:
diff changeset
5027 if ( v5 > 4000000 )
Ritor1
parents:
diff changeset
5028 pParty->uFine = 4000000;
Ritor1
parents:
diff changeset
5029 }
487
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
5030
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
5031 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640;
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
5032
0
Ritor1
parents:
diff changeset
5033 LABEL_13:
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
5034 pParty->InTheShopFlags[a1] = 1;
0
Ritor1
parents:
diff changeset
5035 if ( v3 )
Ritor1
parents:
diff changeset
5036 {
Ritor1
parents:
diff changeset
5037 v7 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5038 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5039 v7 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5040 v7->uReputation += v3;
Ritor1
parents:
diff changeset
5041 if ( v7->uReputation > 10000 )
Ritor1
parents:
diff changeset
5042 v7->uReputation = 10000;
Ritor1
parents:
diff changeset
5043 }
Ritor1
parents:
diff changeset
5044 v8 = &pPlayers[1];
Ritor1
parents:
diff changeset
5045 do
Ritor1
parents:
diff changeset
5046 {
Ritor1
parents:
diff changeset
5047 result = *v8;
Ritor1
parents:
diff changeset
5048 if ( pParty->uFine )
Ritor1
parents:
diff changeset
5049 {
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
5050 //v10 = result->_guilds_member_bits;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5051 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
0
Ritor1
parents:
diff changeset
5052 if ( !(short)result )
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
5053 __debugbreak();
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 493
diff changeset
5054 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
0
Ritor1
parents:
diff changeset
5055 }
Ritor1
parents:
diff changeset
5056 ++v8;
Ritor1
parents:
diff changeset
5057 }
Ritor1
parents:
diff changeset
5058 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
5059 return result;
Ritor1
parents:
diff changeset
5060 }
Ritor1
parents:
diff changeset
5061
Ritor1
parents:
diff changeset
5062 //----- (004B1523) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
5063 void __thiscall sub_4B1523(int *_this)
0
Ritor1
parents:
diff changeset
5064 {
Ritor1
parents:
diff changeset
5065 int v1; // esi@1
Ritor1
parents:
diff changeset
5066 int v2; // edx@1
Ritor1
parents:
diff changeset
5067 unsigned int v3; // eax@2
Ritor1
parents:
diff changeset
5068 int v4; // eax@4
Ritor1
parents:
diff changeset
5069 LONG v5; // ecx@4
Ritor1
parents:
diff changeset
5070 int v6; // eax@10
Ritor1
parents:
diff changeset
5071 char *v7; // ST44_4@12
Ritor1
parents:
diff changeset
5072 unsigned __int16 v8; // ax@12
Ritor1
parents:
diff changeset
5073 GUIWindow a1; // [sp+Ch] [bp-68h]@4
Ritor1
parents:
diff changeset
5074 unsigned int v11; // [sp+60h] [bp-14h]@1
Ritor1
parents:
diff changeset
5075 POINT a2; // [sp+64h] [bp-10h]@1
Ritor1
parents:
diff changeset
5076 int v13; // [sp+6Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
5077 int v14; // [sp+70h] [bp-4h]@4
Ritor1
parents:
diff changeset
5078
Ritor1
parents:
diff changeset
5079 v1 = *_this - 399;
Ritor1
parents:
diff changeset
5080 v2 = (*_this - 400) % 11 + 1;
Ritor1
parents:
diff changeset
5081 v11 = 4 * (*_this - 400) / 11;
1312
ae435824ac4d books code splitted to separate files
Gloval
parents: 1299
diff changeset
5082 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used
0
Ritor1
parents:
diff changeset
5083 if ( pMouse->GetCursorPos(&a2)->y <= 320 )
Ritor1
parents:
diff changeset
5084 v3 = pMouse->GetCursorPos(&a2)->y + 30;
Ritor1
parents:
diff changeset
5085 else
Ritor1
parents:
diff changeset
5086 v3 = 30;
Ritor1
parents:
diff changeset
5087 a1.Hint = 0;
Ritor1
parents:
diff changeset
5088 a1.uFrameY = v3;
Ritor1
parents:
diff changeset
5089 a1.uFrameWidth = 328;
Ritor1
parents:
diff changeset
5090 a1.uFrameHeight = 68;
Ritor1
parents:
diff changeset
5091 a1.uFrameX = 90;
Ritor1
parents:
diff changeset
5092 a1.uFrameZ = 417;
Ritor1
parents:
diff changeset
5093 a1.uFrameW = v3 + 67;
Ritor1
parents:
diff changeset
5094 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
Ritor1
parents:
diff changeset
5095 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
Ritor1
parents:
diff changeset
5096 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
Ritor1
parents:
diff changeset
5097 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
Ritor1
parents:
diff changeset
5098 v5 = a2.y;
Ritor1
parents:
diff changeset
5099 if ( v14 > a2.y )
Ritor1
parents:
diff changeset
5100 v5 = v14;
Ritor1
parents:
diff changeset
5101 if ( v13 > v5 )
Ritor1
parents:
diff changeset
5102 v5 = v13;
Ritor1
parents:
diff changeset
5103 if ( v4 > v5 )
Ritor1
parents:
diff changeset
5104 v5 = v4;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5105 sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
262
Ritor1
parents: 250
diff changeset
5106 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal"
Ritor1
parents: 250
diff changeset
5107 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert"
Ritor1
parents: 250
diff changeset
5108 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master"
Ritor1
parents: 250
diff changeset
5109 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand"
Ritor1
parents: 250
diff changeset
5110 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5111 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
0
Ritor1
parents:
diff changeset
5112 a1.uFrameHeight += v6;
Ritor1
parents:
diff changeset
5113 if ( (signed int)a1.uFrameHeight < 150 )
Ritor1
parents:
diff changeset
5114 a1.uFrameHeight = 150;
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
5115 a1.uFrameWidth = game_viewport_width;
0
Ritor1
parents:
diff changeset
5116 a1.DrawMessageBox(0);
Ritor1
parents:
diff changeset
5117 a1.uFrameWidth -= 12;
Ritor1
parents:
diff changeset
5118 a1.uFrameHeight -= 12;
Ritor1
parents:
diff changeset
5119 v7 = pSpellStats->pInfos[v1].pName;
Ritor1
parents:
diff changeset
5120 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
Ritor1
parents:
diff changeset
5121 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
949
Nomad
parents: 948
diff changeset
5122 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
0
Ritor1
parents:
diff changeset
5123 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5124 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
0
Ritor1
parents:
diff changeset
5125 a1.uFrameZ = a1.uFrameX + 107;
Ritor1
parents:
diff changeset
5126 a1.uFrameWidth = 108;
Ritor1
parents:
diff changeset
5127 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5128 sprintf(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5129 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
0
Ritor1
parents:
diff changeset
5130 }
Ritor1
parents:
diff changeset
5131
Ritor1
parents:
diff changeset
5132 //----- (004B1784) --------------------------------------------------------
Ritor1
parents:
diff changeset
5133 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
Ritor1
parents:
diff changeset
5134 {
Ritor1
parents:
diff changeset
5135 Player *pPlayer; // ebx@1
Ritor1
parents:
diff changeset
5136 bool result; // eax@2
Ritor1
parents:
diff changeset
5137 unsigned __int16 v2; // ST0C_2@3
Ritor1
parents:
diff changeset
5138 int v3; // eax@3
Ritor1
parents:
diff changeset
5139 GUIWindow v4; // [sp+4h] [bp-54h]@3
Ritor1
parents:
diff changeset
5140
Ritor1
parents:
diff changeset
5141 pPlayer = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
5142 if ( pPlayer->CanAct() )
Ritor1
parents:
diff changeset
5143 {
Ritor1
parents:
diff changeset
5144 pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
Ritor1
parents:
diff changeset
5145 result = 1;
Ritor1
parents:
diff changeset
5146 }
Ritor1
parents:
diff changeset
5147 else
Ritor1
parents:
diff changeset
5148 {
Ritor1
parents:
diff changeset
5149 pDialogueWindow->pNumPresenceButton = 0;
Ritor1
parents:
diff changeset
5150 memcpy(&v4, pPrimaryWindow, sizeof(v4));
Ritor1
parents:
diff changeset
5151 v4.uFrameX = 483;
Ritor1
parents:
diff changeset
5152 v4.uFrameWidth = 148;
Ritor1
parents:
diff changeset
5153 v4.uFrameZ = 334;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5154 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);//
0
Ritor1
parents:
diff changeset
5155 // "%s is in no condition to %s"
Ritor1
parents:
diff changeset
5156 // "do anything"
949
Nomad
parents: 948
diff changeset
5157 v2 = TargetColor(255, 255, 0x9Bu);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5158 v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5159 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf.data(), 3u);
0
Ritor1
parents:
diff changeset
5160 result = 0;
Ritor1
parents:
diff changeset
5161 }
Ritor1
parents:
diff changeset
5162 return result;
Ritor1
parents:
diff changeset
5163 }
Ritor1
parents:
diff changeset
5164 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
5165
Ritor1
parents:
diff changeset
5166 // F8B198: using guessed type int dword_F8B198;
Ritor1
parents:
diff changeset
5167 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
5168
1295
86a83e12d795 moving files
Ritor1
parents: 1284
diff changeset
5169
0
Ritor1
parents:
diff changeset
5170 // 507B94: using guessed type int dword_507B94;
Ritor1
parents:
diff changeset
5171
Ritor1
parents:
diff changeset
5172 //----- (004B1ECE) --------------------------------------------------------
Ritor1
parents:
diff changeset
5173 void __cdecl sub_4B1ECE()
Ritor1
parents:
diff changeset
5174 {
Ritor1
parents:
diff changeset
5175 __int16 *v0; // edi@1
Ritor1
parents:
diff changeset
5176 int v1; // ebx@3
Ritor1
parents:
diff changeset
5177 Player *v2; // esi@3
Ritor1
parents:
diff changeset
5178 int v3; // eax@4
Ritor1
parents:
diff changeset
5179 signed int v4; // eax@9
Ritor1
parents:
diff changeset
5180 int v5; // ebx@11
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5181 Player *v6; // esi@13
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5182 ItemGen *v7; // eax@14
0
Ritor1
parents:
diff changeset
5183 signed int v8; // edi@14
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5184 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
0
Ritor1
parents:
diff changeset
5185 signed int v10; // [sp+10h] [bp-8h]@13
Ritor1
parents:
diff changeset
5186 int v11; // [sp+14h] [bp-4h]@1
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5187 Player *v12; // [sp+14h] [bp-4h]@11
0
Ritor1
parents:
diff changeset
5188
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5189 contract_approved = 0;
0
Ritor1
parents:
diff changeset
5190 v11 = 0;
Ritor1
parents:
diff changeset
5191 uDialogueType = 84;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
5192 current_npc_text = (char *)pNPCTopics[667].pText;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5193 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
0
Ritor1
parents:
diff changeset
5194 while ( 1 )
Ritor1
parents:
diff changeset
5195 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5196 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
0
Ritor1
parents:
diff changeset
5197 {
Ritor1
parents:
diff changeset
5198 v1 = 0;
Ritor1
parents:
diff changeset
5199 v2 = pParty->pPlayers;
Ritor1
parents:
diff changeset
5200 do
Ritor1
parents:
diff changeset
5201 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5202 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1));
0
Ritor1
parents:
diff changeset
5203 if ( v3 )
Ritor1
parents:
diff changeset
5204 break;
Ritor1
parents:
diff changeset
5205 ++v2;
Ritor1
parents:
diff changeset
5206 ++v1;
Ritor1
parents:
diff changeset
5207 }
Ritor1
parents:
diff changeset
5208 while ( (signed int)v2 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
5209 if ( v1 == 4 )
Ritor1
parents:
diff changeset
5210 break;
Ritor1
parents:
diff changeset
5211 }
Ritor1
parents:
diff changeset
5212 ++v11;
Ritor1
parents:
diff changeset
5213 v0 += 2;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5214 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5215 break;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5216 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5217 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5218 {
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
5219 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5220 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5221 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5222 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5223 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5224 if ( contract_approved == 601 )
0
Ritor1
parents:
diff changeset
5225 {
Ritor1
parents:
diff changeset
5226 v5 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5227 v12 = pParty->pPlayers;//[0].uClass;
0
Ritor1
parents:
diff changeset
5228 v9 = 0;
Ritor1
parents:
diff changeset
5229 while ( 1 )
Ritor1
parents:
diff changeset
5230 {
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
5231 if ( v12->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
5232 {
Ritor1
parents:
diff changeset
5233 v10 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5234 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A;
0
Ritor1
parents:
diff changeset
5235 do
Ritor1
parents:
diff changeset
5236 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
5237 v7 = v6->pInventoryItemList;
0
Ritor1
parents:
diff changeset
5238 v8 = 138;
Ritor1
parents:
diff changeset
5239 do
Ritor1
parents:
diff changeset
5240 {
1358
61010a655c94 a few itemID changed to their enum values + added a few new ones
Grumpy7
parents: 1355
diff changeset
5241 if ( v7->uItemID == ITEM_LICH_JAR_FULL )
0
Ritor1
parents:
diff changeset
5242 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
5243 if ( !v7->uHolderPlayer )
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5244 v9 = v7;
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
5245 if ( v7->uHolderPlayer == v5 )
0
Ritor1
parents:
diff changeset
5246 v10 = 1;
Ritor1
parents:
diff changeset
5247 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5248 ++v7;
0
Ritor1
parents:
diff changeset
5249 --v8;
Ritor1
parents:
diff changeset
5250 }
Ritor1
parents:
diff changeset
5251 while ( v8 );
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5252 ++v6;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5253 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5254 while ( v6 <= &pParty->pPlayers[3] );
0
Ritor1
parents:
diff changeset
5255 if ( !v10 )
Ritor1
parents:
diff changeset
5256 break;
Ritor1
parents:
diff changeset
5257 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5258 ++v12;
0
Ritor1
parents:
diff changeset
5259 ++v5;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
5260 if ( v12 > &pParty->pPlayers[3] )
0
Ritor1
parents:
diff changeset
5261 return;
Ritor1
parents:
diff changeset
5262 }
Ritor1
parents:
diff changeset
5263 if ( v9 )
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
5264 v9->uHolderPlayer = v5;
0
Ritor1
parents:
diff changeset
5265 }
Ritor1
parents:
diff changeset
5266 }
Ritor1
parents:
diff changeset
5267 // 4F08EC: using guessed type int dword_4F08EC[];
Ritor1
parents:
diff changeset
5268 // 722B3C: using guessed type int dword_722B3C;
Ritor1
parents:
diff changeset
5269 // 722B44: using guessed type int dword_722B44;
Ritor1
parents:
diff changeset
5270 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
5271
Ritor1
parents:
diff changeset
5272 //----- (004B254D) --------------------------------------------------------
Ritor1
parents:
diff changeset
5273 char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
Ritor1
parents:
diff changeset
5274 {
955
Ritor1
parents: 917
diff changeset
5275 //Player *v1; // esi@1
0
Ritor1
parents:
diff changeset
5276 int v2; // edx@1
Ritor1
parents:
diff changeset
5277 int v3; // ecx@1
Ritor1
parents:
diff changeset
5278 int v4; // edi@1
955
Ritor1
parents: 917
diff changeset
5279 int pClassType; // eax@7
0
Ritor1
parents:
diff changeset
5280 int v6; // eax@7
Ritor1
parents:
diff changeset
5281 int v7; // ebx@7
955
Ritor1
parents: 917
diff changeset
5282 //int v8; // ebx@8
0
Ritor1
parents:
diff changeset
5283 signed int v9; // esi@8
Ritor1
parents:
diff changeset
5284 int v10; // eax@8
Ritor1
parents:
diff changeset
5285 char *v11; // ecx@8
Ritor1
parents:
diff changeset
5286 int v12; // edi@9
Ritor1
parents:
diff changeset
5287 char *v13; // edx@9
Ritor1
parents:
diff changeset
5288 signed int v14; // edi@10
Ritor1
parents:
diff changeset
5289 unsigned int v16; // eax@29
955
Ritor1
parents: 917
diff changeset
5290 //int v17; // eax@36
0
Ritor1
parents:
diff changeset
5291 char v18; // cl@46
Ritor1
parents:
diff changeset
5292 __int16 v19; // dx@56
Ritor1
parents:
diff changeset
5293 int v20; // eax@60
955
Ritor1
parents: 917
diff changeset
5294 //char *v21; // [sp-Ch] [bp-38h]@82
Ritor1
parents: 917
diff changeset
5295 //const char *v22; // [sp-8h] [bp-34h]@21
Ritor1
parents: 917
diff changeset
5296 //unsigned int v23; // [sp-8h] [bp-34h]@38
Ritor1
parents: 917
diff changeset
5297 //char *v24; // [sp-8h] [bp-34h]@82
0
Ritor1
parents:
diff changeset
5298 char *v25; // [sp-4h] [bp-30h]@14
955
Ritor1
parents: 917
diff changeset
5299 //int v26; // [sp-4h] [bp-30h]@38
Ritor1
parents: 917
diff changeset
5300 //int v27; // [sp-4h] [bp-30h]@82
0
Ritor1
parents:
diff changeset
5301 char v28[4]; // [sp+Ch] [bp-20h]@9
Ritor1
parents:
diff changeset
5302 int v29; // [sp+10h] [bp-1Ch]@13
Ritor1
parents:
diff changeset
5303 int v30; // [sp+14h] [bp-18h]@15
Ritor1
parents:
diff changeset
5304 int v31; // [sp+18h] [bp-14h]@16
Ritor1
parents:
diff changeset
5305 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7
955
Ritor1
parents: 917
diff changeset
5306 //int v33; // [sp+20h] [bp-Ch]@7
0
Ritor1
parents:
diff changeset
5307 int v34; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
5308 char *v35; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
5309
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5310 contract_approved = 0;
0
Ritor1
parents:
diff changeset
5311 v2 = (_this - 200) % 3;
Ritor1
parents:
diff changeset
5312 v3 = (_this - 200) / 3;
Ritor1
parents:
diff changeset
5313 v4 = v2;
Ritor1
parents:
diff changeset
5314 v35 = (char *)pNPCTopics[127].pText;
492
Gloval
parents: 487
diff changeset
5315 dword_F8B1AC_award_bit_number = v3;
0
Ritor1
parents:
diff changeset
5316 if ( v2 )
Ritor1
parents:
diff changeset
5317 {
Ritor1
parents:
diff changeset
5318 if ( v2 == 1 )
Ritor1
parents:
diff changeset
5319 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5320 gold_transaction_amount = 5000;
0
Ritor1
parents:
diff changeset
5321 dword_F8B1B0 = 3;
Ritor1
parents:
diff changeset
5322 }
Ritor1
parents:
diff changeset
5323 else
Ritor1
parents:
diff changeset
5324 {
Ritor1
parents:
diff changeset
5325 if ( v2 == 2 )
Ritor1
parents:
diff changeset
5326 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5327 gold_transaction_amount = 8000;
0
Ritor1
parents:
diff changeset
5328 dword_F8B1B0 = 4;
Ritor1
parents:
diff changeset
5329 }
Ritor1
parents:
diff changeset
5330 }
Ritor1
parents:
diff changeset
5331 }
Ritor1
parents:
diff changeset
5332 else
Ritor1
parents:
diff changeset
5333 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5334 gold_transaction_amount = 2000;
0
Ritor1
parents:
diff changeset
5335 dword_F8B1B0 = 2;
Ritor1
parents:
diff changeset
5336 }
955
Ritor1
parents: 917
diff changeset
5337 pClassType = pPlayers[uActiveCharacter]->classType;
Ritor1
parents: 917
diff changeset
5338 //v33 = pClassType;
Ritor1
parents: 917
diff changeset
5339 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3];
Ritor1
parents: 917
diff changeset
5340 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3];
0
Ritor1
parents:
diff changeset
5341 v7 = a1[0] & 0x3F;
Ritor1
parents:
diff changeset
5342 v34 = v2 + 2;
Ritor1
parents:
diff changeset
5343 if ( v6 < v2 + 2 )
Ritor1
parents:
diff changeset
5344 {
955
Ritor1
parents: 917
diff changeset
5345 //v8 = v33;
0
Ritor1
parents:
diff changeset
5346 v9 = 0;
955
Ritor1
parents: 917
diff changeset
5347 v10 = pClassType - pClassType % 4;
Ritor1
parents: 917
diff changeset
5348 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3];
0
Ritor1
parents:
diff changeset
5349 do
Ritor1
parents:
diff changeset
5350 {
Ritor1
parents:
diff changeset
5351 v12 = (unsigned __int8)*v11;
Ritor1
parents:
diff changeset
5352 v13 = &v28[4 * v9];
Ritor1
parents:
diff changeset
5353 *(int *)v13 = 0;
Ritor1
parents:
diff changeset
5354 if ( v12 < v34 )
Ritor1
parents:
diff changeset
5355 {
Ritor1
parents:
diff changeset
5356 v14 = 1;
Ritor1
parents:
diff changeset
5357 }
Ritor1
parents:
diff changeset
5358 else
Ritor1
parents:
diff changeset
5359 {
Ritor1
parents:
diff changeset
5360 v14 = 1;
Ritor1
parents:
diff changeset
5361 *(int *)v13 = 1;
Ritor1
parents:
diff changeset
5362 }
Ritor1
parents:
diff changeset
5363 ++v9;
Ritor1
parents:
diff changeset
5364 v11 += 37;
Ritor1
parents:
diff changeset
5365 }
Ritor1
parents:
diff changeset
5366 while ( v9 < 4 );
Ritor1
parents:
diff changeset
5367 if ( v29 == v14 )
Ritor1
parents:
diff changeset
5368 {
Ritor1
parents:
diff changeset
5369 v25 = pClassNames[v10 + 1];
Ritor1
parents:
diff changeset
5370 }
Ritor1
parents:
diff changeset
5371 else
Ritor1
parents:
diff changeset
5372 {
955
Ritor1
parents: 917
diff changeset
5373 if ( v30 == v14 )//crash
0
Ritor1
parents:
diff changeset
5374 {
Ritor1
parents:
diff changeset
5375 if ( v31 == v14 )
Ritor1
parents:
diff changeset
5376 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5377 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà.
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5378 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
5379 }
Ritor1
parents:
diff changeset
5380 v25 = pClassNames[v10 + 2];
Ritor1
parents:
diff changeset
5381 }
Ritor1
parents:
diff changeset
5382 else
Ritor1
parents:
diff changeset
5383 {
Ritor1
parents:
diff changeset
5384 if ( v31 != v14 )
Ritor1
parents:
diff changeset
5385 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5386 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s.
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5387 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
5388 }
Ritor1
parents:
diff changeset
5389 v25 = pClassNames[v10 + 3];
Ritor1
parents:
diff changeset
5390 }
Ritor1
parents:
diff changeset
5391 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5392 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà.
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5393 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
5394 }
955
Ritor1
parents: 917
diff changeset
5395 if ( !pPlayers[uActiveCharacter]->CanAct() )
0
Ritor1
parents:
diff changeset
5396 return (char *)pNPCTopics[122].pText;
Ritor1
parents:
diff changeset
5397 if ( !v7 )
Ritor1
parents:
diff changeset
5398 return (char *)pNPCTopics[131].pText;
Ritor1
parents:
diff changeset
5399 v16 = SkillToMastery(a1[0]);
Ritor1
parents:
diff changeset
5400 if ( (signed int)v16 > v4 + 1 )
Ritor1
parents:
diff changeset
5401 return (char *)pNPCTopics[v4 + 128].pText;
Ritor1
parents:
diff changeset
5402 if ( v34 != 2 )
Ritor1
parents:
diff changeset
5403 {
Ritor1
parents:
diff changeset
5404 if ( v34 == 3 )
Ritor1
parents:
diff changeset
5405 {
Ritor1
parents:
diff changeset
5406 if ( (signed int)v16 >= 2 && v7 >= 7 )
Ritor1
parents:
diff changeset
5407 {
492
Gloval
parents: 487
diff changeset
5408 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
5409 {
Ritor1
parents:
diff changeset
5410 case 12:
Ritor1
parents:
diff changeset
5411 case 13:
Ritor1
parents:
diff changeset
5412 case 14:
Ritor1
parents:
diff changeset
5413 case 15:
Ritor1
parents:
diff changeset
5414 case 16:
Ritor1
parents:
diff changeset
5415 case 17:
Ritor1
parents:
diff changeset
5416 case 18:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5417 gold_transaction_amount = 4000;
0
Ritor1
parents:
diff changeset
5418 goto LABEL_42;
Ritor1
parents:
diff changeset
5419 case 19:
Ritor1
parents:
diff changeset
5420 v19 = 114;
955
Ritor1
parents: 917
diff changeset
5421 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
Ritor1
parents: 917
diff changeset
5422 return v35;
Ritor1
parents: 917
diff changeset
5423 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5424 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5425 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5426 case 20:
Ritor1
parents:
diff changeset
5427 v19 = 110;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5428 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
0
Ritor1
parents:
diff changeset
5429 return v35;
955
Ritor1
parents: 917
diff changeset
5430 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5431 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5432 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5433 case 22:
955
Ritor1
parents: 917
diff changeset
5434 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower();
Ritor1
parents: 917
diff changeset
5435 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
5436 return v35;
Ritor1
parents: 917
diff changeset
5437 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5438 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5439 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5440 case 24:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5441 gold_transaction_amount = 2500;
955
Ritor1
parents: 917
diff changeset
5442 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance();
0
Ritor1
parents:
diff changeset
5443 if ( v20 < 50 )
Ritor1
parents:
diff changeset
5444 return v35;
955
Ritor1
parents: 917
diff changeset
5445 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5446 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5447 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5448 case 36:
Ritor1
parents: 917
diff changeset
5449 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence();
Ritor1
parents: 917
diff changeset
5450 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
5451 return v35;
Ritor1
parents: 917
diff changeset
5452 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5453 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5454 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5455 case 21:
Ritor1
parents:
diff changeset
5456 case 23:
Ritor1
parents:
diff changeset
5457 case 25:
Ritor1
parents:
diff changeset
5458 case 26:
Ritor1
parents:
diff changeset
5459 case 29:
Ritor1
parents:
diff changeset
5460 case 32:
Ritor1
parents:
diff changeset
5461 case 34:
Ritor1
parents:
diff changeset
5462 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5463 gold_transaction_amount = 2500;
0
Ritor1
parents:
diff changeset
5464 goto LABEL_42;
Ritor1
parents:
diff changeset
5465 case 8:
Ritor1
parents:
diff changeset
5466 case 9:
Ritor1
parents:
diff changeset
5467 case 10:
Ritor1
parents:
diff changeset
5468 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5469 gold_transaction_amount = 3000;
0
Ritor1
parents:
diff changeset
5470 goto LABEL_42;
Ritor1
parents:
diff changeset
5471 case 7:
955
Ritor1
parents: 917
diff changeset
5472 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
5473 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5474 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5475 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5476 default:
Ritor1
parents: 917
diff changeset
5477 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5478 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5479 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5480 }
955
Ritor1
parents: 917
diff changeset
5481 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
5482 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5483 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5484 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5485 }
Ritor1
parents:
diff changeset
5486 }
Ritor1
parents:
diff changeset
5487 else
Ritor1
parents:
diff changeset
5488 {
Ritor1
parents:
diff changeset
5489 if ( v34 != 4 )
Ritor1
parents:
diff changeset
5490 {
955
Ritor1
parents: 917
diff changeset
5491 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5492 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5493 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5494 }
Ritor1
parents:
diff changeset
5495 if ( (signed int)v16 >= 3 && v7 >= 10 )
Ritor1
parents:
diff changeset
5496 {
492
Gloval
parents: 487
diff changeset
5497 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
5498 {
Ritor1
parents:
diff changeset
5499 case 19:
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
5500 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
5501 {
Ritor1
parents: 917
diff changeset
5502 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5503 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5504 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5505 }
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
5506 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
5507 {
Ritor1
parents: 917
diff changeset
5508 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5509 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5510 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5511 }
Ritor1
parents: 917
diff changeset
5512 return v35;
0
Ritor1
parents:
diff changeset
5513 case 20:
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
5514 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
5515 {
Ritor1
parents: 917
diff changeset
5516 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5517 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5518 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5519 }
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
5520 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
5521 {
Ritor1
parents: 917
diff changeset
5522 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5523 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5524 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5525 }
0
Ritor1
parents:
diff changeset
5526 return v35;
Ritor1
parents:
diff changeset
5527 case 30:
955
Ritor1
parents: 917
diff changeset
5528 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]);
0
Ritor1
parents:
diff changeset
5529 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents:
diff changeset
5530 return v35;
955
Ritor1
parents: 917
diff changeset
5531 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5532 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5533 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5534 case 31:
Ritor1
parents: 917
diff changeset
5535 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]);
Ritor1
parents: 917
diff changeset
5536 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents: 917
diff changeset
5537 return v35;
Ritor1
parents: 917
diff changeset
5538 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5539 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5540 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5541 case 21:
Ritor1
parents:
diff changeset
5542 case 23:
Ritor1
parents:
diff changeset
5543 case 24:
Ritor1
parents:
diff changeset
5544 case 25:
Ritor1
parents:
diff changeset
5545 case 26:
Ritor1
parents:
diff changeset
5546 case 29:
Ritor1
parents:
diff changeset
5547 case 32:
Ritor1
parents:
diff changeset
5548 case 34:
Ritor1
parents:
diff changeset
5549 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5550 gold_transaction_amount = 6000;
0
Ritor1
parents:
diff changeset
5551 goto LABEL_42;
Ritor1
parents:
diff changeset
5552 case 8:
Ritor1
parents:
diff changeset
5553 case 9:
Ritor1
parents:
diff changeset
5554 case 10:
Ritor1
parents:
diff changeset
5555 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5556 gold_transaction_amount = 7000;
0
Ritor1
parents:
diff changeset
5557 goto LABEL_42;
Ritor1
parents:
diff changeset
5558 case 7:
Ritor1
parents:
diff changeset
5559 break;
955
Ritor1
parents: 917
diff changeset
5560 default:
Ritor1
parents: 917
diff changeset
5561 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5562 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5563 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5564 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5565 gold_transaction_amount = 0;
955
Ritor1
parents: 917
diff changeset
5566 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5567 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5568 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5569 }
Ritor1
parents:
diff changeset
5570 }
Ritor1
parents:
diff changeset
5571 return v35;
Ritor1
parents:
diff changeset
5572 }
Ritor1
parents:
diff changeset
5573 if ( v7 < 4 )
Ritor1
parents:
diff changeset
5574 return v35;
492
Gloval
parents: 487
diff changeset
5575 if ( dword_F8B1AC_award_bit_number > 27 )
Gloval
parents: 487
diff changeset
5576 {
Gloval
parents: 487
diff changeset
5577 if ( dword_F8B1AC_award_bit_number != 29
Gloval
parents: 487
diff changeset
5578 && dword_F8B1AC_award_bit_number != 32
Gloval
parents: 487
diff changeset
5579 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
0
Ritor1
parents:
diff changeset
5580 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5581 if ( !gold_transaction_amount )
0
Ritor1
parents:
diff changeset
5582 goto LABEL_79;
Ritor1
parents:
diff changeset
5583 goto LABEL_42;
Ritor1
parents:
diff changeset
5584 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5585 gold_transaction_amount = 500;
955
Ritor1
parents: 917
diff changeset
5586 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5587 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5588 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5589 }
492
Gloval
parents: 487
diff changeset
5590 if ( dword_F8B1AC_award_bit_number >= 23 )
955
Ritor1
parents: 917
diff changeset
5591 {
Ritor1
parents: 917
diff changeset
5592 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
5593 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5594 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5595 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5596 }
492
Gloval
parents: 487
diff changeset
5597 if ( dword_F8B1AC_award_bit_number == 7 )
0
Ritor1
parents:
diff changeset
5598 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5599 gold_transaction_amount = 0;
0
Ritor1
parents:
diff changeset
5600 goto LABEL_79;
Ritor1
parents:
diff changeset
5601 }
492
Gloval
parents: 487
diff changeset
5602 if ( dword_F8B1AC_award_bit_number <= 7 )
955
Ritor1
parents: 917
diff changeset
5603 {
Ritor1
parents: 917
diff changeset
5604 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5605 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5606 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5607 }
492
Gloval
parents: 487
diff changeset
5608 if ( dword_F8B1AC_award_bit_number > 18 )
Gloval
parents: 487
diff changeset
5609 {
Gloval
parents: 487
diff changeset
5610 if ( dword_F8B1AC_award_bit_number != 21 )
955
Ritor1
parents: 917
diff changeset
5611 {
Ritor1
parents: 917
diff changeset
5612 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5613 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5614 goto LABEL_42;
Ritor1
parents: 917
diff changeset
5615 }
Ritor1
parents: 917
diff changeset
5616 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
5617 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
5618 goto LABEL_79;
Ritor1
parents: 917
diff changeset
5619 goto LABEL_42;
0
Ritor1
parents:
diff changeset
5620 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5621 gold_transaction_amount = 1000;
0
Ritor1
parents:
diff changeset
5622 LABEL_42:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
5623 if ( gold_transaction_amount > pParty->uNumGold )
0
Ritor1
parents:
diff changeset
5624 return (char *)pNPCTopics[124].pText;
Ritor1
parents:
diff changeset
5625 LABEL_79:
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5626 contract_approved = 1;
0
Ritor1
parents:
diff changeset
5627 if ( v34 == 2 )
Ritor1
parents:
diff changeset
5628 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5629 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ]
955
Ritor1
parents: 917
diff changeset
5630 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5631 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
5632 }
Ritor1
parents:
diff changeset
5633 if ( v34 == 3 )
Ritor1
parents:
diff changeset
5634 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5635 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
5636 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5637 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
5638 }
Ritor1
parents:
diff changeset
5639 if ( v34 == 4 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5640 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
5641 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5642 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
5643 }
Ritor1
parents:
diff changeset
5644
Ritor1
parents:
diff changeset
5645 //----- (004B3A72) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5646 void sub_4B3A72( int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5647 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5648 int num_buttons; // esi@1
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5649
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5650 num_buttons = 0;
0
Ritor1
parents:
diff changeset
5651 if ( a1 == 21 )
Ritor1
parents:
diff changeset
5652 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5653 CreateButtonInColumn(0, 0x66u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5654 num_buttons = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5655 CreateButtonInColumn(1, 0x67u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5656 if ( pParty->HasItem(651) ) //Arcomage Deck
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5657 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5658 num_buttons = 3;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5659 CreateButtonInColumn(2, 0x68u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5660 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5661 }
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5662 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2);
0
Ritor1
parents:
diff changeset
5663 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
5664 }
Ritor1
parents:
diff changeset
5665 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
5666
Ritor1
parents:
diff changeset
5667 //----- (004B3AD4) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5668 void sub_4B3AD4( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5669 {
0
Ritor1
parents:
diff changeset
5670 if ( a1 > 0 )
Ritor1
parents:
diff changeset
5671 {
Ritor1
parents:
diff changeset
5672 if ( a1 <= 3 )
Ritor1
parents:
diff changeset
5673 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5674 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5675 CreateButtonInColumn(1, 4u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5676 CreateButtonInColumn(2, 5u);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5677 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2);
0
Ritor1
parents:
diff changeset
5678 }
Ritor1
parents:
diff changeset
5679 if ( a1 == 4 )
Ritor1
parents:
diff changeset
5680 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5681 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5682 CreateButtonInColumn(1, 4u);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5683 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2);
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5684 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5685 }
0
Ritor1
parents:
diff changeset
5686 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
5687 }
Ritor1
parents:
diff changeset
5688 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
5689
Ritor1
parents:
diff changeset
5690 //----- (004B3B42) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5691 void sub_4B3B42( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5692 {
0
Ritor1
parents:
diff changeset
5693 int v1; // ecx@18
Ritor1
parents:
diff changeset
5694 int v2; // ecx@19
Ritor1
parents:
diff changeset
5695 int v3; // ecx@20
Ritor1
parents:
diff changeset
5696 signed int v4; // esi@22
Ritor1
parents:
diff changeset
5697 signed int v5; // eax@22
Ritor1
parents:
diff changeset
5698 unsigned int v6; // edx@24
Ritor1
parents:
diff changeset
5699 int v7; // ecx@24
Ritor1
parents:
diff changeset
5700 int result; // eax@43
Ritor1
parents:
diff changeset
5701 int v9; // [sp-10h] [bp-14h]@28
Ritor1
parents:
diff changeset
5702 int v10; // [sp-Ch] [bp-10h]@28
Ritor1
parents:
diff changeset
5703 int v11; // [sp-8h] [bp-Ch]@28
Ritor1
parents:
diff changeset
5704 unsigned int v12; // [sp-4h] [bp-8h]@4
Ritor1
parents:
diff changeset
5705 unsigned int v13; // [sp-4h] [bp-8h]@5
Ritor1
parents:
diff changeset
5706 unsigned int v14; // [sp-4h] [bp-8h]@9
Ritor1
parents:
diff changeset
5707 unsigned int v15; // [sp-4h] [bp-8h]@10
Ritor1
parents:
diff changeset
5708 unsigned int v16; // [sp-4h] [bp-8h]@14
Ritor1
parents:
diff changeset
5709 int v17; // [sp-4h] [bp-8h]@28
Ritor1
parents:
diff changeset
5710
Ritor1
parents:
diff changeset
5711 if ( a1 > 13 )
Ritor1
parents:
diff changeset
5712 {
Ritor1
parents:
diff changeset
5713 if ( a1 > 22 )
Ritor1
parents:
diff changeset
5714 {
Ritor1
parents:
diff changeset
5715 if ( a1 == 23 )
Ritor1
parents:
diff changeset
5716 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5717 CreateButtonInColumn(0, 0xAu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5718 CreateButtonInColumn(1, 0xBu);
0
Ritor1
parents:
diff changeset
5719 v14 = 96;
Ritor1
parents:
diff changeset
5720 LABEL_41:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5721 CreateButtonInColumn(2, v14);
0
Ritor1
parents:
diff changeset
5722 v17 = 2;
Ritor1
parents:
diff changeset
5723 v11 = 0;
Ritor1
parents:
diff changeset
5724 v10 = 1;
Ritor1
parents:
diff changeset
5725 v9 = 3;
Ritor1
parents:
diff changeset
5726 goto LABEL_42;
Ritor1
parents:
diff changeset
5727 }
Ritor1
parents:
diff changeset
5728 if ( a1 <= 26 )
Ritor1
parents:
diff changeset
5729 goto LABEL_43;
Ritor1
parents:
diff changeset
5730 if ( a1 > 28 )
Ritor1
parents:
diff changeset
5731 {
Ritor1
parents:
diff changeset
5732 if ( a1 != 30 )
Ritor1
parents:
diff changeset
5733 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5734 CreateButtonInColumn(0, 0x11u);
0
Ritor1
parents:
diff changeset
5735 v16 = 96;
Ritor1
parents:
diff changeset
5736 goto LABEL_37;
Ritor1
parents:
diff changeset
5737 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5738 CreateButtonInColumn(0, 0x69u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5739 CreateButtonInColumn(1, 0x6Au);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5740 CreateButtonInColumn(2, 0x6Bu);
0
Ritor1
parents:
diff changeset
5741 v12 = 108;
Ritor1
parents:
diff changeset
5742 }
Ritor1
parents:
diff changeset
5743 else
Ritor1
parents:
diff changeset
5744 {
Ritor1
parents:
diff changeset
5745 if ( a1 == 22 )
Ritor1
parents:
diff changeset
5746 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5747 CreateButtonInColumn(0, 7u);
0
Ritor1
parents:
diff changeset
5748 v16 = 8;
Ritor1
parents:
diff changeset
5749 goto LABEL_37;
Ritor1
parents:
diff changeset
5750 }
Ritor1
parents:
diff changeset
5751 v1 = a1 - 14;
Ritor1
parents:
diff changeset
5752 if ( !v1 )
Ritor1
parents:
diff changeset
5753 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5754 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5755 CreateButtonInColumn(1, 0x30u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5756 CreateButtonInColumn(2, 0x31u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5757 CreateButtonInColumn(3, 0x32u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5758 CreateButtonInColumn(4, 0x33u);
0
Ritor1
parents:
diff changeset
5759 v17 = 2;
Ritor1
parents:
diff changeset
5760 v11 = 0;
Ritor1
parents:
diff changeset
5761 v10 = 1;
Ritor1
parents:
diff changeset
5762 v9 = 5;
Ritor1
parents:
diff changeset
5763 goto LABEL_42;
Ritor1
parents:
diff changeset
5764 }
Ritor1
parents:
diff changeset
5765 v2 = v1 - 1;
Ritor1
parents:
diff changeset
5766 if ( v2 )
Ritor1
parents:
diff changeset
5767 {
Ritor1
parents:
diff changeset
5768 v3 = v2 - 2;
Ritor1
parents:
diff changeset
5769 if ( v3 )
Ritor1
parents:
diff changeset
5770 {
Ritor1
parents:
diff changeset
5771 if ( v3 != 4 )
Ritor1
parents:
diff changeset
5772 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5773 CreateButtonInColumn(0, 0xFu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5774 CreateButtonInColumn(1, 0x10u);
0
Ritor1
parents:
diff changeset
5775 v4 = 3;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5776 CreateButtonInColumn(2, 0x60u);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
5777 v5 = (signed int)window_SpeakInHouse->ptr_1C;
0
Ritor1
parents:
diff changeset
5778 if ( v5 < 108 || v5 > 120 )
Ritor1
parents:
diff changeset
5779 goto LABEL_28;
Ritor1
parents:
diff changeset
5780 v4 = 4;
Ritor1
parents:
diff changeset
5781 v6 = 101;
Ritor1
parents:
diff changeset
5782 v7 = 3;
Ritor1
parents:
diff changeset
5783 }
Ritor1
parents:
diff changeset
5784 else
Ritor1
parents:
diff changeset
5785 {
Ritor1
parents:
diff changeset
5786 v4 = 1;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5787 CreateButtonInColumn(0, 0x63u);
0
Ritor1
parents:
diff changeset
5788 if ( !pParty->uFine )
Ritor1
parents:
diff changeset
5789 {
Ritor1
parents:
diff changeset
5790 LABEL_28:
Ritor1
parents:
diff changeset
5791 v17 = 2;
Ritor1
parents:
diff changeset
5792 v11 = 0;
Ritor1
parents:
diff changeset
5793 v10 = 1;
Ritor1
parents:
diff changeset
5794 v9 = v4;
Ritor1
parents:
diff changeset
5795 LABEL_42:
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5796 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17);
0
Ritor1
parents:
diff changeset
5797 goto LABEL_43;
Ritor1
parents:
diff changeset
5798 }
Ritor1
parents:
diff changeset
5799 v4 = 2;
Ritor1
parents:
diff changeset
5800 v7 = 1;
Ritor1
parents:
diff changeset
5801 v6 = 100;
Ritor1
parents:
diff changeset
5802 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5803 CreateButtonInColumn(v7, v6);
0
Ritor1
parents:
diff changeset
5804 goto LABEL_28;
Ritor1
parents:
diff changeset
5805 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5806 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5807 CreateButtonInColumn(1, 0x34u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5808 CreateButtonInColumn(2, 0x35u);
0
Ritor1
parents:
diff changeset
5809 v12 = 54;
Ritor1
parents:
diff changeset
5810 }
Ritor1
parents:
diff changeset
5811 LABEL_39:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5812 CreateButtonInColumn(3, v12);
0
Ritor1
parents:
diff changeset
5813 v17 = 2;
Ritor1
parents:
diff changeset
5814 v11 = 0;
Ritor1
parents:
diff changeset
5815 v10 = 1;
Ritor1
parents:
diff changeset
5816 v9 = 4;
Ritor1
parents:
diff changeset
5817 goto LABEL_42;
Ritor1
parents:
diff changeset
5818 }
Ritor1
parents:
diff changeset
5819 if ( a1 == 13 )
Ritor1
parents:
diff changeset
5820 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5821 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5822 v16 = 56;
Ritor1
parents:
diff changeset
5823 LABEL_37:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5824 CreateButtonInColumn(1, v16);
0
Ritor1
parents:
diff changeset
5825 v17 = 2;
Ritor1
parents:
diff changeset
5826 v11 = 0;
Ritor1
parents:
diff changeset
5827 v10 = 1;
Ritor1
parents:
diff changeset
5828 v9 = 2;
Ritor1
parents:
diff changeset
5829 goto LABEL_42;
Ritor1
parents:
diff changeset
5830 }
Ritor1
parents:
diff changeset
5831 switch ( a1 )
Ritor1
parents:
diff changeset
5832 {
Ritor1
parents:
diff changeset
5833 case 1:
Ritor1
parents:
diff changeset
5834 case 2:
Ritor1
parents:
diff changeset
5835 case 3:
Ritor1
parents:
diff changeset
5836 case 4:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5837 CreateButtonInColumn(0, 2u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5838 CreateButtonInColumn(1, 0x5Fu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5839 CreateButtonInColumn(2, 0x5Eu);
0
Ritor1
parents:
diff changeset
5840 v12 = 96;
Ritor1
parents:
diff changeset
5841 goto LABEL_39;
Ritor1
parents:
diff changeset
5842 case 5:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5843 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5844 v13 = 48;
Ritor1
parents:
diff changeset
5845 goto LABEL_9;
Ritor1
parents:
diff changeset
5846 case 6:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5847 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5848 v13 = 49;
Ritor1
parents:
diff changeset
5849 goto LABEL_9;
Ritor1
parents:
diff changeset
5850 case 7:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5851 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5852 v13 = 50;
Ritor1
parents:
diff changeset
5853 goto LABEL_9;
Ritor1
parents:
diff changeset
5854 case 8:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5855 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5856 v13 = 51;
Ritor1
parents:
diff changeset
5857 LABEL_9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5858 CreateButtonInColumn(1, v13);
0
Ritor1
parents:
diff changeset
5859 v14 = 72;
Ritor1
parents:
diff changeset
5860 goto LABEL_41;
Ritor1
parents:
diff changeset
5861 case 9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5862 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5863 v15 = 52;
Ritor1
parents:
diff changeset
5864 goto LABEL_13;
Ritor1
parents:
diff changeset
5865 case 10:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5866 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5867 v15 = 53;
Ritor1
parents:
diff changeset
5868 goto LABEL_13;
Ritor1
parents:
diff changeset
5869 case 11:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5870 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5871 v15 = 54;
Ritor1
parents:
diff changeset
5872 LABEL_13:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5873 CreateButtonInColumn(1, v15);
0
Ritor1
parents:
diff changeset
5874 v14 = 61;
Ritor1
parents:
diff changeset
5875 goto LABEL_41;
Ritor1
parents:
diff changeset
5876 case 12:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
5877 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
5878 v16 = 55;
Ritor1
parents:
diff changeset
5879 goto LABEL_37;
Ritor1
parents:
diff changeset
5880 default:
Ritor1
parents:
diff changeset
5881 break;
Ritor1
parents:
diff changeset
5882 }
Ritor1
parents:
diff changeset
5883 LABEL_43:
Ritor1
parents:
diff changeset
5884 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
5885 }
Ritor1
parents:
diff changeset
5886 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
5887
Ritor1
parents:
diff changeset
5888 //----- (004B3E1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
5889 void __cdecl sub_4B3E1E()
Ritor1
parents:
diff changeset
5890 {
Ritor1
parents:
diff changeset
5891 NPCData *v0; // ST40_4@1
Ritor1
parents:
diff changeset
5892 signed int v1; // edi@1
165
Ritor1
parents: 152
diff changeset
5893 //GUIWindow *v2; // ecx@1
0
Ritor1
parents:
diff changeset
5894
167
90521fb9766c NPCDialogue fix
Ritor1
parents: 165
diff changeset
5895 __debugbreak();
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
5896 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0
Ritor1
parents:
diff changeset
5897 v1 = 0;
Ritor1
parents:
diff changeset
5898 pDialogueWindow->eWindowType = WINDOW_MainMenu;
Ritor1
parents:
diff changeset
5899 pDialogueWindow->Release();
165
Ritor1
parents: 152
diff changeset
5900 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
5901 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
0
Ritor1
parents:
diff changeset
5902 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
5903 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
0
Ritor1
parents:
diff changeset
5904 v1 = 1;
Ritor1
parents:
diff changeset
5905 }
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
5906 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5907 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
0
Ritor1
parents:
diff changeset
5908 }
Ritor1
parents:
diff changeset
5909
Ritor1
parents:
diff changeset
5910 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
5911
Ritor1
parents:
diff changeset
5912 //----- (004B3FE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
5913 void __fastcall sub_4B3FE5(int a4)
Ritor1
parents:
diff changeset
5914 {
Ritor1
parents:
diff changeset
5915 int v1; // edi@1
Ritor1
parents:
diff changeset
5916 char *v2; // edi@1
Ritor1
parents:
diff changeset
5917
Ritor1
parents:
diff changeset
5918 v1 = a4;
Ritor1
parents:
diff changeset
5919 uDialogueType = 78;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
5920 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
0
Ritor1
parents:
diff changeset
5921 _4B254D_SkillMasteryTeacher(a4);
Ritor1
parents:
diff changeset
5922 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
5923 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
Ritor1
parents:
diff changeset
5924 v2 = "";
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
5925 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
5926 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
5927 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
5928 if ( contract_approved )
0
Ritor1
parents:
diff changeset
5929 v2 = pGlobalTXT_LocalizationStrings[535];
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
5930 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
5931 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
5932 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
5933 }
Ritor1
parents:
diff changeset
5934 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
5935 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
5936
Ritor1
parents:
diff changeset
5937 //----- (004B46A5) --------------------------------------------------------
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
5938 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 )
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
5939 {
0
Ritor1
parents:
diff changeset
5940 int v4; // eax@1
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
5941 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
5942 v4 = pFontLucida->AlignText_Center(450, Str);
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
5943 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0);
0
Ritor1
parents:
diff changeset
5944 }
Ritor1
parents:
diff changeset
5945
Ritor1
parents:
diff changeset
5946 //----- (004B46F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
5947 int __fastcall sub_4B46F8(int a1)
Ritor1
parents:
diff changeset
5948 {
Ritor1
parents:
diff changeset
5949 int v1; // eax@1
Ritor1
parents:
diff changeset
5950 int i; // edx@1
Ritor1
parents:
diff changeset
5951
Ritor1
parents:
diff changeset
5952 v1 = 0;
Ritor1
parents:
diff changeset
5953 for ( i = 0; i < a1; ++i )
Ritor1
parents:
diff changeset
5954 v1 += i + 1;
Ritor1
parents:
diff changeset
5955 return 1000 * v1;
Ritor1
parents:
diff changeset
5956 }
Ritor1
parents:
diff changeset
5957
Ritor1
parents:
diff changeset
5958 //----- (004BC49B) --------------------------------------------------------
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
5959 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
5960 {
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5961 //unsigned int v1; // esi@1
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5962 NPCData *speakingNPC; // ebp@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5963 //unsigned int v3; // eax@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5964 int npc_event_id; // ecx@10
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5965 signed int v5; // edi@14
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5966 char *v6; // esi@15
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5967 const char *v7; // ecx@22
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5968 signed int v8; // edi@37
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5969 //unsigned int v9; // eax@56
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5970 unsigned int v10; // ecx@57
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5971 void *v11; // [sp-Ch] [bp-1Ch]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5972 int v12; // [sp-8h] [bp-18h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5973 char *v13; // [sp-8h] [bp-18h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5974 size_t v14; // [sp-4h] [bp-14h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5975 const char *v15; // [sp-4h] [bp-14h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5976
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5977 //v1 = _this;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5978 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
5979 //v3 = v1;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5980 uDialogueType = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5981 if (!speakingNPC->uFlags)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5982 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5983 speakingNPC->uFlags = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5984 //v3 = uDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5985 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5986
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5987 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5988 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5989 dialogue_show_profession_details = ~dialogue_show_profession_details;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5990 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5991 else if(newDialogueType == DIALOGUE_76)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5992 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5993 if (speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5994 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5995 v8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5996 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5997 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5998 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
5999 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6000 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6001 ++v8;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6002 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6003 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6004 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6005 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6006 if( v8 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6007 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6008 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
6009 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6010 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6011 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6012 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6013 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
6014 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6015 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6016 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6017 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6018 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6019 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
6020 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6021 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6022 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6023 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6024 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6025 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6026 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6027 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6028 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6029 ShowStatusBarString(v7, 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6030 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6031 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6032 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6033 //v9 = v2->uProfession;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6034 if ( speakingNPC->uProfession != 51 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6035 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6036 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6037 if ( pParty->uNumGold < v10 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6038 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6039 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6040 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6041 uDialogueType = 13;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6042 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6043 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6044 v7 = pGlobalTXT_LocalizationStrings[155];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6045 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6046 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6047 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6048 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6049 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6050 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6051 Party::TakeGold(v10);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6052 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6053 LOBYTE(speakingNPC->uFlags) |= 0x80u;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6054 if ( pParty->pHirelings[0].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6055 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6056 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6057 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6058 v13 = pParty->pHireling2Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6059 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6060 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6061 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6062 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6063 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6064 v13 = pParty->pHireling1Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6065 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6066 strcpy(v13, v15);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6067 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
6068 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6069
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6070 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6071
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
6072 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6073 pDialogue_SpeakingActor->uAIState = Removed;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6074 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6075 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6076 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6077 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6078 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6079 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6080 ArenaFight();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6081 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6082 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6083 else if(newDialogueType == DIALOGUE_9)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6084 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6085 if ( !sub_4BB756(speakingNPC->uProfession) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6086 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6087 if ( speakingNPC->uProfession != 41 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6088 speakingNPC->bHasUsedTheAbility = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6089
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6090 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6091 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6092 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6093 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6094 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6095 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6096 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6097 else if(newDialogueType == DIALOGUE_13)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6098 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6099 if (!speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6100 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6101 sub_4B3E1E();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6102 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6103 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6104 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6105 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6106 v5 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6107 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6108 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6109 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6110 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6111 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6112 ++v5;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6113 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6114 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6115 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6116 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6117 if ( v5 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6118 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6119 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
6120 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6121 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6122 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6123 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6124 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
6125 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6126 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6127 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6128 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6129 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6130 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
6131 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6132 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6133 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6134 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6135 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6136 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6137 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6138 else if(newDialogueType >= 19 && newDialogueType <= 24)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6139 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6140 switch(newDialogueType)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6141 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6142 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6143 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6144 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6145 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6146 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6147 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6148 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6149 if ( (npc_event_id >= 200) && (npc_event_id <= 310) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6150 sub_4B3FE5(npc_event_id); //200-310
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6151 else if (( npc_event_id >= 400) && (npc_event_id <= 410) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6152 { //400-410
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6153 dword_F8B1D8 = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6154 DrawJoinGuildWindow(npc_event_id - 400);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6155 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6156 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6157 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6158 switch ( npc_event_id )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6159 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6160 case 139:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6161 sub_4B1ECE();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6162 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6163 case 311:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6164 sub_4BBA85_bounties();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6165 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6166 case 399:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6167 sub_4BBCDD();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6168 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6169 default:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6170 activeLevelDecoration = (LevelDecoration*)1;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6171 current_npc_text = 0;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6172 EventProcessor(npc_event_id, 0, 1);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6173 activeLevelDecoration = NULL;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6174 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6175 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6176 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6177 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6178 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6179 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6180 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
6181 }
0
Ritor1
parents:
diff changeset
6182
Ritor1
parents:
diff changeset
6183 //----- (004BDAAF) --------------------------------------------------------
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6184 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx)
0
Ritor1
parents:
diff changeset
6185 {
Ritor1
parents:
diff changeset
6186 int v6; // edx@8
Ritor1
parents:
diff changeset
6187 int v7; // edx@9
Ritor1
parents:
diff changeset
6188 int v8; // edx@10
Ritor1
parents:
diff changeset
6189 unsigned __int8 v9; // zf@16
Ritor1
parents:
diff changeset
6190 char v10; // sf@16
Ritor1
parents:
diff changeset
6191 unsigned __int8 v11; // of@16
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6192 bool test;
0
Ritor1
parents:
diff changeset
6193
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6194 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771)
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6195 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen())
0
Ritor1
parents:
diff changeset
6196 return 0;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6197 switch( p2DEvents[_2da_idx - 1].uType )
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6198 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6199 case BildingType_WeaponShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6200 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6201 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6202 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6203 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6204 case BildingType_ArmorShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6205 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6206 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6207 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6208 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6209 case BildingType_MagicShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6210 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6211 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6212 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6213 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6214 case BildingType_AlchemistShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6215 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6216 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6217 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6218 || (signed int)item->uItemID < 740) && item->uItemID != 771);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6219 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6220 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6221 default:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6222 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6223 test = false;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6224 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6225 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6226 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6227 return test;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6228 /*
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6229 if ( p2DEvents[a2 - 1].uType == 1 )
0
Ritor1
parents:
diff changeset
6230 {
Ritor1
parents:
diff changeset
6231 v11 = __OFSUB__(v5, 2);
Ritor1
parents:
diff changeset
6232 v9 = v5 == 2;
Ritor1
parents:
diff changeset
6233 v10 = v5 - 2 < 0;
Ritor1
parents:
diff changeset
6234 goto LABEL_23;
Ritor1
parents:
diff changeset
6235 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6236 if ( p2DEvents[a2 - 1].uType > 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6237 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6238 if ( p2DEvents[a2 - 1].uType == 3 )
0
Ritor1
parents:
diff changeset
6239 {
Ritor1
parents:
diff changeset
6240 if ( pItemsTable->pItems[v4].uSkillType != 38 )
Ritor1
parents:
diff changeset
6241 return v5 == 16;
Ritor1
parents:
diff changeset
6242 return 1;
Ritor1
parents:
diff changeset
6243 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6244 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 )
0
Ritor1
parents:
diff changeset
6245 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6246 if ( p2DEvents[a2 - 1].uType == 4)
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6247 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6248 if ( v5 < 13 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6249 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6250 if ( v5 <= 14 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6251 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6252 if ( v5 != 17 || (signed int)v3 < 740 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6253 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6254 v11 = __OFSUB__(v3, 771);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6255 v9 = v3 == 771;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6256 v10 = ((v3 - 771) & 0x80000000u) != 0;
0
Ritor1
parents:
diff changeset
6257 LABEL_23:
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6258 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6259 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6260 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6261 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6262 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6263 if ( p2DEvents[a2 - 1].uType == 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6264 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6265 if ( v5 >= 3 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6266 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6267 v11 = __OFSUB__(v5, 9);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6268 v9 = v5 == 9;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6269 v10 = v5 - 9 < 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6270 goto LABEL_23;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6271 }
0
Ritor1
parents:
diff changeset
6272 }
Ritor1
parents:
diff changeset
6273 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
6274 */
0
Ritor1
parents:
diff changeset
6275 }
Ritor1
parents:
diff changeset
6276
1209
decc0dd6e4ba more on arcomage
Gloval
parents: 1206
diff changeset
6277
0
Ritor1
parents:
diff changeset
6278