annotate mm7_4.cpp @ 1424:5930342f092b

fall to the water
author Ritor1
date Tue, 30 Jul 2013 15:14:46 +0600
parents 9a1adf08f4ed
children dfc9484ed94c
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
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
16 #include "LightmapBuilder.h"
341
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
17 #include "MM7.h"
0
Ritor1
parents:
diff changeset
18 #include "MapInfo.h"
Ritor1
parents:
diff changeset
19 #include "Game.h"
Ritor1
parents:
diff changeset
20 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
21 #include "GUIFont.h"
Ritor1
parents:
diff changeset
22 #include "Party.h"
Ritor1
parents:
diff changeset
23 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
24 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1275
diff changeset
25 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
26 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
27 #include "LOD.h"
Ritor1
parents:
diff changeset
28 #include "Actor.h"
Ritor1
parents:
diff changeset
29 #include "Allocator.h"
Ritor1
parents:
diff changeset
30 #include "Events.h"
Ritor1
parents:
diff changeset
31 #include "Viewport.h"
Ritor1
parents:
diff changeset
32 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
33 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
34 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
35 #include "ObjectList.h"
Ritor1
parents:
diff changeset
36 #include "DecorationList.h"
Ritor1
parents:
diff changeset
37 #include "Time.h"
Ritor1
parents:
diff changeset
38 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
39 #include "PlayerFrameTable.h"
Ritor1
parents:
diff changeset
40 #include "Awards.h"
Ritor1
parents:
diff changeset
41 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
42 #include "Events2D.h"
Ritor1
parents:
diff changeset
43 #include "stru159.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 180
diff changeset
44 #include "texts.h"
0
Ritor1
parents:
diff changeset
45 #include "Log.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1295
diff changeset
46 #include "UI\UIHouses.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
47 #include "Lights.h"
0
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 //----- (0046CC4B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
50 void __cdecl check_event_triggers()
0
Ritor1
parents:
diff changeset
51 {
Ritor1
parents:
diff changeset
52 int v0; // eax@1
Ritor1
parents:
diff changeset
53 LevelDecoration *v1; // esi@2
Ritor1
parents:
diff changeset
54 signed int v2; // edi@2
Ritor1
parents:
diff changeset
55 int v3; // ebx@2
Ritor1
parents:
diff changeset
56 int v4; // eax@3
Ritor1
parents:
diff changeset
57 int v5; // ebx@3
Ritor1
parents:
diff changeset
58 unsigned int v6; // ecx@3
Ritor1
parents:
diff changeset
59 unsigned int v7; // edx@6
Ritor1
parents:
diff changeset
60 unsigned int v8; // edx@8
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
61 Actor *v9; // edi@13
0
Ritor1
parents:
diff changeset
62 int v10; // ebx@14
Ritor1
parents:
diff changeset
63 int v11; // eax@14
Ritor1
parents:
diff changeset
64 int v12; // ebx@14
Ritor1
parents:
diff changeset
65 unsigned int v13; // ecx@14
Ritor1
parents:
diff changeset
66 int v14; // edx@15
Ritor1
parents:
diff changeset
67 unsigned int v15; // edx@17
Ritor1
parents:
diff changeset
68 unsigned int v16; // edx@19
Ritor1
parents:
diff changeset
69 char *v17; // edi@25
Ritor1
parents:
diff changeset
70 int v18; // ebx@26
Ritor1
parents:
diff changeset
71 int v19; // eax@26
Ritor1
parents:
diff changeset
72 int v20; // ebx@26
Ritor1
parents:
diff changeset
73 unsigned int v21; // ecx@26
Ritor1
parents:
diff changeset
74 int v22; // edx@27
Ritor1
parents:
diff changeset
75 unsigned int v23; // edx@29
Ritor1
parents:
diff changeset
76 unsigned int v24; // edx@31
Ritor1
parents:
diff changeset
77 int v25; // [sp+0h] [bp-24h]@3
Ritor1
parents:
diff changeset
78 int v26; // [sp+0h] [bp-24h]@14
Ritor1
parents:
diff changeset
79 int v27; // [sp+0h] [bp-24h]@26
Ritor1
parents:
diff changeset
80 int v28; // [sp+4h] [bp-20h]@3
Ritor1
parents:
diff changeset
81 int v29; // [sp+4h] [bp-20h]@14
Ritor1
parents:
diff changeset
82 int v30; // [sp+4h] [bp-20h]@26
Ritor1
parents:
diff changeset
83 signed int v31; // [sp+8h] [bp-1Ch]@2
Ritor1
parents:
diff changeset
84 int v32; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
85 int v33; // [sp+10h] [bp-14h]@2
Ritor1
parents:
diff changeset
86 int i; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
87 int v35; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
88 int v36; // [sp+1Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
89 signed int v37; // [sp+1Ch] [bp-8h]@12
Ritor1
parents:
diff changeset
90 signed int v38; // [sp+20h] [bp-4h]@24
Ritor1
parents:
diff changeset
91
Ritor1
parents:
diff changeset
92 v0 = 0;
Ritor1
parents:
diff changeset
93 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i )
Ritor1
parents:
diff changeset
94 {
Ritor1
parents:
diff changeset
95 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]];
Ritor1
parents:
diff changeset
96 v2 = v1->field_18;
Ritor1
parents:
diff changeset
97 v3 = v1->vPosition.y;
Ritor1
parents:
diff changeset
98 v33 = v1->vPosition.x;
Ritor1
parents:
diff changeset
99 v32 = v1->vPosition.y;
Ritor1
parents:
diff changeset
100 v35 = v1->vPosition.z;
Ritor1
parents:
diff changeset
101 v31 = v1->field_18;
Ritor1
parents:
diff changeset
102 if ( v1->field_2 & 1 )
Ritor1
parents:
diff changeset
103 {
Ritor1
parents:
diff changeset
104 v36 = abs(v1->vPosition.x - pParty->vPosition.x);
Ritor1
parents:
diff changeset
105 v25 = abs(v3 - pParty->vPosition.y);
Ritor1
parents:
diff changeset
106 v28 = abs(v35 - pParty->vPosition.z);
Ritor1
parents:
diff changeset
107 v4 = v36;
Ritor1
parents:
diff changeset
108 v5 = v25;
Ritor1
parents:
diff changeset
109 v6 = v28;
Ritor1
parents:
diff changeset
110 if ( v36 < v25 )
Ritor1
parents:
diff changeset
111 {
Ritor1
parents:
diff changeset
112 v4 = v25;
Ritor1
parents:
diff changeset
113 v5 = v36;
Ritor1
parents:
diff changeset
114 }
Ritor1
parents:
diff changeset
115 if ( v4 < v28 )
Ritor1
parents:
diff changeset
116 {
Ritor1
parents:
diff changeset
117 v7 = v4;
Ritor1
parents:
diff changeset
118 v4 = v28;
Ritor1
parents:
diff changeset
119 v6 = v7;
Ritor1
parents:
diff changeset
120 }
Ritor1
parents:
diff changeset
121 if ( v5 < (signed int)v6 )
Ritor1
parents:
diff changeset
122 {
Ritor1
parents:
diff changeset
123 v8 = v6;
Ritor1
parents:
diff changeset
124 v6 = v5;
Ritor1
parents:
diff changeset
125 v5 = v8;
Ritor1
parents:
diff changeset
126 }
Ritor1
parents:
diff changeset
127 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 )
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
128 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1);
0
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 if ( v1->field_2 & 2 )
Ritor1
parents:
diff changeset
131 {
Ritor1
parents:
diff changeset
132 v37 = 0;
Ritor1
parents:
diff changeset
133 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
134 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
135 v9 = pActors.data();//[0].vPosition.y;
0
Ritor1
parents:
diff changeset
136 do
Ritor1
parents:
diff changeset
137 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
138 v10 = abs(v33 - v9->vPosition.x);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
139 v29 = abs(v32 - v9->vPosition.y);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
140 v26 = abs(v35 - v9->vPosition.z);
0
Ritor1
parents:
diff changeset
141 v11 = v10;
Ritor1
parents:
diff changeset
142 v12 = v29;
Ritor1
parents:
diff changeset
143 v13 = v26;
Ritor1
parents:
diff changeset
144 if ( v11 < v29 )
Ritor1
parents:
diff changeset
145 {
Ritor1
parents:
diff changeset
146 v14 = v11;
Ritor1
parents:
diff changeset
147 v11 = v29;
Ritor1
parents:
diff changeset
148 v12 = v14;
Ritor1
parents:
diff changeset
149 }
Ritor1
parents:
diff changeset
150 if ( v11 < v26 )
Ritor1
parents:
diff changeset
151 {
Ritor1
parents:
diff changeset
152 v15 = v11;
Ritor1
parents:
diff changeset
153 v11 = v26;
Ritor1
parents:
diff changeset
154 v13 = v15;
Ritor1
parents:
diff changeset
155 }
Ritor1
parents:
diff changeset
156 if ( v12 < (signed int)v13 )
Ritor1
parents:
diff changeset
157 {
Ritor1
parents:
diff changeset
158 v16 = v13;
Ritor1
parents:
diff changeset
159 v13 = v12;
Ritor1
parents:
diff changeset
160 v12 = v16;
Ritor1
parents:
diff changeset
161 }
Ritor1
parents:
diff changeset
162 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 )
Ritor1
parents:
diff changeset
163 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
164 ++v37;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
165 ++v9;
0
Ritor1
parents:
diff changeset
166 }
Ritor1
parents:
diff changeset
167 while ( v37 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169 }
Ritor1
parents:
diff changeset
170 if ( v1->field_2 & 4 )
Ritor1
parents:
diff changeset
171 {
Ritor1
parents:
diff changeset
172 v38 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
173 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
174 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
175 v17 = (char *)&pSpriteObjects[0].vPosition.y;
0
Ritor1
parents:
diff changeset
176 do
Ritor1
parents:
diff changeset
177 {
Ritor1
parents:
diff changeset
178 v18 = abs(v33 - *((int *)v17 - 1));
Ritor1
parents:
diff changeset
179 v30 = abs(v32 - *(int *)v17);
Ritor1
parents:
diff changeset
180 v27 = abs(v35 - *((int *)v17 + 1));
Ritor1
parents:
diff changeset
181 v19 = v18;
Ritor1
parents:
diff changeset
182 v20 = v30;
Ritor1
parents:
diff changeset
183 v21 = v27;
Ritor1
parents:
diff changeset
184 if ( v19 < v30 )
Ritor1
parents:
diff changeset
185 {
Ritor1
parents:
diff changeset
186 v22 = v19;
Ritor1
parents:
diff changeset
187 v19 = v30;
Ritor1
parents:
diff changeset
188 v20 = v22;
Ritor1
parents:
diff changeset
189 }
Ritor1
parents:
diff changeset
190 if ( v19 < v27 )
Ritor1
parents:
diff changeset
191 {
Ritor1
parents:
diff changeset
192 v23 = v19;
Ritor1
parents:
diff changeset
193 v19 = v27;
Ritor1
parents:
diff changeset
194 v21 = v23;
Ritor1
parents:
diff changeset
195 }
Ritor1
parents:
diff changeset
196 if ( v20 < (signed int)v21 )
Ritor1
parents:
diff changeset
197 {
Ritor1
parents:
diff changeset
198 v24 = v21;
Ritor1
parents:
diff changeset
199 v21 = v20;
Ritor1
parents:
diff changeset
200 v20 = v24;
Ritor1
parents:
diff changeset
201 }
Ritor1
parents:
diff changeset
202 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 )
Ritor1
parents:
diff changeset
203 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
204 ++v38;
Ritor1
parents:
diff changeset
205 v17 += 112;
Ritor1
parents:
diff changeset
206 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
207 while ( v38 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
208 }
Ritor1
parents:
diff changeset
209 }
Ritor1
parents:
diff changeset
210 v0 = i + 1;
Ritor1
parents:
diff changeset
211 }
Ritor1
parents:
diff changeset
212 }
Ritor1
parents:
diff changeset
213 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
Ritor1
parents:
diff changeset
214
Ritor1
parents:
diff changeset
215 //----- (0046D8E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
216 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4)
Ritor1
parents:
diff changeset
217 {
Ritor1
parents:
diff changeset
218 int v4; // ebx@1
Ritor1
parents:
diff changeset
219 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
220 BSPModel *v6; // edi@3
Ritor1
parents:
diff changeset
221 ODMFace *v7; // esi@10
Ritor1
parents:
diff changeset
222 unsigned __int8 v8; // al@10
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 659
diff changeset
223 signed __int16 *v9; // eax@18
0
Ritor1
parents:
diff changeset
224 int v10; // edx@19
Ritor1
parents:
diff changeset
225 int v11; // ecx@21
Ritor1
parents:
diff changeset
226 int v12; // ecx@23
Ritor1
parents:
diff changeset
227 signed int v13; // eax@25
Ritor1
parents:
diff changeset
228 int v14; // edx@27
Ritor1
parents:
diff changeset
229 int v15; // edx@29
Ritor1
parents:
diff changeset
230 int v16; // ST18_4@29
Ritor1
parents:
diff changeset
231 signed int v17; // edx@29
Ritor1
parents:
diff changeset
232 signed __int64 v18; // qtt@29
Ritor1
parents:
diff changeset
233 int v19; // eax@35
Ritor1
parents:
diff changeset
234 signed int v20; // ecx@37
Ritor1
parents:
diff changeset
235 signed int v22; // ebx@42
Ritor1
parents:
diff changeset
236 unsigned int v23; // esi@43
Ritor1
parents:
diff changeset
237 int v24; // edx@44
Ritor1
parents:
diff changeset
238 int v25; // eax@44
Ritor1
parents:
diff changeset
239 int v26; // [sp+Ch] [bp-38h]@7
Ritor1
parents:
diff changeset
240 int v27; // [sp+10h] [bp-34h]@21
Ritor1
parents:
diff changeset
241 int v28; // [sp+18h] [bp-2Ch]@21
Ritor1
parents:
diff changeset
242 int v29; // [sp+1Ch] [bp-28h]@2
Ritor1
parents:
diff changeset
243 unsigned int v30; // [sp+20h] [bp-24h]@8
Ritor1
parents:
diff changeset
244 signed int v31; // [sp+24h] [bp-20h]@1
Ritor1
parents:
diff changeset
245 signed int v32; // [sp+28h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
246 int v33; // [sp+2Ch] [bp-18h]@7
Ritor1
parents:
diff changeset
247 bool v34; // [sp+30h] [bp-14h]@21
Ritor1
parents:
diff changeset
248 bool v35; // [sp+34h] [bp-10h]@23
Ritor1
parents:
diff changeset
249 signed int v36; // [sp+38h] [bp-Ch]@17
Ritor1
parents:
diff changeset
250 signed int v37; // [sp+38h] [bp-Ch]@21
Ritor1
parents:
diff changeset
251 signed int v38; // [sp+38h] [bp-Ch]@42
Ritor1
parents:
diff changeset
252 signed int v39; // [sp+3Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
253 signed int v40; // [sp+40h] [bp-4h]@1
Ritor1
parents:
diff changeset
254
Ritor1
parents:
diff changeset
255 dword_720ED0[0] = -1;
Ritor1
parents:
diff changeset
256 dword_720E80[0] = -1;
Ritor1
parents:
diff changeset
257 v4 = a1;
Ritor1
parents:
diff changeset
258 v5 = 0;
Ritor1
parents:
diff changeset
259 v40 = a2;
Ritor1
parents:
diff changeset
260 v31 = v4;
Ritor1
parents:
diff changeset
261 v39 = 1;
Ritor1
parents:
diff changeset
262 dword_720F20[0] = 10000;
Ritor1
parents:
diff changeset
263 v32 = 0;
Ritor1
parents:
diff changeset
264 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
265 {
Ritor1
parents:
diff changeset
266 v29 = 0;
Ritor1
parents:
diff changeset
267 do
Ritor1
parents:
diff changeset
268 {
Ritor1
parents:
diff changeset
269 v6 = &pOutdoor->pBModels[v29];
Ritor1
parents:
diff changeset
270 if ( v4 <= pOutdoor->pBModels[v29].sMaxX )
Ritor1
parents:
diff changeset
271 {
Ritor1
parents:
diff changeset
272 if ( v4 >= v6->sMinX )
Ritor1
parents:
diff changeset
273 {
Ritor1
parents:
diff changeset
274 if ( v40 <= v6->sMaxY )
Ritor1
parents:
diff changeset
275 {
Ritor1
parents:
diff changeset
276 if ( v40 >= v6->sMinY )
Ritor1
parents:
diff changeset
277 {
Ritor1
parents:
diff changeset
278 v33 = v5;
Ritor1
parents:
diff changeset
279 v26 = v6->uNumFaces;
Ritor1
parents:
diff changeset
280 if ( (signed int)v6->uNumFaces > (signed int)v5 )
Ritor1
parents:
diff changeset
281 {
Ritor1
parents:
diff changeset
282 v30 = v5;
Ritor1
parents:
diff changeset
283 while ( 1 )
Ritor1
parents:
diff changeset
284 {
Ritor1
parents:
diff changeset
285 v7 = (ODMFace *)((char *)v6->pFaces + v30);
Ritor1
parents:
diff changeset
286 v8 = v7->uPolygonType;
Ritor1
parents:
diff changeset
287 if ( (v8 == 5 || v8 == 6)
Ritor1
parents:
diff changeset
288 && !(BYTE3(v7->uAttributes) & 0x20)
Ritor1
parents:
diff changeset
289 && v4 <= v7->pBoundingBox.x2
Ritor1
parents:
diff changeset
290 && v4 >= v7->pBoundingBox.x1
Ritor1
parents:
diff changeset
291 && v40 <= v7->pBoundingBox.y2
Ritor1
parents:
diff changeset
292 && v40 >= v7->pBoundingBox.y1 )
Ritor1
parents:
diff changeset
293 {
Ritor1
parents:
diff changeset
294 v36 = v5;
Ritor1
parents:
diff changeset
295 if ( v7->uNumVertices )
Ritor1
parents:
diff changeset
296 {
Ritor1
parents:
diff changeset
297 v9 = v7->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
298 do
Ritor1
parents:
diff changeset
299 {
Ritor1
parents:
diff changeset
300 v10 = 2 * v36;
Ritor1
parents:
diff changeset
301 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x);
Ritor1
parents:
diff changeset
302 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y);
Ritor1
parents:
diff changeset
303 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x);
Ritor1
parents:
diff changeset
304 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y);
Ritor1
parents:
diff changeset
305 ++v9;
Ritor1
parents:
diff changeset
306 }
Ritor1
parents:
diff changeset
307 while ( v36 < v7->uNumVertices );
Ritor1
parents:
diff changeset
308 v4 = v31;
Ritor1
parents:
diff changeset
309 }
Ritor1
parents:
diff changeset
310 v27 = 2 * v7->uNumVertices;
Ritor1
parents:
diff changeset
311 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0];
Ritor1
parents:
diff changeset
312 word_720CE0_ys[v27] = word_720CE0_ys[0];
Ritor1
parents:
diff changeset
313 v11 = 0;
Ritor1
parents:
diff changeset
314 v34 = word_720CE0_ys[0] >= v40;
Ritor1
parents:
diff changeset
315 v37 = 0;
Ritor1
parents:
diff changeset
316 v28 = 0;
Ritor1
parents:
diff changeset
317 if ( v27 > 0 )
Ritor1
parents:
diff changeset
318 {
Ritor1
parents:
diff changeset
319 do
Ritor1
parents:
diff changeset
320 {
Ritor1
parents:
diff changeset
321 if ( v37 >= 2 )
Ritor1
parents:
diff changeset
322 break;
Ritor1
parents:
diff changeset
323 v12 = v11;
Ritor1
parents:
diff changeset
324 v4 = v31;
Ritor1
parents:
diff changeset
325 v35 = word_720CE0_ys[v12 + 1] >= v40;
Ritor1
parents:
diff changeset
326 if ( v34 != v35 )
Ritor1
parents:
diff changeset
327 {
Ritor1
parents:
diff changeset
328 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
329 v14 = v13 | (word_720DB0_xs[v12] < v31);
0
Ritor1
parents:
diff changeset
330 if ( v14 != 3 )
Ritor1
parents:
diff changeset
331 {
Ritor1
parents:
diff changeset
332 if ( !v14
Ritor1
parents:
diff changeset
333 || (v15 = word_720CE0_ys[v12],
Ritor1
parents:
diff changeset
334 v16 = word_720CE0_ys[v12 + 1] - v15,
Ritor1
parents:
diff changeset
335 v17 = v40 - v15,
Ritor1
parents:
diff changeset
336 LODWORD(v18) = v17 << 16,
Ritor1
parents:
diff changeset
337 HIDWORD(v18) = v17 >> 16,
Ritor1
parents:
diff changeset
338 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1]
Ritor1
parents:
diff changeset
339 - (signed int)word_720DB0_xs[v12])
Ritor1
parents:
diff changeset
340 * v18
Ritor1
parents:
diff changeset
341 / v16) >> 16)
Ritor1
parents:
diff changeset
342 + word_720DB0_xs[v12]) >= v31) )
Ritor1
parents:
diff changeset
343 ++v37;
Ritor1
parents:
diff changeset
344 }
Ritor1
parents:
diff changeset
345 }
Ritor1
parents:
diff changeset
346 v11 = v28 + 1;
Ritor1
parents:
diff changeset
347 v34 = v35;
Ritor1
parents:
diff changeset
348 ++v28;
Ritor1
parents:
diff changeset
349 }
Ritor1
parents:
diff changeset
350 while ( v28 < v27 );
Ritor1
parents:
diff changeset
351 if ( v37 == 1 )
Ritor1
parents:
diff changeset
352 {
Ritor1
parents:
diff changeset
353 if ( v39 >= 20 )
Ritor1
parents:
diff changeset
354 break;
Ritor1
parents:
diff changeset
355 if ( v7->uPolygonType == 5 )
Ritor1
parents:
diff changeset
356 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z;
Ritor1
parents:
diff changeset
357 else
Ritor1
parents:
diff changeset
358 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16)
Ritor1
parents:
diff changeset
359 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16)
Ritor1
parents:
diff changeset
360 + HIWORD(v7->zCalc3);
Ritor1
parents:
diff changeset
361 v20 = v39++;
Ritor1
parents:
diff changeset
362 dword_720F20[v20] = v19;
Ritor1
parents:
diff changeset
363 dword_720ED0[v20] = v32;
Ritor1
parents:
diff changeset
364 dword_720E80[v20] = v33;
Ritor1
parents:
diff changeset
365 }
Ritor1
parents:
diff changeset
366 }
Ritor1
parents:
diff changeset
367 }
Ritor1
parents:
diff changeset
368 ++v33;
Ritor1
parents:
diff changeset
369 v30 += 308;
Ritor1
parents:
diff changeset
370 if ( v33 >= v26 )
Ritor1
parents:
diff changeset
371 break;
Ritor1
parents:
diff changeset
372 v5 = 0;
Ritor1
parents:
diff changeset
373 }
Ritor1
parents:
diff changeset
374 }
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 ++v32;
Ritor1
parents:
diff changeset
380 ++v29;
Ritor1
parents:
diff changeset
381 v5 = 0;
Ritor1
parents:
diff changeset
382 }
Ritor1
parents:
diff changeset
383 while ( v32 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
384 if ( !v39 )
Ritor1
parents:
diff changeset
385 {
Ritor1
parents:
diff changeset
386 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
387 return dword_720F20[0];
Ritor1
parents:
diff changeset
388 }
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390 v22 = 0;
Ritor1
parents:
diff changeset
391 v38 = v5;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
392 if ( v39 > (signed int)v5 )
0
Ritor1
parents:
diff changeset
393 {
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
394 v23 = 0;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
395 do
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
396 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
397 v24 = dword_720F20[v5 / 4];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
398 v25 = *(int *)((char *)dword_720F20.data() + v23);
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
399 if ( v24 == v25 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
400 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
401 v22 = v38;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
402 v23 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
403 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
404 else if ( v25 > a3 + 15 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
405 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
406 if ( v24 < v25 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
407 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
408 v22 = v38;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
409 v23 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
410 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
411 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
412 else if ( v24 > v25 && v24 <= a3 + 15 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
413 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
414 v22 = v38;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
415 v23 = v5;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
416 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
417 ++v38;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
418 v5 += 4;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
419 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
420 while ( v38 < v39 );
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
421 if ( v22 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
422 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
423 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
424 return dword_720F20[v22];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
425 }
0
Ritor1
parents:
diff changeset
426 }
Ritor1
parents:
diff changeset
427 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
428 return dword_720F20[v22];
Ritor1
parents:
diff changeset
429 }
Ritor1
parents:
diff changeset
430
Ritor1
parents:
diff changeset
431 //----- (0046DEF2) --------------------------------------------------------
Ritor1
parents:
diff changeset
432 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
433 {
Ritor1
parents:
diff changeset
434 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
435
Ritor1
parents:
diff changeset
436 result = uLayingItemID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
437 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 )
0
Ritor1
parents:
diff changeset
438 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
Ritor1
parents:
diff changeset
439 return result;
Ritor1
parents:
diff changeset
440 }
Ritor1
parents:
diff changeset
441
Ritor1
parents:
diff changeset
442 //----- (0046E0B2) --------------------------------------------------------
Ritor1
parents:
diff changeset
443 void __cdecl _46E0B2_collide_against_decorations()
Ritor1
parents:
diff changeset
444 {
Ritor1
parents:
diff changeset
445 BLVSector *v0; // ebp@1
Ritor1
parents:
diff changeset
446 LevelDecoration *v1; // edi@2
Ritor1
parents:
diff changeset
447 DecorationDesc *v2; // esi@3
Ritor1
parents:
diff changeset
448 int v3; // edx@4
Ritor1
parents:
diff changeset
449 int v4; // eax@4
Ritor1
parents:
diff changeset
450 int v5; // ecx@6
Ritor1
parents:
diff changeset
451 int v6; // ebx@8
Ritor1
parents:
diff changeset
452 int v7; // esi@8
Ritor1
parents:
diff changeset
453 int v8; // ebx@10
Ritor1
parents:
diff changeset
454 int v9; // esi@11
Ritor1
parents:
diff changeset
455 int v10; // edi@12
Ritor1
parents:
diff changeset
456 int v11; // eax@12
Ritor1
parents:
diff changeset
457 int v12; // esi@14
Ritor1
parents:
diff changeset
458 unsigned int v13; // eax@17
Ritor1
parents:
diff changeset
459 signed int i; // [sp+4h] [bp-14h]@1
Ritor1
parents:
diff changeset
460 int v15; // [sp+8h] [bp-10h]@10
Ritor1
parents:
diff changeset
461 int v16; // [sp+Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
462 int v17; // [sp+10h] [bp-8h]@10
Ritor1
parents:
diff changeset
463 int v18; // [sp+14h] [bp-4h]@8
Ritor1
parents:
diff changeset
464
Ritor1
parents:
diff changeset
465 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
466 for ( i = 0; i < v0->uNumDecorations; ++i )
Ritor1
parents:
diff changeset
467 {
Ritor1
parents:
diff changeset
468 v1 = &pLevelDecorations[v0->pDecorationIDs[i]];
Ritor1
parents:
diff changeset
469 if ( !(v1->field_2 & 0x20) )
Ritor1
parents:
diff changeset
470 {
Ritor1
parents:
diff changeset
471 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
472 if (!v2->CanMoveThrough())
0
Ritor1
parents:
diff changeset
473 {
Ritor1
parents:
diff changeset
474 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
475 v4 = v1->vPosition.x;
Ritor1
parents:
diff changeset
476 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
477 {
Ritor1
parents:
diff changeset
478 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
479 {
Ritor1
parents:
diff changeset
480 v5 = v1->vPosition.y;
Ritor1
parents:
diff changeset
481 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
482 {
Ritor1
parents:
diff changeset
483 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
484 {
Ritor1
parents:
diff changeset
485 v6 = v2->uDecorationHeight;
Ritor1
parents:
diff changeset
486 v7 = v1->vPosition.z;
Ritor1
parents:
diff changeset
487 v18 = v6;
Ritor1
parents:
diff changeset
488 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
489 {
Ritor1
parents:
diff changeset
490 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
491 {
Ritor1
parents:
diff changeset
492 v16 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
493 v15 = v5 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
494 v8 = stru_721530.prolly_normal_d + v3;
Ritor1
parents:
diff changeset
495 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
496 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
497 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 )
Ritor1
parents:
diff changeset
498 {
Ritor1
parents:
diff changeset
499 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
500 if ( v9 > 0 )
Ritor1
parents:
diff changeset
501 {
Ritor1
parents:
diff changeset
502 v10 = v1->vPosition.z;
Ritor1
parents:
diff changeset
503 v11 = stru_721530.normal.z
Ritor1
parents:
diff changeset
504 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16);
Ritor1
parents:
diff changeset
505 if ( v11 >= v10 )
Ritor1
parents:
diff changeset
506 {
Ritor1
parents:
diff changeset
507 if ( v11 <= v18 + v10 )
Ritor1
parents:
diff changeset
508 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
509 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17);
0
Ritor1
parents:
diff changeset
510 if ( v12 < 0 )
Ritor1
parents:
diff changeset
511 v12 = 0;
Ritor1
parents:
diff changeset
512 if ( v12 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
513 {
Ritor1
parents:
diff changeset
514 stru_721530.field_7C = v12;
Ritor1
parents:
diff changeset
515 v13 = 8 * v0->pDecorationIDs[i];
Ritor1
parents:
diff changeset
516 LOBYTE(v13) = v13 | 5;
Ritor1
parents:
diff changeset
517 stru_721530.uFaceID = v13;
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 }
Ritor1
parents:
diff changeset
533
Ritor1
parents:
diff changeset
534 //----- (00487DA9) --------------------------------------------------------
Ritor1
parents:
diff changeset
535 void __cdecl sub_487DA9()
Ritor1
parents:
diff changeset
536 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
537 for (int i = 0; i < 20000; ++i)
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
538 array_77EC08[i].field_108 = 0;
0
Ritor1
parents:
diff changeset
539 }
Ritor1
parents:
diff changeset
540
Ritor1
parents:
diff changeset
541 //----- (00487DBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
542 void Software_ResetNewEdges()
Ritor1
parents:
diff changeset
543 {
Ritor1
parents:
diff changeset
544 int v0; // ecx@1
Ritor1
parents:
diff changeset
545 Edge **v1; // eax@1
Ritor1
parents:
diff changeset
546 signed int v2; // eax@3
Ritor1
parents:
diff changeset
547
Ritor1
parents:
diff changeset
548 v0 = 0;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
549 v1 = ptr_80CA10.data();
0
Ritor1
parents:
diff changeset
550 do
Ritor1
parents:
diff changeset
551 {
Ritor1
parents:
diff changeset
552 ++v0;
Ritor1
parents:
diff changeset
553 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
Ritor1
parents:
diff changeset
554 *v1 = 0;
Ritor1
parents:
diff changeset
555 ++v1;
Ritor1
parents:
diff changeset
556 }
Ritor1
parents:
diff changeset
557 while ( (signed int)v1 < (signed int)&unk_80D190 );
Ritor1
parents:
diff changeset
558 v2 = 2000;
Ritor1
parents:
diff changeset
559 do
Ritor1
parents:
diff changeset
560 {
Ritor1
parents:
diff changeset
561 pSurfs->field_22 = 0;
Ritor1
parents:
diff changeset
562 --v2;
Ritor1
parents:
diff changeset
563 }
Ritor1
parents:
diff changeset
564 while ( v2 );
Ritor1
parents:
diff changeset
565 }
Ritor1
parents:
diff changeset
566
Ritor1
parents:
diff changeset
567 //----- (0048A959) --------------------------------------------------------
Ritor1
parents:
diff changeset
568 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
Ritor1
parents:
diff changeset
569 {
Ritor1
parents:
diff changeset
570 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
Ritor1
parents:
diff changeset
571 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
Ritor1
parents:
diff changeset
572 b = (uColor & 0x000000FF) / 255.0f;
Ritor1
parents:
diff changeset
573
Ritor1
parents:
diff changeset
574 float h, s, v;
Ritor1
parents:
diff changeset
575 RGB2HSV(&h, &s, r, g, b, &v);
Ritor1
parents:
diff changeset
576
Ritor1
parents:
diff changeset
577 if ( h_replace != -1.0 )
Ritor1
parents:
diff changeset
578 h = h_replace;
Ritor1
parents:
diff changeset
579 if ( s_replace != -1.0 )
Ritor1
parents:
diff changeset
580 s = s_replace;
Ritor1
parents:
diff changeset
581 if ( v_replace != -1.0 )
Ritor1
parents:
diff changeset
582 v = v_replace;
Ritor1
parents:
diff changeset
583 HSV2RGB(&r, &g, &b, h, s, v);
Ritor1
parents:
diff changeset
584
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
585 return (((uint)round(r * 255.0f) & 0xFF) << 16) |
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
586 (((uint)round(g * 255.0f) & 0xFF) << 8) |
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
587 (((uint)round(b * 255.0f) & 0xFF));
0
Ritor1
parents:
diff changeset
588 }
Ritor1
parents:
diff changeset
589
Ritor1
parents:
diff changeset
590 //----- (0048B561) --------------------------------------------------------
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
591 int fixpoint_from_float(float val)
0
Ritor1
parents:
diff changeset
592 {
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
593 // float X.Yf -> int XXXX YYYY
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
594 int left = floorf((val - 0.5f) + 0.5f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
595 int right = floorf((val - left) * 65536.0f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
596 return (left << 16) | right;
0
Ritor1
parents:
diff changeset
597 }
Ritor1
parents:
diff changeset
598
Ritor1
parents:
diff changeset
599 //----- (00491E3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
600 void __cdecl sub_491E3A()
Ritor1
parents:
diff changeset
601 {
Ritor1
parents:
diff changeset
602 Player *v0; // ebx@1
Ritor1
parents:
diff changeset
603 signed int v1; // esi@3
Ritor1
parents:
diff changeset
604 char *v2; // eax@4
Ritor1
parents:
diff changeset
605 unsigned int v3; // eax@7
Ritor1
parents:
diff changeset
606 unsigned int v4; // edx@8
Ritor1
parents:
diff changeset
607 char *v5; // ecx@9
Ritor1
parents:
diff changeset
608 int v6; // edi@17
Ritor1
parents:
diff changeset
609 Texture *v7; // ebx@18
Ritor1
parents:
diff changeset
610 struct IDirect3DTexture2 **v8; // eax@19
Ritor1
parents:
diff changeset
611 struct IDirect3DTexture2 *v9; // eax@20
Ritor1
parents:
diff changeset
612 struct IDirectDrawSurface **v10; // eax@22
Ritor1
parents:
diff changeset
613 struct IDirectDrawSurface *v11; // eax@23
Ritor1
parents:
diff changeset
614 int v12; // eax@26
Ritor1
parents:
diff changeset
615
Ritor1
parents:
diff changeset
616 v0 = pParty->pPlayers;
Ritor1
parents:
diff changeset
617 do
Ritor1
parents:
diff changeset
618 {
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
619 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
620 {
Ritor1
parents:
diff changeset
621 v1 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
622 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
623 {
Ritor1
parents:
diff changeset
624 LABEL_7:
Ritor1
parents:
diff changeset
625 v3 = 0;
Ritor1
parents:
diff changeset
626 }
Ritor1
parents:
diff changeset
627 else
Ritor1
parents:
diff changeset
628 {
Ritor1
parents:
diff changeset
629 v2 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
630 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 )
0
Ritor1
parents:
diff changeset
631 {
Ritor1
parents:
diff changeset
632 ++v1;
Ritor1
parents:
diff changeset
633 v2 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
634 if ( v1 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
635 goto LABEL_7;
Ritor1
parents:
diff changeset
636 }
Ritor1
parents:
diff changeset
637 v3 = v1;
Ritor1
parents:
diff changeset
638 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
639 pSoundList->UnloadSound(v3, 1);
0
Ritor1
parents:
diff changeset
640 v4 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
641 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
642 {
Ritor1
parents:
diff changeset
643 LABEL_12:
Ritor1
parents:
diff changeset
644 v4 = 0;
Ritor1
parents:
diff changeset
645 }
Ritor1
parents:
diff changeset
646 else
Ritor1
parents:
diff changeset
647 {
Ritor1
parents:
diff changeset
648 v5 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
649 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 )
0
Ritor1
parents:
diff changeset
650 {
Ritor1
parents:
diff changeset
651 ++v4;
Ritor1
parents:
diff changeset
652 v5 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
653 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
654 goto LABEL_12;
Ritor1
parents:
diff changeset
655 }
Ritor1
parents:
diff changeset
656 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
657 pSoundList->UnloadSound(v4, 1);
0
Ritor1
parents:
diff changeset
658 }
Ritor1
parents:
diff changeset
659 ++v0;
Ritor1
parents:
diff changeset
660 }
Ritor1
parents:
diff changeset
661 while ( (signed int)v0 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
662 v6 = pIcons_LOD->uNumLoadedFiles - 1;
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
663 if ( v6 >= pIcons_LOD->pFacesLock )
0
Ritor1
parents:
diff changeset
664 {
Ritor1
parents:
diff changeset
665 v7 = &pIcons_LOD->pTextures[v6];
Ritor1
parents:
diff changeset
666 do
Ritor1
parents:
diff changeset
667 {
Ritor1
parents:
diff changeset
668 v7->Release();
Ritor1
parents:
diff changeset
669 v8 = pIcons_LOD->pHardwareTextures;
Ritor1
parents:
diff changeset
670 if ( v8 )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 v9 = v8[v6];
Ritor1
parents:
diff changeset
673 if ( v9 )
Ritor1
parents:
diff changeset
674 {
Ritor1
parents:
diff changeset
675 v9->Release();
Ritor1
parents:
diff changeset
676 pIcons_LOD->pHardwareTextures[v6] = 0;
Ritor1
parents:
diff changeset
677 }
Ritor1
parents:
diff changeset
678 }
Ritor1
parents:
diff changeset
679 v10 = pIcons_LOD->pHardwareSurfaces;
Ritor1
parents:
diff changeset
680 if ( v10 )
Ritor1
parents:
diff changeset
681 {
Ritor1
parents:
diff changeset
682 v11 = v10[v6];
Ritor1
parents:
diff changeset
683 if ( v11 )
Ritor1
parents:
diff changeset
684 {
Ritor1
parents:
diff changeset
685 v11->Release();
Ritor1
parents:
diff changeset
686 pIcons_LOD->pHardwareSurfaces[v6] = 0;
Ritor1
parents:
diff changeset
687 }
Ritor1
parents:
diff changeset
688 }
Ritor1
parents:
diff changeset
689 --v6;
Ritor1
parents:
diff changeset
690 --v7;
Ritor1
parents:
diff changeset
691 }
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
692 while ( v6 >= pIcons_LOD->pFacesLock );
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
693 }
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
694 v12 = pIcons_LOD->pFacesLock;
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
695 pIcons_LOD->pFacesLock = 0;
0
Ritor1
parents:
diff changeset
696 pIcons_LOD->uNumLoadedFiles = v12;
Ritor1
parents:
diff changeset
697 }
Ritor1
parents:
diff changeset
698 // 4ED498: using guessed type char byte_4ED498;
Ritor1
parents:
diff changeset
699
Ritor1
parents:
diff changeset
700 //----- (00493938) --------------------------------------------------------
Ritor1
parents:
diff changeset
701 int __cdecl _493938_regenerate()
Ritor1
parents:
diff changeset
702 {
Ritor1
parents:
diff changeset
703 int v0; // edi@1
Ritor1
parents:
diff changeset
704 signed __int64 v1; // qax@1
Ritor1
parents:
diff changeset
705 int v2; // ecx@1
Ritor1
parents:
diff changeset
706 int result; // eax@1
Ritor1
parents:
diff changeset
707 int v4; // eax@2
Ritor1
parents:
diff changeset
708 int v5; // edi@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
709 int *v6; // ecx@5
0
Ritor1
parents:
diff changeset
710 char v7; // sf@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
711 int *v8; // ecx@10
0
Ritor1
parents:
diff changeset
712 int v9; // edi@15
Ritor1
parents:
diff changeset
713 signed int v10; // eax@15
Ritor1
parents:
diff changeset
714 __int16 *v11; // edx@16
Ritor1
parents:
diff changeset
715 int v12; // eax@20
Ritor1
parents:
diff changeset
716 int v13; // ebx@20
Ritor1
parents:
diff changeset
717 unsigned int *v14; // esi@21
Ritor1
parents:
diff changeset
718 unsigned int v15; // ecx@21
Ritor1
parents:
diff changeset
719 unsigned int v16; // eax@21
Ritor1
parents:
diff changeset
720 int v17; // edx@21
Ritor1
parents:
diff changeset
721 int v18; // eax@21
Ritor1
parents:
diff changeset
722 signed int v19; // eax@21
Ritor1
parents:
diff changeset
723 signed int v20; // ebx@25
Ritor1
parents:
diff changeset
724 Player *v21; // esi@25
Ritor1
parents:
diff changeset
725 ITEM_EQUIP_TYPE v22; // edi@30
Ritor1
parents:
diff changeset
726 //int v23; // edx@31
Ritor1
parents:
diff changeset
727 signed int v24; // ecx@32
Ritor1
parents:
diff changeset
728 signed int v25; // eax@33
Ritor1
parents:
diff changeset
729 int v26; // eax@35
Ritor1
parents:
diff changeset
730 int v27; // eax@36
Ritor1
parents:
diff changeset
731 int v28; // eax@37
Ritor1
parents:
diff changeset
732 int v29; // eax@40
Ritor1
parents:
diff changeset
733 int v30; // eax@41
Ritor1
parents:
diff changeset
734 signed int v31; // ecx@53
Ritor1
parents:
diff changeset
735 char *v32; // eax@53
Ritor1
parents:
diff changeset
736 char *v33; // edi@82
Ritor1
parents:
diff changeset
737 int v34; // ecx@88
Ritor1
parents:
diff changeset
738 int v35; // eax@88
Ritor1
parents:
diff changeset
739 char *v36; // edi@99
Ritor1
parents:
diff changeset
740 int v37; // edi@104
Ritor1
parents:
diff changeset
741 int v38; // edi@106
Ritor1
parents:
diff changeset
742 int v39; // edi@111
Ritor1
parents:
diff changeset
743 int v40; // ecx@113
Ritor1
parents:
diff changeset
744 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
745 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
0
Ritor1
parents:
diff changeset
746 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
Ritor1
parents:
diff changeset
747 int v44; // [sp+210h] [bp-20h]@22
Ritor1
parents:
diff changeset
748 int v45; // [sp+214h] [bp-1Ch]@25
Ritor1
parents:
diff changeset
749 int v46; // [sp+218h] [bp-18h]@25
Ritor1
parents:
diff changeset
750 int v47; // [sp+21Ch] [bp-14h]@25
Ritor1
parents:
diff changeset
751 int v48; // [sp+220h] [bp-10h]@25
Ritor1
parents:
diff changeset
752 int v49; // [sp+224h] [bp-Ch]@24
Ritor1
parents:
diff changeset
753 int v50; // [sp+228h] [bp-8h]@25
Ritor1
parents:
diff changeset
754 int v51; // [sp+22Ch] [bp-4h]@2
Ritor1
parents:
diff changeset
755
Ritor1
parents:
diff changeset
756 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
Ritor1
parents:
diff changeset
757 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375);
Ritor1
parents:
diff changeset
758 v2 = (signed int)v1 / 60;
Ritor1
parents:
diff changeset
759 result = (signed int)v1 / 60 + 5;
Ritor1
parents:
diff changeset
760 if ( v0 >= result )
Ritor1
parents:
diff changeset
761 {
Ritor1
parents:
diff changeset
762 v51 = 0;
Ritor1
parents:
diff changeset
763 v4 = (v0 - v2) / 5;
Ritor1
parents:
diff changeset
764 if (pParty->FlyActive())
Ritor1
parents:
diff changeset
765 {
Ritor1
parents:
diff changeset
766 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
767 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
768 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
769 { // colliding with something in the air - fall down
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
770 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
771 //__debugbreak();
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
772 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
773 v7 = *v6 < v5;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
774 *v6 -= v5;
0
Ritor1
parents:
diff changeset
775 if ( v7 )
Ritor1
parents:
diff changeset
776 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
777 *v6 = 0;
0
Ritor1
parents:
diff changeset
778 pParty->uFlags &= 0xFFFFFFBFu;
Ritor1
parents:
diff changeset
779 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
780 v51 = 1;
Ritor1
parents:
diff changeset
781 }
Ritor1
parents:
diff changeset
782 }
Ritor1
parents:
diff changeset
783 }
Ritor1
parents:
diff changeset
784 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
785
0
Ritor1
parents:
diff changeset
786 if (pParty->WaterWalkActive())
Ritor1
parents:
diff changeset
787 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
788 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
789 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
790 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
791 { // taking on water
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
792 //__debugbreak();
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
793 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
794 v7 = *v8 < v4;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
795 *v8 -= v4;
0
Ritor1
parents:
diff changeset
796 if ( v7 )
Ritor1
parents:
diff changeset
797 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
798 *v8 = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
799 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
800 v51 = 1;
Ritor1
parents:
diff changeset
801 }
Ritor1
parents:
diff changeset
802 }
Ritor1
parents:
diff changeset
803 }
Ritor1
parents:
diff changeset
804 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
805
0
Ritor1
parents:
diff changeset
806 if (pParty->ImmolationActive())
Ritor1
parents:
diff changeset
807 {
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
808 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
809 v9 = 0;
Ritor1
parents:
diff changeset
810 a3.z = 0;
Ritor1
parents:
diff changeset
811 a3.y = 0;
Ritor1
parents:
diff changeset
812 a3.x = 0;
Ritor1
parents:
diff changeset
813 a1.stru_24.Reset();
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
814 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
815 a1.spell_skill = pParty->ImmolationSkillLevel();
0
Ritor1
parents:
diff changeset
816 v10 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
817 a1.uType = 1070;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
818 a1.spell_id = SPELL_FIRE_IMMOLATION;
0
Ritor1
parents:
diff changeset
819 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
820 {
Ritor1
parents:
diff changeset
821 LABEL_19:
Ritor1
parents:
diff changeset
822 LOWORD(v10) = 0;
Ritor1
parents:
diff changeset
823 }
Ritor1
parents:
diff changeset
824 else
Ritor1
parents:
diff changeset
825 {
Ritor1
parents:
diff changeset
826 v11 = &pObjectList->pObjects->uObjectID;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 917
diff changeset
827 while ( stru_4E3ACC[8].uType != *v11 )
0
Ritor1
parents:
diff changeset
828 {
Ritor1
parents:
diff changeset
829 ++v10;
Ritor1
parents:
diff changeset
830 v11 += 28;
Ritor1
parents:
diff changeset
831 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
832 goto LABEL_19;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834 }
Ritor1
parents:
diff changeset
835 a1.uObjectDescID = v10;
Ritor1
parents:
diff changeset
836 a1.field_60_distance_related_prolly_lod = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
837 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
838 LOBYTE(v12) = v12 | OBJECT_Player;
0
Ritor1
parents:
diff changeset
839 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
840 a1.uSectorID = 0;
Ritor1
parents:
diff changeset
841 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
842 a1.spell_caster_pid = v12;
0
Ritor1
parents:
diff changeset
843 a1.uFacing = 0;
Ritor1
parents:
diff changeset
844 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
845 v13 = sub_46A89E((int)v41, 100, 307);
Ritor1
parents:
diff changeset
846 if ( v13 > 0 )
Ritor1
parents:
diff changeset
847 {
Ritor1
parents:
diff changeset
848 do
Ritor1
parents:
diff changeset
849 {
Ritor1
parents:
diff changeset
850 v14 = (unsigned int *)&v41[4 * v9];
Ritor1
parents:
diff changeset
851 v15 = *v14;
Ritor1
parents:
diff changeset
852 v16 = *v14;
Ritor1
parents:
diff changeset
853 a1.vPosition.x = pActors[v16].vPosition.x;
Ritor1
parents:
diff changeset
854 v17 = pActors[v16].vPosition.y;
Ritor1
parents:
diff changeset
855 a1.vPosition.z = pActors[v16].vPosition.z;
Ritor1
parents:
diff changeset
856 v18 = 8 * v15;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
857 LOBYTE(v18) = PID(OBJECT_Actor,v15);
0
Ritor1
parents:
diff changeset
858 a1.vPosition.y = v17;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
859 a1.spell_target_pid = v18;
0
Ritor1
parents:
diff changeset
860 v19 = a1.Create(0, 0, 0, 0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
861 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3);
0
Ritor1
parents:
diff changeset
862 ++v9;
Ritor1
parents:
diff changeset
863 }
Ritor1
parents:
diff changeset
864 while ( v9 < v13 );
Ritor1
parents:
diff changeset
865 }
Ritor1
parents:
diff changeset
866 }
Ritor1
parents:
diff changeset
867 v44 = 0;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
868 if (PartyHasDragon())
0
Ritor1
parents:
diff changeset
869 v44 = 1;
Ritor1
parents:
diff changeset
870 v49 = 0;
Ritor1
parents:
diff changeset
871 LABEL_25:
Ritor1
parents:
diff changeset
872 v20 = 0;
Ritor1
parents:
diff changeset
873 v21 = &pParty->pPlayers[v49];
Ritor1
parents:
diff changeset
874 v50 = 0;
Ritor1
parents:
diff changeset
875 v47 = 0;
Ritor1
parents:
diff changeset
876 v45 = 0;
Ritor1
parents:
diff changeset
877 v48 = 0;
Ritor1
parents:
diff changeset
878 v46 = 0;
255
0a37a56e9f02 sprintfex & classes enum
Nomad
parents: 254
diff changeset
879 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK )
0
Ritor1
parents:
diff changeset
880 v50 = 1;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
881 if ( v21->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
882 v48 = 1;
Ritor1
parents:
diff changeset
883 v22 = (ITEM_EQUIP_TYPE)0;
Ritor1
parents:
diff changeset
884 while ( 1 )
Ritor1
parents:
diff changeset
885 {
Ritor1
parents:
diff changeset
886 if ( v21->HasItemEquipped(v22) )
Ritor1
parents:
diff changeset
887 {
Ritor1
parents:
diff changeset
888 //v23 = v21->pEquipment.pIndices;
Ritor1
parents:
diff changeset
889 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
890 v24 = v21->pInventoryItemList[_idx].uItemID;
0
Ritor1
parents:
diff changeset
891 if ( v24 > 134 )
Ritor1
parents:
diff changeset
892 {
Ritor1
parents:
diff changeset
893 if ( v24 == 529 )
Ritor1
parents:
diff changeset
894 goto LABEL_43;
Ritor1
parents:
diff changeset
895 if ( v24 == 535 )
Ritor1
parents:
diff changeset
896 goto LABEL_44;
Ritor1
parents:
diff changeset
897 if ( v24 == 515 )
Ritor1
parents:
diff changeset
898 {
Ritor1
parents:
diff changeset
899 v47 = 1;
Ritor1
parents:
diff changeset
900 }
Ritor1
parents:
diff changeset
901 else
Ritor1
parents:
diff changeset
902 {
Ritor1
parents:
diff changeset
903 if ( v24 == 532 )
Ritor1
parents:
diff changeset
904 goto LABEL_50;
Ritor1
parents:
diff changeset
905 }
Ritor1
parents:
diff changeset
906 }
Ritor1
parents:
diff changeset
907 else
Ritor1
parents:
diff changeset
908 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
909 v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
910 if ( v25 <= 50 )
Ritor1
parents:
diff changeset
911 {
Ritor1
parents:
diff changeset
912 if ( v25 != 50 )
Ritor1
parents:
diff changeset
913 {
Ritor1
parents:
diff changeset
914 v26 = v25 - 37;
Ritor1
parents:
diff changeset
915 if ( v26 )
Ritor1
parents:
diff changeset
916 {
Ritor1
parents:
diff changeset
917 v27 = v26 - 1;
Ritor1
parents:
diff changeset
918 if ( !v27 )
Ritor1
parents:
diff changeset
919 goto LABEL_50;
Ritor1
parents:
diff changeset
920 v28 = v27 - 6;
Ritor1
parents:
diff changeset
921 if ( v28 )
Ritor1
parents:
diff changeset
922 {
Ritor1
parents:
diff changeset
923 if ( v28 != 3 )
Ritor1
parents:
diff changeset
924 goto LABEL_51;
Ritor1
parents:
diff changeset
925 LABEL_50:
Ritor1
parents:
diff changeset
926 v50 = 1;
Ritor1
parents:
diff changeset
927 goto LABEL_51;
Ritor1
parents:
diff changeset
928 }
Ritor1
parents:
diff changeset
929 }
Ritor1
parents:
diff changeset
930 }
Ritor1
parents:
diff changeset
931 LABEL_44:
Ritor1
parents:
diff changeset
932 v20 = 1;
Ritor1
parents:
diff changeset
933 goto LABEL_51;
Ritor1
parents:
diff changeset
934 }
Ritor1
parents:
diff changeset
935 v29 = v25 - 54;
Ritor1
parents:
diff changeset
936 if ( !v29 )
Ritor1
parents:
diff changeset
937 goto LABEL_44;
Ritor1
parents:
diff changeset
938 v30 = v29 - 1;
Ritor1
parents:
diff changeset
939 if ( !v30 )
Ritor1
parents:
diff changeset
940 goto LABEL_50;
Ritor1
parents:
diff changeset
941 if ( v30 == 11 )
Ritor1
parents:
diff changeset
942 {
Ritor1
parents:
diff changeset
943 LABEL_43:
Ritor1
parents:
diff changeset
944 v20 = 1;
Ritor1
parents:
diff changeset
945 v50 = 1;
Ritor1
parents:
diff changeset
946 goto LABEL_51;
Ritor1
parents:
diff changeset
947 }
Ritor1
parents:
diff changeset
948 }
Ritor1
parents:
diff changeset
949 }
Ritor1
parents:
diff changeset
950 LABEL_51:
Ritor1
parents:
diff changeset
951 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1);
Ritor1
parents:
diff changeset
952 if ( (signed int)v22 >= 16 )
Ritor1
parents:
diff changeset
953 {
Ritor1
parents:
diff changeset
954 if ( v48 )
Ritor1
parents:
diff changeset
955 {
Ritor1
parents:
diff changeset
956 v31 = 0;
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
957 v32 = (char *)v21->pInventoryItemList;
0
Ritor1
parents:
diff changeset
958 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 )
Ritor1
parents:
diff changeset
959 {
Ritor1
parents:
diff changeset
960 ++v31;
Ritor1
parents:
diff changeset
961 v32 += 36;
Ritor1
parents:
diff changeset
962 if ( v31 >= 138 )
Ritor1
parents:
diff changeset
963 goto LABEL_59;
Ritor1
parents:
diff changeset
964 }
Ritor1
parents:
diff changeset
965 v48 = 0;
Ritor1
parents:
diff changeset
966 v45 = 1;
Ritor1
parents:
diff changeset
967 }
Ritor1
parents:
diff changeset
968 LABEL_59:
Ritor1
parents:
diff changeset
969 if ( v21->pConditions[17] )
Ritor1
parents:
diff changeset
970 v46 = 1;
Ritor1
parents:
diff changeset
971 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
972 {
Ritor1
parents:
diff changeset
973 ++v21->sHealth;
Ritor1
parents:
diff changeset
974 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
975 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
976 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
977 {
Ritor1
parents:
diff changeset
978 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
979 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
980 }
Ritor1
parents:
diff changeset
981 v51 = 1;
Ritor1
parents:
diff changeset
982 }
Ritor1
parents:
diff changeset
983 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0
Ritor1
parents:
diff changeset
984 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime))
Ritor1
parents:
diff changeset
985 && !v21->pConditions[14]
Ritor1
parents:
diff changeset
986 && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
987 {
Ritor1
parents:
diff changeset
988 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower;
Ritor1
parents:
diff changeset
989 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
990 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
991 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
992 {
Ritor1
parents:
diff changeset
993 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
994 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
995 }
Ritor1
parents:
diff changeset
996 v51 = 1;
Ritor1
parents:
diff changeset
997 }
Ritor1
parents:
diff changeset
998 if ( v50 )
Ritor1
parents:
diff changeset
999 {
Ritor1
parents:
diff changeset
1000 v33 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
1001 ++*(int *)v33;
Ritor1
parents:
diff changeset
1002 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
1003 *(int *)v33 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
1004 v51 = 1;
Ritor1
parents:
diff changeset
1005 }
Ritor1
parents:
diff changeset
1006 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1007 {
Ritor1
parents:
diff changeset
1008 v34 = LODWORD(v21->pConditions[13]);
Ritor1
parents:
diff changeset
1009 --v21->sHealth;
Ritor1
parents:
diff changeset
1010 v35 = v21->sHealth;
Ritor1
parents:
diff changeset
1011 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 )
Ritor1
parents:
diff changeset
1012 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1013 if ( v35 < 1 )
Ritor1
parents:
diff changeset
1014 {
Ritor1
parents:
diff changeset
1015 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
Ritor1
parents:
diff changeset
1016 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1017 {
Ritor1
parents:
diff changeset
1018 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1019 }
Ritor1
parents:
diff changeset
1020 else
Ritor1
parents:
diff changeset
1021 {
Ritor1
parents:
diff changeset
1022 if ( !v21->pConditions[14] )
Ritor1
parents:
diff changeset
1023 v21->pConditions[14] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1024 }
Ritor1
parents:
diff changeset
1025 }
Ritor1
parents:
diff changeset
1026 v51 = 1;
Ritor1
parents:
diff changeset
1027 }
Ritor1
parents:
diff changeset
1028 if ( v45 )
Ritor1
parents:
diff changeset
1029 {
Ritor1
parents:
diff changeset
1030 v36 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
1031 ++*(int *)v36;
Ritor1
parents:
diff changeset
1032 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
1033 *(int *)v36 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
1034 }
Ritor1
parents:
diff changeset
1035 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1036 {
Ritor1
parents:
diff changeset
1037 v37 = v21->sHealth;
Ritor1
parents:
diff changeset
1038 if ( v37 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
1039 v21->sHealth = v37 - 2;
Ritor1
parents:
diff changeset
1040 v38 = v21->sMana;
Ritor1
parents:
diff changeset
1041 if ( v38 > v21->GetMaxMana() / 2 )
Ritor1
parents:
diff changeset
1042 v21->sMana = v38 - 2;
Ritor1
parents:
diff changeset
1043 }
Ritor1
parents:
diff changeset
1044 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
1045 {
Ritor1
parents:
diff changeset
1046 v39 = v21->sHealth;
Ritor1
parents:
diff changeset
1047 if ( v39 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
1048 v21->sHealth = v39 - 1;
Ritor1
parents:
diff changeset
1049 v40 = v21->sMana;
Ritor1
parents:
diff changeset
1050 if ( v40 > 0 )
Ritor1
parents:
diff changeset
1051 v21->sMana = v40 - 1;
Ritor1
parents:
diff changeset
1052 }
Ritor1
parents:
diff changeset
1053 ++v49;
Ritor1
parents:
diff changeset
1054 if ( v49 >= 4 )
Ritor1
parents:
diff changeset
1055 {
Ritor1
parents:
diff changeset
1056 result = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
1057 pParty->uLastRegenerationTime = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
1058 if ( !viewparams->bRedrawGameUI )
Ritor1
parents:
diff changeset
1059 {
Ritor1
parents:
diff changeset
1060 result = v51;
Ritor1
parents:
diff changeset
1061 viewparams->bRedrawGameUI = v51;
Ritor1
parents:
diff changeset
1062 }
Ritor1
parents:
diff changeset
1063 return result;
Ritor1
parents:
diff changeset
1064 }
Ritor1
parents:
diff changeset
1065 goto LABEL_25;
Ritor1
parents:
diff changeset
1066 }
Ritor1
parents:
diff changeset
1067 }
Ritor1
parents:
diff changeset
1068 }
Ritor1
parents:
diff changeset
1069 return result;
Ritor1
parents:
diff changeset
1070 }
Ritor1
parents:
diff changeset
1071
Ritor1
parents:
diff changeset
1072 //----- (00493F79) --------------------------------------------------------
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1073 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
0
Ritor1
parents:
diff changeset
1074 {
Ritor1
parents:
diff changeset
1075 signed __int64 v2; // ST2C_8@1
Ritor1
parents:
diff changeset
1076 signed __int64 v3; // qax@1
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1077 //signed __int64 v4; // ST1C_8@1
0
Ritor1
parents:
diff changeset
1078 unsigned __int64 v5; // qax@1
Ritor1
parents:
diff changeset
1079 unsigned int v6; // ebx@1
Ritor1
parents:
diff changeset
1080
Ritor1
parents:
diff changeset
1081 v2 = (signed __int64)((double)a2 * 0.234375);
Ritor1
parents:
diff changeset
1082 v3 = v2 / 60 / 60;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1083 //v4 = v3;
0
Ritor1
parents:
diff changeset
1084 v5 = (unsigned int)v3 / 0x18;
Ritor1
parents:
diff changeset
1085 v6 = (unsigned int)(v5 / 7) >> 2;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1086 _this->field_0_expire_second = v2 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1087 _this->field_4_expire_minute = v2 / 60 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1088 _this->field_8_expire_hour = v3 % 24;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1089 _this->field_10_expire_week = v5 / 7 & 3;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1090 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1091 _this->field_14_exprie_month = v6 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
1092 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
1093 }
Ritor1
parents:
diff changeset
1094
Ritor1
parents:
diff changeset
1095 //----- (00494035) --------------------------------------------------------
1031
f93d17337113 UI stuff.
Nomad
parents: 1029
diff changeset
1096 void _494035_timed_effects__water_walking_damage__etc()
0
Ritor1
parents:
diff changeset
1097 {
Ritor1
parents:
diff changeset
1098 signed __int64 v0; // qax@1
Ritor1
parents:
diff changeset
1099 signed __int64 v1; // ST30_8@1
Ritor1
parents:
diff changeset
1100 signed __int64 v2; // ST38_8@1
Ritor1
parents:
diff changeset
1101 unsigned __int64 v3; // qax@1
Ritor1
parents:
diff changeset
1102 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
1103 //signed int v5; // eax@4
Ritor1
parents:
diff changeset
1104 //char *v6; // ecx@5
Ritor1
parents:
diff changeset
1105 //Player *v7; // esi@8
Ritor1
parents:
diff changeset
1106 //char *v8; // ecx@12
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1107 //Player *pPlayer; // esi@15
0
Ritor1
parents:
diff changeset
1108 //void *v10; // esi@25
Ritor1
parents:
diff changeset
1109 unsigned int v11; // ecx@27
Ritor1
parents:
diff changeset
1110 signed int v12; // edi@29
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1111 //Player *v13; // ecx@30
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1112 //Player *v14; // esi@35
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1113 //double v15; // st7@35
0
Ritor1
parents:
diff changeset
1114 Player **v16; // esi@43
Ritor1
parents:
diff changeset
1115 Player *v17; // edi@44
Ritor1
parents:
diff changeset
1116 double v18; // st7@44
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1117 //float v19; // ST28_4@48
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1118 //double v20; // ST38_8@48
0
Ritor1
parents:
diff changeset
1119 Player *v21; // esi@51
Ritor1
parents:
diff changeset
1120 signed int v22; // edi@53
Ritor1
parents:
diff changeset
1121 int v23; // eax@59
Ritor1
parents:
diff changeset
1122 int v24; // ecx@60
Ritor1
parents:
diff changeset
1123 int v25; // eax@63
Ritor1
parents:
diff changeset
1124 int v26; // ecx@64
Ritor1
parents:
diff changeset
1125 int v27; // eax@67
Ritor1
parents:
diff changeset
1126 int v28; // ecx@68
Ritor1
parents:
diff changeset
1127 int v29; // eax@71
Ritor1
parents:
diff changeset
1128 int v30; // ecx@72
Ritor1
parents:
diff changeset
1129 int v31; // eax@75
Ritor1
parents:
diff changeset
1130 int v32; // ecx@76
Ritor1
parents:
diff changeset
1131 int v33; // eax@79
Ritor1
parents:
diff changeset
1132 int v34; // ecx@80
Ritor1
parents:
diff changeset
1133 int v35; // eax@83
Ritor1
parents:
diff changeset
1134 int v36; // ecx@84
Ritor1
parents:
diff changeset
1135 int v37; // eax@87
Ritor1
parents:
diff changeset
1136 int v38; // ecx@88
Ritor1
parents:
diff changeset
1137 int v39; // eax@91
Ritor1
parents:
diff changeset
1138 int v40; // ecx@92
Ritor1
parents:
diff changeset
1139 int v41; // eax@95
Ritor1
parents:
diff changeset
1140 int v42; // ecx@96
Ritor1
parents:
diff changeset
1141 bool v43; // ebx@102
Ritor1
parents:
diff changeset
1142 //SpellBuff *v44; // edi@104
Ritor1
parents:
diff changeset
1143 //signed int v45; // ebp@104
Ritor1
parents:
diff changeset
1144 bool v46; // edi@111
Ritor1
parents:
diff changeset
1145 //SpellBuff *v47; // esi@113
Ritor1
parents:
diff changeset
1146 //Player **v48; // esi@119
Ritor1
parents:
diff changeset
1147 //signed int v49; // edi@121
Ritor1
parents:
diff changeset
1148 //char *v50; // esi@122
Ritor1
parents:
diff changeset
1149 signed int v51; // edx@128
Ritor1
parents:
diff changeset
1150 signed int v52; // ecx@130
Ritor1
parents:
diff changeset
1151 int v53; // eax@131
Ritor1
parents:
diff changeset
1152 Player *v54; // eax@141
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1153 //unsigned int v55; // [sp-8h] [bp-38h]@18
0
Ritor1
parents:
diff changeset
1154 unsigned int v56; // [sp-8h] [bp-38h]@55
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1155 //int v57; // [sp-4h] [bp-34h]@18
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1156 //int v58; // [sp-4h] [bp-34h]@33
0
Ritor1
parents:
diff changeset
1157 int v59; // [sp-4h] [bp-34h]@55
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1158 //unsigned int v60; // [sp+10h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
1159 unsigned int v61; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
1160 Player **v62; // [sp+14h] [bp-1Ch]@50
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1161 //unsigned int a2; // [sp+18h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
1162 signed int a2a; // [sp+18h] [bp-18h]@47
Ritor1
parents:
diff changeset
1163 signed int v65; // [sp+1Ch] [bp-14h]@47
Ritor1
parents:
diff changeset
1164
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1165 //a2 = pParty->uCurrentHour;
0
Ritor1
parents:
diff changeset
1166 v61 = pParty->uDaysPlayed;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1167 //auto prev_time = pEventTimer->uTimeElapsed;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1168 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1169 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60;
0
Ritor1
parents:
diff changeset
1170 v1 = v0;
Ritor1
parents:
diff changeset
1171 v0 /= 60i64;
Ritor1
parents:
diff changeset
1172 v2 = v0;
Ritor1
parents:
diff changeset
1173 v3 = (unsigned int)v0 / 24;
Ritor1
parents:
diff changeset
1174 v4 = (unsigned int)(v3 / 7) >> 2;
Ritor1
parents:
diff changeset
1175 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
Ritor1
parents:
diff changeset
1176 pParty->uCurrentMinute = v1 % 60;
Ritor1
parents:
diff changeset
1177 pParty->uCurrentMonthWeek = v3 / 7 & 3;
Ritor1
parents:
diff changeset
1178 pParty->uCurrentHour = v2 % 24;
Ritor1
parents:
diff changeset
1179 pParty->uDaysPlayed = (unsigned int)v3 % 28;
Ritor1
parents:
diff changeset
1180 pParty->uCurrentMonth = v4 % 12;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
1181 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1182 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns
0
Ritor1
parents:
diff changeset
1183 {
Ritor1
parents:
diff changeset
1184 pParty->pHirelings[0].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1185 pParty->pHirelings[1].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1186
Ritor1
parents:
diff changeset
1187 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
Ritor1
parents:
diff changeset
1188 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
1189
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1190 ++pParty->days_played_without_rest;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1191 if (pParty->days_played_without_rest > 1)
0
Ritor1
parents:
diff changeset
1192 {
Ritor1
parents:
diff changeset
1193 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
1194 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0);
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1195
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1196 if (pParty->uNumFoodRations)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1197 Party::TakeFood(1);
0
Ritor1
parents:
diff changeset
1198 else
Ritor1
parents:
diff changeset
1199 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1200 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
1201
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1202 if (pParty->days_played_without_rest > 3)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1203 for (uint i = 0; i < 4; ++i)
0
Ritor1
parents:
diff changeset
1204 {
1362
d6cf8ead9242 Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents: 1361
diff changeset
1205 Player* player = pParty->pPlayers + i;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1206
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1207 player->Zero();
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1208
1362
d6cf8ead9242 Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents: 1361
diff changeset
1209 if (!player->IsPertified() && !player->IsEradicated() && !player->IsDead())
0
Ritor1
parents:
diff changeset
1210 {
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
1211 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
1212 player->SetCondDeadWithBlockCheck(0);
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
1213 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
1214 player->SetCondInsaneWithBlockCheck(0);
0
Ritor1
parents:
diff changeset
1215 }
Ritor1
parents:
diff changeset
1216 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1217 }
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1218 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
Ritor1
parents:
diff changeset
1219 pOutdoor->SetFog();
Ritor1
parents:
diff changeset
1220
Ritor1
parents:
diff changeset
1221 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1222 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
1223 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
1224
0
Ritor1
parents:
diff changeset
1225 v11 = LODWORD(pParty->uTimePlayed);
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1226 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage error
0
Ritor1
parents:
diff changeset
1227 {
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1228 //v12 = 1;
0
Ritor1
parents:
diff changeset
1229 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128;
Ritor1
parents:
diff changeset
1230 viewparams->bRedrawGameUI = 1;
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1231 //while ( 1 )
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1232 for ( v12 = 1; v12 <= 4; ++v12 )
0
Ritor1
parents:
diff changeset
1233 {
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1037
diff changeset
1234 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
99
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
1235 || pPlayers[v12]->HasEnchantedItemEquipped(71)
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
1236 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
1237 {
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1238 //v58 = 0;
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1239 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
0
Ritor1
parents:
diff changeset
1240 }
Ritor1
parents:
diff changeset
1241 else
Ritor1
parents:
diff changeset
1242 {
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1243 //v58 = 0;
0
Ritor1
parents:
diff changeset
1244 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) )
Ritor1
parents:
diff changeset
1245 {
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1246 //v14 = pPlayers[v12];
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1247 //v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1;
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1248 pPlayers[v12]->ReceiveDamage((signed __int64)pPlayers[v12]->GetMaxHealth() * 0.1, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
1249 if ( pParty->uFlags & 4 )
Ritor1
parents:
diff changeset
1250 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1251 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
1252 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
1253 }
Ritor1
parents:
diff changeset
1254 }
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1255 else
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1256 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
0
Ritor1
parents:
diff changeset
1257 }
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1258 //++v12;
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1259 //if ( v12 > 4 )
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1260 //{
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1261 //v11 = LODWORD(pParty->uTimePlayed);
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1262 //break;
0
Ritor1
parents:
diff changeset
1263 }
1424
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1264 v11 = LODWORD(pParty->uTimePlayed);
5930342f092b fall to the water
Ritor1
parents: 1419
diff changeset
1265 //}
0
Ritor1
parents:
diff changeset
1266 }
Ritor1
parents:
diff changeset
1267 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) )
Ritor1
parents:
diff changeset
1268 {
Ritor1
parents:
diff changeset
1269 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1270 pParty->field_6FC = v11 + 128;
Ritor1
parents:
diff changeset
1271 v16 = &pPlayers[1];
Ritor1
parents:
diff changeset
1272 do
Ritor1
parents:
diff changeset
1273 {
Ritor1
parents:
diff changeset
1274 v17 = *v16;
Ritor1
parents:
diff changeset
1275 v18 = (double)(*v16)->GetMaxHealth() * 0.1;
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
1276 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
1277 if ( pParty->uFlags & 0x200 )
Ritor1
parents:
diff changeset
1278 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1279 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
1280 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
1281 }
Ritor1
parents:
diff changeset
1282 ++v16;
Ritor1
parents:
diff changeset
1283 }
Ritor1
parents:
diff changeset
1284 while ( (signed int)v16 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
1285 }
Ritor1
parents:
diff changeset
1286 _493938_regenerate();
Ritor1
parents:
diff changeset
1287 v65 = 4;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1288 a2a = pEventTimer->uTimeElapsed;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1289 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1290 {
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1291 //v19 = (double)(signed int)prev_time * 0.5;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1292 //v20 = v19 + 6.7553994e15;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1293 a2a *= 0.5f;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1294 if (a2a < 1)
0
Ritor1
parents:
diff changeset
1295 a2a = 1;
Ritor1
parents:
diff changeset
1296 }
Ritor1
parents:
diff changeset
1297 v62 = &pPlayers[1];
Ritor1
parents:
diff changeset
1298 do
Ritor1
parents:
diff changeset
1299 {
Ritor1
parents:
diff changeset
1300 v21 = *v62;
Ritor1
parents:
diff changeset
1301 if ( (*v62)->uTimeToRecovery )
Ritor1
parents:
diff changeset
1302 v21->Recover(a2a);
Ritor1
parents:
diff changeset
1303 v22 = v21->sHealth;
Ritor1
parents:
diff changeset
1304 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1
Ritor1
parents:
diff changeset
1305 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1306 {
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1307 if ( v22 < 1 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1308 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1309 v59 = 0;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1310 v56 = 13;
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1311 v21->SetCondition(v56, v59);
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1312 }
0
Ritor1
parents:
diff changeset
1313 }
Ritor1
parents:
diff changeset
1314 else
Ritor1
parents:
diff changeset
1315 {
Ritor1
parents:
diff changeset
1316 v59 = 0;
Ritor1
parents:
diff changeset
1317 v56 = 14;
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1318 v21->SetCondition(v56, v59);
0
Ritor1
parents:
diff changeset
1319 }
Ritor1
parents:
diff changeset
1320 v23 = (int)&v21->field_E0;
Ritor1
parents:
diff changeset
1321 if ( v21->field_E0 )
Ritor1
parents:
diff changeset
1322 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1323 v24 = *(int *)v23 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1324 if ( v24 > 0 )
Ritor1
parents:
diff changeset
1325 {
Ritor1
parents:
diff changeset
1326 *(int *)v23 = v24;
Ritor1
parents:
diff changeset
1327 }
Ritor1
parents:
diff changeset
1328 else
Ritor1
parents:
diff changeset
1329 {
Ritor1
parents:
diff changeset
1330 *(int *)v23 = 0;
Ritor1
parents:
diff changeset
1331 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1332 }
Ritor1
parents:
diff changeset
1333 }
Ritor1
parents:
diff changeset
1334 v25 = (int)&v21->field_E4;
Ritor1
parents:
diff changeset
1335 if ( v21->field_E4 )
Ritor1
parents:
diff changeset
1336 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1337 v26 = *(int *)v25 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1338 if ( v26 > 0 )
Ritor1
parents:
diff changeset
1339 {
Ritor1
parents:
diff changeset
1340 *(int *)v25 = v26;
Ritor1
parents:
diff changeset
1341 }
Ritor1
parents:
diff changeset
1342 else
Ritor1
parents:
diff changeset
1343 {
Ritor1
parents:
diff changeset
1344 *(int *)v25 = 0;
Ritor1
parents:
diff changeset
1345 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1346 }
Ritor1
parents:
diff changeset
1347 }
Ritor1
parents:
diff changeset
1348 v27 = (int)&v21->field_E8;
Ritor1
parents:
diff changeset
1349 if ( v21->field_E8 )
Ritor1
parents:
diff changeset
1350 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1351 v28 = *(int *)v27 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1352 if ( v28 > 0 )
Ritor1
parents:
diff changeset
1353 {
Ritor1
parents:
diff changeset
1354 *(int *)v27 = v28;
Ritor1
parents:
diff changeset
1355 }
Ritor1
parents:
diff changeset
1356 else
Ritor1
parents:
diff changeset
1357 {
Ritor1
parents:
diff changeset
1358 *(int *)v27 = 0;
Ritor1
parents:
diff changeset
1359 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1360 }
Ritor1
parents:
diff changeset
1361 }
Ritor1
parents:
diff changeset
1362 v29 = (int)&v21->field_EC;
Ritor1
parents:
diff changeset
1363 if ( v21->field_EC )
Ritor1
parents:
diff changeset
1364 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1365 v30 = *(int *)v29 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1366 if ( v30 > 0 )
Ritor1
parents:
diff changeset
1367 {
Ritor1
parents:
diff changeset
1368 *(int *)v29 = v30;
Ritor1
parents:
diff changeset
1369 }
Ritor1
parents:
diff changeset
1370 else
Ritor1
parents:
diff changeset
1371 {
Ritor1
parents:
diff changeset
1372 *(int *)v29 = 0;
Ritor1
parents:
diff changeset
1373 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1374 }
Ritor1
parents:
diff changeset
1375 }
Ritor1
parents:
diff changeset
1376 v31 = (int)&v21->field_F0;
Ritor1
parents:
diff changeset
1377 if ( v21->field_F0 )
Ritor1
parents:
diff changeset
1378 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1379 v32 = *(int *)v31 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1380 if ( v32 > 0 )
Ritor1
parents:
diff changeset
1381 {
Ritor1
parents:
diff changeset
1382 *(int *)v31 = v32;
Ritor1
parents:
diff changeset
1383 }
Ritor1
parents:
diff changeset
1384 else
Ritor1
parents:
diff changeset
1385 {
Ritor1
parents:
diff changeset
1386 *(int *)v31 = 0;
Ritor1
parents:
diff changeset
1387 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1388 }
Ritor1
parents:
diff changeset
1389 }
Ritor1
parents:
diff changeset
1390 v33 = (int)&v21->field_F4;
Ritor1
parents:
diff changeset
1391 if ( v21->field_F4 )
Ritor1
parents:
diff changeset
1392 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1393 v34 = *(int *)v33 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1394 if ( v34 > 0 )
Ritor1
parents:
diff changeset
1395 {
Ritor1
parents:
diff changeset
1396 *(int *)v33 = v34;
Ritor1
parents:
diff changeset
1397 }
Ritor1
parents:
diff changeset
1398 else
Ritor1
parents:
diff changeset
1399 {
Ritor1
parents:
diff changeset
1400 *(int *)v33 = 0;
Ritor1
parents:
diff changeset
1401 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1402 }
Ritor1
parents:
diff changeset
1403 }
Ritor1
parents:
diff changeset
1404 v35 = (int)&v21->field_F8;
Ritor1
parents:
diff changeset
1405 if ( v21->field_F8 )
Ritor1
parents:
diff changeset
1406 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1407 v36 = *(int *)v35 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1408 if ( v36 > 0 )
Ritor1
parents:
diff changeset
1409 {
Ritor1
parents:
diff changeset
1410 *(int *)v35 = v36;
Ritor1
parents:
diff changeset
1411 }
Ritor1
parents:
diff changeset
1412 else
Ritor1
parents:
diff changeset
1413 {
Ritor1
parents:
diff changeset
1414 *(int *)v35 = 0;
Ritor1
parents:
diff changeset
1415 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1416 }
Ritor1
parents:
diff changeset
1417 }
Ritor1
parents:
diff changeset
1418 v37 = (int)&v21->field_FC;
Ritor1
parents:
diff changeset
1419 if ( v21->field_FC )
Ritor1
parents:
diff changeset
1420 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1421 v38 = *(int *)v37 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1422 if ( v38 > 0 )
Ritor1
parents:
diff changeset
1423 {
Ritor1
parents:
diff changeset
1424 *(int *)v37 = v38;
Ritor1
parents:
diff changeset
1425 }
Ritor1
parents:
diff changeset
1426 else
Ritor1
parents:
diff changeset
1427 {
Ritor1
parents:
diff changeset
1428 *(int *)v37 = 0;
Ritor1
parents:
diff changeset
1429 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1430 }
Ritor1
parents:
diff changeset
1431 }
Ritor1
parents:
diff changeset
1432 v39 = (int)&v21->field_100;
Ritor1
parents:
diff changeset
1433 if ( v21->field_100 )
Ritor1
parents:
diff changeset
1434 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1435 v40 = *(int *)v39 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1436 if ( v40 > 0 )
Ritor1
parents:
diff changeset
1437 {
Ritor1
parents:
diff changeset
1438 *(int *)v39 = v40;
Ritor1
parents:
diff changeset
1439 }
Ritor1
parents:
diff changeset
1440 else
Ritor1
parents:
diff changeset
1441 {
Ritor1
parents:
diff changeset
1442 *(int *)v39 = 0;
Ritor1
parents:
diff changeset
1443 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1444 }
Ritor1
parents:
diff changeset
1445 }
Ritor1
parents:
diff changeset
1446 v41 = (int)&v21->field_104;
Ritor1
parents:
diff changeset
1447 if ( v21->field_104 )
Ritor1
parents:
diff changeset
1448 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
1449 v42 = *(int *)v41 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
1450 if ( v42 > 0 )
Ritor1
parents:
diff changeset
1451 {
Ritor1
parents:
diff changeset
1452 *(int *)v41 = v42;
Ritor1
parents:
diff changeset
1453 }
Ritor1
parents:
diff changeset
1454 else
Ritor1
parents:
diff changeset
1455 {
Ritor1
parents:
diff changeset
1456 *(int *)v41 = 0;
Ritor1
parents:
diff changeset
1457 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1458 }
Ritor1
parents:
diff changeset
1459 }
Ritor1
parents:
diff changeset
1460 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] )
Ritor1
parents:
diff changeset
1461 --v65;
Ritor1
parents:
diff changeset
1462 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0;
Ritor1
parents:
diff changeset
1463
Ritor1
parents:
diff changeset
1464 for (uint k = 0; k < 24; ++k)
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1465 v21->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed);
0
Ritor1
parents:
diff changeset
1466
Ritor1
parents:
diff changeset
1467 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
1468 v21->SetCondition(1u, 0);
Ritor1
parents:
diff changeset
1469 ++v62;
Ritor1
parents:
diff changeset
1470 }
Ritor1
parents:
diff changeset
1471 while ( (signed int)v62 <= (signed int)&pPlayers[4] );
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1472 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
0
Ritor1
parents:
diff changeset
1473
Ritor1
parents:
diff changeset
1474 for (uint i = 0; i < 20; ++i)
Ritor1
parents:
diff changeset
1475 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
1476 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1)
0
Ritor1
parents:
diff changeset
1477 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1478 }
Ritor1
parents:
diff changeset
1479
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1480 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 )
0
Ritor1
parents:
diff changeset
1481 {
Ritor1
parents:
diff changeset
1482 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1483 pParty->pPlayers[i].SetCondition(1, 0);
Ritor1
parents:
diff changeset
1484 }
Ritor1
parents:
diff changeset
1485
Ritor1
parents:
diff changeset
1486 for (uint i = 0; i < 2; ++i)
Ritor1
parents:
diff changeset
1487 {
Ritor1
parents:
diff changeset
1488 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]];
Ritor1
parents:
diff changeset
1489 if (pBuf->uExpireTime == 0)
Ritor1
parents:
diff changeset
1490 continue;
Ritor1
parents:
diff changeset
1491
Ritor1
parents:
diff changeset
1492 if ( !(pBuf->uFlags & 1) )
Ritor1
parents:
diff changeset
1493 {
Ritor1
parents:
diff changeset
1494 if (!pPlayers[pBuf->uCaster]->CanAct())
Ritor1
parents:
diff changeset
1495 {
Ritor1
parents:
diff changeset
1496 pBuf->Reset();
Ritor1
parents:
diff changeset
1497 if (dword_4EE07C[i] == 7 )
Ritor1
parents:
diff changeset
1498 pParty->bFlying = false;
Ritor1
parents:
diff changeset
1499 }
Ritor1
parents:
diff changeset
1500 }
Ritor1
parents:
diff changeset
1501 }
Ritor1
parents:
diff changeset
1502
Ritor1
parents:
diff changeset
1503 v51 = v65;
Ritor1
parents:
diff changeset
1504 if ( v65 )
Ritor1
parents:
diff changeset
1505 goto LABEL_135;
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1506 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
1507 {
Ritor1
parents:
diff changeset
1508 v52 = (signed int)&pPlayers[1];
Ritor1
parents:
diff changeset
1509 while ( 1 )
Ritor1
parents:
diff changeset
1510 {
Ritor1
parents:
diff changeset
1511 v53 = *(int *)v52;
Ritor1
parents:
diff changeset
1512 if ( *(_QWORD *)(*(int *)v52 + 16) )
Ritor1
parents:
diff changeset
1513 break;
Ritor1
parents:
diff changeset
1514 v52 += 4;
Ritor1
parents:
diff changeset
1515 if ( v52 > (signed int)&pPlayers[4] )
Ritor1
parents:
diff changeset
1516 goto LABEL_135;
Ritor1
parents:
diff changeset
1517 }
Ritor1
parents:
diff changeset
1518 *(int *)(v53 + 16) = 0;
Ritor1
parents:
diff changeset
1519 *(int *)(v53 + 20) = 0;
Ritor1
parents:
diff changeset
1520 v51 = 1;
Ritor1
parents:
diff changeset
1521 LABEL_135:
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1522 if ( pCurrentScreen != SCREEN_REST
0
Ritor1
parents:
diff changeset
1523 && (!v51 || dword_5C35C0) )
981
a6ef7125f6e4 Autonotes & GameState
Nomad
parents: 978
diff changeset
1524 uGameState = GAME_STATE_PARTY_DIED;
0
Ritor1
parents:
diff changeset
1525 }
Ritor1
parents:
diff changeset
1526 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
1527 {
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
1528 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
1529 {
Ritor1
parents:
diff changeset
1530 v54 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
1531 if ( v54->pConditions[2]
Ritor1
parents:
diff changeset
1532 || v54->pConditions[12]
Ritor1
parents:
diff changeset
1533 || v54->pConditions[13]
Ritor1
parents:
diff changeset
1534 || v54->pConditions[14]
Ritor1
parents:
diff changeset
1535 || v54->pConditions[15]
Ritor1
parents:
diff changeset
1536 || v54->pConditions[16] )
Ritor1
parents:
diff changeset
1537 {
Ritor1
parents:
diff changeset
1538 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1539 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
1540 }
Ritor1
parents:
diff changeset
1541 }
Ritor1
parents:
diff changeset
1542 }
Ritor1
parents:
diff changeset
1543 }
Ritor1
parents:
diff changeset
1544
Ritor1
parents:
diff changeset
1545 //----- (00494820) --------------------------------------------------------
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1546 unsigned int __fastcall _494820_training_time(unsigned int a1)
0
Ritor1
parents:
diff changeset
1547 {
Ritor1
parents:
diff changeset
1548 signed int v1; // eax@1
Ritor1
parents:
diff changeset
1549
Ritor1
parents:
diff changeset
1550 v1 = 5;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1551 if ( a1 % 24 >= 5 )
0
Ritor1
parents:
diff changeset
1552 v1 = 29;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
1553 return v1 - a1 % 24;
0
Ritor1
parents:
diff changeset
1554 }
Ritor1
parents:
diff changeset
1555
Ritor1
parents:
diff changeset
1556 //----- (00494836) --------------------------------------------------------
Ritor1
parents:
diff changeset
1557 int stru339_spell_sound::_494836(int uSoundID, int a6)
Ritor1
parents:
diff changeset
1558 {
Ritor1
parents:
diff changeset
1559 int v3; // esi@1
Ritor1
parents:
diff changeset
1560 int result; // eax@1
Ritor1
parents:
diff changeset
1561 stru339_spell_sound *v5; // ebx@1
Ritor1
parents:
diff changeset
1562 int *v6; // edi@2
Ritor1
parents:
diff changeset
1563 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
1564 int v8; // [sp+Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
1565 int v9; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
1566 int a2a; // [sp+1Ch] [bp+8h]@1
Ritor1
parents:
diff changeset
1567
Ritor1
parents:
diff changeset
1568 v3 = 0;
Ritor1
parents:
diff changeset
1569 result = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
1570 v5 = this;
Ritor1
parents:
diff changeset
1571 a2a = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
1572 if ( result )
Ritor1
parents:
diff changeset
1573 {
Ritor1
parents:
diff changeset
1574 v9 = 0;
Ritor1
parents:
diff changeset
1575 v6 = this->pSoundsOffsets;
Ritor1
parents:
diff changeset
1576 do
Ritor1
parents:
diff changeset
1577 {
Ritor1
parents:
diff changeset
1578 v7 = a2a++;
Ritor1
parents:
diff changeset
1579 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6);
Ritor1
parents:
diff changeset
1580 if ( !result )
Ritor1
parents:
diff changeset
1581 break;
Ritor1
parents:
diff changeset
1582 a6 += 4;
Ritor1
parents:
diff changeset
1583 result = v8 + 256;
Ritor1
parents:
diff changeset
1584 *v6 = v3;
Ritor1
parents:
diff changeset
1585 v3 += result;
Ritor1
parents:
diff changeset
1586 ++v9;
Ritor1
parents:
diff changeset
1587 *(v6 - 2) = result;
Ritor1
parents:
diff changeset
1588 ++v6;
Ritor1
parents:
diff changeset
1589 }
Ritor1
parents:
diff changeset
1590 while ( v9 < 2 );
Ritor1
parents:
diff changeset
1591 }
Ritor1
parents:
diff changeset
1592 return result;
Ritor1
parents:
diff changeset
1593 }
Ritor1
parents:
diff changeset
1594 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
1595
Ritor1
parents:
diff changeset
1596 //----- (00494AED) --------------------------------------------------------
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
1597 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
0
Ritor1
parents:
diff changeset
1598 {
Ritor1
parents:
diff changeset
1599 unsigned int _uNumFrames; // edx@1
Ritor1
parents:
diff changeset
1600 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
1601 PlayerFrame *v4; // ecx@2
Ritor1
parents:
diff changeset
1602
Ritor1
parents:
diff changeset
1603 _uNumFrames = this->uNumFrames;
Ritor1
parents:
diff changeset
1604 result = 0;
Ritor1
parents:
diff changeset
1605 if ( (signed int)this->uNumFrames <= 0 )
Ritor1
parents:
diff changeset
1606 {
Ritor1
parents:
diff changeset
1607 result = 0;
Ritor1
parents:
diff changeset
1608 }
Ritor1
parents:
diff changeset
1609 else
Ritor1
parents:
diff changeset
1610 {
Ritor1
parents:
diff changeset
1611 v4 = this->pFrames;
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
1612 while ( v4->expression != expression )
0
Ritor1
parents:
diff changeset
1613 {
Ritor1
parents:
diff changeset
1614 ++result;
Ritor1
parents:
diff changeset
1615 ++v4;
Ritor1
parents:
diff changeset
1616 if ( (signed int)result >= (signed int)_uNumFrames )
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1617 return 0;
0
Ritor1
parents:
diff changeset
1618 }
Ritor1
parents:
diff changeset
1619 }
Ritor1
parents:
diff changeset
1620 return result;
Ritor1
parents:
diff changeset
1621 }
Ritor1
parents:
diff changeset
1622
Ritor1
parents:
diff changeset
1623 //----- (00494B10) --------------------------------------------------------
Ritor1
parents:
diff changeset
1624 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
1625 {
Ritor1
parents:
diff changeset
1626 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
1627 PlayerFrame *v4; // edi@1
Ritor1
parents:
diff changeset
1628 PlayerFrame *v5; // ecx@1
Ritor1
parents:
diff changeset
1629 __int16 v6; // dx@2
Ritor1
parents:
diff changeset
1630 int v7; // edx@3
Ritor1
parents:
diff changeset
1631 char *i; // eax@3
Ritor1
parents:
diff changeset
1632 int v9; // ecx@5
Ritor1
parents:
diff changeset
1633 PlayerFrame *result; // eax@6
Ritor1
parents:
diff changeset
1634
Ritor1
parents:
diff changeset
1635 v3 = uFramesetID;
Ritor1
parents:
diff changeset
1636 v4 = this->pFrames;
Ritor1
parents:
diff changeset
1637 v5 = &v4[uFramesetID];
Ritor1
parents:
diff changeset
1638 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
1639 {
Ritor1
parents:
diff changeset
1640 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6;
Ritor1
parents:
diff changeset
1641 for ( i = (char *)&v5->uAnimTime; ; i += 10 )
Ritor1
parents:
diff changeset
1642 {
Ritor1
parents:
diff changeset
1643 v9 = *(short *)i;
Ritor1
parents:
diff changeset
1644 if ( v7 <= v9 )
Ritor1
parents:
diff changeset
1645 break;
Ritor1
parents:
diff changeset
1646 v7 -= v9;
Ritor1
parents:
diff changeset
1647 ++v3;
Ritor1
parents:
diff changeset
1648 }
Ritor1
parents:
diff changeset
1649 result = &v4[v3];
Ritor1
parents:
diff changeset
1650 }
Ritor1
parents:
diff changeset
1651 else
Ritor1
parents:
diff changeset
1652 {
Ritor1
parents:
diff changeset
1653 result = &v4[uFramesetID];
Ritor1
parents:
diff changeset
1654 }
Ritor1
parents:
diff changeset
1655 return result;
Ritor1
parents:
diff changeset
1656 }
Ritor1
parents:
diff changeset
1657
Ritor1
parents:
diff changeset
1658 //----- (00494B5E) --------------------------------------------------------
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1659 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
0
Ritor1
parents:
diff changeset
1660 {
Ritor1
parents:
diff changeset
1661 PlayerFrameTable *v4; // edi@1
Ritor1
parents:
diff changeset
1662 int v5; // esi@1
Ritor1
parents:
diff changeset
1663 int v6; // eax@2
Ritor1
parents:
diff changeset
1664
Ritor1
parents:
diff changeset
1665 v4 = this;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1666 v5 = a4 + *pAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1667 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
1668 {
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1669 *pAnimTime = v5;
0
Ritor1
parents:
diff changeset
1670 }
Ritor1
parents:
diff changeset
1671 else
Ritor1
parents:
diff changeset
1672 {
Ritor1
parents:
diff changeset
1673 v6 = rand() % 4 + 21;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1674 *pFramesetID = v6;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1675 *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
1676 }
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1677 return &v4->pFrames[*pFramesetID];
0
Ritor1
parents:
diff changeset
1678 }
Ritor1
parents:
diff changeset
1679
Ritor1
parents:
diff changeset
1680 //----- (00494BC3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1681 void PlayerFrameTable::ToFile()
Ritor1
parents:
diff changeset
1682 {
Ritor1
parents:
diff changeset
1683 PlayerFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
1684 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
1685 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
1686
Ritor1
parents:
diff changeset
1687 auto Str = this;
Ritor1
parents:
diff changeset
1688
Ritor1
parents:
diff changeset
1689 v1 = Str;
Ritor1
parents:
diff changeset
1690 v2 = fopen("data\\dpft.bin", "wb");
Ritor1
parents:
diff changeset
1691 v3 = v2;
Ritor1
parents:
diff changeset
1692 if ( !v2 )
Ritor1
parents:
diff changeset
1693 Abortf("Unable to save dpft.bin!");
Ritor1
parents:
diff changeset
1694 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
1695 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
Ritor1
parents:
diff changeset
1696 fclose(v3);
Ritor1
parents:
diff changeset
1697 }
Ritor1
parents:
diff changeset
1698
Ritor1
parents:
diff changeset
1699 //----- (00494C0F) --------------------------------------------------------
Ritor1
parents:
diff changeset
1700 void PlayerFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
1701 {
Ritor1
parents:
diff changeset
1702 uNumFrames = *(int *)pSerialized;
Ritor1
parents:
diff changeset
1703 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames");
Ritor1
parents:
diff changeset
1704 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames);
Ritor1
parents:
diff changeset
1705 }
Ritor1
parents:
diff changeset
1706
Ritor1
parents:
diff changeset
1707 //----- (00494C5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1708 int PlayerFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
1709 {
Ritor1
parents:
diff changeset
1710 PlayerFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
1711 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
1712 int v4; // esi@3
Ritor1
parents:
diff changeset
1713 void *v5; // eax@10
Ritor1
parents:
diff changeset
1714 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
1715 char *i; // eax@12
Ritor1
parents:
diff changeset
1716 __int16 v8; // ax@15
Ritor1
parents:
diff changeset
1717 const char *v9; // ST10_4@15
Ritor1
parents:
diff changeset
1718 unsigned __int16 v10; // ax@15
Ritor1
parents:
diff changeset
1719 const char *v11; // ST0C_4@15
Ritor1
parents:
diff changeset
1720 int j; // esi@15
Ritor1
parents:
diff changeset
1721 int v13; // eax@17
Ritor1
parents:
diff changeset
1722 int v14; // edx@22
Ritor1
parents:
diff changeset
1723 int v15; // ecx@23
Ritor1
parents:
diff changeset
1724 int v16; // eax@24
Ritor1
parents:
diff changeset
1725 signed int k; // eax@27
Ritor1
parents:
diff changeset
1726 PlayerFrame *v18; // edx@28
Ritor1
parents:
diff changeset
1727 int v19; // esi@28
Ritor1
parents:
diff changeset
1728 int l; // ecx@29
Ritor1
parents:
diff changeset
1729 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
1730 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
1731 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
1732 int v25; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
1733 int v26; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
1734 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
1735 int Argsa; // [sp+30Ch] [bp+8h]@28
Ritor1
parents:
diff changeset
1736
Ritor1
parents:
diff changeset
1737 v2 = this;
Ritor1
parents:
diff changeset
1738 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
1739 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
1740 File = v3;
Ritor1
parents:
diff changeset
1741 if ( !v3 )
Ritor1
parents:
diff changeset
1742 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
1743 v4 = 0;
Ritor1
parents:
diff changeset
1744 v25 = 0;
Ritor1
parents:
diff changeset
1745 v26 = 1;
Ritor1
parents:
diff changeset
1746 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
1747 {
Ritor1
parents:
diff changeset
1748 do
Ritor1
parents:
diff changeset
1749 {
Ritor1
parents:
diff changeset
1750 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
1751 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
1752 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1753 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1754 if ( v24.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
1755 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
Ritor1
parents:
diff changeset
1756 ++v25;
Ritor1
parents:
diff changeset
1757 }
Ritor1
parents:
diff changeset
1758 ++v26;
Ritor1
parents:
diff changeset
1759 }
Ritor1
parents:
diff changeset
1760 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
1761 v4 = v25;
Ritor1
parents:
diff changeset
1762 }
Ritor1
parents:
diff changeset
1763 v2->uNumFrames = v4;
Ritor1
parents:
diff changeset
1764 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
Ritor1
parents:
diff changeset
1765 v2->pFrames = (PlayerFrame *)v5;
Ritor1
parents:
diff changeset
1766 if ( !v5 )
Ritor1
parents:
diff changeset
1767 Abortf("PlayerFrameTable::load - Out of Memory!");
Ritor1
parents:
diff changeset
1768 v6 = File;
Ritor1
parents:
diff changeset
1769 v2->uNumFrames = 0;
Ritor1
parents:
diff changeset
1770 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
1771 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
1772 {
Ritor1
parents:
diff changeset
1773 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
1774 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
1775 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
1776 {
Ritor1
parents:
diff changeset
1777 v8 = atoi(v24.pProperties[0]);
Ritor1
parents:
diff changeset
1778 v9 = v24.pProperties[1];
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
1779 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8;
0
Ritor1
parents:
diff changeset
1780 v10 = atoi(v9);
Ritor1
parents:
diff changeset
1781 v11 = v24.pProperties[2];
Ritor1
parents:
diff changeset
1782 v2->pFrames[v2->uNumFrames].uTextureID = v10;
Ritor1
parents:
diff changeset
1783 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11);
Ritor1
parents:
diff changeset
1784 v2->pFrames[v2->uNumFrames].uAnimLength = 0;
Ritor1
parents:
diff changeset
1785 v2->pFrames[v2->uNumFrames].uFlags = 0;
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1786 for ( j = 3; j < v24.uPropCount; ++j )
0
Ritor1
parents:
diff changeset
1787 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
1788 if ( !_stricmp(v24.pProperties[j], "New") )
0
Ritor1
parents:
diff changeset
1789 {
Ritor1
parents:
diff changeset
1790 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags;
Ritor1
parents:
diff changeset
1791 *(char *)v13 |= 4u;
Ritor1
parents:
diff changeset
1792 }
Ritor1
parents:
diff changeset
1793 }
Ritor1
parents:
diff changeset
1794 ++v2->uNumFrames;
Ritor1
parents:
diff changeset
1795 }
Ritor1
parents:
diff changeset
1796 }
Ritor1
parents:
diff changeset
1797 fclose(File);
Ritor1
parents:
diff changeset
1798 v14 = 0;
Ritor1
parents:
diff changeset
1799 if ( (signed int)(v2->uNumFrames - 1) > 0 )
Ritor1
parents:
diff changeset
1800 {
Ritor1
parents:
diff changeset
1801 v15 = 0;
Ritor1
parents:
diff changeset
1802 do
Ritor1
parents:
diff changeset
1803 {
Ritor1
parents:
diff changeset
1804 v16 = (int)&v2->pFrames[v15];
Ritor1
parents:
diff changeset
1805 if ( !(*(char *)(v16 + 18) & 4) )
Ritor1
parents:
diff changeset
1806 *(char *)(v16 + 8) |= 1u;
Ritor1
parents:
diff changeset
1807 ++v14;
Ritor1
parents:
diff changeset
1808 ++v15;
Ritor1
parents:
diff changeset
1809 }
Ritor1
parents:
diff changeset
1810 while ( v14 < (signed int)(v2->uNumFrames - 1) );
Ritor1
parents:
diff changeset
1811 }
Ritor1
parents:
diff changeset
1812 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 )
Ritor1
parents:
diff changeset
1813 {
Ritor1
parents:
diff changeset
1814 v18 = v2->pFrames;
Ritor1
parents:
diff changeset
1815 Argsa = (int)&v18[k];
Ritor1
parents:
diff changeset
1816 v19 = *(short *)(Argsa + 4);
Ritor1
parents:
diff changeset
1817 if ( *(char *)(Argsa + 8) & 1 )
Ritor1
parents:
diff changeset
1818 {
Ritor1
parents:
diff changeset
1819 ++k;
Ritor1
parents:
diff changeset
1820 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 )
Ritor1
parents:
diff changeset
1821 {
Ritor1
parents:
diff changeset
1822 v19 += *(short *)(l + 4);
Ritor1
parents:
diff changeset
1823 ++k;
Ritor1
parents:
diff changeset
1824 }
Ritor1
parents:
diff changeset
1825 LOWORD(v19) = v18[k].uAnimTime + v19;
Ritor1
parents:
diff changeset
1826 }
Ritor1
parents:
diff changeset
1827 ++k;
Ritor1
parents:
diff changeset
1828 }
Ritor1
parents:
diff changeset
1829 return 1;
Ritor1
parents:
diff changeset
1830 }
Ritor1
parents:
diff changeset
1831
Ritor1
parents:
diff changeset
1832 //----- (00495366) --------------------------------------------------------
Ritor1
parents:
diff changeset
1833 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2)
Ritor1
parents:
diff changeset
1834 {
Ritor1
parents:
diff changeset
1835 int v2; // edi@1
Ritor1
parents:
diff changeset
1836 int v3; // edx@2
Ritor1
parents:
diff changeset
1837 int v4; // esi@3
Ritor1
parents:
diff changeset
1838 int v5; // ebx@5
Ritor1
parents:
diff changeset
1839 signed int v7; // [sp+Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
1840 signed int v8; // [sp+10h] [bp-10h]@1
Ritor1
parents:
diff changeset
1841 int **v9; // [sp+14h] [bp-Ch]@4
Ritor1
parents:
diff changeset
1842 signed int v10; // [sp+18h] [bp-8h]@3
Ritor1
parents:
diff changeset
1843 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1844
Ritor1
parents:
diff changeset
1845 v2 = a1;
Ritor1
parents:
diff changeset
1846 v11 = a2;
Ritor1
parents:
diff changeset
1847 v8 = 0;
Ritor1
parents:
diff changeset
1848 v7 = 0;
Ritor1
parents:
diff changeset
1849 if ( dword_AE336C == a1 )
Ritor1
parents:
diff changeset
1850 {
Ritor1
parents:
diff changeset
1851 v3 = dword_AE3370;
Ritor1
parents:
diff changeset
1852 }
Ritor1
parents:
diff changeset
1853 else
Ritor1
parents:
diff changeset
1854 {
Ritor1
parents:
diff changeset
1855 v4 = a2;
Ritor1
parents:
diff changeset
1856 dword_AE336C = a1;
Ritor1
parents:
diff changeset
1857 v10 = 0;
Ritor1
parents:
diff changeset
1858 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 )
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1859 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1860 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1861 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1862 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1863 {
0
Ritor1
parents:
diff changeset
1864 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4);
Ritor1
parents:
diff changeset
1865 do
Ritor1
parents:
diff changeset
1866 {
Ritor1
parents:
diff changeset
1867 v5 = tolower(*(char *)*v9);
Ritor1
parents:
diff changeset
1868 if ( v5 == tolower(v2) )
Ritor1
parents:
diff changeset
1869 {
Ritor1
parents:
diff changeset
1870 if ( v8 )
Ritor1
parents:
diff changeset
1871 v7 = v10;
Ritor1
parents:
diff changeset
1872 else
Ritor1
parents:
diff changeset
1873 v8 = v10;
Ritor1
parents:
diff changeset
1874 }
Ritor1
parents:
diff changeset
1875 ++v10;
Ritor1
parents:
diff changeset
1876 v9 += 2;
Ritor1
parents:
diff changeset
1877 }
Ritor1
parents:
diff changeset
1878 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] );
Ritor1
parents:
diff changeset
1879 if ( v8 && v8 != v7 )
Ritor1
parents:
diff changeset
1880 v3 = v8 + rand() % (v7 - v8);
Ritor1
parents:
diff changeset
1881 else
Ritor1
parents:
diff changeset
1882 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
1883 }
0
Ritor1
parents:
diff changeset
1884 }
Ritor1
parents:
diff changeset
1885 dword_AE3370 = v3;
Ritor1
parents:
diff changeset
1886 return pNPCStats->pNPCNames[0][v11 + 2 * v3];
Ritor1
parents:
diff changeset
1887 }
Ritor1
parents:
diff changeset
1888 // AE336C: using guessed type int dword_AE336C;
Ritor1
parents:
diff changeset
1889 // AE3370: using guessed type int dword_AE3370;
Ritor1
parents:
diff changeset
1890
Ritor1
parents:
diff changeset
1891 //----- (00495430) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
1892 char * GetReputationString( signed int a1 )
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
1893 {
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1894 if (a1 >= 25)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1895 return pGlobalTXT_LocalizationStrings[379]; // Hated
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1896 else if (a1 >= 6)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1897 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1898 else if (a1 >= -5)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1899 return pGlobalTXT_LocalizationStrings[399]; // Neutral;
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1900 else if (a1 >= -24)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1901 return pGlobalTXT_LocalizationStrings[402]; // Friendly
0
Ritor1
parents:
diff changeset
1902 else
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1903 return pGlobalTXT_LocalizationStrings[434]; // Respected;
0
Ritor1
parents:
diff changeset
1904 }
Ritor1
parents:
diff changeset
1905
Ritor1
parents:
diff changeset
1906 //----- (00495461) --------------------------------------------------------
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1409
diff changeset
1907 char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
0
Ritor1
parents:
diff changeset
1908 {
Ritor1
parents:
diff changeset
1909 unsigned __int8 v6; // bl@1
Ritor1
parents:
diff changeset
1910 Player *pPlayer; // ebx@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1911 //NPCData *v9; // eax@4
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
1912 //size_t v10; // eax@6
0
Ritor1
parents:
diff changeset
1913 char *v11; // esi@7
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1914 //int v12; // edx@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1915 //ItemGen *v13; // edi@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1916 //char v14; // cl@8
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1917 //char *v15; // ecx@10
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1918 //int v16; // edx@10
0
Ritor1
parents:
diff changeset
1919 int v17; // eax@10
Ritor1
parents:
diff changeset
1920 signed __int64 v18; // qax@18
Ritor1
parents:
diff changeset
1921 unsigned int v19; // edi@32
Ritor1
parents:
diff changeset
1922 unsigned __int8 *v20; // ebx@32
Ritor1
parents:
diff changeset
1923 int v21; // ecx@34
Ritor1
parents:
diff changeset
1924 __int16 v22; // ax@34
Ritor1
parents:
diff changeset
1925 int v23; // edx@39
Ritor1
parents:
diff changeset
1926 int v24; // eax@39
Ritor1
parents:
diff changeset
1927 int v25; // eax@45
Ritor1
parents:
diff changeset
1928 float *v26; // esi@68
Ritor1
parents:
diff changeset
1929 float v27; // ST18_4@68
Ritor1
parents:
diff changeset
1930 signed int v28; // eax@68
Ritor1
parents:
diff changeset
1931 int v29; // eax@68
Ritor1
parents:
diff changeset
1932 float v30; // ST18_4@72
Ritor1
parents:
diff changeset
1933 signed int v31; // eax@72
Ritor1
parents:
diff changeset
1934 float v32; // ST18_4@74
Ritor1
parents:
diff changeset
1935 signed int v33; // eax@74
Ritor1
parents:
diff changeset
1936 double v34; // st7@75
Ritor1
parents:
diff changeset
1937 float v35; // ST18_4@76
Ritor1
parents:
diff changeset
1938 signed int v36; // eax@76
Ritor1
parents:
diff changeset
1939 float *v37; // esi@78
Ritor1
parents:
diff changeset
1940 float v38; // ST18_4@78
Ritor1
parents:
diff changeset
1941 int v39; // eax@78
Ritor1
parents:
diff changeset
1942 float v40; // ST18_4@82
Ritor1
parents:
diff changeset
1943 int v41; // eax@82
Ritor1
parents:
diff changeset
1944 float v42; // ST18_4@83
Ritor1
parents:
diff changeset
1945 int v43; // eax@83
Ritor1
parents:
diff changeset
1946 float v44; // ST18_4@85
Ritor1
parents:
diff changeset
1947 int v45; // eax@85
Ritor1
parents:
diff changeset
1948 const char *v46; // eax@86
Ritor1
parents:
diff changeset
1949 unsigned int v47; // eax@87
Ritor1
parents:
diff changeset
1950 float v48; // ST18_4@97
Ritor1
parents:
diff changeset
1951 __int64 v49; // ST14_8@107
Ritor1
parents:
diff changeset
1952 int v50; // eax@107
Ritor1
parents:
diff changeset
1953 int v51; // eax@108
Ritor1
parents:
diff changeset
1954 Player *v52; // eax@109
Ritor1
parents:
diff changeset
1955 int v53; // [sp-4h] [bp-13Ch]@107
Ritor1
parents:
diff changeset
1956 int v54; // [sp+0h] [bp-138h]@107
Ritor1
parents:
diff changeset
1957 __int16 v55[56]; // [sp+10h] [bp-128h]@34
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1958 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1959 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
0
Ritor1
parents:
diff changeset
1960 char a1[100]; // [sp+B8h] [bp-80h]@3
Ritor1
parents:
diff changeset
1961 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1962 //size_t v60; // [sp+120h] [bp-18h]@3
249
Nomad
parents: 248
diff changeset
1963 //Player *v61; // [sp+124h] [bp-14h]@3
Nomad
parents: 248
diff changeset
1964 //char *Str; // [sp+128h] [bp-10h]@1
0
Ritor1
parents:
diff changeset
1965 int v63; // [sp+12Ch] [bp-Ch]@32
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1966 //int v64; // [sp+130h] [bp-8h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1967 //NPCData *v65; // [sp+134h] [bp-4h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1968 //int packed;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1969
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1970
0
Ritor1
parents:
diff changeset
1971
Ritor1
parents:
diff changeset
1972 v6 = uPlayerID;
249
Nomad
parents: 248
diff changeset
1973 //Str = lpsz;
0
Ritor1
parents:
diff changeset
1974 if ( IsBadStringPtrA(lpsz, 1u) )
Ritor1
parents:
diff changeset
1975 return "Invalid String Passed";
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1976
0
Ritor1
parents:
diff changeset
1977 a1[0] = 0;
Ritor1
parents:
diff changeset
1978 pPlayer = &pParty->pPlayers[v6];
949
Nomad
parents: 948
diff changeset
1979 v59 = TargetColor(255, 255, 155);
249
Nomad
parents: 248
diff changeset
1980 //v61 = pPlayer;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1981 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1982
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1983 NPCData *npc = nullptr;
0
Ritor1
parents:
diff changeset
1984 if ( dword_5C35D4 )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
1985 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
1986 //__debugbreak(); // fix
1211
fd3bea473c0c fix HouseNpcdata array addresiing
Gloval
parents: 1209
diff changeset
1987 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
1988 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1989 else
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
1990 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1991 //v65 = v9;
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
1992 //v10 = 0;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1993 //v64 = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1994
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1995 //int i = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1996 //if ( (signed int)v60 > 0 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1997 v11 = a4;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1998
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1999 auto len = strlen(lpsz);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2000 for (int i = 0, dst = 0; i < len; ++i)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2001 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2002 //v12 = v64;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2003 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2004 //while ( 1 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2005 //{
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2006 char c = lpsz[i];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2007 if (c != '%')
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2008 pTmpBuf2[dst++] = c;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2009 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2010 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2011 //v15 = &lpsz[v12 + 1];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2012 //v16 = (unsigned __int8)lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2013 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2014 //v17 = packed - 528;// 10 * '0' + '0'
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2015 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
2016
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2017 switch ( v17 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2018 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2019 case 1:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2020 v11 = npc->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2021 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2022 case 2:
0
Ritor1
parents:
diff changeset
2023 v11 = pPlayer->pName;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2024 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2025 case 3:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2026 case 4:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2027 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2028 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2029 case 5:
0
Ritor1
parents:
diff changeset
2030 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
Ritor1
parents:
diff changeset
2031 v11 = pGlobalTXT_LocalizationStrings[397];// "evening"
Ritor1
parents:
diff changeset
2032 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
Ritor1
parents:
diff changeset
2033 {
Ritor1
parents:
diff changeset
2034 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB )
Ritor1
parents:
diff changeset
2035 {
Ritor1
parents:
diff changeset
2036 if ( v18 < 20 )
Ritor1
parents:
diff changeset
2037 v11 = pGlobalTXT_LocalizationStrings[396];// "day"
Ritor1
parents:
diff changeset
2038 }
Ritor1
parents:
diff changeset
2039 else
Ritor1
parents:
diff changeset
2040 {
Ritor1
parents:
diff changeset
2041 v11 = pGlobalTXT_LocalizationStrings[395];// "morning"
Ritor1
parents:
diff changeset
2042 }
Ritor1
parents:
diff changeset
2043 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2044 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2045 case 6:
0
Ritor1
parents:
diff changeset
2046 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
2047 v11 = pGlobalTXT_LocalizationStrings[387];// "lady"
Ritor1
parents:
diff changeset
2048 else
Ritor1
parents:
diff changeset
2049 v11 = pGlobalTXT_LocalizationStrings[385];// "sir"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2050 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2051 case 7:
0
Ritor1
parents:
diff changeset
2052 if ( pPlayer->uSex )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2053 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2054 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2055 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2056 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2057 case 8:
0
Ritor1
parents:
diff changeset
2058 v19 = 0;
Ritor1
parents:
diff changeset
2059 v63 = 0;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2060 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
0
Ritor1
parents:
diff changeset
2061 do
Ritor1
parents:
diff changeset
2062 {
Ritor1
parents:
diff changeset
2063 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) )
Ritor1
parents:
diff changeset
2064 {
Ritor1
parents:
diff changeset
2065 v21 = v63;
Ritor1
parents:
diff changeset
2066 v22 = word_4EE150[v19];
Ritor1
parents:
diff changeset
2067 ++v63;
Ritor1
parents:
diff changeset
2068 v55[v21] = v22;
Ritor1
parents:
diff changeset
2069 }
Ritor1
parents:
diff changeset
2070 ++v19;
Ritor1
parents:
diff changeset
2071 }
Ritor1
parents:
diff changeset
2072 while ( v19 < 28 );
Ritor1
parents:
diff changeset
2073 if ( v63 )
Ritor1
parents:
diff changeset
2074 {
Ritor1
parents:
diff changeset
2075 v23 = rand() % v63;
Ritor1
parents:
diff changeset
2076 v24 = dword_A74CDC;
Ritor1
parents:
diff changeset
2077 if ( dword_A74CDC == -1 )
Ritor1
parents:
diff changeset
2078 {
Ritor1
parents:
diff changeset
2079 v24 = v23;
Ritor1
parents:
diff changeset
2080 dword_A74CDC = v23;
Ritor1
parents:
diff changeset
2081 }
492
Gloval
parents: 487
diff changeset
2082 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
0
Ritor1
parents:
diff changeset
2083 }
Ritor1
parents:
diff changeset
2084 else
Ritor1
parents:
diff changeset
2085 {
Ritor1
parents:
diff changeset
2086 v11 = (char *)pNPCTopics[55].pText;
Ritor1
parents:
diff changeset
2087 }
249
Nomad
parents: 248
diff changeset
2088 //pPlayer = v61;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2089 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2090 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2091 case 9:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2092 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2093 v11 = pGlobalTXT_LocalizationStrings[384];// "her"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2094 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2095 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2096 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2097 case 10:
0
Ritor1
parents:
diff changeset
2098 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
2099 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
Ritor1
parents:
diff changeset
2100 else
Ritor1
parents:
diff changeset
2101 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2102 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2103 case 11:
0
Ritor1
parents:
diff changeset
2104 v25 = GetPartyReputation();
1419
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2105 if ( v25 >= 25 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2106 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2107 v11 = pGlobalTXT_LocalizationStrings[379];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2108 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2109 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2110 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2111 if ( v25 < 6 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2112 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2113 if ( v25 >= -5 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2114 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2115 v11 = pGlobalTXT_LocalizationStrings[399];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2116 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2117 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2118 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2119 if ( v25 < -24 )
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2120 v11 = pGlobalTXT_LocalizationStrings[434];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2121 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2122 v11 = pGlobalTXT_LocalizationStrings[402];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2123 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2124 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2125 else
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2126 {
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2127 v11 = pGlobalTXT_LocalizationStrings[392];
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2128 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2129 }
9a1adf08f4ed more label cleaning 2
zipi
parents: 1413
diff changeset
2130 goto _continue_strcat;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2131 case 12:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2132 v25 = npc->rep;
0
Ritor1
parents:
diff changeset
2133 if ( v25 >= 25 )
Ritor1
parents:
diff changeset
2134 {
Ritor1
parents:
diff changeset
2135 v11 = pGlobalTXT_LocalizationStrings[379];
Ritor1
parents:
diff changeset
2136 }
Ritor1
parents:
diff changeset
2137 else
Ritor1
parents:
diff changeset
2138 {
Ritor1
parents:
diff changeset
2139 if ( v25 < 6 )
Ritor1
parents:
diff changeset
2140 {
Ritor1
parents:
diff changeset
2141 if ( v25 >= -5 )
Ritor1
parents:
diff changeset
2142 {
Ritor1
parents:
diff changeset
2143 v11 = pGlobalTXT_LocalizationStrings[399];
Ritor1
parents:
diff changeset
2144 }
Ritor1
parents:
diff changeset
2145 else
Ritor1
parents:
diff changeset
2146 {
Ritor1
parents:
diff changeset
2147 if ( v25 < -24 )
Ritor1
parents:
diff changeset
2148 v11 = pGlobalTXT_LocalizationStrings[434];
Ritor1
parents:
diff changeset
2149 else
Ritor1
parents:
diff changeset
2150 v11 = pGlobalTXT_LocalizationStrings[402];
Ritor1
parents:
diff changeset
2151 }
Ritor1
parents:
diff changeset
2152 }
Ritor1
parents:
diff changeset
2153 else
Ritor1
parents:
diff changeset
2154 {
Ritor1
parents:
diff changeset
2155 v11 = pGlobalTXT_LocalizationStrings[392];
Ritor1
parents:
diff changeset
2156 }
Ritor1
parents:
diff changeset
2157 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2158 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2159 case 13:
0
Ritor1
parents:
diff changeset
2160 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2161 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2162 case 14:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2163 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2164 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2165 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2166 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2167 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2168 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2169 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2170
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2171 case 15:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2172 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2173 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2174 _continue_strcat:
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2175 strcat(pTmpBuf2.data(), v11);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2176 dst = strlen(pTmpBuf2.data());
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2177 //v64 += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2178 i += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2179 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2180 break;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2181
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2182 case 16:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2183 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2184 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2185 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2186 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2187 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2188 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2189 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2190 case 17:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2191 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2192 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
2193 if (!pay_percentage)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2194 pay_percentage = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2195
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2196 sprintf(a1, "%lu", pay_percentage);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2197 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2198 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2199 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2200
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2201 case 18:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2202 case 19:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2203 case 20:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2204 case 21:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2205 case 22:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2206 case 26:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2207 _continue_strncpy:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2208 strncpy(a1, lpsz + i + 1, 2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2209 v51 = atoi(a1);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2210 sprintf(a1, "%lu", v51);
0
Ritor1
parents:
diff changeset
2211 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2212 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2213
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2214 case 23:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2215 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2216 v47 = pMapStats->GetMapInfo(pCurrentMapName.data());
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2217 if ( v47 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2218 v11 = pMapStats->pInfos[v47].pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2219 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2220 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2221 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2222 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2223 case 24:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2224 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2225 v46 = a3->GetDisplayName();
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
2226 sprintfex(a1, format_4E2D80, v59, v46);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2227 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2228 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2229 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2230
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2231
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2232 case 25:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2233 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2234 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2235 v38 = *v37;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2236 v39 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2237 v29 = pPlayer->GetBaseBuyingPrice(v39, v38);
0
Ritor1
parents:
diff changeset
2238 switch ( a5 )
Ritor1
parents:
diff changeset
2239 {
Ritor1
parents:
diff changeset
2240 case 3:
Ritor1
parents:
diff changeset
2241 v44 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2242 v45 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2243 v29 = pPlayer->GetBaseSellingPrice(v45, v44);
0
Ritor1
parents:
diff changeset
2244 break;
Ritor1
parents:
diff changeset
2245 case 4:
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2246 v29 = pPlayer->GetBaseIdentifyPrice(*v37);
0
Ritor1
parents:
diff changeset
2247 break;
Ritor1
parents:
diff changeset
2248 case 5:
Ritor1
parents:
diff changeset
2249 v42 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2250 v43 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2251 v29 = pPlayer->GetBaseRepairPrice(v43, v42);
0
Ritor1
parents:
diff changeset
2252 break;
Ritor1
parents:
diff changeset
2253 case 6:
Ritor1
parents:
diff changeset
2254 v40 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2255 v41 = a3->GetValue();
1275
7569c88d9cb0 renamed a few unnamed functions
Grumpy7
parents: 1267
diff changeset
2256 v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2;
0
Ritor1
parents:
diff changeset
2257 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2258 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2259 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2260 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2261
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2262 case 27:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2263 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2264 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
0
Ritor1
parents:
diff changeset
2265 v27 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2266 v28 = a3->GetValue();
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
2267 v29 = pPlayer->GetBuyingPrice(v28, v27);
0
Ritor1
parents:
diff changeset
2268 if ( a5 == 3 )
Ritor1
parents:
diff changeset
2269 {
Ritor1
parents:
diff changeset
2270 v35 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2271 v36 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
2272 v29 = pPlayer->GetPriceSell(v36, v35);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
2273 if (a3->Broken())
0
Ritor1
parents:
diff changeset
2274 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2275 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
2276 }
Ritor1
parents:
diff changeset
2277 if ( a5 != 4 )
Ritor1
parents:
diff changeset
2278 {
Ritor1
parents:
diff changeset
2279 if ( a5 == 5 )
Ritor1
parents:
diff changeset
2280 {
Ritor1
parents:
diff changeset
2281 v32 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2282 v33 = a3->GetValue();
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2283 v29 = pPlayer->GetPriceRepair(v33, v32);
0
Ritor1
parents:
diff changeset
2284 }
Ritor1
parents:
diff changeset
2285 else
Ritor1
parents:
diff changeset
2286 {
Ritor1
parents:
diff changeset
2287 if ( a5 == 6 )
Ritor1
parents:
diff changeset
2288 {
Ritor1
parents:
diff changeset
2289 v30 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2290 v31 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
2291 v29 = pPlayer->GetPriceSell(v31, v30) / 2;
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
2292 if (a3->Broken())
0
Ritor1
parents:
diff changeset
2293 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2294 if (!v29)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2295 v29 = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2296 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
2297 }
Ritor1
parents:
diff changeset
2298 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2299 _continue_sprintf:
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
2300 sprintfex(a1, "%lu", v29);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2301 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2302 goto _continue_strcat;
0
Ritor1
parents:
diff changeset
2303 }
Ritor1
parents:
diff changeset
2304 v34 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2305
0
Ritor1
parents:
diff changeset
2306 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2307 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2308 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2309 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2310
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2311 case 28:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2312 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2313 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2314 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2315 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2316 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2317
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2318 case 29:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2319 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2320 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2321 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2322 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
2323 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2324 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2325 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2326
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2327 case 30:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2328 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2329 if ( !a6 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2330 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2331 sub_493F79(&v57, *a6);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2332 v54 = v57.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2333 v53 = v57.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2334 v50 = v57.field_14_exprie_month;
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
2335 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2336 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2337 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2338 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2339
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2340 case 31:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2341 case 32:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2342 case 33:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2343 case 34:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2344 v52 = &pParty->pPlayers[v17 - 31];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2345 v11 = v52->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2346 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2347
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2348 default:
0
Ritor1
parents:
diff changeset
2349 if ( v17 <= 50 || v17 > 70 )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2350 goto _continue_strncpy;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2351 if ( v17 - 51 >= 20 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2352 goto _continue_strcat;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2353 v49 = pParty->field_3C._s_times[v17-51];
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2354
0
Ritor1
parents:
diff changeset
2355 sub_493F79(&v56, v49);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2356 v54 = v56.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2357 v53 = v56.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2358 v50 = v56.field_14_exprie_month;
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
2359 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
2360 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2361 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2362 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
2363 }
0
Ritor1
parents:
diff changeset
2364 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2365 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
2366 }
Ritor1
parents:
diff changeset
2367
Ritor1
parents:
diff changeset
2368 //----- (0049B04D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2369 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
0
Ritor1
parents:
diff changeset
2370 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2371 //stru154 *v3; // edi@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2372 //signed int v4; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2373 //signed int result; // eax@9
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2374 //signed int v6; // [sp-8h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
2375 Vec3_float_ v; // [sp+4h] [bp-Ch]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2376 float v7;
0
Ritor1
parents:
diff changeset
2377
Ritor1
parents:
diff changeset
2378 v.x = 0.0;
Ritor1
parents:
diff changeset
2379 v.y = 0.0;
Ritor1
parents:
diff changeset
2380 v.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2381 GetFacePlane(a2, a3, &v, &v7);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2382
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2383 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2384 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2385 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2386 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2387 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
2388 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2389 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2390
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2391 face_plane.vNormal.x = v.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2392 face_plane.vNormal.y = v.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2393 face_plane.vNormal.z = v.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2394 face_plane.dist = v7;
0
Ritor1
parents:
diff changeset
2395 }
Ritor1
parents:
diff changeset
2396
Ritor1
parents:
diff changeset
2397 //----- (0049B0C9) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2398 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
0
Ritor1
parents:
diff changeset
2399 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2400 if (fabsf(pNormal->z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2401 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2402 else if (fabsf(pNormal->x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2403 fabsf(pNormal->y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2404 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
2405 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2406 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2407
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2408 face_plane.vNormal.x = pNormal->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2409 face_plane.dist = dist;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2410 face_plane.vNormal.y = pNormal->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2411 face_plane.vNormal.z = pNormal->z;
0
Ritor1
parents:
diff changeset
2412 }
Ritor1
parents:
diff changeset
2413
Ritor1
parents:
diff changeset
2414 //----- (0049B13D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2415 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
0
Ritor1
parents:
diff changeset
2416 {
Ritor1
parents:
diff changeset
2417 ODMFace *v5; // ebx@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2418 //int v6; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2419 //unsigned __int16 *v7; // ebx@2
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2420 //Vec3_int_ *v8; // eax@3
0
Ritor1
parents:
diff changeset
2421 Vec3_int_ *v9; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2422 //double v10; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2423 //int v11; // ecx@3
0
Ritor1
parents:
diff changeset
2424 Vec3_int_ *v12; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2425 //double v13; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2426 //double v14; // st6@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2427 //double v15; // st5@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2428 //int v16; // ecx@3
0
Ritor1
parents:
diff changeset
2429 Vec3_int_ *v17; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2430 //double v18; // st5@3
0
Ritor1
parents:
diff changeset
2431 Vec3_float_ *v19; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2432 //int result; // eax@8
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2433 //float v21; // ecx@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2434 //double v22; // st7@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2435 //double v23; // st6@10
0
Ritor1
parents:
diff changeset
2436 Vec3_float_ v2; // [sp+4h] [bp-64h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2437 //float v25; // [sp+18h] [bp-50h]@3
0
Ritor1
parents:
diff changeset
2438 float v26; // [sp+1Ch] [bp-4Ch]@3
Ritor1
parents:
diff changeset
2439 float v27; // [sp+20h] [bp-48h]@3
Ritor1
parents:
diff changeset
2440 float v28; // [sp+24h] [bp-44h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2441 //float v29; // [sp+2Ch] [bp-3Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2442 //float v30; // [sp+30h] [bp-38h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2443 //float v31; // [sp+34h] [bp-34h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2444 //float v32; // [sp+38h] [bp-30h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2445 //float v33; // [sp+3Ch] [bp-2Ch]@3
0
Ritor1
parents:
diff changeset
2446 Vec3_float_ v1; // [sp+40h] [bp-28h]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2447 //float v35; // [sp+4Ch] [bp-1Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2448 //float v36; // [sp+50h] [bp-18h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2449 //float v37; // [sp+54h] [bp-14h]@3
0
Ritor1
parents:
diff changeset
2450 Vec3_float_ v38; // [sp+58h] [bp-10h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2451 //int v39; // [sp+64h] [bp-4h]@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2452
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2453 //v39 = 0;
0
Ritor1
parents:
diff changeset
2454 v1.x = 0.0;
Ritor1
parents:
diff changeset
2455 v5 = pFace;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2456 //v6 = pFace->uNumVertices;
0
Ritor1
parents:
diff changeset
2457 v1.y = 0.0;
Ritor1
parents:
diff changeset
2458 v1.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2459
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2460 if (pFace->uNumVertices >= 2)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2461 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2462 int i = 0;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2463 while ( i < pFace->uNumVertices - 2 )
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2464 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2465 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2466 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2467 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
1093
c59ac5ea63f5 * stru154::GetFacePlane mistake fixed
zipi
parents: 1080
diff changeset
2468 i++;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2469 v1.x = v12->x - v9->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2470 v26 = v17->x - v12->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2471 v1.y = v12->y - v9->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2472 v27 = v17->y - v12->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2473 v1.z = v12->z - v9->z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2474 v28 = v17->z - v12->z;
0
Ritor1
parents:
diff changeset
2475 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
Ritor1
parents:
diff changeset
2476 v38.x = v19->x;
Ritor1
parents:
diff changeset
2477 v38.y = v19->y;
Ritor1
parents:
diff changeset
2478 v38.z = v19->z;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2479 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2480 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2481 v38.Normalize();
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2482
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2483 pOutNormal->x = v38.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2484 pOutNormal->y = v38.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2485 pOutNormal->z = v38.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2486
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2487 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2488 return;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2489 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2490 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2491 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2492
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2493 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2494 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2495 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
2496 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
0
Ritor1
parents:
diff changeset
2497 }
Ritor1
parents:
diff changeset
2498
Ritor1
parents:
diff changeset
2499 //----- (0049D700) --------------------------------------------------------
Ritor1
parents:
diff changeset
2500 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
Ritor1
parents:
diff changeset
2501 {
Ritor1
parents:
diff changeset
2502 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
2503 int v2; // ecx@1
Ritor1
parents:
diff changeset
2504 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
2505
Ritor1
parents:
diff changeset
2506 v1 = uDim;
Ritor1
parents:
diff changeset
2507 v2 = 0;
Ritor1
parents:
diff changeset
2508 v3 = v1 - 1;
Ritor1
parents:
diff changeset
2509 while ( v3 & 1 )
Ritor1
parents:
diff changeset
2510 {
Ritor1
parents:
diff changeset
2511 v3 >>= 1;
Ritor1
parents:
diff changeset
2512 ++v2;
Ritor1
parents:
diff changeset
2513 }
Ritor1
parents:
diff changeset
2514 return v3 == 0 ? v2 : 0;
Ritor1
parents:
diff changeset
2515 }
Ritor1
parents:
diff changeset
2516
Ritor1
parents:
diff changeset
2517 //----- (004A19D8) --------------------------------------------------------
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2518 unsigned int BlendColors(unsigned int a1, unsigned int a2)
0
Ritor1
parents:
diff changeset
2519 {
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2520 /*signed __int64 v2; // ST10_8@1
0
Ritor1
parents:
diff changeset
2521 double v3; // st7@1
Ritor1
parents:
diff changeset
2522 float v4; // ST24_4@1
Ritor1
parents:
diff changeset
2523 double v5; // ST10_8@1
Ritor1
parents:
diff changeset
2524 int v6; // ST1C_4@1
Ritor1
parents:
diff changeset
2525 float v7; // ST24_4@1
Ritor1
parents:
diff changeset
2526 double v8; // ST10_8@1
Ritor1
parents:
diff changeset
2527 unsigned __int8 v9; // ST20_1@1
Ritor1
parents:
diff changeset
2528 float v10; // ST24_4@1
Ritor1
parents:
diff changeset
2529 double v11; // ST10_8@1
Ritor1
parents:
diff changeset
2530 float v12; // ST24_4@1
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2531 double v13; // ST08_8@1*/
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2532
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2533 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2534 (a2 >> 24) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2535 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2536 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2537 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2538 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2539 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2540 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f);
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2541 return (alpha << 24) | (red << 16) | (green << 8) | blue;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2542 /*v2 = a1 >> 24;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2543 v3 = (double)v2 / 255.0f;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2544 HIDWORD(v2) = 0;
0
Ritor1
parents:
diff changeset
2545 LODWORD(v2) = a2 >> 24;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2546 v4 = v3 * (double)v2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2547 v5 = v4 + 6.7553994e15;
Ritor1
parents:
diff changeset
2548 v6 = LODWORD(v5);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2549 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0;
0
Ritor1
parents:
diff changeset
2550 v8 = v7 + 6.7553994e15;
Ritor1
parents:
diff changeset
2551 v9 = LOBYTE(v8);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2552 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2553 v11 = v10 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2554 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
2555 v13 = v12 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
2556 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
0
Ritor1
parents:
diff changeset
2557 }
Ritor1
parents:
diff changeset
2558
Ritor1
parents:
diff changeset
2559 //----- (004A46E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2560 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
2561 {
Ritor1
parents:
diff changeset
2562 int v5; // eax@1
Ritor1
parents:
diff changeset
2563 int z; // eax@1
Ritor1
parents:
diff changeset
2564 unsigned int v7; // eax@9
Ritor1
parents:
diff changeset
2565 unsigned int v8; // ecx@9
Ritor1
parents:
diff changeset
2566 int v9; // eax@9
Ritor1
parents:
diff changeset
2567 unsigned int v10; // eax@10
Ritor1
parents:
diff changeset
2568 int *v11; // esi@10
Ritor1
parents:
diff changeset
2569 int *v12; // edi@10
Ritor1
parents:
diff changeset
2570 int v13; // ecx@10
Ritor1
parents:
diff changeset
2571 int v14; // edx@10
Ritor1
parents:
diff changeset
2572 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
2573 int *v16; // esi@22
Ritor1
parents:
diff changeset
2574 int *v17; // edi@22
Ritor1
parents:
diff changeset
2575 int v18; // ecx@22
Ritor1
parents:
diff changeset
2576 int v19; // edx@22
Ritor1
parents:
diff changeset
2577 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9
Ritor1
parents:
diff changeset
2578 int *pTargetZ; // [sp+10h] [bp-4h]@9
Ritor1
parents:
diff changeset
2579 unsigned int v22; // [sp+1Ch] [bp+8h]@9
Ritor1
parents:
diff changeset
2580 signed int v23; // [sp+20h] [bp+Ch]@1
Ritor1
parents:
diff changeset
2581
Ritor1
parents:
diff changeset
2582 v5 = a4;
Ritor1
parents:
diff changeset
2583 v23 = _z >> 16;
Ritor1
parents:
diff changeset
2584 z = x + v5;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2585 if ( z >= (signed int)pViewport->uViewportTL_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2586 && (signed int)x <= (signed int)pViewport->uViewportBR_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2587 && y >= (signed int)pViewport->uViewportTL_Y
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2588 && y <= (signed int)pViewport->uViewportBR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2589 {
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2590 if ( (signed int)x < (signed int)pViewport->uViewportTL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2591 x = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2592 if ( z > (signed int)pViewport->uViewportBR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2593 z = pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
2594 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
2595 v22 = z - x;
Ritor1
parents:
diff changeset
2596 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y];
Ritor1
parents:
diff changeset
2597 v7 = lightColor >> 3;
Ritor1
parents:
diff changeset
2598 v8 = lightColor & 0xF0;
Ritor1
parents:
diff changeset
2599 v9 = v7 & 0x1E0000;
Ritor1
parents:
diff changeset
2600 if ( pRenderer->uTargetGBits == 5 )
Ritor1
parents:
diff changeset
2601 {
Ritor1
parents:
diff changeset
2602 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4;
Ritor1
parents:
diff changeset
2603 v11 = (int *)pTarget;
Ritor1
parents:
diff changeset
2604 v12 = pTargetZ;
Ritor1
parents:
diff changeset
2605 v13 = v22;
Ritor1
parents:
diff changeset
2606 v14 = (v10 << 16) | v10;
Ritor1
parents:
diff changeset
2607 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
2608 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
2609 {
Ritor1
parents:
diff changeset
2610 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
2611 if ( z > v23 )
Ritor1
parents:
diff changeset
2612 {
Ritor1
parents:
diff changeset
2613 z = v14 + ((*pTarget & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
2614 *pTarget = z;
Ritor1
parents:
diff changeset
2615 }
Ritor1
parents:
diff changeset
2616 v13 = v22 - 1;
Ritor1
parents:
diff changeset
2617 v11 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
2618 v12 = pTargetZ + 1;
Ritor1
parents:
diff changeset
2619 }
Ritor1
parents:
diff changeset
2620 while ( v13 != 1 )
Ritor1
parents:
diff changeset
2621 {
Ritor1
parents:
diff changeset
2622 if ( v13 < 1 )
Ritor1
parents:
diff changeset
2623 return z;
Ritor1
parents:
diff changeset
2624 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
2625 if ( z <= v23 )
Ritor1
parents:
diff changeset
2626 {
Ritor1
parents:
diff changeset
2627 v13 -= 2;
Ritor1
parents:
diff changeset
2628 ++v11;
Ritor1
parents:
diff changeset
2629 v12 += 2;
Ritor1
parents:
diff changeset
2630 }
Ritor1
parents:
diff changeset
2631 else
Ritor1
parents:
diff changeset
2632 {
Ritor1
parents:
diff changeset
2633 v12 += 2;
Ritor1
parents:
diff changeset
2634 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1);
Ritor1
parents:
diff changeset
2635 v13 -= 2;
Ritor1
parents:
diff changeset
2636 *v11 = z;
Ritor1
parents:
diff changeset
2637 ++v11;
Ritor1
parents:
diff changeset
2638 }
Ritor1
parents:
diff changeset
2639 }
Ritor1
parents:
diff changeset
2640 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
2641 if ( z > v23 )
Ritor1
parents:
diff changeset
2642 {
Ritor1
parents:
diff changeset
2643 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
2644 *(short *)v11 = z;
Ritor1
parents:
diff changeset
2645 }
Ritor1
parents:
diff changeset
2646 }
Ritor1
parents:
diff changeset
2647 else
Ritor1
parents:
diff changeset
2648 {
Ritor1
parents:
diff changeset
2649 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4;
Ritor1
parents:
diff changeset
2650 v16 = (int *)pTarget;
Ritor1
parents:
diff changeset
2651 v17 = pTargetZ;
Ritor1
parents:
diff changeset
2652 v18 = v22;
Ritor1
parents:
diff changeset
2653 v19 = (v15 << 16) | v15;
Ritor1
parents:
diff changeset
2654 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
2655 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
2656 {
Ritor1
parents:
diff changeset
2657 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
2658 if ( z > v23 )
Ritor1
parents:
diff changeset
2659 {
Ritor1
parents:
diff changeset
2660 z = v19 + ((*pTarget & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
2661 *pTarget = z;
Ritor1
parents:
diff changeset
2662 }
Ritor1
parents:
diff changeset
2663 v18 = v22 - 1;
Ritor1
parents:
diff changeset
2664 v16 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
2665 v17 = pTargetZ + 1;
Ritor1
parents:
diff changeset
2666 }
Ritor1
parents:
diff changeset
2667 while ( v18 != 1 )
Ritor1
parents:
diff changeset
2668 {
Ritor1
parents:
diff changeset
2669 if ( v18 < 1 )
Ritor1
parents:
diff changeset
2670 return z;
Ritor1
parents:
diff changeset
2671 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
2672 if ( z <= v23 )
Ritor1
parents:
diff changeset
2673 {
Ritor1
parents:
diff changeset
2674 v18 -= 2;
Ritor1
parents:
diff changeset
2675 ++v16;
Ritor1
parents:
diff changeset
2676 v17 += 2;
Ritor1
parents:
diff changeset
2677 }
Ritor1
parents:
diff changeset
2678 else
Ritor1
parents:
diff changeset
2679 {
Ritor1
parents:
diff changeset
2680 v17 += 2;
Ritor1
parents:
diff changeset
2681 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1);
Ritor1
parents:
diff changeset
2682 v18 -= 2;
Ritor1
parents:
diff changeset
2683 *v16 = z;
Ritor1
parents:
diff changeset
2684 ++v16;
Ritor1
parents:
diff changeset
2685 }
Ritor1
parents:
diff changeset
2686 }
Ritor1
parents:
diff changeset
2687 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
2688 if ( z > v23 )
Ritor1
parents:
diff changeset
2689 {
Ritor1
parents:
diff changeset
2690 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
2691 *(short *)v16 = z;
Ritor1
parents:
diff changeset
2692 }
Ritor1
parents:
diff changeset
2693 }
Ritor1
parents:
diff changeset
2694 }
Ritor1
parents:
diff changeset
2695 return z;
Ritor1
parents:
diff changeset
2696 }
Ritor1
parents:
diff changeset
2697
Ritor1
parents:
diff changeset
2698 //----- (004A57E9) --------------------------------------------------------
Ritor1
parents:
diff changeset
2699 void __cdecl Present_ColorKey()
Ritor1
parents:
diff changeset
2700 {
Ritor1
parents:
diff changeset
2701 HRESULT v0; // eax@3
Ritor1
parents:
diff changeset
2702 HRESULT v1; // eax@3
Ritor1
parents:
diff changeset
2703 HRESULT v2; // eax@3
Ritor1
parents:
diff changeset
2704 HRESULT v3; // eax@3
Ritor1
parents:
diff changeset
2705 HRESULT v4; // eax@3
Ritor1
parents:
diff changeset
2706 RECT a2; // [sp+4h] [bp-14h]@3
Ritor1
parents:
diff changeset
2707 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
2708
Ritor1
parents:
diff changeset
2709 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
2710 {
Ritor1
parents:
diff changeset
2711 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
2712 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2713 a2.bottom = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
2714 a2.left = 0;
Ritor1
parents:
diff changeset
2715 a2.top = 0;
Ritor1
parents:
diff changeset
2716 a2.right = 640;
Ritor1
parents:
diff changeset
2717 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u));
Ritor1
parents:
diff changeset
2718 a2.right = 640;
Ritor1
parents:
diff changeset
2719 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2720 a2.top = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
2721 a2.bottom = 480;
Ritor1
parents:
diff changeset
2722 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
2723 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2724 pViewport->uViewportBR_Y + 1,
0
Ritor1
parents:
diff changeset
2725 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
2726 &a2,
Ritor1
parents:
diff changeset
2727 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2728 a2.right = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2729 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
2730 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2731 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
2732 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
2733 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2734 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
2735 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
2736 &a2,
Ritor1
parents:
diff changeset
2737 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2738 a2.left = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2739 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
2740 a2.right = 640;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2741 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
2742 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2743 pViewport->uViewportBR_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2744 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
2745 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
2746 &a2,
Ritor1
parents:
diff changeset
2747 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2748 a2.right = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2749 a2.bottom = pViewport->uViewportBR_Y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2750 a2.left = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2751 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
2752 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2753 pViewport->uViewportTL_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2754 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
2755 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
2756 &a2,
Ritor1
parents:
diff changeset
2757 17u));
Ritor1
parents:
diff changeset
2758 }
Ritor1
parents:
diff changeset
2759 }
Ritor1
parents:
diff changeset
2760 }
Ritor1
parents:
diff changeset
2761
Ritor1
parents:
diff changeset
2762 //----- (004A597D) --------------------------------------------------------
Ritor1
parents:
diff changeset
2763 void Present_NoColorKey()
Ritor1
parents:
diff changeset
2764 {
Ritor1
parents:
diff changeset
2765 //unsigned __int16 *v0; // eax@4
Ritor1
parents:
diff changeset
2766 unsigned __int16 *v1; // esi@4
Ritor1
parents:
diff changeset
2767 void *v2; // edi@4
Ritor1
parents:
diff changeset
2768 //signed int v4; // ebx@4
Ritor1
parents:
diff changeset
2769 //signed int v5; // ebx@6
Ritor1
parents:
diff changeset
2770 //void *v6; // edi@7
Ritor1
parents:
diff changeset
2771 //const void *v7; // esi@7
Ritor1
parents:
diff changeset
2772 signed int v8; // ebx@8
Ritor1
parents:
diff changeset
2773 int v9; // eax@10
Ritor1
parents:
diff changeset
2774 unsigned int v10; // esi@10
Ritor1
parents:
diff changeset
2775 unsigned __int32 v11; // edi@10
Ritor1
parents:
diff changeset
2776 //int v12; // ecx@10
Ritor1
parents:
diff changeset
2777 unsigned int v13; // ebx@10
Ritor1
parents:
diff changeset
2778 int v14; // eax@11
Ritor1
parents:
diff changeset
2779 int v15; // eax@13
Ritor1
parents:
diff changeset
2780 int v16; // eax@14
Ritor1
parents:
diff changeset
2781 int v17; // eax@16
Ritor1
parents:
diff changeset
2782 HRESULT v18; // eax@22
Ritor1
parents:
diff changeset
2783 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
Ritor1
parents:
diff changeset
2784 int v20; // [sp+88h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
2785 int v21; // [sp+8Ch] [bp-18h]@10
Ritor1
parents:
diff changeset
2786 __int32 v22; // [sp+90h] [bp-14h]@10
Ritor1
parents:
diff changeset
2787 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
Ritor1
parents:
diff changeset
2788 unsigned int v24; // [sp+98h] [bp-Ch]@4
Ritor1
parents:
diff changeset
2789 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
2790 //LPVOID v26; // [sp+A0h] [bp-4h]@4
Ritor1
parents:
diff changeset
2791
Ritor1
parents:
diff changeset
2792 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
2793 {
Ritor1
parents:
diff changeset
2794 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
2795 {
Ritor1
parents:
diff changeset
2796 memset(&Dst, 0, 0x7Cu);
Ritor1
parents:
diff changeset
2797 Dst.dwSize = 124;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2798 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
0
Ritor1
parents:
diff changeset
2799 {
Ritor1
parents:
diff changeset
2800 //v26 = Dst.lpSurface;
Ritor1
parents:
diff changeset
2801 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
2802 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask |
Ritor1
parents:
diff changeset
2803 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16);
Ritor1
parents:
diff changeset
2804 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
2805 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
Ritor1
parents:
diff changeset
2806 v1 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
2807 v2 = Dst.lpSurface;
Ritor1
parents:
diff changeset
2808
Ritor1
parents:
diff changeset
2809
Ritor1
parents:
diff changeset
2810 /*for (uint y = 0; y < 480; ++y)
Ritor1
parents:
diff changeset
2811 {
Ritor1
parents:
diff changeset
2812 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
Ritor1
parents:
diff changeset
2813 for (uint x = 0; x < 640; ++x)
Ritor1
parents:
diff changeset
2814 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
Ritor1
parents:
diff changeset
2815 }*/
Ritor1
parents:
diff changeset
2816
Ritor1
parents:
diff changeset
2817 auto pSrc = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
2818 auto pDst = (__int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
2819
Ritor1
parents:
diff changeset
2820 for (uint y = 0; y < 8; ++y)
Ritor1
parents:
diff changeset
2821 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
2822
Ritor1
parents:
diff changeset
2823 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
2824
Ritor1
parents:
diff changeset
2825 for (uint y = 8; y < 352; ++y)
Ritor1
parents:
diff changeset
2826 {
Ritor1
parents:
diff changeset
2827 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
2828 pSrc + y * 640, 8 * sizeof(__int16));
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
2829 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2,
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
2830 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
0
Ritor1
parents:
diff changeset
2831 }
Ritor1
parents:
diff changeset
2832
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
2833 for (uint y = 352; y < 480; ++y)
0
Ritor1
parents:
diff changeset
2834 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
2835 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
2836
Ritor1
parents:
diff changeset
2837
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2838 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
2839 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)];
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2840 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
2841 //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
2842 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1);
0
Ritor1
parents:
diff changeset
2843 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1);
Ritor1
parents:
diff changeset
2844 v22 = 4 * ((Dst.lPitch / 4) + v9);
Ritor1
parents:
diff changeset
2845 v21 = 4 * v9 + 1280;
Ritor1
parents:
diff changeset
2846
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
2847 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
0
Ritor1
parents:
diff changeset
2848 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
Ritor1
parents:
diff changeset
2849 v10 = (int)pSrc_x1y1;
Ritor1
parents:
diff changeset
2850 v11 = (int)pDst_x1y1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2851 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
0
Ritor1
parents:
diff changeset
2852 v13 = v24;
Ritor1
parents:
diff changeset
2853
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2854 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
0
Ritor1
parents:
diff changeset
2855 {
Ritor1
parents:
diff changeset
2856 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
2857 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
2858 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
0
Ritor1
parents:
diff changeset
2859 {
Ritor1
parents:
diff changeset
2860 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
Ritor1
parents:
diff changeset
2861 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
Ritor1
parents:
diff changeset
2862 }
Ritor1
parents:
diff changeset
2863 }
Ritor1
parents:
diff changeset
2864
Ritor1
parents:
diff changeset
2865 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
2866
Ritor1
parents:
diff changeset
2867 /* while ( 1 )
Ritor1
parents:
diff changeset
2868 {
Ritor1
parents:
diff changeset
2869 while ( 1 )
Ritor1
parents:
diff changeset
2870 {
Ritor1
parents:
diff changeset
2871 v14 = *(int *)v10;
Ritor1
parents:
diff changeset
2872 v10 += 4;
Ritor1
parents:
diff changeset
2873 if ( v14 == v13 )
Ritor1
parents:
diff changeset
2874 break;
Ritor1
parents:
diff changeset
2875 if ( (short)v14 == (short)v13 )
Ritor1
parents:
diff changeset
2876 {
Ritor1
parents:
diff changeset
2877 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000;
Ritor1
parents:
diff changeset
2878 v11 += 4;
Ritor1
parents:
diff changeset
2879 --uHalfWidth;
Ritor1
parents:
diff changeset
2880 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
2881 goto LABEL_21;
Ritor1
parents:
diff changeset
2882 }
Ritor1
parents:
diff changeset
2883 else
Ritor1
parents:
diff changeset
2884 {
Ritor1
parents:
diff changeset
2885 v15 = __ROL__(v14, 16);
Ritor1
parents:
diff changeset
2886 if ( (short)v15 == (short)v13 )
Ritor1
parents:
diff changeset
2887 {
Ritor1
parents:
diff changeset
2888 v17 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
2889 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17;
Ritor1
parents:
diff changeset
2890 v11 += 4;
Ritor1
parents:
diff changeset
2891 --uHalfWidth;
Ritor1
parents:
diff changeset
2892 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
2893 goto LABEL_21;
Ritor1
parents:
diff changeset
2894 }
Ritor1
parents:
diff changeset
2895 else
Ritor1
parents:
diff changeset
2896 {
Ritor1
parents:
diff changeset
2897 v16 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
2898 *(int *)v11 = v16;
Ritor1
parents:
diff changeset
2899 v11 += 4;
Ritor1
parents:
diff changeset
2900 --uHalfWidth;
Ritor1
parents:
diff changeset
2901 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
2902 goto LABEL_21;
Ritor1
parents:
diff changeset
2903 }
Ritor1
parents:
diff changeset
2904 }
Ritor1
parents:
diff changeset
2905 }
Ritor1
parents:
diff changeset
2906 v11 += 4;
Ritor1
parents:
diff changeset
2907 --uHalfWidth;
Ritor1
parents:
diff changeset
2908 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
2909 {
Ritor1
parents:
diff changeset
2910 LABEL_21:
Ritor1
parents:
diff changeset
2911 v10 += v21;
Ritor1
parents:
diff changeset
2912 v11 += v22;
Ritor1
parents:
diff changeset
2913 uHalfWidth = v20;
Ritor1
parents:
diff changeset
2914 if ( !--uNumLines )
Ritor1
parents:
diff changeset
2915 {
Ritor1
parents:
diff changeset
2916 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
2917 return;
Ritor1
parents:
diff changeset
2918 }
Ritor1
parents:
diff changeset
2919 }
Ritor1
parents:
diff changeset
2920 }*/
Ritor1
parents:
diff changeset
2921 }
Ritor1
parents:
diff changeset
2922 }
Ritor1
parents:
diff changeset
2923 }
Ritor1
parents:
diff changeset
2924 }
Ritor1
parents:
diff changeset
2925
Ritor1
parents:
diff changeset
2926 //----- (004A7063) --------------------------------------------------------
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2927 unsigned int ModulateColor(unsigned int diffuse, float multiplier)
0
Ritor1
parents:
diff changeset
2928 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2929 float alpha = multiplier * ((diffuse >> 24) & 0xFF);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2930 int a = (int)floorf(alpha + 0.5f);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2931 a = max(0, min(255, a));
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2932
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2933 float red = multiplier * ((diffuse >> 16) & 0xFF);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2934 int r = (int)floorf(red + 0.5f);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2935 r = max(0, min(255, r));
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2936
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2937 float green = multiplier * ((diffuse >> 8) & 0xFF);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2938 int g = (int)floorf(green + 0.5f);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2939 g = max(0, min(255, g));
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2940
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2941 float blue = multiplier * ((diffuse >> 0) & 0xFF);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2942 int b = (int)floorf(blue + 0.5f);
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2943 b = max(0, min(255, b));
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2944
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1384
diff changeset
2945 return (a << 24) | (r << 16) | (g << 8) | b;
0
Ritor1
parents:
diff changeset
2946 }
Ritor1
parents:
diff changeset
2947
Ritor1
parents:
diff changeset
2948
Ritor1
parents:
diff changeset
2949
Ritor1
parents:
diff changeset
2950 //----- (004B1447) --------------------------------------------------------
Ritor1
parents:
diff changeset
2951 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
2952 {
Ritor1
parents:
diff changeset
2953 signed int v3; // esi@1
Ritor1
parents:
diff changeset
2954 char v4; // sf@8
Ritor1
parents:
diff changeset
2955 int v5; // eax@8
Ritor1
parents:
diff changeset
2956 unsigned __int64 v6; // qax@12
Ritor1
parents:
diff changeset
2957 DDM_DLV_Header *v7; // eax@14
Ritor1
parents:
diff changeset
2958 Player **v8; // edi@18
Ritor1
parents:
diff changeset
2959 Player *result; // eax@19
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
2960 //char *v10; // esi@20
0
Ritor1
parents:
diff changeset
2961
Ritor1
parents:
diff changeset
2962 v3 = 0;
Ritor1
parents:
diff changeset
2963 if ( a2 )
Ritor1
parents:
diff changeset
2964 {
Ritor1
parents:
diff changeset
2965 if ( a2 != 1 )
Ritor1
parents:
diff changeset
2966 {
Ritor1
parents:
diff changeset
2967 if ( a2 == 2 )
Ritor1
parents:
diff changeset
2968 v3 = 2;
Ritor1
parents:
diff changeset
2969 goto LABEL_13;
Ritor1
parents:
diff changeset
2970 }
Ritor1
parents:
diff changeset
2971 v3 = 2;
Ritor1
parents:
diff changeset
2972 }
Ritor1
parents:
diff changeset
2973 else
Ritor1
parents:
diff changeset
2974 {
Ritor1
parents:
diff changeset
2975 v3 = 1;
Ritor1
parents:
diff changeset
2976 }
Ritor1
parents:
diff changeset
2977 if ( pParty->uFine < 4000000 )
Ritor1
parents:
diff changeset
2978 {
Ritor1
parents:
diff changeset
2979 v4 = a3 + pParty->uFine < 0;
Ritor1
parents:
diff changeset
2980 v5 = a3 + pParty->uFine;
Ritor1
parents:
diff changeset
2981 pParty->uFine += a3;
Ritor1
parents:
diff changeset
2982 if ( v4 )
Ritor1
parents:
diff changeset
2983 {
Ritor1
parents:
diff changeset
2984 v5 = 0;
Ritor1
parents:
diff changeset
2985 pParty->uFine = 0;
Ritor1
parents:
diff changeset
2986 }
Ritor1
parents:
diff changeset
2987 if ( v5 > 4000000 )
Ritor1
parents:
diff changeset
2988 pParty->uFine = 4000000;
Ritor1
parents:
diff changeset
2989 }
487
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
2990
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
2991 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640;
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
2992
0
Ritor1
parents:
diff changeset
2993 LABEL_13:
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
2994 pParty->InTheShopFlags[a1] = 1;
0
Ritor1
parents:
diff changeset
2995 if ( v3 )
Ritor1
parents:
diff changeset
2996 {
Ritor1
parents:
diff changeset
2997 v7 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
2998 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
2999 v7 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
3000 v7->uReputation += v3;
Ritor1
parents:
diff changeset
3001 if ( v7->uReputation > 10000 )
Ritor1
parents:
diff changeset
3002 v7->uReputation = 10000;
Ritor1
parents:
diff changeset
3003 }
Ritor1
parents:
diff changeset
3004 v8 = &pPlayers[1];
Ritor1
parents:
diff changeset
3005 do
Ritor1
parents:
diff changeset
3006 {
Ritor1
parents:
diff changeset
3007 result = *v8;
Ritor1
parents:
diff changeset
3008 if ( pParty->uFine )
Ritor1
parents:
diff changeset
3009 {
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
3010 //v10 = result->_guilds_member_bits;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3011 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
0
Ritor1
parents:
diff changeset
3012 if ( !(short)result )
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
3013 __debugbreak();
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 493
diff changeset
3014 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
0
Ritor1
parents:
diff changeset
3015 }
Ritor1
parents:
diff changeset
3016 ++v8;
Ritor1
parents:
diff changeset
3017 }
Ritor1
parents:
diff changeset
3018 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
3019 return result;
Ritor1
parents:
diff changeset
3020 }
Ritor1
parents:
diff changeset
3021
Ritor1
parents:
diff changeset
3022 //----- (004B1523) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
3023 void __thiscall sub_4B1523(int *_this)
0
Ritor1
parents:
diff changeset
3024 {
Ritor1
parents:
diff changeset
3025 int v1; // esi@1
Ritor1
parents:
diff changeset
3026 int v2; // edx@1
Ritor1
parents:
diff changeset
3027 unsigned int v3; // eax@2
Ritor1
parents:
diff changeset
3028 int v4; // eax@4
Ritor1
parents:
diff changeset
3029 LONG v5; // ecx@4
Ritor1
parents:
diff changeset
3030 int v6; // eax@10
Ritor1
parents:
diff changeset
3031 char *v7; // ST44_4@12
Ritor1
parents:
diff changeset
3032 unsigned __int16 v8; // ax@12
Ritor1
parents:
diff changeset
3033 GUIWindow a1; // [sp+Ch] [bp-68h]@4
Ritor1
parents:
diff changeset
3034 unsigned int v11; // [sp+60h] [bp-14h]@1
Ritor1
parents:
diff changeset
3035 POINT a2; // [sp+64h] [bp-10h]@1
Ritor1
parents:
diff changeset
3036 int v13; // [sp+6Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
3037 int v14; // [sp+70h] [bp-4h]@4
Ritor1
parents:
diff changeset
3038
Ritor1
parents:
diff changeset
3039 v1 = *_this - 399;
Ritor1
parents:
diff changeset
3040 v2 = (*_this - 400) % 11 + 1;
Ritor1
parents:
diff changeset
3041 v11 = 4 * (*_this - 400) / 11;
1312
ae435824ac4d books code splitted to separate files
Gloval
parents: 1299
diff changeset
3042 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used
0
Ritor1
parents:
diff changeset
3043 if ( pMouse->GetCursorPos(&a2)->y <= 320 )
Ritor1
parents:
diff changeset
3044 v3 = pMouse->GetCursorPos(&a2)->y + 30;
Ritor1
parents:
diff changeset
3045 else
Ritor1
parents:
diff changeset
3046 v3 = 30;
Ritor1
parents:
diff changeset
3047 a1.Hint = 0;
Ritor1
parents:
diff changeset
3048 a1.uFrameY = v3;
Ritor1
parents:
diff changeset
3049 a1.uFrameWidth = 328;
Ritor1
parents:
diff changeset
3050 a1.uFrameHeight = 68;
Ritor1
parents:
diff changeset
3051 a1.uFrameX = 90;
Ritor1
parents:
diff changeset
3052 a1.uFrameZ = 417;
Ritor1
parents:
diff changeset
3053 a1.uFrameW = v3 + 67;
Ritor1
parents:
diff changeset
3054 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
Ritor1
parents:
diff changeset
3055 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
Ritor1
parents:
diff changeset
3056 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
Ritor1
parents:
diff changeset
3057 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
Ritor1
parents:
diff changeset
3058 v5 = a2.y;
Ritor1
parents:
diff changeset
3059 if ( v14 > a2.y )
Ritor1
parents:
diff changeset
3060 v5 = v14;
Ritor1
parents:
diff changeset
3061 if ( v13 > v5 )
Ritor1
parents:
diff changeset
3062 v5 = v13;
Ritor1
parents:
diff changeset
3063 if ( v4 > v5 )
Ritor1
parents:
diff changeset
3064 v5 = v4;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3065 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
3066 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal"
Ritor1
parents: 250
diff changeset
3067 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert"
Ritor1
parents: 250
diff changeset
3068 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master"
Ritor1
parents: 250
diff changeset
3069 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand"
Ritor1
parents: 250
diff changeset
3070 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
3071 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
0
Ritor1
parents:
diff changeset
3072 a1.uFrameHeight += v6;
Ritor1
parents:
diff changeset
3073 if ( (signed int)a1.uFrameHeight < 150 )
Ritor1
parents:
diff changeset
3074 a1.uFrameHeight = 150;
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
3075 a1.uFrameWidth = game_viewport_width;
0
Ritor1
parents:
diff changeset
3076 a1.DrawMessageBox(0);
Ritor1
parents:
diff changeset
3077 a1.uFrameWidth -= 12;
Ritor1
parents:
diff changeset
3078 a1.uFrameHeight -= 12;
Ritor1
parents:
diff changeset
3079 v7 = pSpellStats->pInfos[v1].pName;
Ritor1
parents:
diff changeset
3080 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
Ritor1
parents:
diff changeset
3081 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
949
Nomad
parents: 948
diff changeset
3082 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
0
Ritor1
parents:
diff changeset
3083 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
3084 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
0
Ritor1
parents:
diff changeset
3085 a1.uFrameZ = a1.uFrameX + 107;
Ritor1
parents:
diff changeset
3086 a1.uFrameWidth = 108;
Ritor1
parents:
diff changeset
3087 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
3088 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3089 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
0
Ritor1
parents:
diff changeset
3090 }
Ritor1
parents:
diff changeset
3091
Ritor1
parents:
diff changeset
3092 //----- (004B1ECE) --------------------------------------------------------
Ritor1
parents:
diff changeset
3093 void __cdecl sub_4B1ECE()
Ritor1
parents:
diff changeset
3094 {
Ritor1
parents:
diff changeset
3095 __int16 *v0; // edi@1
Ritor1
parents:
diff changeset
3096 int v1; // ebx@3
Ritor1
parents:
diff changeset
3097 Player *v2; // esi@3
Ritor1
parents:
diff changeset
3098 int v3; // eax@4
Ritor1
parents:
diff changeset
3099 signed int v4; // eax@9
Ritor1
parents:
diff changeset
3100 int v5; // ebx@11
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3101 Player *v6; // esi@13
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3102 ItemGen *v7; // eax@14
0
Ritor1
parents:
diff changeset
3103 signed int v8; // edi@14
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3104 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
0
Ritor1
parents:
diff changeset
3105 signed int v10; // [sp+10h] [bp-8h]@13
Ritor1
parents:
diff changeset
3106 int v11; // [sp+14h] [bp-4h]@1
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3107 Player *v12; // [sp+14h] [bp-4h]@11
0
Ritor1
parents:
diff changeset
3108
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3109 contract_approved = 0;
0
Ritor1
parents:
diff changeset
3110 v11 = 0;
Ritor1
parents:
diff changeset
3111 uDialogueType = 84;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
3112 current_npc_text = (char *)pNPCTopics[667].pText;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3113 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
0
Ritor1
parents:
diff changeset
3114 while ( 1 )
Ritor1
parents:
diff changeset
3115 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3116 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
0
Ritor1
parents:
diff changeset
3117 {
Ritor1
parents:
diff changeset
3118 v1 = 0;
Ritor1
parents:
diff changeset
3119 v2 = pParty->pPlayers;
Ritor1
parents:
diff changeset
3120 do
Ritor1
parents:
diff changeset
3121 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3122 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1));
0
Ritor1
parents:
diff changeset
3123 if ( v3 )
Ritor1
parents:
diff changeset
3124 break;
Ritor1
parents:
diff changeset
3125 ++v2;
Ritor1
parents:
diff changeset
3126 ++v1;
Ritor1
parents:
diff changeset
3127 }
Ritor1
parents:
diff changeset
3128 while ( (signed int)v2 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
3129 if ( v1 == 4 )
Ritor1
parents:
diff changeset
3130 break;
Ritor1
parents:
diff changeset
3131 }
Ritor1
parents:
diff changeset
3132 ++v11;
Ritor1
parents:
diff changeset
3133 v0 += 2;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3134 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3135 break;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3136 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3137 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3138 {
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
3139 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3140 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3141 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3142 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3143 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3144 if ( contract_approved == 601 )
0
Ritor1
parents:
diff changeset
3145 {
Ritor1
parents:
diff changeset
3146 v5 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3147 v12 = pParty->pPlayers;//[0].uClass;
0
Ritor1
parents:
diff changeset
3148 v9 = 0;
Ritor1
parents:
diff changeset
3149 while ( 1 )
Ritor1
parents:
diff changeset
3150 {
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
3151 if ( v12->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
3152 {
Ritor1
parents:
diff changeset
3153 v10 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3154 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A;
0
Ritor1
parents:
diff changeset
3155 do
Ritor1
parents:
diff changeset
3156 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1372
diff changeset
3157 v7 = v6->pInventoryItemList;
0
Ritor1
parents:
diff changeset
3158 v8 = 138;
Ritor1
parents:
diff changeset
3159 do
Ritor1
parents:
diff changeset
3160 {
1358
61010a655c94 a few itemID changed to their enum values + added a few new ones
Grumpy7
parents: 1355
diff changeset
3161 if ( v7->uItemID == ITEM_LICH_JAR_FULL )
0
Ritor1
parents:
diff changeset
3162 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
3163 if ( !v7->uHolderPlayer )
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3164 v9 = v7;
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
3165 if ( v7->uHolderPlayer == v5 )
0
Ritor1
parents:
diff changeset
3166 v10 = 1;
Ritor1
parents:
diff changeset
3167 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3168 ++v7;
0
Ritor1
parents:
diff changeset
3169 --v8;
Ritor1
parents:
diff changeset
3170 }
Ritor1
parents:
diff changeset
3171 while ( v8 );
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3172 ++v6;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3173 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3174 while ( v6 <= &pParty->pPlayers[3] );
0
Ritor1
parents:
diff changeset
3175 if ( !v10 )
Ritor1
parents:
diff changeset
3176 break;
Ritor1
parents:
diff changeset
3177 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3178 ++v12;
0
Ritor1
parents:
diff changeset
3179 ++v5;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
3180 if ( v12 > &pParty->pPlayers[3] )
0
Ritor1
parents:
diff changeset
3181 return;
Ritor1
parents:
diff changeset
3182 }
Ritor1
parents:
diff changeset
3183 if ( v9 )
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
3184 v9->uHolderPlayer = v5;
0
Ritor1
parents:
diff changeset
3185 }
Ritor1
parents:
diff changeset
3186 }
Ritor1
parents:
diff changeset
3187 // 4F08EC: using guessed type int dword_4F08EC[];
Ritor1
parents:
diff changeset
3188 // 722B3C: using guessed type int dword_722B3C;
Ritor1
parents:
diff changeset
3189 // 722B44: using guessed type int dword_722B44;
Ritor1
parents:
diff changeset
3190 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
3191
Ritor1
parents:
diff changeset
3192 //----- (004B254D) --------------------------------------------------------
Ritor1
parents:
diff changeset
3193 char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
Ritor1
parents:
diff changeset
3194 {
955
Ritor1
parents: 917
diff changeset
3195 //Player *v1; // esi@1
0
Ritor1
parents:
diff changeset
3196 int v2; // edx@1
Ritor1
parents:
diff changeset
3197 int v3; // ecx@1
Ritor1
parents:
diff changeset
3198 int v4; // edi@1
955
Ritor1
parents: 917
diff changeset
3199 int pClassType; // eax@7
0
Ritor1
parents:
diff changeset
3200 int v6; // eax@7
Ritor1
parents:
diff changeset
3201 int v7; // ebx@7
955
Ritor1
parents: 917
diff changeset
3202 //int v8; // ebx@8
0
Ritor1
parents:
diff changeset
3203 signed int v9; // esi@8
Ritor1
parents:
diff changeset
3204 int v10; // eax@8
Ritor1
parents:
diff changeset
3205 char *v11; // ecx@8
Ritor1
parents:
diff changeset
3206 int v12; // edi@9
Ritor1
parents:
diff changeset
3207 char *v13; // edx@9
Ritor1
parents:
diff changeset
3208 signed int v14; // edi@10
Ritor1
parents:
diff changeset
3209 unsigned int v16; // eax@29
955
Ritor1
parents: 917
diff changeset
3210 //int v17; // eax@36
0
Ritor1
parents:
diff changeset
3211 char v18; // cl@46
Ritor1
parents:
diff changeset
3212 __int16 v19; // dx@56
Ritor1
parents:
diff changeset
3213 int v20; // eax@60
955
Ritor1
parents: 917
diff changeset
3214 //char *v21; // [sp-Ch] [bp-38h]@82
Ritor1
parents: 917
diff changeset
3215 //const char *v22; // [sp-8h] [bp-34h]@21
Ritor1
parents: 917
diff changeset
3216 //unsigned int v23; // [sp-8h] [bp-34h]@38
Ritor1
parents: 917
diff changeset
3217 //char *v24; // [sp-8h] [bp-34h]@82
0
Ritor1
parents:
diff changeset
3218 char *v25; // [sp-4h] [bp-30h]@14
955
Ritor1
parents: 917
diff changeset
3219 //int v26; // [sp-4h] [bp-30h]@38
Ritor1
parents: 917
diff changeset
3220 //int v27; // [sp-4h] [bp-30h]@82
0
Ritor1
parents:
diff changeset
3221 char v28[4]; // [sp+Ch] [bp-20h]@9
Ritor1
parents:
diff changeset
3222 int v29; // [sp+10h] [bp-1Ch]@13
Ritor1
parents:
diff changeset
3223 int v30; // [sp+14h] [bp-18h]@15
Ritor1
parents:
diff changeset
3224 int v31; // [sp+18h] [bp-14h]@16
Ritor1
parents:
diff changeset
3225 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7
955
Ritor1
parents: 917
diff changeset
3226 //int v33; // [sp+20h] [bp-Ch]@7
0
Ritor1
parents:
diff changeset
3227 int v34; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
3228 char *v35; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
3229
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3230 contract_approved = 0;
0
Ritor1
parents:
diff changeset
3231 v2 = (_this - 200) % 3;
Ritor1
parents:
diff changeset
3232 v3 = (_this - 200) / 3;
Ritor1
parents:
diff changeset
3233 v4 = v2;
Ritor1
parents:
diff changeset
3234 v35 = (char *)pNPCTopics[127].pText;
492
Gloval
parents: 487
diff changeset
3235 dword_F8B1AC_award_bit_number = v3;
0
Ritor1
parents:
diff changeset
3236 if ( v2 )
Ritor1
parents:
diff changeset
3237 {
Ritor1
parents:
diff changeset
3238 if ( v2 == 1 )
Ritor1
parents:
diff changeset
3239 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3240 gold_transaction_amount = 5000;
0
Ritor1
parents:
diff changeset
3241 dword_F8B1B0 = 3;
Ritor1
parents:
diff changeset
3242 }
Ritor1
parents:
diff changeset
3243 else
Ritor1
parents:
diff changeset
3244 {
Ritor1
parents:
diff changeset
3245 if ( v2 == 2 )
Ritor1
parents:
diff changeset
3246 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3247 gold_transaction_amount = 8000;
0
Ritor1
parents:
diff changeset
3248 dword_F8B1B0 = 4;
Ritor1
parents:
diff changeset
3249 }
Ritor1
parents:
diff changeset
3250 }
Ritor1
parents:
diff changeset
3251 }
Ritor1
parents:
diff changeset
3252 else
Ritor1
parents:
diff changeset
3253 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3254 gold_transaction_amount = 2000;
0
Ritor1
parents:
diff changeset
3255 dword_F8B1B0 = 2;
Ritor1
parents:
diff changeset
3256 }
955
Ritor1
parents: 917
diff changeset
3257 pClassType = pPlayers[uActiveCharacter]->classType;
Ritor1
parents: 917
diff changeset
3258 //v33 = pClassType;
Ritor1
parents: 917
diff changeset
3259 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3];
Ritor1
parents: 917
diff changeset
3260 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3];
0
Ritor1
parents:
diff changeset
3261 v7 = a1[0] & 0x3F;
Ritor1
parents:
diff changeset
3262 v34 = v2 + 2;
Ritor1
parents:
diff changeset
3263 if ( v6 < v2 + 2 )
Ritor1
parents:
diff changeset
3264 {
955
Ritor1
parents: 917
diff changeset
3265 //v8 = v33;
0
Ritor1
parents:
diff changeset
3266 v9 = 0;
955
Ritor1
parents: 917
diff changeset
3267 v10 = pClassType - pClassType % 4;
Ritor1
parents: 917
diff changeset
3268 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3];
0
Ritor1
parents:
diff changeset
3269 do
Ritor1
parents:
diff changeset
3270 {
Ritor1
parents:
diff changeset
3271 v12 = (unsigned __int8)*v11;
Ritor1
parents:
diff changeset
3272 v13 = &v28[4 * v9];
Ritor1
parents:
diff changeset
3273 *(int *)v13 = 0;
Ritor1
parents:
diff changeset
3274 if ( v12 < v34 )
Ritor1
parents:
diff changeset
3275 {
Ritor1
parents:
diff changeset
3276 v14 = 1;
Ritor1
parents:
diff changeset
3277 }
Ritor1
parents:
diff changeset
3278 else
Ritor1
parents:
diff changeset
3279 {
Ritor1
parents:
diff changeset
3280 v14 = 1;
Ritor1
parents:
diff changeset
3281 *(int *)v13 = 1;
Ritor1
parents:
diff changeset
3282 }
Ritor1
parents:
diff changeset
3283 ++v9;
Ritor1
parents:
diff changeset
3284 v11 += 37;
Ritor1
parents:
diff changeset
3285 }
Ritor1
parents:
diff changeset
3286 while ( v9 < 4 );
1409
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1393
diff changeset
3287 __debugbreak(); // warning C4700: uninitialized local variable 'v29' used
0
Ritor1
parents:
diff changeset
3288 if ( v29 == v14 )
Ritor1
parents:
diff changeset
3289 {
Ritor1
parents:
diff changeset
3290 v25 = pClassNames[v10 + 1];
Ritor1
parents:
diff changeset
3291 }
Ritor1
parents:
diff changeset
3292 else
Ritor1
parents:
diff changeset
3293 {
1409
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1393
diff changeset
3294 __debugbreak(); // warning C4700: uninitialized local variable 'v30' used
955
Ritor1
parents: 917
diff changeset
3295 if ( v30 == v14 )//crash
0
Ritor1
parents:
diff changeset
3296 {
1409
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1393
diff changeset
3297 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used
0
Ritor1
parents:
diff changeset
3298 if ( v31 == v14 )
Ritor1
parents:
diff changeset
3299 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3300 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
3301 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
3302 }
Ritor1
parents:
diff changeset
3303 v25 = pClassNames[v10 + 2];
Ritor1
parents:
diff changeset
3304 }
Ritor1
parents:
diff changeset
3305 else
Ritor1
parents:
diff changeset
3306 {
Ritor1
parents:
diff changeset
3307 if ( v31 != v14 )
Ritor1
parents:
diff changeset
3308 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3309 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
3310 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
3311 }
Ritor1
parents:
diff changeset
3312 v25 = pClassNames[v10 + 3];
Ritor1
parents:
diff changeset
3313 }
Ritor1
parents:
diff changeset
3314 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3315 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà.
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3316 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
3317 }
955
Ritor1
parents: 917
diff changeset
3318 if ( !pPlayers[uActiveCharacter]->CanAct() )
0
Ritor1
parents:
diff changeset
3319 return (char *)pNPCTopics[122].pText;
Ritor1
parents:
diff changeset
3320 if ( !v7 )
Ritor1
parents:
diff changeset
3321 return (char *)pNPCTopics[131].pText;
Ritor1
parents:
diff changeset
3322 v16 = SkillToMastery(a1[0]);
Ritor1
parents:
diff changeset
3323 if ( (signed int)v16 > v4 + 1 )
Ritor1
parents:
diff changeset
3324 return (char *)pNPCTopics[v4 + 128].pText;
Ritor1
parents:
diff changeset
3325 if ( v34 != 2 )
Ritor1
parents:
diff changeset
3326 {
Ritor1
parents:
diff changeset
3327 if ( v34 == 3 )
Ritor1
parents:
diff changeset
3328 {
Ritor1
parents:
diff changeset
3329 if ( (signed int)v16 >= 2 && v7 >= 7 )
Ritor1
parents:
diff changeset
3330 {
492
Gloval
parents: 487
diff changeset
3331 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
3332 {
Ritor1
parents:
diff changeset
3333 case 12:
Ritor1
parents:
diff changeset
3334 case 13:
Ritor1
parents:
diff changeset
3335 case 14:
Ritor1
parents:
diff changeset
3336 case 15:
Ritor1
parents:
diff changeset
3337 case 16:
Ritor1
parents:
diff changeset
3338 case 17:
Ritor1
parents:
diff changeset
3339 case 18:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3340 gold_transaction_amount = 4000;
0
Ritor1
parents:
diff changeset
3341 goto LABEL_42;
Ritor1
parents:
diff changeset
3342 case 19:
Ritor1
parents:
diff changeset
3343 v19 = 114;
955
Ritor1
parents: 917
diff changeset
3344 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
Ritor1
parents: 917
diff changeset
3345 return v35;
Ritor1
parents: 917
diff changeset
3346 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3347 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3348 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3349 case 20:
Ritor1
parents:
diff changeset
3350 v19 = 110;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3351 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
0
Ritor1
parents:
diff changeset
3352 return v35;
955
Ritor1
parents: 917
diff changeset
3353 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3354 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3355 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3356 case 22:
955
Ritor1
parents: 917
diff changeset
3357 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower();
Ritor1
parents: 917
diff changeset
3358 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
3359 return v35;
Ritor1
parents: 917
diff changeset
3360 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3361 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3362 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3363 case 24:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3364 gold_transaction_amount = 2500;
955
Ritor1
parents: 917
diff changeset
3365 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance();
0
Ritor1
parents:
diff changeset
3366 if ( v20 < 50 )
Ritor1
parents:
diff changeset
3367 return v35;
955
Ritor1
parents: 917
diff changeset
3368 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3369 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3370 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3371 case 36:
Ritor1
parents: 917
diff changeset
3372 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence();
Ritor1
parents: 917
diff changeset
3373 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
3374 return v35;
Ritor1
parents: 917
diff changeset
3375 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3376 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3377 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3378 case 21:
Ritor1
parents:
diff changeset
3379 case 23:
Ritor1
parents:
diff changeset
3380 case 25:
Ritor1
parents:
diff changeset
3381 case 26:
Ritor1
parents:
diff changeset
3382 case 29:
Ritor1
parents:
diff changeset
3383 case 32:
Ritor1
parents:
diff changeset
3384 case 34:
Ritor1
parents:
diff changeset
3385 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3386 gold_transaction_amount = 2500;
0
Ritor1
parents:
diff changeset
3387 goto LABEL_42;
Ritor1
parents:
diff changeset
3388 case 8:
Ritor1
parents:
diff changeset
3389 case 9:
Ritor1
parents:
diff changeset
3390 case 10:
Ritor1
parents:
diff changeset
3391 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3392 gold_transaction_amount = 3000;
0
Ritor1
parents:
diff changeset
3393 goto LABEL_42;
Ritor1
parents:
diff changeset
3394 case 7:
955
Ritor1
parents: 917
diff changeset
3395 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
3396 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3397 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3398 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3399 default:
Ritor1
parents: 917
diff changeset
3400 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3401 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3402 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3403 }
955
Ritor1
parents: 917
diff changeset
3404 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
3405 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3406 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3407 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3408 }
Ritor1
parents:
diff changeset
3409 }
Ritor1
parents:
diff changeset
3410 else
Ritor1
parents:
diff changeset
3411 {
Ritor1
parents:
diff changeset
3412 if ( v34 != 4 )
Ritor1
parents:
diff changeset
3413 {
955
Ritor1
parents: 917
diff changeset
3414 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3415 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3416 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3417 }
Ritor1
parents:
diff changeset
3418 if ( (signed int)v16 >= 3 && v7 >= 10 )
Ritor1
parents:
diff changeset
3419 {
492
Gloval
parents: 487
diff changeset
3420 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
3421 {
Ritor1
parents:
diff changeset
3422 case 19:
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
3423 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
3424 {
Ritor1
parents: 917
diff changeset
3425 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3426 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3427 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3428 }
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
3429 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
3430 {
Ritor1
parents: 917
diff changeset
3431 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3432 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3433 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3434 }
Ritor1
parents: 917
diff changeset
3435 return v35;
0
Ritor1
parents:
diff changeset
3436 case 20:
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
3437 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
3438 {
Ritor1
parents: 917
diff changeset
3439 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3440 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3441 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3442 }
1355
af2fc30d765f Player::CanAct, Player::CanSteal shortened a bit
Grumpy7
parents: 1354
diff changeset
3443 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 )
955
Ritor1
parents: 917
diff changeset
3444 {
Ritor1
parents: 917
diff changeset
3445 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3446 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3447 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3448 }
0
Ritor1
parents:
diff changeset
3449 return v35;
Ritor1
parents:
diff changeset
3450 case 30:
955
Ritor1
parents: 917
diff changeset
3451 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]);
0
Ritor1
parents:
diff changeset
3452 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents:
diff changeset
3453 return v35;
955
Ritor1
parents: 917
diff changeset
3454 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3455 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3456 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3457 case 31:
Ritor1
parents: 917
diff changeset
3458 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]);
Ritor1
parents: 917
diff changeset
3459 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents: 917
diff changeset
3460 return v35;
Ritor1
parents: 917
diff changeset
3461 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3462 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3463 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3464 case 21:
Ritor1
parents:
diff changeset
3465 case 23:
Ritor1
parents:
diff changeset
3466 case 24:
Ritor1
parents:
diff changeset
3467 case 25:
Ritor1
parents:
diff changeset
3468 case 26:
Ritor1
parents:
diff changeset
3469 case 29:
Ritor1
parents:
diff changeset
3470 case 32:
Ritor1
parents:
diff changeset
3471 case 34:
Ritor1
parents:
diff changeset
3472 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3473 gold_transaction_amount = 6000;
0
Ritor1
parents:
diff changeset
3474 goto LABEL_42;
Ritor1
parents:
diff changeset
3475 case 8:
Ritor1
parents:
diff changeset
3476 case 9:
Ritor1
parents:
diff changeset
3477 case 10:
Ritor1
parents:
diff changeset
3478 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3479 gold_transaction_amount = 7000;
0
Ritor1
parents:
diff changeset
3480 goto LABEL_42;
Ritor1
parents:
diff changeset
3481 case 7:
Ritor1
parents:
diff changeset
3482 break;
955
Ritor1
parents: 917
diff changeset
3483 default:
Ritor1
parents: 917
diff changeset
3484 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3485 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3486 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3487 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3488 gold_transaction_amount = 0;
955
Ritor1
parents: 917
diff changeset
3489 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3490 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3491 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3492 }
Ritor1
parents:
diff changeset
3493 }
Ritor1
parents:
diff changeset
3494 return v35;
Ritor1
parents:
diff changeset
3495 }
Ritor1
parents:
diff changeset
3496 if ( v7 < 4 )
Ritor1
parents:
diff changeset
3497 return v35;
492
Gloval
parents: 487
diff changeset
3498 if ( dword_F8B1AC_award_bit_number > 27 )
Gloval
parents: 487
diff changeset
3499 {
Gloval
parents: 487
diff changeset
3500 if ( dword_F8B1AC_award_bit_number != 29
Gloval
parents: 487
diff changeset
3501 && dword_F8B1AC_award_bit_number != 32
Gloval
parents: 487
diff changeset
3502 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
0
Ritor1
parents:
diff changeset
3503 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3504 if ( !gold_transaction_amount )
0
Ritor1
parents:
diff changeset
3505 goto LABEL_79;
Ritor1
parents:
diff changeset
3506 goto LABEL_42;
Ritor1
parents:
diff changeset
3507 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3508 gold_transaction_amount = 500;
955
Ritor1
parents: 917
diff changeset
3509 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3510 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3511 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3512 }
492
Gloval
parents: 487
diff changeset
3513 if ( dword_F8B1AC_award_bit_number >= 23 )
955
Ritor1
parents: 917
diff changeset
3514 {
Ritor1
parents: 917
diff changeset
3515 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
3516 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3517 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3518 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3519 }
492
Gloval
parents: 487
diff changeset
3520 if ( dword_F8B1AC_award_bit_number == 7 )
0
Ritor1
parents:
diff changeset
3521 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3522 gold_transaction_amount = 0;
0
Ritor1
parents:
diff changeset
3523 goto LABEL_79;
Ritor1
parents:
diff changeset
3524 }
492
Gloval
parents: 487
diff changeset
3525 if ( dword_F8B1AC_award_bit_number <= 7 )
955
Ritor1
parents: 917
diff changeset
3526 {
Ritor1
parents: 917
diff changeset
3527 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3528 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3529 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3530 }
492
Gloval
parents: 487
diff changeset
3531 if ( dword_F8B1AC_award_bit_number > 18 )
Gloval
parents: 487
diff changeset
3532 {
Gloval
parents: 487
diff changeset
3533 if ( dword_F8B1AC_award_bit_number != 21 )
955
Ritor1
parents: 917
diff changeset
3534 {
Ritor1
parents: 917
diff changeset
3535 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3536 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3537 goto LABEL_42;
Ritor1
parents: 917
diff changeset
3538 }
Ritor1
parents: 917
diff changeset
3539 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
3540 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
3541 goto LABEL_79;
Ritor1
parents: 917
diff changeset
3542 goto LABEL_42;
0
Ritor1
parents:
diff changeset
3543 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3544 gold_transaction_amount = 1000;
0
Ritor1
parents:
diff changeset
3545 LABEL_42:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
3546 if ( gold_transaction_amount > pParty->uNumGold )
0
Ritor1
parents:
diff changeset
3547 return (char *)pNPCTopics[124].pText;
Ritor1
parents:
diff changeset
3548 LABEL_79:
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3549 contract_approved = 1;
0
Ritor1
parents:
diff changeset
3550 if ( v34 == 2 )
Ritor1
parents:
diff changeset
3551 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3552 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ]
955
Ritor1
parents: 917
diff changeset
3553 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
3554 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
3555 }
Ritor1
parents:
diff changeset
3556 if ( v34 == 3 )
Ritor1
parents:
diff changeset
3557 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3558 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
3559 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
3560 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
3561 }
Ritor1
parents:
diff changeset
3562 if ( v34 == 4 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3563 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
3564 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
3565 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
3566 }
Ritor1
parents:
diff changeset
3567
Ritor1
parents:
diff changeset
3568 //----- (004B3E1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
3569 void __cdecl sub_4B3E1E()
Ritor1
parents:
diff changeset
3570 {
Ritor1
parents:
diff changeset
3571 NPCData *v0; // ST40_4@1
Ritor1
parents:
diff changeset
3572 signed int v1; // edi@1
165
Ritor1
parents: 152
diff changeset
3573 //GUIWindow *v2; // ecx@1
0
Ritor1
parents:
diff changeset
3574
167
90521fb9766c NPCDialogue fix
Ritor1
parents: 165
diff changeset
3575 __debugbreak();
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
3576 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0
Ritor1
parents:
diff changeset
3577 v1 = 0;
Ritor1
parents:
diff changeset
3578 pDialogueWindow->eWindowType = WINDOW_MainMenu;
Ritor1
parents:
diff changeset
3579 pDialogueWindow->Release();
165
Ritor1
parents: 152
diff changeset
3580 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
3581 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
0
Ritor1
parents:
diff changeset
3582 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
3583 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
0
Ritor1
parents:
diff changeset
3584 v1 = 1;
Ritor1
parents:
diff changeset
3585 }
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
3586 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
3587 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
0
Ritor1
parents:
diff changeset
3588 }
Ritor1
parents:
diff changeset
3589
Ritor1
parents:
diff changeset
3590 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
3591
Ritor1
parents:
diff changeset
3592 //----- (004B3FE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
3593 void __fastcall sub_4B3FE5(int a4)
Ritor1
parents:
diff changeset
3594 {
Ritor1
parents:
diff changeset
3595 int v1; // edi@1
Ritor1
parents:
diff changeset
3596 char *v2; // edi@1
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3597
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3598 __debugbreak();
0
Ritor1
parents:
diff changeset
3599 v1 = a4;
Ritor1
parents:
diff changeset
3600 uDialogueType = 78;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
3601 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
0
Ritor1
parents:
diff changeset
3602 _4B254D_SkillMasteryTeacher(a4);
Ritor1
parents:
diff changeset
3603 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
3604 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
Ritor1
parents:
diff changeset
3605 v2 = "";
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
3606 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
3607 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
3608 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
3609 if ( contract_approved )
0
Ritor1
parents:
diff changeset
3610 v2 = pGlobalTXT_LocalizationStrings[535];
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
3611 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
3612 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
3613 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
3614 }
Ritor1
parents:
diff changeset
3615 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
3616 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
3617
Ritor1
parents:
diff changeset
3618 //----- (004B46A5) --------------------------------------------------------
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
3619 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 )
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3620 {
0
Ritor1
parents:
diff changeset
3621 int v4; // eax@1
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
3622 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
3623 v4 = pFontLucida->AlignText_Center(450, Str);
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
3624 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0);
0
Ritor1
parents:
diff changeset
3625 }
Ritor1
parents:
diff changeset
3626
Ritor1
parents:
diff changeset
3627 //----- (004B46F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
3628 int __fastcall sub_4B46F8(int a1)
Ritor1
parents:
diff changeset
3629 {
Ritor1
parents:
diff changeset
3630 int v1; // eax@1
Ritor1
parents:
diff changeset
3631 int i; // edx@1
Ritor1
parents:
diff changeset
3632
Ritor1
parents:
diff changeset
3633 v1 = 0;
Ritor1
parents:
diff changeset
3634 for ( i = 0; i < a1; ++i )
Ritor1
parents:
diff changeset
3635 v1 += i + 1;
Ritor1
parents:
diff changeset
3636 return 1000 * v1;
Ritor1
parents:
diff changeset
3637 }
Ritor1
parents:
diff changeset
3638
Ritor1
parents:
diff changeset
3639 //----- (004BC49B) --------------------------------------------------------
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
3640 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
3641 {
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3642 //unsigned int v1; // esi@1
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3643 NPCData *speakingNPC; // ebp@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3644 //unsigned int v3; // eax@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3645 int npc_event_id; // ecx@10
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3646 signed int v5; // edi@14
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3647 char *v6; // esi@15
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3648 const char *v7; // ecx@22
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3649 signed int v8; // edi@37
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3650 //unsigned int v9; // eax@56
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3651 unsigned int v10; // ecx@57
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3652 void *v11; // [sp-Ch] [bp-1Ch]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3653 int v12; // [sp-8h] [bp-18h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3654 char *v13; // [sp-8h] [bp-18h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3655 size_t v14; // [sp-4h] [bp-14h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3656 const char *v15; // [sp-4h] [bp-14h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3657
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3658 //v1 = _this;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3659 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
3660 //v3 = v1;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3661 uDialogueType = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3662 if (!speakingNPC->uFlags)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3663 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3664 speakingNPC->uFlags = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3665 //v3 = uDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3666 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3667
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3668 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3669 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3670 dialogue_show_profession_details = ~dialogue_show_profession_details;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3671 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3672 else if(newDialogueType == DIALOGUE_76)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3673 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3674 if (speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3675 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3676 v8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3677 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3678 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3679 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3680 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3681 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3682 ++v8;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3683 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3684 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3685 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3686 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3687 if( v8 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3688 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3689 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3690 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3691 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3692 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3693 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3694 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3695 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3696 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3697 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3698 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3699 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3700 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
3701 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3702 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3703 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3704 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3705 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3706 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3707 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3708 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3709 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3710 ShowStatusBarString(v7, 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3711 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3712 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3713 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3714 //v9 = v2->uProfession;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3715 if ( speakingNPC->uProfession != 51 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3716 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3717 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3718 if ( pParty->uNumGold < v10 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3719 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3720 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3721 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3722 uDialogueType = 13;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3723 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3724 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3725 v7 = pGlobalTXT_LocalizationStrings[155];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3726 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3727 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3728 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3729 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3730 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3731 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3732 Party::TakeGold(v10);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3733 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3734 LOBYTE(speakingNPC->uFlags) |= 0x80u;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3735 if ( pParty->pHirelings[0].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3736 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3737 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3738 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3739 v13 = pParty->pHireling2Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3740 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3741 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3742 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3743 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3744 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3745 v13 = pParty->pHireling1Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3746 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3747 strcpy(v13, v15);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3748 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
3749 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3750
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3751 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3752
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
3753 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3754 pDialogue_SpeakingActor->uAIState = Removed;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3755 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3756 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3757 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3758 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3759 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3760 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3761 ArenaFight();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3762 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3763 }
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
3764 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY)
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3765 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
3766 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0)
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3767 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
3768 if ( speakingNPC->uProfession != GateMaster )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3769 speakingNPC->bHasUsedTheAbility = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3770
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3771 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3772 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3773 else
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
3774 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!"
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3775 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3776 else if(newDialogueType == DIALOGUE_13)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3777 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3778 if (!speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3779 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3780 sub_4B3E1E();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3781 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3782 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3783 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3784 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3785 v5 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3786 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3787 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3788 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3789 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3790 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3791 ++v5;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3792 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3793 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3794 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3795 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3796 if ( v5 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3797 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3798 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3799 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3800 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3801 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3802 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3803 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3804 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3805 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3806 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3807 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3808 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3809 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
3810 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3811 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3812 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3813 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3814 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3815 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3816 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3817 else if(newDialogueType >= 19 && newDialogueType <= 24)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3818 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3819 switch(newDialogueType)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3820 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3821 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3822 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3823 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3824 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3825 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3826 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3827 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3828 if ( (npc_event_id >= 200) && (npc_event_id <= 310) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3829 sub_4B3FE5(npc_event_id); //200-310
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3830 else if (( npc_event_id >= 400) && (npc_event_id <= 410) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3831 { //400-410
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3832 dword_F8B1D8 = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3833 DrawJoinGuildWindow(npc_event_id - 400);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3834 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3835 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3836 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3837 switch ( npc_event_id )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3838 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3839 case 139:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3840 sub_4B1ECE();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3841 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3842 case 311:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3843 sub_4BBA85_bounties();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3844 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3845 case 399:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3846 sub_4BBCDD();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3847 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3848 default:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3849 activeLevelDecoration = (LevelDecoration*)1;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
3850 current_npc_text = 0;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3851 EventProcessor(npc_event_id, 0, 1);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3852 activeLevelDecoration = NULL;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3853 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3854 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3855 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3856 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3857 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3858 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3859 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
3860 }
0
Ritor1
parents:
diff changeset
3861
Ritor1
parents:
diff changeset
3862 //----- (004BDAAF) --------------------------------------------------------
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3863 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx)
0
Ritor1
parents:
diff changeset
3864 {
Ritor1
parents:
diff changeset
3865 int v6; // edx@8
Ritor1
parents:
diff changeset
3866 int v7; // edx@9
Ritor1
parents:
diff changeset
3867 int v8; // edx@10
Ritor1
parents:
diff changeset
3868 unsigned __int8 v9; // zf@16
Ritor1
parents:
diff changeset
3869 char v10; // sf@16
Ritor1
parents:
diff changeset
3870 unsigned __int8 v11; // of@16
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3871 bool test;
0
Ritor1
parents:
diff changeset
3872
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3873 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771)
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3874 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen())
0
Ritor1
parents:
diff changeset
3875 return 0;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3876 switch( p2DEvents[_2da_idx - 1].uType )
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3877 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3878 case BuildingType_WeaponShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3879 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3880 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3881 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3882 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3883 case BuildingType_ArmorShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3884 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3885 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3886 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3887 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3888 case BuildingType_MagicShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3889 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3890 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3891 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3892 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3893 case BuildingType_AlchemistShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3894 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3895 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3896 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3897 || (signed int)item->uItemID < 740) && item->uItemID != 771);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3898 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3899 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3900 default:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3901 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3902 test = false;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3903 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3904 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
3905 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3906 return test;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3907 /*
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3908 if ( p2DEvents[a2 - 1].uType == 1 )
0
Ritor1
parents:
diff changeset
3909 {
Ritor1
parents:
diff changeset
3910 v11 = __OFSUB__(v5, 2);
Ritor1
parents:
diff changeset
3911 v9 = v5 == 2;
Ritor1
parents:
diff changeset
3912 v10 = v5 - 2 < 0;
Ritor1
parents:
diff changeset
3913 goto LABEL_23;
Ritor1
parents:
diff changeset
3914 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3915 if ( p2DEvents[a2 - 1].uType > 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3916 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3917 if ( p2DEvents[a2 - 1].uType == 3 )
0
Ritor1
parents:
diff changeset
3918 {
Ritor1
parents:
diff changeset
3919 if ( pItemsTable->pItems[v4].uSkillType != 38 )
Ritor1
parents:
diff changeset
3920 return v5 == 16;
Ritor1
parents:
diff changeset
3921 return 1;
Ritor1
parents:
diff changeset
3922 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3923 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 )
0
Ritor1
parents:
diff changeset
3924 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3925 if ( p2DEvents[a2 - 1].uType == 4)
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3926 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3927 if ( v5 < 13 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3928 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3929 if ( v5 <= 14 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3930 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3931 if ( v5 != 17 || (signed int)v3 < 740 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3932 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3933 v11 = __OFSUB__(v3, 771);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3934 v9 = v3 == 771;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3935 v10 = ((v3 - 771) & 0x80000000u) != 0;
0
Ritor1
parents:
diff changeset
3936 LABEL_23:
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3937 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3938 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3939 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3940 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3941 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3942 if ( p2DEvents[a2 - 1].uType == 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3943 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3944 if ( v5 >= 3 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3945 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3946 v11 = __OFSUB__(v5, 9);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3947 v9 = v5 == 9;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3948 v10 = v5 - 9 < 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3949 goto LABEL_23;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3950 }
0
Ritor1
parents:
diff changeset
3951 }
Ritor1
parents:
diff changeset
3952 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
3953 */
0
Ritor1
parents:
diff changeset
3954 }
Ritor1
parents:
diff changeset
3955
1209
decc0dd6e4ba more on arcomage
Gloval
parents: 1206
diff changeset
3956
0
Ritor1
parents:
diff changeset
3957