annotate mm7_4.cpp @ 785:a821bbace194

m
author Ritor1
date Sun, 24 Mar 2013 09:18:51 +0600
parents 67b77b052ef3
children da80bd2922df
rev   line source
0
Ritor1
parents:
diff changeset
1 #include <io.h>
Ritor1
parents:
diff changeset
2 #include <direct.h>
198
e6e348d66a75 Some work on spellbook
Nomad
parents: 194
diff changeset
3 #include <assert.h>
0
Ritor1
parents:
diff changeset
4
341
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
5 #include "MM7.h"
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
6
0
Ritor1
parents:
diff changeset
7 #include "MapInfo.h"
Ritor1
parents:
diff changeset
8 #include "Game.h"
Ritor1
parents:
diff changeset
9 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
10 #include "GUIButton.h"
Ritor1
parents:
diff changeset
11 #include "GUIFont.h"
Ritor1
parents:
diff changeset
12 #include "Party.h"
Ritor1
parents:
diff changeset
13 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
14 #include "Outdoor.h"
Ritor1
parents:
diff changeset
15 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
16 #include "Overlays.h"
Ritor1
parents:
diff changeset
17 #include "Monsters.h"
Ritor1
parents:
diff changeset
18 #include "Arcomage.h"
Ritor1
parents:
diff changeset
19 #include "LOD.h"
Ritor1
parents:
diff changeset
20 #include "Actor.h"
Ritor1
parents:
diff changeset
21 #include "Allocator.h"
Ritor1
parents:
diff changeset
22 #include "Events.h"
Ritor1
parents:
diff changeset
23 #include "Viewport.h"
Ritor1
parents:
diff changeset
24 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
25 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
26 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
27 #include "ObjectList.h"
Ritor1
parents:
diff changeset
28 #include "Chest.h"
Ritor1
parents:
diff changeset
29 #include "PaletteManager.h"
Ritor1
parents:
diff changeset
30 #include "DecorationList.h"
Ritor1
parents:
diff changeset
31 #include "SaveLoad.h"
Ritor1
parents:
diff changeset
32 #include "stru123.h"
Ritor1
parents:
diff changeset
33 #include "stru287.h"
Ritor1
parents:
diff changeset
34 #include "Time.h"
Ritor1
parents:
diff changeset
35 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
36 #include "GUIProgressBar.h"
Ritor1
parents:
diff changeset
37 #include "Bink_Smacker.h"
Ritor1
parents:
diff changeset
38 #include "TileFrameTable.h"
Ritor1
parents:
diff changeset
39 #include "PlayerFrameTable.h"
Ritor1
parents:
diff changeset
40 #include "Awards.h"
Ritor1
parents:
diff changeset
41 #include "Autonotes.h"
Ritor1
parents:
diff changeset
42 #include "stru160.h"
Ritor1
parents:
diff changeset
43 #include "stru279.h"
Ritor1
parents:
diff changeset
44 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
45 #include "FactionTable.h"
Ritor1
parents:
diff changeset
46 #include "StorylineTextTable.h"
Ritor1
parents:
diff changeset
47 #include "Random.h"
Ritor1
parents:
diff changeset
48 #include "stru277.h"
Ritor1
parents:
diff changeset
49 #include "stru298.h"
Ritor1
parents:
diff changeset
50 #include "stru12.h"
Ritor1
parents:
diff changeset
51 #include "stru351.h"
Ritor1
parents:
diff changeset
52 #include "Events2D.h"
Ritor1
parents:
diff changeset
53 #include "stru159.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 180
diff changeset
54 #include "texts.h"
0
Ritor1
parents:
diff changeset
55 #include "Log.h"
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 615
diff changeset
56 #include "UIHouses.h"
0
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58 #include "mm7_data.h"
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60
Ritor1
parents:
diff changeset
61
Ritor1
parents:
diff changeset
62
Ritor1
parents:
diff changeset
63
Ritor1
parents:
diff changeset
64
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66
Ritor1
parents:
diff changeset
67
Ritor1
parents:
diff changeset
68
Ritor1
parents:
diff changeset
69
Ritor1
parents:
diff changeset
70
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72
Ritor1
parents:
diff changeset
73
Ritor1
parents:
diff changeset
74 //----- (0046CC4B) --------------------------------------------------------
Ritor1
parents:
diff changeset
75 void __cdecl _46CC4B_check_event_triggers()
Ritor1
parents:
diff changeset
76 {
Ritor1
parents:
diff changeset
77 int v0; // eax@1
Ritor1
parents:
diff changeset
78 LevelDecoration *v1; // esi@2
Ritor1
parents:
diff changeset
79 signed int v2; // edi@2
Ritor1
parents:
diff changeset
80 int v3; // ebx@2
Ritor1
parents:
diff changeset
81 int v4; // eax@3
Ritor1
parents:
diff changeset
82 int v5; // ebx@3
Ritor1
parents:
diff changeset
83 unsigned int v6; // ecx@3
Ritor1
parents:
diff changeset
84 unsigned int v7; // edx@6
Ritor1
parents:
diff changeset
85 unsigned int v8; // edx@8
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
86 Actor *v9; // edi@13
0
Ritor1
parents:
diff changeset
87 int v10; // ebx@14
Ritor1
parents:
diff changeset
88 int v11; // eax@14
Ritor1
parents:
diff changeset
89 int v12; // ebx@14
Ritor1
parents:
diff changeset
90 unsigned int v13; // ecx@14
Ritor1
parents:
diff changeset
91 int v14; // edx@15
Ritor1
parents:
diff changeset
92 unsigned int v15; // edx@17
Ritor1
parents:
diff changeset
93 unsigned int v16; // edx@19
Ritor1
parents:
diff changeset
94 char *v17; // edi@25
Ritor1
parents:
diff changeset
95 int v18; // ebx@26
Ritor1
parents:
diff changeset
96 int v19; // eax@26
Ritor1
parents:
diff changeset
97 int v20; // ebx@26
Ritor1
parents:
diff changeset
98 unsigned int v21; // ecx@26
Ritor1
parents:
diff changeset
99 int v22; // edx@27
Ritor1
parents:
diff changeset
100 unsigned int v23; // edx@29
Ritor1
parents:
diff changeset
101 unsigned int v24; // edx@31
Ritor1
parents:
diff changeset
102 int v25; // [sp+0h] [bp-24h]@3
Ritor1
parents:
diff changeset
103 int v26; // [sp+0h] [bp-24h]@14
Ritor1
parents:
diff changeset
104 int v27; // [sp+0h] [bp-24h]@26
Ritor1
parents:
diff changeset
105 int v28; // [sp+4h] [bp-20h]@3
Ritor1
parents:
diff changeset
106 int v29; // [sp+4h] [bp-20h]@14
Ritor1
parents:
diff changeset
107 int v30; // [sp+4h] [bp-20h]@26
Ritor1
parents:
diff changeset
108 signed int v31; // [sp+8h] [bp-1Ch]@2
Ritor1
parents:
diff changeset
109 int v32; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
110 int v33; // [sp+10h] [bp-14h]@2
Ritor1
parents:
diff changeset
111 int i; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
112 int v35; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
113 int v36; // [sp+1Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
114 signed int v37; // [sp+1Ch] [bp-8h]@12
Ritor1
parents:
diff changeset
115 signed int v38; // [sp+20h] [bp-4h]@24
Ritor1
parents:
diff changeset
116
Ritor1
parents:
diff changeset
117 v0 = 0;
Ritor1
parents:
diff changeset
118 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i )
Ritor1
parents:
diff changeset
119 {
Ritor1
parents:
diff changeset
120 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]];
Ritor1
parents:
diff changeset
121 v2 = v1->field_18;
Ritor1
parents:
diff changeset
122 v3 = v1->vPosition.y;
Ritor1
parents:
diff changeset
123 v33 = v1->vPosition.x;
Ritor1
parents:
diff changeset
124 v32 = v1->vPosition.y;
Ritor1
parents:
diff changeset
125 v35 = v1->vPosition.z;
Ritor1
parents:
diff changeset
126 v31 = v1->field_18;
Ritor1
parents:
diff changeset
127 if ( v1->field_2 & 1 )
Ritor1
parents:
diff changeset
128 {
Ritor1
parents:
diff changeset
129 v36 = abs(v1->vPosition.x - pParty->vPosition.x);
Ritor1
parents:
diff changeset
130 v25 = abs(v3 - pParty->vPosition.y);
Ritor1
parents:
diff changeset
131 v28 = abs(v35 - pParty->vPosition.z);
Ritor1
parents:
diff changeset
132 v4 = v36;
Ritor1
parents:
diff changeset
133 v5 = v25;
Ritor1
parents:
diff changeset
134 v6 = v28;
Ritor1
parents:
diff changeset
135 if ( v36 < v25 )
Ritor1
parents:
diff changeset
136 {
Ritor1
parents:
diff changeset
137 v4 = v25;
Ritor1
parents:
diff changeset
138 v5 = v36;
Ritor1
parents:
diff changeset
139 }
Ritor1
parents:
diff changeset
140 if ( v4 < v28 )
Ritor1
parents:
diff changeset
141 {
Ritor1
parents:
diff changeset
142 v7 = v4;
Ritor1
parents:
diff changeset
143 v4 = v28;
Ritor1
parents:
diff changeset
144 v6 = v7;
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146 if ( v5 < (signed int)v6 )
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 v8 = v6;
Ritor1
parents:
diff changeset
149 v6 = v5;
Ritor1
parents:
diff changeset
150 v5 = v8;
Ritor1
parents:
diff changeset
151 }
Ritor1
parents:
diff changeset
152 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 )
Ritor1
parents:
diff changeset
153 EventProcessor(v1->field_16_event_id, 8 * i | 5, 1);
Ritor1
parents:
diff changeset
154 }
Ritor1
parents:
diff changeset
155 if ( v1->field_2 & 2 )
Ritor1
parents:
diff changeset
156 {
Ritor1
parents:
diff changeset
157 v37 = 0;
Ritor1
parents:
diff changeset
158 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
159 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
160 v9 = pActors;//[0].vPosition.y;
0
Ritor1
parents:
diff changeset
161 do
Ritor1
parents:
diff changeset
162 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
163 v10 = abs(v33 - v9->vPosition.x);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
164 v29 = abs(v32 - v9->vPosition.y);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
165 v26 = abs(v35 - v9->vPosition.z);
0
Ritor1
parents:
diff changeset
166 v11 = v10;
Ritor1
parents:
diff changeset
167 v12 = v29;
Ritor1
parents:
diff changeset
168 v13 = v26;
Ritor1
parents:
diff changeset
169 if ( v11 < v29 )
Ritor1
parents:
diff changeset
170 {
Ritor1
parents:
diff changeset
171 v14 = v11;
Ritor1
parents:
diff changeset
172 v11 = v29;
Ritor1
parents:
diff changeset
173 v12 = v14;
Ritor1
parents:
diff changeset
174 }
Ritor1
parents:
diff changeset
175 if ( v11 < v26 )
Ritor1
parents:
diff changeset
176 {
Ritor1
parents:
diff changeset
177 v15 = v11;
Ritor1
parents:
diff changeset
178 v11 = v26;
Ritor1
parents:
diff changeset
179 v13 = v15;
Ritor1
parents:
diff changeset
180 }
Ritor1
parents:
diff changeset
181 if ( v12 < (signed int)v13 )
Ritor1
parents:
diff changeset
182 {
Ritor1
parents:
diff changeset
183 v16 = v13;
Ritor1
parents:
diff changeset
184 v13 = v12;
Ritor1
parents:
diff changeset
185 v12 = v16;
Ritor1
parents:
diff changeset
186 }
Ritor1
parents:
diff changeset
187 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 )
Ritor1
parents:
diff changeset
188 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
189 ++v37;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
190 ++v9;
0
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 while ( v37 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
193 }
Ritor1
parents:
diff changeset
194 }
Ritor1
parents:
diff changeset
195 if ( v1->field_2 & 4 )
Ritor1
parents:
diff changeset
196 {
Ritor1
parents:
diff changeset
197 v38 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
198 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
199 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
200 v17 = (char *)&pSpriteObjects[0].vPosition.y;
0
Ritor1
parents:
diff changeset
201 do
Ritor1
parents:
diff changeset
202 {
Ritor1
parents:
diff changeset
203 v18 = abs(v33 - *((int *)v17 - 1));
Ritor1
parents:
diff changeset
204 v30 = abs(v32 - *(int *)v17);
Ritor1
parents:
diff changeset
205 v27 = abs(v35 - *((int *)v17 + 1));
Ritor1
parents:
diff changeset
206 v19 = v18;
Ritor1
parents:
diff changeset
207 v20 = v30;
Ritor1
parents:
diff changeset
208 v21 = v27;
Ritor1
parents:
diff changeset
209 if ( v19 < v30 )
Ritor1
parents:
diff changeset
210 {
Ritor1
parents:
diff changeset
211 v22 = v19;
Ritor1
parents:
diff changeset
212 v19 = v30;
Ritor1
parents:
diff changeset
213 v20 = v22;
Ritor1
parents:
diff changeset
214 }
Ritor1
parents:
diff changeset
215 if ( v19 < v27 )
Ritor1
parents:
diff changeset
216 {
Ritor1
parents:
diff changeset
217 v23 = v19;
Ritor1
parents:
diff changeset
218 v19 = v27;
Ritor1
parents:
diff changeset
219 v21 = v23;
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 if ( v20 < (signed int)v21 )
Ritor1
parents:
diff changeset
222 {
Ritor1
parents:
diff changeset
223 v24 = v21;
Ritor1
parents:
diff changeset
224 v21 = v20;
Ritor1
parents:
diff changeset
225 v20 = v24;
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 )
Ritor1
parents:
diff changeset
228 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
229 ++v38;
Ritor1
parents:
diff changeset
230 v17 += 112;
Ritor1
parents:
diff changeset
231 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
232 while ( v38 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
233 }
Ritor1
parents:
diff changeset
234 }
Ritor1
parents:
diff changeset
235 v0 = i + 1;
Ritor1
parents:
diff changeset
236 }
Ritor1
parents:
diff changeset
237 }
Ritor1
parents:
diff changeset
238 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
Ritor1
parents:
diff changeset
239
Ritor1
parents:
diff changeset
240 //----- (0046CEC3) --------------------------------------------------------
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
241 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
242 {
Ritor1
parents:
diff changeset
243 int v13; // ecx@13
Ritor1
parents:
diff changeset
244 signed int v14; // ebx@14
Ritor1
parents:
diff changeset
245 int v15; // eax@16
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
246 //int v16; // edx@19
0
Ritor1
parents:
diff changeset
247 int v17; // ST18_4@19
Ritor1
parents:
diff changeset
248 signed int v18; // edx@19
Ritor1
parents:
diff changeset
249 signed __int64 v19; // qtt@19
Ritor1
parents:
diff changeset
250 int v21; // eax@27
Ritor1
parents:
diff changeset
251 int v22; // ecx@29
Ritor1
parents:
diff changeset
252 signed int v28; // eax@45
Ritor1
parents:
diff changeset
253 int v29; // ebx@47
Ritor1
parents:
diff changeset
254 int v30; // edx@49
Ritor1
parents:
diff changeset
255 int v31; // ST10_4@49
Ritor1
parents:
diff changeset
256 signed int v32; // edx@49
Ritor1
parents:
diff changeset
257 signed __int64 v33; // qtt@49
Ritor1
parents:
diff changeset
258 signed int v34; // eax@54
Ritor1
parents:
diff changeset
259 signed int v35; // esi@56
Ritor1
parents:
diff changeset
260 int result; // eax@57
Ritor1
parents:
diff changeset
261 int v38; // edx@62
Ritor1
parents:
diff changeset
262 int v44; // [sp+20h] [bp-20h]@10
Ritor1
parents:
diff changeset
263 bool v47; // [sp+24h] [bp-1Ch]@43
Ritor1
parents:
diff changeset
264 bool v48; // [sp+28h] [bp-18h]@10
Ritor1
parents:
diff changeset
265 bool v49; // [sp+28h] [bp-18h]@41
Ritor1
parents:
diff changeset
266 bool v50; // [sp+2Ch] [bp-14h]@12
Ritor1
parents:
diff changeset
267 signed int v53; // [sp+30h] [bp-10h]@10
Ritor1
parents:
diff changeset
268 signed int v54; // [sp+30h] [bp-10h]@41
Ritor1
parents:
diff changeset
269 signed int v55; // [sp+34h] [bp-Ch]@1
Ritor1
parents:
diff changeset
270
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
271 //LOG_DECOMPILATION_WARNING();
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
272
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
273 static int blv_floor_id[50]; // 00721200
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
274 static int blv_floor_level[50]; // 007212C8
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
275
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
276 static __int16 word_721390_ys[104]; // idb
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
277 static __int16 word_721460_xs[104]; // idb
0
Ritor1
parents:
diff changeset
278
Ritor1
parents:
diff changeset
279 auto pSector = &pIndoor->pSectors[uSectorID];
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
280 v55 = 1;
0
Ritor1
parents:
diff changeset
281 for (uint i = 0; i < pSector->uNumFloors; ++i)
Ritor1
parents:
diff changeset
282 {
Ritor1
parents:
diff changeset
283 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
Ritor1
parents:
diff changeset
284 if (pFloor->Clickable())
Ritor1
parents:
diff changeset
285 continue;
Ritor1
parents:
diff changeset
286
Ritor1
parents:
diff changeset
287 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 &&
Ritor1
parents:
diff changeset
288 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1)
Ritor1
parents:
diff changeset
289 {
Ritor1
parents:
diff changeset
290 for (uint j = 0; j < pFloor->uNumVertices; ++j)
Ritor1
parents:
diff changeset
291 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
292 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
293 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
294 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
295 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
0
Ritor1
parents:
diff changeset
296 }
Ritor1
parents:
diff changeset
297 v44 = 2 * pFloor->uNumVertices;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
298 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
299 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
300
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
301 v48 = word_721390_ys[0] >= y;
0
Ritor1
parents:
diff changeset
302 v53 = 0;
Ritor1
parents:
diff changeset
303 if ( pFloor->uNumVertices > 0 )
Ritor1
parents:
diff changeset
304 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
305 for ( int i = 0; i < v44; i++ )
0
Ritor1
parents:
diff changeset
306 {
Ritor1
parents:
diff changeset
307 if ( v53 >= 2 )
Ritor1
parents:
diff changeset
308 break;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
309 v50 = word_721390_ys[i + 1] >= y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
310
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
311 v13 = i;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
312 if ( v48 != v50 )
0
Ritor1
parents:
diff changeset
313 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
314 v14 = word_721460_xs[i + 1] >= x ? 0 : 2;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
315 v15 = v14 | word_721460_xs[i] < x;
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
316
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
317 if ( !v15)
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
318 ++v53;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
319 else
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
320 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
321 //v16 = word_721390_ys[i];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
322 v17 = word_721390_ys[i + 1] - word_721390_ys[i];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
323 v18 = y - word_721390_ys[i];
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
324 LODWORD(v19) = v18 << 16;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
325 HIDWORD(v19) = v18 >> 16;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
326 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x)
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
327 ++v53;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
328 }
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
329 /*if ( v15 != 3 )
0
Ritor1
parents:
diff changeset
330 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
331 if ( !v15 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
332 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
333 LODWORD(v19) = (y - word_721390_ys[i]) << 16;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
334 HIDWORD(v19) = (y - word_721390_ys[i]) >> 16;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
335 v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
336 if ( v16 >= x)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
337 ++v53;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
338 }
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
339 }*/
0
Ritor1
parents:
diff changeset
340 }
Ritor1
parents:
diff changeset
341 v48 = v50;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
342 }
0
Ritor1
parents:
diff changeset
343 if ( v53 == 1 )
Ritor1
parents:
diff changeset
344 {
Ritor1
parents:
diff changeset
345 if ( v55 >= 50 )
Ritor1
parents:
diff changeset
346 break;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
347 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
0
Ritor1
parents:
diff changeset
348 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
349 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
0
Ritor1
parents:
diff changeset
350 }
Ritor1
parents:
diff changeset
351 else
Ritor1
parents:
diff changeset
352 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
353 v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16)
0
Ritor1
parents:
diff changeset
354 + HIWORD(pFloor->zCalc3);
Ritor1
parents:
diff changeset
355 }
Ritor1
parents:
diff changeset
356 v22 = v55++;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
357 blv_floor_level[v22] = v21;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
358 blv_floor_id[v22] = pSector->pFloors[i];
0
Ritor1
parents:
diff changeset
359 }
Ritor1
parents:
diff changeset
360 }
Ritor1
parents:
diff changeset
361 }
Ritor1
parents:
diff changeset
362 }
Ritor1
parents:
diff changeset
363 if ( pSector->field_0 & 8 )
Ritor1
parents:
diff changeset
364 {
Ritor1
parents:
diff changeset
365 for (uint i = 0; i < pSector->uNumPortals; ++i)
Ritor1
parents:
diff changeset
366 {
Ritor1
parents:
diff changeset
367 auto portal = &pIndoor->pFaces[pSector->pPortals[i]];
Ritor1
parents:
diff changeset
368 if (portal->uPolygonType != POLYGON_Floor)
Ritor1
parents:
diff changeset
369 continue;
Ritor1
parents:
diff changeset
370
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
371 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 &&
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
372 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
373 {
0
Ritor1
parents:
diff changeset
374 for (uint j = 0; j < portal->uNumVertices; ++j)
Ritor1
parents:
diff changeset
375 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
376 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
377 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
378 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
379 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
380 }
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
381 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
382 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0];
0
Ritor1
parents:
diff changeset
383 v54 = 0;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
384 v49 = word_721390_ys[0] >= y;
435
4f451a616d3d blv reloading fixed
Nomad
parents: 434
diff changeset
385 if ( portal->uNumVertices > 0 )
0
Ritor1
parents:
diff changeset
386 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
387 for ( int i = 0; i < 2 * portal->uNumVertices; ++i )
0
Ritor1
parents:
diff changeset
388 {
Ritor1
parents:
diff changeset
389 if ( v54 >= 2 )
Ritor1
parents:
diff changeset
390 break;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
391 v47 = word_721390_ys[i + 1] >= y;
0
Ritor1
parents:
diff changeset
392 if ( v49 != v47 )
Ritor1
parents:
diff changeset
393 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
394 v28 = word_721460_xs[i + 1] >= x ? 0 : 2;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
395 v29 = v28 | word_721460_xs[i] < x;
0
Ritor1
parents:
diff changeset
396 if ( v29 != 3 )
Ritor1
parents:
diff changeset
397 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
398 if ( !v29 )
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
399 ++v54;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
400 else
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
401 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
402 //v30 = word_721390_ys[v27];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
403 v31 = word_721390_ys[i + 1] - word_721390_ys[i];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
404 v32 = y - word_721390_ys[i];
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
405 LODWORD(v33) = v32 << 16;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
406 HIDWORD(v33) = v32 >> 16;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
407 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x)
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
408 ++v54;
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
409 }
0
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411 }
Ritor1
parents:
diff changeset
412 v49 = v47;
Ritor1
parents:
diff changeset
413 }
Ritor1
parents:
diff changeset
414 if ( v54 == 1 )
Ritor1
parents:
diff changeset
415 {
Ritor1
parents:
diff changeset
416 if ( v55 >= 50 )
Ritor1
parents:
diff changeset
417 break;
Ritor1
parents:
diff changeset
418 v34 = v55++;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
419 blv_floor_level[v34] = -29000;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
420 blv_floor_id[v34] = pSector->pPortals[i];
0
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422 }
Ritor1
parents:
diff changeset
423 }
Ritor1
parents:
diff changeset
424 }
Ritor1
parents:
diff changeset
425 }
Ritor1
parents:
diff changeset
426 if ( v55 == 1 )
Ritor1
parents:
diff changeset
427 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
428 *pFaceID = blv_floor_id[0];
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
429 return blv_floor_level[0];
0
Ritor1
parents:
diff changeset
430 }
Ritor1
parents:
diff changeset
431 if ( !v55 )
Ritor1
parents:
diff changeset
432 return -30000;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
433 *pFaceID = blv_floor_id[0];
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
434 //result = blv_floor_level[0];
0
Ritor1
parents:
diff changeset
435 if ( v55 > 1 )
Ritor1
parents:
diff changeset
436 {
717
Ritor1
parents: 690
diff changeset
437 for ( v35 = 1; v35 < v55; ++v35 )
0
Ritor1
parents:
diff changeset
438 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
439 if ( blv_floor_level[0] <= z + 5 )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
440 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
441 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 )
717
Ritor1
parents: 690
diff changeset
442 continue;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
443 blv_floor_level[0] = blv_floor_level[v35];
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
444 *pFaceID = blv_floor_id[v35];
717
Ritor1
parents: 690
diff changeset
445 continue;
Ritor1
parents: 690
diff changeset
446 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
447 if ( blv_floor_level[v35] < blv_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
448 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
449 blv_floor_level[0] = blv_floor_level[v35];
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
450 *pFaceID = blv_floor_id[v35];
717
Ritor1
parents: 690
diff changeset
451 }
Ritor1
parents: 690
diff changeset
452 }
0
Ritor1
parents:
diff changeset
453 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
454 return blv_floor_level[0];
0
Ritor1
parents:
diff changeset
455 }
Ritor1
parents:
diff changeset
456
Ritor1
parents:
diff changeset
457 //----- (0046D49E) --------------------------------------------------------
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
458 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7)
0
Ritor1
parents:
diff changeset
459 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
460 BSPModel *pBModel; // esi@4
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
461 ODMFace *pFace; // ecx@11
0
Ritor1
parents:
diff changeset
462 int v14; // edx@20
Ritor1
parents:
diff changeset
463 signed int v18; // edx@26
Ritor1
parents:
diff changeset
464 int v19; // eax@28
Ritor1
parents:
diff changeset
465 int v20; // edx@30
Ritor1
parents:
diff changeset
466 int v21; // ST1C_4@30
Ritor1
parents:
diff changeset
467 signed int v22; // edx@30
Ritor1
parents:
diff changeset
468 signed __int64 v23; // qtt@30
Ritor1
parents:
diff changeset
469 int v24; // eax@36
Ritor1
parents:
diff changeset
470 signed int v25; // ecx@38
Ritor1
parents:
diff changeset
471 int result; // eax@42
Ritor1
parents:
diff changeset
472 signed int v27; // ecx@43
Ritor1
parents:
diff changeset
473 int v28; // edi@44
Ritor1
parents:
diff changeset
474 signed int v29; // edx@44
Ritor1
parents:
diff changeset
475 int v30; // esi@45
Ritor1
parents:
diff changeset
476 int v31; // eax@45
Ritor1
parents:
diff changeset
477 ODMFace *v32; // eax@57
Ritor1
parents:
diff changeset
478 int v33; // ecx@59
Ritor1
parents:
diff changeset
479 int v36; // [sp+14h] [bp-2Ch]@24
Ritor1
parents:
diff changeset
480 int v38; // [sp+1Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
481 int v39; // [sp+20h] [bp-20h]@9
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
482 signed int pBModelNum; // [sp+28h] [bp-18h]@1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
483 int pFaceNum; // [sp+2Ch] [bp-14h]@8
0
Ritor1
parents:
diff changeset
484 bool v43; // [sp+30h] [bp-10h]@22
Ritor1
parents:
diff changeset
485 bool v44; // [sp+34h] [bp-Ch]@24
Ritor1
parents:
diff changeset
486 signed int v46; // [sp+3Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
487 signed int v48; // [sp+58h] [bp+18h]@22
Ritor1
parents:
diff changeset
488 signed int v49; // [sp+58h] [bp+18h]@43
Ritor1
parents:
diff changeset
489
Ritor1
parents:
diff changeset
490 v46 = 1;
Ritor1
parents:
diff changeset
491 dword_721160[0] = -1;
Ritor1
parents:
diff changeset
492 dword_721110[0] = -1;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
493 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7);
0
Ritor1
parents:
diff changeset
494 if ( (signed int)pOutdoor->uNumBModels <= 0 )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
495 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
496 *a6 = 0;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
497 return odm_floor_level[0];
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
498 }
0
Ritor1
parents:
diff changeset
499 v38 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
500 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
501 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
502 pBModel = &pOutdoor->pBModels[v38];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
503 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
504 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
505 if ( (signed int)pBModel->uNumFaces > 0 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
506 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
507 v39 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
508 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
509 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
510 pFace = &pBModel->pFaces[v39];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
511 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
512 && !(pFace->uAttributes & 0x20000000)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
513 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
514 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
0
Ritor1
parents:
diff changeset
515 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
516 if ( pFace->uNumVertices )
0
Ritor1
parents:
diff changeset
517 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
518 for ( uint i = 0; i < pFace->uNumVertices; ++i)
0
Ritor1
parents:
diff changeset
519 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
520 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
521 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
522 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
523 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
524 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
525 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
526 word_721040[2 * pFace->uNumVertices] = word_721040[0];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
527 word_720F70[2 * pFace->uNumVertices] = word_720F70[0];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
528 v43 = word_720F70[0] >= Y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
529 v48 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
530 if ( 2 * pFace->uNumVertices > 0 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
531 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
532 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
533 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
534 if ( v48 >= 2 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
535 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
536 v36 = word_720F70[i + 1];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
537 v44 = word_720F70[i + 1] >= Y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
538 if ( v43 != v44 )
0
Ritor1
parents:
diff changeset
539 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
540 v18 = word_721040[i + 1] >= X ? 0 : 2;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
541 v19 = v18 | word_721040[i] < X;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
542 if ( v19 != 3 )
0
Ritor1
parents:
diff changeset
543 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
544 if ( !v19 )
740
Ritor1
parents: 729
diff changeset
545 ++v48;
Ritor1
parents: 729
diff changeset
546 else
0
Ritor1
parents:
diff changeset
547 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
548 LODWORD(v23) = (Y - word_720F70[i]) << 16;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
549 HIDWORD(v23) = (Y - word_720F70[i]) >> 16;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
550 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
551 if ( v22 >= X)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
552 ++v48;
0
Ritor1
parents:
diff changeset
553 }
Ritor1
parents:
diff changeset
554 }
Ritor1
parents:
diff changeset
555 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
556 v43 = v44;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
557 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
558 if ( v48 == 1 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
559 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
560 if ( v46 >= 20 )
0
Ritor1
parents:
diff changeset
561 break;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
562 if ( pFace->uPolygonType == POLYGON_Floor )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
563 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
564 else
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
565 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16)
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
566 + HIWORD(pFace->zCalc3);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
567 v25 = v46++;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
568 odm_floor_level[v25] = v24;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
569 dword_721160[v25] = pBModelNum;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
570 dword_721110[v25] = pFaceNum;
0
Ritor1
parents:
diff changeset
571 }
Ritor1
parents:
diff changeset
572 }
Ritor1
parents:
diff changeset
573 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
574 ++v39;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
575 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
576 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
577 }
0
Ritor1
parents:
diff changeset
578 ++v38;
Ritor1
parents:
diff changeset
579 }
Ritor1
parents:
diff changeset
580 if ( v46 == 1 )
Ritor1
parents:
diff changeset
581 {
Ritor1
parents:
diff changeset
582 *a6 = 0;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
583 return odm_floor_level[0];
0
Ritor1
parents:
diff changeset
584 }
Ritor1
parents:
diff changeset
585 v27 = 0;
Ritor1
parents:
diff changeset
586 if ( v46 <= 1 )
Ritor1
parents:
diff changeset
587 *a6 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
588 else
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
589 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
590 //v29 = 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
591 for ( v49 = 1; v49 < v46; ++v49 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
592 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
593 if ( odm_floor_level[v49] == odm_floor_level[0] )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
594 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
595 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
596 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
597 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
598 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
599 if ( odm_floor_level[0] > Z + 5 )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
600 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
601 if ( odm_floor_level[v49] >= odm_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
602 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
603 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
604 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
605 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
606 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
607 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
608 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
609 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
610 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
611 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
612 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
613 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
614 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
615 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
616 if ( !v27 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
617 *a6 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
618 else
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
619 *a6 = dword_721110[v27] | (dword_721160[v27] << 6);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
620 }
0
Ritor1
parents:
diff changeset
621 if ( v27 )
Ritor1
parents:
diff changeset
622 {
Ritor1
parents:
diff changeset
623 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]];
Ritor1
parents:
diff changeset
624 *a5 = 0;
Ritor1
parents:
diff changeset
625 if ( v32->uAttributes & 0x10 )
Ritor1
parents:
diff changeset
626 *a5 = 1;
Ritor1
parents:
diff changeset
627 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
628 if ( odm_floor_level[v27] >= odm_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
629 odm_floor_level[0] = odm_floor_level[v27];
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
630 return odm_floor_level[0];
0
Ritor1
parents:
diff changeset
631 }
Ritor1
parents:
diff changeset
632
Ritor1
parents:
diff changeset
633 //----- (0046D8E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
634 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4)
Ritor1
parents:
diff changeset
635 {
Ritor1
parents:
diff changeset
636 int v4; // ebx@1
Ritor1
parents:
diff changeset
637 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
638 BSPModel *v6; // edi@3
Ritor1
parents:
diff changeset
639 ODMFace *v7; // esi@10
Ritor1
parents:
diff changeset
640 unsigned __int8 v8; // al@10
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 659
diff changeset
641 signed __int16 *v9; // eax@18
0
Ritor1
parents:
diff changeset
642 int v10; // edx@19
Ritor1
parents:
diff changeset
643 int v11; // ecx@21
Ritor1
parents:
diff changeset
644 int v12; // ecx@23
Ritor1
parents:
diff changeset
645 signed int v13; // eax@25
Ritor1
parents:
diff changeset
646 int v14; // edx@27
Ritor1
parents:
diff changeset
647 int v15; // edx@29
Ritor1
parents:
diff changeset
648 int v16; // ST18_4@29
Ritor1
parents:
diff changeset
649 signed int v17; // edx@29
Ritor1
parents:
diff changeset
650 signed __int64 v18; // qtt@29
Ritor1
parents:
diff changeset
651 int v19; // eax@35
Ritor1
parents:
diff changeset
652 signed int v20; // ecx@37
Ritor1
parents:
diff changeset
653 signed int v22; // ebx@42
Ritor1
parents:
diff changeset
654 unsigned int v23; // esi@43
Ritor1
parents:
diff changeset
655 int v24; // edx@44
Ritor1
parents:
diff changeset
656 int v25; // eax@44
Ritor1
parents:
diff changeset
657 int v26; // [sp+Ch] [bp-38h]@7
Ritor1
parents:
diff changeset
658 int v27; // [sp+10h] [bp-34h]@21
Ritor1
parents:
diff changeset
659 int v28; // [sp+18h] [bp-2Ch]@21
Ritor1
parents:
diff changeset
660 int v29; // [sp+1Ch] [bp-28h]@2
Ritor1
parents:
diff changeset
661 unsigned int v30; // [sp+20h] [bp-24h]@8
Ritor1
parents:
diff changeset
662 signed int v31; // [sp+24h] [bp-20h]@1
Ritor1
parents:
diff changeset
663 signed int v32; // [sp+28h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
664 int v33; // [sp+2Ch] [bp-18h]@7
Ritor1
parents:
diff changeset
665 bool v34; // [sp+30h] [bp-14h]@21
Ritor1
parents:
diff changeset
666 bool v35; // [sp+34h] [bp-10h]@23
Ritor1
parents:
diff changeset
667 signed int v36; // [sp+38h] [bp-Ch]@17
Ritor1
parents:
diff changeset
668 signed int v37; // [sp+38h] [bp-Ch]@21
Ritor1
parents:
diff changeset
669 signed int v38; // [sp+38h] [bp-Ch]@42
Ritor1
parents:
diff changeset
670 signed int v39; // [sp+3Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
671 signed int v40; // [sp+40h] [bp-4h]@1
Ritor1
parents:
diff changeset
672
Ritor1
parents:
diff changeset
673 dword_720ED0[0] = -1;
Ritor1
parents:
diff changeset
674 dword_720E80[0] = -1;
Ritor1
parents:
diff changeset
675 v4 = a1;
Ritor1
parents:
diff changeset
676 v5 = 0;
Ritor1
parents:
diff changeset
677 v40 = a2;
Ritor1
parents:
diff changeset
678 v31 = v4;
Ritor1
parents:
diff changeset
679 v39 = 1;
Ritor1
parents:
diff changeset
680 dword_720F20[0] = 10000;
Ritor1
parents:
diff changeset
681 v32 = 0;
Ritor1
parents:
diff changeset
682 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
683 {
Ritor1
parents:
diff changeset
684 v29 = 0;
Ritor1
parents:
diff changeset
685 do
Ritor1
parents:
diff changeset
686 {
Ritor1
parents:
diff changeset
687 v6 = &pOutdoor->pBModels[v29];
Ritor1
parents:
diff changeset
688 if ( v4 <= pOutdoor->pBModels[v29].sMaxX )
Ritor1
parents:
diff changeset
689 {
Ritor1
parents:
diff changeset
690 if ( v4 >= v6->sMinX )
Ritor1
parents:
diff changeset
691 {
Ritor1
parents:
diff changeset
692 if ( v40 <= v6->sMaxY )
Ritor1
parents:
diff changeset
693 {
Ritor1
parents:
diff changeset
694 if ( v40 >= v6->sMinY )
Ritor1
parents:
diff changeset
695 {
Ritor1
parents:
diff changeset
696 v33 = v5;
Ritor1
parents:
diff changeset
697 v26 = v6->uNumFaces;
Ritor1
parents:
diff changeset
698 if ( (signed int)v6->uNumFaces > (signed int)v5 )
Ritor1
parents:
diff changeset
699 {
Ritor1
parents:
diff changeset
700 v30 = v5;
Ritor1
parents:
diff changeset
701 while ( 1 )
Ritor1
parents:
diff changeset
702 {
Ritor1
parents:
diff changeset
703 v7 = (ODMFace *)((char *)v6->pFaces + v30);
Ritor1
parents:
diff changeset
704 v8 = v7->uPolygonType;
Ritor1
parents:
diff changeset
705 if ( (v8 == 5 || v8 == 6)
Ritor1
parents:
diff changeset
706 && !(BYTE3(v7->uAttributes) & 0x20)
Ritor1
parents:
diff changeset
707 && v4 <= v7->pBoundingBox.x2
Ritor1
parents:
diff changeset
708 && v4 >= v7->pBoundingBox.x1
Ritor1
parents:
diff changeset
709 && v40 <= v7->pBoundingBox.y2
Ritor1
parents:
diff changeset
710 && v40 >= v7->pBoundingBox.y1 )
Ritor1
parents:
diff changeset
711 {
Ritor1
parents:
diff changeset
712 v36 = v5;
Ritor1
parents:
diff changeset
713 if ( v7->uNumVertices )
Ritor1
parents:
diff changeset
714 {
Ritor1
parents:
diff changeset
715 v9 = v7->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
716 do
Ritor1
parents:
diff changeset
717 {
Ritor1
parents:
diff changeset
718 v10 = 2 * v36;
Ritor1
parents:
diff changeset
719 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x);
Ritor1
parents:
diff changeset
720 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y);
Ritor1
parents:
diff changeset
721 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x);
Ritor1
parents:
diff changeset
722 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y);
Ritor1
parents:
diff changeset
723 ++v9;
Ritor1
parents:
diff changeset
724 }
Ritor1
parents:
diff changeset
725 while ( v36 < v7->uNumVertices );
Ritor1
parents:
diff changeset
726 v4 = v31;
Ritor1
parents:
diff changeset
727 }
Ritor1
parents:
diff changeset
728 v27 = 2 * v7->uNumVertices;
Ritor1
parents:
diff changeset
729 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0];
Ritor1
parents:
diff changeset
730 word_720CE0_ys[v27] = word_720CE0_ys[0];
Ritor1
parents:
diff changeset
731 v11 = 0;
Ritor1
parents:
diff changeset
732 v34 = word_720CE0_ys[0] >= v40;
Ritor1
parents:
diff changeset
733 v37 = 0;
Ritor1
parents:
diff changeset
734 v28 = 0;
Ritor1
parents:
diff changeset
735 if ( v27 > 0 )
Ritor1
parents:
diff changeset
736 {
Ritor1
parents:
diff changeset
737 do
Ritor1
parents:
diff changeset
738 {
Ritor1
parents:
diff changeset
739 if ( v37 >= 2 )
Ritor1
parents:
diff changeset
740 break;
Ritor1
parents:
diff changeset
741 v12 = v11;
Ritor1
parents:
diff changeset
742 v4 = v31;
Ritor1
parents:
diff changeset
743 v35 = word_720CE0_ys[v12 + 1] >= v40;
Ritor1
parents:
diff changeset
744 if ( v34 != v35 )
Ritor1
parents:
diff changeset
745 {
Ritor1
parents:
diff changeset
746 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2;
Ritor1
parents:
diff changeset
747 v14 = v13 | word_720DB0_xs[v12] < v31;
Ritor1
parents:
diff changeset
748 if ( v14 != 3 )
Ritor1
parents:
diff changeset
749 {
Ritor1
parents:
diff changeset
750 if ( !v14
Ritor1
parents:
diff changeset
751 || (v15 = word_720CE0_ys[v12],
Ritor1
parents:
diff changeset
752 v16 = word_720CE0_ys[v12 + 1] - v15,
Ritor1
parents:
diff changeset
753 v17 = v40 - v15,
Ritor1
parents:
diff changeset
754 LODWORD(v18) = v17 << 16,
Ritor1
parents:
diff changeset
755 HIDWORD(v18) = v17 >> 16,
Ritor1
parents:
diff changeset
756 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1]
Ritor1
parents:
diff changeset
757 - (signed int)word_720DB0_xs[v12])
Ritor1
parents:
diff changeset
758 * v18
Ritor1
parents:
diff changeset
759 / v16) >> 16)
Ritor1
parents:
diff changeset
760 + word_720DB0_xs[v12]) >= v31) )
Ritor1
parents:
diff changeset
761 ++v37;
Ritor1
parents:
diff changeset
762 }
Ritor1
parents:
diff changeset
763 }
Ritor1
parents:
diff changeset
764 v11 = v28 + 1;
Ritor1
parents:
diff changeset
765 v34 = v35;
Ritor1
parents:
diff changeset
766 ++v28;
Ritor1
parents:
diff changeset
767 }
Ritor1
parents:
diff changeset
768 while ( v28 < v27 );
Ritor1
parents:
diff changeset
769 if ( v37 == 1 )
Ritor1
parents:
diff changeset
770 {
Ritor1
parents:
diff changeset
771 if ( v39 >= 20 )
Ritor1
parents:
diff changeset
772 break;
Ritor1
parents:
diff changeset
773 if ( v7->uPolygonType == 5 )
Ritor1
parents:
diff changeset
774 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z;
Ritor1
parents:
diff changeset
775 else
Ritor1
parents:
diff changeset
776 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16)
Ritor1
parents:
diff changeset
777 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16)
Ritor1
parents:
diff changeset
778 + HIWORD(v7->zCalc3);
Ritor1
parents:
diff changeset
779 v20 = v39++;
Ritor1
parents:
diff changeset
780 dword_720F20[v20] = v19;
Ritor1
parents:
diff changeset
781 dword_720ED0[v20] = v32;
Ritor1
parents:
diff changeset
782 dword_720E80[v20] = v33;
Ritor1
parents:
diff changeset
783 }
Ritor1
parents:
diff changeset
784 }
Ritor1
parents:
diff changeset
785 }
Ritor1
parents:
diff changeset
786 ++v33;
Ritor1
parents:
diff changeset
787 v30 += 308;
Ritor1
parents:
diff changeset
788 if ( v33 >= v26 )
Ritor1
parents:
diff changeset
789 break;
Ritor1
parents:
diff changeset
790 v5 = 0;
Ritor1
parents:
diff changeset
791 }
Ritor1
parents:
diff changeset
792 }
Ritor1
parents:
diff changeset
793 }
Ritor1
parents:
diff changeset
794 }
Ritor1
parents:
diff changeset
795 }
Ritor1
parents:
diff changeset
796 }
Ritor1
parents:
diff changeset
797 ++v32;
Ritor1
parents:
diff changeset
798 ++v29;
Ritor1
parents:
diff changeset
799 v5 = 0;
Ritor1
parents:
diff changeset
800 }
Ritor1
parents:
diff changeset
801 while ( v32 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
802 if ( !v39 )
Ritor1
parents:
diff changeset
803 {
Ritor1
parents:
diff changeset
804 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
805 return dword_720F20[0];
Ritor1
parents:
diff changeset
806 }
Ritor1
parents:
diff changeset
807 }
Ritor1
parents:
diff changeset
808 v22 = 0;
Ritor1
parents:
diff changeset
809 v38 = v5;
Ritor1
parents:
diff changeset
810 if ( v39 <= (signed int)v5 )
Ritor1
parents:
diff changeset
811 goto LABEL_54;
Ritor1
parents:
diff changeset
812 v23 = 0;
Ritor1
parents:
diff changeset
813 do
Ritor1
parents:
diff changeset
814 {
Ritor1
parents:
diff changeset
815 v24 = dword_720F20[v5 / 4];
Ritor1
parents:
diff changeset
816 v25 = *(int *)((char *)dword_720F20 + v23);
Ritor1
parents:
diff changeset
817 if ( v24 == v25 )
Ritor1
parents:
diff changeset
818 goto LABEL_50;
Ritor1
parents:
diff changeset
819 if ( v25 > a3 + 15 )
Ritor1
parents:
diff changeset
820 {
Ritor1
parents:
diff changeset
821 if ( v24 >= v25 )
Ritor1
parents:
diff changeset
822 goto LABEL_51;
Ritor1
parents:
diff changeset
823 LABEL_50:
Ritor1
parents:
diff changeset
824 v22 = v38;
Ritor1
parents:
diff changeset
825 v23 = v5;
Ritor1
parents:
diff changeset
826 goto LABEL_51;
Ritor1
parents:
diff changeset
827 }
Ritor1
parents:
diff changeset
828 if ( v24 > v25 && v24 <= a3 + 15 )
Ritor1
parents:
diff changeset
829 goto LABEL_50;
Ritor1
parents:
diff changeset
830 LABEL_51:
Ritor1
parents:
diff changeset
831 ++v38;
Ritor1
parents:
diff changeset
832 v5 += 4;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834 while ( v38 < v39 );
Ritor1
parents:
diff changeset
835 if ( v22 )
Ritor1
parents:
diff changeset
836 {
Ritor1
parents:
diff changeset
837 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
Ritor1
parents:
diff changeset
838 return dword_720F20[v22];
Ritor1
parents:
diff changeset
839 }
Ritor1
parents:
diff changeset
840 LABEL_54:
Ritor1
parents:
diff changeset
841 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
842 return dword_720F20[v22];
Ritor1
parents:
diff changeset
843 }
Ritor1
parents:
diff changeset
844
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
845
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
846 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
847 // for a right-handed system, that would be an inverse normal
0
Ritor1
parents:
diff changeset
848 //----- (0046DCC8) --------------------------------------------------------
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
849 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
850 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
851 auto grid_x = WorldPosToGridCellX(pos_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
852 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
853
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
854 auto grid_pos_x1 = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
855 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
856 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
857 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
858
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
859 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
860 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
861 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
862 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
863
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
864 float side1_dx, side1_dy, side1_dz,
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
865 side2_dx, side2_dy, side2_dz;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
866
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
867 auto dx = abs(pos_x - grid_pos_x1),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
868 dz = abs(grid_pos_z1 - pos_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
869 if (dz >= dx)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
870 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
871 side1_dy = (double)(x1z1_y - x1z2_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
872 side2_dy = (double)(x2z2_y - x1z2_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
873 side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
874 side1_dx = (double)(grid_pos_x1 - grid_pos_x1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
875 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
876 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 431
diff changeset
877 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
878 /* |\
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
879 side1 | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
880 |____\
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
881 side 2 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
882 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
883 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
884 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
885 side1_dy = (double)(x2z2_y - x2z1_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
886 side2_dy = (double)(x1z1_y - x2z1_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
887 side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
888 side1_dx = (double)(grid_pos_x2 - grid_pos_x2);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
889 side2_dz = (double)(grid_pos_z1 - grid_pos_z1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
890 side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
891
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
892 /* side 2
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
893 _____
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
894 \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
895 \ | side 1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
896 \| */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
897 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
898
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
899 float nx = side1_dy * side2_dz - side1_dz * side2_dy;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
900 float ny = side1_dx * side2_dy - side1_dy * side2_dx;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
901 float nz = side1_dz * side2_dx - side1_dx * side2_dz;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
902
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
903 float mag = sqrt(nx * nx + ny * ny + nz * nz);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
904 if (fabsf(mag) < 1e-6f)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
905 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
906 out->y = 0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
907 out->x = 0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
908 out->z = 65536;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
909 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
910 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
911 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
912 float invmag = 1.0 / mag;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
913 out->x = invmag * nx * 65536.0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
914 out->y = invmag * ny * 65536.0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
915 out->z = invmag * nz * 65536.0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
916 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
917 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
918
0
Ritor1
parents:
diff changeset
919
Ritor1
parents:
diff changeset
920 //----- (0046DEF2) --------------------------------------------------------
Ritor1
parents:
diff changeset
921 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
922 {
Ritor1
parents:
diff changeset
923 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
924
Ritor1
parents:
diff changeset
925 result = uLayingItemID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
926 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 )
0
Ritor1
parents:
diff changeset
927 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
Ritor1
parents:
diff changeset
928 return result;
Ritor1
parents:
diff changeset
929 }
Ritor1
parents:
diff changeset
930
Ritor1
parents:
diff changeset
931 //----- (0046DF1A) --------------------------------------------------------
Ritor1
parents:
diff changeset
932 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2)
Ritor1
parents:
diff changeset
933 {
Ritor1
parents:
diff changeset
934 Actor *v2; // edi@1
Ritor1
parents:
diff changeset
935 unsigned __int16 v3; // ax@1
Ritor1
parents:
diff changeset
936 int v4; // esi@6
Ritor1
parents:
diff changeset
937 int v5; // ecx@8
Ritor1
parents:
diff changeset
938 int v6; // eax@10
Ritor1
parents:
diff changeset
939 int v7; // edx@12
Ritor1
parents:
diff changeset
940 int v8; // ecx@14
Ritor1
parents:
diff changeset
941 int v9; // eax@14
Ritor1
parents:
diff changeset
942 int v10; // ebx@14
Ritor1
parents:
diff changeset
943 int v11; // esi@14
Ritor1
parents:
diff changeset
944 int v12; // ebx@15
Ritor1
parents:
diff changeset
945 int v13; // ebx@17
Ritor1
parents:
diff changeset
946 unsigned int v14; // eax@20
Ritor1
parents:
diff changeset
947 signed int result; // eax@21
Ritor1
parents:
diff changeset
948 int v16; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
949 int v17; // [sp+10h] [bp-Ch]@14
Ritor1
parents:
diff changeset
950 int v18; // [sp+14h] [bp-8h]@14
Ritor1
parents:
diff changeset
951 int v19; // [sp+18h] [bp-4h]@14
Ritor1
parents:
diff changeset
952
Ritor1
parents:
diff changeset
953 v16 = a1;
Ritor1
parents:
diff changeset
954 v2 = &pActors[a1];
Ritor1
parents:
diff changeset
955 v3 = v2->uAIState;
Ritor1
parents:
diff changeset
956 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 )
Ritor1
parents:
diff changeset
957 goto LABEL_25;
Ritor1
parents:
diff changeset
958 v4 = v2->uActorRadius;
Ritor1
parents:
diff changeset
959 if ( a2 )
Ritor1
parents:
diff changeset
960 v4 = a2;
Ritor1
parents:
diff changeset
961 v5 = v2->vPosition.x;
Ritor1
parents:
diff changeset
962 if ( stru_721530.sMaxX > v5 + v4
Ritor1
parents:
diff changeset
963 || stru_721530.sMinX < v5 - v4
Ritor1
parents:
diff changeset
964 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4)
Ritor1
parents:
diff changeset
965 || stru_721530.sMinY < v6 - v4
Ritor1
parents:
diff changeset
966 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight)
Ritor1
parents:
diff changeset
967 || stru_721530.sMinZ < v7
Ritor1
parents:
diff changeset
968 || (v8 = v5 - stru_721530.normal.x,
Ritor1
parents:
diff changeset
969 v9 = v6 - stru_721530.normal.y,
Ritor1
parents:
diff changeset
970 v10 = stru_721530.prolly_normal_d + v4,
Ritor1
parents:
diff changeset
971 v17 = stru_721530.prolly_normal_d + v4,
Ritor1
parents:
diff changeset
972 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16,
Ritor1
parents:
diff changeset
973 v18 = v8,
Ritor1
parents:
diff changeset
974 v19 = v9,
Ritor1
parents:
diff changeset
975 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10)
Ritor1
parents:
diff changeset
976 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0)
Ritor1
parents:
diff changeset
977 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z )
Ritor1
parents:
diff changeset
978 {
Ritor1
parents:
diff changeset
979 LABEL_25:
Ritor1
parents:
diff changeset
980 result = 0;
Ritor1
parents:
diff changeset
981 }
Ritor1
parents:
diff changeset
982 else
Ritor1
parents:
diff changeset
983 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
984 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11);
0
Ritor1
parents:
diff changeset
985 if ( v13 < 0 )
Ritor1
parents:
diff changeset
986 v13 = 0;
Ritor1
parents:
diff changeset
987 if ( v13 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
988 {
Ritor1
parents:
diff changeset
989 stru_721530.field_7C = v13;
Ritor1
parents:
diff changeset
990 v14 = 8 * v16;
Ritor1
parents:
diff changeset
991 LOBYTE(v14) = 8 * v16 | 3;
Ritor1
parents:
diff changeset
992 stru_721530.uFaceID = v14;
Ritor1
parents:
diff changeset
993 }
Ritor1
parents:
diff changeset
994 result = 1;
Ritor1
parents:
diff changeset
995 }
Ritor1
parents:
diff changeset
996 return result;
Ritor1
parents:
diff changeset
997 }
Ritor1
parents:
diff changeset
998 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
Ritor1
parents:
diff changeset
999
Ritor1
parents:
diff changeset
1000 //----- (0046E0B2) --------------------------------------------------------
Ritor1
parents:
diff changeset
1001 void __cdecl _46E0B2_collide_against_decorations()
Ritor1
parents:
diff changeset
1002 {
Ritor1
parents:
diff changeset
1003 BLVSector *v0; // ebp@1
Ritor1
parents:
diff changeset
1004 LevelDecoration *v1; // edi@2
Ritor1
parents:
diff changeset
1005 DecorationDesc *v2; // esi@3
Ritor1
parents:
diff changeset
1006 int v3; // edx@4
Ritor1
parents:
diff changeset
1007 int v4; // eax@4
Ritor1
parents:
diff changeset
1008 int v5; // ecx@6
Ritor1
parents:
diff changeset
1009 int v6; // ebx@8
Ritor1
parents:
diff changeset
1010 int v7; // esi@8
Ritor1
parents:
diff changeset
1011 int v8; // ebx@10
Ritor1
parents:
diff changeset
1012 int v9; // esi@11
Ritor1
parents:
diff changeset
1013 int v10; // edi@12
Ritor1
parents:
diff changeset
1014 int v11; // eax@12
Ritor1
parents:
diff changeset
1015 int v12; // esi@14
Ritor1
parents:
diff changeset
1016 unsigned int v13; // eax@17
Ritor1
parents:
diff changeset
1017 signed int i; // [sp+4h] [bp-14h]@1
Ritor1
parents:
diff changeset
1018 int v15; // [sp+8h] [bp-10h]@10
Ritor1
parents:
diff changeset
1019 int v16; // [sp+Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
1020 int v17; // [sp+10h] [bp-8h]@10
Ritor1
parents:
diff changeset
1021 int v18; // [sp+14h] [bp-4h]@8
Ritor1
parents:
diff changeset
1022
Ritor1
parents:
diff changeset
1023 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
1024 for ( i = 0; i < v0->uNumDecorations; ++i )
Ritor1
parents:
diff changeset
1025 {
Ritor1
parents:
diff changeset
1026 v1 = &pLevelDecorations[v0->pDecorationIDs[i]];
Ritor1
parents:
diff changeset
1027 if ( !(v1->field_2 & 0x20) )
Ritor1
parents:
diff changeset
1028 {
Ritor1
parents:
diff changeset
1029 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
1030 if (!v2->CanMoveThrough())
0
Ritor1
parents:
diff changeset
1031 {
Ritor1
parents:
diff changeset
1032 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
1033 v4 = v1->vPosition.x;
Ritor1
parents:
diff changeset
1034 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
1035 {
Ritor1
parents:
diff changeset
1036 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
1037 {
Ritor1
parents:
diff changeset
1038 v5 = v1->vPosition.y;
Ritor1
parents:
diff changeset
1039 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
1040 {
Ritor1
parents:
diff changeset
1041 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
1042 {
Ritor1
parents:
diff changeset
1043 v6 = v2->uDecorationHeight;
Ritor1
parents:
diff changeset
1044 v7 = v1->vPosition.z;
Ritor1
parents:
diff changeset
1045 v18 = v6;
Ritor1
parents:
diff changeset
1046 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
1047 {
Ritor1
parents:
diff changeset
1048 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
1049 {
Ritor1
parents:
diff changeset
1050 v16 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
1051 v15 = v5 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
1052 v8 = stru_721530.prolly_normal_d + v3;
Ritor1
parents:
diff changeset
1053 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
1054 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
1055 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 )
Ritor1
parents:
diff changeset
1056 {
Ritor1
parents:
diff changeset
1057 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
1058 if ( v9 > 0 )
Ritor1
parents:
diff changeset
1059 {
Ritor1
parents:
diff changeset
1060 v10 = v1->vPosition.z;
Ritor1
parents:
diff changeset
1061 v11 = stru_721530.normal.z
Ritor1
parents:
diff changeset
1062 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16);
Ritor1
parents:
diff changeset
1063 if ( v11 >= v10 )
Ritor1
parents:
diff changeset
1064 {
Ritor1
parents:
diff changeset
1065 if ( v11 <= v18 + v10 )
Ritor1
parents:
diff changeset
1066 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
1067 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17);
0
Ritor1
parents:
diff changeset
1068 if ( v12 < 0 )
Ritor1
parents:
diff changeset
1069 v12 = 0;
Ritor1
parents:
diff changeset
1070 if ( v12 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
1071 {
Ritor1
parents:
diff changeset
1072 stru_721530.field_7C = v12;
Ritor1
parents:
diff changeset
1073 v13 = 8 * v0->pDecorationIDs[i];
Ritor1
parents:
diff changeset
1074 LOBYTE(v13) = v13 | 5;
Ritor1
parents:
diff changeset
1075 stru_721530.uFaceID = v13;
Ritor1
parents:
diff changeset
1076 }
Ritor1
parents:
diff changeset
1077 }
Ritor1
parents:
diff changeset
1078 }
Ritor1
parents:
diff changeset
1079 }
Ritor1
parents:
diff changeset
1080 }
Ritor1
parents:
diff changeset
1081 }
Ritor1
parents:
diff changeset
1082 }
Ritor1
parents:
diff changeset
1083 }
Ritor1
parents:
diff changeset
1084 }
Ritor1
parents:
diff changeset
1085 }
Ritor1
parents:
diff changeset
1086 }
Ritor1
parents:
diff changeset
1087 }
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089 }
Ritor1
parents:
diff changeset
1090 }
Ritor1
parents:
diff changeset
1091
Ritor1
parents:
diff changeset
1092 //----- (0046E26D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1093 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2)
Ritor1
parents:
diff changeset
1094 {
Ritor1
parents:
diff changeset
1095 int v2; // edx@5
Ritor1
parents:
diff changeset
1096 unsigned __int16 *v3; // eax@5
Ritor1
parents:
diff changeset
1097 unsigned __int16 v4; // ax@6
Ritor1
parents:
diff changeset
1098 LevelDecoration *v5; // edi@7
Ritor1
parents:
diff changeset
1099 DecorationDesc *v6; // esi@8
Ritor1
parents:
diff changeset
1100 int v7; // edx@9
Ritor1
parents:
diff changeset
1101 int v8; // eax@9
Ritor1
parents:
diff changeset
1102 int v9; // ecx@11
Ritor1
parents:
diff changeset
1103 int v10; // ebx@13
Ritor1
parents:
diff changeset
1104 int v11; // esi@13
Ritor1
parents:
diff changeset
1105 int v12; // ebp@15
Ritor1
parents:
diff changeset
1106 int v13; // ebx@15
Ritor1
parents:
diff changeset
1107 int v14; // esi@16
Ritor1
parents:
diff changeset
1108 int v15; // edi@17
Ritor1
parents:
diff changeset
1109 int v16; // eax@17
Ritor1
parents:
diff changeset
1110 int v17; // esi@19
Ritor1
parents:
diff changeset
1111 char v18; // zf@23
Ritor1
parents:
diff changeset
1112 int v19; // [sp+0h] [bp-10h]@15
Ritor1
parents:
diff changeset
1113 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5
Ritor1
parents:
diff changeset
1114 int v21; // [sp+8h] [bp-8h]@15
Ritor1
parents:
diff changeset
1115 int v22; // [sp+Ch] [bp-4h]@13
Ritor1
parents:
diff changeset
1116
Ritor1
parents:
diff changeset
1117 if ( a1 >= 0 )
Ritor1
parents:
diff changeset
1118 {
Ritor1
parents:
diff changeset
1119 if ( a1 <= 127 )
Ritor1
parents:
diff changeset
1120 {
Ritor1
parents:
diff changeset
1121 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
1122 {
Ritor1
parents:
diff changeset
1123 if ( a2 <= 127 )
Ritor1
parents:
diff changeset
1124 {
Ritor1
parents:
diff changeset
1125 v2 = a1 + (a2 << 7);
Ritor1
parents:
diff changeset
1126 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]];
Ritor1
parents:
diff changeset
1127 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]];
Ritor1
parents:
diff changeset
1128 if ( v3 )
Ritor1
parents:
diff changeset
1129 {
Ritor1
parents:
diff changeset
1130 do
Ritor1
parents:
diff changeset
1131 {
Ritor1
parents:
diff changeset
1132 v4 = *v3;
141
cca78efb377e Constants -> enums
Nomad
parents: 138
diff changeset
1133 if ( (v4 & 7) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
1134 {
Ritor1
parents:
diff changeset
1135 v5 = &pLevelDecorations[(signed __int16)v4 >> 3];
Ritor1
parents:
diff changeset
1136 if ( !(v5->field_2 & 0x20) )
Ritor1
parents:
diff changeset
1137 {
Ritor1
parents:
diff changeset
1138 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
1139 if (!v6->CanMoveThrough())
0
Ritor1
parents:
diff changeset
1140 {
Ritor1
parents:
diff changeset
1141 v7 = v6->uRadius;
Ritor1
parents:
diff changeset
1142 v8 = v5->vPosition.x;
Ritor1
parents:
diff changeset
1143 if ( stru_721530.sMaxX <= v8 + v7 )
Ritor1
parents:
diff changeset
1144 {
Ritor1
parents:
diff changeset
1145 if ( stru_721530.sMinX >= v8 - v7 )
Ritor1
parents:
diff changeset
1146 {
Ritor1
parents:
diff changeset
1147 v9 = v5->vPosition.y;
Ritor1
parents:
diff changeset
1148 if ( stru_721530.sMaxY <= v9 + v7 )
Ritor1
parents:
diff changeset
1149 {
Ritor1
parents:
diff changeset
1150 if ( stru_721530.sMinY >= v9 - v7 )
Ritor1
parents:
diff changeset
1151 {
Ritor1
parents:
diff changeset
1152 v10 = v6->uDecorationHeight;
Ritor1
parents:
diff changeset
1153 v11 = v5->vPosition.z;
Ritor1
parents:
diff changeset
1154 v22 = v10;
Ritor1
parents:
diff changeset
1155 if ( stru_721530.sMaxZ <= v11 + v10 )
Ritor1
parents:
diff changeset
1156 {
Ritor1
parents:
diff changeset
1157 if ( stru_721530.sMinZ >= v11 )
Ritor1
parents:
diff changeset
1158 {
Ritor1
parents:
diff changeset
1159 v12 = v8 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
1160 v19 = v9 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
1161 v13 = stru_721530.prolly_normal_d + v7;
Ritor1
parents:
diff changeset
1162 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
1163 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
1164 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 )
Ritor1
parents:
diff changeset
1165 {
Ritor1
parents:
diff changeset
1166 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
1167 if ( v14 > 0 )
Ritor1
parents:
diff changeset
1168 {
Ritor1
parents:
diff changeset
1169 v15 = v5->vPosition.z;
Ritor1
parents:
diff changeset
1170 v16 = stru_721530.normal.z
Ritor1
parents:
diff changeset
1171 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16);
Ritor1
parents:
diff changeset
1172 if ( v16 >= v15 )
Ritor1
parents:
diff changeset
1173 {
Ritor1
parents:
diff changeset
1174 if ( v16 <= v22 + v15 )
Ritor1
parents:
diff changeset
1175 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
1176 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21);
0
Ritor1
parents:
diff changeset
1177 if ( v17 < 0 )
Ritor1
parents:
diff changeset
1178 v17 = 0;
Ritor1
parents:
diff changeset
1179 if ( v17 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
1180 {
Ritor1
parents:
diff changeset
1181 stru_721530.field_7C = v17;
Ritor1
parents:
diff changeset
1182 stru_721530.uFaceID = (signed __int16)*v20;
Ritor1
parents:
diff changeset
1183 }
Ritor1
parents:
diff changeset
1184 }
Ritor1
parents:
diff changeset
1185 }
Ritor1
parents:
diff changeset
1186 }
Ritor1
parents:
diff changeset
1187 }
Ritor1
parents:
diff changeset
1188 }
Ritor1
parents:
diff changeset
1189 }
Ritor1
parents:
diff changeset
1190 }
Ritor1
parents:
diff changeset
1191 }
Ritor1
parents:
diff changeset
1192 }
Ritor1
parents:
diff changeset
1193 }
Ritor1
parents:
diff changeset
1194 }
Ritor1
parents:
diff changeset
1195 }
Ritor1
parents:
diff changeset
1196 }
Ritor1
parents:
diff changeset
1197 v3 = v20 + 1;
Ritor1
parents:
diff changeset
1198 v18 = *v20 == 0;
Ritor1
parents:
diff changeset
1199 ++v20;
Ritor1
parents:
diff changeset
1200 }
Ritor1
parents:
diff changeset
1201 while ( !v18 );
Ritor1
parents:
diff changeset
1202 }
Ritor1
parents:
diff changeset
1203 }
Ritor1
parents:
diff changeset
1204 }
Ritor1
parents:
diff changeset
1205 }
Ritor1
parents:
diff changeset
1206 }
Ritor1
parents:
diff changeset
1207 }
Ritor1
parents:
diff changeset
1208
Ritor1
parents:
diff changeset
1209 //----- (00486F92) --------------------------------------------------------
Ritor1
parents:
diff changeset
1210 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans()
Ritor1
parents:
diff changeset
1211 {
Ritor1
parents:
diff changeset
1212 Span *v0; // ebx@1
Ritor1
parents:
diff changeset
1213 int v1; // eax@2
Ritor1
parents:
diff changeset
1214 Edge *v2; // ecx@3
Ritor1
parents:
diff changeset
1215 Edge *v3; // edx@3
Ritor1
parents:
diff changeset
1216 Edge *v4; // esi@6
Ritor1
parents:
diff changeset
1217 Edge *v5; // eax@7
Ritor1
parents:
diff changeset
1218 Edge *v6; // ecx@8
Ritor1
parents:
diff changeset
1219 Surf *v7; // esi@11
Ritor1
parents:
diff changeset
1220 double v8; // st7@13
Ritor1
parents:
diff changeset
1221 Surf *v9; // edi@13
Ritor1
parents:
diff changeset
1222 double v10; // st6@13
Ritor1
parents:
diff changeset
1223 double v11; // st7@14
Ritor1
parents:
diff changeset
1224 signed __int64 v12; // qax@14
Ritor1
parents:
diff changeset
1225 stru148 *v13; // eax@15
Ritor1
parents:
diff changeset
1226 Span *v14; // ecx@17
Ritor1
parents:
diff changeset
1227 double v15; // st7@28
Ritor1
parents:
diff changeset
1228 signed __int64 v16; // qax@28
Ritor1
parents:
diff changeset
1229 stru148 *v17; // eax@29
Ritor1
parents:
diff changeset
1230 Span *v18; // ecx@31
Ritor1
parents:
diff changeset
1231 Edge *i; // eax@40
Ritor1
parents:
diff changeset
1232 Edge *v20; // ecx@43
Ritor1
parents:
diff changeset
1233 Edge *v21; // esi@44
Ritor1
parents:
diff changeset
1234 double v22; // st7@45
Ritor1
parents:
diff changeset
1235 Edge *v23; // edx@48
Ritor1
parents:
diff changeset
1236 unsigned int v24; // [sp+10h] [bp-10h]@2
Ritor1
parents:
diff changeset
1237 float v25; // [sp+14h] [bp-Ch]@3
Ritor1
parents:
diff changeset
1238 Edge *v26; // [sp+18h] [bp-8h]@8
Ritor1
parents:
diff changeset
1239 unsigned int v27; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1240
Ritor1
parents:
diff changeset
1241 v0 = pSpans;
Ritor1
parents:
diff changeset
1242 stru_80C9D8.pSurf = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1243 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
1244 stru_80C9A4.pSurf = &stru_80C980;
Ritor1
parents:
diff changeset
1245 stru_80C980.pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
1246 stru_80C980.pNext = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1247 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
1248 stru_80C980.field_8 = 0.0;
Ritor1
parents:
diff changeset
1249 stru_80C980.field_4 = 0.0;
Ritor1
parents:
diff changeset
1250 stru_80C9D8.pNext = &stru_80C9A4;
Ritor1
parents:
diff changeset
1251 stru_80C9D8.pPrev = 0;
Ritor1
parents:
diff changeset
1252 stru_80C9D8.field_8 = 1;
Ritor1
parents:
diff changeset
1253 stru_80C9A4.pNext = 0;
Ritor1
parents:
diff changeset
1254 stru_80C9A4.pPrev = &stru_80C9D8;
Ritor1
parents:
diff changeset
1255 stru_80C9A4.field_8 = 0;
Ritor1
parents:
diff changeset
1256 LODWORD(stru_80C980.field_0) = 0xC97423F0u;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1257 v27 = pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1258 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1259 {
Ritor1
parents:
diff changeset
1260 LABEL_51:
Ritor1
parents:
diff changeset
1261 v0->field_8 = -1;
Ritor1
parents:
diff changeset
1262 }
Ritor1
parents:
diff changeset
1263 else
Ritor1
parents:
diff changeset
1264 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1265 v1 = 52 * pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1266 v24 = 52 * pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
1267 while ( 1 )
Ritor1
parents:
diff changeset
1268 {
Ritor1
parents:
diff changeset
1269 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1);
Ritor1
parents:
diff changeset
1270 v3 = &stru_80C9D8;
Ritor1
parents:
diff changeset
1271 v25 = (double)(signed int)v27;
Ritor1
parents:
diff changeset
1272 if ( v2 != &defaultEdge )
Ritor1
parents:
diff changeset
1273 {
Ritor1
parents:
diff changeset
1274 do
Ritor1
parents:
diff changeset
1275 {
Ritor1
parents:
diff changeset
1276 while ( 1 )
Ritor1
parents:
diff changeset
1277 {
Ritor1
parents:
diff changeset
1278 v4 = v3->pNext;
Ritor1
parents:
diff changeset
1279 if ( v2->field_0 <= (double)v4->field_0 )
Ritor1
parents:
diff changeset
1280 break;
Ritor1
parents:
diff changeset
1281 v3 = v3->pNext;
Ritor1
parents:
diff changeset
1282 }
Ritor1
parents:
diff changeset
1283 v5 = v2->pNext;
Ritor1
parents:
diff changeset
1284 v2->pNext = v4;
Ritor1
parents:
diff changeset
1285 v2->pPrev = v3;
Ritor1
parents:
diff changeset
1286 v3->pNext->pPrev = v2;
Ritor1
parents:
diff changeset
1287 v3->pNext = v2;
Ritor1
parents:
diff changeset
1288 v3 = v2;
Ritor1
parents:
diff changeset
1289 v2 = v5;
Ritor1
parents:
diff changeset
1290 }
Ritor1
parents:
diff changeset
1291 while ( v5 != &defaultEdge );
Ritor1
parents:
diff changeset
1292 }
Ritor1
parents:
diff changeset
1293 v6 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1294 stru_80C980.field_20 = 0;
Ritor1
parents:
diff changeset
1295 stru_80C980.field_22 = 1;
Ritor1
parents:
diff changeset
1296 v26 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1297 if ( stru_80C9D8.pNext )
Ritor1
parents:
diff changeset
1298 {
Ritor1
parents:
diff changeset
1299 while ( 1 )
Ritor1
parents:
diff changeset
1300 {
Ritor1
parents:
diff changeset
1301 v7 = v6->pSurf;
Ritor1
parents:
diff changeset
1302 if ( v6->field_8 )
Ritor1
parents:
diff changeset
1303 {
Ritor1
parents:
diff changeset
1304 ++v7->field_22;
Ritor1
parents:
diff changeset
1305 if ( v7->field_22 == 1 )
Ritor1
parents:
diff changeset
1306 {
Ritor1
parents:
diff changeset
1307 v8 = v6->field_0 + 2.0;
Ritor1
parents:
diff changeset
1308 v9 = stru_80C980.pNext;
Ritor1
parents:
diff changeset
1309 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0;
Ritor1
parents:
diff changeset
1310 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4
Ritor1
parents:
diff changeset
1311 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8
Ritor1
parents:
diff changeset
1312 + stru_80C980.pNext->field_0 )
Ritor1
parents:
diff changeset
1313 {
Ritor1
parents:
diff changeset
1314 do
Ritor1
parents:
diff changeset
1315 v9 = v9->pNext;
Ritor1
parents:
diff changeset
1316 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 );
Ritor1
parents:
diff changeset
1317 v7->pNext = v9;
Ritor1
parents:
diff changeset
1318 v7->pPrev = v9->pPrev;
Ritor1
parents:
diff changeset
1319 v9->pPrev->pNext = v7;
Ritor1
parents:
diff changeset
1320 v9->pPrev = v7;
Ritor1
parents:
diff changeset
1321 }
Ritor1
parents:
diff changeset
1322 else
Ritor1
parents:
diff changeset
1323 {
Ritor1
parents:
diff changeset
1324 v11 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
1325 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20);
Ritor1
parents:
diff changeset
1326 v0->field_C = v12;
Ritor1
parents:
diff changeset
1327 if ( (signed __int16)v12 > 0 )
Ritor1
parents:
diff changeset
1328 {
Ritor1
parents:
diff changeset
1329 v0->field_A = v27;
Ritor1
parents:
diff changeset
1330 v0->field_8 = v9->field_20;
Ritor1
parents:
diff changeset
1331 v13 = v9->pParent;
Ritor1
parents:
diff changeset
1332 v0->pParent = v13;
Ritor1
parents:
diff changeset
1333 if ( v13 )
Ritor1
parents:
diff changeset
1334 {
Ritor1
parents:
diff changeset
1335 if ( v13->prolly_head )
Ritor1
parents:
diff changeset
1336 {
Ritor1
parents:
diff changeset
1337 v14 = v13->prolly_tail;
Ritor1
parents:
diff changeset
1338 if ( !v14 )
Ritor1
parents:
diff changeset
1339 return;
Ritor1
parents:
diff changeset
1340 v14->pNext = v0;
Ritor1
parents:
diff changeset
1341 }
Ritor1
parents:
diff changeset
1342 else
Ritor1
parents:
diff changeset
1343 {
Ritor1
parents:
diff changeset
1344 v13->prolly_head = v0;
Ritor1
parents:
diff changeset
1345 }
Ritor1
parents:
diff changeset
1346 v13->prolly_tail = v0;
Ritor1
parents:
diff changeset
1347 }
Ritor1
parents:
diff changeset
1348 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
1349 return;
Ritor1
parents:
diff changeset
1350 ++v0;
Ritor1
parents:
diff changeset
1351 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
1352 }
Ritor1
parents:
diff changeset
1353 v6 = v26;
Ritor1
parents:
diff changeset
1354 v7->field_20 = (signed __int64)v11;
Ritor1
parents:
diff changeset
1355 v7->pNext = v9;
Ritor1
parents:
diff changeset
1356 v9->pPrev = v7;
Ritor1
parents:
diff changeset
1357 stru_80C980.pNext = v7;
Ritor1
parents:
diff changeset
1358 v7->pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
1359 }
Ritor1
parents:
diff changeset
1360 }
Ritor1
parents:
diff changeset
1361 }
Ritor1
parents:
diff changeset
1362 else
Ritor1
parents:
diff changeset
1363 {
Ritor1
parents:
diff changeset
1364 --v7->field_22;
Ritor1
parents:
diff changeset
1365 if ( !v7->field_22 )
Ritor1
parents:
diff changeset
1366 {
Ritor1
parents:
diff changeset
1367 if ( stru_80C980.pNext == v7 )
Ritor1
parents:
diff changeset
1368 {
Ritor1
parents:
diff changeset
1369 v15 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
1370 v16 = (signed __int64)(v15 - (double)v7->field_20);
Ritor1
parents:
diff changeset
1371 v0->field_C = v16;
Ritor1
parents:
diff changeset
1372 if ( (signed __int16)v16 > 0 )
Ritor1
parents:
diff changeset
1373 {
Ritor1
parents:
diff changeset
1374 v0->field_A = v27;
Ritor1
parents:
diff changeset
1375 v0->field_8 = v7->field_20;
Ritor1
parents:
diff changeset
1376 v17 = v7->pParent;
Ritor1
parents:
diff changeset
1377 v0->pParent = v17;
Ritor1
parents:
diff changeset
1378 if ( v17 )
Ritor1
parents:
diff changeset
1379 {
Ritor1
parents:
diff changeset
1380 if ( v17->prolly_head )
Ritor1
parents:
diff changeset
1381 {
Ritor1
parents:
diff changeset
1382 v18 = v17->prolly_tail;
Ritor1
parents:
diff changeset
1383 if ( !v18 )
Ritor1
parents:
diff changeset
1384 return;
Ritor1
parents:
diff changeset
1385 v18->pNext = v0;
Ritor1
parents:
diff changeset
1386 }
Ritor1
parents:
diff changeset
1387 else
Ritor1
parents:
diff changeset
1388 {
Ritor1
parents:
diff changeset
1389 v17->prolly_head = v0;
Ritor1
parents:
diff changeset
1390 }
Ritor1
parents:
diff changeset
1391 v17->prolly_tail = v0;
Ritor1
parents:
diff changeset
1392 }
Ritor1
parents:
diff changeset
1393 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
1394 return;
Ritor1
parents:
diff changeset
1395 ++v0;
Ritor1
parents:
diff changeset
1396 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
1397 }
Ritor1
parents:
diff changeset
1398 v7->pNext->field_20 = (signed __int64)v15;
Ritor1
parents:
diff changeset
1399 v6 = v26;
Ritor1
parents:
diff changeset
1400 }
Ritor1
parents:
diff changeset
1401 v7->pNext->pPrev = v7->pPrev;
Ritor1
parents:
diff changeset
1402 v7->pPrev->pNext = v7->pNext;
Ritor1
parents:
diff changeset
1403 }
Ritor1
parents:
diff changeset
1404 }
Ritor1
parents:
diff changeset
1405 v26 = v6->pNext;
Ritor1
parents:
diff changeset
1406 if ( !v26 )
Ritor1
parents:
diff changeset
1407 break;
Ritor1
parents:
diff changeset
1408 v6 = v6->pNext;
Ritor1
parents:
diff changeset
1409 }
Ritor1
parents:
diff changeset
1410 }
Ritor1
parents:
diff changeset
1411 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 )
Ritor1
parents:
diff changeset
1412 {
Ritor1
parents:
diff changeset
1413 i->pPrev->pNext = i->pNext;
Ritor1
parents:
diff changeset
1414 i->pNext->pPrev = i->pPrev;
Ritor1
parents:
diff changeset
1415 }
Ritor1
parents:
diff changeset
1416 v20 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1417 if ( stru_80C9D8.pNext != &stru_80C9A4 )
Ritor1
parents:
diff changeset
1418 break;
Ritor1
parents:
diff changeset
1419 LABEL_50:
Ritor1
parents:
diff changeset
1420 ++v27;
Ritor1
parents:
diff changeset
1421 v1 = v24 + 52;
Ritor1
parents:
diff changeset
1422 v24 += 52;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1423 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1424 goto LABEL_51;
Ritor1
parents:
diff changeset
1425 }
Ritor1
parents:
diff changeset
1426 while ( 1 )
Ritor1
parents:
diff changeset
1427 {
Ritor1
parents:
diff changeset
1428 v21 = v20->pNext;
Ritor1
parents:
diff changeset
1429 if ( !v21 )
Ritor1
parents:
diff changeset
1430 break;
Ritor1
parents:
diff changeset
1431 v22 = v20->field_4 + v20->field_0;
Ritor1
parents:
diff changeset
1432 v20->field_0 = v22;
Ritor1
parents:
diff changeset
1433 if ( v22 < stru_80C9D8.field_0 )
Ritor1
parents:
diff changeset
1434 v20->field_0 = stru_80C9D8.field_0 + 0.0000001;
Ritor1
parents:
diff changeset
1435 while ( 1 )
Ritor1
parents:
diff changeset
1436 {
Ritor1
parents:
diff changeset
1437 v23 = v20->pPrev;
Ritor1
parents:
diff changeset
1438 if ( v20->field_0 >= (double)v23->field_0 )
Ritor1
parents:
diff changeset
1439 break;
Ritor1
parents:
diff changeset
1440 v23->pNext = v20->pNext;
Ritor1
parents:
diff changeset
1441 v20->pNext->pPrev = v23;
Ritor1
parents:
diff changeset
1442 v23->pPrev->pNext = v20;
Ritor1
parents:
diff changeset
1443 v20->pPrev = v23->pPrev;
Ritor1
parents:
diff changeset
1444 v20->pNext = v23;
Ritor1
parents:
diff changeset
1445 v23->pPrev = v20;
Ritor1
parents:
diff changeset
1446 }
Ritor1
parents:
diff changeset
1447 v20 = v21;
Ritor1
parents:
diff changeset
1448 if ( v21 == &stru_80C9A4 )
Ritor1
parents:
diff changeset
1449 goto LABEL_50;
Ritor1
parents:
diff changeset
1450 }
Ritor1
parents:
diff changeset
1451 }
Ritor1
parents:
diff changeset
1452 }
Ritor1
parents:
diff changeset
1453 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
1454
Ritor1
parents:
diff changeset
1455
Ritor1
parents:
diff changeset
1456
Ritor1
parents:
diff changeset
1457 //----- (00487355) --------------------------------------------------------
Ritor1
parents:
diff changeset
1458 bool OutdoorCamera::_487355()
Ritor1
parents:
diff changeset
1459 {
Ritor1
parents:
diff changeset
1460 int v0; // esi@1
Ritor1
parents:
diff changeset
1461 stru148 *v1; // edi@2
Ritor1
parents:
diff changeset
1462 bool result; // eax@3
Ritor1
parents:
diff changeset
1463
Ritor1
parents:
diff changeset
1464 v0 = 0;
Ritor1
parents:
diff changeset
1465 if ( pOutdoorCamera->numStru148s > 0 )
Ritor1
parents:
diff changeset
1466 {
Ritor1
parents:
diff changeset
1467 v1 = array_77EC08;
Ritor1
parents:
diff changeset
1468 do
Ritor1
parents:
diff changeset
1469 {
Ritor1
parents:
diff changeset
1470 result = pGame->pLightmapBuilder->_45D3C7(v1);
Ritor1
parents:
diff changeset
1471 ++v0;
Ritor1
parents:
diff changeset
1472 ++v1;
Ritor1
parents:
diff changeset
1473 }
Ritor1
parents:
diff changeset
1474 while ( v0 < pOutdoorCamera->numStru148s );
Ritor1
parents:
diff changeset
1475 }
Ritor1
parents:
diff changeset
1476 return result;
Ritor1
parents:
diff changeset
1477 }
Ritor1
parents:
diff changeset
1478
Ritor1
parents:
diff changeset
1479
Ritor1
parents:
diff changeset
1480
Ritor1
parents:
diff changeset
1481 //----- (00487DA9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1482 void __cdecl sub_487DA9()
Ritor1
parents:
diff changeset
1483 {
Ritor1
parents:
diff changeset
1484 char *v0; // eax@1
Ritor1
parents:
diff changeset
1485
Ritor1
parents:
diff changeset
1486 v0 = &array_77EC08[0].field_108;
Ritor1
parents:
diff changeset
1487 do
Ritor1
parents:
diff changeset
1488 {
Ritor1
parents:
diff changeset
1489 *v0 = 0;
Ritor1
parents:
diff changeset
1490 v0 += 268;
Ritor1
parents:
diff changeset
1491 }
Ritor1
parents:
diff changeset
1492 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] );
Ritor1
parents:
diff changeset
1493 }
Ritor1
parents:
diff changeset
1494
Ritor1
parents:
diff changeset
1495 //----- (00487DBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1496 void Software_ResetNewEdges()
Ritor1
parents:
diff changeset
1497 {
Ritor1
parents:
diff changeset
1498 int v0; // ecx@1
Ritor1
parents:
diff changeset
1499 Edge **v1; // eax@1
Ritor1
parents:
diff changeset
1500 signed int v2; // eax@3
Ritor1
parents:
diff changeset
1501
Ritor1
parents:
diff changeset
1502 v0 = 0;
Ritor1
parents:
diff changeset
1503 v1 = ptr_80CA10;
Ritor1
parents:
diff changeset
1504 do
Ritor1
parents:
diff changeset
1505 {
Ritor1
parents:
diff changeset
1506 ++v0;
Ritor1
parents:
diff changeset
1507 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
Ritor1
parents:
diff changeset
1508 *v1 = 0;
Ritor1
parents:
diff changeset
1509 ++v1;
Ritor1
parents:
diff changeset
1510 }
Ritor1
parents:
diff changeset
1511 while ( (signed int)v1 < (signed int)&unk_80D190 );
Ritor1
parents:
diff changeset
1512 v2 = 2000;
Ritor1
parents:
diff changeset
1513 do
Ritor1
parents:
diff changeset
1514 {
Ritor1
parents:
diff changeset
1515 pSurfs->field_22 = 0;
Ritor1
parents:
diff changeset
1516 --v2;
Ritor1
parents:
diff changeset
1517 }
Ritor1
parents:
diff changeset
1518 while ( v2 );
Ritor1
parents:
diff changeset
1519 }
Ritor1
parents:
diff changeset
1520 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
1521
Ritor1
parents:
diff changeset
1522
Ritor1
parents:
diff changeset
1523
Ritor1
parents:
diff changeset
1524
Ritor1
parents:
diff changeset
1525
Ritor1
parents:
diff changeset
1526 //----- (0048958E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1527 stru12_MemoryBlock::stru12_MemoryBlock(int a2)
Ritor1
parents:
diff changeset
1528 {
Ritor1
parents:
diff changeset
1529 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
1530 void *v3; // eax@1
Ritor1
parents:
diff changeset
1531 void *v4; // ecx@1
Ritor1
parents:
diff changeset
1532 stru12_MemoryBlock *result; // eax@1
Ritor1
parents:
diff changeset
1533
Ritor1
parents:
diff changeset
1534 v2 = this;
Ritor1
parents:
diff changeset
1535 v3 = operator new(8 * a2 + 16);
Ritor1
parents:
diff changeset
1536 v2->pBlockBase = v3;
Ritor1
parents:
diff changeset
1537 v4 = (char *)v3 + (-(signed int)v3 & 7);
Ritor1
parents:
diff changeset
1538 result = v2;
Ritor1
parents:
diff changeset
1539 v2->pAlignedBlock = v4;
Ritor1
parents:
diff changeset
1540 }
Ritor1
parents:
diff changeset
1541
Ritor1
parents:
diff changeset
1542 //----- (004895B7) --------------------------------------------------------
Ritor1
parents:
diff changeset
1543 stru12::stru12(stru11 *pStru11)
Ritor1
parents:
diff changeset
1544 {
Ritor1
parents:
diff changeset
1545 stru12 *v2; // esi@1
Ritor1
parents:
diff changeset
1546
Ritor1
parents:
diff changeset
1547 v2 = this;
Ritor1
parents:
diff changeset
1548 this->field_44 = 0x41000000u;
Ritor1
parents:
diff changeset
1549 this->field_4C = 0x46000000u;
Ritor1
parents:
diff changeset
1550 //this->vdestructor_ptr = stru12::_4898E6;
Ritor1
parents:
diff changeset
1551 this->field_48 = 0;
Ritor1
parents:
diff changeset
1552 this->field_50 = 0;
Ritor1
parents:
diff changeset
1553 this->field_54 = 0x33D6BF95u;
Ritor1
parents:
diff changeset
1554 this->field_58 = 0;
Ritor1
parents:
diff changeset
1555
Ritor1
parents:
diff changeset
1556 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1557 v2->pMemBlocks[i] = new stru12_MemoryBlock(640);
Ritor1
parents:
diff changeset
1558 /*
Ritor1
parents:
diff changeset
1559 v3 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1560 if ( v3 )
Ritor1
parents:
diff changeset
1561 v4 = AllocAlignedMem(v3, 640);
Ritor1
parents:
diff changeset
1562 else
Ritor1
parents:
diff changeset
1563 v4 = 0;
Ritor1
parents:
diff changeset
1564 v2->pMemBlocks[0] = v4;
Ritor1
parents:
diff changeset
1565 /*v5 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1566 if ( v5 )
Ritor1
parents:
diff changeset
1567 v6 = AllocAlignedMem(v5, 640);
Ritor1
parents:
diff changeset
1568 else
Ritor1
parents:
diff changeset
1569 v6 = 0;
Ritor1
parents:
diff changeset
1570 v2->pMemBlocks[1] = v6;
Ritor1
parents:
diff changeset
1571 v7 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1572 if ( v7 )
Ritor1
parents:
diff changeset
1573 v8 = AllocAlignedMem(v7, 640);
Ritor1
parents:
diff changeset
1574 else
Ritor1
parents:
diff changeset
1575 v8 = 0;
Ritor1
parents:
diff changeset
1576 v2->pMemBlocks[2] = v8;
Ritor1
parents:
diff changeset
1577 v9 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1578 if ( v9 )
Ritor1
parents:
diff changeset
1579 v10 = AllocAlignedMem(v9, 640);
Ritor1
parents:
diff changeset
1580 else
Ritor1
parents:
diff changeset
1581 v10 = 0;
Ritor1
parents:
diff changeset
1582 v2->pMemBlocks[3] = v10;
Ritor1
parents:
diff changeset
1583 v11 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1584 if ( v11 )
Ritor1
parents:
diff changeset
1585 v12 = AllocAlignedMem(v11, 640);
Ritor1
parents:
diff changeset
1586 else
Ritor1
parents:
diff changeset
1587 v12 = 0;
Ritor1
parents:
diff changeset
1588 v2->pMemBlocks[4] = v12;
Ritor1
parents:
diff changeset
1589 v13 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1590 if ( v13 )
Ritor1
parents:
diff changeset
1591 v14 = AllocAlignedMem(v13, 640);
Ritor1
parents:
diff changeset
1592 else
Ritor1
parents:
diff changeset
1593 v14 = 0;
Ritor1
parents:
diff changeset
1594 v2->pMemBlocks[5] = v14;
Ritor1
parents:
diff changeset
1595 v15 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1596 if ( v15 )
Ritor1
parents:
diff changeset
1597 v16 = AllocAlignedMem(v15, 640);
Ritor1
parents:
diff changeset
1598 else
Ritor1
parents:
diff changeset
1599 v16 = 0;
Ritor1
parents:
diff changeset
1600 v2->pMemBlocks[6] = v16;
Ritor1
parents:
diff changeset
1601 v17 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1602 if ( v17 )
Ritor1
parents:
diff changeset
1603 v18 = AllocAlignedMem(v17, 640);
Ritor1
parents:
diff changeset
1604 else
Ritor1
parents:
diff changeset
1605 v18 = 0;
Ritor1
parents:
diff changeset
1606 v2->pMemBlocks[7] = v18;
Ritor1
parents:
diff changeset
1607 v19 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1608 if ( v19 )
Ritor1
parents:
diff changeset
1609 v20 = AllocAlignedMem(v19, 640);
Ritor1
parents:
diff changeset
1610 else
Ritor1
parents:
diff changeset
1611 v20 = 0;
Ritor1
parents:
diff changeset
1612 v2->pMemBlocks[8] = v20;
Ritor1
parents:
diff changeset
1613 v21 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1614 if ( v21 )
Ritor1
parents:
diff changeset
1615 v22 = AllocAlignedMem(v21, 640);
Ritor1
parents:
diff changeset
1616 else
Ritor1
parents:
diff changeset
1617 v22 = 0;
Ritor1
parents:
diff changeset
1618 v2->pMemBlocks[9] = v22;
Ritor1
parents:
diff changeset
1619 v23 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1620 if ( v23 )
Ritor1
parents:
diff changeset
1621 v24 = AllocAlignedMem(v23, 640);
Ritor1
parents:
diff changeset
1622 else
Ritor1
parents:
diff changeset
1623 v24 = 0;
Ritor1
parents:
diff changeset
1624 v2->pMemBlocks[10] = v24;
Ritor1
parents:
diff changeset
1625 v25 = (stru12_MemoryBlock *)operator new(8u);
Ritor1
parents:
diff changeset
1626 if ( v25 )
Ritor1
parents:
diff changeset
1627 v26 = AllocAlignedMem(v25, 640);
Ritor1
parents:
diff changeset
1628 else
Ritor1
parents:
diff changeset
1629 v26 = 0;
Ritor1
parents:
diff changeset
1630 v2->field_8C = 0;
Ritor1
parents:
diff changeset
1631 v2->pMemBlocks[11] = v26;*/
Ritor1
parents:
diff changeset
1632 }
Ritor1
parents:
diff changeset
1633
Ritor1
parents:
diff changeset
1634 //----- (00489810) --------------------------------------------------------
Ritor1
parents:
diff changeset
1635 stru12::~stru12()
Ritor1
parents:
diff changeset
1636 {
Ritor1
parents:
diff changeset
1637 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1638 delete pMemBlocks[i];
Ritor1
parents:
diff changeset
1639 /*if ( v2 )
Ritor1
parents:
diff changeset
1640 stru12_MemoryBlock::dtor(v2, 1);
Ritor1
parents:
diff changeset
1641 v3 = v1->pMemBlocks[1];
Ritor1
parents:
diff changeset
1642 if ( v3 )
Ritor1
parents:
diff changeset
1643 stru12_MemoryBlock::dtor(v3, 1);
Ritor1
parents:
diff changeset
1644 v4 = v1->pMemBlocks[2];
Ritor1
parents:
diff changeset
1645 if ( v4 )
Ritor1
parents:
diff changeset
1646 stru12_MemoryBlock::dtor(v4, 1);
Ritor1
parents:
diff changeset
1647 v5 = v1->pMemBlocks[3];
Ritor1
parents:
diff changeset
1648 if ( v5 )
Ritor1
parents:
diff changeset
1649 stru12_MemoryBlock::dtor(v5, 1);
Ritor1
parents:
diff changeset
1650 v6 = v1->pMemBlocks[4];
Ritor1
parents:
diff changeset
1651 if ( v6 )
Ritor1
parents:
diff changeset
1652 stru12_MemoryBlock::dtor(v6, 1);
Ritor1
parents:
diff changeset
1653 v7 = v1->pMemBlocks[5];
Ritor1
parents:
diff changeset
1654 if ( v7 )
Ritor1
parents:
diff changeset
1655 stru12_MemoryBlock::dtor(v7, 1);
Ritor1
parents:
diff changeset
1656 v8 = v1->pMemBlocks[6];
Ritor1
parents:
diff changeset
1657 if ( v8 )
Ritor1
parents:
diff changeset
1658 stru12_MemoryBlock::dtor(v8, 1);
Ritor1
parents:
diff changeset
1659 v9 = v1->pMemBlocks[7];
Ritor1
parents:
diff changeset
1660 if ( v9 )
Ritor1
parents:
diff changeset
1661 stru12_MemoryBlock::dtor(v9, 1);
Ritor1
parents:
diff changeset
1662 v10 = v1->pMemBlocks[8];
Ritor1
parents:
diff changeset
1663 if ( v10 )
Ritor1
parents:
diff changeset
1664 stru12_MemoryBlock::dtor(v10, 1);
Ritor1
parents:
diff changeset
1665 v11 = v1->pMemBlocks[9];
Ritor1
parents:
diff changeset
1666 if ( v11 )
Ritor1
parents:
diff changeset
1667 stru12_MemoryBlock::dtor(v11, 1);
Ritor1
parents:
diff changeset
1668 v12 = v1->pMemBlocks[10];
Ritor1
parents:
diff changeset
1669 if ( v12 )
Ritor1
parents:
diff changeset
1670 stru12_MemoryBlock::dtor(v12, 1);
Ritor1
parents:
diff changeset
1671 v13 = v1->pMemBlocks[11];
Ritor1
parents:
diff changeset
1672 if ( v13 )
Ritor1
parents:
diff changeset
1673 stru12_MemoryBlock::dtor(v13, 1);*/
Ritor1
parents:
diff changeset
1674 }
Ritor1
parents:
diff changeset
1675
Ritor1
parents:
diff changeset
1676 //----- (004898BF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1677 stru12_MemoryBlock::~stru12_MemoryBlock()
Ritor1
parents:
diff changeset
1678 {
Ritor1
parents:
diff changeset
1679 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
1680 void *v3; // ST00_4@1
Ritor1
parents:
diff changeset
1681
Ritor1
parents:
diff changeset
1682 v2 = this;
Ritor1
parents:
diff changeset
1683 v3 = this->pBlockBase;
Ritor1
parents:
diff changeset
1684 this->pAlignedBlock = 0;
Ritor1
parents:
diff changeset
1685 free(v3);
Ritor1
parents:
diff changeset
1686 v2->pBlockBase = 0;
Ritor1
parents:
diff changeset
1687 /*if ( a2 & 1 )
Ritor1
parents:
diff changeset
1688 free(v2);*/
Ritor1
parents:
diff changeset
1689 }
Ritor1
parents:
diff changeset
1690
Ritor1
parents:
diff changeset
1691 //----- (004898E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1692 void stru12::_4898E6()
Ritor1
parents:
diff changeset
1693 {
Ritor1
parents:
diff changeset
1694 void *v1; // eax@1
Ritor1
parents:
diff changeset
1695 void *v2; // edx@1
Ritor1
parents:
diff changeset
1696 char *v3; // edi@2
Ritor1
parents:
diff changeset
1697 double v4; // st7@2
Ritor1
parents:
diff changeset
1698 char *v5; // ebx@2
Ritor1
parents:
diff changeset
1699 double v6; // st6@3
Ritor1
parents:
diff changeset
1700 double v7; // st5@3
Ritor1
parents:
diff changeset
1701 double v8; // st4@3
Ritor1
parents:
diff changeset
1702 int v9; // esi@3
Ritor1
parents:
diff changeset
1703 double v10; // st3@3
Ritor1
parents:
diff changeset
1704 float v11; // ST34_4@5
Ritor1
parents:
diff changeset
1705 double v12; // st6@10
Ritor1
parents:
diff changeset
1706 double v13; // ST0C_8@10
Ritor1
parents:
diff changeset
1707 char *v14; // [sp+14h] [bp-44h]@2
Ritor1
parents:
diff changeset
1708 char *v15; // [sp+18h] [bp-40h]@2
Ritor1
parents:
diff changeset
1709 char *v16; // [sp+1Ch] [bp-3Ch]@2
Ritor1
parents:
diff changeset
1710 char *v17; // [sp+20h] [bp-38h]@2
Ritor1
parents:
diff changeset
1711 char *v18; // [sp+24h] [bp-34h]@2
Ritor1
parents:
diff changeset
1712 float v19; // [sp+30h] [bp-28h]@3
Ritor1
parents:
diff changeset
1713 float v20; // [sp+38h] [bp-20h]@3
Ritor1
parents:
diff changeset
1714 char *v21; // [sp+3Ch] [bp-1Ch]@2
Ritor1
parents:
diff changeset
1715 int v22; // [sp+40h] [bp-18h]@1
Ritor1
parents:
diff changeset
1716 char *v23; // [sp+44h] [bp-14h]@2
Ritor1
parents:
diff changeset
1717 char *v24; // [sp+48h] [bp-10h]@2
Ritor1
parents:
diff changeset
1718 int v25; // [sp+4Ch] [bp-Ch]@2
Ritor1
parents:
diff changeset
1719 float v26; // [sp+50h] [bp-8h]@3
Ritor1
parents:
diff changeset
1720 float v27; // [sp+54h] [bp-4h]@3
Ritor1
parents:
diff changeset
1721
731
de482c901171 Moved unused CPU detection stuff to a separate file.
Nomad
parents: 730
diff changeset
1722 __debugbreak();
0
Ritor1
parents:
diff changeset
1723 v22 = 0;
Ritor1
parents:
diff changeset
1724 v1 = this->pMemBlocks[1]->pAlignedBlock;
Ritor1
parents:
diff changeset
1725 v2 = this->pMemBlocks[6]->pAlignedBlock;
Ritor1
parents:
diff changeset
1726 if ( this->field_8C > 0 )
Ritor1
parents:
diff changeset
1727 {
Ritor1
parents:
diff changeset
1728 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
1729 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
1730 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1731 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1732 v25 = (int)v1 - (int)v2;
Ritor1
parents:
diff changeset
1733 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1734 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1735 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1736 v4 = 1.0;
Ritor1
parents:
diff changeset
1737 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1738 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1739 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1740 do
Ritor1
parents:
diff changeset
1741 {
Ritor1
parents:
diff changeset
1742 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
1743 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
1744 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z;
Ritor1
parents:
diff changeset
1745 v7 = pIndoorCamera->fRotationYCosine;
Ritor1
parents:
diff changeset
1746 v8 = pIndoorCamera->fRotationYSine;
Ritor1
parents:
diff changeset
1747 v20 = pIndoorCamera->fRotationXCosine;
Ritor1
parents:
diff changeset
1748 v19 = pIndoorCamera->fRotationXSine;
Ritor1
parents:
diff changeset
1749 v9 = (int)((char *)v2 + (int)v21);
Ritor1
parents:
diff changeset
1750 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26;
Ritor1
parents:
diff changeset
1751 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
1752 {
Ritor1
parents:
diff changeset
1753 v11 = v10;
Ritor1
parents:
diff changeset
1754 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6;
Ritor1
parents:
diff changeset
1755 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
1756 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19;
Ritor1
parents:
diff changeset
1757 }
Ritor1
parents:
diff changeset
1758 else
Ritor1
parents:
diff changeset
1759 {
Ritor1
parents:
diff changeset
1760 *(float *)v9 = v10;
Ritor1
parents:
diff changeset
1761 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
1762 *(float *)((char *)v2 + (int)v5) = v6;
Ritor1
parents:
diff changeset
1763 }
Ritor1
parents:
diff changeset
1764 if ( *(float *)v9 >= 8.0 )
Ritor1
parents:
diff changeset
1765 {
Ritor1
parents:
diff changeset
1766 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 )
Ritor1
parents:
diff changeset
1767 {
Ritor1
parents:
diff changeset
1768 *(int *)v2 = 0;
Ritor1
parents:
diff changeset
1769 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad;
Ritor1
parents:
diff changeset
1770 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX
Ritor1
parents:
diff changeset
1771 - v12 * *(float *)((char *)v2 + (int)v3);
Ritor1
parents:
diff changeset
1772 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY
Ritor1
parents:
diff changeset
1773 - v12 * *(float *)((char *)v2 + (int)v5);
Ritor1
parents:
diff changeset
1774 *(float *)((char *)v2 + (int)v16) = v4
Ritor1
parents:
diff changeset
1775 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
Ritor1
parents:
diff changeset
1776 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001);
Ritor1
parents:
diff changeset
1777 v13 = *(float *)v9 + 6.7553994e15;
Ritor1
parents:
diff changeset
1778 v4 = 1.0;
Ritor1
parents:
diff changeset
1779 *(int *)((char *)v2 + (int)v14) = LODWORD(v13);
Ritor1
parents:
diff changeset
1780 }
Ritor1
parents:
diff changeset
1781 else
Ritor1
parents:
diff changeset
1782 {
Ritor1
parents:
diff changeset
1783 *(int *)v2 = 2;
Ritor1
parents:
diff changeset
1784 }
Ritor1
parents:
diff changeset
1785 }
Ritor1
parents:
diff changeset
1786 else
Ritor1
parents:
diff changeset
1787 {
Ritor1
parents:
diff changeset
1788 *(int *)v2 = 1;
Ritor1
parents:
diff changeset
1789 }
Ritor1
parents:
diff changeset
1790 ++v22;
Ritor1
parents:
diff changeset
1791 v2 = (char *)v2 + 4;
Ritor1
parents:
diff changeset
1792 }
Ritor1
parents:
diff changeset
1793 while ( v22 < this->field_8C );
Ritor1
parents:
diff changeset
1794 }
Ritor1
parents:
diff changeset
1795 this->field_8C = 0;
Ritor1
parents:
diff changeset
1796 }
Ritor1
parents:
diff changeset
1797
Ritor1
parents:
diff changeset
1798
Ritor1
parents:
diff changeset
1799
Ritor1
parents:
diff changeset
1800
Ritor1
parents:
diff changeset
1801
Ritor1
parents:
diff changeset
1802 //----- (0048A959) --------------------------------------------------------
Ritor1
parents:
diff changeset
1803 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
Ritor1
parents:
diff changeset
1804 {
Ritor1
parents:
diff changeset
1805 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
Ritor1
parents:
diff changeset
1806 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
Ritor1
parents:
diff changeset
1807 b = (uColor & 0x000000FF) / 255.0f;
Ritor1
parents:
diff changeset
1808
Ritor1
parents:
diff changeset
1809 float h, s, v;
Ritor1
parents:
diff changeset
1810 RGB2HSV(&h, &s, r, g, b, &v);
Ritor1
parents:
diff changeset
1811
Ritor1
parents:
diff changeset
1812 if ( h_replace != -1.0 )
Ritor1
parents:
diff changeset
1813 h = h_replace;
Ritor1
parents:
diff changeset
1814 if ( s_replace != -1.0 )
Ritor1
parents:
diff changeset
1815 s = s_replace;
Ritor1
parents:
diff changeset
1816 if ( v_replace != -1.0 )
Ritor1
parents:
diff changeset
1817 v = v_replace;
Ritor1
parents:
diff changeset
1818 HSV2RGB(&r, &g, &b, h, s, v);
Ritor1
parents:
diff changeset
1819
Ritor1
parents:
diff changeset
1820 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) |
Ritor1
parents:
diff changeset
1821 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) |
Ritor1
parents:
diff changeset
1822 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF);
Ritor1
parents:
diff changeset
1823 }
Ritor1
parents:
diff changeset
1824
Ritor1
parents:
diff changeset
1825
Ritor1
parents:
diff changeset
1826 //----- (0048B561) --------------------------------------------------------
Ritor1
parents:
diff changeset
1827 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2)
Ritor1
parents:
diff changeset
1828 {
Ritor1
parents:
diff changeset
1829 //v2 = a2 - 0.5;
Ritor1
parents:
diff changeset
1830 //v3 = v2 + 6.7553994e15;
Ritor1
parents:
diff changeset
1831 int v4 = floorf(a2 - 0.5f + 0.5f);
Ritor1
parents:
diff changeset
1832 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0;
Ritor1
parents:
diff changeset
1833 //v5 = v7 + 6.7553994e15;
Ritor1
parents:
diff changeset
1834 //return LODWORD(v5) | (v4 << 16);
Ritor1
parents:
diff changeset
1835 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f);
Ritor1
parents:
diff changeset
1836 return v5 | (v4 << 16);
Ritor1
parents:
diff changeset
1837 }
Ritor1
parents:
diff changeset
1838
Ritor1
parents:
diff changeset
1839
Ritor1
parents:
diff changeset
1840
Ritor1
parents:
diff changeset
1841
Ritor1
parents:
diff changeset
1842
Ritor1
parents:
diff changeset
1843
Ritor1
parents:
diff changeset
1844 //----- (00491E3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1845 void __cdecl sub_491E3A()
Ritor1
parents:
diff changeset
1846 {
Ritor1
parents:
diff changeset
1847 Player *v0; // ebx@1
Ritor1
parents:
diff changeset
1848 signed int v1; // esi@3
Ritor1
parents:
diff changeset
1849 char *v2; // eax@4
Ritor1
parents:
diff changeset
1850 unsigned int v3; // eax@7
Ritor1
parents:
diff changeset
1851 unsigned int v4; // edx@8
Ritor1
parents:
diff changeset
1852 char *v5; // ecx@9
Ritor1
parents:
diff changeset
1853 int v6; // edi@17
Ritor1
parents:
diff changeset
1854 Texture *v7; // ebx@18
Ritor1
parents:
diff changeset
1855 struct IDirect3DTexture2 **v8; // eax@19
Ritor1
parents:
diff changeset
1856 struct IDirect3DTexture2 *v9; // eax@20
Ritor1
parents:
diff changeset
1857 struct IDirectDrawSurface **v10; // eax@22
Ritor1
parents:
diff changeset
1858 struct IDirectDrawSurface *v11; // eax@23
Ritor1
parents:
diff changeset
1859 int v12; // eax@26
Ritor1
parents:
diff changeset
1860
Ritor1
parents:
diff changeset
1861 v0 = pParty->pPlayers;
Ritor1
parents:
diff changeset
1862 do
Ritor1
parents:
diff changeset
1863 {
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1864 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
1865 {
Ritor1
parents:
diff changeset
1866 v1 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1867 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1868 {
Ritor1
parents:
diff changeset
1869 LABEL_7:
Ritor1
parents:
diff changeset
1870 v3 = 0;
Ritor1
parents:
diff changeset
1871 }
Ritor1
parents:
diff changeset
1872 else
Ritor1
parents:
diff changeset
1873 {
Ritor1
parents:
diff changeset
1874 v2 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1875 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 )
0
Ritor1
parents:
diff changeset
1876 {
Ritor1
parents:
diff changeset
1877 ++v1;
Ritor1
parents:
diff changeset
1878 v2 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1879 if ( v1 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1880 goto LABEL_7;
Ritor1
parents:
diff changeset
1881 }
Ritor1
parents:
diff changeset
1882 v3 = v1;
Ritor1
parents:
diff changeset
1883 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1884 pSoundList->UnloadSound(v3, 1);
0
Ritor1
parents:
diff changeset
1885 v4 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1886 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1887 {
Ritor1
parents:
diff changeset
1888 LABEL_12:
Ritor1
parents:
diff changeset
1889 v4 = 0;
Ritor1
parents:
diff changeset
1890 }
Ritor1
parents:
diff changeset
1891 else
Ritor1
parents:
diff changeset
1892 {
Ritor1
parents:
diff changeset
1893 v5 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1894 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 )
0
Ritor1
parents:
diff changeset
1895 {
Ritor1
parents:
diff changeset
1896 ++v4;
Ritor1
parents:
diff changeset
1897 v5 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1898 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1899 goto LABEL_12;
Ritor1
parents:
diff changeset
1900 }
Ritor1
parents:
diff changeset
1901 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1902 pSoundList->UnloadSound(v4, 1);
0
Ritor1
parents:
diff changeset
1903 }
Ritor1
parents:
diff changeset
1904 ++v0;
Ritor1
parents:
diff changeset
1905 }
Ritor1
parents:
diff changeset
1906 while ( (signed int)v0 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
1907 v6 = pIcons_LOD->uNumLoadedFiles - 1;
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1908 if ( v6 >= pIcons_LOD->pFacesLock )
0
Ritor1
parents:
diff changeset
1909 {
Ritor1
parents:
diff changeset
1910 v7 = &pIcons_LOD->pTextures[v6];
Ritor1
parents:
diff changeset
1911 do
Ritor1
parents:
diff changeset
1912 {
Ritor1
parents:
diff changeset
1913 v7->Release();
Ritor1
parents:
diff changeset
1914 v8 = pIcons_LOD->pHardwareTextures;
Ritor1
parents:
diff changeset
1915 if ( v8 )
Ritor1
parents:
diff changeset
1916 {
Ritor1
parents:
diff changeset
1917 v9 = v8[v6];
Ritor1
parents:
diff changeset
1918 if ( v9 )
Ritor1
parents:
diff changeset
1919 {
Ritor1
parents:
diff changeset
1920 v9->Release();
Ritor1
parents:
diff changeset
1921 pIcons_LOD->pHardwareTextures[v6] = 0;
Ritor1
parents:
diff changeset
1922 }
Ritor1
parents:
diff changeset
1923 }
Ritor1
parents:
diff changeset
1924 v10 = pIcons_LOD->pHardwareSurfaces;
Ritor1
parents:
diff changeset
1925 if ( v10 )
Ritor1
parents:
diff changeset
1926 {
Ritor1
parents:
diff changeset
1927 v11 = v10[v6];
Ritor1
parents:
diff changeset
1928 if ( v11 )
Ritor1
parents:
diff changeset
1929 {
Ritor1
parents:
diff changeset
1930 v11->Release();
Ritor1
parents:
diff changeset
1931 pIcons_LOD->pHardwareSurfaces[v6] = 0;
Ritor1
parents:
diff changeset
1932 }
Ritor1
parents:
diff changeset
1933 }
Ritor1
parents:
diff changeset
1934 --v6;
Ritor1
parents:
diff changeset
1935 --v7;
Ritor1
parents:
diff changeset
1936 }
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1937 while ( v6 >= pIcons_LOD->pFacesLock );
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1938 }
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1939 v12 = pIcons_LOD->pFacesLock;
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1940 pIcons_LOD->pFacesLock = 0;
0
Ritor1
parents:
diff changeset
1941 pIcons_LOD->uNumLoadedFiles = v12;
Ritor1
parents:
diff changeset
1942 }
Ritor1
parents:
diff changeset
1943 // 4ED498: using guessed type char byte_4ED498;
Ritor1
parents:
diff changeset
1944
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 704
diff changeset
1945
0
Ritor1
parents:
diff changeset
1946
Ritor1
parents:
diff changeset
1947
Ritor1
parents:
diff changeset
1948 //----- (0049387A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1949 int CycleCharacter(unsigned int _this)
Ritor1
parents:
diff changeset
1950 {
Ritor1
parents:
diff changeset
1951 signed int result; // eax@1
Ritor1
parents:
diff changeset
1952 signed int v2; // ecx@2
Ritor1
parents:
diff changeset
1953 signed int v3; // ecx@8
Ritor1
parents:
diff changeset
1954
Ritor1
parents:
diff changeset
1955 result = uActiveCharacter;
Ritor1
parents:
diff changeset
1956 if ( _this )
Ritor1
parents:
diff changeset
1957 {
Ritor1
parents:
diff changeset
1958 v2 = 0;
Ritor1
parents:
diff changeset
1959 while ( 1 )
Ritor1
parents:
diff changeset
1960 {
Ritor1
parents:
diff changeset
1961 --result;
Ritor1
parents:
diff changeset
1962 if ( result < 1 )
Ritor1
parents:
diff changeset
1963 result = 4;
Ritor1
parents:
diff changeset
1964 if ( !pPlayers[result]->uTimeToRecovery )
Ritor1
parents:
diff changeset
1965 break;
Ritor1
parents:
diff changeset
1966 ++v2;
Ritor1
parents:
diff changeset
1967 if ( v2 >= 4 )
Ritor1
parents:
diff changeset
1968 return uActiveCharacter;
Ritor1
parents:
diff changeset
1969 }
Ritor1
parents:
diff changeset
1970 }
Ritor1
parents:
diff changeset
1971 else
Ritor1
parents:
diff changeset
1972 {
Ritor1
parents:
diff changeset
1973 v3 = 0;
Ritor1
parents:
diff changeset
1974 while ( 1 )
Ritor1
parents:
diff changeset
1975 {
Ritor1
parents:
diff changeset
1976 ++result;
Ritor1
parents:
diff changeset
1977 if ( result > 4 )
Ritor1
parents:
diff changeset
1978 result = 1;
Ritor1
parents:
diff changeset
1979 if ( !pPlayers[result]->uTimeToRecovery )
Ritor1
parents:
diff changeset
1980 break;
Ritor1
parents:
diff changeset
1981 ++v3;
Ritor1
parents:
diff changeset
1982 if ( v3 >= 4 )
Ritor1
parents:
diff changeset
1983 return uActiveCharacter;
Ritor1
parents:
diff changeset
1984 }
Ritor1
parents:
diff changeset
1985 }
Ritor1
parents:
diff changeset
1986 return result;
Ritor1
parents:
diff changeset
1987 }
Ritor1
parents:
diff changeset
1988
Ritor1
parents:
diff changeset
1989 //----- (004938D1) --------------------------------------------------------
Ritor1
parents:
diff changeset
1990 void __fastcall Rest(unsigned int uHoursToSleep)
Ritor1
parents:
diff changeset
1991 {
Ritor1
parents:
diff changeset
1992 unsigned int v1; // esi@1
Ritor1
parents:
diff changeset
1993 double v2; // st7@3
Ritor1
parents:
diff changeset
1994 Player **v3; // esi@3
Ritor1
parents:
diff changeset
1995
Ritor1
parents:
diff changeset
1996 v1 = uHoursToSleep;
Ritor1
parents:
diff changeset
1997 if ( uHoursToSleep > 240 )
Ritor1
parents:
diff changeset
1998 InitializeActors();
Ritor1
parents:
diff changeset
1999 v2 = (double)(7680 * v1) * 0.033333335;
Ritor1
parents:
diff changeset
2000 pParty->uTimePlayed += (signed __int64)v2;
Ritor1
parents:
diff changeset
2001 v3 = &pPlayers[1];
Ritor1
parents:
diff changeset
2002 do
Ritor1
parents:
diff changeset
2003 {
Ritor1
parents:
diff changeset
2004 (*v3)->Recover((signed __int64)v2);
Ritor1
parents:
diff changeset
2005 ++v3;
Ritor1
parents:
diff changeset
2006 }
Ritor1
parents:
diff changeset
2007 while ( (signed int)v3 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
2008 _494035_timed_effects__water_walking_damage__etc();
Ritor1
parents:
diff changeset
2009 }
Ritor1
parents:
diff changeset
2010
Ritor1
parents:
diff changeset
2011 //----- (00493938) --------------------------------------------------------
Ritor1
parents:
diff changeset
2012 int __cdecl _493938_regenerate()
Ritor1
parents:
diff changeset
2013 {
Ritor1
parents:
diff changeset
2014 int v0; // edi@1
Ritor1
parents:
diff changeset
2015 signed __int64 v1; // qax@1
Ritor1
parents:
diff changeset
2016 int v2; // ecx@1
Ritor1
parents:
diff changeset
2017 int result; // eax@1
Ritor1
parents:
diff changeset
2018 int v4; // eax@2
Ritor1
parents:
diff changeset
2019 int v5; // edi@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2020 int *v6; // ecx@5
0
Ritor1
parents:
diff changeset
2021 char v7; // sf@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2022 int *v8; // ecx@10
0
Ritor1
parents:
diff changeset
2023 int v9; // edi@15
Ritor1
parents:
diff changeset
2024 signed int v10; // eax@15
Ritor1
parents:
diff changeset
2025 __int16 *v11; // edx@16
Ritor1
parents:
diff changeset
2026 int v12; // eax@20
Ritor1
parents:
diff changeset
2027 int v13; // ebx@20
Ritor1
parents:
diff changeset
2028 unsigned int *v14; // esi@21
Ritor1
parents:
diff changeset
2029 unsigned int v15; // ecx@21
Ritor1
parents:
diff changeset
2030 unsigned int v16; // eax@21
Ritor1
parents:
diff changeset
2031 int v17; // edx@21
Ritor1
parents:
diff changeset
2032 int v18; // eax@21
Ritor1
parents:
diff changeset
2033 signed int v19; // eax@21
Ritor1
parents:
diff changeset
2034 signed int v20; // ebx@25
Ritor1
parents:
diff changeset
2035 Player *v21; // esi@25
Ritor1
parents:
diff changeset
2036 ITEM_EQUIP_TYPE v22; // edi@30
Ritor1
parents:
diff changeset
2037 //int v23; // edx@31
Ritor1
parents:
diff changeset
2038 signed int v24; // ecx@32
Ritor1
parents:
diff changeset
2039 signed int v25; // eax@33
Ritor1
parents:
diff changeset
2040 int v26; // eax@35
Ritor1
parents:
diff changeset
2041 int v27; // eax@36
Ritor1
parents:
diff changeset
2042 int v28; // eax@37
Ritor1
parents:
diff changeset
2043 int v29; // eax@40
Ritor1
parents:
diff changeset
2044 int v30; // eax@41
Ritor1
parents:
diff changeset
2045 signed int v31; // ecx@53
Ritor1
parents:
diff changeset
2046 char *v32; // eax@53
Ritor1
parents:
diff changeset
2047 char *v33; // edi@82
Ritor1
parents:
diff changeset
2048 int v34; // ecx@88
Ritor1
parents:
diff changeset
2049 int v35; // eax@88
Ritor1
parents:
diff changeset
2050 char *v36; // edi@99
Ritor1
parents:
diff changeset
2051 int v37; // edi@104
Ritor1
parents:
diff changeset
2052 int v38; // edi@106
Ritor1
parents:
diff changeset
2053 int v39; // edi@111
Ritor1
parents:
diff changeset
2054 int v40; // ecx@113
Ritor1
parents:
diff changeset
2055 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
2056 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
0
Ritor1
parents:
diff changeset
2057 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
Ritor1
parents:
diff changeset
2058 int v44; // [sp+210h] [bp-20h]@22
Ritor1
parents:
diff changeset
2059 int v45; // [sp+214h] [bp-1Ch]@25
Ritor1
parents:
diff changeset
2060 int v46; // [sp+218h] [bp-18h]@25
Ritor1
parents:
diff changeset
2061 int v47; // [sp+21Ch] [bp-14h]@25
Ritor1
parents:
diff changeset
2062 int v48; // [sp+220h] [bp-10h]@25
Ritor1
parents:
diff changeset
2063 int v49; // [sp+224h] [bp-Ch]@24
Ritor1
parents:
diff changeset
2064 int v50; // [sp+228h] [bp-8h]@25
Ritor1
parents:
diff changeset
2065 int v51; // [sp+22Ch] [bp-4h]@2
Ritor1
parents:
diff changeset
2066
Ritor1
parents:
diff changeset
2067 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
Ritor1
parents:
diff changeset
2068 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375);
Ritor1
parents:
diff changeset
2069 v2 = (signed int)v1 / 60;
Ritor1
parents:
diff changeset
2070 result = (signed int)v1 / 60 + 5;
Ritor1
parents:
diff changeset
2071 if ( v0 >= result )
Ritor1
parents:
diff changeset
2072 {
Ritor1
parents:
diff changeset
2073 v51 = 0;
Ritor1
parents:
diff changeset
2074 v4 = (v0 - v2) / 5;
Ritor1
parents:
diff changeset
2075 if (pParty->FlyActive())
Ritor1
parents:
diff changeset
2076 {
Ritor1
parents:
diff changeset
2077 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
2078 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2079 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2080 { // colliding with something in the air - fall down
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2081 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2082 //__debugbreak();
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2083 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000];
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2084 v7 = *v6 < v5;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2085 *v6 -= v5;
0
Ritor1
parents:
diff changeset
2086 if ( v7 )
Ritor1
parents:
diff changeset
2087 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2088 *v6 = 0;
0
Ritor1
parents:
diff changeset
2089 pParty->uFlags &= 0xFFFFFFBFu;
Ritor1
parents:
diff changeset
2090 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
2091 v51 = 1;
Ritor1
parents:
diff changeset
2092 }
Ritor1
parents:
diff changeset
2093 }
Ritor1
parents:
diff changeset
2094 }
Ritor1
parents:
diff changeset
2095 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2096
0
Ritor1
parents:
diff changeset
2097 if (pParty->WaterWalkActive())
Ritor1
parents:
diff changeset
2098 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2099 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2100 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2101 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2102 { // taking on water
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2103 //__debugbreak();
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2104 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000];
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2105 v7 = *v8 < v4;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2106 *v8 -= v4;
0
Ritor1
parents:
diff changeset
2107 if ( v7 )
Ritor1
parents:
diff changeset
2108 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
2109 *v8 = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2110 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
2111 v51 = 1;
Ritor1
parents:
diff changeset
2112 }
Ritor1
parents:
diff changeset
2113 }
Ritor1
parents:
diff changeset
2114 }
Ritor1
parents:
diff changeset
2115 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
2116
0
Ritor1
parents:
diff changeset
2117 if (pParty->ImmolationActive())
Ritor1
parents:
diff changeset
2118 {
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
2119 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
2120 v9 = 0;
Ritor1
parents:
diff changeset
2121 a3.z = 0;
Ritor1
parents:
diff changeset
2122 a3.y = 0;
Ritor1
parents:
diff changeset
2123 a3.x = 0;
Ritor1
parents:
diff changeset
2124 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
2125 a1.field_4C = pParty->pPartyBuffs[10].uPower;
Ritor1
parents:
diff changeset
2126 a1.field_50 = pParty->ImmolationSkillLevel();
Ritor1
parents:
diff changeset
2127 v10 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
2128 a1.uType = 1070;
0
Ritor1
parents:
diff changeset
2129 a1.field_48 = 8;
Ritor1
parents:
diff changeset
2130 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
2131 {
Ritor1
parents:
diff changeset
2132 LABEL_19:
Ritor1
parents:
diff changeset
2133 LOWORD(v10) = 0;
Ritor1
parents:
diff changeset
2134 }
Ritor1
parents:
diff changeset
2135 else
Ritor1
parents:
diff changeset
2136 {
Ritor1
parents:
diff changeset
2137 v11 = &pObjectList->pObjects->uObjectID;
488
Nomad
parents: 484
diff changeset
2138 while ( stru_4E3ACC[8].field_0 != *v11 )
0
Ritor1
parents:
diff changeset
2139 {
Ritor1
parents:
diff changeset
2140 ++v10;
Ritor1
parents:
diff changeset
2141 v11 += 28;
Ritor1
parents:
diff changeset
2142 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
2143 goto LABEL_19;
Ritor1
parents:
diff changeset
2144 }
Ritor1
parents:
diff changeset
2145 }
Ritor1
parents:
diff changeset
2146 a1.uObjectDescID = v10;
Ritor1
parents:
diff changeset
2147 a1.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
2148 v12 = 8 * pParty->pPartyBuffs[10].uCaster;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
2149 LOBYTE(v12) = v12 | OBJECT_Player;
0
Ritor1
parents:
diff changeset
2150 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
2151 a1.uSectorID = 0;
Ritor1
parents:
diff changeset
2152 a1.uSpriteFrameID = 0;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
2153 a1.field_58_pid = v12;
0
Ritor1
parents:
diff changeset
2154 a1.uFacing = 0;
Ritor1
parents:
diff changeset
2155 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
2156 v13 = sub_46A89E((int)v41, 100, 307);
Ritor1
parents:
diff changeset
2157 if ( v13 > 0 )
Ritor1
parents:
diff changeset
2158 {
Ritor1
parents:
diff changeset
2159 do
Ritor1
parents:
diff changeset
2160 {
Ritor1
parents:
diff changeset
2161 v14 = (unsigned int *)&v41[4 * v9];
Ritor1
parents:
diff changeset
2162 v15 = *v14;
Ritor1
parents:
diff changeset
2163 v16 = *v14;
Ritor1
parents:
diff changeset
2164 a1.vPosition.x = pActors[v16].vPosition.x;
Ritor1
parents:
diff changeset
2165 v17 = pActors[v16].vPosition.y;
Ritor1
parents:
diff changeset
2166 a1.vPosition.z = pActors[v16].vPosition.z;
Ritor1
parents:
diff changeset
2167 v18 = 8 * v15;
Ritor1
parents:
diff changeset
2168 LOBYTE(v18) = 8 * v15 | 3;
Ritor1
parents:
diff changeset
2169 a1.vPosition.y = v17;
Ritor1
parents:
diff changeset
2170 a1.field_5C = v18;
Ritor1
parents:
diff changeset
2171 v19 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
2172 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3);
Ritor1
parents:
diff changeset
2173 ++v9;
Ritor1
parents:
diff changeset
2174 }
Ritor1
parents:
diff changeset
2175 while ( v9 < v13 );
Ritor1
parents:
diff changeset
2176 }
Ritor1
parents:
diff changeset
2177 }
Ritor1
parents:
diff changeset
2178 v44 = 0;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
2179 if (PartyHasDragon())
0
Ritor1
parents:
diff changeset
2180 v44 = 1;
Ritor1
parents:
diff changeset
2181 v49 = 0;
Ritor1
parents:
diff changeset
2182 LABEL_25:
Ritor1
parents:
diff changeset
2183 v20 = 0;
Ritor1
parents:
diff changeset
2184 v21 = &pParty->pPlayers[v49];
Ritor1
parents:
diff changeset
2185 v50 = 0;
Ritor1
parents:
diff changeset
2186 v47 = 0;
Ritor1
parents:
diff changeset
2187 v45 = 0;
Ritor1
parents:
diff changeset
2188 v48 = 0;
Ritor1
parents:
diff changeset
2189 v46 = 0;
255
0a37a56e9f02 sprintfex & classes enum
Nomad
parents: 254
diff changeset
2190 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK )
0
Ritor1
parents:
diff changeset
2191 v50 = 1;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
2192 if ( v21->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
2193 v48 = 1;
Ritor1
parents:
diff changeset
2194 v22 = (ITEM_EQUIP_TYPE)0;
Ritor1
parents:
diff changeset
2195 while ( 1 )
Ritor1
parents:
diff changeset
2196 {
Ritor1
parents:
diff changeset
2197 if ( v21->HasItemEquipped(v22) )
Ritor1
parents:
diff changeset
2198 {
Ritor1
parents:
diff changeset
2199 //v23 = v21->pEquipment.pIndices;
Ritor1
parents:
diff changeset
2200 auto _idx = v21->pEquipment.pIndices[v22];
Ritor1
parents:
diff changeset
2201 v24 = v21->pInventoryItems[_idx].uItemID;
Ritor1
parents:
diff changeset
2202 if ( v24 > 134 )
Ritor1
parents:
diff changeset
2203 {
Ritor1
parents:
diff changeset
2204 if ( v24 == 529 )
Ritor1
parents:
diff changeset
2205 goto LABEL_43;
Ritor1
parents:
diff changeset
2206 if ( v24 == 535 )
Ritor1
parents:
diff changeset
2207 goto LABEL_44;
Ritor1
parents:
diff changeset
2208 if ( v24 == 515 )
Ritor1
parents:
diff changeset
2209 {
Ritor1
parents:
diff changeset
2210 v47 = 1;
Ritor1
parents:
diff changeset
2211 }
Ritor1
parents:
diff changeset
2212 else
Ritor1
parents:
diff changeset
2213 {
Ritor1
parents:
diff changeset
2214 if ( v24 == 532 )
Ritor1
parents:
diff changeset
2215 goto LABEL_50;
Ritor1
parents:
diff changeset
2216 }
Ritor1
parents:
diff changeset
2217 }
Ritor1
parents:
diff changeset
2218 else
Ritor1
parents:
diff changeset
2219 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
2220 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
2221 if ( v25 <= 50 )
Ritor1
parents:
diff changeset
2222 {
Ritor1
parents:
diff changeset
2223 if ( v25 != 50 )
Ritor1
parents:
diff changeset
2224 {
Ritor1
parents:
diff changeset
2225 v26 = v25 - 37;
Ritor1
parents:
diff changeset
2226 if ( v26 )
Ritor1
parents:
diff changeset
2227 {
Ritor1
parents:
diff changeset
2228 v27 = v26 - 1;
Ritor1
parents:
diff changeset
2229 if ( !v27 )
Ritor1
parents:
diff changeset
2230 goto LABEL_50;
Ritor1
parents:
diff changeset
2231 v28 = v27 - 6;
Ritor1
parents:
diff changeset
2232 if ( v28 )
Ritor1
parents:
diff changeset
2233 {
Ritor1
parents:
diff changeset
2234 if ( v28 != 3 )
Ritor1
parents:
diff changeset
2235 goto LABEL_51;
Ritor1
parents:
diff changeset
2236 LABEL_50:
Ritor1
parents:
diff changeset
2237 v50 = 1;
Ritor1
parents:
diff changeset
2238 goto LABEL_51;
Ritor1
parents:
diff changeset
2239 }
Ritor1
parents:
diff changeset
2240 }
Ritor1
parents:
diff changeset
2241 }
Ritor1
parents:
diff changeset
2242 LABEL_44:
Ritor1
parents:
diff changeset
2243 v20 = 1;
Ritor1
parents:
diff changeset
2244 goto LABEL_51;
Ritor1
parents:
diff changeset
2245 }
Ritor1
parents:
diff changeset
2246 v29 = v25 - 54;
Ritor1
parents:
diff changeset
2247 if ( !v29 )
Ritor1
parents:
diff changeset
2248 goto LABEL_44;
Ritor1
parents:
diff changeset
2249 v30 = v29 - 1;
Ritor1
parents:
diff changeset
2250 if ( !v30 )
Ritor1
parents:
diff changeset
2251 goto LABEL_50;
Ritor1
parents:
diff changeset
2252 if ( v30 == 11 )
Ritor1
parents:
diff changeset
2253 {
Ritor1
parents:
diff changeset
2254 LABEL_43:
Ritor1
parents:
diff changeset
2255 v20 = 1;
Ritor1
parents:
diff changeset
2256 v50 = 1;
Ritor1
parents:
diff changeset
2257 goto LABEL_51;
Ritor1
parents:
diff changeset
2258 }
Ritor1
parents:
diff changeset
2259 }
Ritor1
parents:
diff changeset
2260 }
Ritor1
parents:
diff changeset
2261 LABEL_51:
Ritor1
parents:
diff changeset
2262 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1);
Ritor1
parents:
diff changeset
2263 if ( (signed int)v22 >= 16 )
Ritor1
parents:
diff changeset
2264 {
Ritor1
parents:
diff changeset
2265 if ( v48 )
Ritor1
parents:
diff changeset
2266 {
Ritor1
parents:
diff changeset
2267 v31 = 0;
Ritor1
parents:
diff changeset
2268 v32 = (char *)v21->pInventoryItems;
Ritor1
parents:
diff changeset
2269 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 )
Ritor1
parents:
diff changeset
2270 {
Ritor1
parents:
diff changeset
2271 ++v31;
Ritor1
parents:
diff changeset
2272 v32 += 36;
Ritor1
parents:
diff changeset
2273 if ( v31 >= 138 )
Ritor1
parents:
diff changeset
2274 goto LABEL_59;
Ritor1
parents:
diff changeset
2275 }
Ritor1
parents:
diff changeset
2276 v48 = 0;
Ritor1
parents:
diff changeset
2277 v45 = 1;
Ritor1
parents:
diff changeset
2278 }
Ritor1
parents:
diff changeset
2279 LABEL_59:
Ritor1
parents:
diff changeset
2280 if ( v21->pConditions[17] )
Ritor1
parents:
diff changeset
2281 v46 = 1;
Ritor1
parents:
diff changeset
2282 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2283 {
Ritor1
parents:
diff changeset
2284 ++v21->sHealth;
Ritor1
parents:
diff changeset
2285 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
2286 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
2287 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
2288 {
Ritor1
parents:
diff changeset
2289 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2290 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2291 }
Ritor1
parents:
diff changeset
2292 v51 = 1;
Ritor1
parents:
diff changeset
2293 }
Ritor1
parents:
diff changeset
2294 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0
Ritor1
parents:
diff changeset
2295 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime))
Ritor1
parents:
diff changeset
2296 && !v21->pConditions[14]
Ritor1
parents:
diff changeset
2297 && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2298 {
Ritor1
parents:
diff changeset
2299 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower;
Ritor1
parents:
diff changeset
2300 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
2301 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
2302 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
2303 {
Ritor1
parents:
diff changeset
2304 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2305 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2306 }
Ritor1
parents:
diff changeset
2307 v51 = 1;
Ritor1
parents:
diff changeset
2308 }
Ritor1
parents:
diff changeset
2309 if ( v50 )
Ritor1
parents:
diff changeset
2310 {
Ritor1
parents:
diff changeset
2311 v33 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
2312 ++*(int *)v33;
Ritor1
parents:
diff changeset
2313 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
2314 *(int *)v33 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
2315 v51 = 1;
Ritor1
parents:
diff changeset
2316 }
Ritor1
parents:
diff changeset
2317 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2318 {
Ritor1
parents:
diff changeset
2319 v34 = LODWORD(v21->pConditions[13]);
Ritor1
parents:
diff changeset
2320 --v21->sHealth;
Ritor1
parents:
diff changeset
2321 v35 = v21->sHealth;
Ritor1
parents:
diff changeset
2322 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 )
Ritor1
parents:
diff changeset
2323 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2324 if ( v35 < 1 )
Ritor1
parents:
diff changeset
2325 {
Ritor1
parents:
diff changeset
2326 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
Ritor1
parents:
diff changeset
2327 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2328 {
Ritor1
parents:
diff changeset
2329 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2330 }
Ritor1
parents:
diff changeset
2331 else
Ritor1
parents:
diff changeset
2332 {
Ritor1
parents:
diff changeset
2333 if ( !v21->pConditions[14] )
Ritor1
parents:
diff changeset
2334 v21->pConditions[14] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2335 }
Ritor1
parents:
diff changeset
2336 }
Ritor1
parents:
diff changeset
2337 v51 = 1;
Ritor1
parents:
diff changeset
2338 }
Ritor1
parents:
diff changeset
2339 if ( v45 )
Ritor1
parents:
diff changeset
2340 {
Ritor1
parents:
diff changeset
2341 v36 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
2342 ++*(int *)v36;
Ritor1
parents:
diff changeset
2343 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
2344 *(int *)v36 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
2345 }
Ritor1
parents:
diff changeset
2346 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2347 {
Ritor1
parents:
diff changeset
2348 v37 = v21->sHealth;
Ritor1
parents:
diff changeset
2349 if ( v37 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
2350 v21->sHealth = v37 - 2;
Ritor1
parents:
diff changeset
2351 v38 = v21->sMana;
Ritor1
parents:
diff changeset
2352 if ( v38 > v21->GetMaxMana() / 2 )
Ritor1
parents:
diff changeset
2353 v21->sMana = v38 - 2;
Ritor1
parents:
diff changeset
2354 }
Ritor1
parents:
diff changeset
2355 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2356 {
Ritor1
parents:
diff changeset
2357 v39 = v21->sHealth;
Ritor1
parents:
diff changeset
2358 if ( v39 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
2359 v21->sHealth = v39 - 1;
Ritor1
parents:
diff changeset
2360 v40 = v21->sMana;
Ritor1
parents:
diff changeset
2361 if ( v40 > 0 )
Ritor1
parents:
diff changeset
2362 v21->sMana = v40 - 1;
Ritor1
parents:
diff changeset
2363 }
Ritor1
parents:
diff changeset
2364 ++v49;
Ritor1
parents:
diff changeset
2365 if ( v49 >= 4 )
Ritor1
parents:
diff changeset
2366 {
Ritor1
parents:
diff changeset
2367 result = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2368 pParty->uLastRegenerationTime = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2369 if ( !viewparams->bRedrawGameUI )
Ritor1
parents:
diff changeset
2370 {
Ritor1
parents:
diff changeset
2371 result = v51;
Ritor1
parents:
diff changeset
2372 viewparams->bRedrawGameUI = v51;
Ritor1
parents:
diff changeset
2373 }
Ritor1
parents:
diff changeset
2374 return result;
Ritor1
parents:
diff changeset
2375 }
Ritor1
parents:
diff changeset
2376 goto LABEL_25;
Ritor1
parents:
diff changeset
2377 }
Ritor1
parents:
diff changeset
2378 }
Ritor1
parents:
diff changeset
2379 }
Ritor1
parents:
diff changeset
2380 return result;
Ritor1
parents:
diff changeset
2381 }
Ritor1
parents:
diff changeset
2382
Ritor1
parents:
diff changeset
2383
Ritor1
parents:
diff changeset
2384
Ritor1
parents:
diff changeset
2385 //----- (00493F79) --------------------------------------------------------
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2386 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
0
Ritor1
parents:
diff changeset
2387 {
Ritor1
parents:
diff changeset
2388 signed __int64 v2; // ST2C_8@1
Ritor1
parents:
diff changeset
2389 signed __int64 v3; // qax@1
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2390 //signed __int64 v4; // ST1C_8@1
0
Ritor1
parents:
diff changeset
2391 unsigned __int64 v5; // qax@1
Ritor1
parents:
diff changeset
2392 unsigned int v6; // ebx@1
Ritor1
parents:
diff changeset
2393
Ritor1
parents:
diff changeset
2394 v2 = (signed __int64)((double)a2 * 0.234375);
Ritor1
parents:
diff changeset
2395 v3 = v2 / 60 / 60;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2396 //v4 = v3;
0
Ritor1
parents:
diff changeset
2397 v5 = (unsigned int)v3 / 0x18;
Ritor1
parents:
diff changeset
2398 v6 = (unsigned int)(v5 / 7) >> 2;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2399 _this->field_0_expire_second = v2 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2400 _this->field_4_expire_minute = v2 / 60 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2401 _this->field_8_expire_hour = v3 % 24;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2402 _this->field_10_expire_week = v5 / 7 & 3;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2403 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2404 _this->field_14_exprie_month = v6 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
2405 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
2406 }
Ritor1
parents:
diff changeset
2407
Ritor1
parents:
diff changeset
2408
Ritor1
parents:
diff changeset
2409
Ritor1
parents:
diff changeset
2410
Ritor1
parents:
diff changeset
2411
Ritor1
parents:
diff changeset
2412 //----- (00494035) --------------------------------------------------------
Ritor1
parents:
diff changeset
2413 void __cdecl _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents:
diff changeset
2414 {
Ritor1
parents:
diff changeset
2415 signed __int64 v0; // qax@1
Ritor1
parents:
diff changeset
2416 signed __int64 v1; // ST30_8@1
Ritor1
parents:
diff changeset
2417 signed __int64 v2; // ST38_8@1
Ritor1
parents:
diff changeset
2418 unsigned __int64 v3; // qax@1
Ritor1
parents:
diff changeset
2419 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
2420 //signed int v5; // eax@4
Ritor1
parents:
diff changeset
2421 //char *v6; // ecx@5
Ritor1
parents:
diff changeset
2422 //Player *v7; // esi@8
Ritor1
parents:
diff changeset
2423 //char *v8; // ecx@12
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2424 //Player *pPlayer; // esi@15
0
Ritor1
parents:
diff changeset
2425 //void *v10; // esi@25
Ritor1
parents:
diff changeset
2426 unsigned int v11; // ecx@27
Ritor1
parents:
diff changeset
2427 signed int v12; // edi@29
Ritor1
parents:
diff changeset
2428 Player *v13; // ecx@30
Ritor1
parents:
diff changeset
2429 Player *v14; // esi@35
Ritor1
parents:
diff changeset
2430 double v15; // st7@35
Ritor1
parents:
diff changeset
2431 Player **v16; // esi@43
Ritor1
parents:
diff changeset
2432 Player *v17; // edi@44
Ritor1
parents:
diff changeset
2433 double v18; // st7@44
Ritor1
parents:
diff changeset
2434 float v19; // ST28_4@48
Ritor1
parents:
diff changeset
2435 double v20; // ST38_8@48
Ritor1
parents:
diff changeset
2436 Player *v21; // esi@51
Ritor1
parents:
diff changeset
2437 signed int v22; // edi@53
Ritor1
parents:
diff changeset
2438 int v23; // eax@59
Ritor1
parents:
diff changeset
2439 int v24; // ecx@60
Ritor1
parents:
diff changeset
2440 int v25; // eax@63
Ritor1
parents:
diff changeset
2441 int v26; // ecx@64
Ritor1
parents:
diff changeset
2442 int v27; // eax@67
Ritor1
parents:
diff changeset
2443 int v28; // ecx@68
Ritor1
parents:
diff changeset
2444 int v29; // eax@71
Ritor1
parents:
diff changeset
2445 int v30; // ecx@72
Ritor1
parents:
diff changeset
2446 int v31; // eax@75
Ritor1
parents:
diff changeset
2447 int v32; // ecx@76
Ritor1
parents:
diff changeset
2448 int v33; // eax@79
Ritor1
parents:
diff changeset
2449 int v34; // ecx@80
Ritor1
parents:
diff changeset
2450 int v35; // eax@83
Ritor1
parents:
diff changeset
2451 int v36; // ecx@84
Ritor1
parents:
diff changeset
2452 int v37; // eax@87
Ritor1
parents:
diff changeset
2453 int v38; // ecx@88
Ritor1
parents:
diff changeset
2454 int v39; // eax@91
Ritor1
parents:
diff changeset
2455 int v40; // ecx@92
Ritor1
parents:
diff changeset
2456 int v41; // eax@95
Ritor1
parents:
diff changeset
2457 int v42; // ecx@96
Ritor1
parents:
diff changeset
2458 bool v43; // ebx@102
Ritor1
parents:
diff changeset
2459 //SpellBuff *v44; // edi@104
Ritor1
parents:
diff changeset
2460 //signed int v45; // ebp@104
Ritor1
parents:
diff changeset
2461 bool v46; // edi@111
Ritor1
parents:
diff changeset
2462 //SpellBuff *v47; // esi@113
Ritor1
parents:
diff changeset
2463 //Player **v48; // esi@119
Ritor1
parents:
diff changeset
2464 //signed int v49; // edi@121
Ritor1
parents:
diff changeset
2465 //char *v50; // esi@122
Ritor1
parents:
diff changeset
2466 signed int v51; // edx@128
Ritor1
parents:
diff changeset
2467 signed int v52; // ecx@130
Ritor1
parents:
diff changeset
2468 int v53; // eax@131
Ritor1
parents:
diff changeset
2469 Player *v54; // eax@141
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2470 //unsigned int v55; // [sp-8h] [bp-38h]@18
0
Ritor1
parents:
diff changeset
2471 unsigned int v56; // [sp-8h] [bp-38h]@55
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2472 //int v57; // [sp-4h] [bp-34h]@18
0
Ritor1
parents:
diff changeset
2473 int v58; // [sp-4h] [bp-34h]@33
Ritor1
parents:
diff changeset
2474 int v59; // [sp-4h] [bp-34h]@55
Ritor1
parents:
diff changeset
2475 unsigned int v60; // [sp+10h] [bp-20h]@1
Ritor1
parents:
diff changeset
2476 unsigned int v61; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
2477 Player **v62; // [sp+14h] [bp-1Ch]@50
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2478 //unsigned int a2; // [sp+18h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
2479 signed int a2a; // [sp+18h] [bp-18h]@47
Ritor1
parents:
diff changeset
2480 signed int v65; // [sp+1Ch] [bp-14h]@47
Ritor1
parents:
diff changeset
2481
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2482 //a2 = pParty->uCurrentHour;
0
Ritor1
parents:
diff changeset
2483 v61 = pParty->uDaysPlayed;
Ritor1
parents:
diff changeset
2484 v60 = pEventTimer->uTimeElapsed;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2485 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2486 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60;
0
Ritor1
parents:
diff changeset
2487 v1 = v0;
Ritor1
parents:
diff changeset
2488 v0 /= 60i64;
Ritor1
parents:
diff changeset
2489 v2 = v0;
Ritor1
parents:
diff changeset
2490 v3 = (unsigned int)v0 / 24;
Ritor1
parents:
diff changeset
2491 v4 = (unsigned int)(v3 / 7) >> 2;
Ritor1
parents:
diff changeset
2492 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
Ritor1
parents:
diff changeset
2493 pParty->uCurrentMinute = v1 % 60;
Ritor1
parents:
diff changeset
2494 pParty->uCurrentMonthWeek = v3 / 7 & 3;
Ritor1
parents:
diff changeset
2495 pParty->uCurrentHour = v2 % 24;
Ritor1
parents:
diff changeset
2496 pParty->uDaysPlayed = (unsigned int)v3 % 28;
Ritor1
parents:
diff changeset
2497 pParty->uCurrentMonth = v4 % 12;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
2498 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2499 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns
0
Ritor1
parents:
diff changeset
2500 {
Ritor1
parents:
diff changeset
2501 pParty->pHirelings[0].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2502 pParty->pHirelings[1].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2503
Ritor1
parents:
diff changeset
2504 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
Ritor1
parents:
diff changeset
2505 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2506
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2507 ++pParty->days_played_without_rest;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2508 if (pParty->days_played_without_rest > 1)
0
Ritor1
parents:
diff changeset
2509 {
Ritor1
parents:
diff changeset
2510 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2511 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0);
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2512
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2513 if (pParty->uNumFoodRations)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2514 Party::TakeFood(1);
0
Ritor1
parents:
diff changeset
2515 else
Ritor1
parents:
diff changeset
2516 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2517 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
2518
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2519 if (pParty->days_played_without_rest > 3)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2520 for (uint i = 0; i < 4; ++i)
0
Ritor1
parents:
diff changeset
2521 {
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2522 auto player = pParty->pPlayers + i;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2523
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2524 player->Zero();
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2525
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2526 if (!player->Pertified() && !player->Eradicated() && !player->Dead())
0
Ritor1
parents:
diff changeset
2527 {
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
2528 if (rand() % 100 < 5 * pParty->days_played_without_rest)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2529 player->SetCondition(Player::Condition_Dead, 0);
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
2530 if (rand() % 100 < 10 * pParty->days_played_without_rest)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2531 player->SetCondition(Player::Condition_Insane, 0);
0
Ritor1
parents:
diff changeset
2532 }
Ritor1
parents:
diff changeset
2533 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2534 }
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2535 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
Ritor1
parents:
diff changeset
2536 pOutdoor->SetFog();
Ritor1
parents:
diff changeset
2537
Ritor1
parents:
diff changeset
2538 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
2539 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
2540 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2541
0
Ritor1
parents:
diff changeset
2542 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2543 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )
Ritor1
parents:
diff changeset
2544 {
Ritor1
parents:
diff changeset
2545 v12 = 1;
Ritor1
parents:
diff changeset
2546 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128;
Ritor1
parents:
diff changeset
2547 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2548 while ( 1 )
Ritor1
parents:
diff changeset
2549 {
Ritor1
parents:
diff changeset
2550 if ( pPlayers[v12]->WearsItem(516, 3)
99
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
2551 || pPlayers[v12]->HasEnchantedItemEquipped(71)
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
2552 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
2553 {
Ritor1
parents:
diff changeset
2554 v58 = 0;
Ritor1
parents:
diff changeset
2555 }
Ritor1
parents:
diff changeset
2556 else
Ritor1
parents:
diff changeset
2557 {
Ritor1
parents:
diff changeset
2558 v58 = 0;
Ritor1
parents:
diff changeset
2559 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) )
Ritor1
parents:
diff changeset
2560 {
Ritor1
parents:
diff changeset
2561 v14 = pPlayers[v12];
Ritor1
parents:
diff changeset
2562 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1;
Ritor1
parents:
diff changeset
2563 v14->ReceiveDamage((signed __int64)v15, 0);
Ritor1
parents:
diff changeset
2564 if ( pParty->uFlags & 4 )
Ritor1
parents:
diff changeset
2565 {
Ritor1
parents:
diff changeset
2566 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[660]);
Ritor1
parents:
diff changeset
2567 GameUI_StatusBar_TimedStringTimeLeft = 128;
Ritor1
parents:
diff changeset
2568 }
Ritor1
parents:
diff changeset
2569 goto LABEL_39;
Ritor1
parents:
diff changeset
2570 }
Ritor1
parents:
diff changeset
2571 v13 = pPlayers[v12];
Ritor1
parents:
diff changeset
2572 }
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2573 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
0
Ritor1
parents:
diff changeset
2574 LABEL_39:
Ritor1
parents:
diff changeset
2575 ++v12;
Ritor1
parents:
diff changeset
2576 if ( v12 > 4 )
Ritor1
parents:
diff changeset
2577 {
Ritor1
parents:
diff changeset
2578 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2579 break;
Ritor1
parents:
diff changeset
2580 }
Ritor1
parents:
diff changeset
2581 }
Ritor1
parents:
diff changeset
2582 }
Ritor1
parents:
diff changeset
2583 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) )
Ritor1
parents:
diff changeset
2584 {
Ritor1
parents:
diff changeset
2585 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2586 pParty->field_6FC = v11 + 128;
Ritor1
parents:
diff changeset
2587 v16 = &pPlayers[1];
Ritor1
parents:
diff changeset
2588 do
Ritor1
parents:
diff changeset
2589 {
Ritor1
parents:
diff changeset
2590 v17 = *v16;
Ritor1
parents:
diff changeset
2591 v18 = (double)(*v16)->GetMaxHealth() * 0.1;
Ritor1
parents:
diff changeset
2592 v17->ReceiveDamage((signed __int64)v18, 0);
Ritor1
parents:
diff changeset
2593 if ( pParty->uFlags & 0x200 )
Ritor1
parents:
diff changeset
2594 {
Ritor1
parents:
diff changeset
2595 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[661]);
Ritor1
parents:
diff changeset
2596 GameUI_StatusBar_TimedStringTimeLeft = 128;
Ritor1
parents:
diff changeset
2597 }
Ritor1
parents:
diff changeset
2598 ++v16;
Ritor1
parents:
diff changeset
2599 }
Ritor1
parents:
diff changeset
2600 while ( (signed int)v16 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
2601 }
Ritor1
parents:
diff changeset
2602 _493938_regenerate();
Ritor1
parents:
diff changeset
2603 v65 = 4;
Ritor1
parents:
diff changeset
2604 a2a = v60;
Ritor1
parents:
diff changeset
2605 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
2606 {
Ritor1
parents:
diff changeset
2607 v19 = (double)(signed int)v60 * 0.5;
Ritor1
parents:
diff changeset
2608 v20 = v19 + 6.7553994e15;
Ritor1
parents:
diff changeset
2609 a2a = LODWORD(v20);
Ritor1
parents:
diff changeset
2610 if ( SLODWORD(v20) <= 0 )
Ritor1
parents:
diff changeset
2611 a2a = 1;
Ritor1
parents:
diff changeset
2612 }
Ritor1
parents:
diff changeset
2613 v62 = &pPlayers[1];
Ritor1
parents:
diff changeset
2614 do
Ritor1
parents:
diff changeset
2615 {
Ritor1
parents:
diff changeset
2616 v21 = *v62;
Ritor1
parents:
diff changeset
2617 if ( (*v62)->uTimeToRecovery )
Ritor1
parents:
diff changeset
2618 v21->Recover(a2a);
Ritor1
parents:
diff changeset
2619 v22 = v21->sHealth;
Ritor1
parents:
diff changeset
2620 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1
Ritor1
parents:
diff changeset
2621 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2622 {
Ritor1
parents:
diff changeset
2623 if ( v22 >= 1 )
Ritor1
parents:
diff changeset
2624 goto LABEL_59;
Ritor1
parents:
diff changeset
2625 v59 = 0;
Ritor1
parents:
diff changeset
2626 v56 = 13;
Ritor1
parents:
diff changeset
2627 }
Ritor1
parents:
diff changeset
2628 else
Ritor1
parents:
diff changeset
2629 {
Ritor1
parents:
diff changeset
2630 v59 = 0;
Ritor1
parents:
diff changeset
2631 v56 = 14;
Ritor1
parents:
diff changeset
2632 }
Ritor1
parents:
diff changeset
2633 v21->SetCondition(v56, v59);
Ritor1
parents:
diff changeset
2634 LABEL_59:
Ritor1
parents:
diff changeset
2635 v23 = (int)&v21->field_E0;
Ritor1
parents:
diff changeset
2636 if ( v21->field_E0 )
Ritor1
parents:
diff changeset
2637 {
Ritor1
parents:
diff changeset
2638 v24 = *(int *)v23 - v60;
Ritor1
parents:
diff changeset
2639 if ( v24 > 0 )
Ritor1
parents:
diff changeset
2640 {
Ritor1
parents:
diff changeset
2641 *(int *)v23 = v24;
Ritor1
parents:
diff changeset
2642 }
Ritor1
parents:
diff changeset
2643 else
Ritor1
parents:
diff changeset
2644 {
Ritor1
parents:
diff changeset
2645 *(int *)v23 = 0;
Ritor1
parents:
diff changeset
2646 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2647 }
Ritor1
parents:
diff changeset
2648 }
Ritor1
parents:
diff changeset
2649 v25 = (int)&v21->field_E4;
Ritor1
parents:
diff changeset
2650 if ( v21->field_E4 )
Ritor1
parents:
diff changeset
2651 {
Ritor1
parents:
diff changeset
2652 v26 = *(int *)v25 - v60;
Ritor1
parents:
diff changeset
2653 if ( v26 > 0 )
Ritor1
parents:
diff changeset
2654 {
Ritor1
parents:
diff changeset
2655 *(int *)v25 = v26;
Ritor1
parents:
diff changeset
2656 }
Ritor1
parents:
diff changeset
2657 else
Ritor1
parents:
diff changeset
2658 {
Ritor1
parents:
diff changeset
2659 *(int *)v25 = 0;
Ritor1
parents:
diff changeset
2660 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2661 }
Ritor1
parents:
diff changeset
2662 }
Ritor1
parents:
diff changeset
2663 v27 = (int)&v21->field_E8;
Ritor1
parents:
diff changeset
2664 if ( v21->field_E8 )
Ritor1
parents:
diff changeset
2665 {
Ritor1
parents:
diff changeset
2666 v28 = *(int *)v27 - v60;
Ritor1
parents:
diff changeset
2667 if ( v28 > 0 )
Ritor1
parents:
diff changeset
2668 {
Ritor1
parents:
diff changeset
2669 *(int *)v27 = v28;
Ritor1
parents:
diff changeset
2670 }
Ritor1
parents:
diff changeset
2671 else
Ritor1
parents:
diff changeset
2672 {
Ritor1
parents:
diff changeset
2673 *(int *)v27 = 0;
Ritor1
parents:
diff changeset
2674 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2675 }
Ritor1
parents:
diff changeset
2676 }
Ritor1
parents:
diff changeset
2677 v29 = (int)&v21->field_EC;
Ritor1
parents:
diff changeset
2678 if ( v21->field_EC )
Ritor1
parents:
diff changeset
2679 {
Ritor1
parents:
diff changeset
2680 v30 = *(int *)v29 - v60;
Ritor1
parents:
diff changeset
2681 if ( v30 > 0 )
Ritor1
parents:
diff changeset
2682 {
Ritor1
parents:
diff changeset
2683 *(int *)v29 = v30;
Ritor1
parents:
diff changeset
2684 }
Ritor1
parents:
diff changeset
2685 else
Ritor1
parents:
diff changeset
2686 {
Ritor1
parents:
diff changeset
2687 *(int *)v29 = 0;
Ritor1
parents:
diff changeset
2688 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2689 }
Ritor1
parents:
diff changeset
2690 }
Ritor1
parents:
diff changeset
2691 v31 = (int)&v21->field_F0;
Ritor1
parents:
diff changeset
2692 if ( v21->field_F0 )
Ritor1
parents:
diff changeset
2693 {
Ritor1
parents:
diff changeset
2694 v32 = *(int *)v31 - v60;
Ritor1
parents:
diff changeset
2695 if ( v32 > 0 )
Ritor1
parents:
diff changeset
2696 {
Ritor1
parents:
diff changeset
2697 *(int *)v31 = v32;
Ritor1
parents:
diff changeset
2698 }
Ritor1
parents:
diff changeset
2699 else
Ritor1
parents:
diff changeset
2700 {
Ritor1
parents:
diff changeset
2701 *(int *)v31 = 0;
Ritor1
parents:
diff changeset
2702 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2703 }
Ritor1
parents:
diff changeset
2704 }
Ritor1
parents:
diff changeset
2705 v33 = (int)&v21->field_F4;
Ritor1
parents:
diff changeset
2706 if ( v21->field_F4 )
Ritor1
parents:
diff changeset
2707 {
Ritor1
parents:
diff changeset
2708 v34 = *(int *)v33 - v60;
Ritor1
parents:
diff changeset
2709 if ( v34 > 0 )
Ritor1
parents:
diff changeset
2710 {
Ritor1
parents:
diff changeset
2711 *(int *)v33 = v34;
Ritor1
parents:
diff changeset
2712 }
Ritor1
parents:
diff changeset
2713 else
Ritor1
parents:
diff changeset
2714 {
Ritor1
parents:
diff changeset
2715 *(int *)v33 = 0;
Ritor1
parents:
diff changeset
2716 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2717 }
Ritor1
parents:
diff changeset
2718 }
Ritor1
parents:
diff changeset
2719 v35 = (int)&v21->field_F8;
Ritor1
parents:
diff changeset
2720 if ( v21->field_F8 )
Ritor1
parents:
diff changeset
2721 {
Ritor1
parents:
diff changeset
2722 v36 = *(int *)v35 - v60;
Ritor1
parents:
diff changeset
2723 if ( v36 > 0 )
Ritor1
parents:
diff changeset
2724 {
Ritor1
parents:
diff changeset
2725 *(int *)v35 = v36;
Ritor1
parents:
diff changeset
2726 }
Ritor1
parents:
diff changeset
2727 else
Ritor1
parents:
diff changeset
2728 {
Ritor1
parents:
diff changeset
2729 *(int *)v35 = 0;
Ritor1
parents:
diff changeset
2730 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2731 }
Ritor1
parents:
diff changeset
2732 }
Ritor1
parents:
diff changeset
2733 v37 = (int)&v21->field_FC;
Ritor1
parents:
diff changeset
2734 if ( v21->field_FC )
Ritor1
parents:
diff changeset
2735 {
Ritor1
parents:
diff changeset
2736 v38 = *(int *)v37 - v60;
Ritor1
parents:
diff changeset
2737 if ( v38 > 0 )
Ritor1
parents:
diff changeset
2738 {
Ritor1
parents:
diff changeset
2739 *(int *)v37 = v38;
Ritor1
parents:
diff changeset
2740 }
Ritor1
parents:
diff changeset
2741 else
Ritor1
parents:
diff changeset
2742 {
Ritor1
parents:
diff changeset
2743 *(int *)v37 = 0;
Ritor1
parents:
diff changeset
2744 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2745 }
Ritor1
parents:
diff changeset
2746 }
Ritor1
parents:
diff changeset
2747 v39 = (int)&v21->field_100;
Ritor1
parents:
diff changeset
2748 if ( v21->field_100 )
Ritor1
parents:
diff changeset
2749 {
Ritor1
parents:
diff changeset
2750 v40 = *(int *)v39 - v60;
Ritor1
parents:
diff changeset
2751 if ( v40 > 0 )
Ritor1
parents:
diff changeset
2752 {
Ritor1
parents:
diff changeset
2753 *(int *)v39 = v40;
Ritor1
parents:
diff changeset
2754 }
Ritor1
parents:
diff changeset
2755 else
Ritor1
parents:
diff changeset
2756 {
Ritor1
parents:
diff changeset
2757 *(int *)v39 = 0;
Ritor1
parents:
diff changeset
2758 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2759 }
Ritor1
parents:
diff changeset
2760 }
Ritor1
parents:
diff changeset
2761 v41 = (int)&v21->field_104;
Ritor1
parents:
diff changeset
2762 if ( v21->field_104 )
Ritor1
parents:
diff changeset
2763 {
Ritor1
parents:
diff changeset
2764 v42 = *(int *)v41 - v60;
Ritor1
parents:
diff changeset
2765 if ( v42 > 0 )
Ritor1
parents:
diff changeset
2766 {
Ritor1
parents:
diff changeset
2767 *(int *)v41 = v42;
Ritor1
parents:
diff changeset
2768 }
Ritor1
parents:
diff changeset
2769 else
Ritor1
parents:
diff changeset
2770 {
Ritor1
parents:
diff changeset
2771 *(int *)v41 = 0;
Ritor1
parents:
diff changeset
2772 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2773 }
Ritor1
parents:
diff changeset
2774 }
Ritor1
parents:
diff changeset
2775 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] )
Ritor1
parents:
diff changeset
2776 --v65;
Ritor1
parents:
diff changeset
2777 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0;
Ritor1
parents:
diff changeset
2778
Ritor1
parents:
diff changeset
2779 for (uint k = 0; k < 24; ++k)
Ritor1
parents:
diff changeset
2780 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2781
Ritor1
parents:
diff changeset
2782 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
2783 v21->SetCondition(1u, 0);
Ritor1
parents:
diff changeset
2784 ++v62;
Ritor1
parents:
diff changeset
2785 }
Ritor1
parents:
diff changeset
2786 while ( (signed int)v62 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
2787 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0;
Ritor1
parents:
diff changeset
2788
Ritor1
parents:
diff changeset
2789 for (uint i = 0; i < 20; ++i)
Ritor1
parents:
diff changeset
2790 {
Ritor1
parents:
diff changeset
2791 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1)
Ritor1
parents:
diff changeset
2792 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2793 }
Ritor1
parents:
diff changeset
2794
Ritor1
parents:
diff changeset
2795 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
2796 {
Ritor1
parents:
diff changeset
2797 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
2798 pParty->pPlayers[i].SetCondition(1, 0);
Ritor1
parents:
diff changeset
2799 }
Ritor1
parents:
diff changeset
2800
Ritor1
parents:
diff changeset
2801 for (uint i = 0; i < 2; ++i)
Ritor1
parents:
diff changeset
2802 {
Ritor1
parents:
diff changeset
2803 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]];
Ritor1
parents:
diff changeset
2804 if (pBuf->uExpireTime == 0)
Ritor1
parents:
diff changeset
2805 continue;
Ritor1
parents:
diff changeset
2806
Ritor1
parents:
diff changeset
2807 if ( !(pBuf->uFlags & 1) )
Ritor1
parents:
diff changeset
2808 {
Ritor1
parents:
diff changeset
2809 if (!pPlayers[pBuf->uCaster]->CanAct())
Ritor1
parents:
diff changeset
2810 {
Ritor1
parents:
diff changeset
2811 pBuf->Reset();
Ritor1
parents:
diff changeset
2812 if (dword_4EE07C[i] == 7 )
Ritor1
parents:
diff changeset
2813 pParty->bFlying = false;
Ritor1
parents:
diff changeset
2814 }
Ritor1
parents:
diff changeset
2815 }
Ritor1
parents:
diff changeset
2816 }
Ritor1
parents:
diff changeset
2817
Ritor1
parents:
diff changeset
2818 v51 = v65;
Ritor1
parents:
diff changeset
2819 if ( v65 )
Ritor1
parents:
diff changeset
2820 goto LABEL_135;
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2821 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
2822 {
Ritor1
parents:
diff changeset
2823 v52 = (signed int)&pPlayers[1];
Ritor1
parents:
diff changeset
2824 while ( 1 )
Ritor1
parents:
diff changeset
2825 {
Ritor1
parents:
diff changeset
2826 v53 = *(int *)v52;
Ritor1
parents:
diff changeset
2827 if ( *(_QWORD *)(*(int *)v52 + 16) )
Ritor1
parents:
diff changeset
2828 break;
Ritor1
parents:
diff changeset
2829 v52 += 4;
Ritor1
parents:
diff changeset
2830 if ( v52 > (signed int)&pPlayers[4] )
Ritor1
parents:
diff changeset
2831 goto LABEL_135;
Ritor1
parents:
diff changeset
2832 }
Ritor1
parents:
diff changeset
2833 *(int *)(v53 + 16) = 0;
Ritor1
parents:
diff changeset
2834 *(int *)(v53 + 20) = 0;
Ritor1
parents:
diff changeset
2835 v51 = 1;
Ritor1
parents:
diff changeset
2836 LABEL_135:
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2837 if ( pCurrentScreen != SCREEN_REST
0
Ritor1
parents:
diff changeset
2838 && (!v51 || dword_5C35C0) )
Ritor1
parents:
diff changeset
2839 uGameState = 8;
Ritor1
parents:
diff changeset
2840 }
Ritor1
parents:
diff changeset
2841 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
2842 {
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2843 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
2844 {
Ritor1
parents:
diff changeset
2845 v54 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
2846 if ( v54->pConditions[2]
Ritor1
parents:
diff changeset
2847 || v54->pConditions[12]
Ritor1
parents:
diff changeset
2848 || v54->pConditions[13]
Ritor1
parents:
diff changeset
2849 || v54->pConditions[14]
Ritor1
parents:
diff changeset
2850 || v54->pConditions[15]
Ritor1
parents:
diff changeset
2851 || v54->pConditions[16] )
Ritor1
parents:
diff changeset
2852 {
Ritor1
parents:
diff changeset
2853 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2854 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2855 }
Ritor1
parents:
diff changeset
2856 }
Ritor1
parents:
diff changeset
2857 }
Ritor1
parents:
diff changeset
2858 }
Ritor1
parents:
diff changeset
2859
Ritor1
parents:
diff changeset
2860 //----- (00494820) --------------------------------------------------------
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2861 unsigned int __fastcall _494820_training_time(unsigned int a1)
0
Ritor1
parents:
diff changeset
2862 {
Ritor1
parents:
diff changeset
2863 signed int v1; // eax@1
Ritor1
parents:
diff changeset
2864
Ritor1
parents:
diff changeset
2865 v1 = 5;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2866 if ( a1 % 24 >= 5 )
0
Ritor1
parents:
diff changeset
2867 v1 = 29;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2868 return v1 - a1 % 24;
0
Ritor1
parents:
diff changeset
2869 }
Ritor1
parents:
diff changeset
2870
Ritor1
parents:
diff changeset
2871 //----- (00494836) --------------------------------------------------------
Ritor1
parents:
diff changeset
2872 int stru339_spell_sound::_494836(int uSoundID, int a6)
Ritor1
parents:
diff changeset
2873 {
Ritor1
parents:
diff changeset
2874 int v3; // esi@1
Ritor1
parents:
diff changeset
2875 int result; // eax@1
Ritor1
parents:
diff changeset
2876 stru339_spell_sound *v5; // ebx@1
Ritor1
parents:
diff changeset
2877 int *v6; // edi@2
Ritor1
parents:
diff changeset
2878 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
2879 int v8; // [sp+Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
2880 int v9; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
2881 int a2a; // [sp+1Ch] [bp+8h]@1
Ritor1
parents:
diff changeset
2882
Ritor1
parents:
diff changeset
2883 v3 = 0;
Ritor1
parents:
diff changeset
2884 result = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
2885 v5 = this;
Ritor1
parents:
diff changeset
2886 a2a = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
2887 if ( result )
Ritor1
parents:
diff changeset
2888 {
Ritor1
parents:
diff changeset
2889 v9 = 0;
Ritor1
parents:
diff changeset
2890 v6 = this->pSoundsOffsets;
Ritor1
parents:
diff changeset
2891 do
Ritor1
parents:
diff changeset
2892 {
Ritor1
parents:
diff changeset
2893 v7 = a2a++;
Ritor1
parents:
diff changeset
2894 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6);
Ritor1
parents:
diff changeset
2895 if ( !result )
Ritor1
parents:
diff changeset
2896 break;
Ritor1
parents:
diff changeset
2897 a6 += 4;
Ritor1
parents:
diff changeset
2898 result = v8 + 256;
Ritor1
parents:
diff changeset
2899 *v6 = v3;
Ritor1
parents:
diff changeset
2900 v3 += result;
Ritor1
parents:
diff changeset
2901 ++v9;
Ritor1
parents:
diff changeset
2902 *(v6 - 2) = result;
Ritor1
parents:
diff changeset
2903 ++v6;
Ritor1
parents:
diff changeset
2904 }
Ritor1
parents:
diff changeset
2905 while ( v9 < 2 );
Ritor1
parents:
diff changeset
2906 }
Ritor1
parents:
diff changeset
2907 return result;
Ritor1
parents:
diff changeset
2908 }
Ritor1
parents:
diff changeset
2909 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
2910
Ritor1
parents:
diff changeset
2911
Ritor1
parents:
diff changeset
2912
Ritor1
parents:
diff changeset
2913 //----- (00494AED) --------------------------------------------------------
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2914 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
0
Ritor1
parents:
diff changeset
2915 {
Ritor1
parents:
diff changeset
2916 unsigned int _uNumFrames; // edx@1
Ritor1
parents:
diff changeset
2917 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
2918 PlayerFrame *v4; // ecx@2
Ritor1
parents:
diff changeset
2919
Ritor1
parents:
diff changeset
2920 _uNumFrames = this->uNumFrames;
Ritor1
parents:
diff changeset
2921 result = 0;
Ritor1
parents:
diff changeset
2922 if ( (signed int)this->uNumFrames <= 0 )
Ritor1
parents:
diff changeset
2923 {
Ritor1
parents:
diff changeset
2924 LABEL_5:
Ritor1
parents:
diff changeset
2925 result = 0;
Ritor1
parents:
diff changeset
2926 }
Ritor1
parents:
diff changeset
2927 else
Ritor1
parents:
diff changeset
2928 {
Ritor1
parents:
diff changeset
2929 v4 = this->pFrames;
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2930 while ( v4->expression != expression )
0
Ritor1
parents:
diff changeset
2931 {
Ritor1
parents:
diff changeset
2932 ++result;
Ritor1
parents:
diff changeset
2933 ++v4;
Ritor1
parents:
diff changeset
2934 if ( (signed int)result >= (signed int)_uNumFrames )
Ritor1
parents:
diff changeset
2935 goto LABEL_5;
Ritor1
parents:
diff changeset
2936 }
Ritor1
parents:
diff changeset
2937 }
Ritor1
parents:
diff changeset
2938 return result;
Ritor1
parents:
diff changeset
2939 }
Ritor1
parents:
diff changeset
2940
Ritor1
parents:
diff changeset
2941 //----- (00494B10) --------------------------------------------------------
Ritor1
parents:
diff changeset
2942 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
2943 {
Ritor1
parents:
diff changeset
2944 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
2945 PlayerFrame *v4; // edi@1
Ritor1
parents:
diff changeset
2946 PlayerFrame *v5; // ecx@1
Ritor1
parents:
diff changeset
2947 __int16 v6; // dx@2
Ritor1
parents:
diff changeset
2948 int v7; // edx@3
Ritor1
parents:
diff changeset
2949 char *i; // eax@3
Ritor1
parents:
diff changeset
2950 int v9; // ecx@5
Ritor1
parents:
diff changeset
2951 PlayerFrame *result; // eax@6
Ritor1
parents:
diff changeset
2952
Ritor1
parents:
diff changeset
2953 v3 = uFramesetID;
Ritor1
parents:
diff changeset
2954 v4 = this->pFrames;
Ritor1
parents:
diff changeset
2955 v5 = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2956 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
2957 {
Ritor1
parents:
diff changeset
2958 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6;
Ritor1
parents:
diff changeset
2959 for ( i = (char *)&v5->uAnimTime; ; i += 10 )
Ritor1
parents:
diff changeset
2960 {
Ritor1
parents:
diff changeset
2961 v9 = *(short *)i;
Ritor1
parents:
diff changeset
2962 if ( v7 <= v9 )
Ritor1
parents:
diff changeset
2963 break;
Ritor1
parents:
diff changeset
2964 v7 -= v9;
Ritor1
parents:
diff changeset
2965 ++v3;
Ritor1
parents:
diff changeset
2966 }
Ritor1
parents:
diff changeset
2967 result = &v4[v3];
Ritor1
parents:
diff changeset
2968 }
Ritor1
parents:
diff changeset
2969 else
Ritor1
parents:
diff changeset
2970 {
Ritor1
parents:
diff changeset
2971 result = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2972 }
Ritor1
parents:
diff changeset
2973 return result;
Ritor1
parents:
diff changeset
2974 }
Ritor1
parents:
diff changeset
2975
Ritor1
parents:
diff changeset
2976 //----- (00494B5E) --------------------------------------------------------
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2977 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
0
Ritor1
parents:
diff changeset
2978 {
Ritor1
parents:
diff changeset
2979 PlayerFrameTable *v4; // edi@1
Ritor1
parents:
diff changeset
2980 int v5; // esi@1
Ritor1
parents:
diff changeset
2981 int v6; // eax@2
Ritor1
parents:
diff changeset
2982
Ritor1
parents:
diff changeset
2983 v4 = this;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2984 v5 = a4 + *pAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2985 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
2986 {
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2987 *pAnimTime = v5;
0
Ritor1
parents:
diff changeset
2988 }
Ritor1
parents:
diff changeset
2989 else
Ritor1
parents:
diff changeset
2990 {
Ritor1
parents:
diff changeset
2991 v6 = rand() % 4 + 21;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2992 *pFramesetID = v6;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2993 *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
2994 }
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2995 return &v4->pFrames[*pFramesetID];
0
Ritor1
parents:
diff changeset
2996 }
Ritor1
parents:
diff changeset
2997
Ritor1
parents:
diff changeset
2998 //----- (00494BC3) --------------------------------------------------------
Ritor1
parents:
diff changeset
2999 void PlayerFrameTable::ToFile()
Ritor1
parents:
diff changeset
3000 {
Ritor1
parents:
diff changeset
3001 PlayerFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
3002 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
3003 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
3004
Ritor1
parents:
diff changeset
3005 auto Str = this;
Ritor1
parents:
diff changeset
3006
Ritor1
parents:
diff changeset
3007 v1 = Str;
Ritor1
parents:
diff changeset
3008 v2 = fopen("data\\dpft.bin", "wb");
Ritor1
parents:
diff changeset
3009 v3 = v2;
Ritor1
parents:
diff changeset
3010 if ( !v2 )
Ritor1
parents:
diff changeset
3011 Abortf("Unable to save dpft.bin!");
Ritor1
parents:
diff changeset
3012 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
3013 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
Ritor1
parents:
diff changeset
3014 fclose(v3);
Ritor1
parents:
diff changeset
3015 }
Ritor1
parents:
diff changeset
3016
Ritor1
parents:
diff changeset
3017 //----- (00494C0F) --------------------------------------------------------
Ritor1
parents:
diff changeset
3018 void PlayerFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
3019 {
Ritor1
parents:
diff changeset
3020 uNumFrames = *(int *)pSerialized;
Ritor1
parents:
diff changeset
3021 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames");
Ritor1
parents:
diff changeset
3022 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames);
Ritor1
parents:
diff changeset
3023 }
Ritor1
parents:
diff changeset
3024
Ritor1
parents:
diff changeset
3025 //----- (00494C5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3026 int PlayerFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
3027 {
Ritor1
parents:
diff changeset
3028 PlayerFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
3029 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
3030 int v4; // esi@3
Ritor1
parents:
diff changeset
3031 void *v5; // eax@10
Ritor1
parents:
diff changeset
3032 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
3033 char *i; // eax@12
Ritor1
parents:
diff changeset
3034 __int16 v8; // ax@15
Ritor1
parents:
diff changeset
3035 const char *v9; // ST10_4@15
Ritor1
parents:
diff changeset
3036 unsigned __int16 v10; // ax@15
Ritor1
parents:
diff changeset
3037 const char *v11; // ST0C_4@15
Ritor1
parents:
diff changeset
3038 int j; // esi@15
Ritor1
parents:
diff changeset
3039 int v13; // eax@17
Ritor1
parents:
diff changeset
3040 int v14; // edx@22
Ritor1
parents:
diff changeset
3041 int v15; // ecx@23
Ritor1
parents:
diff changeset
3042 int v16; // eax@24
Ritor1
parents:
diff changeset
3043 signed int k; // eax@27
Ritor1
parents:
diff changeset
3044 PlayerFrame *v18; // edx@28
Ritor1
parents:
diff changeset
3045 int v19; // esi@28
Ritor1
parents:
diff changeset
3046 int l; // ecx@29
Ritor1
parents:
diff changeset
3047 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
3048 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
3049 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
3050 int v25; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
3051 int v26; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
3052 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
3053 int Argsa; // [sp+30Ch] [bp+8h]@28
Ritor1
parents:
diff changeset
3054
Ritor1
parents:
diff changeset
3055 v2 = this;
Ritor1
parents:
diff changeset
3056 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
3057 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
3058 File = v3;
Ritor1
parents:
diff changeset
3059 if ( !v3 )
Ritor1
parents:
diff changeset
3060 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
3061 v4 = 0;
Ritor1
parents:
diff changeset
3062 v25 = 0;
Ritor1
parents:
diff changeset
3063 v26 = 1;
Ritor1
parents:
diff changeset
3064 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
3065 {
Ritor1
parents:
diff changeset
3066 do
Ritor1
parents:
diff changeset
3067 {
Ritor1
parents:
diff changeset
3068 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
3069 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
3070 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3071 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3072 if ( v24.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
3073 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
Ritor1
parents:
diff changeset
3074 ++v25;
Ritor1
parents:
diff changeset
3075 }
Ritor1
parents:
diff changeset
3076 ++v26;
Ritor1
parents:
diff changeset
3077 }
Ritor1
parents:
diff changeset
3078 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
3079 v4 = v25;
Ritor1
parents:
diff changeset
3080 }
Ritor1
parents:
diff changeset
3081 v2->uNumFrames = v4;
Ritor1
parents:
diff changeset
3082 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
Ritor1
parents:
diff changeset
3083 v2->pFrames = (PlayerFrame *)v5;
Ritor1
parents:
diff changeset
3084 if ( !v5 )
Ritor1
parents:
diff changeset
3085 Abortf("PlayerFrameTable::load - Out of Memory!");
Ritor1
parents:
diff changeset
3086 v6 = File;
Ritor1
parents:
diff changeset
3087 v2->uNumFrames = 0;
Ritor1
parents:
diff changeset
3088 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
3089 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
3090 {
Ritor1
parents:
diff changeset
3091 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
3092 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
3093 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
3094 {
Ritor1
parents:
diff changeset
3095 v8 = atoi(v24.pProperties[0]);
Ritor1
parents:
diff changeset
3096 v9 = v24.pProperties[1];
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
3097 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8;
0
Ritor1
parents:
diff changeset
3098 v10 = atoi(v9);
Ritor1
parents:
diff changeset
3099 v11 = v24.pProperties[2];
Ritor1
parents:
diff changeset
3100 v2->pFrames[v2->uNumFrames].uTextureID = v10;
Ritor1
parents:
diff changeset
3101 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11);
Ritor1
parents:
diff changeset
3102 v2->pFrames[v2->uNumFrames].uAnimLength = 0;
Ritor1
parents:
diff changeset
3103 v2->pFrames[v2->uNumFrames].uFlags = 0;
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3104 for ( j = 3; j < v24.uPropCount; ++j )
0
Ritor1
parents:
diff changeset
3105 {
Ritor1
parents:
diff changeset
3106 if ( !_strcmpi(v24.pProperties[j], "New") )
Ritor1
parents:
diff changeset
3107 {
Ritor1
parents:
diff changeset
3108 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags;
Ritor1
parents:
diff changeset
3109 *(char *)v13 |= 4u;
Ritor1
parents:
diff changeset
3110 }
Ritor1
parents:
diff changeset
3111 }
Ritor1
parents:
diff changeset
3112 ++v2->uNumFrames;
Ritor1
parents:
diff changeset
3113 }
Ritor1
parents:
diff changeset
3114 }
Ritor1
parents:
diff changeset
3115 fclose(File);
Ritor1
parents:
diff changeset
3116 v14 = 0;
Ritor1
parents:
diff changeset
3117 if ( (signed int)(v2->uNumFrames - 1) > 0 )
Ritor1
parents:
diff changeset
3118 {
Ritor1
parents:
diff changeset
3119 v15 = 0;
Ritor1
parents:
diff changeset
3120 do
Ritor1
parents:
diff changeset
3121 {
Ritor1
parents:
diff changeset
3122 v16 = (int)&v2->pFrames[v15];
Ritor1
parents:
diff changeset
3123 if ( !(*(char *)(v16 + 18) & 4) )
Ritor1
parents:
diff changeset
3124 *(char *)(v16 + 8) |= 1u;
Ritor1
parents:
diff changeset
3125 ++v14;
Ritor1
parents:
diff changeset
3126 ++v15;
Ritor1
parents:
diff changeset
3127 }
Ritor1
parents:
diff changeset
3128 while ( v14 < (signed int)(v2->uNumFrames - 1) );
Ritor1
parents:
diff changeset
3129 }
Ritor1
parents:
diff changeset
3130 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 )
Ritor1
parents:
diff changeset
3131 {
Ritor1
parents:
diff changeset
3132 v18 = v2->pFrames;
Ritor1
parents:
diff changeset
3133 Argsa = (int)&v18[k];
Ritor1
parents:
diff changeset
3134 v19 = *(short *)(Argsa + 4);
Ritor1
parents:
diff changeset
3135 if ( *(char *)(Argsa + 8) & 1 )
Ritor1
parents:
diff changeset
3136 {
Ritor1
parents:
diff changeset
3137 ++k;
Ritor1
parents:
diff changeset
3138 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 )
Ritor1
parents:
diff changeset
3139 {
Ritor1
parents:
diff changeset
3140 v19 += *(short *)(l + 4);
Ritor1
parents:
diff changeset
3141 ++k;
Ritor1
parents:
diff changeset
3142 }
Ritor1
parents:
diff changeset
3143 LOWORD(v19) = v18[k].uAnimTime + v19;
Ritor1
parents:
diff changeset
3144 }
Ritor1
parents:
diff changeset
3145 ++k;
Ritor1
parents:
diff changeset
3146 }
Ritor1
parents:
diff changeset
3147 return 1;
Ritor1
parents:
diff changeset
3148 }
Ritor1
parents:
diff changeset
3149
Ritor1
parents:
diff changeset
3150 //----- (00494F3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3151 unsigned int IconFrameTable::FindIcon(const char *pIconName)
Ritor1
parents:
diff changeset
3152 {
Ritor1
parents:
diff changeset
3153 IconFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
3154 int v3; // ebx@1
Ritor1
parents:
diff changeset
3155 unsigned int uID; // edi@1
Ritor1
parents:
diff changeset
3156 unsigned int result; // eax@4
Ritor1
parents:
diff changeset
3157
Ritor1
parents:
diff changeset
3158 v2 = this;
Ritor1
parents:
diff changeset
3159 v3 = 0;
Ritor1
parents:
diff changeset
3160 uID = 0;
Ritor1
parents:
diff changeset
3161 if ( (signed int)this->uNumIcons <= 0 )
Ritor1
parents:
diff changeset
3162 {
Ritor1
parents:
diff changeset
3163 LABEL_4:
Ritor1
parents:
diff changeset
3164 result = 0;
Ritor1
parents:
diff changeset
3165 }
Ritor1
parents:
diff changeset
3166 else
Ritor1
parents:
diff changeset
3167 {
Ritor1
parents:
diff changeset
3168 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) )
Ritor1
parents:
diff changeset
3169 {
Ritor1
parents:
diff changeset
3170 ++uID;
Ritor1
parents:
diff changeset
3171 ++v3;
Ritor1
parents:
diff changeset
3172 if ( (signed int)uID >= (signed int)v2->uNumIcons )
Ritor1
parents:
diff changeset
3173 goto LABEL_4;
Ritor1
parents:
diff changeset
3174 }
Ritor1
parents:
diff changeset
3175 result = uID;
Ritor1
parents:
diff changeset
3176 }
Ritor1
parents:
diff changeset
3177 return result;
Ritor1
parents:
diff changeset
3178 }
Ritor1
parents:
diff changeset
3179
Ritor1
parents:
diff changeset
3180 //----- (00494F70) --------------------------------------------------------
Ritor1
parents:
diff changeset
3181 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
3182 {
Ritor1
parents:
diff changeset
3183 IconFrame *v3; // edi@1
Ritor1
parents:
diff changeset
3184 IconFrame *v4; // ecx@1
Ritor1
parents:
diff changeset
3185 __int16 v5; // dx@2
Ritor1
parents:
diff changeset
3186 int v6; // edx@3
Ritor1
parents:
diff changeset
3187 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
3188 char *i; // ecx@3
Ritor1
parents:
diff changeset
3189 int v9; // esi@5
Ritor1
parents:
diff changeset
3190 IconFrame *result; // eax@6
Ritor1
parents:
diff changeset
3191
Ritor1
parents:
diff changeset
3192 v3 = this->pIcons;
Ritor1
parents:
diff changeset
3193 v4 = &v3[uIconID];
Ritor1
parents:
diff changeset
3194 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
3195 {
Ritor1
parents:
diff changeset
3196 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5;
Ritor1
parents:
diff changeset
3197 v7 = uIconID;
Ritor1
parents:
diff changeset
3198 for ( i = (char *)&v4->uAnimTime; ; i += 32 )
Ritor1
parents:
diff changeset
3199 {
Ritor1
parents:
diff changeset
3200 v9 = *(short *)i;
Ritor1
parents:
diff changeset
3201 if ( v6 <= v9 )
Ritor1
parents:
diff changeset
3202 break;
Ritor1
parents:
diff changeset
3203 v6 -= v9;
Ritor1
parents:
diff changeset
3204 ++v7;
Ritor1
parents:
diff changeset
3205 }
Ritor1
parents:
diff changeset
3206 result = &v3[v7];
Ritor1
parents:
diff changeset
3207 }
Ritor1
parents:
diff changeset
3208 else
Ritor1
parents:
diff changeset
3209 {
Ritor1
parents:
diff changeset
3210 result = &v3[uIconID];
Ritor1
parents:
diff changeset
3211 }
Ritor1
parents:
diff changeset
3212 return result;
Ritor1
parents:
diff changeset
3213 }
Ritor1
parents:
diff changeset
3214
Ritor1
parents:
diff changeset
3215 //----- (00494FBF) --------------------------------------------------------
Ritor1
parents:
diff changeset
3216 void IconFrameTable::InitializeAnimation(unsigned int uIconID)
Ritor1
parents:
diff changeset
3217 {
Ritor1
parents:
diff changeset
3218 IconFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
3219 unsigned int v3; // edi@3
Ritor1
parents:
diff changeset
3220 const char *i; // eax@3
Ritor1
parents:
diff changeset
3221 IconFrame *v5; // eax@5
Ritor1
parents:
diff changeset
3222
Ritor1
parents:
diff changeset
3223 v2 = this;
Ritor1
parents:
diff changeset
3224 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 )
Ritor1
parents:
diff changeset
3225 {
Ritor1
parents:
diff changeset
3226 v3 = uIconID;
Ritor1
parents:
diff changeset
3227 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName )
Ritor1
parents:
diff changeset
3228 {
Ritor1
parents:
diff changeset
3229 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
3230 v5 = v2->pIcons;
Ritor1
parents:
diff changeset
3231 if ( !(v5[v3].uFlags & 1) )
Ritor1
parents:
diff changeset
3232 break;
Ritor1
parents:
diff changeset
3233 ++v3;
Ritor1
parents:
diff changeset
3234 }
Ritor1
parents:
diff changeset
3235 }
Ritor1
parents:
diff changeset
3236 }
Ritor1
parents:
diff changeset
3237
Ritor1
parents:
diff changeset
3238 //----- (0049500A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3239 void IconFrameTable::ToFile()
Ritor1
parents:
diff changeset
3240 {
Ritor1
parents:
diff changeset
3241 IconFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
3242 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
3243 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
3244
Ritor1
parents:
diff changeset
3245 auto Str = this;
Ritor1
parents:
diff changeset
3246
Ritor1
parents:
diff changeset
3247 v1 = Str;
Ritor1
parents:
diff changeset
3248 v2 = fopen("data\\dift.bin", "wb");
Ritor1
parents:
diff changeset
3249 v3 = v2;
Ritor1
parents:
diff changeset
3250 if ( !v2 )
Ritor1
parents:
diff changeset
3251 Abortf("Unable to save dift.bin!");
Ritor1
parents:
diff changeset
3252 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
3253 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3);
Ritor1
parents:
diff changeset
3254 fclose(v3);
Ritor1
parents:
diff changeset
3255 }
Ritor1
parents:
diff changeset
3256
Ritor1
parents:
diff changeset
3257 //----- (00495056) --------------------------------------------------------
Ritor1
parents:
diff changeset
3258 void IconFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
3259 {
Ritor1
parents:
diff changeset
3260 uNumIcons = *(int *)pSerialized;
Ritor1
parents:
diff changeset
3261 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames");
Ritor1
parents:
diff changeset
3262 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons);
Ritor1
parents:
diff changeset
3263 }
Ritor1
parents:
diff changeset
3264
Ritor1
parents:
diff changeset
3265 //----- (0049509D) --------------------------------------------------------
Ritor1
parents:
diff changeset
3266 int IconFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
3267 {
Ritor1
parents:
diff changeset
3268 IconFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
3269 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
3270 int v4; // esi@3
Ritor1
parents:
diff changeset
3271 void *v5; // eax@10
Ritor1
parents:
diff changeset
3272 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
3273 char *i; // eax@12
Ritor1
parents:
diff changeset
3274 const char *v8; // ST00_4@15
Ritor1
parents:
diff changeset
3275 int v9; // eax@16
Ritor1
parents:
diff changeset
3276 int v10; // edx@20
Ritor1
parents:
diff changeset
3277 int v11; // ecx@21
Ritor1
parents:
diff changeset
3278 int v12; // eax@22
Ritor1
parents:
diff changeset
3279 signed int j; // edx@25
Ritor1
parents:
diff changeset
3280 IconFrame *v14; // ecx@26
Ritor1
parents:
diff changeset
3281 int v15; // esi@26
Ritor1
parents:
diff changeset
3282 int k; // eax@27
Ritor1
parents:
diff changeset
3283 signed int result; // eax@11
Ritor1
parents:
diff changeset
3284 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
3285 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
3286 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
3287 int v21; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
3288 int v22; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
3289 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
3290 int Argsa; // [sp+30Ch] [bp+8h]@26
Ritor1
parents:
diff changeset
3291
Ritor1
parents:
diff changeset
3292 v2 = this;
Ritor1
parents:
diff changeset
3293 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
3294 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
3295 File = v3;
Ritor1
parents:
diff changeset
3296 if ( !v3 )
Ritor1
parents:
diff changeset
3297 Abortf("IconFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
3298 v4 = 0;
Ritor1
parents:
diff changeset
3299 v21 = 0;
Ritor1
parents:
diff changeset
3300 v22 = 1;
Ritor1
parents:
diff changeset
3301 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
3302 {
Ritor1
parents:
diff changeset
3303 do
Ritor1
parents:
diff changeset
3304 {
Ritor1
parents:
diff changeset
3305 *strchr(&Buf, 10) = 0;
Ritor1
parents:
diff changeset
3306 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3307 if ( v20.uPropCount && *v20.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3308 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3309 if ( v20.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
3310 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22);
Ritor1
parents:
diff changeset
3311 ++v21;
Ritor1
parents:
diff changeset
3312 }
Ritor1
parents:
diff changeset
3313 ++v22;
Ritor1
parents:
diff changeset
3314 }
Ritor1
parents:
diff changeset
3315 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
3316 v4 = v21;
Ritor1
parents:
diff changeset
3317 }
Ritor1
parents:
diff changeset
3318 v2->uNumIcons = v4;
Ritor1
parents:
diff changeset
3319 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames");
Ritor1
parents:
diff changeset
3320 v2->pIcons = (IconFrame *)v5;
Ritor1
parents:
diff changeset
3321 if ( v5 )
Ritor1
parents:
diff changeset
3322 {
Ritor1
parents:
diff changeset
3323 v6 = File;
Ritor1
parents:
diff changeset
3324 v2->uNumIcons = 0;
Ritor1
parents:
diff changeset
3325 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
3326 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
3327 {
Ritor1
parents:
diff changeset
3328 *strchr(&Buf, 10) = 0;
Ritor1
parents:
diff changeset
3329 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3330 if ( v20.uPropCount && *v20.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
3331 {
Ritor1
parents:
diff changeset
3332 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]);
Ritor1
parents:
diff changeset
3333 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]);
Ritor1
parents:
diff changeset
3334 v8 = v20.pProperties[2];
Ritor1
parents:
diff changeset
3335 v2->pIcons[v2->uNumIcons].uFlags = 0;
Ritor1
parents:
diff changeset
3336 if ( !_strcmpi(v8, "new") )
Ritor1
parents:
diff changeset
3337 {
Ritor1
parents:
diff changeset
3338 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags;
Ritor1
parents:
diff changeset
3339 *(char *)v9 |= 4u;
Ritor1
parents:
diff changeset
3340 }
Ritor1
parents:
diff changeset
3341 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]);
Ritor1
parents:
diff changeset
3342 v2->pIcons[v2->uNumIcons].uAnimLength = 0;
Ritor1
parents:
diff changeset
3343 v2->pIcons[v2->uNumIcons++].uTextureID = 0;
Ritor1
parents:
diff changeset
3344 }
Ritor1
parents:
diff changeset
3345 }
Ritor1
parents:
diff changeset
3346 fclose(File);
Ritor1
parents:
diff changeset
3347 v10 = 0;
Ritor1
parents:
diff changeset
3348 if ( (signed int)(v2->uNumIcons - 1) > 0 )
Ritor1
parents:
diff changeset
3349 {
Ritor1
parents:
diff changeset
3350 v11 = 0;
Ritor1
parents:
diff changeset
3351 do
Ritor1
parents:
diff changeset
3352 {
Ritor1
parents:
diff changeset
3353 v12 = (int)&v2->pIcons[v11];
Ritor1
parents:
diff changeset
3354 if ( !(*(char *)(v12 + 60) & 4) )
Ritor1
parents:
diff changeset
3355 *(char *)(v12 + 28) |= 1u;
Ritor1
parents:
diff changeset
3356 ++v10;
Ritor1
parents:
diff changeset
3357 ++v11;
Ritor1
parents:
diff changeset
3358 }
Ritor1
parents:
diff changeset
3359 while ( v10 < (signed int)(v2->uNumIcons - 1) );
Ritor1
parents:
diff changeset
3360 }
Ritor1
parents:
diff changeset
3361 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 )
Ritor1
parents:
diff changeset
3362 {
Ritor1
parents:
diff changeset
3363 v14 = v2->pIcons;
Ritor1
parents:
diff changeset
3364 Argsa = (int)&v14[j];
Ritor1
parents:
diff changeset
3365 v15 = *(short *)(Argsa + 24);
Ritor1
parents:
diff changeset
3366 if ( *(char *)(Argsa + 28) & 1 )
Ritor1
parents:
diff changeset
3367 {
Ritor1
parents:
diff changeset
3368 ++j;
Ritor1
parents:
diff changeset
3369 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 )
Ritor1
parents:
diff changeset
3370 {
Ritor1
parents:
diff changeset
3371 v15 += *(short *)(k + 24);
Ritor1
parents:
diff changeset
3372 ++j;
Ritor1
parents:
diff changeset
3373 }
Ritor1
parents:
diff changeset
3374 LOWORD(v15) = v14[j].uAnimTime + v15;
Ritor1
parents:
diff changeset
3375 }
Ritor1
parents:
diff changeset
3376 ++j;
Ritor1
parents:
diff changeset
3377 }
Ritor1
parents:
diff changeset
3378 result = 1;
Ritor1
parents:
diff changeset
3379 }
Ritor1
parents:
diff changeset
3380 else
Ritor1
parents:
diff changeset
3381 {
Ritor1
parents:
diff changeset
3382 fclose(File);
Ritor1
parents:
diff changeset
3383 result = 0;
Ritor1
parents:
diff changeset
3384 }
Ritor1
parents:
diff changeset
3385 return result;
Ritor1
parents:
diff changeset
3386 }
Ritor1
parents:
diff changeset
3387
Ritor1
parents:
diff changeset
3388
Ritor1
parents:
diff changeset
3389
Ritor1
parents:
diff changeset
3390 //----- (00495366) --------------------------------------------------------
Ritor1
parents:
diff changeset
3391 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2)
Ritor1
parents:
diff changeset
3392 {
Ritor1
parents:
diff changeset
3393 int v2; // edi@1
Ritor1
parents:
diff changeset
3394 int v3; // edx@2
Ritor1
parents:
diff changeset
3395 int v4; // esi@3
Ritor1
parents:
diff changeset
3396 int v5; // ebx@5
Ritor1
parents:
diff changeset
3397 signed int v7; // [sp+Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
3398 signed int v8; // [sp+10h] [bp-10h]@1
Ritor1
parents:
diff changeset
3399 int **v9; // [sp+14h] [bp-Ch]@4
Ritor1
parents:
diff changeset
3400 signed int v10; // [sp+18h] [bp-8h]@3
Ritor1
parents:
diff changeset
3401 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
3402
Ritor1
parents:
diff changeset
3403 v2 = a1;
Ritor1
parents:
diff changeset
3404 v11 = a2;
Ritor1
parents:
diff changeset
3405 v8 = 0;
Ritor1
parents:
diff changeset
3406 v7 = 0;
Ritor1
parents:
diff changeset
3407 if ( dword_AE336C == a1 )
Ritor1
parents:
diff changeset
3408 {
Ritor1
parents:
diff changeset
3409 v3 = dword_AE3370;
Ritor1
parents:
diff changeset
3410 }
Ritor1
parents:
diff changeset
3411 else
Ritor1
parents:
diff changeset
3412 {
Ritor1
parents:
diff changeset
3413 v4 = a2;
Ritor1
parents:
diff changeset
3414 dword_AE336C = a1;
Ritor1
parents:
diff changeset
3415 v10 = 0;
Ritor1
parents:
diff changeset
3416 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 )
Ritor1
parents:
diff changeset
3417 goto LABEL_17;
Ritor1
parents:
diff changeset
3418 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4);
Ritor1
parents:
diff changeset
3419 do
Ritor1
parents:
diff changeset
3420 {
Ritor1
parents:
diff changeset
3421 v5 = tolower(*(char *)*v9);
Ritor1
parents:
diff changeset
3422 if ( v5 == tolower(v2) )
Ritor1
parents:
diff changeset
3423 {
Ritor1
parents:
diff changeset
3424 if ( v8 )
Ritor1
parents:
diff changeset
3425 v7 = v10;
Ritor1
parents:
diff changeset
3426 else
Ritor1
parents:
diff changeset
3427 v8 = v10;
Ritor1
parents:
diff changeset
3428 }
Ritor1
parents:
diff changeset
3429 ++v10;
Ritor1
parents:
diff changeset
3430 v9 += 2;
Ritor1
parents:
diff changeset
3431 }
Ritor1
parents:
diff changeset
3432 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] );
Ritor1
parents:
diff changeset
3433 if ( v8 && v8 != v7 )
Ritor1
parents:
diff changeset
3434 v3 = v8 + rand() % (v7 - v8);
Ritor1
parents:
diff changeset
3435 else
Ritor1
parents:
diff changeset
3436 LABEL_17:
Ritor1
parents:
diff changeset
3437 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
Ritor1
parents:
diff changeset
3438 }
Ritor1
parents:
diff changeset
3439 dword_AE3370 = v3;
Ritor1
parents:
diff changeset
3440 return pNPCStats->pNPCNames[0][v11 + 2 * v3];
Ritor1
parents:
diff changeset
3441 }
Ritor1
parents:
diff changeset
3442 // AE336C: using guessed type int dword_AE336C;
Ritor1
parents:
diff changeset
3443 // AE3370: using guessed type int dword_AE3370;
Ritor1
parents:
diff changeset
3444
Ritor1
parents:
diff changeset
3445 //----- (00495430) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
3446 char * GetReputationString( signed int a1 )
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
3447 {
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3448 if (a1 >= 25)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3449 return pGlobalTXT_LocalizationStrings[379]; // Hated
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3450 else if (a1 >= 6)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3451 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3452 else if (a1 >= -5)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3453 return pGlobalTXT_LocalizationStrings[399]; // Neutral;
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3454 else if (a1 >= -24)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3455 return pGlobalTXT_LocalizationStrings[402]; // Friendly
0
Ritor1
parents:
diff changeset
3456 else
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3457 return pGlobalTXT_LocalizationStrings[434]; // Respected;
0
Ritor1
parents:
diff changeset
3458 }
Ritor1
parents:
diff changeset
3459
Ritor1
parents:
diff changeset
3460 //----- (00495461) --------------------------------------------------------
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3461 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
0
Ritor1
parents:
diff changeset
3462 {
Ritor1
parents:
diff changeset
3463 unsigned __int8 v6; // bl@1
Ritor1
parents:
diff changeset
3464 Player *pPlayer; // ebx@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3465 //NPCData *v9; // eax@4
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3466 //size_t v10; // eax@6
0
Ritor1
parents:
diff changeset
3467 char *v11; // esi@7
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3468 //int v12; // edx@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3469 //ItemGen *v13; // edi@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3470 //char v14; // cl@8
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3471 //char *v15; // ecx@10
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3472 //int v16; // edx@10
0
Ritor1
parents:
diff changeset
3473 int v17; // eax@10
Ritor1
parents:
diff changeset
3474 signed __int64 v18; // qax@18
Ritor1
parents:
diff changeset
3475 unsigned int v19; // edi@32
Ritor1
parents:
diff changeset
3476 unsigned __int8 *v20; // ebx@32
Ritor1
parents:
diff changeset
3477 int v21; // ecx@34
Ritor1
parents:
diff changeset
3478 __int16 v22; // ax@34
Ritor1
parents:
diff changeset
3479 int v23; // edx@39
Ritor1
parents:
diff changeset
3480 int v24; // eax@39
Ritor1
parents:
diff changeset
3481 int v25; // eax@45
Ritor1
parents:
diff changeset
3482 float *v26; // esi@68
Ritor1
parents:
diff changeset
3483 float v27; // ST18_4@68
Ritor1
parents:
diff changeset
3484 signed int v28; // eax@68
Ritor1
parents:
diff changeset
3485 int v29; // eax@68
Ritor1
parents:
diff changeset
3486 float v30; // ST18_4@72
Ritor1
parents:
diff changeset
3487 signed int v31; // eax@72
Ritor1
parents:
diff changeset
3488 float v32; // ST18_4@74
Ritor1
parents:
diff changeset
3489 signed int v33; // eax@74
Ritor1
parents:
diff changeset
3490 double v34; // st7@75
Ritor1
parents:
diff changeset
3491 float v35; // ST18_4@76
Ritor1
parents:
diff changeset
3492 signed int v36; // eax@76
Ritor1
parents:
diff changeset
3493 float *v37; // esi@78
Ritor1
parents:
diff changeset
3494 float v38; // ST18_4@78
Ritor1
parents:
diff changeset
3495 int v39; // eax@78
Ritor1
parents:
diff changeset
3496 float v40; // ST18_4@82
Ritor1
parents:
diff changeset
3497 int v41; // eax@82
Ritor1
parents:
diff changeset
3498 float v42; // ST18_4@83
Ritor1
parents:
diff changeset
3499 int v43; // eax@83
Ritor1
parents:
diff changeset
3500 float v44; // ST18_4@85
Ritor1
parents:
diff changeset
3501 int v45; // eax@85
Ritor1
parents:
diff changeset
3502 const char *v46; // eax@86
Ritor1
parents:
diff changeset
3503 unsigned int v47; // eax@87
Ritor1
parents:
diff changeset
3504 float v48; // ST18_4@97
Ritor1
parents:
diff changeset
3505 __int64 v49; // ST14_8@107
Ritor1
parents:
diff changeset
3506 int v50; // eax@107
Ritor1
parents:
diff changeset
3507 int v51; // eax@108
Ritor1
parents:
diff changeset
3508 Player *v52; // eax@109
Ritor1
parents:
diff changeset
3509 int v53; // [sp-4h] [bp-13Ch]@107
Ritor1
parents:
diff changeset
3510 int v54; // [sp+0h] [bp-138h]@107
Ritor1
parents:
diff changeset
3511 __int16 v55[56]; // [sp+10h] [bp-128h]@34
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3512 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3513 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
0
Ritor1
parents:
diff changeset
3514 char a1[100]; // [sp+B8h] [bp-80h]@3
Ritor1
parents:
diff changeset
3515 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3516 //size_t v60; // [sp+120h] [bp-18h]@3
249
Nomad
parents: 248
diff changeset
3517 //Player *v61; // [sp+124h] [bp-14h]@3
Nomad
parents: 248
diff changeset
3518 //char *Str; // [sp+128h] [bp-10h]@1
0
Ritor1
parents:
diff changeset
3519 int v63; // [sp+12Ch] [bp-Ch]@32
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3520 //int v64; // [sp+130h] [bp-8h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3521 //NPCData *v65; // [sp+134h] [bp-4h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3522 //int packed;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3523
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3524
0
Ritor1
parents:
diff changeset
3525
Ritor1
parents:
diff changeset
3526 v6 = uPlayerID;
249
Nomad
parents: 248
diff changeset
3527 //Str = lpsz;
0
Ritor1
parents:
diff changeset
3528 if ( IsBadStringPtrA(lpsz, 1u) )
Ritor1
parents:
diff changeset
3529 return "Invalid String Passed";
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3530
0
Ritor1
parents:
diff changeset
3531 a1[0] = 0;
Ritor1
parents:
diff changeset
3532 pPlayer = &pParty->pPlayers[v6];
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
3533 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
249
Nomad
parents: 248
diff changeset
3534 //v61 = pPlayer;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3535 memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3536
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3537 NPCData *npc = nullptr;
0
Ritor1
parents:
diff changeset
3538 if ( dword_5C35D4 )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
3539 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
3540 //__debugbreak(); // fix
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
3541 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
3542 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3543 else
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
3544 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3545 //v65 = v9;
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3546 //v10 = 0;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3547 //v64 = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3548
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3549 //int i = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3550 //if ( (signed int)v60 > 0 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3551 v11 = a4;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3552
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3553 auto len = strlen(lpsz);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3554 for (int i = 0, dst = 0; i < len; ++i)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3555 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3556 //v12 = v64;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3557 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3558 //while ( 1 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3559 //{
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3560 char c = lpsz[i];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3561 if (c != '%')
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3562 pTmpBuf2[dst++] = c;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3563 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3564 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3565 //v15 = &lpsz[v12 + 1];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3566 //v16 = (unsigned __int8)lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3567 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3568 //v17 = packed - 528;// 10 * '0' + '0'
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3569 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
3570
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3571 switch ( v17 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3572 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3573 case 1:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3574 v11 = npc->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3575 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3576 case 2:
0
Ritor1
parents:
diff changeset
3577 v11 = pPlayer->pName;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3578 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3579 case 3:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3580 case 4:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3581 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3582 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3583 case 5:
0
Ritor1
parents:
diff changeset
3584 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
Ritor1
parents:
diff changeset
3585 v11 = pGlobalTXT_LocalizationStrings[397];// "evening"
Ritor1
parents:
diff changeset
3586 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
Ritor1
parents:
diff changeset
3587 {
Ritor1
parents:
diff changeset
3588 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB )
Ritor1
parents:
diff changeset
3589 {
Ritor1
parents:
diff changeset
3590 if ( v18 < 20 )
Ritor1
parents:
diff changeset
3591 v11 = pGlobalTXT_LocalizationStrings[396];// "day"
Ritor1
parents:
diff changeset
3592 }
Ritor1
parents:
diff changeset
3593 else
Ritor1
parents:
diff changeset
3594 {
Ritor1
parents:
diff changeset
3595 v11 = pGlobalTXT_LocalizationStrings[395];// "morning"
Ritor1
parents:
diff changeset
3596 }
Ritor1
parents:
diff changeset
3597 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3598 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3599 case 6:
0
Ritor1
parents:
diff changeset
3600 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
3601 v11 = pGlobalTXT_LocalizationStrings[387];// "lady"
Ritor1
parents:
diff changeset
3602 else
Ritor1
parents:
diff changeset
3603 v11 = pGlobalTXT_LocalizationStrings[385];// "sir"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3604 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3605 case 7:
0
Ritor1
parents:
diff changeset
3606 if ( pPlayer->uSex )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3607 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3608 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3609 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3610 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3611 case 8:
0
Ritor1
parents:
diff changeset
3612 v19 = 0;
Ritor1
parents:
diff changeset
3613 v63 = 0;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3614 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
0
Ritor1
parents:
diff changeset
3615 do
Ritor1
parents:
diff changeset
3616 {
Ritor1
parents:
diff changeset
3617 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) )
Ritor1
parents:
diff changeset
3618 {
Ritor1
parents:
diff changeset
3619 v21 = v63;
Ritor1
parents:
diff changeset
3620 v22 = word_4EE150[v19];
Ritor1
parents:
diff changeset
3621 ++v63;
Ritor1
parents:
diff changeset
3622 v55[v21] = v22;
Ritor1
parents:
diff changeset
3623 }
Ritor1
parents:
diff changeset
3624 ++v19;
Ritor1
parents:
diff changeset
3625 }
Ritor1
parents:
diff changeset
3626 while ( v19 < 28 );
Ritor1
parents:
diff changeset
3627 if ( v63 )
Ritor1
parents:
diff changeset
3628 {
Ritor1
parents:
diff changeset
3629 v23 = rand() % v63;
Ritor1
parents:
diff changeset
3630 v24 = dword_A74CDC;
Ritor1
parents:
diff changeset
3631 if ( dword_A74CDC == -1 )
Ritor1
parents:
diff changeset
3632 {
Ritor1
parents:
diff changeset
3633 v24 = v23;
Ritor1
parents:
diff changeset
3634 dword_A74CDC = v23;
Ritor1
parents:
diff changeset
3635 }
492
Gloval
parents: 487
diff changeset
3636 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
0
Ritor1
parents:
diff changeset
3637 }
Ritor1
parents:
diff changeset
3638 else
Ritor1
parents:
diff changeset
3639 {
Ritor1
parents:
diff changeset
3640 v11 = (char *)pNPCTopics[55].pText;
Ritor1
parents:
diff changeset
3641 }
249
Nomad
parents: 248
diff changeset
3642 //pPlayer = v61;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3643 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3644 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3645 case 9:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3646 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3647 v11 = pGlobalTXT_LocalizationStrings[384];// "her"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3648 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3649 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3650 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3651 case 10:
0
Ritor1
parents:
diff changeset
3652 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
3653 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
Ritor1
parents:
diff changeset
3654 else
Ritor1
parents:
diff changeset
3655 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3656 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3657 case 11:
0
Ritor1
parents:
diff changeset
3658 v25 = GetPartyReputation();
Ritor1
parents:
diff changeset
3659 goto LABEL_46;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3660 case 12:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3661 v25 = npc->rep;
0
Ritor1
parents:
diff changeset
3662 LABEL_46:
Ritor1
parents:
diff changeset
3663 if ( v25 >= 25 )
Ritor1
parents:
diff changeset
3664 {
Ritor1
parents:
diff changeset
3665 v11 = pGlobalTXT_LocalizationStrings[379];
Ritor1
parents:
diff changeset
3666 }
Ritor1
parents:
diff changeset
3667 else
Ritor1
parents:
diff changeset
3668 {
Ritor1
parents:
diff changeset
3669 if ( v25 < 6 )
Ritor1
parents:
diff changeset
3670 {
Ritor1
parents:
diff changeset
3671 if ( v25 >= -5 )
Ritor1
parents:
diff changeset
3672 {
Ritor1
parents:
diff changeset
3673 v11 = pGlobalTXT_LocalizationStrings[399];
Ritor1
parents:
diff changeset
3674 }
Ritor1
parents:
diff changeset
3675 else
Ritor1
parents:
diff changeset
3676 {
Ritor1
parents:
diff changeset
3677 if ( v25 < -24 )
Ritor1
parents:
diff changeset
3678 v11 = pGlobalTXT_LocalizationStrings[434];
Ritor1
parents:
diff changeset
3679 else
Ritor1
parents:
diff changeset
3680 v11 = pGlobalTXT_LocalizationStrings[402];
Ritor1
parents:
diff changeset
3681 }
Ritor1
parents:
diff changeset
3682 }
Ritor1
parents:
diff changeset
3683 else
Ritor1
parents:
diff changeset
3684 {
Ritor1
parents:
diff changeset
3685 v11 = pGlobalTXT_LocalizationStrings[392];
Ritor1
parents:
diff changeset
3686 }
Ritor1
parents:
diff changeset
3687 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3688 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3689 case 13:
0
Ritor1
parents:
diff changeset
3690 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3691 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3692 case 14:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3693 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3694 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3695 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3696 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3697 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3698 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3699 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3700
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3701 case 15:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3702 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3703 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3704 _continue_strcat:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3705 strcat(pTmpBuf2, v11);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3706 dst = strlen(pTmpBuf2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3707 //v64 += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3708 i += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3709 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3710 break;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3711
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3712 case 16:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3713 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3714 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3715 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3716 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3717 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3718 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3719 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3720 case 17:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3721 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3722 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
3723 if (!pay_percentage)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3724 pay_percentage = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3725
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3726 sprintf(a1, "%lu", pay_percentage);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3727 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3728 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3729 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3730
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3731 case 18:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3732 case 19:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3733 case 20:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3734 case 21:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3735 case 22:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3736 case 26:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3737 _continue_strncpy:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3738 strncpy(a1, lpsz + i + 1, 2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3739 v51 = atoi(a1);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3740 sprintf(a1, "%lu", v51);
0
Ritor1
parents:
diff changeset
3741 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3742 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3743
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3744 case 23:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3745 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3746 v47 = pMapStats->GetMapInfo(pCurrentMapName);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3747 if ( v47 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3748 v11 = pMapStats->pInfos[v47].pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3749 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3750 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3751 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3752 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3753 case 24:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3754 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3755 v46 = a3->GetDisplayName();
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3756 sprintf(a1, format_4E2D80, v59, v46);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3757 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3758 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3759 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3760
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3761
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3762 case 25:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3763 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3764 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3765 v38 = *v37;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3766 v39 = a3->GetValue();
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3767 v29 = pPlayer->_4B8233(v39, v38);
0
Ritor1
parents:
diff changeset
3768 switch ( a5 )
Ritor1
parents:
diff changeset
3769 {
Ritor1
parents:
diff changeset
3770 case 3:
Ritor1
parents:
diff changeset
3771 v44 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3772 v45 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3773 v29 = pPlayer->_4B8213(v45, v44);
Ritor1
parents:
diff changeset
3774 break;
Ritor1
parents:
diff changeset
3775 case 4:
Ritor1
parents:
diff changeset
3776 v29 = pPlayer->_4B824B(*v37);
Ritor1
parents:
diff changeset
3777 break;
Ritor1
parents:
diff changeset
3778 case 5:
Ritor1
parents:
diff changeset
3779 v42 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3780 v43 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3781 v29 = pPlayer->_4B8265(v43, v42);
Ritor1
parents:
diff changeset
3782 break;
Ritor1
parents:
diff changeset
3783 case 6:
Ritor1
parents:
diff changeset
3784 v40 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3785 v41 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3786 v29 = pPlayer->_4B8213(v41, v40) / 2;
Ritor1
parents:
diff changeset
3787 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3788 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3789 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3790 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3791
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3792 case 27:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3793 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3794 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
0
Ritor1
parents:
diff changeset
3795 v27 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3796 v28 = a3->GetValue();
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
3797 v29 = pPlayer->GetBuyingPrice(v28, v27);
0
Ritor1
parents:
diff changeset
3798 if ( a5 == 3 )
Ritor1
parents:
diff changeset
3799 {
Ritor1
parents:
diff changeset
3800 v35 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3801 v36 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3802 v29 = pPlayer->_4B8102(v36, v35);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
3803 if (a3->Broken())
0
Ritor1
parents:
diff changeset
3804 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3805 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
3806 }
Ritor1
parents:
diff changeset
3807 if ( a5 != 4 )
Ritor1
parents:
diff changeset
3808 {
Ritor1
parents:
diff changeset
3809 if ( a5 == 5 )
Ritor1
parents:
diff changeset
3810 {
Ritor1
parents:
diff changeset
3811 v32 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3812 v33 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3813 v29 = pPlayer->_4B81C3(v33, v32);
Ritor1
parents:
diff changeset
3814 }
Ritor1
parents:
diff changeset
3815 else
Ritor1
parents:
diff changeset
3816 {
Ritor1
parents:
diff changeset
3817 if ( a5 == 6 )
Ritor1
parents:
diff changeset
3818 {
Ritor1
parents:
diff changeset
3819 v30 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3820 v31 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3821 v29 = pPlayer->_4B8102(v31, v30) / 2;
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
3822 if (a3->Broken())
0
Ritor1
parents:
diff changeset
3823 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3824 if (!v29)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3825 v29 = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3826 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
3827 }
Ritor1
parents:
diff changeset
3828 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3829 _continue_sprintf:
0
Ritor1
parents:
diff changeset
3830 sprintf(a1, "%lu", v29);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3831 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3832 goto _continue_strcat;
0
Ritor1
parents:
diff changeset
3833 }
Ritor1
parents:
diff changeset
3834 v34 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3835
0
Ritor1
parents:
diff changeset
3836 v48 = v34;
Ritor1
parents:
diff changeset
3837 v29 = pPlayer->_4B8179(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3838 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3839 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3840
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3841 case 28:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3842 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3843 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3844 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3845 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3846 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3847
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3848 case 29:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3849 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3850 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3851 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3852 v48 = v34;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3853 v29 = pPlayer->_4B8179(v48);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3854 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3855 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3856
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3857 case 30:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3858 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3859 if ( !a6 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3860 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3861 sub_493F79(&v57, *a6);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3862 v54 = v57.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3863 v53 = v57.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3864 v50 = v57.field_14_exprie_month;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3865 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3866 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3867 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3868 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3869
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3870 case 31:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3871 case 32:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3872 case 33:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3873 case 34:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3874 v52 = &pParty->pPlayers[v17 - 31];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3875 v11 = v52->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3876 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3877
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3878 default:
0
Ritor1
parents:
diff changeset
3879 if ( v17 <= 50 || v17 > 70 )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3880 goto _continue_strncpy;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3881 if ( v17 - 51 >= 20 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3882 goto _continue_strcat;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3883 v49 = pParty->field_3C._s_times[v17-51];
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3884
0
Ritor1
parents:
diff changeset
3885 sub_493F79(&v56, v49);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3886 v54 = v56.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3887 v53 = v56.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3888 v50 = v56.field_14_exprie_month;
0
Ritor1
parents:
diff changeset
3889 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3890 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3891 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3892 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3893 }
0
Ritor1
parents:
diff changeset
3894 }
Ritor1
parents:
diff changeset
3895 return pTmpBuf2;
Ritor1
parents:
diff changeset
3896 }
Ritor1
parents:
diff changeset
3897
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 704
diff changeset
3898
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 704
diff changeset
3899
0
Ritor1
parents:
diff changeset
3900
Ritor1
parents:
diff changeset
3901 //----- (0049B04D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3902 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
0
Ritor1
parents:
diff changeset
3903 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3904 //stru154 *v3; // edi@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3905 //signed int v4; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3906 //signed int result; // eax@9
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3907 //signed int v6; // [sp-8h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
3908 Vec3_float_ v; // [sp+4h] [bp-Ch]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3909 float v7;
0
Ritor1
parents:
diff changeset
3910
Ritor1
parents:
diff changeset
3911 v.x = 0.0;
Ritor1
parents:
diff changeset
3912 v.y = 0.0;
Ritor1
parents:
diff changeset
3913 v.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3914 GetFacePlane(a2, a3, &v, &v7);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3915
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3916 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3917 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3918 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3919 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3920 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
3921 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3922 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3923
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3924 face_plane.vNormal.x = v.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3925 face_plane.vNormal.y = v.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3926 face_plane.vNormal.z = v.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3927 face_plane.dist = v7;
0
Ritor1
parents:
diff changeset
3928 }
Ritor1
parents:
diff changeset
3929
Ritor1
parents:
diff changeset
3930 //----- (0049B0C9) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3931 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
0
Ritor1
parents:
diff changeset
3932 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3933 if (fabsf(pNormal->z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3934 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3935 else if (fabsf(pNormal->x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3936 fabsf(pNormal->y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3937 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
3938 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3939 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3940
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3941 face_plane.vNormal.x = pNormal->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3942 face_plane.dist = dist;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3943 face_plane.vNormal.y = pNormal->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3944 face_plane.vNormal.z = pNormal->z;
0
Ritor1
parents:
diff changeset
3945 }
Ritor1
parents:
diff changeset
3946
Ritor1
parents:
diff changeset
3947 //----- (0049B13D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3948 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
0
Ritor1
parents:
diff changeset
3949 {
Ritor1
parents:
diff changeset
3950 ODMFace *v5; // ebx@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3951 //int v6; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3952 //unsigned __int16 *v7; // ebx@2
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3953 //Vec3_int_ *v8; // eax@3
0
Ritor1
parents:
diff changeset
3954 Vec3_int_ *v9; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3955 //double v10; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3956 //int v11; // ecx@3
0
Ritor1
parents:
diff changeset
3957 Vec3_int_ *v12; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3958 //double v13; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3959 //double v14; // st6@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3960 //double v15; // st5@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3961 //int v16; // ecx@3
0
Ritor1
parents:
diff changeset
3962 Vec3_int_ *v17; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3963 //double v18; // st5@3
0
Ritor1
parents:
diff changeset
3964 Vec3_float_ *v19; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3965 //int result; // eax@8
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3966 //float v21; // ecx@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3967 //double v22; // st7@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3968 //double v23; // st6@10
0
Ritor1
parents:
diff changeset
3969 Vec3_float_ v2; // [sp+4h] [bp-64h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3970 //float v25; // [sp+18h] [bp-50h]@3
0
Ritor1
parents:
diff changeset
3971 float v26; // [sp+1Ch] [bp-4Ch]@3
Ritor1
parents:
diff changeset
3972 float v27; // [sp+20h] [bp-48h]@3
Ritor1
parents:
diff changeset
3973 float v28; // [sp+24h] [bp-44h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3974 //float v29; // [sp+2Ch] [bp-3Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3975 //float v30; // [sp+30h] [bp-38h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3976 //float v31; // [sp+34h] [bp-34h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3977 //float v32; // [sp+38h] [bp-30h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3978 //float v33; // [sp+3Ch] [bp-2Ch]@3
0
Ritor1
parents:
diff changeset
3979 Vec3_float_ v1; // [sp+40h] [bp-28h]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3980 //float v35; // [sp+4Ch] [bp-1Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3981 //float v36; // [sp+50h] [bp-18h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3982 //float v37; // [sp+54h] [bp-14h]@3
0
Ritor1
parents:
diff changeset
3983 Vec3_float_ v38; // [sp+58h] [bp-10h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3984 //int v39; // [sp+64h] [bp-4h]@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3985
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3986 //v39 = 0;
0
Ritor1
parents:
diff changeset
3987 v1.x = 0.0;
Ritor1
parents:
diff changeset
3988 v5 = pFace;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3989 //v6 = pFace->uNumVertices;
0
Ritor1
parents:
diff changeset
3990 v1.y = 0.0;
Ritor1
parents:
diff changeset
3991 v1.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3992
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3993 if (pFace->uNumVertices >= 2)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3994 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3995 int i = 0;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3996 while ( i < pFace->uNumVertices - 2 )
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3997 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3998 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3999 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4000 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4001
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4002 v1.x = v12->x - v9->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4003 v26 = v17->x - v12->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4004 v1.y = v12->y - v9->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4005 v27 = v17->y - v12->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4006 v1.z = v12->z - v9->z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4007 v28 = v17->z - v12->z;
0
Ritor1
parents:
diff changeset
4008 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
Ritor1
parents:
diff changeset
4009 v38.x = v19->x;
Ritor1
parents:
diff changeset
4010 v38.y = v19->y;
Ritor1
parents:
diff changeset
4011 v38.z = v19->z;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4012 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4013 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4014 v38.Normalize();
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4015
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4016 pOutNormal->x = v38.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4017 pOutNormal->y = v38.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4018 pOutNormal->z = v38.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4019
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4020 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4021 return;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4022 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4023 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4024 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4025
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4026 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4027 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4028 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
4029 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
0
Ritor1
parents:
diff changeset
4030 }
Ritor1
parents:
diff changeset
4031
Ritor1
parents:
diff changeset
4032
Ritor1
parents:
diff changeset
4033
Ritor1
parents:
diff changeset
4034
Ritor1
parents:
diff changeset
4035
Ritor1
parents:
diff changeset
4036 //----- (0049D700) --------------------------------------------------------
Ritor1
parents:
diff changeset
4037 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
Ritor1
parents:
diff changeset
4038 {
Ritor1
parents:
diff changeset
4039 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
4040 int v2; // ecx@1
Ritor1
parents:
diff changeset
4041 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
4042
Ritor1
parents:
diff changeset
4043 v1 = uDim;
Ritor1
parents:
diff changeset
4044 v2 = 0;
Ritor1
parents:
diff changeset
4045 v3 = v1 - 1;
Ritor1
parents:
diff changeset
4046 while ( v3 & 1 )
Ritor1
parents:
diff changeset
4047 {
Ritor1
parents:
diff changeset
4048 v3 >>= 1;
Ritor1
parents:
diff changeset
4049 ++v2;
Ritor1
parents:
diff changeset
4050 }
Ritor1
parents:
diff changeset
4051 return v3 == 0 ? v2 : 0;
Ritor1
parents:
diff changeset
4052 }
Ritor1
parents:
diff changeset
4053
Ritor1
parents:
diff changeset
4054
Ritor1
parents:
diff changeset
4055
Ritor1
parents:
diff changeset
4056
Ritor1
parents:
diff changeset
4057
Ritor1
parents:
diff changeset
4058
Ritor1
parents:
diff changeset
4059
Ritor1
parents:
diff changeset
4060
Ritor1
parents:
diff changeset
4061
Ritor1
parents:
diff changeset
4062
Ritor1
parents:
diff changeset
4063 //----- (004A19D8) --------------------------------------------------------
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4064 unsigned int BlendColors(unsigned int a1, unsigned int a2)
0
Ritor1
parents:
diff changeset
4065 {
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4066 /*signed __int64 v2; // ST10_8@1
0
Ritor1
parents:
diff changeset
4067 double v3; // st7@1
Ritor1
parents:
diff changeset
4068 float v4; // ST24_4@1
Ritor1
parents:
diff changeset
4069 double v5; // ST10_8@1
Ritor1
parents:
diff changeset
4070 int v6; // ST1C_4@1
Ritor1
parents:
diff changeset
4071 float v7; // ST24_4@1
Ritor1
parents:
diff changeset
4072 double v8; // ST10_8@1
Ritor1
parents:
diff changeset
4073 unsigned __int8 v9; // ST20_1@1
Ritor1
parents:
diff changeset
4074 float v10; // ST24_4@1
Ritor1
parents:
diff changeset
4075 double v11; // ST10_8@1
Ritor1
parents:
diff changeset
4076 float v12; // ST24_4@1
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4077 double v13; // ST08_8@1*/
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4078
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4079 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4080 (a2 >> 24) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4081 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4082 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4083 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4084 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4085 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4086 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f);
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4087 return (alpha << 24) | (red << 16) | (green << 8) | blue;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4088 /*v2 = a1 >> 24;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4089 v3 = (double)v2 / 255.0f;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4090 HIDWORD(v2) = 0;
0
Ritor1
parents:
diff changeset
4091 LODWORD(v2) = a2 >> 24;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4092 v4 = v3 * (double)v2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
4093 v5 = v4 + 6.7553994e15;
Ritor1
parents:
diff changeset
4094 v6 = LODWORD(v5);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4095 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0;
0
Ritor1
parents:
diff changeset
4096 v8 = v7 + 6.7553994e15;
Ritor1
parents:
diff changeset
4097 v9 = LOBYTE(v8);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4098 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
4099 v11 = v10 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4100 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
4101 v13 = v12 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
4102 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
0
Ritor1
parents:
diff changeset
4103 }
Ritor1
parents:
diff changeset
4104
Ritor1
parents:
diff changeset
4105
Ritor1
parents:
diff changeset
4106
Ritor1
parents:
diff changeset
4107 //----- (004A46E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
4108 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
4109 {
Ritor1
parents:
diff changeset
4110 int v5; // eax@1
Ritor1
parents:
diff changeset
4111 int z; // eax@1
Ritor1
parents:
diff changeset
4112 unsigned int v7; // eax@9
Ritor1
parents:
diff changeset
4113 unsigned int v8; // ecx@9
Ritor1
parents:
diff changeset
4114 int v9; // eax@9
Ritor1
parents:
diff changeset
4115 unsigned int v10; // eax@10
Ritor1
parents:
diff changeset
4116 int *v11; // esi@10
Ritor1
parents:
diff changeset
4117 int *v12; // edi@10
Ritor1
parents:
diff changeset
4118 int v13; // ecx@10
Ritor1
parents:
diff changeset
4119 int v14; // edx@10
Ritor1
parents:
diff changeset
4120 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
4121 int *v16; // esi@22
Ritor1
parents:
diff changeset
4122 int *v17; // edi@22
Ritor1
parents:
diff changeset
4123 int v18; // ecx@22
Ritor1
parents:
diff changeset
4124 int v19; // edx@22
Ritor1
parents:
diff changeset
4125 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9
Ritor1
parents:
diff changeset
4126 int *pTargetZ; // [sp+10h] [bp-4h]@9
Ritor1
parents:
diff changeset
4127 unsigned int v22; // [sp+1Ch] [bp+8h]@9
Ritor1
parents:
diff changeset
4128 signed int v23; // [sp+20h] [bp+Ch]@1
Ritor1
parents:
diff changeset
4129
Ritor1
parents:
diff changeset
4130 v5 = a4;
Ritor1
parents:
diff changeset
4131 v23 = _z >> 16;
Ritor1
parents:
diff changeset
4132 z = x + v5;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4133 if ( z >= (signed int)pViewport->uViewportTL_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4134 && (signed int)x <= (signed int)pViewport->uViewportBR_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4135 && y >= (signed int)pViewport->uViewportTL_Y
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4136 && y <= (signed int)pViewport->uViewportBR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4137 {
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4138 if ( (signed int)x < (signed int)pViewport->uViewportTL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4139 x = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4140 if ( z > (signed int)pViewport->uViewportBR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4141 z = pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
4142 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
4143 v22 = z - x;
Ritor1
parents:
diff changeset
4144 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y];
Ritor1
parents:
diff changeset
4145 v7 = lightColor >> 3;
Ritor1
parents:
diff changeset
4146 v8 = lightColor & 0xF0;
Ritor1
parents:
diff changeset
4147 v9 = v7 & 0x1E0000;
Ritor1
parents:
diff changeset
4148 if ( pRenderer->uTargetGBits == 5 )
Ritor1
parents:
diff changeset
4149 {
Ritor1
parents:
diff changeset
4150 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4;
Ritor1
parents:
diff changeset
4151 v11 = (int *)pTarget;
Ritor1
parents:
diff changeset
4152 v12 = pTargetZ;
Ritor1
parents:
diff changeset
4153 v13 = v22;
Ritor1
parents:
diff changeset
4154 v14 = (v10 << 16) | v10;
Ritor1
parents:
diff changeset
4155 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
4156 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
4157 {
Ritor1
parents:
diff changeset
4158 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
4159 if ( z > v23 )
Ritor1
parents:
diff changeset
4160 {
Ritor1
parents:
diff changeset
4161 z = v14 + ((*pTarget & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
4162 *pTarget = z;
Ritor1
parents:
diff changeset
4163 }
Ritor1
parents:
diff changeset
4164 v13 = v22 - 1;
Ritor1
parents:
diff changeset
4165 v11 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
4166 v12 = pTargetZ + 1;
Ritor1
parents:
diff changeset
4167 }
Ritor1
parents:
diff changeset
4168 while ( v13 != 1 )
Ritor1
parents:
diff changeset
4169 {
Ritor1
parents:
diff changeset
4170 if ( v13 < 1 )
Ritor1
parents:
diff changeset
4171 return z;
Ritor1
parents:
diff changeset
4172 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
4173 if ( z <= v23 )
Ritor1
parents:
diff changeset
4174 {
Ritor1
parents:
diff changeset
4175 v13 -= 2;
Ritor1
parents:
diff changeset
4176 ++v11;
Ritor1
parents:
diff changeset
4177 v12 += 2;
Ritor1
parents:
diff changeset
4178 }
Ritor1
parents:
diff changeset
4179 else
Ritor1
parents:
diff changeset
4180 {
Ritor1
parents:
diff changeset
4181 v12 += 2;
Ritor1
parents:
diff changeset
4182 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1);
Ritor1
parents:
diff changeset
4183 v13 -= 2;
Ritor1
parents:
diff changeset
4184 *v11 = z;
Ritor1
parents:
diff changeset
4185 ++v11;
Ritor1
parents:
diff changeset
4186 }
Ritor1
parents:
diff changeset
4187 }
Ritor1
parents:
diff changeset
4188 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
4189 if ( z > v23 )
Ritor1
parents:
diff changeset
4190 {
Ritor1
parents:
diff changeset
4191 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
4192 *(short *)v11 = z;
Ritor1
parents:
diff changeset
4193 }
Ritor1
parents:
diff changeset
4194 }
Ritor1
parents:
diff changeset
4195 else
Ritor1
parents:
diff changeset
4196 {
Ritor1
parents:
diff changeset
4197 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4;
Ritor1
parents:
diff changeset
4198 v16 = (int *)pTarget;
Ritor1
parents:
diff changeset
4199 v17 = pTargetZ;
Ritor1
parents:
diff changeset
4200 v18 = v22;
Ritor1
parents:
diff changeset
4201 v19 = (v15 << 16) | v15;
Ritor1
parents:
diff changeset
4202 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
4203 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
4204 {
Ritor1
parents:
diff changeset
4205 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
4206 if ( z > v23 )
Ritor1
parents:
diff changeset
4207 {
Ritor1
parents:
diff changeset
4208 z = v19 + ((*pTarget & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
4209 *pTarget = z;
Ritor1
parents:
diff changeset
4210 }
Ritor1
parents:
diff changeset
4211 v18 = v22 - 1;
Ritor1
parents:
diff changeset
4212 v16 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
4213 v17 = pTargetZ + 1;
Ritor1
parents:
diff changeset
4214 }
Ritor1
parents:
diff changeset
4215 while ( v18 != 1 )
Ritor1
parents:
diff changeset
4216 {
Ritor1
parents:
diff changeset
4217 if ( v18 < 1 )
Ritor1
parents:
diff changeset
4218 return z;
Ritor1
parents:
diff changeset
4219 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
4220 if ( z <= v23 )
Ritor1
parents:
diff changeset
4221 {
Ritor1
parents:
diff changeset
4222 v18 -= 2;
Ritor1
parents:
diff changeset
4223 ++v16;
Ritor1
parents:
diff changeset
4224 v17 += 2;
Ritor1
parents:
diff changeset
4225 }
Ritor1
parents:
diff changeset
4226 else
Ritor1
parents:
diff changeset
4227 {
Ritor1
parents:
diff changeset
4228 v17 += 2;
Ritor1
parents:
diff changeset
4229 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1);
Ritor1
parents:
diff changeset
4230 v18 -= 2;
Ritor1
parents:
diff changeset
4231 *v16 = z;
Ritor1
parents:
diff changeset
4232 ++v16;
Ritor1
parents:
diff changeset
4233 }
Ritor1
parents:
diff changeset
4234 }
Ritor1
parents:
diff changeset
4235 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
4236 if ( z > v23 )
Ritor1
parents:
diff changeset
4237 {
Ritor1
parents:
diff changeset
4238 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
4239 *(short *)v16 = z;
Ritor1
parents:
diff changeset
4240 }
Ritor1
parents:
diff changeset
4241 }
Ritor1
parents:
diff changeset
4242 }
Ritor1
parents:
diff changeset
4243 return z;
Ritor1
parents:
diff changeset
4244 }
Ritor1
parents:
diff changeset
4245
Ritor1
parents:
diff changeset
4246
Ritor1
parents:
diff changeset
4247 //----- (004A57E9) --------------------------------------------------------
Ritor1
parents:
diff changeset
4248 void __cdecl Present_ColorKey()
Ritor1
parents:
diff changeset
4249 {
Ritor1
parents:
diff changeset
4250 HRESULT v0; // eax@3
Ritor1
parents:
diff changeset
4251 HRESULT v1; // eax@3
Ritor1
parents:
diff changeset
4252 HRESULT v2; // eax@3
Ritor1
parents:
diff changeset
4253 HRESULT v3; // eax@3
Ritor1
parents:
diff changeset
4254 HRESULT v4; // eax@3
Ritor1
parents:
diff changeset
4255 RECT a2; // [sp+4h] [bp-14h]@3
Ritor1
parents:
diff changeset
4256 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
4257
Ritor1
parents:
diff changeset
4258 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
4259 {
Ritor1
parents:
diff changeset
4260 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
4261 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4262 a2.bottom = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4263 a2.left = 0;
Ritor1
parents:
diff changeset
4264 a2.top = 0;
Ritor1
parents:
diff changeset
4265 a2.right = 640;
Ritor1
parents:
diff changeset
4266 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u));
Ritor1
parents:
diff changeset
4267 a2.right = 640;
Ritor1
parents:
diff changeset
4268 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4269 a2.top = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4270 a2.bottom = 480;
Ritor1
parents:
diff changeset
4271 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
4272 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4273 pViewport->uViewportBR_Y + 1,
0
Ritor1
parents:
diff changeset
4274 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4275 &a2,
Ritor1
parents:
diff changeset
4276 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4277 a2.right = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4278 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4279 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4280 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4281 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
4282 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4283 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4284 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4285 &a2,
Ritor1
parents:
diff changeset
4286 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4287 a2.left = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4288 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4289 a2.right = 640;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4290 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4291 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4292 pViewport->uViewportBR_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4293 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4294 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4295 &a2,
Ritor1
parents:
diff changeset
4296 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4297 a2.right = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4298 a2.bottom = pViewport->uViewportBR_Y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4299 a2.left = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4300 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4301 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4302 pViewport->uViewportTL_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4303 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4304 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4305 &a2,
Ritor1
parents:
diff changeset
4306 17u));
Ritor1
parents:
diff changeset
4307 }
Ritor1
parents:
diff changeset
4308 }
Ritor1
parents:
diff changeset
4309 }
Ritor1
parents:
diff changeset
4310
Ritor1
parents:
diff changeset
4311 //----- (004A597D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4312 void Present_NoColorKey()
Ritor1
parents:
diff changeset
4313 {
Ritor1
parents:
diff changeset
4314 //unsigned __int16 *v0; // eax@4
Ritor1
parents:
diff changeset
4315 unsigned __int16 *v1; // esi@4
Ritor1
parents:
diff changeset
4316 void *v2; // edi@4
Ritor1
parents:
diff changeset
4317 //signed int v4; // ebx@4
Ritor1
parents:
diff changeset
4318 //signed int v5; // ebx@6
Ritor1
parents:
diff changeset
4319 //void *v6; // edi@7
Ritor1
parents:
diff changeset
4320 //const void *v7; // esi@7
Ritor1
parents:
diff changeset
4321 signed int v8; // ebx@8
Ritor1
parents:
diff changeset
4322 int v9; // eax@10
Ritor1
parents:
diff changeset
4323 unsigned int v10; // esi@10
Ritor1
parents:
diff changeset
4324 unsigned __int32 v11; // edi@10
Ritor1
parents:
diff changeset
4325 //int v12; // ecx@10
Ritor1
parents:
diff changeset
4326 unsigned int v13; // ebx@10
Ritor1
parents:
diff changeset
4327 int v14; // eax@11
Ritor1
parents:
diff changeset
4328 int v15; // eax@13
Ritor1
parents:
diff changeset
4329 int v16; // eax@14
Ritor1
parents:
diff changeset
4330 int v17; // eax@16
Ritor1
parents:
diff changeset
4331 HRESULT v18; // eax@22
Ritor1
parents:
diff changeset
4332 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
Ritor1
parents:
diff changeset
4333 int v20; // [sp+88h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
4334 int v21; // [sp+8Ch] [bp-18h]@10
Ritor1
parents:
diff changeset
4335 __int32 v22; // [sp+90h] [bp-14h]@10
Ritor1
parents:
diff changeset
4336 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
Ritor1
parents:
diff changeset
4337 unsigned int v24; // [sp+98h] [bp-Ch]@4
Ritor1
parents:
diff changeset
4338 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
4339 //LPVOID v26; // [sp+A0h] [bp-4h]@4
Ritor1
parents:
diff changeset
4340
Ritor1
parents:
diff changeset
4341 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
4342 {
Ritor1
parents:
diff changeset
4343 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
4344 {
Ritor1
parents:
diff changeset
4345 memset(&Dst, 0, 0x7Cu);
Ritor1
parents:
diff changeset
4346 Dst.dwSize = 124;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4347 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
0
Ritor1
parents:
diff changeset
4348 {
Ritor1
parents:
diff changeset
4349 //v26 = Dst.lpSurface;
Ritor1
parents:
diff changeset
4350 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
4351 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask |
Ritor1
parents:
diff changeset
4352 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16);
Ritor1
parents:
diff changeset
4353 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4354 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
Ritor1
parents:
diff changeset
4355 v1 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4356 v2 = Dst.lpSurface;
Ritor1
parents:
diff changeset
4357
Ritor1
parents:
diff changeset
4358
Ritor1
parents:
diff changeset
4359 /*for (uint y = 0; y < 480; ++y)
Ritor1
parents:
diff changeset
4360 {
Ritor1
parents:
diff changeset
4361 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
Ritor1
parents:
diff changeset
4362 for (uint x = 0; x < 640; ++x)
Ritor1
parents:
diff changeset
4363 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
Ritor1
parents:
diff changeset
4364 }*/
Ritor1
parents:
diff changeset
4365
Ritor1
parents:
diff changeset
4366 auto pSrc = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4367 auto pDst = (__int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
4368
Ritor1
parents:
diff changeset
4369 for (uint y = 0; y < 8; ++y)
Ritor1
parents:
diff changeset
4370 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4371
Ritor1
parents:
diff changeset
4372 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
4373
Ritor1
parents:
diff changeset
4374 for (uint y = 8; y < 352; ++y)
Ritor1
parents:
diff changeset
4375 {
Ritor1
parents:
diff changeset
4376 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4377 pSrc + y * 640, 8 * sizeof(__int16));
Ritor1
parents:
diff changeset
4378 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4379 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
Ritor1
parents:
diff changeset
4380 }
Ritor1
parents:
diff changeset
4381
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
4382 for (uint y = 352; y < 480; ++y)
0
Ritor1
parents:
diff changeset
4383 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4384 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
4385
Ritor1
parents:
diff changeset
4386
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4387 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
4388 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)];
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4389 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
4390 //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
4391 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1);
0
Ritor1
parents:
diff changeset
4392 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1);
Ritor1
parents:
diff changeset
4393 v22 = 4 * ((Dst.lPitch / 4) + v9);
Ritor1
parents:
diff changeset
4394 v21 = 4 * v9 + 1280;
Ritor1
parents:
diff changeset
4395
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
4396 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
0
Ritor1
parents:
diff changeset
4397 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
Ritor1
parents:
diff changeset
4398 v10 = (int)pSrc_x1y1;
Ritor1
parents:
diff changeset
4399 v11 = (int)pDst_x1y1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4400 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
0
Ritor1
parents:
diff changeset
4401 v13 = v24;
Ritor1
parents:
diff changeset
4402
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4403 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
0
Ritor1
parents:
diff changeset
4404 {
Ritor1
parents:
diff changeset
4405 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4406 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4407 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
0
Ritor1
parents:
diff changeset
4408 {
Ritor1
parents:
diff changeset
4409 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
Ritor1
parents:
diff changeset
4410 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
Ritor1
parents:
diff changeset
4411 }
Ritor1
parents:
diff changeset
4412 }
Ritor1
parents:
diff changeset
4413
Ritor1
parents:
diff changeset
4414 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
4415
Ritor1
parents:
diff changeset
4416 /* while ( 1 )
Ritor1
parents:
diff changeset
4417 {
Ritor1
parents:
diff changeset
4418 while ( 1 )
Ritor1
parents:
diff changeset
4419 {
Ritor1
parents:
diff changeset
4420 v14 = *(int *)v10;
Ritor1
parents:
diff changeset
4421 v10 += 4;
Ritor1
parents:
diff changeset
4422 if ( v14 == v13 )
Ritor1
parents:
diff changeset
4423 break;
Ritor1
parents:
diff changeset
4424 if ( (short)v14 == (short)v13 )
Ritor1
parents:
diff changeset
4425 {
Ritor1
parents:
diff changeset
4426 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000;
Ritor1
parents:
diff changeset
4427 v11 += 4;
Ritor1
parents:
diff changeset
4428 --uHalfWidth;
Ritor1
parents:
diff changeset
4429 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4430 goto LABEL_21;
Ritor1
parents:
diff changeset
4431 }
Ritor1
parents:
diff changeset
4432 else
Ritor1
parents:
diff changeset
4433 {
Ritor1
parents:
diff changeset
4434 v15 = __ROL__(v14, 16);
Ritor1
parents:
diff changeset
4435 if ( (short)v15 == (short)v13 )
Ritor1
parents:
diff changeset
4436 {
Ritor1
parents:
diff changeset
4437 v17 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
4438 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17;
Ritor1
parents:
diff changeset
4439 v11 += 4;
Ritor1
parents:
diff changeset
4440 --uHalfWidth;
Ritor1
parents:
diff changeset
4441 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4442 goto LABEL_21;
Ritor1
parents:
diff changeset
4443 }
Ritor1
parents:
diff changeset
4444 else
Ritor1
parents:
diff changeset
4445 {
Ritor1
parents:
diff changeset
4446 v16 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
4447 *(int *)v11 = v16;
Ritor1
parents:
diff changeset
4448 v11 += 4;
Ritor1
parents:
diff changeset
4449 --uHalfWidth;
Ritor1
parents:
diff changeset
4450 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4451 goto LABEL_21;
Ritor1
parents:
diff changeset
4452 }
Ritor1
parents:
diff changeset
4453 }
Ritor1
parents:
diff changeset
4454 }
Ritor1
parents:
diff changeset
4455 v11 += 4;
Ritor1
parents:
diff changeset
4456 --uHalfWidth;
Ritor1
parents:
diff changeset
4457 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4458 {
Ritor1
parents:
diff changeset
4459 LABEL_21:
Ritor1
parents:
diff changeset
4460 v10 += v21;
Ritor1
parents:
diff changeset
4461 v11 += v22;
Ritor1
parents:
diff changeset
4462 uHalfWidth = v20;
Ritor1
parents:
diff changeset
4463 if ( !--uNumLines )
Ritor1
parents:
diff changeset
4464 {
Ritor1
parents:
diff changeset
4465 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
4466 return;
Ritor1
parents:
diff changeset
4467 }
Ritor1
parents:
diff changeset
4468 }
Ritor1
parents:
diff changeset
4469 }*/
Ritor1
parents:
diff changeset
4470 }
Ritor1
parents:
diff changeset
4471 }
Ritor1
parents:
diff changeset
4472 }
Ritor1
parents:
diff changeset
4473 }
Ritor1
parents:
diff changeset
4474
Ritor1
parents:
diff changeset
4475
Ritor1
parents:
diff changeset
4476
Ritor1
parents:
diff changeset
4477 //----- (004A7063) --------------------------------------------------------
Ritor1
parents:
diff changeset
4478 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2)
Ritor1
parents:
diff changeset
4479 {
Ritor1
parents:
diff changeset
4480 float v2; // ST1C_4@1
Ritor1
parents:
diff changeset
4481 double v3; // ST14_8@1
Ritor1
parents:
diff changeset
4482 signed int v4; // ebx@1
Ritor1
parents:
diff changeset
4483 float v5; // ST1C_4@1
Ritor1
parents:
diff changeset
4484 double v6; // ST14_8@1
Ritor1
parents:
diff changeset
4485 signed int v7; // edi@1
Ritor1
parents:
diff changeset
4486 double v8; // ST0C_8@1
Ritor1
parents:
diff changeset
4487 signed int v9; // esi@1
Ritor1
parents:
diff changeset
4488 signed int v10; // ecx@1
Ritor1
parents:
diff changeset
4489 double v12; // [sp+8h] [bp-18h]@1
Ritor1
parents:
diff changeset
4490 unsigned __int64 v13; // [sp+18h] [bp-8h]@1
Ritor1
parents:
diff changeset
4491
Ritor1
parents:
diff changeset
4492 v2 = (double)(uDiffuse >> 24) * a2;
Ritor1
parents:
diff changeset
4493 v3 = v2 + 6.7553994e15;
Ritor1
parents:
diff changeset
4494 v4 = LODWORD(v3);
Ritor1
parents:
diff changeset
4495 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2;
Ritor1
parents:
diff changeset
4496 v6 = v5 + 6.7553994e15;
Ritor1
parents:
diff changeset
4497 v7 = LODWORD(v6);
Ritor1
parents:
diff changeset
4498 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2;
Ritor1
parents:
diff changeset
4499 v8 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
4500 v13 = __PAIR__(LODWORD(v6), LODWORD(v8));
Ritor1
parents:
diff changeset
4501 v9 = LODWORD(v8);
Ritor1
parents:
diff changeset
4502 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2;
Ritor1
parents:
diff changeset
4503 v12 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
4504 v10 = LODWORD(v12);
Ritor1
parents:
diff changeset
4505 if ( v4 > 255 )
Ritor1
parents:
diff changeset
4506 v4 = 255;
Ritor1
parents:
diff changeset
4507 if ( v4 < 0 )
Ritor1
parents:
diff changeset
4508 v4 = 0;
Ritor1
parents:
diff changeset
4509 if ( SHIDWORD(v13) > 255 )
Ritor1
parents:
diff changeset
4510 v7 = 255;
Ritor1
parents:
diff changeset
4511 if ( v7 < 0 )
Ritor1
parents:
diff changeset
4512 v7 = 0;
Ritor1
parents:
diff changeset
4513 if ( (signed int)v13 > 255 )
Ritor1
parents:
diff changeset
4514 v9 = 255;
Ritor1
parents:
diff changeset
4515 if ( v9 < 0 )
Ritor1
parents:
diff changeset
4516 v9 = 0;
Ritor1
parents:
diff changeset
4517 if ( SLODWORD(v12) > 255 )
Ritor1
parents:
diff changeset
4518 v10 = 255;
Ritor1
parents:
diff changeset
4519 if ( v10 < 0 )
Ritor1
parents:
diff changeset
4520 v10 = 0;
Ritor1
parents:
diff changeset
4521 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
4522 }
Ritor1
parents:
diff changeset
4523
Ritor1
parents:
diff changeset
4524
Ritor1
parents:
diff changeset
4525
Ritor1
parents:
diff changeset
4526
Ritor1
parents:
diff changeset
4527
Ritor1
parents:
diff changeset
4528
Ritor1
parents:
diff changeset
4529
Ritor1
parents:
diff changeset
4530
Ritor1
parents:
diff changeset
4531 //----- (004AD504) --------------------------------------------------------
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4532 int __fastcall sub_4AD504(signed int sFaceID)
0
Ritor1
parents:
diff changeset
4533 {
Ritor1
parents:
diff changeset
4534 int result; // eax@1
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4535 signed int v2; // ebx@1
0
Ritor1
parents:
diff changeset
4536 BLVFace *v3; // esi@3
Ritor1
parents:
diff changeset
4537 Texture *v4; // edi@6
Ritor1
parents:
diff changeset
4538 int v5; // eax@7
Ritor1
parents:
diff changeset
4539 int v6; // edx@7
Ritor1
parents:
diff changeset
4540 int v7; // ecx@7
Ritor1
parents:
diff changeset
4541 int v8; // ebx@8
Ritor1
parents:
diff changeset
4542 int v9; // eax@8
Ritor1
parents:
diff changeset
4543 int v10; // ebx@8
Ritor1
parents:
diff changeset
4544 unsigned int v11; // ebx@9
Ritor1
parents:
diff changeset
4545 int v12; // esi@10
Ritor1
parents:
diff changeset
4546 int v13; // eax@13
Ritor1
parents:
diff changeset
4547 unsigned __int16 *v14; // eax@13
Ritor1
parents:
diff changeset
4548 unsigned int v15; // eax@14
Ritor1
parents:
diff changeset
4549 unsigned __int16 *v16; // ebx@14
Ritor1
parents:
diff changeset
4550 int v17; // eax@15
Ritor1
parents:
diff changeset
4551 int v18; // ebx@15
Ritor1
parents:
diff changeset
4552 int v19; // esi@15
Ritor1
parents:
diff changeset
4553 int v20; // ecx@15
Ritor1
parents:
diff changeset
4554 int v21; // eax@15
Ritor1
parents:
diff changeset
4555 stru193_math *v22; // ebx@15
Ritor1
parents:
diff changeset
4556 int v23; // eax@15
Ritor1
parents:
diff changeset
4557 char *v24; // esi@16
Ritor1
parents:
diff changeset
4558 int v25; // eax@18
Ritor1
parents:
diff changeset
4559 int v26; // eax@18
Ritor1
parents:
diff changeset
4560 int v27; // eax@20
Ritor1
parents:
diff changeset
4561 signed int v28; // esi@20
Ritor1
parents:
diff changeset
4562 signed int v29; // edx@20
Ritor1
parents:
diff changeset
4563 signed int v30; // esi@20
Ritor1
parents:
diff changeset
4564 signed int v31; // edi@20
Ritor1
parents:
diff changeset
4565 int v32; // esi@20
Ritor1
parents:
diff changeset
4566 int v33; // eax@26
Ritor1
parents:
diff changeset
4567 int *v34; // esi@27
Ritor1
parents:
diff changeset
4568 unsigned __int16 *v35; // edi@27
Ritor1
parents:
diff changeset
4569 unsigned int v36; // edx@27
Ritor1
parents:
diff changeset
4570 int v37; // ebx@27
Ritor1
parents:
diff changeset
4571 char v38; // cl@27
Ritor1
parents:
diff changeset
4572 char v39; // ch@27
Ritor1
parents:
diff changeset
4573 int v40; // ebx@29
Ritor1
parents:
diff changeset
4574 int v41; // edx@29
Ritor1
parents:
diff changeset
4575 unsigned int v42; // ebx@30
Ritor1
parents:
diff changeset
4576 int v43; // edx@30
Ritor1
parents:
diff changeset
4577 int v44; // eax@33
Ritor1
parents:
diff changeset
4578 int *v45; // esi@34
Ritor1
parents:
diff changeset
4579 unsigned __int16 *v46; // edi@34
Ritor1
parents:
diff changeset
4580 unsigned int v47; // edx@34
Ritor1
parents:
diff changeset
4581 int v48; // ebx@34
Ritor1
parents:
diff changeset
4582 char v49; // cl@34
Ritor1
parents:
diff changeset
4583 char v50; // ch@34
Ritor1
parents:
diff changeset
4584 int v51; // ebx@36
Ritor1
parents:
diff changeset
4585 int v52; // edx@36
Ritor1
parents:
diff changeset
4586 unsigned __int16 v53; // bx@37
Ritor1
parents:
diff changeset
4587 int v54; // edx@37
Ritor1
parents:
diff changeset
4588 int v55; // eax@40
Ritor1
parents:
diff changeset
4589 int v56; // eax@41
Ritor1
parents:
diff changeset
4590 int *v57; // esi@42
Ritor1
parents:
diff changeset
4591 unsigned __int16 *v58; // edi@42
Ritor1
parents:
diff changeset
4592 unsigned int v59; // edx@42
Ritor1
parents:
diff changeset
4593 int v60; // ebx@42
Ritor1
parents:
diff changeset
4594 char v61; // cl@42
Ritor1
parents:
diff changeset
4595 char v62; // ch@42
Ritor1
parents:
diff changeset
4596 unsigned int v63; // ebx@44
Ritor1
parents:
diff changeset
4597 int v64; // edx@44
Ritor1
parents:
diff changeset
4598 unsigned int v65; // ebx@44
Ritor1
parents:
diff changeset
4599 int v66; // edx@44
Ritor1
parents:
diff changeset
4600 unsigned int v67; // ebx@45
Ritor1
parents:
diff changeset
4601 int v68; // edx@45
Ritor1
parents:
diff changeset
4602 int v69; // ebx@45
Ritor1
parents:
diff changeset
4603 int v70; // edx@45
Ritor1
parents:
diff changeset
4604 int v71; // eax@48
Ritor1
parents:
diff changeset
4605 int *v72; // esi@49
Ritor1
parents:
diff changeset
4606 unsigned __int16 *v73; // edi@49
Ritor1
parents:
diff changeset
4607 unsigned int v74; // edx@49
Ritor1
parents:
diff changeset
4608 int v75; // ebx@49
Ritor1
parents:
diff changeset
4609 char v76; // cl@49
Ritor1
parents:
diff changeset
4610 char v77; // ch@49
Ritor1
parents:
diff changeset
4611 unsigned int v78; // ebx@51
Ritor1
parents:
diff changeset
4612 int v79; // edx@51
Ritor1
parents:
diff changeset
4613 unsigned int v80; // ebx@51
Ritor1
parents:
diff changeset
4614 int v81; // edx@51
Ritor1
parents:
diff changeset
4615 unsigned int v82; // ebx@52
Ritor1
parents:
diff changeset
4616 int v83; // edx@52
Ritor1
parents:
diff changeset
4617 int v84; // ebx@52
Ritor1
parents:
diff changeset
4618 int v85; // edx@52
Ritor1
parents:
diff changeset
4619 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9
Ritor1
parents:
diff changeset
4620 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9
Ritor1
parents:
diff changeset
4621 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9
Ritor1
parents:
diff changeset
4622 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9
Ritor1
parents:
diff changeset
4623 int v90; // [sp+1Ch] [bp-88h]@20
Ritor1
parents:
diff changeset
4624 BLVFace *v91; // [sp+20h] [bp-84h]@3
Ritor1
parents:
diff changeset
4625 int v92; // [sp+24h] [bp-80h]@7
Ritor1
parents:
diff changeset
4626 int i; // [sp+28h] [bp-7Ch]@7
Ritor1
parents:
diff changeset
4627 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9
Ritor1
parents:
diff changeset
4628 unsigned int v95; // [sp+30h] [bp-74h]@1
Ritor1
parents:
diff changeset
4629 Texture *v96; // [sp+34h] [bp-70h]@6
Ritor1
parents:
diff changeset
4630 int v97; // [sp+38h] [bp-6Ch]@15
Ritor1
parents:
diff changeset
4631 unsigned int v98; // [sp+3Ch] [bp-68h]@9
Ritor1
parents:
diff changeset
4632 int v99; // [sp+40h] [bp-64h]@9
Ritor1
parents:
diff changeset
4633 int v100; // [sp+44h] [bp-60h]@24
Ritor1
parents:
diff changeset
4634 int v101; // [sp+48h] [bp-5Ch]@10
Ritor1
parents:
diff changeset
4635 int v102; // [sp+4Ch] [bp-58h]@20
Ritor1
parents:
diff changeset
4636 int v103; // [sp+50h] [bp-54h]@20
Ritor1
parents:
diff changeset
4637 int v104; // [sp+54h] [bp-50h]@9
Ritor1
parents:
diff changeset
4638 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20
Ritor1
parents:
diff changeset
4639 int v106; // [sp+5Ch] [bp-48h]@24
Ritor1
parents:
diff changeset
4640 int v107; // [sp+60h] [bp-44h]@20
Ritor1
parents:
diff changeset
4641 int v108; // [sp+64h] [bp-40h]@20
Ritor1
parents:
diff changeset
4642 int v109; // [sp+68h] [bp-3Ch]@20
Ritor1
parents:
diff changeset
4643 int v110; // [sp+6Ch] [bp-38h]@15
Ritor1
parents:
diff changeset
4644 int v111; // [sp+70h] [bp-34h]@20
Ritor1
parents:
diff changeset
4645 int a1; // [sp+74h] [bp-30h]@12
Ritor1
parents:
diff changeset
4646 int a2; // [sp+78h] [bp-2Ch]@9
Ritor1
parents:
diff changeset
4647 int *v114; // [sp+7Ch] [bp-28h]@16
Ritor1
parents:
diff changeset
4648 int v115; // [sp+80h] [bp-24h]@18
Ritor1
parents:
diff changeset
4649 int v116; // [sp+84h] [bp-20h]@7
Ritor1
parents:
diff changeset
4650 unsigned int v117; // [sp+88h] [bp-1Ch]@15
Ritor1
parents:
diff changeset
4651 unsigned int v118; // [sp+8Ch] [bp-18h]@24
Ritor1
parents:
diff changeset
4652 int *v119; // [sp+90h] [bp-14h]@13
Ritor1
parents:
diff changeset
4653 int v120; // [sp+94h] [bp-10h]@15
Ritor1
parents:
diff changeset
4654 unsigned int v121; // [sp+98h] [bp-Ch]@15
Ritor1
parents:
diff changeset
4655 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
4656 unsigned int v123; // [sp+A0h] [bp-4h]@13
Ritor1
parents:
diff changeset
4657
Ritor1
parents:
diff changeset
4658 result = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4659 v2 = sFaceID;
0
Ritor1
parents:
diff changeset
4660 v95 = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4661 if ( sFaceID >= 0 )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4662 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4663 if ( sFaceID < (signed int)pIndoor->uNumFaces )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4664 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4665 v3 = &pIndoor->pFaces[sFaceID];
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4666 v91 = &pIndoor->pFaces[sFaceID];
0
Ritor1
parents:
diff changeset
4667 if ( !pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4668 {
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4669 result = sub_423B5D(sFaceID);
0
Ritor1
parents:
diff changeset
4670 if ( result )
Ritor1
parents:
diff changeset
4671 {
Ritor1
parents:
diff changeset
4672 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
Ritor1
parents:
diff changeset
4673 if ( result )
Ritor1
parents:
diff changeset
4674 {
Ritor1
parents:
diff changeset
4675 result = (int)v3->GetTexture();
Ritor1
parents:
diff changeset
4676 v4 = (Texture *)result;
Ritor1
parents:
diff changeset
4677 v96 = (Texture *)result;
Ritor1
parents:
diff changeset
4678 if ( result )
Ritor1
parents:
diff changeset
4679 {
Ritor1
parents:
diff changeset
4680 v5 = *(short *)(result + 38);
Ritor1
parents:
diff changeset
4681 LOBYTE(v3->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
4682 v92 = v5;
Ritor1
parents:
diff changeset
4683 sub_4AE5F1(v2);
Ritor1
parents:
diff changeset
4684 ++pBLVRenderParams->field_84;
Ritor1
parents:
diff changeset
4685 v6 = stru_F8AD28.pDeltaUV[0];
Ritor1
parents:
diff changeset
4686 v116 = stru_F8AD28.pDeltaUV[1];
Ritor1
parents:
diff changeset
4687 v7 = 0;
Ritor1
parents:
diff changeset
4688 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 )
Ritor1
parents:
diff changeset
4689 {
Ritor1
parents:
diff changeset
4690 v8 = v116;
Ritor1
parents:
diff changeset
4691 stru_F8AD28._blv_lights_xs[v7] += v6;
Ritor1
parents:
diff changeset
4692 v9 = 4 * v7 + 16297672;
Ritor1
parents:
diff changeset
4693 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++];
Ritor1
parents:
diff changeset
4694 }
Ritor1
parents:
diff changeset
4695 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1);
Ritor1
parents:
diff changeset
4696 result = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4697 a2 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4698 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
4699 v99 = 640 * stru_F8A590._viewport_space_y;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
4700 v86 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
4701 v87 = v4->pLevelOfDetail1;
Ritor1
parents:
diff changeset
4702 v88 = v4->pLevelOfDetail2;
Ritor1
parents:
diff changeset
4703 v89 = v4->pLevelOfDetail3;
Ritor1
parents:
diff changeset
4704 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
4705 v104 = 2 * pBLVRenderParams->field_0_timer_;
Ritor1
parents:
diff changeset
4706 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4707 {
Ritor1
parents:
diff changeset
4708 v12 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4709 v101 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4710 while ( 1 )
Ritor1
parents:
diff changeset
4711 {
Ritor1
parents:
diff changeset
4712 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12);
Ritor1
parents:
diff changeset
4713 sub_4AE313(a1, result, &stru_F81018.field_0);
Ritor1
parents:
diff changeset
4714 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4715 {
Ritor1
parents:
diff changeset
4716 v15 = v95 * (v12 - pBLVRenderParams->uViewportY);
Ritor1
parents:
diff changeset
4717 v119 = &pBLVRenderParams->pTargetZBuffer[2
Ritor1
parents:
diff changeset
4718 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12)
Ritor1
parents:
diff changeset
4719 + 320 * (v12 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
4720 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4721 v16 = &pBLVRenderParams->pRenderTarget[v15
Ritor1
parents:
diff changeset
4722 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12)
Ritor1
parents:
diff changeset
4723 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4724 v14 = &pBLVRenderParams->pRenderTarget[v15
Ritor1
parents:
diff changeset
4725 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)
Ritor1
parents:
diff changeset
4726 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4727 v123 = (unsigned int)v16;
Ritor1
parents:
diff changeset
4728 }
Ritor1
parents:
diff changeset
4729 else
Ritor1
parents:
diff changeset
4730 {
Ritor1
parents:
diff changeset
4731 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12);
Ritor1
parents:
diff changeset
4732 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99];
Ritor1
parents:
diff changeset
4733 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11];
Ritor1
parents:
diff changeset
4734 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)];
Ritor1
parents:
diff changeset
4735 }
Ritor1
parents:
diff changeset
4736 v117 = (unsigned int)v14;
Ritor1
parents:
diff changeset
4737 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0);
Ritor1
parents:
diff changeset
4738 v18 = stru_F81018.field_0.field_10;
Ritor1
parents:
diff changeset
4739 LOWORD(v17) = 0;
Ritor1
parents:
diff changeset
4740 v97 = stru_F8AD28.field_0 | v17;
Ritor1
parents:
diff changeset
4741 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
Ritor1
parents:
diff changeset
4742 v19 = stru_F81018.field_0.field_4 >> i;
Ritor1
parents:
diff changeset
4743 v20 = 11 - v18;
Ritor1
parents:
diff changeset
4744 v116 = stru_F81018.field_0.field_8 >> i;
Ritor1
parents:
diff changeset
4745 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18);
Ritor1
parents:
diff changeset
4746 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
4747 v122 = (unsigned __int16 *)v20;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4748 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4749 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122));
0
Ritor1
parents:
diff changeset
4750 v120 = v116 + 4 * v23;
Ritor1
parents:
diff changeset
4751 if ( v123 < v117 )
Ritor1
parents:
diff changeset
4752 {
Ritor1
parents:
diff changeset
4753 v24 = (char *)&stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
4754 v114 = &stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
4755 a1 += 16;
Ritor1
parents:
diff changeset
4756 while ( 1 )
Ritor1
parents:
diff changeset
4757 {
Ritor1
parents:
diff changeset
4758 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8));
Ritor1
parents:
diff changeset
4759 v25 = *((int *)v24 - 2);
Ritor1
parents:
diff changeset
4760 LOWORD(v25) = 0;
Ritor1
parents:
diff changeset
4761 v115 = v97;
Ritor1
parents:
diff changeset
4762 v26 = stru_F8AD28.field_0 | v25;
Ritor1
parents:
diff changeset
4763 if ( v97 <= (unsigned int)v26 )
Ritor1
parents:
diff changeset
4764 v115 = v26;
Ritor1
parents:
diff changeset
4765 v97 = v26;
Ritor1
parents:
diff changeset
4766 v27 = *((int *)v24 - 11);
Ritor1
parents:
diff changeset
4767 v28 = *((int *)v24 - 1);
Ritor1
parents:
diff changeset
4768 v105 = (&v86)[4 * v27];
Ritor1
parents:
diff changeset
4769 v111 = v27 + 16;
Ritor1
parents:
diff changeset
4770 v29 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
4771 v109 = v27 + v27 + 16 - v4->uWidthLn2;
Ritor1
parents:
diff changeset
4772 v107 = v29 >> v27;
Ritor1
parents:
diff changeset
4773 v30 = v28 >> i;
Ritor1
parents:
diff changeset
4774 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16);
Ritor1
parents:
diff changeset
4775 v31 = *v114 >> i;
Ritor1
parents:
diff changeset
4776 v122 = (unsigned __int16 *)(11 - v27);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4777 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27)));
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4778 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122));
0
Ritor1
parents:
diff changeset
4779 v108 = (signed int)(v116 - v121) >> 4;
Ritor1
parents:
diff changeset
4780 v103 = (v90 - v120) >> 4;
Ritor1
parents:
diff changeset
4781 v32 = v123 + 32;
Ritor1
parents:
diff changeset
4782 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4783 v32 = v123 + 64;
Ritor1
parents:
diff changeset
4784 if ( v32 > v117 )
Ritor1
parents:
diff changeset
4785 v32 = v117;
Ritor1
parents:
diff changeset
4786 v118 = v32;
Ritor1
parents:
diff changeset
4787 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1));
Ritor1
parents:
diff changeset
4788 v106 = (signed int)(v32 - v123) >> 1;
Ritor1
parents:
diff changeset
4789 if ( v110 >> 16 == v100 >> 16 )
Ritor1
parents:
diff changeset
4790 {
Ritor1
parents:
diff changeset
4791 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1);
Ritor1
parents:
diff changeset
4792 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4793 {
Ritor1
parents:
diff changeset
4794 v44 = v123;
Ritor1
parents:
diff changeset
4795 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4796 {
Ritor1
parents:
diff changeset
4797 v45 = v119;
Ritor1
parents:
diff changeset
4798 v46 = v122;
Ritor1
parents:
diff changeset
4799 v47 = v121;
Ritor1
parents:
diff changeset
4800 v48 = v120;
Ritor1
parents:
diff changeset
4801 v49 = v111;
Ritor1
parents:
diff changeset
4802 v50 = v109;
Ritor1
parents:
diff changeset
4803 if ( v106 & 2 )
Ritor1
parents:
diff changeset
4804 {
Ritor1
parents:
diff changeset
4805 *v119 = v115;
Ritor1
parents:
diff changeset
4806 v45 -= 2;
Ritor1
parents:
diff changeset
4807 v44 = v123 + 4;
Ritor1
parents:
diff changeset
4808 goto LABEL_37;
Ritor1
parents:
diff changeset
4809 }
Ritor1
parents:
diff changeset
4810 do
Ritor1
parents:
diff changeset
4811 {
Ritor1
parents:
diff changeset
4812 v44 += 8;
Ritor1
parents:
diff changeset
4813 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50));
Ritor1
parents:
diff changeset
4814 v52 = v115;
Ritor1
parents:
diff changeset
4815 LOWORD(v51) = v46[v51];
Ritor1
parents:
diff changeset
4816 *v45 = v115;
Ritor1
parents:
diff changeset
4817 v45[1] = v52;
Ritor1
parents:
diff changeset
4818 v45[640] = v52;
Ritor1
parents:
diff changeset
4819 v45[641] = v52;
Ritor1
parents:
diff changeset
4820 *(short *)(v44 - 8) = v51;
Ritor1
parents:
diff changeset
4821 *(short *)(v44 - 6) = v51;
Ritor1
parents:
diff changeset
4822 *(short *)(v44 + 1272) = v51;
Ritor1
parents:
diff changeset
4823 *(short *)(v44 + 1274) = v51;
Ritor1
parents:
diff changeset
4824 v45[2] = v52;
Ritor1
parents:
diff changeset
4825 v45[3] = v52;
Ritor1
parents:
diff changeset
4826 v45[642] = v52;
Ritor1
parents:
diff changeset
4827 v45[643] = v52;
Ritor1
parents:
diff changeset
4828 v121 += v108;
Ritor1
parents:
diff changeset
4829 v120 += v103;
Ritor1
parents:
diff changeset
4830 v47 = v121;
Ritor1
parents:
diff changeset
4831 v48 = v120;
Ritor1
parents:
diff changeset
4832 LABEL_37:
Ritor1
parents:
diff changeset
4833 v45 += 4;
Ritor1
parents:
diff changeset
4834 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))];
Ritor1
parents:
diff changeset
4835 v54 = v108;
Ritor1
parents:
diff changeset
4836 *(short *)(v44 - 4) = v53;
Ritor1
parents:
diff changeset
4837 *(short *)(v44 - 2) = v53;
Ritor1
parents:
diff changeset
4838 *(short *)(v44 + 1276) = v53;
Ritor1
parents:
diff changeset
4839 *(short *)(v44 + 1278) = v53;
Ritor1
parents:
diff changeset
4840 v121 += v54;
Ritor1
parents:
diff changeset
4841 v120 += v103;
Ritor1
parents:
diff changeset
4842 v47 = v121;
Ritor1
parents:
diff changeset
4843 v48 = v120;
Ritor1
parents:
diff changeset
4844 }
Ritor1
parents:
diff changeset
4845 while ( v44 < v118 );
Ritor1
parents:
diff changeset
4846 v123 = v44;
Ritor1
parents:
diff changeset
4847 v119 = v45;
Ritor1
parents:
diff changeset
4848 }
Ritor1
parents:
diff changeset
4849 }
Ritor1
parents:
diff changeset
4850 else
Ritor1
parents:
diff changeset
4851 {
Ritor1
parents:
diff changeset
4852 v33 = v123;
Ritor1
parents:
diff changeset
4853 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4854 {
Ritor1
parents:
diff changeset
4855 v34 = v119;
Ritor1
parents:
diff changeset
4856 v35 = v122;
Ritor1
parents:
diff changeset
4857 v36 = v121;
Ritor1
parents:
diff changeset
4858 v37 = v120;
Ritor1
parents:
diff changeset
4859 v38 = v111;
Ritor1
parents:
diff changeset
4860 v39 = v109;
Ritor1
parents:
diff changeset
4861 if ( v106 & 1 )
Ritor1
parents:
diff changeset
4862 {
Ritor1
parents:
diff changeset
4863 *v119 = v115;
Ritor1
parents:
diff changeset
4864 --v34;
Ritor1
parents:
diff changeset
4865 v33 = v123 + 2;
Ritor1
parents:
diff changeset
4866 goto LABEL_30;
Ritor1
parents:
diff changeset
4867 }
Ritor1
parents:
diff changeset
4868 do
Ritor1
parents:
diff changeset
4869 {
Ritor1
parents:
diff changeset
4870 v33 += 4;
Ritor1
parents:
diff changeset
4871 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
4872 v41 = v115;
Ritor1
parents:
diff changeset
4873 LOWORD(v40) = v35[v40];
Ritor1
parents:
diff changeset
4874 *v34 = v115;
Ritor1
parents:
diff changeset
4875 *(short *)(v33 - 4) = v40;
Ritor1
parents:
diff changeset
4876 v34[1] = v41;
Ritor1
parents:
diff changeset
4877 v121 += v108;
Ritor1
parents:
diff changeset
4878 v120 += v103;
Ritor1
parents:
diff changeset
4879 v36 = v121;
Ritor1
parents:
diff changeset
4880 v37 = v120;
Ritor1
parents:
diff changeset
4881 LABEL_30:
Ritor1
parents:
diff changeset
4882 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
4883 v34 += 2;
Ritor1
parents:
diff changeset
4884 v43 = v108;
Ritor1
parents:
diff changeset
4885 *(short *)(v33 - 2) = v35[*(char *)v42];
Ritor1
parents:
diff changeset
4886 v121 += v43;
Ritor1
parents:
diff changeset
4887 v120 += v103;
Ritor1
parents:
diff changeset
4888 v36 = v121;
Ritor1
parents:
diff changeset
4889 v37 = v120;
Ritor1
parents:
diff changeset
4890 }
Ritor1
parents:
diff changeset
4891 while ( v33 < v118 );
Ritor1
parents:
diff changeset
4892 v123 = v33;
Ritor1
parents:
diff changeset
4893 v119 = v34;
Ritor1
parents:
diff changeset
4894 }
Ritor1
parents:
diff changeset
4895 }
Ritor1
parents:
diff changeset
4896 }
Ritor1
parents:
diff changeset
4897 else
Ritor1
parents:
diff changeset
4898 {
Ritor1
parents:
diff changeset
4899 v55 = v110 - ((v100 - v110) >> 4);
Ritor1
parents:
diff changeset
4900 v110 = (v100 - v110) >> 4;
Ritor1
parents:
diff changeset
4901 v122 = (unsigned __int16 *)v55;
Ritor1
parents:
diff changeset
4902 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4903 {
Ritor1
parents:
diff changeset
4904 v71 = v123;
Ritor1
parents:
diff changeset
4905 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4906 {
Ritor1
parents:
diff changeset
4907 v72 = v119;
Ritor1
parents:
diff changeset
4908 v73 = v94;
Ritor1
parents:
diff changeset
4909 v74 = v121;
Ritor1
parents:
diff changeset
4910 v75 = v120;
Ritor1
parents:
diff changeset
4911 v76 = v111;
Ritor1
parents:
diff changeset
4912 v77 = v109;
Ritor1
parents:
diff changeset
4913 if ( v106 & 2 )
Ritor1
parents:
diff changeset
4914 {
Ritor1
parents:
diff changeset
4915 *v119 = v115;
Ritor1
parents:
diff changeset
4916 v72 += 2;
Ritor1
parents:
diff changeset
4917 v71 = v123 + 4;
Ritor1
parents:
diff changeset
4918 goto LABEL_52;
Ritor1
parents:
diff changeset
4919 }
Ritor1
parents:
diff changeset
4920 do
Ritor1
parents:
diff changeset
4921 {
Ritor1
parents:
diff changeset
4922 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
4923 v79 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4924 v71 += 8;
Ritor1
parents:
diff changeset
4925 v122 = (unsigned __int16 *)v79;
Ritor1
parents:
diff changeset
4926 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78];
Ritor1
parents:
diff changeset
4927 v81 = v115;
Ritor1
parents:
diff changeset
4928 LOWORD(v80) = v73[v80];
Ritor1
parents:
diff changeset
4929 *v72 = v115;
Ritor1
parents:
diff changeset
4930 v72[1] = v81;
Ritor1
parents:
diff changeset
4931 v72[640] = v81;
Ritor1
parents:
diff changeset
4932 v72[641] = v81;
Ritor1
parents:
diff changeset
4933 *(short *)(v71 - 8) = v80;
Ritor1
parents:
diff changeset
4934 *(short *)(v71 - 6) = v80;
Ritor1
parents:
diff changeset
4935 *(short *)(v71 + 1272) = v80;
Ritor1
parents:
diff changeset
4936 *(short *)(v71 + 1274) = v80;
Ritor1
parents:
diff changeset
4937 v72[2] = v81;
Ritor1
parents:
diff changeset
4938 v72[3] = v81;
Ritor1
parents:
diff changeset
4939 v72[642] = v81;
Ritor1
parents:
diff changeset
4940 v72[643] = v81;
Ritor1
parents:
diff changeset
4941 v121 += v108;
Ritor1
parents:
diff changeset
4942 v120 += v103;
Ritor1
parents:
diff changeset
4943 v74 = v121;
Ritor1
parents:
diff changeset
4944 v75 = v120;
Ritor1
parents:
diff changeset
4945 v72 += 4;
Ritor1
parents:
diff changeset
4946 LABEL_52:
Ritor1
parents:
diff changeset
4947 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
4948 v83 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4949 v84 = v105[v82];
Ritor1
parents:
diff changeset
4950 v122 = (unsigned __int16 *)v83;
Ritor1
parents:
diff changeset
4951 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84];
Ritor1
parents:
diff changeset
4952 v85 = v108;
Ritor1
parents:
diff changeset
4953 *(short *)(v71 - 4) = v84;
Ritor1
parents:
diff changeset
4954 *(short *)(v71 - 2) = v84;
Ritor1
parents:
diff changeset
4955 *(short *)(v71 + 1276) = v84;
Ritor1
parents:
diff changeset
4956 *(short *)(v71 + 1278) = v84;
Ritor1
parents:
diff changeset
4957 v121 += v85;
Ritor1
parents:
diff changeset
4958 v120 += v103;
Ritor1
parents:
diff changeset
4959 v74 = v121;
Ritor1
parents:
diff changeset
4960 v75 = v120;
Ritor1
parents:
diff changeset
4961 }
Ritor1
parents:
diff changeset
4962 while ( v71 < v118 );
Ritor1
parents:
diff changeset
4963 v123 = v71;
Ritor1
parents:
diff changeset
4964 v119 = v72;
Ritor1
parents:
diff changeset
4965 }
Ritor1
parents:
diff changeset
4966 }
Ritor1
parents:
diff changeset
4967 else
Ritor1
parents:
diff changeset
4968 {
Ritor1
parents:
diff changeset
4969 v56 = v123;
Ritor1
parents:
diff changeset
4970 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4971 {
Ritor1
parents:
diff changeset
4972 v57 = v119;
Ritor1
parents:
diff changeset
4973 v58 = v94;
Ritor1
parents:
diff changeset
4974 v59 = v121;
Ritor1
parents:
diff changeset
4975 v60 = v120;
Ritor1
parents:
diff changeset
4976 v61 = v111;
Ritor1
parents:
diff changeset
4977 v62 = v109;
Ritor1
parents:
diff changeset
4978 if ( v106 & 1 )
Ritor1
parents:
diff changeset
4979 {
Ritor1
parents:
diff changeset
4980 *v119 = v115;
Ritor1
parents:
diff changeset
4981 ++v57;
Ritor1
parents:
diff changeset
4982 v56 = v123 + 2;
Ritor1
parents:
diff changeset
4983 goto LABEL_45;
Ritor1
parents:
diff changeset
4984 }
Ritor1
parents:
diff changeset
4985 do
Ritor1
parents:
diff changeset
4986 {
Ritor1
parents:
diff changeset
4987 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
4988 v64 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4989 v56 += 4;
Ritor1
parents:
diff changeset
4990 v122 = (unsigned __int16 *)v64;
Ritor1
parents:
diff changeset
4991 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63];
Ritor1
parents:
diff changeset
4992 v66 = v115;
Ritor1
parents:
diff changeset
4993 LOWORD(v65) = v58[v65];
Ritor1
parents:
diff changeset
4994 *v57 = v115;
Ritor1
parents:
diff changeset
4995 *(short *)(v56 - 4) = v65;
Ritor1
parents:
diff changeset
4996 v57[1] = v66;
Ritor1
parents:
diff changeset
4997 v121 += v108;
Ritor1
parents:
diff changeset
4998 v120 += v103;
Ritor1
parents:
diff changeset
4999 v59 = v121;
Ritor1
parents:
diff changeset
5000 v60 = v120;
Ritor1
parents:
diff changeset
5001 v57 += 2;
Ritor1
parents:
diff changeset
5002 LABEL_45:
Ritor1
parents:
diff changeset
5003 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
5004 v68 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
5005 v69 = v105[v67];
Ritor1
parents:
diff changeset
5006 v122 = (unsigned __int16 *)v68;
Ritor1
parents:
diff changeset
5007 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69];
Ritor1
parents:
diff changeset
5008 v70 = v108;
Ritor1
parents:
diff changeset
5009 *(short *)(v56 - 2) = v69;
Ritor1
parents:
diff changeset
5010 v121 += v70;
Ritor1
parents:
diff changeset
5011 v120 += v103;
Ritor1
parents:
diff changeset
5012 v59 = v121;
Ritor1
parents:
diff changeset
5013 v60 = v120;
Ritor1
parents:
diff changeset
5014 }
Ritor1
parents:
diff changeset
5015 while ( v56 < v118 );
Ritor1
parents:
diff changeset
5016 v123 = v56;
Ritor1
parents:
diff changeset
5017 v119 = v57;
Ritor1
parents:
diff changeset
5018 }
Ritor1
parents:
diff changeset
5019 }
Ritor1
parents:
diff changeset
5020 }
Ritor1
parents:
diff changeset
5021 v114 += 13;
Ritor1
parents:
diff changeset
5022 v110 = v100;
Ritor1
parents:
diff changeset
5023 a1 += 16;
Ritor1
parents:
diff changeset
5024 v4 = v96;
Ritor1
parents:
diff changeset
5025 v121 = v116;
Ritor1
parents:
diff changeset
5026 v120 = v90;
Ritor1
parents:
diff changeset
5027 if ( v123 >= v117 )
Ritor1
parents:
diff changeset
5028 break;
Ritor1
parents:
diff changeset
5029 v24 = (char *)v114;
Ritor1
parents:
diff changeset
5030 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
5031 }
Ritor1
parents:
diff changeset
5032 }
Ritor1
parents:
diff changeset
5033 ++a2;
Ritor1
parents:
diff changeset
5034 v98 += v95;
Ritor1
parents:
diff changeset
5035 result = a2;
Ritor1
parents:
diff changeset
5036 v101 += 2;
Ritor1
parents:
diff changeset
5037 v99 += 640;
Ritor1
parents:
diff changeset
5038 if ( a2 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
5039 break;
Ritor1
parents:
diff changeset
5040 v12 = v101;
Ritor1
parents:
diff changeset
5041 result = a2;
Ritor1
parents:
diff changeset
5042 v11 = v98;
Ritor1
parents:
diff changeset
5043 }
Ritor1
parents:
diff changeset
5044 }
Ritor1
parents:
diff changeset
5045 }
Ritor1
parents:
diff changeset
5046 }
Ritor1
parents:
diff changeset
5047 }
Ritor1
parents:
diff changeset
5048 }
Ritor1
parents:
diff changeset
5049 }
Ritor1
parents:
diff changeset
5050 }
Ritor1
parents:
diff changeset
5051 return result;
Ritor1
parents:
diff changeset
5052 }
Ritor1
parents:
diff changeset
5053 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
5054
Ritor1
parents:
diff changeset
5055 //----- (004ADD1D) --------------------------------------------------------
Ritor1
parents:
diff changeset
5056 void __fastcall sub_4ADD1D(int uFaceID)
Ritor1
parents:
diff changeset
5057 {
Ritor1
parents:
diff changeset
5058 int v1; // edi@1
Ritor1
parents:
diff changeset
5059 BLVFace *v2; // esi@3
Ritor1
parents:
diff changeset
5060 signed int v3; // ebx@4
Ritor1
parents:
diff changeset
5061 Texture *v4; // edi@9
Ritor1
parents:
diff changeset
5062 signed int v5; // eax@9
Ritor1
parents:
diff changeset
5063 char *v6; // edi@12
Ritor1
parents:
diff changeset
5064 signed int v7; // eax@15
Ritor1
parents:
diff changeset
5065 unsigned int v8; // eax@16
Ritor1
parents:
diff changeset
5066 __int16 v9; // cx@19
Ritor1
parents:
diff changeset
5067 unsigned __int8 *v10; // eax@19
Ritor1
parents:
diff changeset
5068 unsigned __int16 *v11; // eax@19
Ritor1
parents:
diff changeset
5069 int v12; // edi@19
Ritor1
parents:
diff changeset
5070 int v13; // ebx@20
Ritor1
parents:
diff changeset
5071 stru352 *v14; // esi@20
Ritor1
parents:
diff changeset
5072 DWORD v15; // eax@22
Ritor1
parents:
diff changeset
5073 signed int v16; // ecx@22
Ritor1
parents:
diff changeset
5074 signed int v17; // ST68_4@22
Ritor1
parents:
diff changeset
5075 int v18; // eax@22
Ritor1
parents:
diff changeset
5076 int v19; // ecx@22
Ritor1
parents:
diff changeset
5077 unsigned int v20; // esi@23
Ritor1
parents:
diff changeset
5078 int v21; // edi@23
Ritor1
parents:
diff changeset
5079 int v22; // eax@23
Ritor1
parents:
diff changeset
5080 int *v23; // ebx@24
Ritor1
parents:
diff changeset
5081 int v24; // edx@24
Ritor1
parents:
diff changeset
5082 int v25; // ebx@25
Ritor1
parents:
diff changeset
5083 unsigned __int16 v26; // cx@25
Ritor1
parents:
diff changeset
5084 int v27; // edx@26
Ritor1
parents:
diff changeset
5085 unsigned __int16 v28; // cx@26
Ritor1
parents:
diff changeset
5086 unsigned __int8 v29; // sf@27
Ritor1
parents:
diff changeset
5087 unsigned __int8 v30; // of@27
Ritor1
parents:
diff changeset
5088 unsigned int v31; // esi@29
Ritor1
parents:
diff changeset
5089 int v32; // edi@29
Ritor1
parents:
diff changeset
5090 unsigned __int16 *v33; // eax@29
Ritor1
parents:
diff changeset
5091 int *v34; // ebx@30
Ritor1
parents:
diff changeset
5092 int v35; // edx@30
Ritor1
parents:
diff changeset
5093 int v36; // ebx@31
Ritor1
parents:
diff changeset
5094 unsigned __int16 v37; // cx@31
Ritor1
parents:
diff changeset
5095 int v38; // edx@32
Ritor1
parents:
diff changeset
5096 unsigned __int16 v39; // cx@32
Ritor1
parents:
diff changeset
5097 Texture *v40; // [sp-10h] [bp-6Ch]@16
Ritor1
parents:
diff changeset
5098 int v41; // [sp-Ch] [bp-68h]@15
Ritor1
parents:
diff changeset
5099 unsigned int v42; // [sp+10h] [bp-4Ch]@1
Ritor1
parents:
diff changeset
5100 signed int v43; // [sp+14h] [bp-48h]@12
Ritor1
parents:
diff changeset
5101 signed int v44; // [sp+14h] [bp-48h]@22
Ritor1
parents:
diff changeset
5102 int v45; // [sp+1Ch] [bp-40h]@22
Ritor1
parents:
diff changeset
5103 int v46; // [sp+20h] [bp-3Ch]@22
Ritor1
parents:
diff changeset
5104 int v47; // [sp+24h] [bp-38h]@19
Ritor1
parents:
diff changeset
5105 char v48; // [sp+28h] [bp-34h]@19
Ritor1
parents:
diff changeset
5106 int v49; // [sp+2Ch] [bp-30h]@19
Ritor1
parents:
diff changeset
5107 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19
Ritor1
parents:
diff changeset
5108 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19
Ritor1
parents:
diff changeset
5109 int v52; // [sp+38h] [bp-24h]@22
Ritor1
parents:
diff changeset
5110 int v53; // [sp+3Ch] [bp-20h]@22
Ritor1
parents:
diff changeset
5111 signed int v54; // [sp+40h] [bp-1Ch]@12
Ritor1
parents:
diff changeset
5112 int v55; // [sp+40h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
5113 int v56; // [sp+44h] [bp-18h]@20
Ritor1
parents:
diff changeset
5114 stru352 *i; // [sp+48h] [bp-14h]@20
Ritor1
parents:
diff changeset
5115 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23
Ritor1
parents:
diff changeset
5116 int v59; // [sp+50h] [bp-Ch]@4
Ritor1
parents:
diff changeset
5117 int v60; // [sp+50h] [bp-Ch]@19
Ritor1
parents:
diff changeset
5118 int v61; // [sp+54h] [bp-8h]@22
Ritor1
parents:
diff changeset
5119 int *v62; // [sp+58h] [bp-4h]@23
Ritor1
parents:
diff changeset
5120 int *v63; // [sp+58h] [bp-4h]@29
Ritor1
parents:
diff changeset
5121
Ritor1
parents:
diff changeset
5122 v1 = uFaceID;
Ritor1
parents:
diff changeset
5123 v42 = pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
5124 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces )
Ritor1
parents:
diff changeset
5125 {
Ritor1
parents:
diff changeset
5126 v2 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
5127 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
5128 {
Ritor1
parents:
diff changeset
5129 v3 = sub_424579(uFaceID, &stru_F8AD28);
Ritor1
parents:
diff changeset
5130 v59 = v3;
Ritor1
parents:
diff changeset
5131 }
Ritor1
parents:
diff changeset
5132 else
Ritor1
parents:
diff changeset
5133 {
Ritor1
parents:
diff changeset
5134 v59 = sub_423B5D(uFaceID);
Ritor1
parents:
diff changeset
5135 v3 = v59;
Ritor1
parents:
diff changeset
5136 }
Ritor1
parents:
diff changeset
5137 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
Ritor1
parents:
diff changeset
5138 {
Ritor1
parents:
diff changeset
5139 v4 = v2->GetTexture();
Ritor1
parents:
diff changeset
5140 v5 = 0;
Ritor1
parents:
diff changeset
5141 if ( v4 )
Ritor1
parents:
diff changeset
5142 {
Ritor1
parents:
diff changeset
5143 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
5144 {
Ritor1
parents:
diff changeset
5145 if ( v3 > 0 )
Ritor1
parents:
diff changeset
5146 {
Ritor1
parents:
diff changeset
5147 v54 = v3;
Ritor1
parents:
diff changeset
5148 v43 = v3;
Ritor1
parents:
diff changeset
5149 v6 = (char *)&array_507D30[0].v;
Ritor1
parents:
diff changeset
5150 do
Ritor1
parents:
diff changeset
5151 {
Ritor1
parents:
diff changeset
5152 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1);
Ritor1
parents:
diff changeset
5153 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6;
Ritor1
parents:
diff changeset
5154 v6 += 48;
Ritor1
parents:
diff changeset
5155 --v54;
Ritor1
parents:
diff changeset
5156 }
Ritor1
parents:
diff changeset
5157 while ( v54 );
Ritor1
parents:
diff changeset
5158 v3 = v59;
Ritor1
parents:
diff changeset
5159 v5 = v43;
Ritor1
parents:
diff changeset
5160 }
Ritor1
parents:
diff changeset
5161 v7 = v5;
Ritor1
parents:
diff changeset
5162 v41 = stru_F8AD28.field_0;
Ritor1
parents:
diff changeset
5163 array_507D30[v7].u = array_507D30[v7].u * 0.25;
Ritor1
parents:
diff changeset
5164 array_507D30[v7].v = array_507D30[v7].v * 0.25;
Ritor1
parents:
diff changeset
5165 if ( BYTE1(v2->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
5166 {
Ritor1
parents:
diff changeset
5167 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
5168 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_);
Ritor1
parents:
diff changeset
5169 }
Ritor1
parents:
diff changeset
5170 else
Ritor1
parents:
diff changeset
5171 {
Ritor1
parents:
diff changeset
5172 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
5173 v8 = v2->uBitmapID;
Ritor1
parents:
diff changeset
5174 }
Ritor1
parents:
diff changeset
5175 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0);
Ritor1
parents:
diff changeset
5176 }
Ritor1
parents:
diff changeset
5177 else
Ritor1
parents:
diff changeset
5178 {
Ritor1
parents:
diff changeset
5179 v49 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
5180 v47 = v4->uHeightMinus1 << 16;
Ritor1
parents:
diff changeset
5181 v9 = 16 - v4->uWidthLn2;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
5182 v10 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
5183 LOBYTE(v2->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
5184 v48 = v9;
Ritor1
parents:
diff changeset
5185 v50 = v10;
Ritor1
parents:
diff changeset
5186 sub_4AF412();
Ritor1
parents:
diff changeset
5187 ++pBLVRenderParams->uNumFacesRenderedThisFrame;
Ritor1
parents:
diff changeset
5188 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1);
Ritor1
parents:
diff changeset
5189 v12 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5190 v51 = v11;
Ritor1
parents:
diff changeset
5191 v60 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5192 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
5193 {
Ritor1
parents:
diff changeset
5194 v13 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5195 v14 = &stru_F83B80[stru_F8A590._viewport_space_y];
Ritor1
parents:
diff changeset
5196 v55 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5197 v56 = 640 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5198 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i )
Ritor1
parents:
diff changeset
5199 {
Ritor1
parents:
diff changeset
5200 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12);
Ritor1
parents:
diff changeset
5201 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16);
Ritor1
parents:
diff changeset
5202 v15 = GetTickCount();
Ritor1
parents:
diff changeset
5203 v16 = v14->field_0;
Ritor1
parents:
diff changeset
5204 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11;
Ritor1
parents:
diff changeset
5205 v45 = v14->field_4 >> 3;
Ritor1
parents:
diff changeset
5206 v44 = v16 >> 3;
Ritor1
parents:
diff changeset
5207 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3;
Ritor1
parents:
diff changeset
5208 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5209 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
5210 v18 = v14->field_28;
Ritor1
parents:
diff changeset
5211 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13);
Ritor1
parents:
diff changeset
5212 LOWORD(v18) = 0;
Ritor1
parents:
diff changeset
5213 v46 = stru_F8AD28.field_0 | v18;
Ritor1
parents:
diff changeset
5214 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19;
Ritor1
parents:
diff changeset
5215 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
5216 {
Ritor1
parents:
diff changeset
5217 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
5218 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5219 v31 = v44;
Ritor1
parents:
diff changeset
5220 v32 = v45;
Ritor1
parents:
diff changeset
5221 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
5222 + 2 * v19
Ritor1
parents:
diff changeset
5223 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5224 if ( v61 & 1 )
Ritor1
parents:
diff changeset
5225 {
Ritor1
parents:
diff changeset
5226 --v61;
Ritor1
parents:
diff changeset
5227 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
5228 + 2 * v19
Ritor1
parents:
diff changeset
5229 - pBLVRenderParams->uViewportX
Ritor1
parents:
diff changeset
5230 - 2];
Ritor1
parents:
diff changeset
5231 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
5232 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5233 v35 = v46;
Ritor1
parents:
diff changeset
5234 v63 += 2;
Ritor1
parents:
diff changeset
5235 goto LABEL_32;
Ritor1
parents:
diff changeset
5236 }
Ritor1
parents:
diff changeset
5237 while ( 1 )
Ritor1
parents:
diff changeset
5238 {
Ritor1
parents:
diff changeset
5239 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
5240 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
5241 v61 -= 2;
Ritor1
parents:
diff changeset
5242 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
5243 break;
Ritor1
parents:
diff changeset
5244 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48));
Ritor1
parents:
diff changeset
5245 v31 += v52;
Ritor1
parents:
diff changeset
5246 v37 = v51[v36];
Ritor1
parents:
diff changeset
5247 v32 += v53;
Ritor1
parents:
diff changeset
5248 v34 = v63;
Ritor1
parents:
diff changeset
5249 v35 = v46;
Ritor1
parents:
diff changeset
5250 *v33 = v37;
Ritor1
parents:
diff changeset
5251 v33[1] = v37;
Ritor1
parents:
diff changeset
5252 v33[640] = v37;
Ritor1
parents:
diff changeset
5253 v33[641] = v37;
Ritor1
parents:
diff changeset
5254 v63 += 4;
Ritor1
parents:
diff changeset
5255 v34[2] = v46;
Ritor1
parents:
diff changeset
5256 v34[3] = v46;
Ritor1
parents:
diff changeset
5257 v34[642] = v46;
Ritor1
parents:
diff changeset
5258 v34[643] = v46;
Ritor1
parents:
diff changeset
5259 LABEL_32:
Ritor1
parents:
diff changeset
5260 *v34 = v35;
Ritor1
parents:
diff changeset
5261 v34[1] = v35;
Ritor1
parents:
diff changeset
5262 v34[640] = v35;
Ritor1
parents:
diff changeset
5263 v34[641] = v35;
Ritor1
parents:
diff changeset
5264 v38 = v49 & (v31 >> 16);
Ritor1
parents:
diff changeset
5265 v33 += 4;
Ritor1
parents:
diff changeset
5266 v31 += v52;
Ritor1
parents:
diff changeset
5267 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))];
Ritor1
parents:
diff changeset
5268 v32 += v53;
Ritor1
parents:
diff changeset
5269 *(v33 - 2) = v39;
Ritor1
parents:
diff changeset
5270 *(v33 - 1) = v39;
Ritor1
parents:
diff changeset
5271 v33[638] = v39;
Ritor1
parents:
diff changeset
5272 v33[639] = v39;
Ritor1
parents:
diff changeset
5273 }
Ritor1
parents:
diff changeset
5274 }
Ritor1
parents:
diff changeset
5275 else
Ritor1
parents:
diff changeset
5276 {
Ritor1
parents:
diff changeset
5277 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
5278 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
5279 v20 = v44;
Ritor1
parents:
diff changeset
5280 v21 = v45;
Ritor1
parents:
diff changeset
5281 v22 = (int)v58;
Ritor1
parents:
diff changeset
5282 if ( v61 & 1 )
Ritor1
parents:
diff changeset
5283 {
Ritor1
parents:
diff changeset
5284 --v61;
Ritor1
parents:
diff changeset
5285 v22 = (int)(v58 - 1);
Ritor1
parents:
diff changeset
5286 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
5287 v24 = v46;
Ritor1
parents:
diff changeset
5288 ++v62;
Ritor1
parents:
diff changeset
5289 goto LABEL_26;
Ritor1
parents:
diff changeset
5290 }
Ritor1
parents:
diff changeset
5291 while ( 1 )
Ritor1
parents:
diff changeset
5292 {
Ritor1
parents:
diff changeset
5293 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
5294 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
5295 v61 -= 2;
Ritor1
parents:
diff changeset
5296 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
5297 break;
Ritor1
parents:
diff changeset
5298 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48));
Ritor1
parents:
diff changeset
5299 v20 += v52;
Ritor1
parents:
diff changeset
5300 v26 = v51[v25];
Ritor1
parents:
diff changeset
5301 v21 += v53;
Ritor1
parents:
diff changeset
5302 v23 = v62;
Ritor1
parents:
diff changeset
5303 v24 = v46;
Ritor1
parents:
diff changeset
5304 *(short *)v22 = v26;
Ritor1
parents:
diff changeset
5305 v62 += 2;
Ritor1
parents:
diff changeset
5306 v23[1] = v46;
Ritor1
parents:
diff changeset
5307 LABEL_26:
Ritor1
parents:
diff changeset
5308 *v23 = v24;
Ritor1
parents:
diff changeset
5309 v27 = v49 & (v20 >> 16);
Ritor1
parents:
diff changeset
5310 v22 += 4;
Ritor1
parents:
diff changeset
5311 v20 += v52;
Ritor1
parents:
diff changeset
5312 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))];
Ritor1
parents:
diff changeset
5313 v21 += v53;
Ritor1
parents:
diff changeset
5314 *(short *)(v22 - 2) = v28;
Ritor1
parents:
diff changeset
5315 }
Ritor1
parents:
diff changeset
5316 }
Ritor1
parents:
diff changeset
5317 ++v60;
Ritor1
parents:
diff changeset
5318 ++i;
Ritor1
parents:
diff changeset
5319 v56 += 640;
Ritor1
parents:
diff changeset
5320 v55 += 2;
Ritor1
parents:
diff changeset
5321 if ( v60 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
5322 break;
Ritor1
parents:
diff changeset
5323 v13 = v55;
Ritor1
parents:
diff changeset
5324 v12 = v60;
Ritor1
parents:
diff changeset
5325 }
Ritor1
parents:
diff changeset
5326 }
Ritor1
parents:
diff changeset
5327 }
Ritor1
parents:
diff changeset
5328 }
Ritor1
parents:
diff changeset
5329 }
Ritor1
parents:
diff changeset
5330 }
Ritor1
parents:
diff changeset
5331 }
Ritor1
parents:
diff changeset
5332
Ritor1
parents:
diff changeset
5333 //----- (004AE1E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
5334 int __fastcall sub_4AE1E7(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
5335 {
Ritor1
parents:
diff changeset
5336 int v3; // ebx@1
Ritor1
parents:
diff changeset
5337 int v4; // edi@1
Ritor1
parents:
diff changeset
5338 int v5; // esi@1
Ritor1
parents:
diff changeset
5339 signed __int64 v6; // qtt@3
Ritor1
parents:
diff changeset
5340 int v7; // esi@3
Ritor1
parents:
diff changeset
5341 int v8; // eax@5
Ritor1
parents:
diff changeset
5342 int result; // eax@5
Ritor1
parents:
diff changeset
5343 int v10; // edx@5
Ritor1
parents:
diff changeset
5344 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
5345 int v12; // [sp+1Ch] [bp+8h]@2
Ritor1
parents:
diff changeset
5346
Ritor1
parents:
diff changeset
5347 v3 = pBLVRenderParams->uViewportCenterY - a3;
Ritor1
parents:
diff changeset
5348 v4 = pBLVRenderParams->uViewportCenterX - a2;
Ritor1
parents:
diff changeset
5349 v11 = a1;
Ritor1
parents:
diff changeset
5350 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y
Ritor1
parents:
diff changeset
5351 + stru_F8AD28.field_7C
Ritor1
parents:
diff changeset
5352 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5353 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) )
Ritor1
parents:
diff changeset
5354 {
Ritor1
parents:
diff changeset
5355 LODWORD(v6) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
5356 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
5357 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x);
Ritor1
parents:
diff changeset
5358 }
Ritor1
parents:
diff changeset
5359 else
Ritor1
parents:
diff changeset
5360 {
Ritor1
parents:
diff changeset
5361 v7 = 1073741824;
Ritor1
parents:
diff changeset
5362 }
Ritor1
parents:
diff changeset
5363 v8 = stru_F8AD28.vec_9C.z;
Ritor1
parents:
diff changeset
5364 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z
Ritor1
parents:
diff changeset
5365 + stru_F8AD28.vec_8C.x
Ritor1
parents:
diff changeset
5366 + v4 * stru_F8AD28.vec_8C.y)
Ritor1
parents:
diff changeset
5367 * (signed __int64)v7) >> 16)
Ritor1
parents:
diff changeset
5368 + stru_F8AD28.field_98;
Ritor1
parents:
diff changeset
5369 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16;
Ritor1
parents:
diff changeset
5370 v10 = result + stru_F8AD28.field_A8;
Ritor1
parents:
diff changeset
5371 stru_F83B80[v11].field_28 = v7;
Ritor1
parents:
diff changeset
5372 stru_F83B80[v11].field_4 = v10;
Ritor1
parents:
diff changeset
5373 return result;
Ritor1
parents:
diff changeset
5374 }
Ritor1
parents:
diff changeset
5375
Ritor1
parents:
diff changeset
5376 //----- (004AE313) --------------------------------------------------------
Ritor1
parents:
diff changeset
5377 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p)
Ritor1
parents:
diff changeset
5378 {
Ritor1
parents:
diff changeset
5379 int _dy; // ebx@1
Ritor1
parents:
diff changeset
5380 int _dx; // edi@1
Ritor1
parents:
diff changeset
5381 int v5; // ecx@1
Ritor1
parents:
diff changeset
5382 int v6; // esi@1
Ritor1
parents:
diff changeset
5383 int v7; // ST18_4@2
Ritor1
parents:
diff changeset
5384 signed __int64 v8; // qtt@3
Ritor1
parents:
diff changeset
5385 unsigned int v9; // ecx@3
Ritor1
parents:
diff changeset
5386 int result; // eax@8
Ritor1
parents:
diff changeset
5387 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
5388
Ritor1
parents:
diff changeset
5389 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y;
Ritor1
parents:
diff changeset
5390 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x;
Ritor1
parents:
diff changeset
5391 ++pBLVRenderParams->field_88;
Ritor1
parents:
diff changeset
5392 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C;
Ritor1
parents:
diff changeset
5393 v6 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5394 v11 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5395 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) )
Ritor1
parents:
diff changeset
5396 {
Ritor1
parents:
diff changeset
5397 LODWORD(v8) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
5398 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
5399 v9 = v8 / v11;
Ritor1
parents:
diff changeset
5400 }
Ritor1
parents:
diff changeset
5401 else
Ritor1
parents:
diff changeset
5402 {
Ritor1
parents:
diff changeset
5403 v9 = 0x40000000u;
Ritor1
parents:
diff changeset
5404 }
Ritor1
parents:
diff changeset
5405 if ( (signed int)v9 >= stru_F8AD28.field_34 )
Ritor1
parents:
diff changeset
5406 p->field_0 = v9;
Ritor1
parents:
diff changeset
5407 else
Ritor1
parents:
diff changeset
5408 p->field_0 = stru_F8AD28.field_34;
Ritor1
parents:
diff changeset
5409 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y)
Ritor1
parents:
diff changeset
5410 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
5411 + stru_F8AD28.field_98
Ritor1
parents:
diff changeset
5412 + (stru_F8AD28.pDeltaUV[0] << 16);
Ritor1
parents:
diff changeset
5413 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y)
Ritor1
parents:
diff changeset
5414 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
5415 + stru_F8AD28.field_A8
Ritor1
parents:
diff changeset
5416 + (stru_F8AD28.pDeltaUV[1] << 16);
Ritor1
parents:
diff changeset
5417 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16);
Ritor1
parents:
diff changeset
5418 if ( result < 369620 || bUseLoResSprites )
Ritor1
parents:
diff changeset
5419 {
Ritor1
parents:
diff changeset
5420 if ( result < 184810 )
Ritor1
parents:
diff changeset
5421 p->field_10 = result > 92405;
Ritor1
parents:
diff changeset
5422 else
Ritor1
parents:
diff changeset
5423 p->field_10 = 2;
Ritor1
parents:
diff changeset
5424 }
Ritor1
parents:
diff changeset
5425 else
Ritor1
parents:
diff changeset
5426 {
Ritor1
parents:
diff changeset
5427 p->field_10 = 3;
Ritor1
parents:
diff changeset
5428 }
Ritor1
parents:
diff changeset
5429 return result;
Ritor1
parents:
diff changeset
5430 }
Ritor1
parents:
diff changeset
5431
Ritor1
parents:
diff changeset
5432 //----- (004AE491) --------------------------------------------------------
Ritor1
parents:
diff changeset
5433 int __fastcall sub_4AE491(signed int a1, signed int a2)
Ritor1
parents:
diff changeset
5434 {
Ritor1
parents:
diff changeset
5435 signed int v2; // eax@1
Ritor1
parents:
diff changeset
5436 signed int v3; // edi@1
Ritor1
parents:
diff changeset
5437 int v4; // ecx@1
Ritor1
parents:
diff changeset
5438 int v5; // esi@2
Ritor1
parents:
diff changeset
5439 int v6; // eax@2
Ritor1
parents:
diff changeset
5440 int v7; // ebx@2
Ritor1
parents:
diff changeset
5441 unsigned int v8; // ecx@2
Ritor1
parents:
diff changeset
5442 int v9; // edx@5
Ritor1
parents:
diff changeset
5443 int v10; // edx@7
Ritor1
parents:
diff changeset
5444 unsigned int v11; // eax@8
Ritor1
parents:
diff changeset
5445 int v13; // [sp+4h] [bp-18h]@2
Ritor1
parents:
diff changeset
5446 int v14; // [sp+8h] [bp-14h]@2
Ritor1
parents:
diff changeset
5447 signed int v15; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
5448 int v16; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
5449 int v17; // [sp+18h] [bp-4h]@1
Ritor1
parents:
diff changeset
5450
Ritor1
parents:
diff changeset
5451 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
5452 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
5453 v17 = stru_F8AD28.uCurrentAmbientLightLevel;
Ritor1
parents:
diff changeset
5454 v4 = 0;
Ritor1
parents:
diff changeset
5455 v15 = v2;
Ritor1
parents:
diff changeset
5456 v16 = 0;
Ritor1
parents:
diff changeset
5457 if ( stru_F8AD28.uNumLightsApplied > 0 )
Ritor1
parents:
diff changeset
5458 {
Ritor1
parents:
diff changeset
5459 do
Ritor1
parents:
diff changeset
5460 {
Ritor1
parents:
diff changeset
5461 v5 = v16;
Ritor1
parents:
diff changeset
5462 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]);
Ritor1
parents:
diff changeset
5463 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]);
Ritor1
parents:
diff changeset
5464 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
5465 v7 = v13;
Ritor1
parents:
diff changeset
5466 v8 = v14;
Ritor1
parents:
diff changeset
5467 if ( v6 < v13 )
Ritor1
parents:
diff changeset
5468 {
Ritor1
parents:
diff changeset
5469 v6 = v13;
Ritor1
parents:
diff changeset
5470 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
5471 }
Ritor1
parents:
diff changeset
5472 if ( v6 < v14 )
Ritor1
parents:
diff changeset
5473 {
Ritor1
parents:
diff changeset
5474 v9 = v6;
Ritor1
parents:
diff changeset
5475 v6 = v14;
Ritor1
parents:
diff changeset
5476 v8 = v9;
Ritor1
parents:
diff changeset
5477 }
Ritor1
parents:
diff changeset
5478 if ( v7 < (signed int)v8 )
Ritor1
parents:
diff changeset
5479 {
Ritor1
parents:
diff changeset
5480 v10 = v8;
Ritor1
parents:
diff changeset
5481 v8 = v7;
Ritor1
parents:
diff changeset
5482 v7 = v10;
Ritor1
parents:
diff changeset
5483 }
Ritor1
parents:
diff changeset
5484 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6;
Ritor1
parents:
diff changeset
5485 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] )
Ritor1
parents:
diff changeset
5486 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536);
Ritor1
parents:
diff changeset
5487 ++v16;
Ritor1
parents:
diff changeset
5488 v2 = v15;
Ritor1
parents:
diff changeset
5489 }
Ritor1
parents:
diff changeset
5490 while ( v16 < stru_F8AD28.uNumLightsApplied );
Ritor1
parents:
diff changeset
5491 v4 = 0;
Ritor1
parents:
diff changeset
5492 }
Ritor1
parents:
diff changeset
5493 if ( stru_F8AD28.field_3E4 != v4 )
Ritor1
parents:
diff changeset
5494 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4);
Ritor1
parents:
diff changeset
5495 if ( v17 >= v4 )
Ritor1
parents:
diff changeset
5496 {
Ritor1
parents:
diff changeset
5497 if ( v17 > 2031616 )
Ritor1
parents:
diff changeset
5498 v17 = 2031616;
Ritor1
parents:
diff changeset
5499 }
Ritor1
parents:
diff changeset
5500 else
Ritor1
parents:
diff changeset
5501 {
Ritor1
parents:
diff changeset
5502 v17 = v4;
Ritor1
parents:
diff changeset
5503 }
Ritor1
parents:
diff changeset
5504 ++pBLVRenderParams->field_8C;
Ritor1
parents:
diff changeset
5505 return v17;
Ritor1
parents:
diff changeset
5506 }
Ritor1
parents:
diff changeset
5507 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
5508
Ritor1
parents:
diff changeset
5509
Ritor1
parents:
diff changeset
5510
Ritor1
parents:
diff changeset
5511
Ritor1
parents:
diff changeset
5512 //----- (004AE5F1) --------------------------------------------------------
Ritor1
parents:
diff changeset
5513 void __fastcall sub_4AE5F1(unsigned int uFaceID)
Ritor1
parents:
diff changeset
5514 {
Ritor1
parents:
diff changeset
5515 BLVFace *v1; // esi@1
Ritor1
parents:
diff changeset
5516 BLVFaceExtra *v2; // ebx@1
Ritor1
parents:
diff changeset
5517 int v3; // eax@1
Ritor1
parents:
diff changeset
5518 int v4; // edi@1
Ritor1
parents:
diff changeset
5519 Texture *v5; // edi@1
Ritor1
parents:
diff changeset
5520 int v6; // eax@1
Ritor1
parents:
diff changeset
5521 unsigned int v7; // eax@1
Ritor1
parents:
diff changeset
5522 unsigned int v8; // ecx@1
Ritor1
parents:
diff changeset
5523 unsigned int v9; // eax@1
Ritor1
parents:
diff changeset
5524 unsigned int v10; // ecx@5
Ritor1
parents:
diff changeset
5525 int v11; // edi@10
Ritor1
parents:
diff changeset
5526 int v12; // ecx@10
Ritor1
parents:
diff changeset
5527 int v13; // eax@10
Ritor1
parents:
diff changeset
5528 int v14; // edx@10
Ritor1
parents:
diff changeset
5529 int v15; // ebx@12
Ritor1
parents:
diff changeset
5530 double v16; // st7@16
Ritor1
parents:
diff changeset
5531 int v17; // eax@16
Ritor1
parents:
diff changeset
5532 char *v18; // ebx@17
Ritor1
parents:
diff changeset
5533 int v19; // ecx@19
Ritor1
parents:
diff changeset
5534 int v20; // eax@19
Ritor1
parents:
diff changeset
5535 int v21; // edx@21
Ritor1
parents:
diff changeset
5536 int v22; // eax@23
Ritor1
parents:
diff changeset
5537 int v23; // ST04_4@26
Ritor1
parents:
diff changeset
5538 int v24; // edi@26
Ritor1
parents:
diff changeset
5539 double v25; // st6@26
Ritor1
parents:
diff changeset
5540 int v26; // eax@26
Ritor1
parents:
diff changeset
5541 double v27; // st6@26
Ritor1
parents:
diff changeset
5542 int v28; // ecx@26
Ritor1
parents:
diff changeset
5543 char v29; // al@26
Ritor1
parents:
diff changeset
5544 int v30; // edx@28
Ritor1
parents:
diff changeset
5545 int v31; // ecx@28
Ritor1
parents:
diff changeset
5546 BLVLightMM7 *v32; // ecx@32
Ritor1
parents:
diff changeset
5547 int v33; // edi@33
Ritor1
parents:
diff changeset
5548 int v34; // edx@33
Ritor1
parents:
diff changeset
5549 int v35; // eax@33
Ritor1
parents:
diff changeset
5550 int v36; // edi@35
Ritor1
parents:
diff changeset
5551 int v37; // edx@37
Ritor1
parents:
diff changeset
5552 int v38; // ebx@39
Ritor1
parents:
diff changeset
5553 int v39; // edi@42
Ritor1
parents:
diff changeset
5554 int v40; // eax@42
Ritor1
parents:
diff changeset
5555 char *v41; // ebx@45
Ritor1
parents:
diff changeset
5556 signed int v42; // ecx@47
Ritor1
parents:
diff changeset
5557 int v43; // edi@47
Ritor1
parents:
diff changeset
5558 int v44; // eax@49
Ritor1
parents:
diff changeset
5559 int v45; // edx@51
Ritor1
parents:
diff changeset
5560 int v46; // eax@53
Ritor1
parents:
diff changeset
5561 int v47; // ST04_4@55
Ritor1
parents:
diff changeset
5562 int v48; // edi@55
Ritor1
parents:
diff changeset
5563 double v49; // st6@55
Ritor1
parents:
diff changeset
5564 int v50; // eax@55
Ritor1
parents:
diff changeset
5565 double v51; // st6@55
Ritor1
parents:
diff changeset
5566 int v52; // eax@55
Ritor1
parents:
diff changeset
5567 int v53; // ecx@57
Ritor1
parents:
diff changeset
5568 int v54; // ecx@58
Ritor1
parents:
diff changeset
5569 int v55; // ecx@59
Ritor1
parents:
diff changeset
5570 int v56; // edx@62
Ritor1
parents:
diff changeset
5571 int v57; // ecx@62
Ritor1
parents:
diff changeset
5572 int v58; // eax@63
Ritor1
parents:
diff changeset
5573 int v59; // edx@64
Ritor1
parents:
diff changeset
5574 int v60; // ecx@67
Ritor1
parents:
diff changeset
5575 int v61; // edx@67
Ritor1
parents:
diff changeset
5576 int v62; // eax@68
Ritor1
parents:
diff changeset
5577 int v63; // edx@69
Ritor1
parents:
diff changeset
5578 signed int v64; // ecx@72
Ritor1
parents:
diff changeset
5579 double v65; // st7@75
Ritor1
parents:
diff changeset
5580 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9
Ritor1
parents:
diff changeset
5581 Vec3_int_ v67; // [sp+18h] [bp-28h]@9
Ritor1
parents:
diff changeset
5582 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
5583 int v69; // [sp+28h] [bp-18h]@10
Ritor1
parents:
diff changeset
5584 int v70; // [sp+2Ch] [bp-14h]@10
Ritor1
parents:
diff changeset
5585 int X; // [sp+30h] [bp-10h]@10
Ritor1
parents:
diff changeset
5586 int v72; // [sp+34h] [bp-Ch]@10
Ritor1
parents:
diff changeset
5587 int v73; // [sp+38h] [bp-8h]@10
Ritor1
parents:
diff changeset
5588 int v74; // [sp+3Ch] [bp-4h]@10
Ritor1
parents:
diff changeset
5589
Ritor1
parents:
diff changeset
5590 v1 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
5591 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID];
Ritor1
parents:
diff changeset
5592 v3 = v1->uBitmapID;
Ritor1
parents:
diff changeset
5593 v4 = v1->uBitmapID;
Ritor1
parents:
diff changeset
5594 v68 = v2;
Ritor1
parents:
diff changeset
5595 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0);
Ritor1
parents:
diff changeset
5596 v6 = 8 * uFaceID;
Ritor1
parents:
diff changeset
5597 LOBYTE(v6) = 8 * uFaceID | 6;
Ritor1
parents:
diff changeset
5598 stru_F8AD28.field_0 = v6;
Ritor1
parents:
diff changeset
5599 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
Ritor1
parents:
diff changeset
5600 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
5601 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
5602 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
5603 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU;
Ritor1
parents:
diff changeset
5604 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV;
Ritor1
parents:
diff changeset
5605 v7 = GetTickCount();
Ritor1
parents:
diff changeset
5606 v8 = v1->uAttributes;
Ritor1
parents:
diff changeset
5607 v9 = v7 >> 3;
Ritor1
parents:
diff changeset
5608 if ( v8 & 4 )
Ritor1
parents:
diff changeset
5609 {
Ritor1
parents:
diff changeset
5610 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
5611 }
Ritor1
parents:
diff changeset
5612 else
Ritor1
parents:
diff changeset
5613 {
Ritor1
parents:
diff changeset
5614 if ( v8 & 0x20 )
Ritor1
parents:
diff changeset
5615 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
5616 }
Ritor1
parents:
diff changeset
5617 v10 = v1->uAttributes;
Ritor1
parents:
diff changeset
5618 if ( BYTE1(v10) & 8 )
Ritor1
parents:
diff changeset
5619 {
Ritor1
parents:
diff changeset
5620 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
5621 }
Ritor1
parents:
diff changeset
5622 else
Ritor1
parents:
diff changeset
5623 {
Ritor1
parents:
diff changeset
5624 if ( v10 & 0x40 )
Ritor1
parents:
diff changeset
5625 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
5626 }
Ritor1
parents:
diff changeset
5627 v1->_get_normals(&v67, &v66);
Ritor1
parents:
diff changeset
5628 stru_F8AD28.vec_14.x = v67.x;
Ritor1
parents:
diff changeset
5629 stru_F8AD28.vec_14.y = v67.y;
Ritor1
parents:
diff changeset
5630 stru_F8AD28.vec_14.z = v67.z;
Ritor1
parents:
diff changeset
5631 stru_F8AD28.vec_20.x = v66.x;
Ritor1
parents:
diff changeset
5632 stru_F8AD28.vec_20.y = v66.y;
Ritor1
parents:
diff changeset
5633 stru_F8AD28.vec_20.z = v66.z;
Ritor1
parents:
diff changeset
5634 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22;
Ritor1
parents:
diff changeset
5635 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
5636 {
Ritor1
parents:
diff changeset
5637 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5638 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74;
Ritor1
parents:
diff changeset
5639 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5640 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X;
Ritor1
parents:
diff changeset
5641 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5642 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5643 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5644 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5645 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5646 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
5647 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5648 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5649 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
5650 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5651 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5652 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5653 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5654 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5655 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5656 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5657 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
5658 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5659 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
5660 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5661 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5662 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5663 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5664 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5665 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5666 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5667 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5668 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5669 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5670 v73 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5671 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5672 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5673 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5674 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5675 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5676 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5677 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5678 }
Ritor1
parents:
diff changeset
5679 else
Ritor1
parents:
diff changeset
5680 {
Ritor1
parents:
diff changeset
5681 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5682 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5683 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5684 - v70;
Ritor1
parents:
diff changeset
5685 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
5686 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5687 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5688 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5689 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5690 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5691 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5692 - v70;
Ritor1
parents:
diff changeset
5693 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
5694 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5695 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5696 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5697 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5698 - v70;
Ritor1
parents:
diff changeset
5699 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5700 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5701 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
5702 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5703 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5704 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5705 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5706 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5707 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5708 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5709 v70 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5710 }
Ritor1
parents:
diff changeset
5711 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
5712 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z
Ritor1
parents:
diff changeset
5713 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
5714 + stru_F8AD28.plane_4.vNormal.y * v13
Ritor1
parents:
diff changeset
5715 + stru_F8AD28.plane_4.vNormal.x * v14;
Ritor1
parents:
diff changeset
5716 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5717 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
5718 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5719 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
5720 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
5721 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
5722 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
5723 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
5724 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
5725 v15 = v70;
Ritor1
parents:
diff changeset
5726 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16;
Ritor1
parents:
diff changeset
5727 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
5728 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70);
Ritor1
parents:
diff changeset
5729 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
5730 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
5731 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
5732 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16;
Ritor1
parents:
diff changeset
5733 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16;
Ritor1
parents:
diff changeset
5734 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
5735 stru_F8AD28.field_A8 = -(X
Ritor1
parents:
diff changeset
5736 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16)
Ritor1
parents:
diff changeset
5737 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16));
Ritor1
parents:
diff changeset
5738 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 )
Ritor1
parents:
diff changeset
5739 {
Ritor1
parents:
diff changeset
5740 stru_F8AD28.field_3E4 = 1;
Ritor1
parents:
diff changeset
5741 stru_F8AD28.field_3E8 = *(int *)&v68->field_4;
Ritor1
parents:
diff changeset
5742 stru_F8AD28.field_3EC = *(int *)&v68->field_8;
Ritor1
parents:
diff changeset
5743 stru_F8AD28.field_3F0 = v68->field_1E;
Ritor1
parents:
diff changeset
5744 stru_F8AD28.field_3F4 = v68->field_20;
Ritor1
parents:
diff changeset
5745 }
Ritor1
parents:
diff changeset
5746 else
Ritor1
parents:
diff changeset
5747 {
Ritor1
parents:
diff changeset
5748 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
5749 }
Ritor1
parents:
diff changeset
5750 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5751 v17 = 116 * v1->uSectorID;
Ritor1
parents:
diff changeset
5752 v69 = v17;
Ritor1
parents:
diff changeset
5753 v74 = 0;
Ritor1
parents:
diff changeset
5754 v73 = 0;
Ritor1
parents:
diff changeset
5755 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16;
Ritor1
parents:
diff changeset
5756 v70 = pMobileLightsStack->uNumLightsActive;
Ritor1
parents:
diff changeset
5757 if ( pMobileLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
5758 {
Ritor1
parents:
diff changeset
5759 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
5760 do
Ritor1
parents:
diff changeset
5761 {
Ritor1
parents:
diff changeset
5762 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
5763 break;
Ritor1
parents:
diff changeset
5764 v19 = *((short *)v18 + 2);
Ritor1
parents:
diff changeset
5765 v20 = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
5766 if ( v20 > v1->pBounding.x1 - v19 )
Ritor1
parents:
diff changeset
5767 {
Ritor1
parents:
diff changeset
5768 if ( v20 < v19 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5769 {
Ritor1
parents:
diff changeset
5770 v21 = *(short *)v18;
Ritor1
parents:
diff changeset
5771 if ( v21 > v1->pBounding.y1 - v19 )
Ritor1
parents:
diff changeset
5772 {
Ritor1
parents:
diff changeset
5773 if ( v21 < v19 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5774 {
Ritor1
parents:
diff changeset
5775 v22 = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
5776 if ( v22 > v1->pBounding.z1 - v19 )
Ritor1
parents:
diff changeset
5777 {
Ritor1
parents:
diff changeset
5778 if ( v22 < v19 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5779 {
Ritor1
parents:
diff changeset
5780 X = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5781 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
5782 + v21 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
5783 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
5784 if ( X <= v19 )
Ritor1
parents:
diff changeset
5785 {
Ritor1
parents:
diff changeset
5786 v23 = X;
Ritor1
parents:
diff changeset
5787 v24 = v74;
Ritor1
parents:
diff changeset
5788 stru_F8AD28._blv_lights_radii[v74] = v19;
Ritor1
parents:
diff changeset
5789 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19;
Ritor1
parents:
diff changeset
5790 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16;
Ritor1
parents:
diff changeset
5791 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
5792 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18;
Ritor1
parents:
diff changeset
5793 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
5794 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6];
Ritor1
parents:
diff changeset
5795 v25 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5796 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7];
Ritor1
parents:
diff changeset
5797 v26 = (unsigned __int8)v18[8];
Ritor1
parents:
diff changeset
5798 *(float *)(v24 * 4 + 16297992) = v25;
Ritor1
parents:
diff changeset
5799 v27 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
5800 v68 = (BLVFaceExtra *)v26;
Ritor1
parents:
diff changeset
5801 *(float *)(v24 * 4 + 16298072) = v27 * v16;
Ritor1
parents:
diff changeset
5802 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5803 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5804 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23);
Ritor1
parents:
diff changeset
5805 v28 = v74;
Ritor1
parents:
diff changeset
5806 v29 = v18[9];
Ritor1
parents:
diff changeset
5807 ++v74;
Ritor1
parents:
diff changeset
5808 stru_F8AD28._blv_lights_types[v28] = v29;
Ritor1
parents:
diff changeset
5809 }
Ritor1
parents:
diff changeset
5810 }
Ritor1
parents:
diff changeset
5811 }
Ritor1
parents:
diff changeset
5812 }
Ritor1
parents:
diff changeset
5813 }
Ritor1
parents:
diff changeset
5814 }
Ritor1
parents:
diff changeset
5815 }
Ritor1
parents:
diff changeset
5816 ++v73;
Ritor1
parents:
diff changeset
5817 v18 += 18;
Ritor1
parents:
diff changeset
5818 v17 = v69;
Ritor1
parents:
diff changeset
5819 }
Ritor1
parents:
diff changeset
5820 while ( v73 < v70 );
Ritor1
parents:
diff changeset
5821 }
Ritor1
parents:
diff changeset
5822 v30 = 0;
Ritor1
parents:
diff changeset
5823 v73 = 0;
Ritor1
parents:
diff changeset
5824 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
5825 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
5826 if ( v31 > 0 )
Ritor1
parents:
diff changeset
5827 {
Ritor1
parents:
diff changeset
5828 while ( v74 < 20 )
Ritor1
parents:
diff changeset
5829 {
Ritor1
parents:
diff changeset
5830 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)];
Ritor1
parents:
diff changeset
5831 if ( !(v32->uAtributes & 8) )
Ritor1
parents:
diff changeset
5832 {
Ritor1
parents:
diff changeset
5833 v33 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
5834 v34 = v32->vPosition.x;
Ritor1
parents:
diff changeset
5835 X = v32->uBrightness;
Ritor1
parents:
diff changeset
5836 v35 = v32->uRadius;
Ritor1
parents:
diff changeset
5837 v68 = (BLVFaceExtra *)v32->uRadius;
Ritor1
parents:
diff changeset
5838 if ( v34 > v33 - v35 )
Ritor1
parents:
diff changeset
5839 {
Ritor1
parents:
diff changeset
5840 if ( v34 < v35 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5841 {
Ritor1
parents:
diff changeset
5842 v36 = v32->vPosition.y;
Ritor1
parents:
diff changeset
5843 if ( v36 > v1->pBounding.y1 - v35 )
Ritor1
parents:
diff changeset
5844 {
Ritor1
parents:
diff changeset
5845 if ( v36 < v35 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5846 {
Ritor1
parents:
diff changeset
5847 v37 = v32->vPosition.z;
Ritor1
parents:
diff changeset
5848 if ( v37 > v1->pBounding.z1 - v35 )
Ritor1
parents:
diff changeset
5849 {
Ritor1
parents:
diff changeset
5850 if ( v37 < v35 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5851 {
Ritor1
parents:
diff changeset
5852 v38 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5853 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
5854 + v37 * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
5855 + v36 * v1->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
5856 if ( v38 >= 0 )
Ritor1
parents:
diff changeset
5857 {
Ritor1
parents:
diff changeset
5858 if ( v38 <= v35 && v35 )
Ritor1
parents:
diff changeset
5859 {
Ritor1
parents:
diff changeset
5860 v39 = v74;
Ritor1
parents:
diff changeset
5861 stru_F8AD28._blv_lights_radii[v74] = v35;
Ritor1
parents:
diff changeset
5862 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68;
Ritor1
parents:
diff changeset
5863 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16;
Ritor1
parents:
diff changeset
5864 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x;
Ritor1
parents:
diff changeset
5865 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y;
Ritor1
parents:
diff changeset
5866 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z;
Ritor1
parents:
diff changeset
5867 v68 = (BLVFaceExtra *)v32->uRed;
Ritor1
parents:
diff changeset
5868 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5869 v68 = (BLVFaceExtra *)v32->uGreen;
Ritor1
parents:
diff changeset
5870 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5871 v68 = (BLVFaceExtra *)v32->uBlue;
Ritor1
parents:
diff changeset
5872 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5873 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5874 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38);
Ritor1
parents:
diff changeset
5875 v40 = v74++;
Ritor1
parents:
diff changeset
5876 stru_F8AD28._blv_lights_types[v40] = 1;
Ritor1
parents:
diff changeset
5877 }
Ritor1
parents:
diff changeset
5878 }
Ritor1
parents:
diff changeset
5879 }
Ritor1
parents:
diff changeset
5880 }
Ritor1
parents:
diff changeset
5881 }
Ritor1
parents:
diff changeset
5882 }
Ritor1
parents:
diff changeset
5883 }
Ritor1
parents:
diff changeset
5884 }
Ritor1
parents:
diff changeset
5885 }
Ritor1
parents:
diff changeset
5886 v30 = v73++ + 1;
Ritor1
parents:
diff changeset
5887 if ( v73 >= v70 )
Ritor1
parents:
diff changeset
5888 break;
Ritor1
parents:
diff changeset
5889 v17 = v69;
Ritor1
parents:
diff changeset
5890 }
Ritor1
parents:
diff changeset
5891 }
Ritor1
parents:
diff changeset
5892 v73 = 0;
Ritor1
parents:
diff changeset
5893 if ( pStationaryLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
5894 {
Ritor1
parents:
diff changeset
5895 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
5896 do
Ritor1
parents:
diff changeset
5897 {
Ritor1
parents:
diff changeset
5898 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
5899 break;
Ritor1
parents:
diff changeset
5900 v42 = *((short *)v41 + 2);
Ritor1
parents:
diff changeset
5901 v43 = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
5902 if ( v43 > v1->pBounding.x1 - v42 )
Ritor1
parents:
diff changeset
5903 {
Ritor1
parents:
diff changeset
5904 if ( v43 < v42 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5905 {
Ritor1
parents:
diff changeset
5906 v44 = *(short *)v41;
Ritor1
parents:
diff changeset
5907 if ( v44 > v1->pBounding.y1 - v42 )
Ritor1
parents:
diff changeset
5908 {
Ritor1
parents:
diff changeset
5909 if ( v44 < v42 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5910 {
Ritor1
parents:
diff changeset
5911 v45 = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
5912 if ( v45 > v1->pBounding.z1 - v42 )
Ritor1
parents:
diff changeset
5913 {
Ritor1
parents:
diff changeset
5914 if ( v45 < v42 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5915 {
Ritor1
parents:
diff changeset
5916 v46 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5917 + *(short *)v41 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
5918 + v43 * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
5919 + v45 * v1->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
5920 v69 = v46;
Ritor1
parents:
diff changeset
5921 if ( v46 >= 0 )
Ritor1
parents:
diff changeset
5922 {
Ritor1
parents:
diff changeset
5923 if ( v46 <= v42 )
Ritor1
parents:
diff changeset
5924 {
Ritor1
parents:
diff changeset
5925 v47 = v69;
Ritor1
parents:
diff changeset
5926 v48 = v74;
Ritor1
parents:
diff changeset
5927 stru_F8AD28._blv_lights_radii[v74] = v42;
Ritor1
parents:
diff changeset
5928 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42;
Ritor1
parents:
diff changeset
5929 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
5930 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41;
Ritor1
parents:
diff changeset
5931 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
5932 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6];
Ritor1
parents:
diff changeset
5933 v49 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5934 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7];
Ritor1
parents:
diff changeset
5935 v50 = (unsigned __int8)v41[8];
Ritor1
parents:
diff changeset
5936 stru_F8AD28._blv_lights_rs[v48] = v49;
Ritor1
parents:
diff changeset
5937 v51 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
5938 v68 = (BLVFaceExtra *)v50;
Ritor1
parents:
diff changeset
5939 stru_F8AD28._blv_lights_gs[v48] = v51 * v16;
Ritor1
parents:
diff changeset
5940 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5941 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5942 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47);
Ritor1
parents:
diff changeset
5943 v52 = v74++;
Ritor1
parents:
diff changeset
5944 stru_F8AD28._blv_lights_types[v52] = 1;
Ritor1
parents:
diff changeset
5945 }
Ritor1
parents:
diff changeset
5946 }
Ritor1
parents:
diff changeset
5947 }
Ritor1
parents:
diff changeset
5948 }
Ritor1
parents:
diff changeset
5949 }
Ritor1
parents:
diff changeset
5950 }
Ritor1
parents:
diff changeset
5951 }
Ritor1
parents:
diff changeset
5952 }
Ritor1
parents:
diff changeset
5953 ++v73;
Ritor1
parents:
diff changeset
5954 v41 += 12;
Ritor1
parents:
diff changeset
5955 }
Ritor1
parents:
diff changeset
5956 while ( v73 < pStationaryLightsStack->uNumLightsActive );
Ritor1
parents:
diff changeset
5957 }
Ritor1
parents:
diff changeset
5958 stru_F8AD28.uNumLightsApplied = v74;
Ritor1
parents:
diff changeset
5959 v53 = v1->pBounding.x2;
Ritor1
parents:
diff changeset
5960 if ( pBLVRenderParams->vPartyPos.x <= v53 )
Ritor1
parents:
diff changeset
5961 {
Ritor1
parents:
diff changeset
5962 v55 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
5963 if ( pBLVRenderParams->vPartyPos.x >= v55 )
Ritor1
parents:
diff changeset
5964 v54 = 0;
Ritor1
parents:
diff changeset
5965 else
Ritor1
parents:
diff changeset
5966 v54 = v55 - pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5967 }
Ritor1
parents:
diff changeset
5968 else
Ritor1
parents:
diff changeset
5969 {
Ritor1
parents:
diff changeset
5970 v54 = pBLVRenderParams->vPartyPos.x - v53;
Ritor1
parents:
diff changeset
5971 }
Ritor1
parents:
diff changeset
5972 v56 = v1->pBounding.y2;
Ritor1
parents:
diff changeset
5973 v57 = v54 * v54;
Ritor1
parents:
diff changeset
5974 if ( pBLVRenderParams->vPartyPos.y <= v56 )
Ritor1
parents:
diff changeset
5975 {
Ritor1
parents:
diff changeset
5976 v59 = v1->pBounding.y1;
Ritor1
parents:
diff changeset
5977 if ( pBLVRenderParams->vPartyPos.y >= v59 )
Ritor1
parents:
diff changeset
5978 v58 = 0;
Ritor1
parents:
diff changeset
5979 else
Ritor1
parents:
diff changeset
5980 v58 = v59 - pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5981 }
Ritor1
parents:
diff changeset
5982 else
Ritor1
parents:
diff changeset
5983 {
Ritor1
parents:
diff changeset
5984 v58 = pBLVRenderParams->vPartyPos.y - v56;
Ritor1
parents:
diff changeset
5985 }
Ritor1
parents:
diff changeset
5986 v60 = v58 * v58 + v57;
Ritor1
parents:
diff changeset
5987 v61 = v1->pBounding.z2;
Ritor1
parents:
diff changeset
5988 if ( pBLVRenderParams->vPartyPos.z <= v61 )
Ritor1
parents:
diff changeset
5989 {
Ritor1
parents:
diff changeset
5990 v63 = v1->pBounding.z1;
Ritor1
parents:
diff changeset
5991 if ( pBLVRenderParams->vPartyPos.z >= v63 )
Ritor1
parents:
diff changeset
5992 v62 = 0;
Ritor1
parents:
diff changeset
5993 else
Ritor1
parents:
diff changeset
5994 v62 = v63 - pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5995 }
Ritor1
parents:
diff changeset
5996 else
Ritor1
parents:
diff changeset
5997 {
Ritor1
parents:
diff changeset
5998 v62 = pBLVRenderParams->vPartyPos.z - v61;
Ritor1
parents:
diff changeset
5999 }
Ritor1
parents:
diff changeset
6000 v64 = v62 * v62 + v60;
Ritor1
parents:
diff changeset
6001 if ( v64 )
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
6002 stru_F8AD28.field_34 = integer_sqrt(v64) << 16;
0
Ritor1
parents:
diff changeset
6003 else
Ritor1
parents:
diff changeset
6004 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
6005 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y);
Ritor1
parents:
diff changeset
6006 v65 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
6007 if ( v65 >= 655.36 )
Ritor1
parents:
diff changeset
6008 {
Ritor1
parents:
diff changeset
6009 if ( v65 >= 26214.4 )
Ritor1
parents:
diff changeset
6010 {
Ritor1
parents:
diff changeset
6011 if ( v65 >= 45875.2 )
Ritor1
parents:
diff changeset
6012 {
Ritor1
parents:
diff changeset
6013 stru_F8AD28.field_44 = 8;
Ritor1
parents:
diff changeset
6014 stru_F8AD28.field_48 = 3;
Ritor1
parents:
diff changeset
6015 }
Ritor1
parents:
diff changeset
6016 else
Ritor1
parents:
diff changeset
6017 {
Ritor1
parents:
diff changeset
6018 stru_F8AD28.field_44 = 16;
Ritor1
parents:
diff changeset
6019 stru_F8AD28.field_48 = 4;
Ritor1
parents:
diff changeset
6020 }
Ritor1
parents:
diff changeset
6021 }
Ritor1
parents:
diff changeset
6022 else
Ritor1
parents:
diff changeset
6023 {
Ritor1
parents:
diff changeset
6024 stru_F8AD28.field_44 = 32;
Ritor1
parents:
diff changeset
6025 stru_F8AD28.field_48 = 5;
Ritor1
parents:
diff changeset
6026 }
Ritor1
parents:
diff changeset
6027 }
Ritor1
parents:
diff changeset
6028 else
Ritor1
parents:
diff changeset
6029 {
Ritor1
parents:
diff changeset
6030 stru_F8AD28.field_44 = 64;
Ritor1
parents:
diff changeset
6031 stru_F8AD28.field_48 = 6;
Ritor1
parents:
diff changeset
6032 }
Ritor1
parents:
diff changeset
6033 }
Ritor1
parents:
diff changeset
6034 // 519AB4: using guessed type int uNumStationaryLightsApplied;
Ritor1
parents:
diff changeset
6035
Ritor1
parents:
diff changeset
6036 //----- (004AF412) --------------------------------------------------------
Ritor1
parents:
diff changeset
6037 int __cdecl sub_4AF412()
Ritor1
parents:
diff changeset
6038 {
Ritor1
parents:
diff changeset
6039 int v0; // ST20_4@2
Ritor1
parents:
diff changeset
6040 int v1; // ST20_4@2
Ritor1
parents:
diff changeset
6041 int v2; // ST20_4@2
Ritor1
parents:
diff changeset
6042 int v3; // esi@2
Ritor1
parents:
diff changeset
6043 int v4; // ST20_4@2
Ritor1
parents:
diff changeset
6044 int v5; // ecx@2
Ritor1
parents:
diff changeset
6045 int v6; // ebx@2
Ritor1
parents:
diff changeset
6046 int v7; // edi@2
Ritor1
parents:
diff changeset
6047 int v8; // edx@2
Ritor1
parents:
diff changeset
6048 int v9; // eax@2
Ritor1
parents:
diff changeset
6049 int result; // eax@4
Ritor1
parents:
diff changeset
6050
Ritor1
parents:
diff changeset
6051 stru_F8AD28.plane_4.vNormal.z = -65536;
Ritor1
parents:
diff changeset
6052 stru_F8AD28.vec_20.y = -65536;
Ritor1
parents:
diff changeset
6053 stru_F8AD28.plane_4.vNormal.x = 0;
Ritor1
parents:
diff changeset
6054 stru_F8AD28.plane_4.vNormal.y = 0;
Ritor1
parents:
diff changeset
6055 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16;
Ritor1
parents:
diff changeset
6056 stru_F8AD28.vec_14.x = 65536;
Ritor1
parents:
diff changeset
6057 stru_F8AD28.vec_14.y = 0;
Ritor1
parents:
diff changeset
6058 stru_F8AD28.vec_14.z = 0;
Ritor1
parents:
diff changeset
6059 stru_F8AD28.vec_20.x = 0;
Ritor1
parents:
diff changeset
6060 stru_F8AD28.vec_20.z = 0;
Ritor1
parents:
diff changeset
6061 stru_F8AD28.uDefaultAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
6062 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
6063 {
Ritor1
parents:
diff changeset
6064 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6065 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6066 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
6067 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
6068 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
6069 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
6070 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6071 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
6072 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6073 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
6074 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
6075 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
6076 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6077 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6078 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
6079 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
6080 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6081 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6082 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
6083 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
6084 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6085 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6086 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
6087 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
6088 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6089 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6090 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
6091 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
6092 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
6093 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
6094 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
6095 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
6096 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
6097 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
6098 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
6099 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
6100 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
6101 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
6102 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
6103 }
Ritor1
parents:
diff changeset
6104 else
Ritor1
parents:
diff changeset
6105 {
Ritor1
parents:
diff changeset
6106 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
6107 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6108 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
6109 * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6110 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
6111 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
6112 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6113 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
6114 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6115 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6116 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6117 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
6118 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6119 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6120 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
6121 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
6122 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
6123 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
6124 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
6125 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
6126 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
6127 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
6128 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
6129 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
6130 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
6131 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
6132 v7 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
6133 }
Ritor1
parents:
diff changeset
6134 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
6135 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8
Ritor1
parents:
diff changeset
6136 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
6137 + stru_F8AD28.plane_4.vNormal.x * v9
Ritor1
parents:
diff changeset
6138 + stru_F8AD28.plane_4.vNormal.z * v6;
Ritor1
parents:
diff changeset
6139 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
6140 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
6141 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
6142 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
6143 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
6144 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
6145 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
6146 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
6147 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
6148 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
6149 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
6150 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
6151 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
6152 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
6153 result = 0;
Ritor1
parents:
diff changeset
6154 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
6155 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
6156 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
6157 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
6158 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
6159 stru_F8AD28.uCurrentAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
6160 stru_F8AD28.uNumLightsApplied = 0;
Ritor1
parents:
diff changeset
6161 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
6162 return result;
Ritor1
parents:
diff changeset
6163 }
Ritor1
parents:
diff changeset
6164
Ritor1
parents:
diff changeset
6165
Ritor1
parents:
diff changeset
6166
Ritor1
parents:
diff changeset
6167
Ritor1
parents:
diff changeset
6168
Ritor1
parents:
diff changeset
6169
Ritor1
parents:
diff changeset
6170 //----- (004B1447) --------------------------------------------------------
Ritor1
parents:
diff changeset
6171 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
6172 {
Ritor1
parents:
diff changeset
6173 signed int v3; // esi@1
Ritor1
parents:
diff changeset
6174 char v4; // sf@8
Ritor1
parents:
diff changeset
6175 int v5; // eax@8
Ritor1
parents:
diff changeset
6176 unsigned __int64 v6; // qax@12
Ritor1
parents:
diff changeset
6177 DDM_DLV_Header *v7; // eax@14
Ritor1
parents:
diff changeset
6178 Player **v8; // edi@18
Ritor1
parents:
diff changeset
6179 Player *result; // eax@19
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6180 //char *v10; // esi@20
0
Ritor1
parents:
diff changeset
6181
Ritor1
parents:
diff changeset
6182 v3 = 0;
Ritor1
parents:
diff changeset
6183 if ( a2 )
Ritor1
parents:
diff changeset
6184 {
Ritor1
parents:
diff changeset
6185 if ( a2 != 1 )
Ritor1
parents:
diff changeset
6186 {
Ritor1
parents:
diff changeset
6187 if ( a2 == 2 )
Ritor1
parents:
diff changeset
6188 v3 = 2;
Ritor1
parents:
diff changeset
6189 goto LABEL_13;
Ritor1
parents:
diff changeset
6190 }
Ritor1
parents:
diff changeset
6191 v3 = 2;
Ritor1
parents:
diff changeset
6192 }
Ritor1
parents:
diff changeset
6193 else
Ritor1
parents:
diff changeset
6194 {
Ritor1
parents:
diff changeset
6195 v3 = 1;
Ritor1
parents:
diff changeset
6196 }
Ritor1
parents:
diff changeset
6197 if ( pParty->uFine < 4000000 )
Ritor1
parents:
diff changeset
6198 {
Ritor1
parents:
diff changeset
6199 v4 = a3 + pParty->uFine < 0;
Ritor1
parents:
diff changeset
6200 v5 = a3 + pParty->uFine;
Ritor1
parents:
diff changeset
6201 pParty->uFine += a3;
Ritor1
parents:
diff changeset
6202 if ( v4 )
Ritor1
parents:
diff changeset
6203 {
Ritor1
parents:
diff changeset
6204 v5 = 0;
Ritor1
parents:
diff changeset
6205 pParty->uFine = 0;
Ritor1
parents:
diff changeset
6206 }
Ritor1
parents:
diff changeset
6207 if ( v5 > 4000000 )
Ritor1
parents:
diff changeset
6208 pParty->uFine = 4000000;
Ritor1
parents:
diff changeset
6209 }
487
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6210
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6211 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640;
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6212
0
Ritor1
parents:
diff changeset
6213 LABEL_13:
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
6214 pParty->InTheShopFlags[a1] = 1;
0
Ritor1
parents:
diff changeset
6215 if ( v3 )
Ritor1
parents:
diff changeset
6216 {
Ritor1
parents:
diff changeset
6217 v7 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
6218 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
6219 v7 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
6220 v7->uReputation += v3;
Ritor1
parents:
diff changeset
6221 if ( v7->uReputation > 10000 )
Ritor1
parents:
diff changeset
6222 v7->uReputation = 10000;
Ritor1
parents:
diff changeset
6223 }
Ritor1
parents:
diff changeset
6224 v8 = &pPlayers[1];
Ritor1
parents:
diff changeset
6225 do
Ritor1
parents:
diff changeset
6226 {
Ritor1
parents:
diff changeset
6227 result = *v8;
Ritor1
parents:
diff changeset
6228 if ( pParty->uFine )
Ritor1
parents:
diff changeset
6229 {
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6230 //v10 = result->_guilds_member_bits;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6231 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
0
Ritor1
parents:
diff changeset
6232 if ( !(short)result )
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6233 __debugbreak();
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 493
diff changeset
6234 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
0
Ritor1
parents:
diff changeset
6235 }
Ritor1
parents:
diff changeset
6236 ++v8;
Ritor1
parents:
diff changeset
6237 }
Ritor1
parents:
diff changeset
6238 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
6239 return result;
Ritor1
parents:
diff changeset
6240 }
Ritor1
parents:
diff changeset
6241
Ritor1
parents:
diff changeset
6242 //----- (004B1523) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
6243 void __thiscall sub_4B1523(int *_this)
0
Ritor1
parents:
diff changeset
6244 {
Ritor1
parents:
diff changeset
6245 int v1; // esi@1
Ritor1
parents:
diff changeset
6246 int v2; // edx@1
Ritor1
parents:
diff changeset
6247 unsigned int v3; // eax@2
Ritor1
parents:
diff changeset
6248 int v4; // eax@4
Ritor1
parents:
diff changeset
6249 LONG v5; // ecx@4
Ritor1
parents:
diff changeset
6250 int v6; // eax@10
Ritor1
parents:
diff changeset
6251 char *v7; // ST44_4@12
Ritor1
parents:
diff changeset
6252 unsigned __int16 v8; // ax@12
Ritor1
parents:
diff changeset
6253 GUIWindow a1; // [sp+Ch] [bp-68h]@4
Ritor1
parents:
diff changeset
6254 unsigned int v11; // [sp+60h] [bp-14h]@1
Ritor1
parents:
diff changeset
6255 POINT a2; // [sp+64h] [bp-10h]@1
Ritor1
parents:
diff changeset
6256 int v13; // [sp+6Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
6257 int v14; // [sp+70h] [bp-4h]@4
Ritor1
parents:
diff changeset
6258
Ritor1
parents:
diff changeset
6259 v1 = *_this - 399;
Ritor1
parents:
diff changeset
6260 v2 = (*_this - 400) % 11 + 1;
Ritor1
parents:
diff changeset
6261 v11 = 4 * (*_this - 400) / 11;
Ritor1
parents:
diff changeset
6262 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
Ritor1
parents:
diff changeset
6263 if ( pMouse->GetCursorPos(&a2)->y <= 320 )
Ritor1
parents:
diff changeset
6264 v3 = pMouse->GetCursorPos(&a2)->y + 30;
Ritor1
parents:
diff changeset
6265 else
Ritor1
parents:
diff changeset
6266 v3 = 30;
Ritor1
parents:
diff changeset
6267 a1.Hint = 0;
Ritor1
parents:
diff changeset
6268 a1.uFrameY = v3;
Ritor1
parents:
diff changeset
6269 a1.uFrameWidth = 328;
Ritor1
parents:
diff changeset
6270 a1.uFrameHeight = 68;
Ritor1
parents:
diff changeset
6271 a1.uFrameX = 90;
Ritor1
parents:
diff changeset
6272 a1.uFrameZ = 417;
Ritor1
parents:
diff changeset
6273 a1.uFrameW = v3 + 67;
Ritor1
parents:
diff changeset
6274 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
Ritor1
parents:
diff changeset
6275 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
Ritor1
parents:
diff changeset
6276 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
Ritor1
parents:
diff changeset
6277 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
Ritor1
parents:
diff changeset
6278 v5 = a2.y;
Ritor1
parents:
diff changeset
6279 if ( v14 > a2.y )
Ritor1
parents:
diff changeset
6280 v5 = v14;
Ritor1
parents:
diff changeset
6281 if ( v13 > v5 )
Ritor1
parents:
diff changeset
6282 v5 = v13;
Ritor1
parents:
diff changeset
6283 if ( v4 > v5 )
Ritor1
parents:
diff changeset
6284 v5 = v4;
262
Ritor1
parents: 250
diff changeset
6285 sprintf(pTmpBuf2, "%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",
Ritor1
parents: 250
diff changeset
6286 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal"
Ritor1
parents: 250
diff changeset
6287 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert"
Ritor1
parents: 250
diff changeset
6288 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master"
Ritor1
parents: 250
diff changeset
6289 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand"
Ritor1
parents: 250
diff changeset
6290 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
0
Ritor1
parents:
diff changeset
6291 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
Ritor1
parents:
diff changeset
6292 a1.uFrameHeight += v6;
Ritor1
parents:
diff changeset
6293 if ( (signed int)a1.uFrameHeight < 150 )
Ritor1
parents:
diff changeset
6294 a1.uFrameHeight = 150;
Ritor1
parents:
diff changeset
6295 a1.uFrameWidth = 460;
Ritor1
parents:
diff changeset
6296 a1.DrawMessageBox(0);
Ritor1
parents:
diff changeset
6297 a1.uFrameWidth -= 12;
Ritor1
parents:
diff changeset
6298 a1.uFrameHeight -= 12;
Ritor1
parents:
diff changeset
6299 v7 = pSpellStats->pInfos[v1].pName;
Ritor1
parents:
diff changeset
6300 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
Ritor1
parents:
diff changeset
6301 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
Ritor1
parents:
diff changeset
6302 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
Ritor1
parents:
diff changeset
6303 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
Ritor1
parents:
diff changeset
6304 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
Ritor1
parents:
diff changeset
6305 a1.uFrameZ = a1.uFrameX + 107;
Ritor1
parents:
diff changeset
6306 a1.uFrameWidth = 108;
Ritor1
parents:
diff changeset
6307 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
Ritor1
parents:
diff changeset
6308 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
6309 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3);
0
Ritor1
parents:
diff changeset
6310 }
Ritor1
parents:
diff changeset
6311
Ritor1
parents:
diff changeset
6312
Ritor1
parents:
diff changeset
6313 //----- (004B1784) --------------------------------------------------------
Ritor1
parents:
diff changeset
6314 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
Ritor1
parents:
diff changeset
6315 {
Ritor1
parents:
diff changeset
6316 Player *pPlayer; // ebx@1
Ritor1
parents:
diff changeset
6317 bool result; // eax@2
Ritor1
parents:
diff changeset
6318 unsigned __int16 v2; // ST0C_2@3
Ritor1
parents:
diff changeset
6319 int v3; // eax@3
Ritor1
parents:
diff changeset
6320 GUIWindow v4; // [sp+4h] [bp-54h]@3
Ritor1
parents:
diff changeset
6321
Ritor1
parents:
diff changeset
6322 pPlayer = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
6323 if ( pPlayer->CanAct() )
Ritor1
parents:
diff changeset
6324 {
Ritor1
parents:
diff changeset
6325 pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
Ritor1
parents:
diff changeset
6326 result = 1;
Ritor1
parents:
diff changeset
6327 }
Ritor1
parents:
diff changeset
6328 else
Ritor1
parents:
diff changeset
6329 {
Ritor1
parents:
diff changeset
6330 pDialogueWindow->pNumPresenceButton = 0;
Ritor1
parents:
diff changeset
6331 memcpy(&v4, pPrimaryWindow, sizeof(v4));
Ritor1
parents:
diff changeset
6332 v4.uFrameX = 483;
Ritor1
parents:
diff changeset
6333 v4.uFrameWidth = 148;
Ritor1
parents:
diff changeset
6334 v4.uFrameZ = 334;
Ritor1
parents:
diff changeset
6335 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);//
Ritor1
parents:
diff changeset
6336 // "%s is in no condition to %s"
Ritor1
parents:
diff changeset
6337 // "do anything"
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
6338 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu);
0
Ritor1
parents:
diff changeset
6339 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0);
Ritor1
parents:
diff changeset
6340 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
6341 result = 0;
Ritor1
parents:
diff changeset
6342 }
Ritor1
parents:
diff changeset
6343 return result;
Ritor1
parents:
diff changeset
6344 }
Ritor1
parents:
diff changeset
6345 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
6346
Ritor1
parents:
diff changeset
6347
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
6348 //view item details in shop?
0
Ritor1
parents:
diff changeset
6349 //----- (004B1A2D) --------------------------------------------------------
Ritor1
parents:
diff changeset
6350 void __cdecl sub_4B1A2D()
Ritor1
parents:
diff changeset
6351 {
358
4a236657a0be GameMenuButton fix
Ritor1
parents: 355
diff changeset
6352 //Player *v0; // edi@1
0
Ritor1
parents:
diff changeset
6353 POINT *v1; // esi@5
Ritor1
parents:
diff changeset
6354 unsigned int v2; // eax@5
Ritor1
parents:
diff changeset
6355 int v3; // ecx@5
Ritor1
parents:
diff changeset
6356 POINT *v4; // esi@12
Ritor1
parents:
diff changeset
6357 int v5; // eax@12
Ritor1
parents:
diff changeset
6358 unsigned int v6; // eax@13
Ritor1
parents:
diff changeset
6359 ItemGen *v7; // ecx@13
Ritor1
parents:
diff changeset
6360 signed int v8; // esi@17
Ritor1
parents:
diff changeset
6361 unsigned int v9; // eax@19
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6362 POINT v10; // [sp+8h] [bp-44h]@12
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6363 POINT v11; // [sp+10h] [bp-3Ch]@12
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6364 POINT v12; // [sp+18h] [bp-34h]@18
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6365 POINT v13; // [sp+20h] [bp-2Ch]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6366 POINT v14; // [sp+28h] [bp-24h]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6367 POINT v15; // [sp+30h] [bp-1Ch]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6368 POINT v16; // [sp+38h] [bp-14h]@5
0
Ritor1
parents:
diff changeset
6369 POINT a2; // [sp+40h] [bp-Ch]@5
Ritor1
parents:
diff changeset
6370 int v18; // [sp+48h] [bp-4h]@5
Ritor1
parents:
diff changeset
6371
358
4a236657a0be GameMenuButton fix
Ritor1
parents: 355
diff changeset
6372 //v0 = pPlayers[uActiveCharacter];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6373 if ( in_current_building_type <= 0 )
0
Ritor1
parents:
diff changeset
6374 return;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6375 if ( in_current_building_type <= BildingType_AlchemistShop )
0
Ritor1
parents:
diff changeset
6376 {
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6377 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6378 {
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6379 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
0
Ritor1
parents:
diff changeset
6380 return;
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6381 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
0
Ritor1
parents:
diff changeset
6382 {
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6383 v8 = pMouse->GetCursorPos(&v15)->x - 14;
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6384 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5);
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6385 if ( pMouse->GetCursorPos(&v13)->x <= 13
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6386 || pMouse->GetCursorPos(&v12)->x >= 462
358
4a236657a0be GameMenuButton fix
Ritor1
parents: 355
diff changeset
6387 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 )
0
Ritor1
parents:
diff changeset
6388 return;
358
4a236657a0be GameMenuButton fix
Ritor1
parents: 355
diff changeset
6389 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1];
0
Ritor1
parents:
diff changeset
6390 LABEL_15:
Ritor1
parents:
diff changeset
6391 GameUI_DrawItemInfo(v7);
Ritor1
parents:
diff changeset
6392 return;
Ritor1
parents:
diff changeset
6393 }
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6394 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
0
Ritor1
parents:
diff changeset
6395 return;
Ritor1
parents:
diff changeset
6396 }
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6397 v4 = pMouse->GetCursorPos(&v11);
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6398 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF;
0
Ritor1
parents:
diff changeset
6399 v18 = v5;
Ritor1
parents:
diff changeset
6400 if ( !v5 )
Ritor1
parents:
diff changeset
6401 return;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6402 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
0
Ritor1
parents:
diff changeset
6403 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6404 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
439
6b8118542175 recipie item
Gloval
parents: 437
diff changeset
6405 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
470
fcdaa804074f Tables for shopgenerators
Gloval
parents: 469
diff changeset
6406 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
0
Ritor1
parents:
diff changeset
6407 goto LABEL_15;
Ritor1
parents:
diff changeset
6408 }
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6409 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS )
0
Ritor1
parents:
diff changeset
6410 {
Ritor1
parents:
diff changeset
6411 v1 = pMouse->GetCursorPos(&a2);
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6412 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];
0
Ritor1
parents:
diff changeset
6413 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
Ritor1
parents:
diff changeset
6414 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
Ritor1
parents:
diff changeset
6415 if ( v18 )
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6416 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
0
Ritor1
parents:
diff changeset
6417 }
Ritor1
parents:
diff changeset
6418 }
Ritor1
parents:
diff changeset
6419 // F8B198: using guessed type int dword_F8B198;
Ritor1
parents:
diff changeset
6420 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
6421
Ritor1
parents:
diff changeset
6422 //----- (004B1BDB) --------------------------------------------------------
Ritor1
parents:
diff changeset
6423 void __stdcall RestAndHeal(__int64 uNumMinutes)
Ritor1
parents:
diff changeset
6424 {
Ritor1
parents:
diff changeset
6425 signed __int64 v1; // ST2C_8@1
Ritor1
parents:
diff changeset
6426 signed __int64 v2; // qax@1
Ritor1
parents:
diff changeset
6427 signed __int64 v3; // ST1C_8@1
Ritor1
parents:
diff changeset
6428 unsigned __int64 v4; // qax@1
Ritor1
parents:
diff changeset
6429 unsigned int v5; // ebx@1
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6430 Player *v6; // ebx@1
0
Ritor1
parents:
diff changeset
6431
Ritor1
parents:
diff changeset
6432 pParty->pHirelings[0].bHasUsedTheAbility = 0;
Ritor1
parents:
diff changeset
6433 pParty->pHirelings[1].bHasUsedTheAbility = 0;
Ritor1
parents:
diff changeset
6434 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335);
Ritor1
parents:
diff changeset
6435 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
Ritor1
parents:
diff changeset
6436 v2 = v1 / 60 / 60;
Ritor1
parents:
diff changeset
6437 v3 = v2;
Ritor1
parents:
diff changeset
6438 v4 = (unsigned int)v2 / 0x18;
Ritor1
parents:
diff changeset
6439 v5 = (unsigned int)(v4 / 7) >> 2;
Ritor1
parents:
diff changeset
6440 pParty->uCurrentTimeSecond = v1 % 60;
Ritor1
parents:
diff changeset
6441 pParty->uCurrentMinute = v1 / 60 % 60;
Ritor1
parents:
diff changeset
6442 pParty->uCurrentHour = v3 % 24;
Ritor1
parents:
diff changeset
6443 pParty->uCurrentMonthWeek = v4 / 7 & 3;
Ritor1
parents:
diff changeset
6444 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C;
Ritor1
parents:
diff changeset
6445 pParty->uCurrentMonth = v5 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
6446 pParty->uCurrentYear = v5 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
6447 pParty->RestAndHeal();
Ritor1
parents:
diff changeset
6448 dword_507B94 = 1;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6449 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
0
Ritor1
parents:
diff changeset
6450 do
Ritor1
parents:
diff changeset
6451 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6452 v6->uTimeToRecovery = 0;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6453 memset(&v6->uTimeToRecovery, 0, 4u);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6454 ++v6;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6455 }
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6456 while ( v6 <= &pParty->pPlayers[3] );
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
6457 pParty->UpdatePlayersAndHirelingsEmotions();
0
Ritor1
parents:
diff changeset
6458 }
Ritor1
parents:
diff changeset
6459 // 507B94: using guessed type int dword_507B94;
Ritor1
parents:
diff changeset
6460
Ritor1
parents:
diff changeset
6461 //----- (004B1D27) --------------------------------------------------------
Ritor1
parents:
diff changeset
6462 void __cdecl sub_4B1D27()
Ritor1
parents:
diff changeset
6463 {
Ritor1
parents:
diff changeset
6464 int v0; // edx@2
Ritor1
parents:
diff changeset
6465 unsigned int v1; // ecx@7
Ritor1
parents:
diff changeset
6466 signed int v2; // edi@10
Ritor1
parents:
diff changeset
6467 int v3; // esi@10
Ritor1
parents:
diff changeset
6468 __int16 v4; // ax@15
Ritor1
parents:
diff changeset
6469 signed int v5; // edi@20
Ritor1
parents:
diff changeset
6470 int v6; // esi@20
Ritor1
parents:
diff changeset
6471 int v7[4]; // [sp+Ch] [bp-10h]@12
Ritor1
parents:
diff changeset
6472
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6473 if ( in_current_building_type > 0 )
0
Ritor1
parents:
diff changeset
6474 {
Ritor1
parents:
diff changeset
6475 v0 = 3;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6476 if ( in_current_building_type > BildingType_MagicShop )
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6477 {
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6478 if ( in_current_building_type == BildingType_Bank )
0
Ritor1
parents:
diff changeset
6479 {
Ritor1
parents:
diff changeset
6480 if ( !dword_F8B1E4 )
Ritor1
parents:
diff changeset
6481 return;
Ritor1
parents:
diff changeset
6482 }
Ritor1
parents:
diff changeset
6483 else
Ritor1
parents:
diff changeset
6484 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6485 if ( in_current_building_type != BildingType_Temple )
0
Ritor1
parents:
diff changeset
6486 return;
Ritor1
parents:
diff changeset
6487 }
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6488 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
0
Ritor1
parents:
diff changeset
6489 LABEL_28:
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6490 PlayHouseSound(v1, (HouseSoundID)v0);
0
Ritor1
parents:
diff changeset
6491 return;
Ritor1
parents:
diff changeset
6492 }
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6493 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6494 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed )
0
Ritor1
parents:
diff changeset
6495 {
Ritor1
parents:
diff changeset
6496 if ( pParty->uNumGold <= 0x2710 )
Ritor1
parents:
diff changeset
6497 {
Ritor1
parents:
diff changeset
6498 if ( !dword_F8B1E4 )
Ritor1
parents:
diff changeset
6499 return;
Ritor1
parents:
diff changeset
6500 v0 = 4;
Ritor1
parents:
diff changeset
6501 goto LABEL_28;
Ritor1
parents:
diff changeset
6502 }
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6503 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3));
0
Ritor1
parents:
diff changeset
6504 if ( !dword_F8B1E4 && !qword_A750D8 )
Ritor1
parents:
diff changeset
6505 {
Ritor1
parents:
diff changeset
6506 v5 = 0;
Ritor1
parents:
diff changeset
6507 v6 = 1;
Ritor1
parents:
diff changeset
6508 do
Ritor1
parents:
diff changeset
6509 {
Ritor1
parents:
diff changeset
6510 if ( pPlayers[v6]->CanAct() )
Ritor1
parents:
diff changeset
6511 v7[v5++] = v6;
Ritor1
parents:
diff changeset
6512 ++v6;
Ritor1
parents:
diff changeset
6513 }
Ritor1
parents:
diff changeset
6514 while ( v6 <= 4 );
Ritor1
parents:
diff changeset
6515 if ( v5 )
Ritor1
parents:
diff changeset
6516 {
Ritor1
parents:
diff changeset
6517 qword_A750D8 = 256i64;
Ritor1
parents:
diff changeset
6518 word_A750E0 = 80;
Ritor1
parents:
diff changeset
6519 v4 = LOWORD(v7[rand() % v5]);
Ritor1
parents:
diff changeset
6520 goto LABEL_16;
Ritor1
parents:
diff changeset
6521 }
Ritor1
parents:
diff changeset
6522 }
Ritor1
parents:
diff changeset
6523 }
Ritor1
parents:
diff changeset
6524 else
Ritor1
parents:
diff changeset
6525 {
Ritor1
parents:
diff changeset
6526 if ( !qword_A750D8 )
Ritor1
parents:
diff changeset
6527 {
Ritor1
parents:
diff changeset
6528 v2 = 0;
Ritor1
parents:
diff changeset
6529 v3 = 1;
Ritor1
parents:
diff changeset
6530 do
Ritor1
parents:
diff changeset
6531 {
Ritor1
parents:
diff changeset
6532 if ( pPlayers[v3]->CanAct() )
Ritor1
parents:
diff changeset
6533 v7[v2++] = v3;
Ritor1
parents:
diff changeset
6534 ++v3;
Ritor1
parents:
diff changeset
6535 }
Ritor1
parents:
diff changeset
6536 while ( v3 <= 4 );
Ritor1
parents:
diff changeset
6537 if ( v2 )
Ritor1
parents:
diff changeset
6538 {
Ritor1
parents:
diff changeset
6539 qword_A750D8 = 256i64;
Ritor1
parents:
diff changeset
6540 word_A750E0 = 80;
Ritor1
parents:
diff changeset
6541 v4 = LOWORD(v7[rand() % v2]);
Ritor1
parents:
diff changeset
6542 LABEL_16:
Ritor1
parents:
diff changeset
6543 word_A750E2 = v4;
Ritor1
parents:
diff changeset
6544 return;
Ritor1
parents:
diff changeset
6545 }
Ritor1
parents:
diff changeset
6546 }
Ritor1
parents:
diff changeset
6547 }
Ritor1
parents:
diff changeset
6548 }
Ritor1
parents:
diff changeset
6549 }
Ritor1
parents:
diff changeset
6550
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 615
diff changeset
6551
0
Ritor1
parents:
diff changeset
6552
Ritor1
parents:
diff changeset
6553 //----- (004B1ECE) --------------------------------------------------------
Ritor1
parents:
diff changeset
6554 void __cdecl sub_4B1ECE()
Ritor1
parents:
diff changeset
6555 {
Ritor1
parents:
diff changeset
6556 __int16 *v0; // edi@1
Ritor1
parents:
diff changeset
6557 int v1; // ebx@3
Ritor1
parents:
diff changeset
6558 Player *v2; // esi@3
Ritor1
parents:
diff changeset
6559 int v3; // eax@4
Ritor1
parents:
diff changeset
6560 signed int v4; // eax@9
Ritor1
parents:
diff changeset
6561 int v5; // ebx@11
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6562 Player *v6; // esi@13
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6563 ItemGen *v7; // eax@14
0
Ritor1
parents:
diff changeset
6564 signed int v8; // edi@14
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6565 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
0
Ritor1
parents:
diff changeset
6566 signed int v10; // [sp+10h] [bp-8h]@13
Ritor1
parents:
diff changeset
6567 int v11; // [sp+14h] [bp-4h]@1
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6568 Player *v12; // [sp+14h] [bp-4h]@11
0
Ritor1
parents:
diff changeset
6569
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6570 contract_approved = 0;
0
Ritor1
parents:
diff changeset
6571 v11 = 0;
Ritor1
parents:
diff changeset
6572 uDialogueType = 84;
Ritor1
parents:
diff changeset
6573 ptr_F8B1E8 = (char *)pNPCTopics[667].pText;
Ritor1
parents:
diff changeset
6574 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
Ritor1
parents:
diff changeset
6575 while ( 1 )
Ritor1
parents:
diff changeset
6576 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6577 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
0
Ritor1
parents:
diff changeset
6578 {
Ritor1
parents:
diff changeset
6579 v1 = 0;
Ritor1
parents:
diff changeset
6580 v2 = pParty->pPlayers;
Ritor1
parents:
diff changeset
6581 do
Ritor1
parents:
diff changeset
6582 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6583 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1));
0
Ritor1
parents:
diff changeset
6584 if ( v3 )
Ritor1
parents:
diff changeset
6585 break;
Ritor1
parents:
diff changeset
6586 ++v2;
Ritor1
parents:
diff changeset
6587 ++v1;
Ritor1
parents:
diff changeset
6588 }
Ritor1
parents:
diff changeset
6589 while ( (signed int)v2 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
6590 if ( v1 == 4 )
Ritor1
parents:
diff changeset
6591 break;
Ritor1
parents:
diff changeset
6592 }
Ritor1
parents:
diff changeset
6593 ++v11;
Ritor1
parents:
diff changeset
6594 v0 += 2;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6595 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6596 break;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6597 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6598 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6599 {
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
6600 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6601 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6602 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6603 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6604 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6605 if ( contract_approved == 601 )
0
Ritor1
parents:
diff changeset
6606 {
Ritor1
parents:
diff changeset
6607 v5 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6608 v12 = pParty->pPlayers;//[0].uClass;
0
Ritor1
parents:
diff changeset
6609 v9 = 0;
Ritor1
parents:
diff changeset
6610 while ( 1 )
Ritor1
parents:
diff changeset
6611 {
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
6612 if ( v12->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
6613 {
Ritor1
parents:
diff changeset
6614 v10 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6615 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A;
0
Ritor1
parents:
diff changeset
6616 do
Ritor1
parents:
diff changeset
6617 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6618 v7 = v6->pInventoryItems;
0
Ritor1
parents:
diff changeset
6619 v8 = 138;
Ritor1
parents:
diff changeset
6620 do
Ritor1
parents:
diff changeset
6621 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6622 if ( v7->uItemID == 601 )
0
Ritor1
parents:
diff changeset
6623 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6624 if ( !v7->uHolderPlayer )
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6625 v9 = v7;
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6626 if ( v7->uHolderPlayer == v5 )
0
Ritor1
parents:
diff changeset
6627 v10 = 1;
Ritor1
parents:
diff changeset
6628 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6629 ++v7;
0
Ritor1
parents:
diff changeset
6630 --v8;
Ritor1
parents:
diff changeset
6631 }
Ritor1
parents:
diff changeset
6632 while ( v8 );
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6633 ++v6;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6634 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6635 while ( v6 <= &pParty->pPlayers[3] );
0
Ritor1
parents:
diff changeset
6636 if ( !v10 )
Ritor1
parents:
diff changeset
6637 break;
Ritor1
parents:
diff changeset
6638 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6639 ++v12;
0
Ritor1
parents:
diff changeset
6640 ++v5;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6641 if ( v12 > &pParty->pPlayers[3] )
0
Ritor1
parents:
diff changeset
6642 return;
Ritor1
parents:
diff changeset
6643 }
Ritor1
parents:
diff changeset
6644 if ( v9 )
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6645 v9->uHolderPlayer = v5;
0
Ritor1
parents:
diff changeset
6646 }
Ritor1
parents:
diff changeset
6647 }
503
Ritor1
parents: 460
diff changeset
6648
0
Ritor1
parents:
diff changeset
6649 // 4F08EC: using guessed type int dword_4F08EC[];
Ritor1
parents:
diff changeset
6650 // 722B3C: using guessed type int dword_722B3C;
Ritor1
parents:
diff changeset
6651 // 722B44: using guessed type int dword_722B44;
Ritor1
parents:
diff changeset
6652 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
6653
Ritor1
parents:
diff changeset
6654 //----- (004B2001) --------------------------------------------------------
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6655 void __fastcall ClickNPCTopic(signed int uMessageParam)
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6656 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6657 //signed int v1; // eax@1
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6658 NPCData *pCurrentNPCInfo; // ebp@1
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6659 int pEventNumber; // ecx@8
0
Ritor1
parents:
diff changeset
6660 Player *v4; // esi@20
467
Ritor1
parents: 460
diff changeset
6661 //int v5; // eax@28
Ritor1
parents: 460
diff changeset
6662 //int v6; // eax@31
Ritor1
parents: 460
diff changeset
6663 //int v7; // eax@34
Ritor1
parents: 460
diff changeset
6664 //int v8; // eax@37
Ritor1
parents: 460
diff changeset
6665 //int v9; // eax@40
Ritor1
parents: 460
diff changeset
6666 //unsigned int v10; // eax@43
0
Ritor1
parents:
diff changeset
6667 char *v12; // eax@53
Ritor1
parents:
diff changeset
6668 char *v13; // eax@56
Ritor1
parents:
diff changeset
6669 char *v14; // eax@57
Ritor1
parents:
diff changeset
6670 char *v15; // eax@58
467
Ritor1
parents: 460
diff changeset
6671 //unsigned int v16; // ebp@62
0
Ritor1
parents:
diff changeset
6672 char *v17; // ecx@63
Ritor1
parents:
diff changeset
6673 char *v18; // eax@65
Ritor1
parents:
diff changeset
6674 const char *v19; // ecx@68
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6675 //unsigned int v20; // eax@69
467
Ritor1
parents: 460
diff changeset
6676 signed int pPrice; // ecx@70
0
Ritor1
parents:
diff changeset
6677 char *v22; // [sp-Ch] [bp-18h]@73
467
Ritor1
parents: 460
diff changeset
6678 //int v23; // [sp-8h] [bp-14h]@49
0
Ritor1
parents:
diff changeset
6679 char *v24; // [sp-8h] [bp-14h]@73
467
Ritor1
parents: 460
diff changeset
6680 //int v25; // [sp-4h] [bp-10h]@49
Ritor1
parents: 460
diff changeset
6681
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6682 uDialogueType = uMessageParam + 1;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6683 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
467
Ritor1
parents: 460
diff changeset
6684 if ( uMessageParam <= 24 )
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6685 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6686 switch ( uMessageParam )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6687 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6688 case 13:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6689 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6690 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
6691 NPCHireableDialogPrepare();
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6692 dialogue_show_profession_details = false;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6693 goto _return;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6694 case 19:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6695 pEventNumber = pCurrentNPCInfo->evt_A;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6696 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6697 case 20:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6698 pEventNumber = pCurrentNPCInfo->evt_B;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6699 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6700 case 21:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6701 pEventNumber = pCurrentNPCInfo->evt_C;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6702 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6703 case 22:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6704 pEventNumber = pCurrentNPCInfo->evt_D;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6705 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6706 case 23:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6707 pEventNumber = pCurrentNPCInfo->evt_E;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6708 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6709 case 24:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6710 pEventNumber = pCurrentNPCInfo->evt_F;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6711 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6712 default:
467
Ritor1
parents: 460
diff changeset
6713 goto _return;
Ritor1
parents: 460
diff changeset
6714 }
Ritor1
parents: 460
diff changeset
6715 /*switch ( pEventNumber )
Ritor1
parents: 460
diff changeset
6716 {
Ritor1
parents: 460
diff changeset
6717 case 139:
Ritor1
parents: 460
diff changeset
6718 sub_4B1ECE();
Ritor1
parents: 460
diff changeset
6719 goto _return;
Ritor1
parents: 460
diff changeset
6720 case 311:
Ritor1
parents: 460
diff changeset
6721 sub_4BBA85_bounties();
Ritor1
parents: 460
diff changeset
6722 goto _return;
Ritor1
parents: 460
diff changeset
6723 }*/
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6724 if ( pEventNumber < 200 || pEventNumber > 310 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6725 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6726 if ( pEventNumber < 400 || pEventNumber > 410 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6727 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6728 if ( pEventNumber == 139 )
0
Ritor1
parents:
diff changeset
6729 {
Ritor1
parents:
diff changeset
6730 sub_4B1ECE();
Ritor1
parents:
diff changeset
6731 }
Ritor1
parents:
diff changeset
6732 else
Ritor1
parents:
diff changeset
6733 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6734 if ( pEventNumber == 311 )
0
Ritor1
parents:
diff changeset
6735 {
Ritor1
parents:
diff changeset
6736 sub_4BBA85_bounties();
Ritor1
parents:
diff changeset
6737 }
Ritor1
parents:
diff changeset
6738 else
Ritor1
parents:
diff changeset
6739 {
Ritor1
parents:
diff changeset
6740 ptr_F8B1E8 = 0;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
6741 activeLevelDecoration = (LevelDecoration*)1;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6742 EventProcessor(pEventNumber, 0, 1);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
6743 activeLevelDecoration = NULL;
0
Ritor1
parents:
diff changeset
6744 }
Ritor1
parents:
diff changeset
6745 }
Ritor1
parents:
diff changeset
6746 }
Ritor1
parents:
diff changeset
6747 else
Ritor1
parents:
diff changeset
6748 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6749 dword_F8B1D8 = uMessageParam;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6750 DrawJoinGuildWindow(pEventNumber - 400);
0
Ritor1
parents:
diff changeset
6751 }
Ritor1
parents:
diff changeset
6752 }
Ritor1
parents:
diff changeset
6753 else
Ritor1
parents:
diff changeset
6754 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6755 sub_4B3FE5(pEventNumber);
0
Ritor1
parents:
diff changeset
6756 }
Ritor1
parents:
diff changeset
6757 goto _return;
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6758 }
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6759 if ( uMessageParam != 76 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6760 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6761 if ( uMessageParam == 77 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6762 {
467
Ritor1
parents: 460
diff changeset
6763 //v16 = pCurrentNPCInfo->uProfession;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6764 if (dialogue_show_profession_details)
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6765 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
0
Ritor1
parents:
diff changeset
6766 else
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6767 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits;
0
Ritor1
parents:
diff changeset
6768 ptr_F8B1E8 = v17;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
6769 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6770 dialogue_show_profession_details = ~dialogue_show_profession_details;
0
Ritor1
parents:
diff changeset
6771 ptr_F8B1E8 = v18;
Ritor1
parents:
diff changeset
6772 }
Ritor1
parents:
diff changeset
6773 else
Ritor1
parents:
diff changeset
6774 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6775 if ( uMessageParam == 79 )
0
Ritor1
parents:
diff changeset
6776 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6777 if ( contract_approved )
0
Ritor1
parents:
diff changeset
6778 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6779 Party::TakeGold(gold_transaction_amount);
0
Ritor1
parents:
diff changeset
6780 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
6781 {
492
Gloval
parents: 487
diff changeset
6782 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6783 *(short *)v12 &= 0x3Fu;
Ritor1
parents:
diff changeset
6784 switch ( dword_F8B1B0 )
Ritor1
parents:
diff changeset
6785 {
Ritor1
parents:
diff changeset
6786 case 2:
492
Gloval
parents: 487
diff changeset
6787 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6788 *v15 |= 0x40u;
Ritor1
parents:
diff changeset
6789 break;
Ritor1
parents:
diff changeset
6790 case 3:
492
Gloval
parents: 487
diff changeset
6791 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6792 *v14 |= 0x80u;
Ritor1
parents:
diff changeset
6793 break;
Ritor1
parents:
diff changeset
6794 case 4:
492
Gloval
parents: 487
diff changeset
6795 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6796 v13[1] |= 1u;
Ritor1
parents:
diff changeset
6797 break;
Ritor1
parents:
diff changeset
6798 }
187
49728858c35e On player voices
Nomad
parents: 180
diff changeset
6799 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
0
Ritor1
parents:
diff changeset
6800 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6801 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6802 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6803 {
Ritor1
parents:
diff changeset
6804 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
6805 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6806 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6807 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6808 }*/
0
Ritor1
parents:
diff changeset
6809 }
Ritor1
parents:
diff changeset
6810 }
Ritor1
parents:
diff changeset
6811 else
Ritor1
parents:
diff changeset
6812 {
492
Gloval
parents: 487
diff changeset
6813 if ( uMessageParam == 82 && contract_approved ) //join guild
0
Ritor1
parents:
diff changeset
6814 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6815 Party::TakeGold(gold_transaction_amount);
0
Ritor1
parents:
diff changeset
6816 v4 = pParty->pPlayers;
Ritor1
parents:
diff changeset
6817 do
Ritor1
parents:
diff changeset
6818 {
492
Gloval
parents: 487
diff changeset
6819 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
0
Ritor1
parents:
diff changeset
6820 ++v4;
Ritor1
parents:
diff changeset
6821 }
Ritor1
parents:
diff changeset
6822 while ( (signed int)v4 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
6823 switch ( dword_F8B1D8 )
Ritor1
parents:
diff changeset
6824 {
Ritor1
parents:
diff changeset
6825 case 19:
467
Ritor1
parents: 460
diff changeset
6826 pEventNumber = pCurrentNPCInfo->evt_A;
Ritor1
parents: 460
diff changeset
6827 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6828 pCurrentNPCInfo->evt_A = 0;
0
Ritor1
parents:
diff changeset
6829 break;
Ritor1
parents:
diff changeset
6830 case 20:
467
Ritor1
parents: 460
diff changeset
6831 pEventNumber = pCurrentNPCInfo->evt_B;
Ritor1
parents: 460
diff changeset
6832 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6833 pCurrentNPCInfo->evt_B = 0;
0
Ritor1
parents:
diff changeset
6834 break;
Ritor1
parents:
diff changeset
6835 case 21:
467
Ritor1
parents: 460
diff changeset
6836 pEventNumber = pCurrentNPCInfo->evt_C;
Ritor1
parents: 460
diff changeset
6837 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6838 pCurrentNPCInfo->evt_C = 0;
0
Ritor1
parents:
diff changeset
6839 break;
Ritor1
parents:
diff changeset
6840 case 22:
467
Ritor1
parents: 460
diff changeset
6841 pEventNumber = pCurrentNPCInfo->evt_D;
Ritor1
parents: 460
diff changeset
6842 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6843 pCurrentNPCInfo->evt_D = 0;
0
Ritor1
parents:
diff changeset
6844 break;
Ritor1
parents:
diff changeset
6845 case 23:
467
Ritor1
parents: 460
diff changeset
6846 pEventNumber = pCurrentNPCInfo->evt_E;
Ritor1
parents: 460
diff changeset
6847 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6848 pCurrentNPCInfo->evt_E = 0;
0
Ritor1
parents:
diff changeset
6849 break;
Ritor1
parents:
diff changeset
6850 case 24:
467
Ritor1
parents: 460
diff changeset
6851 pEventNumber = pCurrentNPCInfo->evt_F;
Ritor1
parents: 460
diff changeset
6852 if ( pEventNumber >= 400 && pEventNumber <= 416)
Ritor1
parents: 460
diff changeset
6853 pCurrentNPCInfo->evt_F = 0;
0
Ritor1
parents:
diff changeset
6854 break;
Ritor1
parents:
diff changeset
6855 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6856 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6857 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6858 {
Ritor1
parents:
diff changeset
6859 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
6860 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6861 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6862 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6863 }*/
467
Ritor1
parents: 460
diff changeset
6864 //v11 = uActiveCharacter;
0
Ritor1
parents:
diff changeset
6865 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
6866 {
467
Ritor1
parents: 460
diff changeset
6867 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
0
Ritor1
parents:
diff changeset
6868 goto _return;
Ritor1
parents:
diff changeset
6869 }
Ritor1
parents:
diff changeset
6870 }
Ritor1
parents:
diff changeset
6871 }
Ritor1
parents:
diff changeset
6872 }
Ritor1
parents:
diff changeset
6873 goto _return;
Ritor1
parents:
diff changeset
6874 }
Ritor1
parents:
diff changeset
6875 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
Ritor1
parents:
diff changeset
6876 {
467
Ritor1
parents: 460
diff changeset
6877 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
0
Ritor1
parents:
diff changeset
6878 goto _return;
Ritor1
parents:
diff changeset
6879 }
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6880 if ( pCurrentNPCInfo->uProfession != 51 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6881 {
467
Ritor1
parents: 460
diff changeset
6882 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice;
Ritor1
parents: 460
diff changeset
6883 if ( pParty->uNumGold < pPrice )
Ritor1
parents: 460
diff changeset
6884 {
Ritor1
parents: 460
diff changeset
6885 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6886 dialogue_show_profession_details = false;
0
Ritor1
parents:
diff changeset
6887 uDialogueType = 13;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6888 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
6889 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
6890 if ( uActiveCharacter )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6891 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
467
Ritor1
parents: 460
diff changeset
6892 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
Ritor1
parents: 460
diff changeset
6893 goto _return;
Ritor1
parents: 460
diff changeset
6894 }
Ritor1
parents: 460
diff changeset
6895 Party::TakeGold(pPrice);
0
Ritor1
parents:
diff changeset
6896 }
147
c70fea5013aa 12.02.13
Ritor1
parents: 112
diff changeset
6897 //LOBYTE(v2->uFlags) |= 0x80u;
655
6a2d29c21d09 Margaret disappear fixed
zipi
parents: 652
diff changeset
6898 pCurrentNPCInfo->uFlags |= 128;
0
Ritor1
parents:
diff changeset
6899 pParty->field_709 = 0;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 656
diff changeset
6900 Party__CountHirelings();
0
Ritor1
parents:
diff changeset
6901 if ( pParty->pHirelings[0].pName )
Ritor1
parents:
diff changeset
6902 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6903 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6904 v24 = pCurrentNPCInfo->pName;
0
Ritor1
parents:
diff changeset
6905 v22 = pParty->pHireling2Name;
Ritor1
parents:
diff changeset
6906 }
Ritor1
parents:
diff changeset
6907 else
Ritor1
parents:
diff changeset
6908 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6909 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu);
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6910 v24 = pCurrentNPCInfo->pName;
0
Ritor1
parents:
diff changeset
6911 v22 = pParty->pHireling1Name;
Ritor1
parents:
diff changeset
6912 }
Ritor1
parents:
diff changeset
6913 strcpy(v22, v24);
Ritor1
parents:
diff changeset
6914 pParty->field_709 = 0;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 656
diff changeset
6915 Party__CountHirelings();
480
d4ea191229ff BildingType
Ritor1
parents: 475
diff changeset
6916 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
6917 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6918
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6919 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6920 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6921 {
Ritor1
parents:
diff changeset
6922 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
6923 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6924 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6925 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6926 }*/
0
Ritor1
parents:
diff changeset
6927 if ( uActiveCharacter )
467
Ritor1
parents: 460
diff changeset
6928 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
0
Ritor1
parents:
diff changeset
6929 _return:
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6930 pVideoPlayer->_4BF5B2();//HouseVideo
0
Ritor1
parents:
diff changeset
6931 }
Ritor1
parents:
diff changeset
6932
Ritor1
parents:
diff changeset
6933
Ritor1
parents:
diff changeset
6934 //----- (004B254D) --------------------------------------------------------
Ritor1
parents:
diff changeset
6935 char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
Ritor1
parents:
diff changeset
6936 {
Ritor1
parents:
diff changeset
6937 Player *v1; // esi@1
Ritor1
parents:
diff changeset
6938 int v2; // edx@1
Ritor1
parents:
diff changeset
6939 int v3; // ecx@1
Ritor1
parents:
diff changeset
6940 int v4; // edi@1
Ritor1
parents:
diff changeset
6941 int v5; // eax@7
Ritor1
parents:
diff changeset
6942 int v6; // eax@7
Ritor1
parents:
diff changeset
6943 int v7; // ebx@7
Ritor1
parents:
diff changeset
6944 int v8; // ebx@8
Ritor1
parents:
diff changeset
6945 signed int v9; // esi@8
Ritor1
parents:
diff changeset
6946 int v10; // eax@8
Ritor1
parents:
diff changeset
6947 char *v11; // ecx@8
Ritor1
parents:
diff changeset
6948 int v12; // edi@9
Ritor1
parents:
diff changeset
6949 char *v13; // edx@9
Ritor1
parents:
diff changeset
6950 signed int v14; // edi@10
Ritor1
parents:
diff changeset
6951 unsigned int v16; // eax@29
Ritor1
parents:
diff changeset
6952 int v17; // eax@36
Ritor1
parents:
diff changeset
6953 char v18; // cl@46
Ritor1
parents:
diff changeset
6954 __int16 v19; // dx@56
Ritor1
parents:
diff changeset
6955 int v20; // eax@60
Ritor1
parents:
diff changeset
6956 char *v21; // [sp-Ch] [bp-38h]@82
Ritor1
parents:
diff changeset
6957 const char *v22; // [sp-8h] [bp-34h]@21
Ritor1
parents:
diff changeset
6958 unsigned int v23; // [sp-8h] [bp-34h]@38
Ritor1
parents:
diff changeset
6959 char *v24; // [sp-8h] [bp-34h]@82
Ritor1
parents:
diff changeset
6960 char *v25; // [sp-4h] [bp-30h]@14
Ritor1
parents:
diff changeset
6961 int v26; // [sp-4h] [bp-30h]@38
Ritor1
parents:
diff changeset
6962 int v27; // [sp-4h] [bp-30h]@82
Ritor1
parents:
diff changeset
6963 char v28[4]; // [sp+Ch] [bp-20h]@9
Ritor1
parents:
diff changeset
6964 int v29; // [sp+10h] [bp-1Ch]@13
Ritor1
parents:
diff changeset
6965 int v30; // [sp+14h] [bp-18h]@15
Ritor1
parents:
diff changeset
6966 int v31; // [sp+18h] [bp-14h]@16
Ritor1
parents:
diff changeset
6967 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7
Ritor1
parents:
diff changeset
6968 int v33; // [sp+20h] [bp-Ch]@7
Ritor1
parents:
diff changeset
6969 int v34; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
6970 char *v35; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
6971
Ritor1
parents:
diff changeset
6972 v1 = pPlayers[uActiveCharacter];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6973 contract_approved = 0;
0
Ritor1
parents:
diff changeset
6974 v2 = (_this - 200) % 3;
Ritor1
parents:
diff changeset
6975 v3 = (_this - 200) / 3;
Ritor1
parents:
diff changeset
6976 v4 = v2;
Ritor1
parents:
diff changeset
6977 v35 = (char *)pNPCTopics[127].pText;
492
Gloval
parents: 487
diff changeset
6978 dword_F8B1AC_award_bit_number = v3;
0
Ritor1
parents:
diff changeset
6979 if ( v2 )
Ritor1
parents:
diff changeset
6980 {
Ritor1
parents:
diff changeset
6981 if ( v2 == 1 )
Ritor1
parents:
diff changeset
6982 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6983 gold_transaction_amount = 5000;
0
Ritor1
parents:
diff changeset
6984 dword_F8B1B0 = 3;
Ritor1
parents:
diff changeset
6985 }
Ritor1
parents:
diff changeset
6986 else
Ritor1
parents:
diff changeset
6987 {
Ritor1
parents:
diff changeset
6988 if ( v2 == 2 )
Ritor1
parents:
diff changeset
6989 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6990 gold_transaction_amount = 8000;
0
Ritor1
parents:
diff changeset
6991 dword_F8B1B0 = 4;
Ritor1
parents:
diff changeset
6992 }
Ritor1
parents:
diff changeset
6993 }
Ritor1
parents:
diff changeset
6994 }
Ritor1
parents:
diff changeset
6995 else
Ritor1
parents:
diff changeset
6996 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6997 gold_transaction_amount = 2000;
0
Ritor1
parents:
diff changeset
6998 dword_F8B1B0 = 2;
Ritor1
parents:
diff changeset
6999 }
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
7000 v5 = v1->classType;
0
Ritor1
parents:
diff changeset
7001 v33 = v5;
Ritor1
parents:
diff changeset
7002 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3];
Ritor1
parents:
diff changeset
7003 *(int *)a1 = v1->pActiveSkills[v3];
Ritor1
parents:
diff changeset
7004 v7 = a1[0] & 0x3F;
Ritor1
parents:
diff changeset
7005 v34 = v2 + 2;
Ritor1
parents:
diff changeset
7006 if ( v6 < v2 + 2 )
Ritor1
parents:
diff changeset
7007 {
Ritor1
parents:
diff changeset
7008 v8 = v33;
Ritor1
parents:
diff changeset
7009 v9 = 0;
Ritor1
parents:
diff changeset
7010 v10 = v33 - v33 % 4;
Ritor1
parents:
diff changeset
7011 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3];
Ritor1
parents:
diff changeset
7012 do
Ritor1
parents:
diff changeset
7013 {
Ritor1
parents:
diff changeset
7014 v12 = (unsigned __int8)*v11;
Ritor1
parents:
diff changeset
7015 v13 = &v28[4 * v9];
Ritor1
parents:
diff changeset
7016 *(int *)v13 = 0;
Ritor1
parents:
diff changeset
7017 if ( v12 < v34 )
Ritor1
parents:
diff changeset
7018 {
Ritor1
parents:
diff changeset
7019 v14 = 1;
Ritor1
parents:
diff changeset
7020 }
Ritor1
parents:
diff changeset
7021 else
Ritor1
parents:
diff changeset
7022 {
Ritor1
parents:
diff changeset
7023 v14 = 1;
Ritor1
parents:
diff changeset
7024 *(int *)v13 = 1;
Ritor1
parents:
diff changeset
7025 }
Ritor1
parents:
diff changeset
7026 ++v9;
Ritor1
parents:
diff changeset
7027 v11 += 37;
Ritor1
parents:
diff changeset
7028 }
Ritor1
parents:
diff changeset
7029 while ( v9 < 4 );
Ritor1
parents:
diff changeset
7030 if ( v29 == v14 )
Ritor1
parents:
diff changeset
7031 {
Ritor1
parents:
diff changeset
7032 v25 = pClassNames[v10 + 1];
Ritor1
parents:
diff changeset
7033 }
Ritor1
parents:
diff changeset
7034 else
Ritor1
parents:
diff changeset
7035 {
Ritor1
parents:
diff changeset
7036 if ( v30 == v14 )
Ritor1
parents:
diff changeset
7037 {
Ritor1
parents:
diff changeset
7038 if ( v31 == v14 )
Ritor1
parents:
diff changeset
7039 {
Ritor1
parents:
diff changeset
7040 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);
Ritor1
parents:
diff changeset
7041 return pTmpBuf;
Ritor1
parents:
diff changeset
7042 }
Ritor1
parents:
diff changeset
7043 v25 = pClassNames[v10 + 2];
Ritor1
parents:
diff changeset
7044 }
Ritor1
parents:
diff changeset
7045 else
Ritor1
parents:
diff changeset
7046 {
Ritor1
parents:
diff changeset
7047 if ( v31 != v14 )
Ritor1
parents:
diff changeset
7048 {
Ritor1
parents:
diff changeset
7049 v25 = pClassNames[v8];
Ritor1
parents:
diff changeset
7050 v22 = pGlobalTXT_LocalizationStrings[632];
Ritor1
parents:
diff changeset
7051 goto LABEL_23;
Ritor1
parents:
diff changeset
7052 }
Ritor1
parents:
diff changeset
7053 v25 = pClassNames[v10 + 3];
Ritor1
parents:
diff changeset
7054 }
Ritor1
parents:
diff changeset
7055 }
Ritor1
parents:
diff changeset
7056 v22 = pGlobalTXT_LocalizationStrings[633];
Ritor1
parents:
diff changeset
7057 LABEL_23:
Ritor1
parents:
diff changeset
7058 sprintf(pTmpBuf, v22, v25);
Ritor1
parents:
diff changeset
7059 return pTmpBuf;
Ritor1
parents:
diff changeset
7060 }
Ritor1
parents:
diff changeset
7061 if ( !v1->CanAct() )
Ritor1
parents:
diff changeset
7062 return (char *)pNPCTopics[122].pText;
Ritor1
parents:
diff changeset
7063 if ( !v7 )
Ritor1
parents:
diff changeset
7064 return (char *)pNPCTopics[131].pText;
Ritor1
parents:
diff changeset
7065 v16 = SkillToMastery(a1[0]);
Ritor1
parents:
diff changeset
7066 if ( (signed int)v16 > v4 + 1 )
Ritor1
parents:
diff changeset
7067 return (char *)pNPCTopics[v4 + 128].pText;
Ritor1
parents:
diff changeset
7068 if ( v34 != 2 )
Ritor1
parents:
diff changeset
7069 {
Ritor1
parents:
diff changeset
7070 if ( v34 == 3 )
Ritor1
parents:
diff changeset
7071 {
Ritor1
parents:
diff changeset
7072 if ( (signed int)v16 >= 2 && v7 >= 7 )
Ritor1
parents:
diff changeset
7073 {
492
Gloval
parents: 487
diff changeset
7074 v17 = dword_F8B1AC_award_bit_number;
Gloval
parents: 487
diff changeset
7075 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
7076 {
Ritor1
parents:
diff changeset
7077 default:
Ritor1
parents:
diff changeset
7078 goto LABEL_41;
Ritor1
parents:
diff changeset
7079 case 12:
Ritor1
parents:
diff changeset
7080 case 13:
Ritor1
parents:
diff changeset
7081 case 14:
Ritor1
parents:
diff changeset
7082 case 15:
Ritor1
parents:
diff changeset
7083 case 16:
Ritor1
parents:
diff changeset
7084 case 17:
Ritor1
parents:
diff changeset
7085 case 18:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7086 gold_transaction_amount = 4000;
0
Ritor1
parents:
diff changeset
7087 goto LABEL_42;
Ritor1
parents:
diff changeset
7088 case 19:
Ritor1
parents:
diff changeset
7089 v19 = 114;
Ritor1
parents:
diff changeset
7090 goto LABEL_57;
Ritor1
parents:
diff changeset
7091 case 20:
Ritor1
parents:
diff changeset
7092 v19 = 110;
Ritor1
parents:
diff changeset
7093 LABEL_57:
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7094 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
0
Ritor1
parents:
diff changeset
7095 return v35;
Ritor1
parents:
diff changeset
7096 goto LABEL_40;
Ritor1
parents:
diff changeset
7097 case 22:
Ritor1
parents:
diff changeset
7098 v20 = v1->GetBaseWillpower();
Ritor1
parents:
diff changeset
7099 goto LABEL_61;
Ritor1
parents:
diff changeset
7100 case 24:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7101 gold_transaction_amount = 2500;
0
Ritor1
parents:
diff changeset
7102 v20 = v1->GetBaseEndurance();
Ritor1
parents:
diff changeset
7103 goto LABEL_61;
Ritor1
parents:
diff changeset
7104 case 36:
Ritor1
parents:
diff changeset
7105 v20 = v1->GetBaseIntelligence();
Ritor1
parents:
diff changeset
7106 LABEL_61:
Ritor1
parents:
diff changeset
7107 if ( v20 < 50 )
Ritor1
parents:
diff changeset
7108 return v35;
Ritor1
parents:
diff changeset
7109 goto LABEL_40;
Ritor1
parents:
diff changeset
7110 case 21:
Ritor1
parents:
diff changeset
7111 case 23:
Ritor1
parents:
diff changeset
7112 case 25:
Ritor1
parents:
diff changeset
7113 case 26:
Ritor1
parents:
diff changeset
7114 case 29:
Ritor1
parents:
diff changeset
7115 case 32:
Ritor1
parents:
diff changeset
7116 case 34:
Ritor1
parents:
diff changeset
7117 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7118 gold_transaction_amount = 2500;
0
Ritor1
parents:
diff changeset
7119 goto LABEL_42;
Ritor1
parents:
diff changeset
7120 case 8:
Ritor1
parents:
diff changeset
7121 case 9:
Ritor1
parents:
diff changeset
7122 case 10:
Ritor1
parents:
diff changeset
7123 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7124 gold_transaction_amount = 3000;
0
Ritor1
parents:
diff changeset
7125 goto LABEL_42;
Ritor1
parents:
diff changeset
7126 case 7:
Ritor1
parents:
diff changeset
7127 goto LABEL_67;
Ritor1
parents:
diff changeset
7128 }
Ritor1
parents:
diff changeset
7129 goto LABEL_67;
Ritor1
parents:
diff changeset
7130 }
Ritor1
parents:
diff changeset
7131 }
Ritor1
parents:
diff changeset
7132 else
Ritor1
parents:
diff changeset
7133 {
Ritor1
parents:
diff changeset
7134 if ( v34 != 4 )
Ritor1
parents:
diff changeset
7135 {
Ritor1
parents:
diff changeset
7136 LABEL_40:
492
Gloval
parents: 487
diff changeset
7137 v17 = dword_F8B1AC_award_bit_number;
0
Ritor1
parents:
diff changeset
7138 goto LABEL_41;
Ritor1
parents:
diff changeset
7139 }
Ritor1
parents:
diff changeset
7140 if ( (signed int)v16 >= 3 && v7 >= 10 )
Ritor1
parents:
diff changeset
7141 {
492
Gloval
parents: 487
diff changeset
7142 v17 = dword_F8B1AC_award_bit_number;
Gloval
parents: 487
diff changeset
7143 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
7144 {
Ritor1
parents:
diff changeset
7145 case 19:
Ritor1
parents:
diff changeset
7146 if ( v1->_49327B(0x22u, 1) == 1 )
Ritor1
parents:
diff changeset
7147 goto LABEL_40;
Ritor1
parents:
diff changeset
7148 v26 = 1;
Ritor1
parents:
diff changeset
7149 v23 = 26;
Ritor1
parents:
diff changeset
7150 goto LABEL_39;
Ritor1
parents:
diff changeset
7151 default:
Ritor1
parents:
diff changeset
7152 goto LABEL_41;
Ritor1
parents:
diff changeset
7153 case 20:
Ritor1
parents:
diff changeset
7154 if ( v1->_49327B(0x23u, 1) == 1 )
Ritor1
parents:
diff changeset
7155 goto LABEL_40;
Ritor1
parents:
diff changeset
7156 v26 = 1;
Ritor1
parents:
diff changeset
7157 v23 = 27;
Ritor1
parents:
diff changeset
7158 LABEL_39:
Ritor1
parents:
diff changeset
7159 if ( v1->_49327B(v23, v26) == 1 )
Ritor1
parents:
diff changeset
7160 goto LABEL_40;
Ritor1
parents:
diff changeset
7161 return v35;
Ritor1
parents:
diff changeset
7162 case 30:
Ritor1
parents:
diff changeset
7163 v18 = LOBYTE(v1->pActiveSkills[31]);
Ritor1
parents:
diff changeset
7164 goto LABEL_47;
Ritor1
parents:
diff changeset
7165 case 31:
Ritor1
parents:
diff changeset
7166 v18 = LOBYTE(v1->pActiveSkills[30]);
Ritor1
parents:
diff changeset
7167 LABEL_47:
Ritor1
parents:
diff changeset
7168 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents:
diff changeset
7169 return v35;
Ritor1
parents:
diff changeset
7170 goto LABEL_41;
Ritor1
parents:
diff changeset
7171 case 21:
Ritor1
parents:
diff changeset
7172 case 23:
Ritor1
parents:
diff changeset
7173 case 24:
Ritor1
parents:
diff changeset
7174 case 25:
Ritor1
parents:
diff changeset
7175 case 26:
Ritor1
parents:
diff changeset
7176 case 29:
Ritor1
parents:
diff changeset
7177 case 32:
Ritor1
parents:
diff changeset
7178 case 34:
Ritor1
parents:
diff changeset
7179 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7180 gold_transaction_amount = 6000;
0
Ritor1
parents:
diff changeset
7181 goto LABEL_42;
Ritor1
parents:
diff changeset
7182 case 8:
Ritor1
parents:
diff changeset
7183 case 9:
Ritor1
parents:
diff changeset
7184 case 10:
Ritor1
parents:
diff changeset
7185 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7186 gold_transaction_amount = 7000;
0
Ritor1
parents:
diff changeset
7187 goto LABEL_42;
Ritor1
parents:
diff changeset
7188 case 7:
Ritor1
parents:
diff changeset
7189 break;
Ritor1
parents:
diff changeset
7190 }
Ritor1
parents:
diff changeset
7191 LABEL_67:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7192 gold_transaction_amount = 0;
0
Ritor1
parents:
diff changeset
7193 goto LABEL_41;
Ritor1
parents:
diff changeset
7194 }
Ritor1
parents:
diff changeset
7195 }
Ritor1
parents:
diff changeset
7196 return v35;
Ritor1
parents:
diff changeset
7197 }
Ritor1
parents:
diff changeset
7198 if ( v7 < 4 )
Ritor1
parents:
diff changeset
7199 return v35;
492
Gloval
parents: 487
diff changeset
7200 v17 = dword_F8B1AC_award_bit_number;
Gloval
parents: 487
diff changeset
7201 if ( dword_F8B1AC_award_bit_number > 27 )
Gloval
parents: 487
diff changeset
7202 {
Gloval
parents: 487
diff changeset
7203 if ( dword_F8B1AC_award_bit_number != 29
Gloval
parents: 487
diff changeset
7204 && dword_F8B1AC_award_bit_number != 32
Gloval
parents: 487
diff changeset
7205 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
0
Ritor1
parents:
diff changeset
7206 {
Ritor1
parents:
diff changeset
7207 LABEL_41:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7208 if ( !gold_transaction_amount )
0
Ritor1
parents:
diff changeset
7209 goto LABEL_79;
Ritor1
parents:
diff changeset
7210 goto LABEL_42;
Ritor1
parents:
diff changeset
7211 }
Ritor1
parents:
diff changeset
7212 LABEL_87:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7213 gold_transaction_amount = 500;
0
Ritor1
parents:
diff changeset
7214 goto LABEL_41;
Ritor1
parents:
diff changeset
7215 }
492
Gloval
parents: 487
diff changeset
7216 if ( dword_F8B1AC_award_bit_number >= 23 )
0
Ritor1
parents:
diff changeset
7217 goto LABEL_87;
492
Gloval
parents: 487
diff changeset
7218 if ( dword_F8B1AC_award_bit_number == 7 )
0
Ritor1
parents:
diff changeset
7219 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7220 gold_transaction_amount = 0;
0
Ritor1
parents:
diff changeset
7221 goto LABEL_79;
Ritor1
parents:
diff changeset
7222 }
492
Gloval
parents: 487
diff changeset
7223 if ( dword_F8B1AC_award_bit_number <= 7 )
0
Ritor1
parents:
diff changeset
7224 goto LABEL_41;
492
Gloval
parents: 487
diff changeset
7225 if ( dword_F8B1AC_award_bit_number > 18 )
Gloval
parents: 487
diff changeset
7226 {
Gloval
parents: 487
diff changeset
7227 if ( dword_F8B1AC_award_bit_number != 21 )
0
Ritor1
parents:
diff changeset
7228 goto LABEL_41;
Ritor1
parents:
diff changeset
7229 goto LABEL_87;
Ritor1
parents:
diff changeset
7230 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7231 gold_transaction_amount = 1000;
0
Ritor1
parents:
diff changeset
7232 LABEL_42:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7233 if ( gold_transaction_amount > pParty->uNumGold )
0
Ritor1
parents:
diff changeset
7234 return (char *)pNPCTopics[124].pText;
Ritor1
parents:
diff changeset
7235 LABEL_79:
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7236 contract_approved = 1;
0
Ritor1
parents:
diff changeset
7237 if ( v34 == 2 )
Ritor1
parents:
diff changeset
7238 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7239 v27 = gold_transaction_amount;
0
Ritor1
parents:
diff changeset
7240 v24 = pSkillNames[v17];
Ritor1
parents:
diff changeset
7241 v21 = pGlobalTXT_LocalizationStrings[433];
Ritor1
parents:
diff changeset
7242 goto LABEL_90;
Ritor1
parents:
diff changeset
7243 }
Ritor1
parents:
diff changeset
7244 if ( v34 == 3 )
Ritor1
parents:
diff changeset
7245 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7246 v27 = gold_transaction_amount;
0
Ritor1
parents:
diff changeset
7247 v24 = pSkillNames[v17];
Ritor1
parents:
diff changeset
7248 v21 = pGlobalTXT_LocalizationStrings[432];
Ritor1
parents:
diff changeset
7249 goto LABEL_90;
Ritor1
parents:
diff changeset
7250 }
Ritor1
parents:
diff changeset
7251 if ( v34 == 4 )
Ritor1
parents:
diff changeset
7252 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7253 v27 = gold_transaction_amount;
0
Ritor1
parents:
diff changeset
7254 v24 = pSkillNames[v17];
Ritor1
parents:
diff changeset
7255 v21 = pGlobalTXT_LocalizationStrings[225];
Ritor1
parents:
diff changeset
7256 LABEL_90:
Ritor1
parents:
diff changeset
7257 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
Ritor1
parents:
diff changeset
7258 }
Ritor1
parents:
diff changeset
7259 return pTmpBuf2;
Ritor1
parents:
diff changeset
7260 }
Ritor1
parents:
diff changeset
7261
Ritor1
parents:
diff changeset
7262
Ritor1
parents:
diff changeset
7263
Ritor1
parents:
diff changeset
7264 //----- (004B29F2) --------------------------------------------------------
492
Gloval
parents: 487
diff changeset
7265 const char * ContractSelectText( int pEventCode )
Gloval
parents: 487
diff changeset
7266 {
Gloval
parents: 487
diff changeset
7267 static const int dialogue_base=110;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7268 contract_approved = 0;
492
Gloval
parents: 487
diff changeset
7269 dword_F8B1AC_award_bit_number = pEventCode + 50;
Gloval
parents: 487
diff changeset
7270 gold_transaction_amount = price_for_membership[pEventCode];
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7271 if ( pPlayers[uActiveCharacter]->CanAct() )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7272 {
492
Gloval
parents: 487
diff changeset
7273 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) )
Gloval
parents: 487
diff changeset
7274 {
Gloval
parents: 487
diff changeset
7275 return pNPCTopics[dialogue_base+13].pText;
0
Ritor1
parents:
diff changeset
7276 }
Ritor1
parents:
diff changeset
7277 else
Ritor1
parents:
diff changeset
7278 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7279 if ( gold_transaction_amount <= pParty->uNumGold )
0
Ritor1
parents:
diff changeset
7280 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7281 contract_approved = 1;
492
Gloval
parents: 487
diff changeset
7282 return pNPCTopics[pEventCode + dialogue_base].pText;
0
Ritor1
parents:
diff changeset
7283 }
Ritor1
parents:
diff changeset
7284 else
Ritor1
parents:
diff changeset
7285 {
492
Gloval
parents: 487
diff changeset
7286 return pNPCTopics[dialogue_base+14].pText;
0
Ritor1
parents:
diff changeset
7287 }
Ritor1
parents:
diff changeset
7288 }
Ritor1
parents:
diff changeset
7289 }
Ritor1
parents:
diff changeset
7290 else
Ritor1
parents:
diff changeset
7291 {
492
Gloval
parents: 487
diff changeset
7292 return pNPCTopics[dialogue_base+12].pText;
0
Ritor1
parents:
diff changeset
7293 }
Ritor1
parents:
diff changeset
7294 }
Ritor1
parents:
diff changeset
7295
Ritor1
parents:
diff changeset
7296
Ritor1
parents:
diff changeset
7297 //----- (004B2A74) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7298 void SimpleHouseAndBoatsDialog()
0
Ritor1
parents:
diff changeset
7299 {
Ritor1
parents:
diff changeset
7300 char *v0; // esi@3
Ritor1
parents:
diff changeset
7301 char *v1; // ST1C_4@3
Ritor1
parents:
diff changeset
7302 char *v2; // eax@3
Ritor1
parents:
diff changeset
7303 const char *v3; // ST1C_4@5
Ritor1
parents:
diff changeset
7304 int v4; // eax@5
Ritor1
parents:
diff changeset
7305 unsigned int i; // eax@5
Ritor1
parents:
diff changeset
7306 NPCData *v6; // esi@6
Ritor1
parents:
diff changeset
7307 unsigned __int16 v7; // bx@6
Ritor1
parents:
diff changeset
7308 unsigned int v8; // eax@6
Ritor1
parents:
diff changeset
7309 int v9; // eax@11
Ritor1
parents:
diff changeset
7310 unsigned int v10; // ecx@12
Ritor1
parents:
diff changeset
7311 int v11; // eax@12
Ritor1
parents:
diff changeset
7312 int v12; // esi@12
Ritor1
parents:
diff changeset
7313 char *v13; // eax@12
Ritor1
parents:
diff changeset
7314 GUIWindow *v14; // ebx@13
Ritor1
parents:
diff changeset
7315 char *v15; // esi@14
Ritor1
parents:
diff changeset
7316 GUIButton *v16; // eax@15
Ritor1
parents:
diff changeset
7317 unsigned int v17; // ecx@15
Ritor1
parents:
diff changeset
7318 int v18; // ecx@17
Ritor1
parents:
diff changeset
7319 int v19; // ecx@18
Ritor1
parents:
diff changeset
7320 int v20; // ecx@19
Ritor1
parents:
diff changeset
7321 int v21; // ecx@20
Ritor1
parents:
diff changeset
7322 int v22; // ecx@21
Ritor1
parents:
diff changeset
7323 unsigned int v23; // ecx@23
Ritor1
parents:
diff changeset
7324 int v24; // ecx@35
Ritor1
parents:
diff changeset
7325 int v25; // ecx@36
Ritor1
parents:
diff changeset
7326 int v26; // ecx@37
Ritor1
parents:
diff changeset
7327 int v27; // ecx@38
Ritor1
parents:
diff changeset
7328 int v28; // ecx@39
Ritor1
parents:
diff changeset
7329 char *v29; // esi@42
Ritor1
parents:
diff changeset
7330 unsigned int v30; // ST20_4@42
Ritor1
parents:
diff changeset
7331 int v31; // ST1C_4@42
Ritor1
parents:
diff changeset
7332 unsigned int v32; // eax@42
Ritor1
parents:
diff changeset
7333 char *v33; // eax@43
Ritor1
parents:
diff changeset
7334 int v34; // esi@51
Ritor1
parents:
diff changeset
7335 int v35; // eax@51
Ritor1
parents:
diff changeset
7336 unsigned int v36; // edi@51
Ritor1
parents:
diff changeset
7337 GUIButton *v37; // eax@52
Ritor1
parents:
diff changeset
7338 int v38; // eax@52
Ritor1
parents:
diff changeset
7339 signed int v39; // ecx@54
Ritor1
parents:
diff changeset
7340 int v40; // edi@57
Ritor1
parents:
diff changeset
7341 GUIButton *v41; // eax@60
Ritor1
parents:
diff changeset
7342 GUIButton *v42; // esi@60
Ritor1
parents:
diff changeset
7343 const char *v43; // ebx@60
Ritor1
parents:
diff changeset
7344 int v44; // eax@60
Ritor1
parents:
diff changeset
7345 unsigned int v45; // ecx@60
Ritor1
parents:
diff changeset
7346 unsigned __int16 v46; // ax@60
Ritor1
parents:
diff changeset
7347 GUIFont *v47; // ebx@64
Ritor1
parents:
diff changeset
7348 int v48; // esi@64
Ritor1
parents:
diff changeset
7349 char *v49; // eax@66
Ritor1
parents:
diff changeset
7350 GUIWindow w; // [sp+Ch] [bp-110h]@64
Ritor1
parents:
diff changeset
7351 GUIWindow v52; // [sp+60h] [bp-BCh]@13
Ritor1
parents:
diff changeset
7352 GUIWindow a1; // [sp+B4h] [bp-68h]@1
Ritor1
parents:
diff changeset
7353 unsigned int v54; // [sp+108h] [bp-14h]@14
Ritor1
parents:
diff changeset
7354 int v55; // [sp+10Ch] [bp-10h]@6
Ritor1
parents:
diff changeset
7355 int v56; // [sp+110h] [bp-Ch]@13
Ritor1
parents:
diff changeset
7356 char *pInString; // [sp+114h] [bp-8h]@12
Ritor1
parents:
diff changeset
7357 NPCData *v58; // [sp+118h] [bp-4h]@6
Ritor1
parents:
diff changeset
7358
Ritor1
parents:
diff changeset
7359 memcpy(&a1, pDialogueWindow, sizeof(a1));
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7360 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
0
Ritor1
parents:
diff changeset
7361 {
Ritor1
parents:
diff changeset
7362 v0 = pMapStats->pInfos[uHouse_ExitPic].pName;
Ritor1
parents:
diff changeset
7363 v1 = pMapStats->pInfos[uHouse_ExitPic].pName;
Ritor1
parents:
diff changeset
7364 a1.uFrameX = 493;
Ritor1
parents:
diff changeset
7365 a1.uFrameWidth = 126;
Ritor1
parents:
diff changeset
7366 a1.uFrameZ = 366;
Ritor1
parents:
diff changeset
7367 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u);
Ritor1
parents:
diff changeset
7368 a1.uFrameX = 483;
Ritor1
parents:
diff changeset
7369 a1.uFrameWidth = 148;
Ritor1
parents:
diff changeset
7370 a1.uFrameZ = 334;
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 431
diff changeset
7371 v2 = pTransitionStrings[uHouse_ExitPic];
0
Ritor1
parents:
diff changeset
7372 if ( !v2 )
Ritor1
parents:
diff changeset
7373 {
721
Ritor1
parents: 720
diff changeset
7374 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
0
Ritor1
parents:
diff changeset
7375 v2 = pTmpBuf;
Ritor1
parents:
diff changeset
7376 }
Ritor1
parents:
diff changeset
7377 v3 = v2;
Ritor1
parents:
diff changeset
7378 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0);
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7379 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u);
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7380 return;
0
Ritor1
parents:
diff changeset
7381 }
Ritor1
parents:
diff changeset
7382 a1.uFrameWidth -= 10;
Ritor1
parents:
diff changeset
7383 a1.uFrameZ -= 10;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7384 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
0
Ritor1
parents:
diff changeset
7385 v6 = v58;
Ritor1
parents:
diff changeset
7386 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
Ritor1
parents:
diff changeset
7387 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
Ritor1
parents:
diff changeset
7388 v8 = v6->uProfession;
Ritor1
parents:
diff changeset
7389 if ( v8 )
264
fb890fb66cad ^Pi[%s]%s
Ritor1
parents: 263
diff changeset
7390 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
0
Ritor1
parents:
diff changeset
7391 else
Ritor1
parents:
diff changeset
7392 strcpy(pTmpBuf, v6->pName);
Ritor1
parents:
diff changeset
7393 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
7394 if ( !dword_591080 )
Ritor1
parents:
diff changeset
7395 {
Ritor1
parents:
diff changeset
7396 if ( !uDialogueType )
Ritor1
parents:
diff changeset
7397 {
Ritor1
parents:
diff changeset
7398 v9 = v6->greet;
Ritor1
parents:
diff changeset
7399 if ( v9 )
Ritor1
parents:
diff changeset
7400 {
Ritor1
parents:
diff changeset
7401 v10 = v6->uFlags;
Ritor1
parents:
diff changeset
7402 a1.uFrameWidth = 460;
Ritor1
parents:
diff changeset
7403 a1.uFrameZ = 452;
Ritor1
parents:
diff changeset
7404 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9);
Ritor1
parents:
diff changeset
7405 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0);
Ritor1
parents:
diff changeset
7406 v12 = v11 + 7;
Ritor1
parents:
diff changeset
7407 pRenderer->_4A6A68(
Ritor1
parents:
diff changeset
7408 8u,
Ritor1
parents:
diff changeset
7409 352 - (v11 + 7),
Ritor1
parents:
diff changeset
7410 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
Ritor1
parents:
diff changeset
7411 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7));
Ritor1
parents:
diff changeset
7412 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
Ritor1
parents:
diff changeset
7413 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0);
Ritor1
parents:
diff changeset
7414 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
Ritor1
parents:
diff changeset
7415 }
Ritor1
parents:
diff changeset
7416 }
Ritor1
parents:
diff changeset
7417 }
Ritor1
parents:
diff changeset
7418 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7419 memcpy(&v52, pDialogueWindow, sizeof(v52));
Ritor1
parents:
diff changeset
7420 v52.uFrameX = 483;
Ritor1
parents:
diff changeset
7421 v52.uFrameWidth = 148;
Ritor1
parents:
diff changeset
7422 v52.uFrameZ = 334;
Ritor1
parents:
diff changeset
7423 v56 = v52.pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7424 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
Ritor1
parents:
diff changeset
7425 {
348
5bc2df838558 small fix, decompiler error
zipi
parents: 342
diff changeset
7426 v15 = "";//(char *)v54;
0
Ritor1
parents:
diff changeset
7427 while ( 1 )
Ritor1
parents:
diff changeset
7428 {
Ritor1
parents:
diff changeset
7429 v16 = v52.GetControl(v56);
Ritor1
parents:
diff changeset
7430 v17 = v16->uControlParam;
Ritor1
parents:
diff changeset
7431 pInString = (char *)v16;
Ritor1
parents:
diff changeset
7432 if ( (signed int)v17 > 24 )
Ritor1
parents:
diff changeset
7433 {
Ritor1
parents:
diff changeset
7434 v24 = v17 - 76;
Ritor1
parents:
diff changeset
7435 if ( !v24 )
Ritor1
parents:
diff changeset
7436 {
Ritor1
parents:
diff changeset
7437 v15 = pGlobalTXT_LocalizationStrings[406];
Ritor1
parents:
diff changeset
7438 goto LABEL_49;
Ritor1
parents:
diff changeset
7439 }
Ritor1
parents:
diff changeset
7440 v25 = v24 - 1;
Ritor1
parents:
diff changeset
7441 if ( !v25 )
Ritor1
parents:
diff changeset
7442 {
Ritor1
parents:
diff changeset
7443 v15 = pGlobalTXT_LocalizationStrings[407];
Ritor1
parents:
diff changeset
7444 goto LABEL_49;
Ritor1
parents:
diff changeset
7445 }
Ritor1
parents:
diff changeset
7446 v26 = v25 - 2;
Ritor1
parents:
diff changeset
7447 if ( !v26 )
Ritor1
parents:
diff changeset
7448 {
Ritor1
parents:
diff changeset
7449 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C);
Ritor1
parents:
diff changeset
7450 LABEL_44:
Ritor1
parents:
diff changeset
7451 v15 = v33;
Ritor1
parents:
diff changeset
7452 LABEL_45:
Ritor1
parents:
diff changeset
7453 v16 = (GUIButton *)pInString;
Ritor1
parents:
diff changeset
7454 goto LABEL_49;
Ritor1
parents:
diff changeset
7455 }
Ritor1
parents:
diff changeset
7456 v27 = v26 - 3;
Ritor1
parents:
diff changeset
7457 if ( !v27 )
Ritor1
parents:
diff changeset
7458 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7459 v33 = (char *)ContractSelectText((int)v52.ptr_1C);
0
Ritor1
parents:
diff changeset
7460 goto LABEL_44;
Ritor1
parents:
diff changeset
7461 }
Ritor1
parents:
diff changeset
7462 v28 = v27 - 1;
Ritor1
parents:
diff changeset
7463 if ( !v28 )
Ritor1
parents:
diff changeset
7464 {
Ritor1
parents:
diff changeset
7465 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0;
Ritor1
parents:
diff changeset
7466 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
Ritor1
parents:
diff changeset
7467 v31 = *(int *)v29;
Ritor1
parents:
diff changeset
7468 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
Ritor1
parents:
diff changeset
7469 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30);
Ritor1
parents:
diff changeset
7470 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
Ritor1
parents:
diff changeset
7471 ptr_F8B1E8 = pTmpBuf2;
Ritor1
parents:
diff changeset
7472 v15 = "";
Ritor1
parents:
diff changeset
7473 goto LABEL_45;
Ritor1
parents:
diff changeset
7474 }
Ritor1
parents:
diff changeset
7475 if ( v28 != 10 )
Ritor1
parents:
diff changeset
7476 goto LABEL_41;
Ritor1
parents:
diff changeset
7477 }
Ritor1
parents:
diff changeset
7478 else
Ritor1
parents:
diff changeset
7479 {
Ritor1
parents:
diff changeset
7480 if ( v17 == 24 )
Ritor1
parents:
diff changeset
7481 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7482 v23 = v58->evt_F;
0
Ritor1
parents:
diff changeset
7483 LABEL_33:
81
377535d6e366 structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents: 66
diff changeset
7484 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
0
Ritor1
parents:
diff changeset
7485 if ( !v15 )
Ritor1
parents:
diff changeset
7486 {
Ritor1
parents:
diff changeset
7487 v16->uControlParam = 0;
Ritor1
parents:
diff changeset
7488 v15 = "";
Ritor1
parents:
diff changeset
7489 }
Ritor1
parents:
diff changeset
7490 goto LABEL_49;
Ritor1
parents:
diff changeset
7491 }
Ritor1
parents:
diff changeset
7492 v18 = v17 - 13;
Ritor1
parents:
diff changeset
7493 if ( v18 )
Ritor1
parents:
diff changeset
7494 {
Ritor1
parents:
diff changeset
7495 v19 = v18 - 6;
Ritor1
parents:
diff changeset
7496 if ( !v19 )
Ritor1
parents:
diff changeset
7497 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7498 v23 = v58->evt_A;
0
Ritor1
parents:
diff changeset
7499 goto LABEL_33;
Ritor1
parents:
diff changeset
7500 }
Ritor1
parents:
diff changeset
7501 v20 = v19 - 1;
Ritor1
parents:
diff changeset
7502 if ( !v20 )
Ritor1
parents:
diff changeset
7503 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7504 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb];
0
Ritor1
parents:
diff changeset
7505 if ( !v15 )
Ritor1
parents:
diff changeset
7506 {
Ritor1
parents:
diff changeset
7507 v16->uControlParam = 0;
Ritor1
parents:
diff changeset
7508 v15 = "";
Ritor1
parents:
diff changeset
7509 }
Ritor1
parents:
diff changeset
7510 if ( uDialogueType != 84 )
Ritor1
parents:
diff changeset
7511 goto LABEL_49;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7512 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
0
Ritor1
parents:
diff changeset
7513 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf);
Ritor1
parents:
diff changeset
7514 ptr_F8B1E8 = pTmpBuf2;
Ritor1
parents:
diff changeset
7515 goto LABEL_45;
Ritor1
parents:
diff changeset
7516 }
Ritor1
parents:
diff changeset
7517 v21 = v20 - 1;
Ritor1
parents:
diff changeset
7518 if ( !v21 )
Ritor1
parents:
diff changeset
7519 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7520 v23 = v58->evt_C;
0
Ritor1
parents:
diff changeset
7521 goto LABEL_33;
Ritor1
parents:
diff changeset
7522 }
Ritor1
parents:
diff changeset
7523 v22 = v21 - 1;
Ritor1
parents:
diff changeset
7524 if ( !v22 )
Ritor1
parents:
diff changeset
7525 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7526 v23 = v58->evt_D;
0
Ritor1
parents:
diff changeset
7527 goto LABEL_33;
Ritor1
parents:
diff changeset
7528 }
Ritor1
parents:
diff changeset
7529 if ( v22 == 1 )
Ritor1
parents:
diff changeset
7530 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7531 v23 = v58->evt_E;
0
Ritor1
parents:
diff changeset
7532 goto LABEL_33;
Ritor1
parents:
diff changeset
7533 }
Ritor1
parents:
diff changeset
7534 LABEL_41:
Ritor1
parents:
diff changeset
7535 v15 = "";
Ritor1
parents:
diff changeset
7536 goto LABEL_49;
Ritor1
parents:
diff changeset
7537 }
Ritor1
parents:
diff changeset
7538 v15 = pGlobalTXT_LocalizationStrings[122];
Ritor1
parents:
diff changeset
7539 }
Ritor1
parents:
diff changeset
7540 LABEL_49:
Ritor1
parents:
diff changeset
7541 strcpy(v16->pButtonName, v15);
Ritor1
parents:
diff changeset
7542 ++v56;
Ritor1
parents:
diff changeset
7543 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton )
Ritor1
parents:
diff changeset
7544 {
Ritor1
parents:
diff changeset
7545 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7546 break;
Ritor1
parents:
diff changeset
7547 }
Ritor1
parents:
diff changeset
7548 }
Ritor1
parents:
diff changeset
7549 }
Ritor1
parents:
diff changeset
7550 v34 = 0;
Ritor1
parents:
diff changeset
7551 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
Ritor1
parents:
diff changeset
7552 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
Ritor1
parents:
diff changeset
7553 v36 = v14->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7554 v55 = v35;
Ritor1
parents:
diff changeset
7555 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
Ritor1
parents:
diff changeset
7556 + pDialogueWindow->pStartingPosActiveItem )
Ritor1
parents:
diff changeset
7557 {
Ritor1
parents:
diff changeset
7558 v37 = v14->GetControl(v36);
Ritor1
parents:
diff changeset
7559 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
Ritor1
parents:
diff changeset
7560 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7561 v34 += v38;
Ritor1
parents:
diff changeset
7562 ++v36;
Ritor1
parents:
diff changeset
7563 }
Ritor1
parents:
diff changeset
7564 v39 = v14->pNumPresenceButton;
Ritor1
parents:
diff changeset
7565 if ( v39 )
Ritor1
parents:
diff changeset
7566 {
Ritor1
parents:
diff changeset
7567 v58 = (NPCData *)((174 - v34) / v39);
Ritor1
parents:
diff changeset
7568 if ( (signed int)v58 > 32 )
Ritor1
parents:
diff changeset
7569 v58 = (NPCData *)32;
Ritor1
parents:
diff changeset
7570 pInString = (char *)2;
Ritor1
parents:
diff changeset
7571 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138;
Ritor1
parents:
diff changeset
7572 v56 = v14->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7573 i = v56;
Ritor1
parents:
diff changeset
7574 if ( (signed int)i < (signed int)(i + v39) )
Ritor1
parents:
diff changeset
7575 {
Ritor1
parents:
diff changeset
7576 while ( 1 )
Ritor1
parents:
diff changeset
7577 {
Ritor1
parents:
diff changeset
7578 v41 = v14->GetControl(i);
Ritor1
parents:
diff changeset
7579 v42 = v41;
Ritor1
parents:
diff changeset
7580 v43 = v41->pButtonName;
Ritor1
parents:
diff changeset
7581 v41->uY = (unsigned int)((char *)v58 + v40);
Ritor1
parents:
diff changeset
7582 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0);
Ritor1
parents:
diff changeset
7583 v45 = v42->uY;
Ritor1
parents:
diff changeset
7584 v42->uHeight = v44;
Ritor1
parents:
diff changeset
7585 v40 = v45 + v44 - 1;
Ritor1
parents:
diff changeset
7586 v42->uW = v40;
Ritor1
parents:
diff changeset
7587 v46 = v55;
Ritor1
parents:
diff changeset
7588 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
Ritor1
parents:
diff changeset
7589 v46 = v54;
Ritor1
parents:
diff changeset
7590 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u);
Ritor1
parents:
diff changeset
7591 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7592 ++pInString;
Ritor1
parents:
diff changeset
7593 ++v56;
Ritor1
parents:
diff changeset
7594 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7595 if ( v56 >= (signed int)i )
Ritor1
parents:
diff changeset
7596 break;
Ritor1
parents:
diff changeset
7597 i = v56;
Ritor1
parents:
diff changeset
7598 }
Ritor1
parents:
diff changeset
7599 }
Ritor1
parents:
diff changeset
7600 }
Ritor1
parents:
diff changeset
7601 if ( ptr_F8B1E8 )
Ritor1
parents:
diff changeset
7602 {
Ritor1
parents:
diff changeset
7603 w.uFrameWidth = 458;
Ritor1
parents:
diff changeset
7604 w.uFrameZ = 457;
Ritor1
parents:
diff changeset
7605 v47 = pFontArrus;
Ritor1
parents:
diff changeset
7606 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
Ritor1
parents:
diff changeset
7607 if ( 352 - v48 < 8 )
Ritor1
parents:
diff changeset
7608 {
Ritor1
parents:
diff changeset
7609 v47 = pFontCreate;
Ritor1
parents:
diff changeset
7610 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
Ritor1
parents:
diff changeset
7611 }
Ritor1
parents:
diff changeset
7612 pRenderer->_4A6A68(
Ritor1
parents:
diff changeset
7613 8u,
Ritor1
parents:
diff changeset
7614 352 - v48,
Ritor1
parents:
diff changeset
7615 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
Ritor1
parents:
diff changeset
7616 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48);
Ritor1
parents:
diff changeset
7617 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428);
Ritor1
parents:
diff changeset
7618 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0);
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7619 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0);
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7620 }
0
Ritor1
parents:
diff changeset
7621 }
Ritor1
parents:
diff changeset
7622
Ritor1
parents:
diff changeset
7623
Ritor1
parents:
diff changeset
7624
Ritor1
parents:
diff changeset
7625
Ritor1
parents:
diff changeset
7626
Ritor1
parents:
diff changeset
7627 //----- (004B36CC) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7628 void CreateButtonInColumn( int column_pos, unsigned int control_id )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7629 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7630 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0);
0
Ritor1
parents:
diff changeset
7631 }
Ritor1
parents:
diff changeset
7632
Ritor1
parents:
diff changeset
7633
Ritor1
parents:
diff changeset
7634
Ritor1
parents:
diff changeset
7635 //----- (004B3A72) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7636 void sub_4B3A72( int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7637 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7638 int num_buttons; // esi@1
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7639
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7640 num_buttons = 0;
0
Ritor1
parents:
diff changeset
7641 if ( a1 == 21 )
Ritor1
parents:
diff changeset
7642 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7643 CreateButtonInColumn(0, 0x66u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7644 num_buttons = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7645 CreateButtonInColumn(1, 0x67u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7646 if ( pParty->HasItem(651) ) //Arcomage Deck
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7647 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7648 num_buttons = 3;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7649 CreateButtonInColumn(2, 0x68u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7650 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7651 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7652 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2);
0
Ritor1
parents:
diff changeset
7653 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7654 }
Ritor1
parents:
diff changeset
7655 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7656
Ritor1
parents:
diff changeset
7657 //----- (004B3AD4) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7658 void sub_4B3AD4( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7659 {
0
Ritor1
parents:
diff changeset
7660 if ( a1 > 0 )
Ritor1
parents:
diff changeset
7661 {
Ritor1
parents:
diff changeset
7662 if ( a1 <= 3 )
Ritor1
parents:
diff changeset
7663 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7664 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7665 CreateButtonInColumn(1, 4u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7666 CreateButtonInColumn(2, 5u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7667 pDialogueWindow->_41D08F(3, 1, 0, 2);
0
Ritor1
parents:
diff changeset
7668 }
Ritor1
parents:
diff changeset
7669 if ( a1 == 4 )
Ritor1
parents:
diff changeset
7670 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7671 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7672 CreateButtonInColumn(1, 4u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7673 pDialogueWindow->_41D08F(2, 1, 0, 2);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7674 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7675 }
0
Ritor1
parents:
diff changeset
7676 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7677 }
Ritor1
parents:
diff changeset
7678 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7679
Ritor1
parents:
diff changeset
7680 //----- (004B3B42) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7681 void sub_4B3B42( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7682 {
0
Ritor1
parents:
diff changeset
7683 int v1; // ecx@18
Ritor1
parents:
diff changeset
7684 int v2; // ecx@19
Ritor1
parents:
diff changeset
7685 int v3; // ecx@20
Ritor1
parents:
diff changeset
7686 signed int v4; // esi@22
Ritor1
parents:
diff changeset
7687 signed int v5; // eax@22
Ritor1
parents:
diff changeset
7688 unsigned int v6; // edx@24
Ritor1
parents:
diff changeset
7689 int v7; // ecx@24
Ritor1
parents:
diff changeset
7690 int result; // eax@43
Ritor1
parents:
diff changeset
7691 int v9; // [sp-10h] [bp-14h]@28
Ritor1
parents:
diff changeset
7692 int v10; // [sp-Ch] [bp-10h]@28
Ritor1
parents:
diff changeset
7693 int v11; // [sp-8h] [bp-Ch]@28
Ritor1
parents:
diff changeset
7694 unsigned int v12; // [sp-4h] [bp-8h]@4
Ritor1
parents:
diff changeset
7695 unsigned int v13; // [sp-4h] [bp-8h]@5
Ritor1
parents:
diff changeset
7696 unsigned int v14; // [sp-4h] [bp-8h]@9
Ritor1
parents:
diff changeset
7697 unsigned int v15; // [sp-4h] [bp-8h]@10
Ritor1
parents:
diff changeset
7698 unsigned int v16; // [sp-4h] [bp-8h]@14
Ritor1
parents:
diff changeset
7699 int v17; // [sp-4h] [bp-8h]@28
Ritor1
parents:
diff changeset
7700
Ritor1
parents:
diff changeset
7701 if ( a1 > 13 )
Ritor1
parents:
diff changeset
7702 {
Ritor1
parents:
diff changeset
7703 if ( a1 > 22 )
Ritor1
parents:
diff changeset
7704 {
Ritor1
parents:
diff changeset
7705 if ( a1 == 23 )
Ritor1
parents:
diff changeset
7706 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7707 CreateButtonInColumn(0, 0xAu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7708 CreateButtonInColumn(1, 0xBu);
0
Ritor1
parents:
diff changeset
7709 v14 = 96;
Ritor1
parents:
diff changeset
7710 LABEL_41:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7711 CreateButtonInColumn(2, v14);
0
Ritor1
parents:
diff changeset
7712 v17 = 2;
Ritor1
parents:
diff changeset
7713 v11 = 0;
Ritor1
parents:
diff changeset
7714 v10 = 1;
Ritor1
parents:
diff changeset
7715 v9 = 3;
Ritor1
parents:
diff changeset
7716 goto LABEL_42;
Ritor1
parents:
diff changeset
7717 }
Ritor1
parents:
diff changeset
7718 if ( a1 <= 26 )
Ritor1
parents:
diff changeset
7719 goto LABEL_43;
Ritor1
parents:
diff changeset
7720 if ( a1 > 28 )
Ritor1
parents:
diff changeset
7721 {
Ritor1
parents:
diff changeset
7722 if ( a1 != 30 )
Ritor1
parents:
diff changeset
7723 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7724 CreateButtonInColumn(0, 0x11u);
0
Ritor1
parents:
diff changeset
7725 v16 = 96;
Ritor1
parents:
diff changeset
7726 goto LABEL_37;
Ritor1
parents:
diff changeset
7727 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7728 CreateButtonInColumn(0, 0x69u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7729 CreateButtonInColumn(1, 0x6Au);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7730 CreateButtonInColumn(2, 0x6Bu);
0
Ritor1
parents:
diff changeset
7731 v12 = 108;
Ritor1
parents:
diff changeset
7732 }
Ritor1
parents:
diff changeset
7733 else
Ritor1
parents:
diff changeset
7734 {
Ritor1
parents:
diff changeset
7735 if ( a1 == 22 )
Ritor1
parents:
diff changeset
7736 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7737 CreateButtonInColumn(0, 7u);
0
Ritor1
parents:
diff changeset
7738 v16 = 8;
Ritor1
parents:
diff changeset
7739 goto LABEL_37;
Ritor1
parents:
diff changeset
7740 }
Ritor1
parents:
diff changeset
7741 v1 = a1 - 14;
Ritor1
parents:
diff changeset
7742 if ( !v1 )
Ritor1
parents:
diff changeset
7743 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7744 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7745 CreateButtonInColumn(1, 0x30u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7746 CreateButtonInColumn(2, 0x31u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7747 CreateButtonInColumn(3, 0x32u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7748 CreateButtonInColumn(4, 0x33u);
0
Ritor1
parents:
diff changeset
7749 v17 = 2;
Ritor1
parents:
diff changeset
7750 v11 = 0;
Ritor1
parents:
diff changeset
7751 v10 = 1;
Ritor1
parents:
diff changeset
7752 v9 = 5;
Ritor1
parents:
diff changeset
7753 goto LABEL_42;
Ritor1
parents:
diff changeset
7754 }
Ritor1
parents:
diff changeset
7755 v2 = v1 - 1;
Ritor1
parents:
diff changeset
7756 if ( v2 )
Ritor1
parents:
diff changeset
7757 {
Ritor1
parents:
diff changeset
7758 v3 = v2 - 2;
Ritor1
parents:
diff changeset
7759 if ( v3 )
Ritor1
parents:
diff changeset
7760 {
Ritor1
parents:
diff changeset
7761 if ( v3 != 4 )
Ritor1
parents:
diff changeset
7762 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7763 CreateButtonInColumn(0, 0xFu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7764 CreateButtonInColumn(1, 0x10u);
0
Ritor1
parents:
diff changeset
7765 v4 = 3;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7766 CreateButtonInColumn(2, 0x60u);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
7767 v5 = (signed int)window_SpeakInHouse->ptr_1C;
0
Ritor1
parents:
diff changeset
7768 if ( v5 < 108 || v5 > 120 )
Ritor1
parents:
diff changeset
7769 goto LABEL_28;
Ritor1
parents:
diff changeset
7770 v4 = 4;
Ritor1
parents:
diff changeset
7771 v6 = 101;
Ritor1
parents:
diff changeset
7772 v7 = 3;
Ritor1
parents:
diff changeset
7773 }
Ritor1
parents:
diff changeset
7774 else
Ritor1
parents:
diff changeset
7775 {
Ritor1
parents:
diff changeset
7776 v4 = 1;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7777 CreateButtonInColumn(0, 0x63u);
0
Ritor1
parents:
diff changeset
7778 if ( !pParty->uFine )
Ritor1
parents:
diff changeset
7779 {
Ritor1
parents:
diff changeset
7780 LABEL_28:
Ritor1
parents:
diff changeset
7781 v17 = 2;
Ritor1
parents:
diff changeset
7782 v11 = 0;
Ritor1
parents:
diff changeset
7783 v10 = 1;
Ritor1
parents:
diff changeset
7784 v9 = v4;
Ritor1
parents:
diff changeset
7785 LABEL_42:
Ritor1
parents:
diff changeset
7786 pDialogueWindow->_41D08F(v9, v10, v11, v17);
Ritor1
parents:
diff changeset
7787 goto LABEL_43;
Ritor1
parents:
diff changeset
7788 }
Ritor1
parents:
diff changeset
7789 v4 = 2;
Ritor1
parents:
diff changeset
7790 v7 = 1;
Ritor1
parents:
diff changeset
7791 v6 = 100;
Ritor1
parents:
diff changeset
7792 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7793 CreateButtonInColumn(v7, v6);
0
Ritor1
parents:
diff changeset
7794 goto LABEL_28;
Ritor1
parents:
diff changeset
7795 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7796 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7797 CreateButtonInColumn(1, 0x34u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7798 CreateButtonInColumn(2, 0x35u);
0
Ritor1
parents:
diff changeset
7799 v12 = 54;
Ritor1
parents:
diff changeset
7800 }
Ritor1
parents:
diff changeset
7801 LABEL_39:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7802 CreateButtonInColumn(3, v12);
0
Ritor1
parents:
diff changeset
7803 v17 = 2;
Ritor1
parents:
diff changeset
7804 v11 = 0;
Ritor1
parents:
diff changeset
7805 v10 = 1;
Ritor1
parents:
diff changeset
7806 v9 = 4;
Ritor1
parents:
diff changeset
7807 goto LABEL_42;
Ritor1
parents:
diff changeset
7808 }
Ritor1
parents:
diff changeset
7809 if ( a1 == 13 )
Ritor1
parents:
diff changeset
7810 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7811 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7812 v16 = 56;
Ritor1
parents:
diff changeset
7813 LABEL_37:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7814 CreateButtonInColumn(1, v16);
0
Ritor1
parents:
diff changeset
7815 v17 = 2;
Ritor1
parents:
diff changeset
7816 v11 = 0;
Ritor1
parents:
diff changeset
7817 v10 = 1;
Ritor1
parents:
diff changeset
7818 v9 = 2;
Ritor1
parents:
diff changeset
7819 goto LABEL_42;
Ritor1
parents:
diff changeset
7820 }
Ritor1
parents:
diff changeset
7821 switch ( a1 )
Ritor1
parents:
diff changeset
7822 {
Ritor1
parents:
diff changeset
7823 case 1:
Ritor1
parents:
diff changeset
7824 case 2:
Ritor1
parents:
diff changeset
7825 case 3:
Ritor1
parents:
diff changeset
7826 case 4:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7827 CreateButtonInColumn(0, 2u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7828 CreateButtonInColumn(1, 0x5Fu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7829 CreateButtonInColumn(2, 0x5Eu);
0
Ritor1
parents:
diff changeset
7830 v12 = 96;
Ritor1
parents:
diff changeset
7831 goto LABEL_39;
Ritor1
parents:
diff changeset
7832 case 5:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7833 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7834 v13 = 48;
Ritor1
parents:
diff changeset
7835 goto LABEL_9;
Ritor1
parents:
diff changeset
7836 case 6:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7837 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7838 v13 = 49;
Ritor1
parents:
diff changeset
7839 goto LABEL_9;
Ritor1
parents:
diff changeset
7840 case 7:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7841 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7842 v13 = 50;
Ritor1
parents:
diff changeset
7843 goto LABEL_9;
Ritor1
parents:
diff changeset
7844 case 8:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7845 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7846 v13 = 51;
Ritor1
parents:
diff changeset
7847 LABEL_9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7848 CreateButtonInColumn(1, v13);
0
Ritor1
parents:
diff changeset
7849 v14 = 72;
Ritor1
parents:
diff changeset
7850 goto LABEL_41;
Ritor1
parents:
diff changeset
7851 case 9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7852 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7853 v15 = 52;
Ritor1
parents:
diff changeset
7854 goto LABEL_13;
Ritor1
parents:
diff changeset
7855 case 10:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7856 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7857 v15 = 53;
Ritor1
parents:
diff changeset
7858 goto LABEL_13;
Ritor1
parents:
diff changeset
7859 case 11:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7860 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7861 v15 = 54;
Ritor1
parents:
diff changeset
7862 LABEL_13:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7863 CreateButtonInColumn(1, v15);
0
Ritor1
parents:
diff changeset
7864 v14 = 61;
Ritor1
parents:
diff changeset
7865 goto LABEL_41;
Ritor1
parents:
diff changeset
7866 case 12:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7867 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7868 v16 = 55;
Ritor1
parents:
diff changeset
7869 goto LABEL_37;
Ritor1
parents:
diff changeset
7870 default:
Ritor1
parents:
diff changeset
7871 break;
Ritor1
parents:
diff changeset
7872 }
Ritor1
parents:
diff changeset
7873 LABEL_43:
Ritor1
parents:
diff changeset
7874 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7875 }
Ritor1
parents:
diff changeset
7876 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7877
Ritor1
parents:
diff changeset
7878 //----- (004B3E1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7879 void __cdecl sub_4B3E1E()
Ritor1
parents:
diff changeset
7880 {
Ritor1
parents:
diff changeset
7881 NPCData *v0; // ST40_4@1
Ritor1
parents:
diff changeset
7882 signed int v1; // edi@1
165
Ritor1
parents: 152
diff changeset
7883 //GUIWindow *v2; // ecx@1
0
Ritor1
parents:
diff changeset
7884
167
90521fb9766c NPCDialogue fix
Ritor1
parents: 165
diff changeset
7885 __debugbreak();
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
7886 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0
Ritor1
parents:
diff changeset
7887 v1 = 0;
Ritor1
parents:
diff changeset
7888 pDialogueWindow->eWindowType = WINDOW_MainMenu;
Ritor1
parents:
diff changeset
7889 pDialogueWindow->Release();
165
Ritor1
parents: 152
diff changeset
7890 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7891 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
0
Ritor1
parents:
diff changeset
7892 {
165
Ritor1
parents: 152
diff changeset
7893 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
0
Ritor1
parents:
diff changeset
7894 v1 = 1;
Ritor1
parents:
diff changeset
7895 }
165
Ritor1
parents: 152
diff changeset
7896 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
0
Ritor1
parents:
diff changeset
7897 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1);
Ritor1
parents:
diff changeset
7898 }
Ritor1
parents:
diff changeset
7899
Ritor1
parents:
diff changeset
7900 //----- (004B3EF0) --------------------------------------------------------
492
Gloval
parents: 487
diff changeset
7901 void DrawJoinGuildWindow( int pEventCode )
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7902 {
467
Ritor1
parents: 460
diff changeset
7903 uDialogueType = 81;//enum JoinGuildDialog
492
Gloval
parents: 487
diff changeset
7904 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText;
Gloval
parents: 487
diff changeset
7905 ContractSelectText(pEventCode);
0
Ritor1
parents:
diff changeset
7906 pDialogueWindow->Release();
492
Gloval
parents: 487
diff changeset
7907 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0);
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7908 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34],
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 520
diff changeset
7909 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
0
Ritor1
parents:
diff changeset
7910 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7911 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
0
Ritor1
parents:
diff changeset
7912 pDialogueWindow->_41D08F(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7913 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7914 }
Ritor1
parents:
diff changeset
7915 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
7916
Ritor1
parents:
diff changeset
7917 //----- (004B3FE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
7918 void __fastcall sub_4B3FE5(int a4)
Ritor1
parents:
diff changeset
7919 {
Ritor1
parents:
diff changeset
7920 int v1; // edi@1
Ritor1
parents:
diff changeset
7921 char *v2; // edi@1
Ritor1
parents:
diff changeset
7922
Ritor1
parents:
diff changeset
7923 v1 = a4;
Ritor1
parents:
diff changeset
7924 uDialogueType = 78;
Ritor1
parents:
diff changeset
7925 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText;
Ritor1
parents:
diff changeset
7926 _4B254D_SkillMasteryTeacher(a4);
Ritor1
parents:
diff changeset
7927 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7928 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
Ritor1
parents:
diff changeset
7929 v2 = "";
492
Gloval
parents: 487
diff changeset
7930 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0,
0
Ritor1
parents:
diff changeset
7931 pGlobalTXT_LocalizationStrings[34],
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 520
diff changeset
7932 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
0
Ritor1
parents:
diff changeset
7933 0);
Ritor1
parents:
diff changeset
7934 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7935 if ( contract_approved )
0
Ritor1
parents:
diff changeset
7936 v2 = pGlobalTXT_LocalizationStrings[535];
Ritor1
parents:
diff changeset
7937 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0);
Ritor1
parents:
diff changeset
7938 pDialogueWindow->_41D08F(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7939 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7940 }
Ritor1
parents:
diff changeset
7941 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
7942 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
7943
Ritor1
parents:
diff changeset
7944 //----- (004B40E6) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7945 void NPCHireableDialogPrepare()
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7946 {
0
Ritor1
parents:
diff changeset
7947 signed int v0; // ebx@1
Ritor1
parents:
diff changeset
7948 NPCData *v1; // edi@1
Ritor1
parents:
diff changeset
7949
Ritor1
parents:
diff changeset
7950 v0 = 0;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7951 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
0
Ritor1
parents:
diff changeset
7952 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7953 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7954 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0,
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7955 pGlobalTXT_LocalizationStrings[34], //"Cancel"
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 520
diff changeset
7956 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
0
Ritor1
parents:
diff changeset
7957 0);
Ritor1
parents:
diff changeset
7958 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7959 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
0
Ritor1
parents:
diff changeset
7960 {
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7961 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0,
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7962 pGlobalTXT_LocalizationStrings[407], 0);//"More Information"
0
Ritor1
parents:
diff changeset
7963 v0 = 1;
Ritor1
parents:
diff changeset
7964 }
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7965 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0,
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7966 pGlobalTXT_LocalizationStrings[406], 0); //"Hire"
0
Ritor1
parents:
diff changeset
7967 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7968 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7969 }
Ritor1
parents:
diff changeset
7970
Ritor1
parents:
diff changeset
7971
Ritor1
parents:
diff changeset
7972 //----- (004B4224) --------------------------------------------------------
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7973 void _4B4224_UpdateNPCTopics( int _this )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7974 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7975 int num_menu_buttons; // ebx@1
0
Ritor1
parents:
diff changeset
7976 int i; // ebp@5
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7977 // signed int v4; // ebp@9
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7978 int v6; // eax@16
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7979 int v8; // eax@21
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7980 int v10; // eax@26
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7981 int v12; // eax@31
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7982 int v14; // eax@36
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7983 int v16; // eax@41
0
Ritor1
parents:
diff changeset
7984 NPCData *v17; // [sp+10h] [bp-4h]@4
Ritor1
parents:
diff changeset
7985
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7986 num_menu_buttons = 0;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7987 pDialogueNPCCount = (_this + 1);
0
Ritor1
parents:
diff changeset
7988 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
Ritor1
parents:
diff changeset
7989 {
Ritor1
parents:
diff changeset
7990 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7991 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7992 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7993 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu,
0
Ritor1
parents:
diff changeset
7994 pGlobalTXT_LocalizationStrings[34],// "Cancel"
425
Gloval
parents: 424
diff changeset
7995 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7996 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u,
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7997 sHouseName,
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7998 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0);
424
Gloval
parents: 423 420
diff changeset
7999 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8000 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0);
0
Ritor1
parents:
diff changeset
8001 }
Ritor1
parents:
diff changeset
8002 else
Ritor1
parents:
diff changeset
8003 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
8004 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)];
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8005 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER )
0
Ritor1
parents:
diff changeset
8006 {
Ritor1
parents:
diff changeset
8007 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
8008 }
Ritor1
parents:
diff changeset
8009 else
Ritor1
parents:
diff changeset
8010 {
Ritor1
parents:
diff changeset
8011 for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
697
2dfb67633b01 GUIButton Release
zipi
parents: 693
diff changeset
8012 ((GUIButton *)HouseNPCData[i + 7])->Release();
0
Ritor1
parents:
diff changeset
8013 }
Ritor1
parents:
diff changeset
8014 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8015 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0,
0
Ritor1
parents:
diff changeset
8016 pGlobalTXT_LocalizationStrings[74],// "End Conversation"
526
214d9d47cf1f Chest working, but items are not laid correctly
Gloval
parents: 520
diff changeset
8017 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
0
Ritor1
parents:
diff changeset
8018 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
8019 if ( pDialogueNPCCount == 1 && dword_591080 )
0
Ritor1
parents:
diff changeset
8020 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
8021 sub_4B3B42(in_current_building_type);
0
Ritor1
parents:
diff changeset
8022 }
Ritor1
parents:
diff changeset
8023 else
Ritor1
parents:
diff changeset
8024 {
Ritor1
parents:
diff changeset
8025 if ( v17->joins )
Ritor1
parents:
diff changeset
8026 {
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8027 num_menu_buttons = 1;
0
Ritor1
parents:
diff changeset
8028 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0);
Ritor1
parents:
diff changeset
8029 }
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8030 if ( v17->evt_A)
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8031 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8032 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8033 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8034 v6 = NPC_EventProcessor(v17->evt_A);
0
Ritor1
parents:
diff changeset
8035 if ( v6 == 1 || v6 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8036 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8037 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8038 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8039 if ( v17->evt_B )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8040 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8041 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8042 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8043 v8 = NPC_EventProcessor(v17->evt_B);
0
Ritor1
parents:
diff changeset
8044 if ( v8 == 1 || v8 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8045 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8046 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8047 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8048 if ( v17->evt_C )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8049 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8050 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8051 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8052 v10 = NPC_EventProcessor(v17->evt_C);
0
Ritor1
parents:
diff changeset
8053 if ( v10 == 1 || v10 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8054 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8055 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8056 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8057
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8058 if ( v17->evt_D )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8059 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8060 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8061 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8062 v12 = NPC_EventProcessor(v17->evt_D);
0
Ritor1
parents:
diff changeset
8063 if ( v12 == 1 || v12 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8064 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8065 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8066 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8067 if ( v17->evt_E )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8068 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8069 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8070 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8071 v14 = NPC_EventProcessor(v17->evt_E);
0
Ritor1
parents:
diff changeset
8072 if ( v14 == 1 || v14 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8073 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8074 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8075 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8076 if ( v17->evt_F )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8077 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8078 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8079 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8080 v16 = NPC_EventProcessor(v17->evt_F);
0
Ritor1
parents:
diff changeset
8081 if ( v16 == 1 || v16 == 2 )
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8082 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0);
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8083 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8084 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8085 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2);
0
Ritor1
parents:
diff changeset
8086 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
8087 }
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
8088 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8089 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
8090
0
Ritor1
parents:
diff changeset
8091 }
Ritor1
parents:
diff changeset
8092
Ritor1
parents:
diff changeset
8093
Ritor1
parents:
diff changeset
8094
Ritor1
parents:
diff changeset
8095 //----- (004B46A5) --------------------------------------------------------
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
8096 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color)
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
8097 {
0
Ritor1
parents:
diff changeset
8098 int v4; // eax@1
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
8099 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
8100 v4 = pFontLucida->AlignText_Center(450, sText);
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
8101 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0);
0
Ritor1
parents:
diff changeset
8102 }
Ritor1
parents:
diff changeset
8103
Ritor1
parents:
diff changeset
8104 //----- (004B46F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
8105 int __fastcall sub_4B46F8(int a1)
Ritor1
parents:
diff changeset
8106 {
Ritor1
parents:
diff changeset
8107 int v1; // eax@1
Ritor1
parents:
diff changeset
8108 int i; // edx@1
Ritor1
parents:
diff changeset
8109
Ritor1
parents:
diff changeset
8110 v1 = 0;
Ritor1
parents:
diff changeset
8111 for ( i = 0; i < a1; ++i )
Ritor1
parents:
diff changeset
8112 v1 += i + 1;
Ritor1
parents:
diff changeset
8113 return 1000 * v1;
Ritor1
parents:
diff changeset
8114 }
Ritor1
parents:
diff changeset
8115
Ritor1
parents:
diff changeset
8116
Ritor1
parents:
diff changeset
8117 //----- (004BC49B) --------------------------------------------------------
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
8118 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8119 {
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8120 //unsigned int v1; // esi@1
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8121 NPCData *speakingNPC; // ebp@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8122 //unsigned int v3; // eax@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8123 int npc_event_id; // ecx@10
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8124 signed int v5; // edi@14
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8125 char *v6; // esi@15
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8126 const char *v7; // ecx@22
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8127 signed int v8; // edi@37
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8128 //unsigned int v9; // eax@56
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8129 unsigned int v10; // ecx@57
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8130 void *v11; // [sp-Ch] [bp-1Ch]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8131 int v12; // [sp-8h] [bp-18h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8132 char *v13; // [sp-8h] [bp-18h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8133 size_t v14; // [sp-4h] [bp-14h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8134 const char *v15; // [sp-4h] [bp-14h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8135
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8136 //v1 = _this;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8137 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
8138 //v3 = v1;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8139 uDialogueType = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8140 if (!speakingNPC->uFlags)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8141 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8142 speakingNPC->uFlags = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8143 //v3 = uDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8144 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8145
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8146 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8147 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8148 dialogue_show_profession_details = ~dialogue_show_profession_details;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8149 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8150 else if(newDialogueType == DIALOGUE_76)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8151 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8152 if (speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8153 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8154 v8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8155 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8156 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8157 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8158 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8159 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8160 ++v8;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8161 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8162 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8163 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8164 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8165 if( v8 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8166 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8167 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8168 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8169 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8170 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8171 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8172 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8173 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8174 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8175 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8176 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8177 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8178 pParty->field_709 = 0;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 656
diff changeset
8179 Party__CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8180 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8181 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8182 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8183 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8184 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8185 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8186 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8187 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8188 ShowStatusBarString(v7, 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8189 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8190 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8191 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8192 //v9 = v2->uProfession;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8193 if ( speakingNPC->uProfession != 51 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8194 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8195 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8196 if ( pParty->uNumGold < v10 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8197 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8198 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8199 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8200 uDialogueType = 13;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8201 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8202 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8203 v7 = pGlobalTXT_LocalizationStrings[155];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8204 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8205 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8206 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8207 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8208 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8209 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8210 Party::TakeGold(v10);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8211 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8212 LOBYTE(speakingNPC->uFlags) |= 0x80u;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8213 if ( pParty->pHirelings[0].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8214 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8215 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8216 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8217 v13 = pParty->pHireling2Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8218 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8219 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8220 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8221 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8222 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8223 v13 = pParty->pHireling1Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8224 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8225 strcpy(v13, v15);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8226 pParty->field_709 = 0;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 656
diff changeset
8227 Party__CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8228
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8229 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8230
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8231 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8232 pDialogue_SpeakingActor->uAIState = Removed;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8233 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8234 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8235 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8236 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8237 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8238 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8239 ArenaFight();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8240 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8241 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8242 else if(newDialogueType == DIALOGUE_9)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8243 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8244 if ( !sub_4BB756(speakingNPC->uProfession) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8245 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8246 if ( speakingNPC->uProfession != 41 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8247 speakingNPC->bHasUsedTheAbility = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8248
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8249 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8250 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8251 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8252 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8253 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8254 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8255 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8256 else if(newDialogueType == DIALOGUE_13)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8257 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8258 if (!speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8259 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8260 sub_4B3E1E();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8261 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8262 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8263 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8264 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8265 v5 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8266 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8267 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8268 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8269 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8270 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8271 ++v5;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8272 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8273 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8274 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8275 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8276 if ( v5 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8277 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8278 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8279 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8280 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8281 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8282 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8283 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8284 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8285 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8286 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8287 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8288 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8289 pParty->field_709 = 0;
659
c10163a6d946 NPC hiring fixed
zipi
parents: 656
diff changeset
8290 Party__CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8291 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8292 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8293 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8294 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8295 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8296 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8297 else if(newDialogueType >= 19 && newDialogueType <= 24)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8298 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8299 switch(newDialogueType)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8300 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8301 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8302 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8303 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8304 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8305 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8306 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8307 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8308 if ( (npc_event_id >= 200) && (npc_event_id <= 310) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8309 sub_4B3FE5(npc_event_id); //200-310
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8310 else if (( npc_event_id >= 400) && (npc_event_id <= 410) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8311 { //400-410
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8312 dword_F8B1D8 = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8313 DrawJoinGuildWindow(npc_event_id - 400);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8314 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8315 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8316 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8317 switch ( npc_event_id )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8318 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8319 case 139:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8320 sub_4B1ECE();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8321 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8322 case 311:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8323 sub_4BBA85_bounties();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8324 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8325 case 399:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8326 sub_4BBCDD();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8327 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8328 default:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8329 activeLevelDecoration = (LevelDecoration*)1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8330 ptr_F8B1E8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8331 EventProcessor(npc_event_id, 0, 1);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8332 activeLevelDecoration = NULL;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8333 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8334 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8335 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8336 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8337 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8338 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8339 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8340 }
0
Ritor1
parents:
diff changeset
8341
Ritor1
parents:
diff changeset
8342
Ritor1
parents:
diff changeset
8343
Ritor1
parents:
diff changeset
8344 //----- (004BDAAF) --------------------------------------------------------
Ritor1
parents:
diff changeset
8345 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx)
Ritor1
parents:
diff changeset
8346 {
Ritor1
parents:
diff changeset
8347 int v2; // edx@1
Ritor1
parents:
diff changeset
8348 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
8349 unsigned int v4; // eax@1
Ritor1
parents:
diff changeset
8350 signed int v5; // edi@1
Ritor1
parents:
diff changeset
8351 int v6; // edx@8
Ritor1
parents:
diff changeset
8352 int v7; // edx@9
Ritor1
parents:
diff changeset
8353 int v8; // edx@10
Ritor1
parents:
diff changeset
8354 unsigned __int8 v9; // zf@16
Ritor1
parents:
diff changeset
8355 char v10; // sf@16
Ritor1
parents:
diff changeset
8356 unsigned __int8 v11; // of@16
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8357 bool test;
0
Ritor1
parents:
diff changeset
8358
Ritor1
parents:
diff changeset
8359 auto a2 = _2da_idx;
Ritor1
parents:
diff changeset
8360 //v2 = p2DEvents_minus1___00[26 * a2];
Ritor1
parents:
diff changeset
8361 v2 = p2DEvents[a2 - 1].uType;
Ritor1
parents:
diff changeset
8362 v3 = a1->uItemID;
Ritor1
parents:
diff changeset
8363 v4 = a1->uItemID;
Ritor1
parents:
diff changeset
8364 v5 = pItemsTable->pItems[v4].uEquipType;
Ritor1
parents:
diff changeset
8365 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771)
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
8366 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen())
0
Ritor1
parents:
diff changeset
8367 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8368 switch( p2DEvents[a2 - 1].uType )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8369 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8370 case BildingType_WeaponShop:
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8371 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8372 test = v5 <= 2;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8373 break;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8374 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8375 case BildingType_ArmorShop:
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8376 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8377 test = v5 >= 3;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8378 break;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8379 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8380 case BildingType_MagicShop:
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8381 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8382 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8383 break;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8384 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8385 case BildingType_AlchemistShop:
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8386 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8387 __debugbreak(); // need to test
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8388 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8389 break;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8390 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8391 default:
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8392 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8393 test = 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8394 break;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8395 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8396 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8397
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8398 return test;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8399 /*
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8400 if ( p2DEvents[a2 - 1].uType == 1 )
0
Ritor1
parents:
diff changeset
8401 {
Ritor1
parents:
diff changeset
8402 v11 = __OFSUB__(v5, 2);
Ritor1
parents:
diff changeset
8403 v9 = v5 == 2;
Ritor1
parents:
diff changeset
8404 v10 = v5 - 2 < 0;
Ritor1
parents:
diff changeset
8405 goto LABEL_23;
Ritor1
parents:
diff changeset
8406 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8407 if ( p2DEvents[a2 - 1].uType > 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8408 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8409 if ( p2DEvents[a2 - 1].uType == 3 )
0
Ritor1
parents:
diff changeset
8410 {
Ritor1
parents:
diff changeset
8411 if ( pItemsTable->pItems[v4].uSkillType != 38 )
Ritor1
parents:
diff changeset
8412 return v5 == 16;
Ritor1
parents:
diff changeset
8413 return 1;
Ritor1
parents:
diff changeset
8414 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8415 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 )
0
Ritor1
parents:
diff changeset
8416 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8417 if ( p2DEvents[a2 - 1].uType == 4)
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8418 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8419 if ( v5 < 13 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8420 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8421 if ( v5 <= 14 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8422 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8423 if ( v5 != 17 || (signed int)v3 < 740 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8424 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8425 v11 = __OFSUB__(v3, 771);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8426 v9 = v3 == 771;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8427 v10 = ((v3 - 771) & 0x80000000u) != 0;
0
Ritor1
parents:
diff changeset
8428 LABEL_23:
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8429 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8430 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8431 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8432 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8433 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8434 if ( p2DEvents[a2 - 1].uType == 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8435 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8436 if ( v5 >= 3 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8437 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8438 v11 = __OFSUB__(v5, 9);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8439 v9 = v5 == 9;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8440 v10 = v5 - 9 < 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8441 goto LABEL_23;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8442 }
0
Ritor1
parents:
diff changeset
8443 }
Ritor1
parents:
diff changeset
8444 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8445 */
0
Ritor1
parents:
diff changeset
8446 }
Ritor1
parents:
diff changeset
8447
Ritor1
parents:
diff changeset
8448
Ritor1
parents:
diff changeset
8449
Ritor1
parents:
diff changeset
8450
Ritor1
parents:
diff changeset
8451 //----- (004B6478) --------------------------------------------------------
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8452 void sub_4B6478()
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8453 {
0
Ritor1
parents:
diff changeset
8454 GUIWindow *v0; // ebx@1
Ritor1
parents:
diff changeset
8455 Player *v1; // edi@1
Ritor1
parents:
diff changeset
8456 unsigned int v2; // eax@1
Ritor1
parents:
diff changeset
8457 signed int v3; // esi@1
Ritor1
parents:
diff changeset
8458 int v4; // ebx@1
Ritor1
parents:
diff changeset
8459 unsigned int v5; // esi@5
Ritor1
parents:
diff changeset
8460 int v6; // edi@6
Ritor1
parents:
diff changeset
8461 int result; // eax@13
Ritor1
parents:
diff changeset
8462 GUIWindow *v8; // ebx@17
Ritor1
parents:
diff changeset
8463 int v9; // eax@17
Ritor1
parents:
diff changeset
8464 int v10; // ecx@17
Ritor1
parents:
diff changeset
8465 unsigned int v11; // ecx@18
Ritor1
parents:
diff changeset
8466 int v12; // eax@20
Ritor1
parents:
diff changeset
8467 int v13; // eax@21
Ritor1
parents:
diff changeset
8468 GUIButton *v14; // esi@27
Ritor1
parents:
diff changeset
8469 int v15; // ecx@27
Ritor1
parents:
diff changeset
8470 unsigned int v16; // eax@28
Ritor1
parents:
diff changeset
8471 const char *v17; // ebx@29
Ritor1
parents:
diff changeset
8472 int v18; // eax@29
Ritor1
parents:
diff changeset
8473 unsigned int v19; // ecx@29
Ritor1
parents:
diff changeset
8474 int v20; // eax@29
Ritor1
parents:
diff changeset
8475 unsigned __int16 v21; // ax@29
Ritor1
parents:
diff changeset
8476 unsigned __int16 v22; // ST14_2@36
Ritor1
parents:
diff changeset
8477 int v23; // eax@36
Ritor1
parents:
diff changeset
8478 const char *v24; // ST18_4@37
Ritor1
parents:
diff changeset
8479 unsigned __int16 v25; // ST14_2@37
Ritor1
parents:
diff changeset
8480 int v26; // eax@37
Ritor1
parents:
diff changeset
8481 int v27; // [sp-4h] [bp-80h]@8
Ritor1
parents:
diff changeset
8482 GUIWindow v28; // [sp+Ch] [bp-70h]@1
Ritor1
parents:
diff changeset
8483 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
Ritor1
parents:
diff changeset
8484 unsigned int v30; // [sp+64h] [bp-18h]@1
Ritor1
parents:
diff changeset
8485 int v31; // [sp+68h] [bp-14h]@1
Ritor1
parents:
diff changeset
8486 int v32; // [sp+6Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
8487 int v33; // [sp+70h] [bp-Ch]@17
Ritor1
parents:
diff changeset
8488 int v34; // [sp+74h] [bp-8h]@17
Ritor1
parents:
diff changeset
8489 int v35; // [sp+78h] [bp-4h]@17
Ritor1
parents:
diff changeset
8490
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8491 v0 = window_SpeakInHouse;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8492 memcpy(&v28, window_SpeakInHouse, sizeof(v28));
0
Ritor1
parents:
diff changeset
8493 v1 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
8494 v28.uFrameX = 483;
Ritor1
parents:
diff changeset
8495 v28.uFrameWidth = 148;
Ritor1
parents:
diff changeset
8496 v28.uFrameZ = 334;
Ritor1
parents:
diff changeset
8497 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
Ritor1
parents:
diff changeset
8498 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
Ritor1
parents:
diff changeset
8499 v2 = 52 * (unsigned int)v0->ptr_1C;
Ritor1
parents:
diff changeset
8500 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
Ritor1
parents:
diff changeset
8501 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
Ritor1
parents:
diff changeset
8502 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
Ritor1
parents:
diff changeset
8503 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
Ritor1
parents:
diff changeset
8504 v4 = v3 * (100 - v1->GetMerchant()) / 100;
Ritor1
parents:
diff changeset
8505 v32 = v4;
Ritor1
parents:
diff changeset
8506 if ( v4 < v3 / 3 )
Ritor1
parents:
diff changeset
8507 {
Ritor1
parents:
diff changeset
8508 v4 = v3 / 3;
Ritor1
parents:
diff changeset
8509 v32 = v3 / 3;
Ritor1
parents:
diff changeset
8510 }
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8511 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
0
Ritor1
parents:
diff changeset
8512 {
Ritor1
parents:
diff changeset
8513 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
Ritor1
parents:
diff changeset
8514 {
Ritor1
parents:
diff changeset
8515 v5 = 0;
Ritor1
parents:
diff changeset
8516
Ritor1
parents:
diff changeset
8517 __debugbreak();
Ritor1
parents:
diff changeset
8518 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
Ritor1
parents:
diff changeset
8519 // or
Ritor1
parents:
diff changeset
8520 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
Ritor1
parents:
diff changeset
8521 // or
Ritor1
parents:
diff changeset
8522 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8523 __debugbreak(); // whacky condition - fix
0
Ritor1
parents:
diff changeset
8524 if (false
Ritor1
parents:
diff changeset
8525 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
8526 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
0
Ritor1
parents:
diff changeset
8527 {
Ritor1
parents:
diff changeset
8528 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
8529 }
Ritor1
parents:
diff changeset
8530 else
Ritor1
parents:
diff changeset
8531 {
Ritor1
parents:
diff changeset
8532 if ( pParty->uNumGold < v4 )
Ritor1
parents:
diff changeset
8533 {
Ritor1
parents:
diff changeset
8534 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
Ritor1
parents:
diff changeset
8535 v27 = 4;
Ritor1
parents:
diff changeset
8536 }
Ritor1
parents:
diff changeset
8537 else
Ritor1
parents:
diff changeset
8538 {
Ritor1
parents:
diff changeset
8539 Party::TakeGold(v4);
Ritor1
parents:
diff changeset
8540 *(short *)v6 = 1;
Ritor1
parents:
diff changeset
8541 v27 = 2;
Ritor1
parents:
diff changeset
8542 }
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
8543 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
0
Ritor1
parents:
diff changeset
8544 }
Ritor1
parents:
diff changeset
8545 }
Ritor1
parents:
diff changeset
8546 else
Ritor1
parents:
diff changeset
8547 {
Ritor1
parents:
diff changeset
8548 v5 = 0;
Ritor1
parents:
diff changeset
8549 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8550 /*result = pMessageQueue_50CBD0->uNumMessages;
0
Ritor1
parents:
diff changeset
8551 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
Ritor1
parents:
diff changeset
8552 {
Ritor1
parents:
diff changeset
8553 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
8554 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
8555 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
Ritor1
parents:
diff changeset
8556 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
Ritor1
parents:
diff changeset
8557 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8558 }*/
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8559 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8560 return; // void func
0
Ritor1
parents:
diff changeset
8561 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
8562 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
0
Ritor1
parents:
diff changeset
8563 {
Ritor1
parents:
diff changeset
8564 v24 = pNPCTopics[171].pText;
Ritor1
parents:
diff changeset
8565 v25 = v31;
Ritor1
parents:
diff changeset
8566 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
Ritor1
parents:
diff changeset
8567 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
Ritor1
parents:
diff changeset
8568 pDialogueWindow->pNumPresenceButton = 0;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8569 return ;
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8570 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8571
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8572 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8573 return;
0
Ritor1
parents:
diff changeset
8574 v8 = pDialogueWindow;
Ritor1
parents:
diff changeset
8575 v33 = 0;
Ritor1
parents:
diff changeset
8576 v34 = 0;
Ritor1
parents:
diff changeset
8577 v29 = pDialogueWindow;
Ritor1
parents:
diff changeset
8578 v9 = pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8579 v10 = v9 + pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
8580 v35 = pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8581 if ( v9 >= v10 )
Ritor1
parents:
diff changeset
8582 goto LABEL_40;
Ritor1
parents:
diff changeset
8583 do
Ritor1
parents:
diff changeset
8584 {
Ritor1
parents:
diff changeset
8585 v11 = v8->GetControl(v35)->uControlParam - 36;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8586 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
0
Ritor1
parents:
diff changeset
8587 {
Ritor1
parents:
diff changeset
8588 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
Ritor1
parents:
diff changeset
8589 v33 += v12;
Ritor1
parents:
diff changeset
8590 ++v34;
Ritor1
parents:
diff changeset
8591 }
Ritor1
parents:
diff changeset
8592 v13 = v8->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8593 ++v35;
Ritor1
parents:
diff changeset
8594 }
Ritor1
parents:
diff changeset
8595 while ( v35 < v8->pNumPresenceButton + v13 );
Ritor1
parents:
diff changeset
8596 if ( !v34 )
Ritor1
parents:
diff changeset
8597 {
Ritor1
parents:
diff changeset
8598 LABEL_40:
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8599 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
0
Ritor1
parents:
diff changeset
8600 strcat(pTmpBuf, "\n \n");
Ritor1
parents:
diff changeset
8601 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
Ritor1
parents:
diff changeset
8602 v22 = v31;
Ritor1
parents:
diff changeset
8603 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8604 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8605 return;
0
Ritor1
parents:
diff changeset
8606 }
Ritor1
parents:
diff changeset
8607 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
Ritor1
parents:
diff changeset
8608 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
8609 v32 = (149 - v33) / v34;
Ritor1
parents:
diff changeset
8610 if ( (149 - v33) / v34 > 32 )
Ritor1
parents:
diff changeset
8611 v32 = 32;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8612
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8613 v35 = v8->pStartingPosActiveItem;
0
Ritor1
parents:
diff changeset
8614 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8615 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
0
Ritor1
parents:
diff changeset
8616 {
Ritor1
parents:
diff changeset
8617 v33 = 2;
Ritor1
parents:
diff changeset
8618 do
Ritor1
parents:
diff changeset
8619 {
Ritor1
parents:
diff changeset
8620 v14 = v8->GetControl(v35);
Ritor1
parents:
diff changeset
8621 v15 = v14->uControlParam - 36;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8622 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
0
Ritor1
parents:
diff changeset
8623 {
Ritor1
parents:
diff changeset
8624 v16 = 0;
Ritor1
parents:
diff changeset
8625 if ( !v1->pActiveSkills[v15] )
Ritor1
parents:
diff changeset
8626 {
Ritor1
parents:
diff changeset
8627 v17 = pSkillNames[v15];
Ritor1
parents:
diff changeset
8628 v14->uY = v32 + v34;
Ritor1
parents:
diff changeset
8629 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
Ritor1
parents:
diff changeset
8630 v19 = v14->uY;
Ritor1
parents:
diff changeset
8631 v14->uHeight = v18;
Ritor1
parents:
diff changeset
8632 v20 = v19 + v18 - 1;
Ritor1
parents:
diff changeset
8633 v14->uW = v20;
Ritor1
parents:
diff changeset
8634 v34 = v20;
Ritor1
parents:
diff changeset
8635 v21 = v31;
Ritor1
parents:
diff changeset
8636 if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
Ritor1
parents:
diff changeset
8637 v21 = v30;
Ritor1
parents:
diff changeset
8638 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
Ritor1
parents:
diff changeset
8639 goto LABEL_34;
Ritor1
parents:
diff changeset
8640 }
Ritor1
parents:
diff changeset
8641 }
Ritor1
parents:
diff changeset
8642 else
Ritor1
parents:
diff changeset
8643 {
Ritor1
parents:
diff changeset
8644 v16 = 0;
Ritor1
parents:
diff changeset
8645 }
Ritor1
parents:
diff changeset
8646 v14->uW = v16;
Ritor1
parents:
diff changeset
8647 v14->uHeight = v16;
Ritor1
parents:
diff changeset
8648 v14->uY = v16;
Ritor1
parents:
diff changeset
8649 LABEL_34:
Ritor1
parents:
diff changeset
8650 v8 = v29;
Ritor1
parents:
diff changeset
8651 ++v35;
Ritor1
parents:
diff changeset
8652 ++v33;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8653 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8654 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8655 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8656 return;
0
Ritor1
parents:
diff changeset
8657 }
Ritor1
parents:
diff changeset
8658
Ritor1
parents:
diff changeset
8659
Ritor1
parents:
diff changeset
8660
Ritor1
parents:
diff changeset
8661 //----- (004B6943) --------------------------------------------------------
Ritor1
parents:
diff changeset
8662 void __cdecl TravelByTransport()
Ritor1
parents:
diff changeset
8663 {
Ritor1
parents:
diff changeset
8664 GUIWindow *v0; // ebx@1
Ritor1
parents:
diff changeset
8665 Player *v1; // esi@1
Ritor1
parents:
diff changeset
8666 signed int v2; // edi@1
Ritor1
parents:
diff changeset
8667 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
8668 signed int v4; // ebx@1
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8669 stru365_travel_info *v5; // esi@7
0
Ritor1
parents:
diff changeset
8670 int v6; // eax@9
Ritor1
parents:
diff changeset
8671 int v7; // eax@9
Ritor1
parents:
diff changeset
8672 int v8; // eax@12
Ritor1
parents:
diff changeset
8673 int v9; // edi@12
Ritor1
parents:
diff changeset
8674 int v10; // edx@12
Ritor1
parents:
diff changeset
8675 int v11; // ecx@12
Ritor1
parents:
diff changeset
8676 signed int v12; // esi@13
Ritor1
parents:
diff changeset
8677 signed int v13; // edi@14
Ritor1
parents:
diff changeset
8678 DWORD v14; // eax@26
Ritor1
parents:
diff changeset
8679 DWORD v15; // edi@26
Ritor1
parents:
diff changeset
8680 GUIWindow *v16; // ebx@36
Ritor1
parents:
diff changeset
8681 int v17; // esi@36
Ritor1
parents:
diff changeset
8682 int v18; // eax@36
Ritor1
parents:
diff changeset
8683 int v19; // ecx@36
Ritor1
parents:
diff changeset
8684 int v20; // esi@36
Ritor1
parents:
diff changeset
8685 int v21; // eax@36
Ritor1
parents:
diff changeset
8686 void *v22; // eax@39
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8687 int v23; // esi@39
0
Ritor1
parents:
diff changeset
8688 GUIButton *v24; // ebx@39
Ritor1
parents:
diff changeset
8689 signed int v25; // eax@41
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8690 //int v26; // esi@44
0
Ritor1
parents:
diff changeset
8691 const char *v27; // eax@46
Ritor1
parents:
diff changeset
8692 char *v28; // eax@62
Ritor1
parents:
diff changeset
8693 int v29; // eax@62
Ritor1
parents:
diff changeset
8694 unsigned int v30; // ecx@62
Ritor1
parents:
diff changeset
8695 char *v31; // eax@63
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8696 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8697 /*int v33; // [sp-38h] [bp-2C8h]@62
0
Ritor1
parents:
diff changeset
8698 int v34; // [sp-34h] [bp-2C4h]@62
Ritor1
parents:
diff changeset
8699 int v35; // [sp-30h] [bp-2C0h]@62
Ritor1
parents:
diff changeset
8700 int v36; // [sp-2Ch] [bp-2BCh]@62
Ritor1
parents:
diff changeset
8701 int v37; // [sp-28h] [bp-2B8h]@62
Ritor1
parents:
diff changeset
8702 int v38; // [sp-24h] [bp-2B4h]@62
Ritor1
parents:
diff changeset
8703 int v39; // [sp-20h] [bp-2B0h]@62
Ritor1
parents:
diff changeset
8704 int v40; // [sp-1Ch] [bp-2ACh]@62
Ritor1
parents:
diff changeset
8705 int v41; // [sp-18h] [bp-2A8h]@62
Ritor1
parents:
diff changeset
8706 int v42; // [sp-14h] [bp-2A4h]@62
Ritor1
parents:
diff changeset
8707 char *v43; // [sp-10h] [bp-2A0h]@62
Ritor1
parents:
diff changeset
8708 char *v44; // [sp-Ch] [bp-29Ch]@62
Ritor1
parents:
diff changeset
8709 unsigned int v45; // [sp-8h] [bp-298h]@62
Ritor1
parents:
diff changeset
8710 char *v46; // [sp-4h] [bp-294h]@62
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8711 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8712 char v48[100]; // [sp+14h] [bp-27Ch]@37
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8713 char v49[100]; // [sp+78h] [bp-218h]@68
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8714 char v50[100]; // [sp+DCh] [bp-1B4h]@68
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8715 char v51[100]; // [sp+140h] [bp-150h]@68
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8716 char Dest[100]; // [sp+1A4h] [bp-ECh]@36
0
Ritor1
parents:
diff changeset
8717 GUIWindow v53; // [sp+208h] [bp-88h]@1
Ritor1
parents:
diff changeset
8718 int v54; // [sp+25Ch] [bp-34h]@36
Ritor1
parents:
diff changeset
8719 int v55; // [sp+260h] [bp-30h]@36
Ritor1
parents:
diff changeset
8720 unsigned int v56; // [sp+264h] [bp-2Ch]@1
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8721 int v57; // [sp+268h] [bp-28h]@1
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8722 int v58; // [sp+26Ch] [bp-24h]@36
0
Ritor1
parents:
diff changeset
8723 GUIWindow *v59; // [sp+270h] [bp-20h]@1
Ritor1
parents:
diff changeset
8724 unsigned int v60; // [sp+274h] [bp-1Ch]@36
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8725 //Player *v61; // [sp+278h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
8726 int v62; // [sp+27Ch] [bp-14h]@36
Ritor1
parents:
diff changeset
8727 int v63; // [sp+280h] [bp-10h]@14
Ritor1
parents:
diff changeset
8728 char *a1; // [sp+284h] [bp-Ch]@37
Ritor1
parents:
diff changeset
8729 unsigned int s1; // [sp+288h] [bp-8h]@1
Ritor1
parents:
diff changeset
8730 int v66; // [sp+28Ch] [bp-4h]@48
Ritor1
parents:
diff changeset
8731
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8732 v0 = window_SpeakInHouse;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8733 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
0
Ritor1
parents:
diff changeset
8734 v2 = 255;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8735 //v61 = pPlayers[uActiveCharacter];
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8736 v1 = pPlayers[uActiveCharacter];
0
Ritor1
parents:
diff changeset
8737 v53.uFrameX = 483;
Ritor1
parents:
diff changeset
8738 v53.uFrameWidth = 148;
Ritor1
parents:
diff changeset
8739 v53.uFrameZ = 334;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8740 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
0
Ritor1
parents:
diff changeset
8741 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
Ritor1
parents:
diff changeset
8742 v3 = 52 * (unsigned int)v0->ptr_1C;
Ritor1
parents:
diff changeset
8743 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
Ritor1
parents:
diff changeset
8744 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50);
Ritor1
parents:
diff changeset
8745 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
Ritor1
parents:
diff changeset
8746 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
Ritor1
parents:
diff changeset
8747 s1 = v4 * (100 - v1->GetMerchant()) / 100;
Ritor1
parents:
diff changeset
8748 if ( (signed int)s1 < v4 / 3 )
Ritor1
parents:
diff changeset
8749 s1 = v4 / 3;
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8750 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
0
Ritor1
parents:
diff changeset
8751 {
Ritor1
parents:
diff changeset
8752 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
Ritor1
parents:
diff changeset
8753 {
Ritor1
parents:
diff changeset
8754 v16 = pDialogueWindow;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8755 v58 = -1;
0
Ritor1
parents:
diff changeset
8756 v62 = 0;
Ritor1
parents:
diff changeset
8757 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
Ritor1
parents:
diff changeset
8758 v59 = pDialogueWindow;
Ritor1
parents:
diff changeset
8759 v54 = v17;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8760 strcpy(Dest, "");
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8761 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
0
Ritor1
parents:
diff changeset
8762 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
Ritor1
parents:
diff changeset
8763 v19 = v16->pNumPresenceButton;
Ritor1
parents:
diff changeset
8764 v20 = v18 + v17 + 146;
Ritor1
parents:
diff changeset
8765 v21 = v16->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8766 v63 = v20;
Ritor1
parents:
diff changeset
8767 v55 = v20;
Ritor1
parents:
diff changeset
8768 v60 = v21;
Ritor1
parents:
diff changeset
8769 if ( v21 >= v21 + v19 )
Ritor1
parents:
diff changeset
8770 goto LABEL_71;
Ritor1
parents:
diff changeset
8771 s1 = 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8772 a1 = v48;
0
Ritor1
parents:
diff changeset
8773 while ( 1 )
Ritor1
parents:
diff changeset
8774 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8775 int v47 = v60;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8776 v22 = window_SpeakInHouse->ptr_1C;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8777 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8778 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8779 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
0
Ritor1
parents:
diff changeset
8780 v24 = v16->GetControl(v60);
Ritor1
parents:
diff changeset
8781 if ( v23 != v58
785
Ritor1
parents: 768
diff changeset
8782 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = travel_schedule[v23].pSchedule[pParty->uDaysPlayed % 7]),
0
Ritor1
parents:
diff changeset
8783 v25
785
Ritor1
parents: 768
diff changeset
8784 && (travel_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, travel_schedule[v23].uQuestBit))) )
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8785 {
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8786 v58 = v23;
0
Ritor1
parents:
diff changeset
8787 v27 = (const char *)v56;
Ritor1
parents:
diff changeset
8788 if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8789 v27 = (const char *)v57;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8790 //v32.uRedbookTrackID = v27;
690
26dfde53decd ui fixing
Gloval
parents: 676
diff changeset
8791 sprintf(a1, "\f%05d", v27);
785
Ritor1
parents: 768
diff changeset
8792 v66 = travel_schedule[v23].uTravelTime;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8793 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
0
Ritor1
parents:
diff changeset
8794 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8795 if ( CheckHiredNPCSpeciality(Sailor) )
0
Ritor1
parents:
diff changeset
8796 v66 -= 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8797 if ( CheckHiredNPCSpeciality(Navigator) )
0
Ritor1
parents:
diff changeset
8798 v66 -= 3;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8799 //v47 = Pirate;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8800 if ( CheckHiredNPCSpeciality(Pirate) )
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8801 v66 -= 2;
0
Ritor1
parents:
diff changeset
8802 }
Ritor1
parents:
diff changeset
8803 else
Ritor1
parents:
diff changeset
8804 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8805 //v47 = Horseman;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8806 if ( CheckHiredNPCSpeciality(Horseman) )
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8807 v66 -= 2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8808 }
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8809 if ( CheckHiredNPCSpeciality(Explorer) )
0
Ritor1
parents:
diff changeset
8810 --v66;
Ritor1
parents:
diff changeset
8811 if ( v66 < 1 )
Ritor1
parents:
diff changeset
8812 v66 = 1;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8813 if ( v23 != v2 )
0
Ritor1
parents:
diff changeset
8814 {
785
Ritor1
parents: 768
diff changeset
8815 memcpy(&v32, &pMapStats->pInfos[travel_schedule[v23].uMapInfoID], 0x44u);
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8816 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8817 v66, v32.pName);
0
Ritor1
parents:
diff changeset
8818 strcat(a1, pTmpBuf);
Ritor1
parents:
diff changeset
8819 v28 = a1;
Ritor1
parents:
diff changeset
8820 a1 += 100;
Ritor1
parents:
diff changeset
8821 ++v62;
Ritor1
parents:
diff changeset
8822 ++s1;
Ritor1
parents:
diff changeset
8823 strcat(v28, "\n \n");
Ritor1
parents:
diff changeset
8824 v24->uY = v63;
Ritor1
parents:
diff changeset
8825 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
Ritor1
parents:
diff changeset
8826 v30 = v24->uY;
Ritor1
parents:
diff changeset
8827 v24->uHeight = v29;
Ritor1
parents:
diff changeset
8828 v2 = 255;
Ritor1
parents:
diff changeset
8829 v24->uW = v30 + v29 - 1;
Ritor1
parents:
diff changeset
8830 v63 += v54 + v29;
Ritor1
parents:
diff changeset
8831 }
Ritor1
parents:
diff changeset
8832 }
Ritor1
parents:
diff changeset
8833 else
Ritor1
parents:
diff changeset
8834 {
Ritor1
parents:
diff changeset
8835 v31 = a1;
Ritor1
parents:
diff changeset
8836 ++v62;
Ritor1
parents:
diff changeset
8837 ++s1;
Ritor1
parents:
diff changeset
8838 a1 += 100;
Ritor1
parents:
diff changeset
8839 strcpy(v31, "");
Ritor1
parents:
diff changeset
8840 if ( v24 )
Ritor1
parents:
diff changeset
8841 {
Ritor1
parents:
diff changeset
8842 v24->uW = 0;
Ritor1
parents:
diff changeset
8843 v24->uHeight = 0;
Ritor1
parents:
diff changeset
8844 v24->uY = 0;
Ritor1
parents:
diff changeset
8845 }
Ritor1
parents:
diff changeset
8846 }
Ritor1
parents:
diff changeset
8847 ++v60;
Ritor1
parents:
diff changeset
8848 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem )
Ritor1
parents:
diff changeset
8849 break;
Ritor1
parents:
diff changeset
8850 v16 = v59;
Ritor1
parents:
diff changeset
8851 }
Ritor1
parents:
diff changeset
8852 if ( v63 != v55 )
Ritor1
parents:
diff changeset
8853 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8854 /*v47[1] = &Dest;
0
Ritor1
parents:
diff changeset
8855 v47[0] = &v51;
Ritor1
parents:
diff changeset
8856 v46 = &v50;
Ritor1
parents:
diff changeset
8857 v45 = (unsigned int)&v49;
Ritor1
parents:
diff changeset
8858 v44 = &v48;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8859 v43 = pTmpBuf2;*/
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8860 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest);
0
Ritor1
parents:
diff changeset
8861 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
8862 }
Ritor1
parents:
diff changeset
8863 else
Ritor1
parents:
diff changeset
8864 {
Ritor1
parents:
diff changeset
8865 LABEL_71:
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8866 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8867 v57, pGlobalTXT_LocalizationStrings[561], 3);
0
Ritor1
parents:
diff changeset
8868 pAudioPlayer->StopChannels(-1, -1);
Ritor1
parents:
diff changeset
8869 }
Ritor1
parents:
diff changeset
8870 }
Ritor1
parents:
diff changeset
8871 }
Ritor1
parents:
diff changeset
8872 else
Ritor1
parents:
diff changeset
8873 {
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8874 if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 )
0
Ritor1
parents:
diff changeset
8875 {
Ritor1
parents:
diff changeset
8876 if ( pParty->uNumGold < s1 )
Ritor1
parents:
diff changeset
8877 {
Ritor1
parents:
diff changeset
8878 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
8879 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8880 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
0
Ritor1
parents:
diff changeset
8881 return;
Ritor1
parents:
diff changeset
8882 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
8883 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8884 goto LABEL_33;*/
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8885 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0
Ritor1
parents:
diff changeset
8886 }
Ritor1
parents:
diff changeset
8887 Party::TakeGold(s1);
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8888 //v47[1] = (const char *)7;
785
Ritor1
parents: 768
diff changeset
8889 v5 = &travel_schedule[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]];
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8890 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8891 {
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8892 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
0
Ritor1
parents:
diff changeset
8893 {
Ritor1
parents:
diff changeset
8894 SaveGame(1, 0);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8895 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8896 v8 = v5->field_18;
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8897 v9 = v5->field_14;
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8898 v10 = v5->field_10;
0
Ritor1
parents:
diff changeset
8899 dword_6BE364_game_settings_1 |= 1u;
Ritor1
parents:
diff changeset
8900 _5B65B8_npcdata_hiword_house_or_other = 0;
Ritor1
parents:
diff changeset
8901 dword_5B65BC = 0;
Ritor1
parents:
diff changeset
8902 _5B65B4_npcdata_loword_house_or_other = v8;
Ritor1
parents:
diff changeset
8903 v11 = *((int *)v5 + 3);
Ritor1
parents:
diff changeset
8904 uGameState = 2;
Ritor1
parents:
diff changeset
8905 _5B65A8_npcdata_uflags_or_other = v11;
Ritor1
parents:
diff changeset
8906 _5B65AC_npcdata_fame_or_other = v10;
Ritor1
parents:
diff changeset
8907 _5B65B0_npcdata_rep_or_other = v9;
Ritor1
parents:
diff changeset
8908 dword_5B65C0 = v11 | v10 | v9 | v8;
Ritor1
parents:
diff changeset
8909 }
Ritor1
parents:
diff changeset
8910 else
Ritor1
parents:
diff changeset
8911 {
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8912 v6 = v5->field_C;
0
Ritor1
parents:
diff changeset
8913 pParty->sRotationX = 0;
Ritor1
parents:
diff changeset
8914 pParty->vPosition.x = v6;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8915 v7 = v5->field_10;
0
Ritor1
parents:
diff changeset
8916 pIndoorCamera->sRotationY = 0;
Ritor1
parents:
diff changeset
8917 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
8918 pParty->vPosition.y = v7;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8919 pParty->vPosition.z = v5->field_14;
0
Ritor1
parents:
diff changeset
8920 pParty->uFallStartY = pParty->vPosition.z;
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8921 pParty->sRotationY = v5->field_18;
0
Ritor1
parents:
diff changeset
8922 }
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
8923 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8924 v12 = v5->uTravelTime;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8925 int _v47;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8926 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
0
Ritor1
parents:
diff changeset
8927 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8928 v63 = SPEECH_SetSail;
0
Ritor1
parents:
diff changeset
8929 v13 = 2500;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8930 if ( CheckHiredNPCSpeciality(Sailor) )
0
Ritor1
parents:
diff changeset
8931 v12 -= 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8932 if ( CheckHiredNPCSpeciality(Navigator) )
0
Ritor1
parents:
diff changeset
8933 v12 -= 3;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8934 //_v47 = 45;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8935 if ( CheckHiredNPCSpeciality(Pirate) )
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8936 v12 -= 2;
0
Ritor1
parents:
diff changeset
8937 }
Ritor1
parents:
diff changeset
8938 else
Ritor1
parents:
diff changeset
8939 {
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8940 v63 = SPEECH_CarriageReady;
0
Ritor1
parents:
diff changeset
8941 v13 = 1500;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8942 //_v47 = 35;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8943 if ( CheckHiredNPCSpeciality(Horseman) )
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8944 v12 -= 2;
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8945 }
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
8946 if ( CheckHiredNPCSpeciality(Explorer) )
0
Ritor1
parents:
diff changeset
8947 --v12;
Ritor1
parents:
diff changeset
8948 if ( v12 < 1 )
Ritor1
parents:
diff changeset
8949 v12 = 1;
Ritor1
parents:
diff changeset
8950 RestAndHeal(1440 * v12);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
8951 v1->PlaySound((PlayerSpeech)v63, 0);
0
Ritor1
parents:
diff changeset
8952 v14 = GetTickCount();
Ritor1
parents:
diff changeset
8953 v15 = v14 + v13;
Ritor1
parents:
diff changeset
8954 if ( v15 < v14 )
Ritor1
parents:
diff changeset
8955 v15 = v14;
Ritor1
parents:
diff changeset
8956 while ( GetTickCount() < v15 )
Ritor1
parents:
diff changeset
8957 sqrt(3.1415926);
Ritor1
parents:
diff changeset
8958 while ( sub_4BD8B5() )
Ritor1
parents:
diff changeset
8959 ;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8960 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8961 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
8962 {
Ritor1
parents:
diff changeset
8963 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
Ritor1
parents:
diff changeset
8964 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
Ritor1
parents:
diff changeset
8965 LABEL_33:
Ritor1
parents:
diff changeset
8966 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
8967 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
8968 return;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8969 }*/
0
Ritor1
parents:
diff changeset
8970 }
Ritor1
parents:
diff changeset
8971 else
Ritor1
parents:
diff changeset
8972 {
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
8973 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
0
Ritor1
parents:
diff changeset
8974 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
8975 }
Ritor1
parents:
diff changeset
8976 }
Ritor1
parents:
diff changeset
8977 }
Ritor1
parents:
diff changeset
8978 }
Ritor1
parents:
diff changeset
8979
Ritor1
parents:
diff changeset
8980
Ritor1
parents:
diff changeset
8981
Ritor1
parents:
diff changeset
8982
Ritor1
parents:
diff changeset
8983
Ritor1
parents:
diff changeset
8984 //----- (00405CFF) --------------------------------------------------------
Ritor1
parents:
diff changeset
8985 void stru262_TurnBased::End(bool bPlaySound)
Ritor1
parents:
diff changeset
8986 {
Ritor1
parents:
diff changeset
8987 stru262_TurnBased *v2; // edi@1
Ritor1
parents:
diff changeset
8988 int v3; // ebx@1
Ritor1
parents:
diff changeset
8989 int v4; // esi@1
Ritor1
parents:
diff changeset
8990 unsigned __int8 v5; // zf@1
Ritor1
parents:
diff changeset
8991 unsigned __int8 v6; // sf@1
Ritor1
parents:
diff changeset
8992 TurnBased_QueueElem *v7; // ecx@2
Ritor1
parents:
diff changeset
8993 unsigned __int16 *pAttributes; // ecx@7
Ritor1
parents:
diff changeset
8994 size_t v9; // edx@7
Ritor1
parents:
diff changeset
8995 unsigned __int16 v10; // ax@8
Ritor1
parents:
diff changeset
8996 TurnBased_QueueElem *v11; // ebx@12
Ritor1
parents:
diff changeset
8997 ObjectType objType; // eax@13
Ritor1
parents:
diff changeset
8998 int objID; // esi@13
Ritor1
parents:
diff changeset
8999 int v14; // [sp+Ch] [bp-4h]@11
Ritor1
parents:
diff changeset
9000
Ritor1
parents:
diff changeset
9001 v2 = this;
Ritor1
parents:
diff changeset
9002 v3 = 0;
Ritor1
parents:
diff changeset
9003 v4 = 0;
Ritor1
parents:
diff changeset
9004 v5 = this->uActorQueueSize == 0;
Ritor1
parents:
diff changeset
9005 v6 = this->uActorQueueSize < 0;
Ritor1
parents:
diff changeset
9006 this->field_4 = 0;
Ritor1
parents:
diff changeset
9007 if ( !(v6 | v5) )
Ritor1
parents:
diff changeset
9008 {
Ritor1
parents:
diff changeset
9009 v7 = this->pQueue;
Ritor1
parents:
diff changeset
9010 do
Ritor1
parents:
diff changeset
9011 {
Ritor1
parents:
diff changeset
9012 if ( (v7->uPackedID & 7) == OBJECT_Actor )
Ritor1
parents:
diff changeset
9013 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu;
Ritor1
parents:
diff changeset
9014 ++v4;
Ritor1
parents:
diff changeset
9015 ++v7;
Ritor1
parents:
diff changeset
9016 }
Ritor1
parents:
diff changeset
9017 while ( v4 < v2->uActorQueueSize );
Ritor1
parents:
diff changeset
9018 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
9019 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
9020 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
9021 pAttributes = &pSpriteObjects[0].uAttributes;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
9022 v9 = uNumSpriteObjects;
0
Ritor1
parents:
diff changeset
9023 do
Ritor1
parents:
diff changeset
9024 {
Ritor1
parents:
diff changeset
9025 v10 = *pAttributes;
Ritor1
parents:
diff changeset
9026 if ( *pAttributes & 4 )
Ritor1
parents:
diff changeset
9027 {
Ritor1
parents:
diff changeset
9028 LOBYTE(v10) = v10 & 0xFB;
Ritor1
parents:
diff changeset
9029 *pAttributes = v10;
Ritor1
parents:
diff changeset
9030 }
Ritor1
parents:
diff changeset
9031 pAttributes += 56;
Ritor1
parents:
diff changeset
9032 --v9;
Ritor1
parents:
diff changeset
9033 }
Ritor1
parents:
diff changeset
9034 while ( v9 );
Ritor1
parents:
diff changeset
9035 }
Ritor1
parents:
diff changeset
9036 v14 = 0;
Ritor1
parents:
diff changeset
9037 if ( v2->uActorQueueSize > 0 )
Ritor1
parents:
diff changeset
9038 {
Ritor1
parents:
diff changeset
9039 v11 = v2->pQueue;
Ritor1
parents:
diff changeset
9040 do
Ritor1
parents:
diff changeset
9041 {
Ritor1
parents:
diff changeset
9042 objType = (ObjectType)(v11->uPackedID & 7);
Ritor1
parents:
diff changeset
9043 objID = v11->uPackedID >> 3;
Ritor1
parents:
diff changeset
9044 if ( objType == OBJECT_Player )
Ritor1
parents:
diff changeset
9045 {
Ritor1
parents:
diff changeset
9046 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333);
Ritor1
parents:
diff changeset
9047 }
Ritor1
parents:
diff changeset
9048 else
Ritor1
parents:
diff changeset
9049 {
Ritor1
parents:
diff changeset
9050 if ( objType == OBJECT_Actor )
Ritor1
parents:
diff changeset
9051 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333);
Ritor1
parents:
diff changeset
9052 }
Ritor1
parents:
diff changeset
9053 ++v14;
Ritor1
parents:
diff changeset
9054 ++v11;
Ritor1
parents:
diff changeset
9055 }
Ritor1
parents:
diff changeset
9056 while ( v14 < v2->uActorQueueSize );
Ritor1
parents:
diff changeset
9057 v3 = 0;
Ritor1
parents:
diff changeset
9058 }
Ritor1
parents:
diff changeset
9059 pAudioPlayer->StopChannels(-1, -1);
Ritor1
parents:
diff changeset
9060 if ( bPlaySound != v3 )
Ritor1
parents:
diff changeset
9061 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3);
Ritor1
parents:
diff changeset
9062 pTurnEngine->field_18 &= 0xFFFFFFFDu;
Ritor1
parents:
diff changeset
9063 pEventTimer->StopGameTime();
Ritor1
parents:
diff changeset
9064 dword_50C994 = v3;
Ritor1
parents:
diff changeset
9065 dword_50C998_turnbased_icon_1A = v3;
Ritor1
parents:
diff changeset
9066 }
Ritor1
parents:
diff changeset
9067 // 50C994: using guessed type int dword_50C994;
Ritor1
parents:
diff changeset
9068 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
Ritor1
parents:
diff changeset
9069
Ritor1
parents:
diff changeset
9070 //----- (00405E14) --------------------------------------------------------
Ritor1
parents:
diff changeset
9071 void stru262_TurnBased::_405E14()
Ritor1
parents:
diff changeset
9072 {
Ritor1
parents:
diff changeset
9073 stru262_TurnBased *v1; // esi@1
Ritor1
parents:
diff changeset
9074 int v2; // ecx@1
Ritor1
parents:
diff changeset
9075 SpellBuff *v3; // edi@2
Ritor1
parents:
diff changeset
9076 Actor *v4; // ebx@3
Ritor1
parents:
diff changeset
9077 signed int v5; // edx@20
Ritor1
parents:
diff changeset
9078 AIDirection *v6; // esi@21
Ritor1
parents:
diff changeset
9079 int v7; // eax@21
Ritor1
parents:
diff changeset
9080 int v8; // eax@21
Ritor1
parents:
diff changeset
9081 int v9; // eax@22
Ritor1
parents:
diff changeset
9082 int v10; // eax@23
Ritor1
parents:
diff changeset
9083 int v11; // eax@37
Ritor1
parents:
diff changeset
9084 int v12; // eax@44
Ritor1
parents:
diff changeset
9085 AIDirection a3; // [sp+4h] [bp-68h]@21
Ritor1
parents:
diff changeset
9086 AIDirection v14; // [sp+20h] [bp-4Ch]@21
Ritor1
parents:
diff changeset
9087 AIDirection v15; // [sp+3Ch] [bp-30h]@21
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9088 Actor *v16; // [sp+58h] [bp-14h]@2
0
Ritor1
parents:
diff changeset
9089 int v17; // [sp+5Ch] [bp-10h]@6
Ritor1
parents:
diff changeset
9090 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1
Ritor1
parents:
diff changeset
9091 int v19; // [sp+64h] [bp-8h]@8
Ritor1
parents:
diff changeset
9092 unsigned int v20; // [sp+68h] [bp-4h]@1
Ritor1
parents:
diff changeset
9093
Ritor1
parents:
diff changeset
9094 v1 = this;
Ritor1
parents:
diff changeset
9095 v2 = 0;
Ritor1
parents:
diff changeset
9096 v18 = v1;
Ritor1
parents:
diff changeset
9097 v20 = 0;
Ritor1
parents:
diff changeset
9098 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
9099 {
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9100 //v3 = pActors;//[0].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9101 v16 = pActors;//[0].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9102 v3 = v16->pActorBuffs;
0
Ritor1
parents:
diff changeset
9103 do
Ritor1
parents:
diff changeset
9104 {
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9105 v4 = v16;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9106 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 )
0
Ritor1
parents:
diff changeset
9107 v17 = v2;
Ritor1
parents:
diff changeset
9108 else
Ritor1
parents:
diff changeset
9109 v17 = 1;
Ritor1
parents:
diff changeset
9110 v19 = v2;
Ritor1
parents:
diff changeset
9111 do
Ritor1
parents:
diff changeset
9112 {
Ritor1
parents:
diff changeset
9113 if ( v19 != 10 )
Ritor1
parents:
diff changeset
9114 {
Ritor1
parents:
diff changeset
9115 v3->_4585CA(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
9116 v2 = 0;
Ritor1
parents:
diff changeset
9117 }
Ritor1
parents:
diff changeset
9118 ++v19;
Ritor1
parents:
diff changeset
9119 ++v3;
Ritor1
parents:
diff changeset
9120 }
Ritor1
parents:
diff changeset
9121 while ( v19 < 22 );
Ritor1
parents:
diff changeset
9122 if ( v17 != v2
Ritor1
parents:
diff changeset
9123 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2
Ritor1
parents:
diff changeset
9124 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) )
Ritor1
parents:
diff changeset
9125 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight;
Ritor1
parents:
diff changeset
9126 if ( !(v4->uAttributes & 0x80) )
Ritor1
parents:
diff changeset
9127 {
Ritor1
parents:
diff changeset
9128 if ( !v4->pActorBuffs[5].uExpireTime )
Ritor1
parents:
diff changeset
9129 {
Ritor1
parents:
diff changeset
9130 if ( !v4->pActorBuffs[6].uExpireTime )
Ritor1
parents:
diff changeset
9131 {
Ritor1
parents:
diff changeset
9132 v5 = v4->uCurrentActionLength;
Ritor1
parents:
diff changeset
9133 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed;
Ritor1
parents:
diff changeset
9134 if ( (signed int)v4->uCurrentActionTime >= v5 )
Ritor1
parents:
diff changeset
9135 {
417
55684f4eda73 Actor::SelectTarget & ai_near_actors_targets_pid
Nomad
parents: 414
diff changeset
9136 v17 = ai_near_actors_targets_pid[v20];
55684f4eda73 Actor::SelectTarget & ai_near_actors_targets_pid
Nomad
parents: 414
diff changeset
9137 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2);
0
Ritor1
parents:
diff changeset
9138 v7 = v4->uAIState;
Ritor1
parents:
diff changeset
9139 memcpy(&v15, v6, sizeof(v15));
Ritor1
parents:
diff changeset
9140 v8 = v7 - 4;
Ritor1
parents:
diff changeset
9141 memcpy(&v14, &v15, sizeof(v14));
Ritor1
parents:
diff changeset
9142 if ( v8 )
Ritor1
parents:
diff changeset
9143 {
Ritor1
parents:
diff changeset
9144 v9 = v8 - 1;
Ritor1
parents:
diff changeset
9145 if ( v9 )
Ritor1
parents:
diff changeset
9146 {
Ritor1
parents:
diff changeset
9147 v10 = v9 - 6;
Ritor1
parents:
diff changeset
9148 if ( v10 )
Ritor1
parents:
diff changeset
9149 {
Ritor1
parents:
diff changeset
9150 if ( v10 != 8 )
414
d8b3056df4e2 AI_Bored
Nomad
parents: 410
diff changeset
9151 Actor::AI_StandOrBored(v20, v17, 32, &v14);
0
Ritor1
parents:
diff changeset
9152 }
Ritor1
parents:
diff changeset
9153 }
Ritor1
parents:
diff changeset
9154 }
Ritor1
parents:
diff changeset
9155 else
Ritor1
parents:
diff changeset
9156 {
Ritor1
parents:
diff changeset
9157 v4->uCurrentActionTime = 0;
Ritor1
parents:
diff changeset
9158 v4->uCurrentActionLength = 0;
Ritor1
parents:
diff changeset
9159 v4->uAIState = Dead;
Ritor1
parents:
diff changeset
9160 v4->UpdateAnimation();
Ritor1
parents:
diff changeset
9161 }
Ritor1
parents:
diff changeset
9162 v1 = v18;
Ritor1
parents:
diff changeset
9163 v2 = 0;
Ritor1
parents:
diff changeset
9164 }
Ritor1
parents:
diff changeset
9165 }
Ritor1
parents:
diff changeset
9166 }
Ritor1
parents:
diff changeset
9167 }
Ritor1
parents:
diff changeset
9168 ++v20;
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9169 v3 = v16[1].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
9170 ++v16;
0
Ritor1
parents:
diff changeset
9171 }
Ritor1
parents:
diff changeset
9172 while ( (signed int)v20 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
9173 }
Ritor1
parents:
diff changeset
9174 if ( v1->field_4 == 1 )
Ritor1
parents:
diff changeset
9175 {
Ritor1
parents:
diff changeset
9176 v12 = v1->field_8;
Ritor1
parents:
diff changeset
9177 if ( v12 == 64 )
Ritor1
parents:
diff changeset
9178 {
Ritor1
parents:
diff changeset
9179 v1->_406A63();
Ritor1
parents:
diff changeset
9180 }
Ritor1
parents:
diff changeset
9181 else
Ritor1
parents:
diff changeset
9182 {
Ritor1
parents:
diff changeset
9183 if ( v12 > v2 )
Ritor1
parents:
diff changeset
9184 {
Ritor1
parents:
diff changeset
9185 v1->_406B9F();
Ritor1
parents:
diff changeset
9186 }
Ritor1
parents:
diff changeset
9187 else
Ritor1
parents:
diff changeset
9188 {
Ritor1
parents:
diff changeset
9189 v1->_406AFE();
Ritor1
parents:
diff changeset
9190 v1->field_10 = 100;
Ritor1
parents:
diff changeset
9191 }
Ritor1
parents:
diff changeset
9192 }
Ritor1
parents:
diff changeset
9193 v1->field_8 -= pEventTimer->uTimeElapsed;
Ritor1
parents:
diff changeset
9194 return;
Ritor1
parents:
diff changeset
9195 }
Ritor1
parents:
diff changeset
9196 if ( v1->field_4 == 2 )
Ritor1
parents:
diff changeset
9197 {
Ritor1
parents:
diff changeset
9198 if ( !(v1->field_18 & 1) )
Ritor1
parents:
diff changeset
9199 {
Ritor1
parents:
diff changeset
9200 v11 = v1->field_10;
Ritor1
parents:
diff changeset
9201 if ( v11 == 100 )
Ritor1
parents:
diff changeset
9202 {
Ritor1
parents:
diff changeset
9203 v1->StartTurn();
Ritor1
parents:
diff changeset
9204 LABEL_39:
Ritor1
parents:
diff changeset
9205 v1->_40652A();
Ritor1
parents:
diff changeset
9206 return;
Ritor1
parents:
diff changeset
9207 }
Ritor1
parents:
diff changeset
9208 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 )
Ritor1
parents:
diff changeset
9209 {
Ritor1
parents:
diff changeset
9210 v1->_4065B0();
Ritor1
parents:
diff changeset
9211 goto LABEL_39;
Ritor1
parents:
diff changeset
9212 }
Ritor1
parents:
diff changeset
9213 }
Ritor1
parents:
diff changeset
9214 v1->NextTurn();
Ritor1
parents:
diff changeset
9215 return;
Ritor1
parents:
diff changeset
9216 }
Ritor1
parents:
diff changeset
9217 if ( v1->field_4 == 3 )
Ritor1
parents:
diff changeset
9218 {
Ritor1
parents:
diff changeset
9219 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 )
Ritor1
parents:
diff changeset
9220 {
Ritor1
parents:
diff changeset
9221 v1->field_18 &= 0xFFFFFFF7u;
Ritor1
parents:
diff changeset
9222 v1->field_4 = 1;
Ritor1
parents:
diff changeset
9223 v1->field_8 = 64;
Ritor1
parents:
diff changeset
9224 }
Ritor1
parents:
diff changeset
9225 else
Ritor1
parents:
diff changeset
9226 {
Ritor1
parents:
diff changeset
9227 v1->_406FA8();
Ritor1
parents:
diff changeset
9228 }
Ritor1
parents:
diff changeset
9229 }
Ritor1
parents:
diff changeset
9230 }
Ritor1
parents:
diff changeset
9231
Ritor1
parents:
diff changeset
9232
Ritor1
parents:
diff changeset
9233
Ritor1
parents:
diff changeset
9234
Ritor1
parents:
diff changeset
9235 //----- (0043FDED) --------------------------------------------------------
Ritor1
parents:
diff changeset
9236 void PrepareActorRenderList_BLV()
Ritor1
parents:
diff changeset
9237 {
Ritor1
parents:
diff changeset
9238 RenderBillboard *v0; // esi@0
Ritor1
parents:
diff changeset
9239 unsigned __int16 v3; // ax@3
Ritor1
parents:
diff changeset
9240 unsigned int v4; // eax@5
Ritor1
parents:
diff changeset
9241 unsigned __int16 v5; // cx@5
Ritor1
parents:
diff changeset
9242 int v6; // esi@5
Ritor1
parents:
diff changeset
9243 unsigned int v7; // eax@7
Ritor1
parents:
diff changeset
9244 int v8; // eax@10
Ritor1
parents:
diff changeset
9245 SpriteFrame *v9; // eax@16
Ritor1
parents:
diff changeset
9246 SpriteFrame *v10; // ebx@18
Ritor1
parents:
diff changeset
9247 //int *v11; // eax@18
Ritor1
parents:
diff changeset
9248 int v12; // ecx@28
Ritor1
parents:
diff changeset
9249 //IndoorCameraD3D **v14; // eax@36
Ritor1
parents:
diff changeset
9250 double v15; // st7@36
Ritor1
parents:
diff changeset
9251 float v16; // eax@36
Ritor1
parents:
diff changeset
9252 //double v17; // ST30_8@36
Ritor1
parents:
diff changeset
9253 signed __int64 v18; // qtt@36
Ritor1
parents:
diff changeset
9254 int v19; // ST5C_4@36
Ritor1
parents:
diff changeset
9255 signed __int64 v20; // qtt@37
Ritor1
parents:
diff changeset
9256 int v21; // ST5C_4@37
Ritor1
parents:
diff changeset
9257 signed __int16 v22; // cx@39
Ritor1
parents:
diff changeset
9258 int v23; // ST50_4@40
Ritor1
parents:
diff changeset
9259 signed int v24; // ecx@40
Ritor1
parents:
diff changeset
9260 int v25; // edx@44
Ritor1
parents:
diff changeset
9261 __int16 v26; // ax@44
Ritor1
parents:
diff changeset
9262 //MonsterDesc *v27; // edx@44
Ritor1
parents:
diff changeset
9263 //int v28; // ecx@44
Ritor1
parents:
diff changeset
9264 unsigned __int8 v29; // zf@44
Ritor1
parents:
diff changeset
9265 unsigned __int8 v30; // sf@44
Ritor1
parents:
diff changeset
9266 unsigned int v31; // [sp-8h] [bp-5Ch]@15
Ritor1
parents:
diff changeset
9267 int v32; // [sp+1Ch] [bp-38h]@5
Ritor1
parents:
diff changeset
9268 int a3; // [sp+20h] [bp-34h]@5
Ritor1
parents:
diff changeset
9269 int a2; // [sp+24h] [bp-30h]@5
Ritor1
parents:
diff changeset
9270 int a1a; // [sp+28h] [bp-2Ch]@5
Ritor1
parents:
diff changeset
9271 __int16 a5; // [sp+2Ch] [bp-28h]@5
Ritor1
parents:
diff changeset
9272 int a5a; // [sp+2Ch] [bp-28h]@36
Ritor1
parents:
diff changeset
9273 int a5b; // [sp+2Ch] [bp-28h]@40
Ritor1
parents:
diff changeset
9274 __int16 v41; // [sp+3Ch] [bp-18h]@18
Ritor1
parents:
diff changeset
9275 int a6; // [sp+40h] [bp-14h]@34
Ritor1
parents:
diff changeset
9276 int v43; // [sp+44h] [bp-10h]@34
Ritor1
parents:
diff changeset
9277 int z; // [sp+48h] [bp-Ch]@32
Ritor1
parents:
diff changeset
9278 signed int y; // [sp+4Ch] [bp-8h]@32
Ritor1
parents:
diff changeset
9279 int x; // [sp+50h] [bp-4h]@32
Ritor1
parents:
diff changeset
9280
Ritor1
parents:
diff changeset
9281 for (uint i = 0; i < uNumActors; ++i)
Ritor1
parents:
diff changeset
9282 {
Ritor1
parents:
diff changeset
9283 auto p = pActors + i;
Ritor1
parents:
diff changeset
9284
Ritor1
parents:
diff changeset
9285 if (p->uAIState == Removed ||
Ritor1
parents:
diff changeset
9286 p->uAIState == Disabled)
Ritor1
parents:
diff changeset
9287 continue;
Ritor1
parents:
diff changeset
9288
Ritor1
parents:
diff changeset
9289 a5 = p->uSectorID;
Ritor1
parents:
diff changeset
9290 a2 = p->vPosition.y;
Ritor1
parents:
diff changeset
9291 a1a = p->vPosition.x;
Ritor1
parents:
diff changeset
9292 a3 = p->vPosition.z;
Ritor1
parents:
diff changeset
9293 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y);
Ritor1
parents:
diff changeset
9294 LOWORD(v0) = p->uYawAngle;
Ritor1
parents:
diff changeset
9295 v5 = p->uCurrentActionAnimation;
Ritor1
parents:
diff changeset
9296 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
Ritor1
parents:
diff changeset
9297 v32 = v6;
Ritor1
parents:
diff changeset
9298 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
9299 {
Ritor1
parents:
diff changeset
9300 if ( v5 == 1 )
Ritor1
parents:
diff changeset
9301 {
Ritor1
parents:
diff changeset
9302 v7 = pMiscTimer->uTotalGameTimeElapsed;
Ritor1
parents:
diff changeset
9303 goto LABEL_10;
Ritor1
parents:
diff changeset
9304 }
Ritor1
parents:
diff changeset
9305 }
Ritor1
parents:
diff changeset
9306 else
Ritor1
parents:
diff changeset
9307 {
Ritor1
parents:
diff changeset
9308 if ( v5 == 1 )
Ritor1
parents:
diff changeset
9309 {
Ritor1
parents:
diff changeset
9310 v7 = pBLVRenderParams->field_0_timer_;
Ritor1
parents:
diff changeset
9311 LABEL_10:
Ritor1
parents:
diff changeset
9312 v8 = i * 32 + v7;
Ritor1
parents:
diff changeset
9313 goto LABEL_12;
Ritor1
parents:
diff changeset
9314 }
Ritor1
parents:
diff changeset
9315 }
Ritor1
parents:
diff changeset
9316 v8 = p->uCurrentActionTime;
Ritor1
parents:
diff changeset
9317 LABEL_12:
Ritor1
parents:
diff changeset
9318 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 )
Ritor1
parents:
diff changeset
9319 v8 = 0;
Ritor1
parents:
diff changeset
9320 v31 = p->pSpriteIDs[v5];
Ritor1
parents:
diff changeset
9321 if (p->uAIState == Resurrected)
Ritor1
parents:
diff changeset
9322 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8);
Ritor1
parents:
diff changeset
9323 else
Ritor1
parents:
diff changeset
9324 v9 = pSpriteFrameTable->GetFrame(v31, v8);
Ritor1
parents:
diff changeset
9325 v41 = 0;
Ritor1
parents:
diff changeset
9326 v10 = v9;
Ritor1
parents:
diff changeset
9327 //v11 = (int *)v9->uFlags;
Ritor1
parents:
diff changeset
9328 if (v9->uFlags & 2)
Ritor1
parents:
diff changeset
9329 v41 = 2;
Ritor1
parents:
diff changeset
9330 if (v9->uFlags & 0x40000)
Ritor1
parents:
diff changeset
9331 v41 |= 0x40u;
Ritor1
parents:
diff changeset
9332 if (v9->uFlags & 0x20000)
Ritor1
parents:
diff changeset
9333 LOBYTE(v41) = v41 | 0x80;
Ritor1
parents:
diff changeset
9334 v0 = (RenderBillboard *)(256 << v6);
Ritor1
parents:
diff changeset
9335 if ( (unsigned int)v0 & v9->uFlags)
Ritor1
parents:
diff changeset
9336 v41 |= 4u;
Ritor1
parents:
diff changeset
9337 if ( v10->uGlowRadius )
Ritor1
parents:
diff changeset
9338 {
Ritor1
parents:
diff changeset
9339 //LOBYTE(v11) = byte_4E94D3;
Ritor1
parents:
diff changeset
9340 pMobileLightsStack->AddLight(
Ritor1
parents:
diff changeset
9341 a1a,
Ritor1
parents:
diff changeset
9342 a2,
Ritor1
parents:
diff changeset
9343 a3,
Ritor1
parents:
diff changeset
9344 a5,
Ritor1
parents:
diff changeset
9345 v10->uGlowRadius,
Ritor1
parents:
diff changeset
9346 0xFFu,
Ritor1
parents:
diff changeset
9347 0xFFu,
Ritor1
parents:
diff changeset
9348 0xFFu,
Ritor1
parents:
diff changeset
9349 byte_4E94D3);
Ritor1
parents:
diff changeset
9350 }
Ritor1
parents:
diff changeset
9351 v12 = 0;
Ritor1
parents:
diff changeset
9352 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 )
Ritor1
parents:
diff changeset
9353 continue;
Ritor1
parents:
diff changeset
9354 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID)
Ritor1
parents:
diff changeset
9355 {
Ritor1
parents:
diff changeset
9356 ++v12;
Ritor1
parents:
diff changeset
9357 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors )
Ritor1
parents:
diff changeset
9358 goto _continue;
Ritor1
parents:
diff changeset
9359 }
Ritor1
parents:
diff changeset
9360 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1)
Ritor1
parents:
diff changeset
9361 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) )
Ritor1
parents:
diff changeset
9362 continue;
Ritor1
parents:
diff changeset
9363 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
Ritor1
parents:
diff changeset
9364 v0 = &pBillboardRenderList[uNumBillboardsToDraw];
Ritor1
parents:
diff changeset
9365 if (uNumBillboardsToDraw >= 500)
Ritor1
parents:
diff changeset
9366 break;
Ritor1
parents:
diff changeset
9367 ++uNumBillboardsToDraw;
Ritor1
parents:
diff changeset
9368 ++uNumSpritesDrawnThisFrame;
Ritor1
parents:
diff changeset
9369 p->uAttributes |= 8u;
Ritor1
parents:
diff changeset
9370 v29 = pRenderer->pRenderD3D == 0;
Ritor1
parents:
diff changeset
9371 v0->uHwSpriteID = v10->pHwSpriteIDs[v32];
Ritor1
parents:
diff changeset
9372 v0->uPalette = v10->uPaletteIndex;
Ritor1
parents:
diff changeset
9373 v0->uIndoorSectorID = a5;
Ritor1
parents:
diff changeset
9374 if ( v29 )
Ritor1
parents:
diff changeset
9375 {
Ritor1
parents:
diff changeset
9376 LODWORD(v20) = pBLVRenderParams->field_40 << 16;
Ritor1
parents:
diff changeset
9377 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16;
Ritor1
parents:
diff changeset
9378 v21 = v20 / x;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9379 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16;
0
Ritor1
parents:
diff changeset
9380 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16;
Ritor1
parents:
diff changeset
9381 }
Ritor1
parents:
diff changeset
9382 else
Ritor1
parents:
diff changeset
9383 {
Ritor1
parents:
diff changeset
9384 //v14 = &pGame->pIndoorCameraD3D;
Ritor1
parents:
diff changeset
9385 v0->fov_x = pGame->pIndoorCameraD3D->fov_x;
Ritor1
parents:
diff changeset
9386 v15 = pGame->pIndoorCameraD3D->fov_y;
Ritor1
parents:
diff changeset
9387 v16 = v0->fov_x;
Ritor1
parents:
diff changeset
9388 v0->fov_y = v15;
Ritor1
parents:
diff changeset
9389 //v17 = v16 + 6.7553994e15;
Ritor1
parents:
diff changeset
9390 LODWORD(v18) = 0;
Ritor1
parents:
diff changeset
9391 HIDWORD(v18) = floorf(v16 + 0.5f);
Ritor1
parents:
diff changeset
9392 v19 = v18 / x;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9393 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16;
0
Ritor1
parents:
diff changeset
9394 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16;
Ritor1
parents:
diff changeset
9395 }
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9396 v0->_screenspace_y_scaler_packedfloat = a5a;
0
Ritor1
parents:
diff changeset
9397 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
9398 {
Ritor1
parents:
diff changeset
9399 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 )
Ritor1
parents:
diff changeset
9400 {
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9401 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
9402 goto LABEL_43;
Ritor1
parents:
diff changeset
9403 }
Ritor1
parents:
diff changeset
9404 }
Ritor1
parents:
diff changeset
9405 else
Ritor1
parents:
diff changeset
9406 {
Ritor1
parents:
diff changeset
9407 v22 = p->pActorBuffs[3].uPower;
Ritor1
parents:
diff changeset
9408 if ( v22 )
Ritor1
parents:
diff changeset
9409 {
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9410 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
9411 v24 = p->pActorBuffs[3].uPower;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9412 v0->_screenspace_x_scaler_packedfloat = v23;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9413 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
9414 LABEL_43:
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
9415 v0->_screenspace_y_scaler_packedfloat = a5b;
0
Ritor1
parents:
diff changeset
9416 goto LABEL_44;
Ritor1
parents:
diff changeset
9417 }
Ritor1
parents:
diff changeset
9418 }
Ritor1
parents:
diff changeset
9419 LABEL_44:
Ritor1
parents:
diff changeset
9420 HIWORD(v25) = HIWORD(x);
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
9421 v0->world_x = a1a;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
9422 v0->world_y = a2;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
9423 v0->world_z = a3;
0
Ritor1
parents:
diff changeset
9424 v0->uScreenSpaceX = v43;
Ritor1
parents:
diff changeset
9425 v0->uScreenSpaceY = a6;
Ritor1
parents:
diff changeset
9426 LOWORD(v25) = 0;
Ritor1
parents:
diff changeset
9427 LOBYTE(v26) = v41;
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
9428
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
9429 //v0->sZValue = v25 + (8 * i | OBJECT_Actor);
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
9430 v0->actual_z = HIWORD(x);
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
9431 v0->object_pid = v8 * i | OBJECT_Actor;
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
9432
0
Ritor1
parents:
diff changeset
9433 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0;
Ritor1
parents:
diff changeset
9434 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0;
Ritor1
parents:
diff changeset
9435 v0->field_1E = v41;
Ritor1
parents:
diff changeset
9436 v0->pSpriteFrame = v10;
Ritor1
parents:
diff changeset
9437 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor;
Ritor1
parents:
diff changeset
9438 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) )
Ritor1
parents:
diff changeset
9439 {
Ritor1
parents:
diff changeset
9440 HIBYTE(v26) = HIBYTE(v41) | 1;
Ritor1
parents:
diff changeset
9441 v0->field_1E = v26;
Ritor1
parents:
diff changeset
9442 }
Ritor1
parents:
diff changeset
9443
Ritor1
parents:
diff changeset
9444 _continue:
Ritor1
parents:
diff changeset
9445 ;
Ritor1
parents:
diff changeset
9446 }
Ritor1
parents:
diff changeset
9447 }
Ritor1
parents:
diff changeset
9448
Ritor1
parents:
diff changeset
9449
Ritor1
parents:
diff changeset
9450
Ritor1
parents:
diff changeset
9451
Ritor1
parents:
diff changeset
9452 //----- (00444732) --------------------------------------------------------
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9453 char *GetEventHintString(unsigned int uEventID)
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9454 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9455 signed int event_index; // edx@1
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9456 int event_pos; // esi@4
0
Ritor1
parents:
diff changeset
9457 char *result; // eax@6
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9458 unsigned int str_index; // eax@9
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9459 int i; // esi@11
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9460 _evt_raw* test_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9461 _evt_raw* last_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9462
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9463 event_index = 0;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9464 if ( uLevelEVT_NumEvents <= 0 )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9465 return NULL;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9466
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9467 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
0
Ritor1
parents:
diff changeset
9468 while ( 1 )
Ritor1
parents:
diff changeset
9469 {
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9470 if ( pLevelEVT_Index[event_index].uEventID == uEventID )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9471 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9472 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9473 last_evt=test_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9474 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9475 if ( test_evt->_e_type == EVENT_MouseOver )
0
Ritor1
parents:
diff changeset
9476 break;
Ritor1
parents:
diff changeset
9477 }
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9478 ++event_index;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9479 if ( event_index >= uLevelEVT_NumEvents )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9480 return NULL;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9481 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9482 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9483 if ( test_evt->_e_type== EVENT_SpeakInHouse )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9484 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9485 str_index = EVT_DWORD(test_evt->v5);
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9486 result = (char *)p2DEvents[str_index - 1].pName;
0
Ritor1
parents:
diff changeset
9487 }
Ritor1
parents:
diff changeset
9488 else
Ritor1
parents:
diff changeset
9489 {
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9490 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9491 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9492 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9493 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9494 if ( test_evt->_e_type == EVENT_SpeakInHouse )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9495 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9496 str_index = EVT_DWORD(test_evt->v5);
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9497 if ( str_index < 600 )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9498 return (char *)p2DEvents[str_index - 1].pName;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9499 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9500 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9501 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9502 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
9503
0
Ritor1
parents:
diff changeset
9504 return result;
Ritor1
parents:
diff changeset
9505 }
Ritor1
parents:
diff changeset
9506
Ritor1
parents:
diff changeset
9507
Ritor1
parents:
diff changeset
9508
Ritor1
parents:
diff changeset
9509
Ritor1
parents:
diff changeset
9510 //----- (00444839) --------------------------------------------------------
Ritor1
parents:
diff changeset
9511 unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName)
Ritor1
parents:
diff changeset
9512 {
Ritor1
parents:
diff changeset
9513 unsigned int v9; // ebx@1
Ritor1
parents:
diff changeset
9514 int v10; // edi@1
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9515 //signed int v11; // eax@1
0
Ritor1
parents:
diff changeset
9516 unsigned int v12; // eax@6
Ritor1
parents:
diff changeset
9517 const char *v13; // ST0C_4@6
Ritor1
parents:
diff changeset
9518 unsigned int v14; // eax@8
Ritor1
parents:
diff changeset
9519 const char *v15; // eax@14
Ritor1
parents:
diff changeset
9520 unsigned int v16; // eax@16
Ritor1
parents:
diff changeset
9521 unsigned int result; // eax@26
Ritor1
parents:
diff changeset
9522 const char *v18; // [sp-8h] [bp-40h]@9
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9523 //const char *v19; // [sp-4h] [bp-3Ch]@2
0
Ritor1
parents:
diff changeset
9524 char *v20; // [sp-4h] [bp-3Ch]@9
Ritor1
parents:
diff changeset
9525 const char *v21; // [sp-4h] [bp-3Ch]@11
Ritor1
parents:
diff changeset
9526 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
Ritor1
parents:
diff changeset
9527 unsigned int v23; // [sp+34h] [bp-4h]@1
Ritor1
parents:
diff changeset
9528
Ritor1
parents:
diff changeset
9529 v9 = a1;
Ritor1
parents:
diff changeset
9530 v10 = a2;
Ritor1
parents:
diff changeset
9531 v23 = IndoorLocation::GetLocationIndex(pLocationName);
Ritor1
parents:
diff changeset
9532 dword_59117C_teleportx = x;
Ritor1
parents:
diff changeset
9533 dword_591178_teleporty = y;
Ritor1
parents:
diff changeset
9534 dword_591174_teleportz = z;
Ritor1
parents:
diff changeset
9535 dword_591170_teleport_directiony = directiony;
Ritor1
parents:
diff changeset
9536 dword_59116C_teleport_directionx = directionx;
Ritor1
parents:
diff changeset
9537 dword_591168_teleport_speedz = a8;
Ritor1
parents:
diff changeset
9538 dword_591164_teleport_map_name = (char *)pLocationName;
Ritor1
parents:
diff changeset
9539 uCurrentHouse_Animation = v9;
Ritor1
parents:
diff changeset
9540 pEventTimer->Pause();
Ritor1
parents:
diff changeset
9541 pAudioPlayer->StopChannels(-1, -1);
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9542
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9543 switch (pParty->alignment)
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9544 {
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9545 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9546 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9547 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9548 default: assert(false);
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9549 }
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9550 /*v11 = const_2();
0
Ritor1
parents:
diff changeset
9551 sprintf(pContainer, "evt%02d", v11);
Ritor1
parents:
diff changeset
9552 if ( pParty->uAlignment )
Ritor1
parents:
diff changeset
9553 {
Ritor1
parents:
diff changeset
9554 if ( pParty->uAlignment != 2 )
Ritor1
parents:
diff changeset
9555 goto LABEL_6;
Ritor1
parents:
diff changeset
9556 v19 = "-c";
Ritor1
parents:
diff changeset
9557 }
Ritor1
parents:
diff changeset
9558 else
Ritor1
parents:
diff changeset
9559 {
Ritor1
parents:
diff changeset
9560 v19 = "-b";
Ritor1
parents:
diff changeset
9561 }
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9562 strcat(pContainer, v19);*/
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9563
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 370
diff changeset
9564 //LABEL_6:
0
Ritor1
parents:
diff changeset
9565 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
9566 v13 = pHouse_ExitPictures[v10];
Ritor1
parents:
diff changeset
9567 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12];
Ritor1
parents:
diff changeset
9568 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)];
Ritor1
parents:
diff changeset
9569 if ( v9 )
Ritor1
parents:
diff changeset
9570 {
Ritor1
parents:
diff changeset
9571 if ( !v23 )
Ritor1
parents:
diff changeset
9572 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u);
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
9573 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u);
0
Ritor1
parents:
diff changeset
9574 }
Ritor1
parents:
diff changeset
9575 else
Ritor1
parents:
diff changeset
9576 {
Ritor1
parents:
diff changeset
9577 if ( !v23 )
Ritor1
parents:
diff changeset
9578 {
Ritor1
parents:
diff changeset
9579 v14 = pMapStats->GetMapInfo(pCurrentMapName);
Ritor1
parents:
diff changeset
9580 if ( v14 )
Ritor1
parents:
diff changeset
9581 {
721
Ritor1
parents: 720
diff changeset
9582 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName);
0
Ritor1
parents:
diff changeset
9583 goto LABEL_20;
Ritor1
parents:
diff changeset
9584 }
Ritor1
parents:
diff changeset
9585 v21 = pGlobalTXT_LocalizationStrings[79];
Ritor1
parents:
diff changeset
9586 goto LABEL_19;
Ritor1
parents:
diff changeset
9587 }
Ritor1
parents:
diff changeset
9588 }
Ritor1
parents:
diff changeset
9589 v15 = pLocationName;
Ritor1
parents:
diff changeset
9590 if ( *pLocationName == 48 )
Ritor1
parents:
diff changeset
9591 v15 = pCurrentMapName;
Ritor1
parents:
diff changeset
9592 v16 = pMapStats->GetMapInfo(v15);
Ritor1
parents:
diff changeset
9593 if ( v16 )
Ritor1
parents:
diff changeset
9594 {
721
Ritor1
parents: 720
diff changeset
9595 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
Ritor1
parents: 720
diff changeset
9596 goto LABEL_20;
0
Ritor1
parents:
diff changeset
9597 }
Ritor1
parents:
diff changeset
9598 v21 = pGlobalTXT_LocalizationStrings[73];
Ritor1
parents:
diff changeset
9599 LABEL_19:
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
9600 strcpy(sHouseName, v21);
0
Ritor1
parents:
diff changeset
9601 LABEL_20:
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
9602 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName);
0
Ritor1
parents:
diff changeset
9603 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
495
90fdb47bfcba guilds ...
Gloval
parents: 494
diff changeset
9604 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId )
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
9605 PlayHouseSound(v9, HouseSound_Greeting);
0
Ritor1
parents:
diff changeset
9606 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
187
49728858c35e On player voices
Nomad
parents: 180
diff changeset
9607 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
0
Ritor1
parents:
diff changeset
9608 result = v23;
Ritor1
parents:
diff changeset
9609 if ( v23 )
Ritor1
parents:
diff changeset
9610 uCurrentHouse_Animation = v23;
Ritor1
parents:
diff changeset
9611 return result;
Ritor1
parents:
diff changeset
9612 }
Ritor1
parents:
diff changeset
9613