annotate mm7_4.cpp @ 1150:354ec6263123

sub_451007_scale_image_bicubic cleanup - remove assert
author Grumpy7
date Sun, 02 Jun 2013 05:42:28 +0200
parents cf6cd674c398
children 29a8defbad9e
rev   line source
198
e6e348d66a75 Some work on spellbook
Nomad
parents: 194
diff changeset
1 #include <assert.h>
0
Ritor1
parents:
diff changeset
2
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
3 #include "VideoPlayer.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
4 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
5 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
6 #include "OutdoorCamera.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
7 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
8 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
9 #include "stru11.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
10 #include "stru12.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
11
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
12 #include "LightmapBuilder.h"
341
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
13 #include "MM7.h"
0
Ritor1
parents:
diff changeset
14 #include "MapInfo.h"
Ritor1
parents:
diff changeset
15 #include "Game.h"
Ritor1
parents:
diff changeset
16 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
17 #include "GUIFont.h"
Ritor1
parents:
diff changeset
18 #include "Party.h"
Ritor1
parents:
diff changeset
19 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
20 #include "Outdoor.h"
Ritor1
parents:
diff changeset
21 #include "IndoorCamera.h"
Ritor1
parents:
diff changeset
22 #include "LOD.h"
Ritor1
parents:
diff changeset
23 #include "Actor.h"
Ritor1
parents:
diff changeset
24 #include "Allocator.h"
Ritor1
parents:
diff changeset
25 #include "Events.h"
Ritor1
parents:
diff changeset
26 #include "Viewport.h"
Ritor1
parents:
diff changeset
27 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
28 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
29 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
30 #include "ObjectList.h"
Ritor1
parents:
diff changeset
31 #include "DecorationList.h"
Ritor1
parents:
diff changeset
32 #include "Time.h"
Ritor1
parents:
diff changeset
33 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
34 #include "PlayerFrameTable.h"
Ritor1
parents:
diff changeset
35 #include "Awards.h"
Ritor1
parents:
diff changeset
36 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
37 #include "Events2D.h"
Ritor1
parents:
diff changeset
38 #include "stru159.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 180
diff changeset
39 #include "texts.h"
0
Ritor1
parents:
diff changeset
40 #include "Log.h"
629
59713bb36033 houses func moved to uihouses
Gloval
parents: 615
diff changeset
41 #include "UIHouses.h"
0
Ritor1
parents:
diff changeset
42 #include "mm7_data.h"
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 //----- (0046CC4B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
45 void __cdecl check_event_triggers()
0
Ritor1
parents:
diff changeset
46 {
Ritor1
parents:
diff changeset
47 int v0; // eax@1
Ritor1
parents:
diff changeset
48 LevelDecoration *v1; // esi@2
Ritor1
parents:
diff changeset
49 signed int v2; // edi@2
Ritor1
parents:
diff changeset
50 int v3; // ebx@2
Ritor1
parents:
diff changeset
51 int v4; // eax@3
Ritor1
parents:
diff changeset
52 int v5; // ebx@3
Ritor1
parents:
diff changeset
53 unsigned int v6; // ecx@3
Ritor1
parents:
diff changeset
54 unsigned int v7; // edx@6
Ritor1
parents:
diff changeset
55 unsigned int v8; // edx@8
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
56 Actor *v9; // edi@13
0
Ritor1
parents:
diff changeset
57 int v10; // ebx@14
Ritor1
parents:
diff changeset
58 int v11; // eax@14
Ritor1
parents:
diff changeset
59 int v12; // ebx@14
Ritor1
parents:
diff changeset
60 unsigned int v13; // ecx@14
Ritor1
parents:
diff changeset
61 int v14; // edx@15
Ritor1
parents:
diff changeset
62 unsigned int v15; // edx@17
Ritor1
parents:
diff changeset
63 unsigned int v16; // edx@19
Ritor1
parents:
diff changeset
64 char *v17; // edi@25
Ritor1
parents:
diff changeset
65 int v18; // ebx@26
Ritor1
parents:
diff changeset
66 int v19; // eax@26
Ritor1
parents:
diff changeset
67 int v20; // ebx@26
Ritor1
parents:
diff changeset
68 unsigned int v21; // ecx@26
Ritor1
parents:
diff changeset
69 int v22; // edx@27
Ritor1
parents:
diff changeset
70 unsigned int v23; // edx@29
Ritor1
parents:
diff changeset
71 unsigned int v24; // edx@31
Ritor1
parents:
diff changeset
72 int v25; // [sp+0h] [bp-24h]@3
Ritor1
parents:
diff changeset
73 int v26; // [sp+0h] [bp-24h]@14
Ritor1
parents:
diff changeset
74 int v27; // [sp+0h] [bp-24h]@26
Ritor1
parents:
diff changeset
75 int v28; // [sp+4h] [bp-20h]@3
Ritor1
parents:
diff changeset
76 int v29; // [sp+4h] [bp-20h]@14
Ritor1
parents:
diff changeset
77 int v30; // [sp+4h] [bp-20h]@26
Ritor1
parents:
diff changeset
78 signed int v31; // [sp+8h] [bp-1Ch]@2
Ritor1
parents:
diff changeset
79 int v32; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
80 int v33; // [sp+10h] [bp-14h]@2
Ritor1
parents:
diff changeset
81 int i; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
82 int v35; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
83 int v36; // [sp+1Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
84 signed int v37; // [sp+1Ch] [bp-8h]@12
Ritor1
parents:
diff changeset
85 signed int v38; // [sp+20h] [bp-4h]@24
Ritor1
parents:
diff changeset
86
Ritor1
parents:
diff changeset
87 v0 = 0;
Ritor1
parents:
diff changeset
88 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i )
Ritor1
parents:
diff changeset
89 {
Ritor1
parents:
diff changeset
90 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]];
Ritor1
parents:
diff changeset
91 v2 = v1->field_18;
Ritor1
parents:
diff changeset
92 v3 = v1->vPosition.y;
Ritor1
parents:
diff changeset
93 v33 = v1->vPosition.x;
Ritor1
parents:
diff changeset
94 v32 = v1->vPosition.y;
Ritor1
parents:
diff changeset
95 v35 = v1->vPosition.z;
Ritor1
parents:
diff changeset
96 v31 = v1->field_18;
Ritor1
parents:
diff changeset
97 if ( v1->field_2 & 1 )
Ritor1
parents:
diff changeset
98 {
Ritor1
parents:
diff changeset
99 v36 = abs(v1->vPosition.x - pParty->vPosition.x);
Ritor1
parents:
diff changeset
100 v25 = abs(v3 - pParty->vPosition.y);
Ritor1
parents:
diff changeset
101 v28 = abs(v35 - pParty->vPosition.z);
Ritor1
parents:
diff changeset
102 v4 = v36;
Ritor1
parents:
diff changeset
103 v5 = v25;
Ritor1
parents:
diff changeset
104 v6 = v28;
Ritor1
parents:
diff changeset
105 if ( v36 < v25 )
Ritor1
parents:
diff changeset
106 {
Ritor1
parents:
diff changeset
107 v4 = v25;
Ritor1
parents:
diff changeset
108 v5 = v36;
Ritor1
parents:
diff changeset
109 }
Ritor1
parents:
diff changeset
110 if ( v4 < v28 )
Ritor1
parents:
diff changeset
111 {
Ritor1
parents:
diff changeset
112 v7 = v4;
Ritor1
parents:
diff changeset
113 v4 = v28;
Ritor1
parents:
diff changeset
114 v6 = v7;
Ritor1
parents:
diff changeset
115 }
Ritor1
parents:
diff changeset
116 if ( v5 < (signed int)v6 )
Ritor1
parents:
diff changeset
117 {
Ritor1
parents:
diff changeset
118 v8 = v6;
Ritor1
parents:
diff changeset
119 v6 = v5;
Ritor1
parents:
diff changeset
120 v5 = v8;
Ritor1
parents:
diff changeset
121 }
Ritor1
parents:
diff changeset
122 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 )
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
123 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1);
0
Ritor1
parents:
diff changeset
124 }
Ritor1
parents:
diff changeset
125 if ( v1->field_2 & 2 )
Ritor1
parents:
diff changeset
126 {
Ritor1
parents:
diff changeset
127 v37 = 0;
Ritor1
parents:
diff changeset
128 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
129 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
130 v9 = pActors;//[0].vPosition.y;
0
Ritor1
parents:
diff changeset
131 do
Ritor1
parents:
diff changeset
132 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
133 v10 = abs(v33 - v9->vPosition.x);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
134 v29 = abs(v32 - v9->vPosition.y);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
135 v26 = abs(v35 - v9->vPosition.z);
0
Ritor1
parents:
diff changeset
136 v11 = v10;
Ritor1
parents:
diff changeset
137 v12 = v29;
Ritor1
parents:
diff changeset
138 v13 = v26;
Ritor1
parents:
diff changeset
139 if ( v11 < v29 )
Ritor1
parents:
diff changeset
140 {
Ritor1
parents:
diff changeset
141 v14 = v11;
Ritor1
parents:
diff changeset
142 v11 = v29;
Ritor1
parents:
diff changeset
143 v12 = v14;
Ritor1
parents:
diff changeset
144 }
Ritor1
parents:
diff changeset
145 if ( v11 < v26 )
Ritor1
parents:
diff changeset
146 {
Ritor1
parents:
diff changeset
147 v15 = v11;
Ritor1
parents:
diff changeset
148 v11 = v26;
Ritor1
parents:
diff changeset
149 v13 = v15;
Ritor1
parents:
diff changeset
150 }
Ritor1
parents:
diff changeset
151 if ( v12 < (signed int)v13 )
Ritor1
parents:
diff changeset
152 {
Ritor1
parents:
diff changeset
153 v16 = v13;
Ritor1
parents:
diff changeset
154 v13 = v12;
Ritor1
parents:
diff changeset
155 v12 = v16;
Ritor1
parents:
diff changeset
156 }
Ritor1
parents:
diff changeset
157 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 )
Ritor1
parents:
diff changeset
158 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
159 ++v37;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
160 ++v9;
0
Ritor1
parents:
diff changeset
161 }
Ritor1
parents:
diff changeset
162 while ( v37 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
163 }
Ritor1
parents:
diff changeset
164 }
Ritor1
parents:
diff changeset
165 if ( v1->field_2 & 4 )
Ritor1
parents:
diff changeset
166 {
Ritor1
parents:
diff changeset
167 v38 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
168 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
169 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
170 v17 = (char *)&pSpriteObjects[0].vPosition.y;
0
Ritor1
parents:
diff changeset
171 do
Ritor1
parents:
diff changeset
172 {
Ritor1
parents:
diff changeset
173 v18 = abs(v33 - *((int *)v17 - 1));
Ritor1
parents:
diff changeset
174 v30 = abs(v32 - *(int *)v17);
Ritor1
parents:
diff changeset
175 v27 = abs(v35 - *((int *)v17 + 1));
Ritor1
parents:
diff changeset
176 v19 = v18;
Ritor1
parents:
diff changeset
177 v20 = v30;
Ritor1
parents:
diff changeset
178 v21 = v27;
Ritor1
parents:
diff changeset
179 if ( v19 < v30 )
Ritor1
parents:
diff changeset
180 {
Ritor1
parents:
diff changeset
181 v22 = v19;
Ritor1
parents:
diff changeset
182 v19 = v30;
Ritor1
parents:
diff changeset
183 v20 = v22;
Ritor1
parents:
diff changeset
184 }
Ritor1
parents:
diff changeset
185 if ( v19 < v27 )
Ritor1
parents:
diff changeset
186 {
Ritor1
parents:
diff changeset
187 v23 = v19;
Ritor1
parents:
diff changeset
188 v19 = v27;
Ritor1
parents:
diff changeset
189 v21 = v23;
Ritor1
parents:
diff changeset
190 }
Ritor1
parents:
diff changeset
191 if ( v20 < (signed int)v21 )
Ritor1
parents:
diff changeset
192 {
Ritor1
parents:
diff changeset
193 v24 = v21;
Ritor1
parents:
diff changeset
194 v21 = v20;
Ritor1
parents:
diff changeset
195 v20 = v24;
Ritor1
parents:
diff changeset
196 }
Ritor1
parents:
diff changeset
197 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 )
Ritor1
parents:
diff changeset
198 EventProcessor(v1->field_16_event_id, 0, 1);
Ritor1
parents:
diff changeset
199 ++v38;
Ritor1
parents:
diff changeset
200 v17 += 112;
Ritor1
parents:
diff changeset
201 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
202 while ( v38 < (signed int)uNumSpriteObjects );
0
Ritor1
parents:
diff changeset
203 }
Ritor1
parents:
diff changeset
204 }
Ritor1
parents:
diff changeset
205 v0 = i + 1;
Ritor1
parents:
diff changeset
206 }
Ritor1
parents:
diff changeset
207 }
Ritor1
parents:
diff changeset
208 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
Ritor1
parents:
diff changeset
209
Ritor1
parents:
diff changeset
210 //----- (0046CEC3) --------------------------------------------------------
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
211 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
212 {
Ritor1
parents:
diff changeset
213 int v13; // ecx@13
Ritor1
parents:
diff changeset
214 signed int v14; // ebx@14
Ritor1
parents:
diff changeset
215 int v15; // eax@16
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
216 //int v16; // edx@19
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
217 //int v17; // ST18_4@19
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
218 //signed int v18; // edx@19
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
219 //signed __int64 v19; // qtt@19
0
Ritor1
parents:
diff changeset
220 int v21; // eax@27
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
221 //int v22; // ecx@29
0
Ritor1
parents:
diff changeset
222 signed int v28; // eax@45
Ritor1
parents:
diff changeset
223 int v29; // ebx@47
Ritor1
parents:
diff changeset
224 int v30; // edx@49
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
225 //int v31; // ST10_4@49
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
226 //signed int v32; // edx@49
0
Ritor1
parents:
diff changeset
227 signed __int64 v33; // qtt@49
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
228 //signed int v34; // eax@54
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
229 //signed int v35; // esi@56
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
230 //int result; // eax@57
0
Ritor1
parents:
diff changeset
231 int v38; // edx@62
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
232 //int v44; // [sp+20h] [bp-20h]@10
0
Ritor1
parents:
diff changeset
233 bool v47; // [sp+24h] [bp-1Ch]@43
Ritor1
parents:
diff changeset
234 bool v48; // [sp+28h] [bp-18h]@10
Ritor1
parents:
diff changeset
235 bool v49; // [sp+28h] [bp-18h]@41
Ritor1
parents:
diff changeset
236 bool v50; // [sp+2Ch] [bp-14h]@12
Ritor1
parents:
diff changeset
237 signed int v53; // [sp+30h] [bp-10h]@10
Ritor1
parents:
diff changeset
238 signed int v54; // [sp+30h] [bp-10h]@41
Ritor1
parents:
diff changeset
239 signed int v55; // [sp+34h] [bp-Ch]@1
Ritor1
parents:
diff changeset
240
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
241 //LOG_DECOMPILATION_WARNING();
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
242
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
243 static int blv_floor_id[50]; // 00721200
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
244 static int blv_floor_level[50]; // 007212C8
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
245
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
246 static __int16 word_721390_ys[104]; // idb
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
247 static __int16 word_721460_xs[104]; // idb
0
Ritor1
parents:
diff changeset
248
Ritor1
parents:
diff changeset
249 auto pSector = &pIndoor->pSectors[uSectorID];
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
250 v55 = 0;
0
Ritor1
parents:
diff changeset
251 for (uint i = 0; i < pSector->uNumFloors; ++i)
Ritor1
parents:
diff changeset
252 {
Ritor1
parents:
diff changeset
253 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
Ritor1
parents:
diff changeset
254 if (pFloor->Clickable())
Ritor1
parents:
diff changeset
255 continue;
Ritor1
parents:
diff changeset
256
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
257 assert(pFloor->uNumVertices);
0
Ritor1
parents:
diff changeset
258 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 &&
Ritor1
parents:
diff changeset
259 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1)
Ritor1
parents:
diff changeset
260 {
Ritor1
parents:
diff changeset
261 for (uint j = 0; j < pFloor->uNumVertices; ++j)
Ritor1
parents:
diff changeset
262 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
263 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
264 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
265 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
266 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
0
Ritor1
parents:
diff changeset
267 }
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
268 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
269 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
270
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
271 v50 = word_721390_ys[0] >= y;
0
Ritor1
parents:
diff changeset
272 v53 = 0;
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
273
796
14beae4f1723 Last observable issues with walking in dragon cave fixed.
Nomad
parents: 792
diff changeset
274 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j)
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
275 {
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
276 if (v53 >= 2)
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
277 break;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
278
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
279 v48 = v50;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
280 v50 = word_721390_ys[j + 1] >= y;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
281
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
282 v13 = i;
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
283 if (v48 == v50)
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
284 continue;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
285
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
286 v14 = word_721460_xs[j + 1] >= x ? 0 : 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
287 v15 = v14 | (word_721460_xs[j] < x);
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
288
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
289 if (v15 == 3)
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
290 continue;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
291 else if (!v15)
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
292 ++v53;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
293 else
0
Ritor1
parents:
diff changeset
294 {
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
295 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
871
710cf848ad24 Particle engine made working.
Nomad
parents: 832
diff changeset
296 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b);
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
297
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
298 if (res + word_721460_xs[j] >= x)
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
299 ++v53;
0
Ritor1
parents:
diff changeset
300 }
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
301 }
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
302
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
303
0
Ritor1
parents:
diff changeset
304 if ( v53 == 1 )
Ritor1
parents:
diff changeset
305 {
Ritor1
parents:
diff changeset
306 if ( v55 >= 50 )
Ritor1
parents:
diff changeset
307 break;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
308 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
0
Ritor1
parents:
diff changeset
309 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
310 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
0
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 else
Ritor1
parents:
diff changeset
313 {
871
710cf848ad24 Particle engine made working.
Nomad
parents: 832
diff changeset
314 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
0
Ritor1
parents:
diff changeset
315 }
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
316 blv_floor_level[v55] = v21;
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
317 blv_floor_id[v55] = pSector->pFloors[i];
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
318 v55++;
0
Ritor1
parents:
diff changeset
319 }
792
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
320 }
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
321 }
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
322
41b4e9769863 Walking in BLV iproved drastically.
Nomad
parents: 791
diff changeset
323
0
Ritor1
parents:
diff changeset
324 if ( pSector->field_0 & 8 )
Ritor1
parents:
diff changeset
325 {
Ritor1
parents:
diff changeset
326 for (uint i = 0; i < pSector->uNumPortals; ++i)
Ritor1
parents:
diff changeset
327 {
Ritor1
parents:
diff changeset
328 auto portal = &pIndoor->pFaces[pSector->pPortals[i]];
Ritor1
parents:
diff changeset
329 if (portal->uPolygonType != POLYGON_Floor)
Ritor1
parents:
diff changeset
330 continue;
Ritor1
parents:
diff changeset
331
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
332 if (!portal->uNumVertices)
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
333 continue;
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
334
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
335 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 &&
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
336 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
337 {
0
Ritor1
parents:
diff changeset
338 for (uint j = 0; j < portal->uNumVertices; ++j)
Ritor1
parents:
diff changeset
339 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
340 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
341 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
342 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y;
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
343 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
344 }
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
345 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0];
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
346 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0];
0
Ritor1
parents:
diff changeset
347 v54 = 0;
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
348 v47 = word_721390_ys[0] >= y;
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
349
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
350 for (uint j = 0; j < 2 * portal->uNumVertices; ++j)
0
Ritor1
parents:
diff changeset
351 {
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
352 v49 = v47;
0
Ritor1
parents:
diff changeset
353 if ( v54 >= 2 )
Ritor1
parents:
diff changeset
354 break;
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
355 v47 = word_721390_ys[j + 1] >= y;
0
Ritor1
parents:
diff changeset
356 if ( v49 != v47 )
Ritor1
parents:
diff changeset
357 {
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
358 v28 = word_721460_xs[j + 1] >= x ? 0 : 2;
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
359 v29 = v28 | (word_721460_xs[j] < x);
0
Ritor1
parents:
diff changeset
360 if ( v29 != 3 )
Ritor1
parents:
diff changeset
361 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
362 if ( !v29 )
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
363 ++v54;
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
364 else
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
365 {
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
366 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
871
710cf848ad24 Particle engine made working.
Nomad
parents: 832
diff changeset
367 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b);
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
368 if (res + word_721460_xs[j] >= x)
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
369 ++v54;
729
8323734d58c8 Fixed few errors in blv walking commit.
Nomad
parents: 728
diff changeset
370 }
0
Ritor1
parents:
diff changeset
371 }
Ritor1
parents:
diff changeset
372 }
Ritor1
parents:
diff changeset
373 }
Ritor1
parents:
diff changeset
374 if ( v54 == 1 )
Ritor1
parents:
diff changeset
375 {
Ritor1
parents:
diff changeset
376 if ( v55 >= 50 )
Ritor1
parents:
diff changeset
377 break;
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
378 blv_floor_level[v55] = -29000;
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
379 blv_floor_id[v55] = pSector->pPortals[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
380 v55++;
0
Ritor1
parents:
diff changeset
381 }
Ritor1
parents:
diff changeset
382 }
Ritor1
parents:
diff changeset
383 }
Ritor1
parents:
diff changeset
384 }
Ritor1
parents:
diff changeset
385 if ( v55 == 1 )
Ritor1
parents:
diff changeset
386 {
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
387 *pFaceID = blv_floor_id[0];
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
388 return blv_floor_level[0];
0
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390 if ( !v55 )
Ritor1
parents:
diff changeset
391 return -30000;
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
392 *pFaceID = blv_floor_id[0];
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
393 //result = blv_floor_level[0];
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
394
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
395 /*for ( v35 = 1; v35 < v55; ++v35 )
0
Ritor1
parents:
diff changeset
396 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
397 if ( blv_floor_level[0] <= z + 5 )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
398 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
399 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 )
717
Ritor1
parents: 690
diff changeset
400 continue;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
401 blv_floor_level[0] = blv_floor_level[v35];
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
402 *pFaceID = blv_floor_id[v35];
717
Ritor1
parents: 690
diff changeset
403 continue;
Ritor1
parents: 690
diff changeset
404 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
405 if ( blv_floor_level[v35] < blv_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
406 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
407 blv_floor_level[0] = blv_floor_level[v35];
730
79ad0526166c Some data movements.
Nomad
parents: 729
diff changeset
408 *pFaceID = blv_floor_id[v35];
717
Ritor1
parents: 690
diff changeset
409 }
830
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
410 }*/
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
411
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
412
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
413 int result = blv_floor_level[0];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
414 for (uint i = 1; i < v55; ++i)
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
415 {
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
416 v38 = blv_floor_level[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
417 if ( result <= z + 5 )
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
418 {
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
419 if ( v38 > result && v38 <= z + 5 )
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
420 {
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
421 result = blv_floor_level[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
422 *pFaceID = blv_floor_id[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
423 }
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
424 }
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
425 else if ( v38 < result )
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
426 {
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
427 result = blv_floor_level[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
428 *pFaceID = blv_floor_id[i];
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
429 }
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
430 }
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
431
08d90b633131 some BLV floor collisions
Nomad
parents: 827
diff changeset
432 return result;
0
Ritor1
parents:
diff changeset
433 }
Ritor1
parents:
diff changeset
434
Ritor1
parents:
diff changeset
435 //----- (0046D49E) --------------------------------------------------------
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 788
diff changeset
436 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk)
0
Ritor1
parents:
diff changeset
437 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
438 BSPModel *pBModel; // esi@4
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
439 ODMFace *pFace; // ecx@11
0
Ritor1
parents:
diff changeset
440 int v14; // edx@20
Ritor1
parents:
diff changeset
441 signed int v18; // edx@26
Ritor1
parents:
diff changeset
442 int v19; // eax@28
Ritor1
parents:
diff changeset
443 int v20; // edx@30
Ritor1
parents:
diff changeset
444 int v21; // ST1C_4@30
Ritor1
parents:
diff changeset
445 signed int v22; // edx@30
Ritor1
parents:
diff changeset
446 signed __int64 v23; // qtt@30
Ritor1
parents:
diff changeset
447 int v24; // eax@36
Ritor1
parents:
diff changeset
448 signed int v25; // ecx@38
Ritor1
parents:
diff changeset
449 int result; // eax@42
Ritor1
parents:
diff changeset
450 signed int v27; // ecx@43
Ritor1
parents:
diff changeset
451 int v28; // edi@44
Ritor1
parents:
diff changeset
452 signed int v29; // edx@44
Ritor1
parents:
diff changeset
453 int v30; // esi@45
Ritor1
parents:
diff changeset
454 int v31; // eax@45
Ritor1
parents:
diff changeset
455 ODMFace *v32; // eax@57
Ritor1
parents:
diff changeset
456 int v33; // ecx@59
Ritor1
parents:
diff changeset
457 int v36; // [sp+14h] [bp-2Ch]@24
Ritor1
parents:
diff changeset
458 int v38; // [sp+1Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
459 int v39; // [sp+20h] [bp-20h]@9
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
460 signed int pBModelNum; // [sp+28h] [bp-18h]@1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
461 int pFaceNum; // [sp+2Ch] [bp-14h]@8
0
Ritor1
parents:
diff changeset
462 bool v43; // [sp+30h] [bp-10h]@22
Ritor1
parents:
diff changeset
463 bool v44; // [sp+34h] [bp-Ch]@24
Ritor1
parents:
diff changeset
464 signed int v46; // [sp+3Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
465 signed int v48; // [sp+58h] [bp+18h]@22
Ritor1
parents:
diff changeset
466 signed int v49; // [sp+58h] [bp+18h]@43
Ritor1
parents:
diff changeset
467
Ritor1
parents:
diff changeset
468 v46 = 1;
Ritor1
parents:
diff changeset
469 dword_721160[0] = -1;
Ritor1
parents:
diff changeset
470 dword_721110[0] = -1;
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 788
diff changeset
471 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk);
0
Ritor1
parents:
diff changeset
472 if ( (signed int)pOutdoor->uNumBModels <= 0 )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
473 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
474 *a6 = 0;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
475 return odm_floor_level[0];
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
476 }
0
Ritor1
parents:
diff changeset
477 v38 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
478 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
479 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
480 pBModel = &pOutdoor->pBModels[v38];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
481 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
482 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
483 if ( (signed int)pBModel->uNumFaces > 0 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
484 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
485 v39 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
486 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
487 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
488 pFace = &pBModel->pFaces[v39];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
489 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
490 && !(pFace->uAttributes & 0x20000000)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
491 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
492 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
0
Ritor1
parents:
diff changeset
493 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
494 if ( pFace->uNumVertices )
0
Ritor1
parents:
diff changeset
495 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
496 for ( uint i = 0; i < pFace->uNumVertices; ++i)
0
Ritor1
parents:
diff changeset
497 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
498 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
499 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
500 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
501 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
502 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
503 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
504 word_721040[2 * pFace->uNumVertices] = word_721040[0];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
505 word_720F70[2 * pFace->uNumVertices] = word_720F70[0];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
506 v43 = word_720F70[0] >= Y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
507 v48 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
508 if ( 2 * pFace->uNumVertices > 0 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
509 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
510 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
511 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
512 if ( v48 >= 2 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
513 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
514 v36 = word_720F70[i + 1];
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
515 v44 = word_720F70[i + 1] >= Y;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
516 if ( v43 != v44 )
0
Ritor1
parents:
diff changeset
517 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
518 v18 = word_721040[i + 1] >= X ? 0 : 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
519 v19 = v18 | (word_721040[i] < X);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
520 if ( v19 != 3 )
0
Ritor1
parents:
diff changeset
521 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
522 if ( !v19 )
740
Ritor1
parents: 729
diff changeset
523 ++v48;
Ritor1
parents: 729
diff changeset
524 else
0
Ritor1
parents:
diff changeset
525 {
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
526 LODWORD(v23) = (Y - word_720F70[i]) << 16;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
527 HIDWORD(v23) = (Y - word_720F70[i]) >> 16;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
528 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
529 if ( v22 >= X)
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
530 ++v48;
0
Ritor1
parents:
diff changeset
531 }
Ritor1
parents:
diff changeset
532 }
Ritor1
parents:
diff changeset
533 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
534 v43 = v44;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
535 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
536 if ( v48 == 1 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
537 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
538 if ( v46 >= 20 )
0
Ritor1
parents:
diff changeset
539 break;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
540 if ( pFace->uPolygonType == POLYGON_Floor )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
541 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
542 else
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
543 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
544 + HIWORD(pFace->zCalc3);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
545 v25 = v46++;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
546 odm_floor_level[v25] = v24;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
547 dword_721160[v25] = pBModelNum;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
548 dword_721110[v25] = pFaceNum;
0
Ritor1
parents:
diff changeset
549 }
Ritor1
parents:
diff changeset
550 }
Ritor1
parents:
diff changeset
551 }
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
552 ++v39;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
553 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
554 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
555 }
0
Ritor1
parents:
diff changeset
556 ++v38;
Ritor1
parents:
diff changeset
557 }
Ritor1
parents:
diff changeset
558 if ( v46 == 1 )
Ritor1
parents:
diff changeset
559 {
Ritor1
parents:
diff changeset
560 *a6 = 0;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
561 return odm_floor_level[0];
0
Ritor1
parents:
diff changeset
562 }
Ritor1
parents:
diff changeset
563 v27 = 0;
Ritor1
parents:
diff changeset
564 if ( v46 <= 1 )
Ritor1
parents:
diff changeset
565 *a6 = 0;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
566 else
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
567 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
568 //v29 = 1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
569 for ( v49 = 1; v49 < v46; ++v49 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
570 {
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
571 if ( odm_floor_level[v49] == odm_floor_level[0] )
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
572 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
573 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
574 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
575 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
576 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
577 if ( odm_floor_level[0] > Z + 5 )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
578 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
579 if ( odm_floor_level[v49] >= odm_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
580 {
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
581 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
582 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
583 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
584 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
585 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
586 break;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
587 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
588 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
589 {
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
590 v27 = v49;
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
591 //++v29;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
592 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
593 }
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
594 if ( !v27 )
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
595 *a6 = 0;
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
596 else
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
597 *a6 = dword_721110[v27] | (dword_721160[v27] << 6);
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
598 }
0
Ritor1
parents:
diff changeset
599 if ( v27 )
Ritor1
parents:
diff changeset
600 {
Ritor1
parents:
diff changeset
601 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]];
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 788
diff changeset
602 *pIsOnWater = false;
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 788
diff changeset
603 if ( v32->Fluid())
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 788
diff changeset
604 *pIsOnWater = true;
0
Ritor1
parents:
diff changeset
605 }
725
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
606 if ( odm_floor_level[v27] >= odm_floor_level[0] )
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
607 odm_floor_level[0] = odm_floor_level[v27];
7037f22cd716 little continue
Ritor1
parents: 723
diff changeset
608 return odm_floor_level[0];
0
Ritor1
parents:
diff changeset
609 }
Ritor1
parents:
diff changeset
610
Ritor1
parents:
diff changeset
611 //----- (0046D8E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
612 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4)
Ritor1
parents:
diff changeset
613 {
Ritor1
parents:
diff changeset
614 int v4; // ebx@1
Ritor1
parents:
diff changeset
615 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
616 BSPModel *v6; // edi@3
Ritor1
parents:
diff changeset
617 ODMFace *v7; // esi@10
Ritor1
parents:
diff changeset
618 unsigned __int8 v8; // al@10
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 659
diff changeset
619 signed __int16 *v9; // eax@18
0
Ritor1
parents:
diff changeset
620 int v10; // edx@19
Ritor1
parents:
diff changeset
621 int v11; // ecx@21
Ritor1
parents:
diff changeset
622 int v12; // ecx@23
Ritor1
parents:
diff changeset
623 signed int v13; // eax@25
Ritor1
parents:
diff changeset
624 int v14; // edx@27
Ritor1
parents:
diff changeset
625 int v15; // edx@29
Ritor1
parents:
diff changeset
626 int v16; // ST18_4@29
Ritor1
parents:
diff changeset
627 signed int v17; // edx@29
Ritor1
parents:
diff changeset
628 signed __int64 v18; // qtt@29
Ritor1
parents:
diff changeset
629 int v19; // eax@35
Ritor1
parents:
diff changeset
630 signed int v20; // ecx@37
Ritor1
parents:
diff changeset
631 signed int v22; // ebx@42
Ritor1
parents:
diff changeset
632 unsigned int v23; // esi@43
Ritor1
parents:
diff changeset
633 int v24; // edx@44
Ritor1
parents:
diff changeset
634 int v25; // eax@44
Ritor1
parents:
diff changeset
635 int v26; // [sp+Ch] [bp-38h]@7
Ritor1
parents:
diff changeset
636 int v27; // [sp+10h] [bp-34h]@21
Ritor1
parents:
diff changeset
637 int v28; // [sp+18h] [bp-2Ch]@21
Ritor1
parents:
diff changeset
638 int v29; // [sp+1Ch] [bp-28h]@2
Ritor1
parents:
diff changeset
639 unsigned int v30; // [sp+20h] [bp-24h]@8
Ritor1
parents:
diff changeset
640 signed int v31; // [sp+24h] [bp-20h]@1
Ritor1
parents:
diff changeset
641 signed int v32; // [sp+28h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
642 int v33; // [sp+2Ch] [bp-18h]@7
Ritor1
parents:
diff changeset
643 bool v34; // [sp+30h] [bp-14h]@21
Ritor1
parents:
diff changeset
644 bool v35; // [sp+34h] [bp-10h]@23
Ritor1
parents:
diff changeset
645 signed int v36; // [sp+38h] [bp-Ch]@17
Ritor1
parents:
diff changeset
646 signed int v37; // [sp+38h] [bp-Ch]@21
Ritor1
parents:
diff changeset
647 signed int v38; // [sp+38h] [bp-Ch]@42
Ritor1
parents:
diff changeset
648 signed int v39; // [sp+3Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
649 signed int v40; // [sp+40h] [bp-4h]@1
Ritor1
parents:
diff changeset
650
Ritor1
parents:
diff changeset
651 dword_720ED0[0] = -1;
Ritor1
parents:
diff changeset
652 dword_720E80[0] = -1;
Ritor1
parents:
diff changeset
653 v4 = a1;
Ritor1
parents:
diff changeset
654 v5 = 0;
Ritor1
parents:
diff changeset
655 v40 = a2;
Ritor1
parents:
diff changeset
656 v31 = v4;
Ritor1
parents:
diff changeset
657 v39 = 1;
Ritor1
parents:
diff changeset
658 dword_720F20[0] = 10000;
Ritor1
parents:
diff changeset
659 v32 = 0;
Ritor1
parents:
diff changeset
660 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
661 {
Ritor1
parents:
diff changeset
662 v29 = 0;
Ritor1
parents:
diff changeset
663 do
Ritor1
parents:
diff changeset
664 {
Ritor1
parents:
diff changeset
665 v6 = &pOutdoor->pBModels[v29];
Ritor1
parents:
diff changeset
666 if ( v4 <= pOutdoor->pBModels[v29].sMaxX )
Ritor1
parents:
diff changeset
667 {
Ritor1
parents:
diff changeset
668 if ( v4 >= v6->sMinX )
Ritor1
parents:
diff changeset
669 {
Ritor1
parents:
diff changeset
670 if ( v40 <= v6->sMaxY )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 if ( v40 >= v6->sMinY )
Ritor1
parents:
diff changeset
673 {
Ritor1
parents:
diff changeset
674 v33 = v5;
Ritor1
parents:
diff changeset
675 v26 = v6->uNumFaces;
Ritor1
parents:
diff changeset
676 if ( (signed int)v6->uNumFaces > (signed int)v5 )
Ritor1
parents:
diff changeset
677 {
Ritor1
parents:
diff changeset
678 v30 = v5;
Ritor1
parents:
diff changeset
679 while ( 1 )
Ritor1
parents:
diff changeset
680 {
Ritor1
parents:
diff changeset
681 v7 = (ODMFace *)((char *)v6->pFaces + v30);
Ritor1
parents:
diff changeset
682 v8 = v7->uPolygonType;
Ritor1
parents:
diff changeset
683 if ( (v8 == 5 || v8 == 6)
Ritor1
parents:
diff changeset
684 && !(BYTE3(v7->uAttributes) & 0x20)
Ritor1
parents:
diff changeset
685 && v4 <= v7->pBoundingBox.x2
Ritor1
parents:
diff changeset
686 && v4 >= v7->pBoundingBox.x1
Ritor1
parents:
diff changeset
687 && v40 <= v7->pBoundingBox.y2
Ritor1
parents:
diff changeset
688 && v40 >= v7->pBoundingBox.y1 )
Ritor1
parents:
diff changeset
689 {
Ritor1
parents:
diff changeset
690 v36 = v5;
Ritor1
parents:
diff changeset
691 if ( v7->uNumVertices )
Ritor1
parents:
diff changeset
692 {
Ritor1
parents:
diff changeset
693 v9 = v7->pXInterceptDisplacements;
Ritor1
parents:
diff changeset
694 do
Ritor1
parents:
diff changeset
695 {
Ritor1
parents:
diff changeset
696 v10 = 2 * v36;
Ritor1
parents:
diff changeset
697 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x);
Ritor1
parents:
diff changeset
698 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y);
Ritor1
parents:
diff changeset
699 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x);
Ritor1
parents:
diff changeset
700 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y);
Ritor1
parents:
diff changeset
701 ++v9;
Ritor1
parents:
diff changeset
702 }
Ritor1
parents:
diff changeset
703 while ( v36 < v7->uNumVertices );
Ritor1
parents:
diff changeset
704 v4 = v31;
Ritor1
parents:
diff changeset
705 }
Ritor1
parents:
diff changeset
706 v27 = 2 * v7->uNumVertices;
Ritor1
parents:
diff changeset
707 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0];
Ritor1
parents:
diff changeset
708 word_720CE0_ys[v27] = word_720CE0_ys[0];
Ritor1
parents:
diff changeset
709 v11 = 0;
Ritor1
parents:
diff changeset
710 v34 = word_720CE0_ys[0] >= v40;
Ritor1
parents:
diff changeset
711 v37 = 0;
Ritor1
parents:
diff changeset
712 v28 = 0;
Ritor1
parents:
diff changeset
713 if ( v27 > 0 )
Ritor1
parents:
diff changeset
714 {
Ritor1
parents:
diff changeset
715 do
Ritor1
parents:
diff changeset
716 {
Ritor1
parents:
diff changeset
717 if ( v37 >= 2 )
Ritor1
parents:
diff changeset
718 break;
Ritor1
parents:
diff changeset
719 v12 = v11;
Ritor1
parents:
diff changeset
720 v4 = v31;
Ritor1
parents:
diff changeset
721 v35 = word_720CE0_ys[v12 + 1] >= v40;
Ritor1
parents:
diff changeset
722 if ( v34 != v35 )
Ritor1
parents:
diff changeset
723 {
Ritor1
parents:
diff changeset
724 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
725 v14 = v13 | (word_720DB0_xs[v12] < v31);
0
Ritor1
parents:
diff changeset
726 if ( v14 != 3 )
Ritor1
parents:
diff changeset
727 {
Ritor1
parents:
diff changeset
728 if ( !v14
Ritor1
parents:
diff changeset
729 || (v15 = word_720CE0_ys[v12],
Ritor1
parents:
diff changeset
730 v16 = word_720CE0_ys[v12 + 1] - v15,
Ritor1
parents:
diff changeset
731 v17 = v40 - v15,
Ritor1
parents:
diff changeset
732 LODWORD(v18) = v17 << 16,
Ritor1
parents:
diff changeset
733 HIDWORD(v18) = v17 >> 16,
Ritor1
parents:
diff changeset
734 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1]
Ritor1
parents:
diff changeset
735 - (signed int)word_720DB0_xs[v12])
Ritor1
parents:
diff changeset
736 * v18
Ritor1
parents:
diff changeset
737 / v16) >> 16)
Ritor1
parents:
diff changeset
738 + word_720DB0_xs[v12]) >= v31) )
Ritor1
parents:
diff changeset
739 ++v37;
Ritor1
parents:
diff changeset
740 }
Ritor1
parents:
diff changeset
741 }
Ritor1
parents:
diff changeset
742 v11 = v28 + 1;
Ritor1
parents:
diff changeset
743 v34 = v35;
Ritor1
parents:
diff changeset
744 ++v28;
Ritor1
parents:
diff changeset
745 }
Ritor1
parents:
diff changeset
746 while ( v28 < v27 );
Ritor1
parents:
diff changeset
747 if ( v37 == 1 )
Ritor1
parents:
diff changeset
748 {
Ritor1
parents:
diff changeset
749 if ( v39 >= 20 )
Ritor1
parents:
diff changeset
750 break;
Ritor1
parents:
diff changeset
751 if ( v7->uPolygonType == 5 )
Ritor1
parents:
diff changeset
752 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z;
Ritor1
parents:
diff changeset
753 else
Ritor1
parents:
diff changeset
754 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16)
Ritor1
parents:
diff changeset
755 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16)
Ritor1
parents:
diff changeset
756 + HIWORD(v7->zCalc3);
Ritor1
parents:
diff changeset
757 v20 = v39++;
Ritor1
parents:
diff changeset
758 dword_720F20[v20] = v19;
Ritor1
parents:
diff changeset
759 dword_720ED0[v20] = v32;
Ritor1
parents:
diff changeset
760 dword_720E80[v20] = v33;
Ritor1
parents:
diff changeset
761 }
Ritor1
parents:
diff changeset
762 }
Ritor1
parents:
diff changeset
763 }
Ritor1
parents:
diff changeset
764 ++v33;
Ritor1
parents:
diff changeset
765 v30 += 308;
Ritor1
parents:
diff changeset
766 if ( v33 >= v26 )
Ritor1
parents:
diff changeset
767 break;
Ritor1
parents:
diff changeset
768 v5 = 0;
Ritor1
parents:
diff changeset
769 }
Ritor1
parents:
diff changeset
770 }
Ritor1
parents:
diff changeset
771 }
Ritor1
parents:
diff changeset
772 }
Ritor1
parents:
diff changeset
773 }
Ritor1
parents:
diff changeset
774 }
Ritor1
parents:
diff changeset
775 ++v32;
Ritor1
parents:
diff changeset
776 ++v29;
Ritor1
parents:
diff changeset
777 v5 = 0;
Ritor1
parents:
diff changeset
778 }
Ritor1
parents:
diff changeset
779 while ( v32 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
780 if ( !v39 )
Ritor1
parents:
diff changeset
781 {
Ritor1
parents:
diff changeset
782 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
783 return dword_720F20[0];
Ritor1
parents:
diff changeset
784 }
Ritor1
parents:
diff changeset
785 }
Ritor1
parents:
diff changeset
786 v22 = 0;
Ritor1
parents:
diff changeset
787 v38 = v5;
Ritor1
parents:
diff changeset
788 if ( v39 <= (signed int)v5 )
Ritor1
parents:
diff changeset
789 goto LABEL_54;
Ritor1
parents:
diff changeset
790 v23 = 0;
Ritor1
parents:
diff changeset
791 do
Ritor1
parents:
diff changeset
792 {
Ritor1
parents:
diff changeset
793 v24 = dword_720F20[v5 / 4];
Ritor1
parents:
diff changeset
794 v25 = *(int *)((char *)dword_720F20 + v23);
Ritor1
parents:
diff changeset
795 if ( v24 == v25 )
Ritor1
parents:
diff changeset
796 goto LABEL_50;
Ritor1
parents:
diff changeset
797 if ( v25 > a3 + 15 )
Ritor1
parents:
diff changeset
798 {
Ritor1
parents:
diff changeset
799 if ( v24 >= v25 )
Ritor1
parents:
diff changeset
800 goto LABEL_51;
Ritor1
parents:
diff changeset
801 LABEL_50:
Ritor1
parents:
diff changeset
802 v22 = v38;
Ritor1
parents:
diff changeset
803 v23 = v5;
Ritor1
parents:
diff changeset
804 goto LABEL_51;
Ritor1
parents:
diff changeset
805 }
Ritor1
parents:
diff changeset
806 if ( v24 > v25 && v24 <= a3 + 15 )
Ritor1
parents:
diff changeset
807 goto LABEL_50;
Ritor1
parents:
diff changeset
808 LABEL_51:
Ritor1
parents:
diff changeset
809 ++v38;
Ritor1
parents:
diff changeset
810 v5 += 4;
Ritor1
parents:
diff changeset
811 }
Ritor1
parents:
diff changeset
812 while ( v38 < v39 );
Ritor1
parents:
diff changeset
813 if ( v22 )
Ritor1
parents:
diff changeset
814 {
Ritor1
parents:
diff changeset
815 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
Ritor1
parents:
diff changeset
816 return dword_720F20[v22];
Ritor1
parents:
diff changeset
817 }
Ritor1
parents:
diff changeset
818 LABEL_54:
Ritor1
parents:
diff changeset
819 *(int *)a4 = 0;
Ritor1
parents:
diff changeset
820 return dword_720F20[v22];
Ritor1
parents:
diff changeset
821 }
Ritor1
parents:
diff changeset
822
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
823 //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
824 // for a right-handed system, that would be an inverse normal
0
Ritor1
parents:
diff changeset
825 //----- (0046DCC8) --------------------------------------------------------
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
826 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
827 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
828 auto grid_x = WorldPosToGridCellX(pos_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
829 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
830
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
831 auto grid_pos_x1 = GridCellToWorldPosX(grid_x);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
832 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
833 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
834 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
835
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
836 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
837 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
838 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
839 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
840
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
841 float side1_dx, side1_dy, side1_dz,
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
842 side2_dx, side2_dy, side2_dz;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
843
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
844 auto dx = abs(pos_x - grid_pos_x1),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
845 dz = abs(grid_pos_z1 - pos_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
846 if (dz >= dx)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
847 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
848 side1_dy = (double)(x1z1_y - x1z2_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
849 side2_dy = (double)(x2z2_y - x1z2_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
850 side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
851 side1_dx = (double)(grid_pos_x1 - grid_pos_x1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
852 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
853 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
854 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
855 /* |\
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
856 side1 | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
857 |____\
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
858 side 2 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
859 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
860 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
861 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
862 side1_dy = (double)(x2z2_y - x2z1_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
863 side2_dy = (double)(x1z1_y - x2z1_y);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
864 side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
865 side1_dx = (double)(grid_pos_x2 - grid_pos_x2);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
866 side2_dz = (double)(grid_pos_z1 - grid_pos_z1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
867 side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
868
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
869 /* side 2
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
870 _____
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
871 \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
872 \ | side 1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
873 \| */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
874 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
875
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
876 float nx = side1_dy * side2_dz - side1_dz * side2_dy;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
877 float ny = side1_dx * side2_dy - side1_dy * side2_dx;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
878 float nz = side1_dz * side2_dx - side1_dx * side2_dz;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
879
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
880 float mag = sqrt(nx * nx + ny * ny + nz * nz);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
881 if (fabsf(mag) < 1e-6f)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
882 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
883 out->y = 0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
884 out->x = 0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
885 out->z = 65536;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
886 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
887 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
888 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
889 float invmag = 1.0 / mag;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
890 out->x = invmag * nx * 65536.0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
891 out->y = invmag * ny * 65536.0;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 135
diff changeset
892 out->z = invmag * nz * 65536.0;
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
0
Ritor1
parents:
diff changeset
896 //----- (0046DEF2) --------------------------------------------------------
Ritor1
parents:
diff changeset
897 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
898 {
Ritor1
parents:
diff changeset
899 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
900
Ritor1
parents:
diff changeset
901 result = uLayingItemID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
902 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 )
0
Ritor1
parents:
diff changeset
903 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
Ritor1
parents:
diff changeset
904 return result;
Ritor1
parents:
diff changeset
905 }
Ritor1
parents:
diff changeset
906
Ritor1
parents:
diff changeset
907 //----- (0046DF1A) --------------------------------------------------------
Ritor1
parents:
diff changeset
908 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2)
Ritor1
parents:
diff changeset
909 {
Ritor1
parents:
diff changeset
910 Actor *v2; // edi@1
Ritor1
parents:
diff changeset
911 unsigned __int16 v3; // ax@1
Ritor1
parents:
diff changeset
912 int v4; // esi@6
Ritor1
parents:
diff changeset
913 int v5; // ecx@8
Ritor1
parents:
diff changeset
914 int v6; // eax@10
Ritor1
parents:
diff changeset
915 int v7; // edx@12
Ritor1
parents:
diff changeset
916 int v8; // ecx@14
Ritor1
parents:
diff changeset
917 int v9; // eax@14
Ritor1
parents:
diff changeset
918 int v10; // ebx@14
Ritor1
parents:
diff changeset
919 int v11; // esi@14
Ritor1
parents:
diff changeset
920 int v12; // ebx@15
Ritor1
parents:
diff changeset
921 int v13; // ebx@17
Ritor1
parents:
diff changeset
922 unsigned int v14; // eax@20
Ritor1
parents:
diff changeset
923 signed int result; // eax@21
Ritor1
parents:
diff changeset
924 int v16; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
925 int v17; // [sp+10h] [bp-Ch]@14
Ritor1
parents:
diff changeset
926 int v18; // [sp+14h] [bp-8h]@14
Ritor1
parents:
diff changeset
927 int v19; // [sp+18h] [bp-4h]@14
Ritor1
parents:
diff changeset
928
Ritor1
parents:
diff changeset
929 v16 = a1;
Ritor1
parents:
diff changeset
930 v2 = &pActors[a1];
Ritor1
parents:
diff changeset
931 v3 = v2->uAIState;
Ritor1
parents:
diff changeset
932 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 )
Ritor1
parents:
diff changeset
933 goto LABEL_25;
Ritor1
parents:
diff changeset
934 v4 = v2->uActorRadius;
Ritor1
parents:
diff changeset
935 if ( a2 )
Ritor1
parents:
diff changeset
936 v4 = a2;
Ritor1
parents:
diff changeset
937 v5 = v2->vPosition.x;
Ritor1
parents:
diff changeset
938 if ( stru_721530.sMaxX > v5 + v4
Ritor1
parents:
diff changeset
939 || stru_721530.sMinX < v5 - v4
Ritor1
parents:
diff changeset
940 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4)
Ritor1
parents:
diff changeset
941 || stru_721530.sMinY < v6 - v4
Ritor1
parents:
diff changeset
942 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight)
Ritor1
parents:
diff changeset
943 || stru_721530.sMinZ < v7
Ritor1
parents:
diff changeset
944 || (v8 = v5 - stru_721530.normal.x,
Ritor1
parents:
diff changeset
945 v9 = v6 - stru_721530.normal.y,
Ritor1
parents:
diff changeset
946 v10 = stru_721530.prolly_normal_d + v4,
Ritor1
parents:
diff changeset
947 v17 = stru_721530.prolly_normal_d + v4,
Ritor1
parents:
diff changeset
948 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16,
Ritor1
parents:
diff changeset
949 v18 = v8,
Ritor1
parents:
diff changeset
950 v19 = v9,
Ritor1
parents:
diff changeset
951 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10)
Ritor1
parents:
diff changeset
952 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0)
Ritor1
parents:
diff changeset
953 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z )
Ritor1
parents:
diff changeset
954 {
Ritor1
parents:
diff changeset
955 LABEL_25:
Ritor1
parents:
diff changeset
956 result = 0;
Ritor1
parents:
diff changeset
957 }
Ritor1
parents:
diff changeset
958 else
Ritor1
parents:
diff changeset
959 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
960 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11);
0
Ritor1
parents:
diff changeset
961 if ( v13 < 0 )
Ritor1
parents:
diff changeset
962 v13 = 0;
Ritor1
parents:
diff changeset
963 if ( v13 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
964 {
Ritor1
parents:
diff changeset
965 stru_721530.field_7C = v13;
Ritor1
parents:
diff changeset
966 v14 = 8 * v16;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
967 LOBYTE(v14) = PID(OBJECT_Actor,v16);
0
Ritor1
parents:
diff changeset
968 stru_721530.uFaceID = v14;
Ritor1
parents:
diff changeset
969 }
Ritor1
parents:
diff changeset
970 result = 1;
Ritor1
parents:
diff changeset
971 }
Ritor1
parents:
diff changeset
972 return result;
Ritor1
parents:
diff changeset
973 }
Ritor1
parents:
diff changeset
974 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
Ritor1
parents:
diff changeset
975
Ritor1
parents:
diff changeset
976 //----- (0046E0B2) --------------------------------------------------------
Ritor1
parents:
diff changeset
977 void __cdecl _46E0B2_collide_against_decorations()
Ritor1
parents:
diff changeset
978 {
Ritor1
parents:
diff changeset
979 BLVSector *v0; // ebp@1
Ritor1
parents:
diff changeset
980 LevelDecoration *v1; // edi@2
Ritor1
parents:
diff changeset
981 DecorationDesc *v2; // esi@3
Ritor1
parents:
diff changeset
982 int v3; // edx@4
Ritor1
parents:
diff changeset
983 int v4; // eax@4
Ritor1
parents:
diff changeset
984 int v5; // ecx@6
Ritor1
parents:
diff changeset
985 int v6; // ebx@8
Ritor1
parents:
diff changeset
986 int v7; // esi@8
Ritor1
parents:
diff changeset
987 int v8; // ebx@10
Ritor1
parents:
diff changeset
988 int v9; // esi@11
Ritor1
parents:
diff changeset
989 int v10; // edi@12
Ritor1
parents:
diff changeset
990 int v11; // eax@12
Ritor1
parents:
diff changeset
991 int v12; // esi@14
Ritor1
parents:
diff changeset
992 unsigned int v13; // eax@17
Ritor1
parents:
diff changeset
993 signed int i; // [sp+4h] [bp-14h]@1
Ritor1
parents:
diff changeset
994 int v15; // [sp+8h] [bp-10h]@10
Ritor1
parents:
diff changeset
995 int v16; // [sp+Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
996 int v17; // [sp+10h] [bp-8h]@10
Ritor1
parents:
diff changeset
997 int v18; // [sp+14h] [bp-4h]@8
Ritor1
parents:
diff changeset
998
Ritor1
parents:
diff changeset
999 v0 = &pIndoor->pSectors[stru_721530.uSectorID];
Ritor1
parents:
diff changeset
1000 for ( i = 0; i < v0->uNumDecorations; ++i )
Ritor1
parents:
diff changeset
1001 {
Ritor1
parents:
diff changeset
1002 v1 = &pLevelDecorations[v0->pDecorationIDs[i]];
Ritor1
parents:
diff changeset
1003 if ( !(v1->field_2 & 0x20) )
Ritor1
parents:
diff changeset
1004 {
Ritor1
parents:
diff changeset
1005 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
1006 if (!v2->CanMoveThrough())
0
Ritor1
parents:
diff changeset
1007 {
Ritor1
parents:
diff changeset
1008 v3 = v2->uRadius;
Ritor1
parents:
diff changeset
1009 v4 = v1->vPosition.x;
Ritor1
parents:
diff changeset
1010 if ( stru_721530.sMaxX <= v4 + v3 )
Ritor1
parents:
diff changeset
1011 {
Ritor1
parents:
diff changeset
1012 if ( stru_721530.sMinX >= v4 - v3 )
Ritor1
parents:
diff changeset
1013 {
Ritor1
parents:
diff changeset
1014 v5 = v1->vPosition.y;
Ritor1
parents:
diff changeset
1015 if ( stru_721530.sMaxY <= v5 + v3 )
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 if ( stru_721530.sMinY >= v5 - v3 )
Ritor1
parents:
diff changeset
1018 {
Ritor1
parents:
diff changeset
1019 v6 = v2->uDecorationHeight;
Ritor1
parents:
diff changeset
1020 v7 = v1->vPosition.z;
Ritor1
parents:
diff changeset
1021 v18 = v6;
Ritor1
parents:
diff changeset
1022 if ( stru_721530.sMaxZ <= v7 + v6 )
Ritor1
parents:
diff changeset
1023 {
Ritor1
parents:
diff changeset
1024 if ( stru_721530.sMinZ >= v7 )
Ritor1
parents:
diff changeset
1025 {
Ritor1
parents:
diff changeset
1026 v16 = v4 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
1027 v15 = v5 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
1028 v8 = stru_721530.prolly_normal_d + v3;
Ritor1
parents:
diff changeset
1029 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
1030 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
1031 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 )
Ritor1
parents:
diff changeset
1032 {
Ritor1
parents:
diff changeset
1033 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
1034 if ( v9 > 0 )
Ritor1
parents:
diff changeset
1035 {
Ritor1
parents:
diff changeset
1036 v10 = v1->vPosition.z;
Ritor1
parents:
diff changeset
1037 v11 = stru_721530.normal.z
Ritor1
parents:
diff changeset
1038 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16);
Ritor1
parents:
diff changeset
1039 if ( v11 >= v10 )
Ritor1
parents:
diff changeset
1040 {
Ritor1
parents:
diff changeset
1041 if ( v11 <= v18 + v10 )
Ritor1
parents:
diff changeset
1042 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
1043 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17);
0
Ritor1
parents:
diff changeset
1044 if ( v12 < 0 )
Ritor1
parents:
diff changeset
1045 v12 = 0;
Ritor1
parents:
diff changeset
1046 if ( v12 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
1047 {
Ritor1
parents:
diff changeset
1048 stru_721530.field_7C = v12;
Ritor1
parents:
diff changeset
1049 v13 = 8 * v0->pDecorationIDs[i];
Ritor1
parents:
diff changeset
1050 LOBYTE(v13) = v13 | 5;
Ritor1
parents:
diff changeset
1051 stru_721530.uFaceID = v13;
Ritor1
parents:
diff changeset
1052 }
Ritor1
parents:
diff changeset
1053 }
Ritor1
parents:
diff changeset
1054 }
Ritor1
parents:
diff changeset
1055 }
Ritor1
parents:
diff changeset
1056 }
Ritor1
parents:
diff changeset
1057 }
Ritor1
parents:
diff changeset
1058 }
Ritor1
parents:
diff changeset
1059 }
Ritor1
parents:
diff changeset
1060 }
Ritor1
parents:
diff changeset
1061 }
Ritor1
parents:
diff changeset
1062 }
Ritor1
parents:
diff changeset
1063 }
Ritor1
parents:
diff changeset
1064 }
Ritor1
parents:
diff changeset
1065 }
Ritor1
parents:
diff changeset
1066 }
Ritor1
parents:
diff changeset
1067
Ritor1
parents:
diff changeset
1068 //----- (0046E26D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1069 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2)
Ritor1
parents:
diff changeset
1070 {
Ritor1
parents:
diff changeset
1071 int v2; // edx@5
Ritor1
parents:
diff changeset
1072 unsigned __int16 *v3; // eax@5
Ritor1
parents:
diff changeset
1073 unsigned __int16 v4; // ax@6
Ritor1
parents:
diff changeset
1074 LevelDecoration *v5; // edi@7
Ritor1
parents:
diff changeset
1075 DecorationDesc *v6; // esi@8
Ritor1
parents:
diff changeset
1076 int v7; // edx@9
Ritor1
parents:
diff changeset
1077 int v8; // eax@9
Ritor1
parents:
diff changeset
1078 int v9; // ecx@11
Ritor1
parents:
diff changeset
1079 int v10; // ebx@13
Ritor1
parents:
diff changeset
1080 int v11; // esi@13
Ritor1
parents:
diff changeset
1081 int v12; // ebp@15
Ritor1
parents:
diff changeset
1082 int v13; // ebx@15
Ritor1
parents:
diff changeset
1083 int v14; // esi@16
Ritor1
parents:
diff changeset
1084 int v15; // edi@17
Ritor1
parents:
diff changeset
1085 int v16; // eax@17
Ritor1
parents:
diff changeset
1086 int v17; // esi@19
Ritor1
parents:
diff changeset
1087 char v18; // zf@23
Ritor1
parents:
diff changeset
1088 int v19; // [sp+0h] [bp-10h]@15
Ritor1
parents:
diff changeset
1089 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5
Ritor1
parents:
diff changeset
1090 int v21; // [sp+8h] [bp-8h]@15
Ritor1
parents:
diff changeset
1091 int v22; // [sp+Ch] [bp-4h]@13
Ritor1
parents:
diff changeset
1092
Ritor1
parents:
diff changeset
1093 if ( a1 >= 0 )
Ritor1
parents:
diff changeset
1094 {
Ritor1
parents:
diff changeset
1095 if ( a1 <= 127 )
Ritor1
parents:
diff changeset
1096 {
Ritor1
parents:
diff changeset
1097 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
1098 {
Ritor1
parents:
diff changeset
1099 if ( a2 <= 127 )
Ritor1
parents:
diff changeset
1100 {
Ritor1
parents:
diff changeset
1101 v2 = a1 + (a2 << 7);
Ritor1
parents:
diff changeset
1102 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]];
Ritor1
parents:
diff changeset
1103 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]];
Ritor1
parents:
diff changeset
1104 if ( v3 )
Ritor1
parents:
diff changeset
1105 {
Ritor1
parents:
diff changeset
1106 do
Ritor1
parents:
diff changeset
1107 {
Ritor1
parents:
diff changeset
1108 v4 = *v3;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1109 if ( PID_TYPE(v4) == OBJECT_Decoration)
0
Ritor1
parents:
diff changeset
1110 {
Ritor1
parents:
diff changeset
1111 v5 = &pLevelDecorations[(signed __int16)v4 >> 3];
Ritor1
parents:
diff changeset
1112 if ( !(v5->field_2 & 0x20) )
Ritor1
parents:
diff changeset
1113 {
Ritor1
parents:
diff changeset
1114 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID];
380
2f67762d04f6 DecorationDesc: flags -> methods
Nomad
parents: 373
diff changeset
1115 if (!v6->CanMoveThrough())
0
Ritor1
parents:
diff changeset
1116 {
Ritor1
parents:
diff changeset
1117 v7 = v6->uRadius;
Ritor1
parents:
diff changeset
1118 v8 = v5->vPosition.x;
Ritor1
parents:
diff changeset
1119 if ( stru_721530.sMaxX <= v8 + v7 )
Ritor1
parents:
diff changeset
1120 {
Ritor1
parents:
diff changeset
1121 if ( stru_721530.sMinX >= v8 - v7 )
Ritor1
parents:
diff changeset
1122 {
Ritor1
parents:
diff changeset
1123 v9 = v5->vPosition.y;
Ritor1
parents:
diff changeset
1124 if ( stru_721530.sMaxY <= v9 + v7 )
Ritor1
parents:
diff changeset
1125 {
Ritor1
parents:
diff changeset
1126 if ( stru_721530.sMinY >= v9 - v7 )
Ritor1
parents:
diff changeset
1127 {
Ritor1
parents:
diff changeset
1128 v10 = v6->uDecorationHeight;
Ritor1
parents:
diff changeset
1129 v11 = v5->vPosition.z;
Ritor1
parents:
diff changeset
1130 v22 = v10;
Ritor1
parents:
diff changeset
1131 if ( stru_721530.sMaxZ <= v11 + v10 )
Ritor1
parents:
diff changeset
1132 {
Ritor1
parents:
diff changeset
1133 if ( stru_721530.sMinZ >= v11 )
Ritor1
parents:
diff changeset
1134 {
Ritor1
parents:
diff changeset
1135 v12 = v8 - stru_721530.normal.x;
Ritor1
parents:
diff changeset
1136 v19 = v9 - stru_721530.normal.y;
Ritor1
parents:
diff changeset
1137 v13 = stru_721530.prolly_normal_d + v7;
Ritor1
parents:
diff changeset
1138 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y
Ritor1
parents:
diff changeset
1139 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
Ritor1
parents:
diff changeset
1140 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 )
Ritor1
parents:
diff changeset
1141 {
Ritor1
parents:
diff changeset
1142 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16;
Ritor1
parents:
diff changeset
1143 if ( v14 > 0 )
Ritor1
parents:
diff changeset
1144 {
Ritor1
parents:
diff changeset
1145 v15 = v5->vPosition.z;
Ritor1
parents:
diff changeset
1146 v16 = stru_721530.normal.z
Ritor1
parents:
diff changeset
1147 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16);
Ritor1
parents:
diff changeset
1148 if ( v16 >= v15 )
Ritor1
parents:
diff changeset
1149 {
Ritor1
parents:
diff changeset
1150 if ( v16 <= v22 + v15 )
Ritor1
parents:
diff changeset
1151 {
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
1152 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21);
0
Ritor1
parents:
diff changeset
1153 if ( v17 < 0 )
Ritor1
parents:
diff changeset
1154 v17 = 0;
Ritor1
parents:
diff changeset
1155 if ( v17 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
1156 {
Ritor1
parents:
diff changeset
1157 stru_721530.field_7C = v17;
Ritor1
parents:
diff changeset
1158 stru_721530.uFaceID = (signed __int16)*v20;
Ritor1
parents:
diff changeset
1159 }
Ritor1
parents:
diff changeset
1160 }
Ritor1
parents:
diff changeset
1161 }
Ritor1
parents:
diff changeset
1162 }
Ritor1
parents:
diff changeset
1163 }
Ritor1
parents:
diff changeset
1164 }
Ritor1
parents:
diff changeset
1165 }
Ritor1
parents:
diff changeset
1166 }
Ritor1
parents:
diff changeset
1167 }
Ritor1
parents:
diff changeset
1168 }
Ritor1
parents:
diff changeset
1169 }
Ritor1
parents:
diff changeset
1170 }
Ritor1
parents:
diff changeset
1171 }
Ritor1
parents:
diff changeset
1172 }
Ritor1
parents:
diff changeset
1173 v3 = v20 + 1;
Ritor1
parents:
diff changeset
1174 v18 = *v20 == 0;
Ritor1
parents:
diff changeset
1175 ++v20;
Ritor1
parents:
diff changeset
1176 }
Ritor1
parents:
diff changeset
1177 while ( !v18 );
Ritor1
parents:
diff changeset
1178 }
Ritor1
parents:
diff changeset
1179 }
Ritor1
parents:
diff changeset
1180 }
Ritor1
parents:
diff changeset
1181 }
Ritor1
parents:
diff changeset
1182 }
Ritor1
parents:
diff changeset
1183 }
Ritor1
parents:
diff changeset
1184
Ritor1
parents:
diff changeset
1185 //----- (00486F92) --------------------------------------------------------
Ritor1
parents:
diff changeset
1186 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans()
Ritor1
parents:
diff changeset
1187 {
Ritor1
parents:
diff changeset
1188 Span *v0; // ebx@1
Ritor1
parents:
diff changeset
1189 int v1; // eax@2
Ritor1
parents:
diff changeset
1190 Edge *v2; // ecx@3
Ritor1
parents:
diff changeset
1191 Edge *v3; // edx@3
Ritor1
parents:
diff changeset
1192 Edge *v4; // esi@6
Ritor1
parents:
diff changeset
1193 Edge *v5; // eax@7
Ritor1
parents:
diff changeset
1194 Edge *v6; // ecx@8
Ritor1
parents:
diff changeset
1195 Surf *v7; // esi@11
Ritor1
parents:
diff changeset
1196 double v8; // st7@13
Ritor1
parents:
diff changeset
1197 Surf *v9; // edi@13
Ritor1
parents:
diff changeset
1198 double v10; // st6@13
Ritor1
parents:
diff changeset
1199 double v11; // st7@14
Ritor1
parents:
diff changeset
1200 signed __int64 v12; // qax@14
Ritor1
parents:
diff changeset
1201 stru148 *v13; // eax@15
Ritor1
parents:
diff changeset
1202 Span *v14; // ecx@17
Ritor1
parents:
diff changeset
1203 double v15; // st7@28
Ritor1
parents:
diff changeset
1204 signed __int64 v16; // qax@28
Ritor1
parents:
diff changeset
1205 stru148 *v17; // eax@29
Ritor1
parents:
diff changeset
1206 Span *v18; // ecx@31
Ritor1
parents:
diff changeset
1207 Edge *i; // eax@40
Ritor1
parents:
diff changeset
1208 Edge *v20; // ecx@43
Ritor1
parents:
diff changeset
1209 Edge *v21; // esi@44
Ritor1
parents:
diff changeset
1210 double v22; // st7@45
Ritor1
parents:
diff changeset
1211 Edge *v23; // edx@48
Ritor1
parents:
diff changeset
1212 unsigned int v24; // [sp+10h] [bp-10h]@2
Ritor1
parents:
diff changeset
1213 float v25; // [sp+14h] [bp-Ch]@3
Ritor1
parents:
diff changeset
1214 Edge *v26; // [sp+18h] [bp-8h]@8
Ritor1
parents:
diff changeset
1215 unsigned int v27; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1216
Ritor1
parents:
diff changeset
1217 v0 = pSpans;
Ritor1
parents:
diff changeset
1218 stru_80C9D8.pSurf = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1219 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
1220 stru_80C9A4.pSurf = &stru_80C980;
Ritor1
parents:
diff changeset
1221 stru_80C980.pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
1222 stru_80C980.pNext = &stru_80C980;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1223 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
1224 stru_80C980.field_8 = 0.0;
Ritor1
parents:
diff changeset
1225 stru_80C980.field_4 = 0.0;
Ritor1
parents:
diff changeset
1226 stru_80C9D8.pNext = &stru_80C9A4;
Ritor1
parents:
diff changeset
1227 stru_80C9D8.pPrev = 0;
Ritor1
parents:
diff changeset
1228 stru_80C9D8.field_8 = 1;
Ritor1
parents:
diff changeset
1229 stru_80C9A4.pNext = 0;
Ritor1
parents:
diff changeset
1230 stru_80C9A4.pPrev = &stru_80C9D8;
Ritor1
parents:
diff changeset
1231 stru_80C9A4.field_8 = 0;
Ritor1
parents:
diff changeset
1232 LODWORD(stru_80C980.field_0) = 0xC97423F0u;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1233 v27 = pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1234 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1235 {
Ritor1
parents:
diff changeset
1236 LABEL_51:
Ritor1
parents:
diff changeset
1237 v0->field_8 = -1;
Ritor1
parents:
diff changeset
1238 }
Ritor1
parents:
diff changeset
1239 else
Ritor1
parents:
diff changeset
1240 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1241 v1 = 52 * pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1242 v24 = 52 * pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
1243 while ( 1 )
Ritor1
parents:
diff changeset
1244 {
Ritor1
parents:
diff changeset
1245 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1);
Ritor1
parents:
diff changeset
1246 v3 = &stru_80C9D8;
Ritor1
parents:
diff changeset
1247 v25 = (double)(signed int)v27;
Ritor1
parents:
diff changeset
1248 if ( v2 != &defaultEdge )
Ritor1
parents:
diff changeset
1249 {
Ritor1
parents:
diff changeset
1250 do
Ritor1
parents:
diff changeset
1251 {
Ritor1
parents:
diff changeset
1252 while ( 1 )
Ritor1
parents:
diff changeset
1253 {
Ritor1
parents:
diff changeset
1254 v4 = v3->pNext;
Ritor1
parents:
diff changeset
1255 if ( v2->field_0 <= (double)v4->field_0 )
Ritor1
parents:
diff changeset
1256 break;
Ritor1
parents:
diff changeset
1257 v3 = v3->pNext;
Ritor1
parents:
diff changeset
1258 }
Ritor1
parents:
diff changeset
1259 v5 = v2->pNext;
Ritor1
parents:
diff changeset
1260 v2->pNext = v4;
Ritor1
parents:
diff changeset
1261 v2->pPrev = v3;
Ritor1
parents:
diff changeset
1262 v3->pNext->pPrev = v2;
Ritor1
parents:
diff changeset
1263 v3->pNext = v2;
Ritor1
parents:
diff changeset
1264 v3 = v2;
Ritor1
parents:
diff changeset
1265 v2 = v5;
Ritor1
parents:
diff changeset
1266 }
Ritor1
parents:
diff changeset
1267 while ( v5 != &defaultEdge );
Ritor1
parents:
diff changeset
1268 }
Ritor1
parents:
diff changeset
1269 v6 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1270 stru_80C980.field_20 = 0;
Ritor1
parents:
diff changeset
1271 stru_80C980.field_22 = 1;
Ritor1
parents:
diff changeset
1272 v26 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1273 if ( stru_80C9D8.pNext )
Ritor1
parents:
diff changeset
1274 {
Ritor1
parents:
diff changeset
1275 while ( 1 )
Ritor1
parents:
diff changeset
1276 {
Ritor1
parents:
diff changeset
1277 v7 = v6->pSurf;
Ritor1
parents:
diff changeset
1278 if ( v6->field_8 )
Ritor1
parents:
diff changeset
1279 {
Ritor1
parents:
diff changeset
1280 ++v7->field_22;
Ritor1
parents:
diff changeset
1281 if ( v7->field_22 == 1 )
Ritor1
parents:
diff changeset
1282 {
Ritor1
parents:
diff changeset
1283 v8 = v6->field_0 + 2.0;
Ritor1
parents:
diff changeset
1284 v9 = stru_80C980.pNext;
Ritor1
parents:
diff changeset
1285 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0;
Ritor1
parents:
diff changeset
1286 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4
Ritor1
parents:
diff changeset
1287 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8
Ritor1
parents:
diff changeset
1288 + stru_80C980.pNext->field_0 )
Ritor1
parents:
diff changeset
1289 {
Ritor1
parents:
diff changeset
1290 do
Ritor1
parents:
diff changeset
1291 v9 = v9->pNext;
Ritor1
parents:
diff changeset
1292 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 );
Ritor1
parents:
diff changeset
1293 v7->pNext = v9;
Ritor1
parents:
diff changeset
1294 v7->pPrev = v9->pPrev;
Ritor1
parents:
diff changeset
1295 v9->pPrev->pNext = v7;
Ritor1
parents:
diff changeset
1296 v9->pPrev = v7;
Ritor1
parents:
diff changeset
1297 }
Ritor1
parents:
diff changeset
1298 else
Ritor1
parents:
diff changeset
1299 {
Ritor1
parents:
diff changeset
1300 v11 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
1301 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20);
Ritor1
parents:
diff changeset
1302 v0->field_C = v12;
Ritor1
parents:
diff changeset
1303 if ( (signed __int16)v12 > 0 )
Ritor1
parents:
diff changeset
1304 {
Ritor1
parents:
diff changeset
1305 v0->field_A = v27;
Ritor1
parents:
diff changeset
1306 v0->field_8 = v9->field_20;
Ritor1
parents:
diff changeset
1307 v13 = v9->pParent;
Ritor1
parents:
diff changeset
1308 v0->pParent = v13;
Ritor1
parents:
diff changeset
1309 if ( v13 )
Ritor1
parents:
diff changeset
1310 {
Ritor1
parents:
diff changeset
1311 if ( v13->prolly_head )
Ritor1
parents:
diff changeset
1312 {
Ritor1
parents:
diff changeset
1313 v14 = v13->prolly_tail;
Ritor1
parents:
diff changeset
1314 if ( !v14 )
Ritor1
parents:
diff changeset
1315 return;
Ritor1
parents:
diff changeset
1316 v14->pNext = v0;
Ritor1
parents:
diff changeset
1317 }
Ritor1
parents:
diff changeset
1318 else
Ritor1
parents:
diff changeset
1319 {
Ritor1
parents:
diff changeset
1320 v13->prolly_head = v0;
Ritor1
parents:
diff changeset
1321 }
Ritor1
parents:
diff changeset
1322 v13->prolly_tail = v0;
Ritor1
parents:
diff changeset
1323 }
Ritor1
parents:
diff changeset
1324 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
1325 return;
Ritor1
parents:
diff changeset
1326 ++v0;
Ritor1
parents:
diff changeset
1327 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
1328 }
Ritor1
parents:
diff changeset
1329 v6 = v26;
Ritor1
parents:
diff changeset
1330 v7->field_20 = (signed __int64)v11;
Ritor1
parents:
diff changeset
1331 v7->pNext = v9;
Ritor1
parents:
diff changeset
1332 v9->pPrev = v7;
Ritor1
parents:
diff changeset
1333 stru_80C980.pNext = v7;
Ritor1
parents:
diff changeset
1334 v7->pPrev = &stru_80C980;
Ritor1
parents:
diff changeset
1335 }
Ritor1
parents:
diff changeset
1336 }
Ritor1
parents:
diff changeset
1337 }
Ritor1
parents:
diff changeset
1338 else
Ritor1
parents:
diff changeset
1339 {
Ritor1
parents:
diff changeset
1340 --v7->field_22;
Ritor1
parents:
diff changeset
1341 if ( !v7->field_22 )
Ritor1
parents:
diff changeset
1342 {
Ritor1
parents:
diff changeset
1343 if ( stru_80C980.pNext == v7 )
Ritor1
parents:
diff changeset
1344 {
Ritor1
parents:
diff changeset
1345 v15 = v6->field_0 + 0.5;
Ritor1
parents:
diff changeset
1346 v16 = (signed __int64)(v15 - (double)v7->field_20);
Ritor1
parents:
diff changeset
1347 v0->field_C = v16;
Ritor1
parents:
diff changeset
1348 if ( (signed __int16)v16 > 0 )
Ritor1
parents:
diff changeset
1349 {
Ritor1
parents:
diff changeset
1350 v0->field_A = v27;
Ritor1
parents:
diff changeset
1351 v0->field_8 = v7->field_20;
Ritor1
parents:
diff changeset
1352 v17 = v7->pParent;
Ritor1
parents:
diff changeset
1353 v0->pParent = v17;
Ritor1
parents:
diff changeset
1354 if ( v17 )
Ritor1
parents:
diff changeset
1355 {
Ritor1
parents:
diff changeset
1356 if ( v17->prolly_head )
Ritor1
parents:
diff changeset
1357 {
Ritor1
parents:
diff changeset
1358 v18 = v17->prolly_tail;
Ritor1
parents:
diff changeset
1359 if ( !v18 )
Ritor1
parents:
diff changeset
1360 return;
Ritor1
parents:
diff changeset
1361 v18->pNext = v0;
Ritor1
parents:
diff changeset
1362 }
Ritor1
parents:
diff changeset
1363 else
Ritor1
parents:
diff changeset
1364 {
Ritor1
parents:
diff changeset
1365 v17->prolly_head = v0;
Ritor1
parents:
diff changeset
1366 }
Ritor1
parents:
diff changeset
1367 v17->prolly_tail = v0;
Ritor1
parents:
diff changeset
1368 }
Ritor1
parents:
diff changeset
1369 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 )
Ritor1
parents:
diff changeset
1370 return;
Ritor1
parents:
diff changeset
1371 ++v0;
Ritor1
parents:
diff changeset
1372 ++pOutdoorCamera->uNumSpans;
Ritor1
parents:
diff changeset
1373 }
Ritor1
parents:
diff changeset
1374 v7->pNext->field_20 = (signed __int64)v15;
Ritor1
parents:
diff changeset
1375 v6 = v26;
Ritor1
parents:
diff changeset
1376 }
Ritor1
parents:
diff changeset
1377 v7->pNext->pPrev = v7->pPrev;
Ritor1
parents:
diff changeset
1378 v7->pPrev->pNext = v7->pNext;
Ritor1
parents:
diff changeset
1379 }
Ritor1
parents:
diff changeset
1380 }
Ritor1
parents:
diff changeset
1381 v26 = v6->pNext;
Ritor1
parents:
diff changeset
1382 if ( !v26 )
Ritor1
parents:
diff changeset
1383 break;
Ritor1
parents:
diff changeset
1384 v6 = v6->pNext;
Ritor1
parents:
diff changeset
1385 }
Ritor1
parents:
diff changeset
1386 }
Ritor1
parents:
diff changeset
1387 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 )
Ritor1
parents:
diff changeset
1388 {
Ritor1
parents:
diff changeset
1389 i->pPrev->pNext = i->pNext;
Ritor1
parents:
diff changeset
1390 i->pNext->pPrev = i->pPrev;
Ritor1
parents:
diff changeset
1391 }
Ritor1
parents:
diff changeset
1392 v20 = stru_80C9D8.pNext;
Ritor1
parents:
diff changeset
1393 if ( stru_80C9D8.pNext != &stru_80C9A4 )
Ritor1
parents:
diff changeset
1394 break;
Ritor1
parents:
diff changeset
1395 LABEL_50:
Ritor1
parents:
diff changeset
1396 ++v27;
Ritor1
parents:
diff changeset
1397 v1 = v24 + 52;
Ritor1
parents:
diff changeset
1398 v24 += 52;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
1399 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1400 goto LABEL_51;
Ritor1
parents:
diff changeset
1401 }
Ritor1
parents:
diff changeset
1402 while ( 1 )
Ritor1
parents:
diff changeset
1403 {
Ritor1
parents:
diff changeset
1404 v21 = v20->pNext;
Ritor1
parents:
diff changeset
1405 if ( !v21 )
Ritor1
parents:
diff changeset
1406 break;
Ritor1
parents:
diff changeset
1407 v22 = v20->field_4 + v20->field_0;
Ritor1
parents:
diff changeset
1408 v20->field_0 = v22;
Ritor1
parents:
diff changeset
1409 if ( v22 < stru_80C9D8.field_0 )
Ritor1
parents:
diff changeset
1410 v20->field_0 = stru_80C9D8.field_0 + 0.0000001;
Ritor1
parents:
diff changeset
1411 while ( 1 )
Ritor1
parents:
diff changeset
1412 {
Ritor1
parents:
diff changeset
1413 v23 = v20->pPrev;
Ritor1
parents:
diff changeset
1414 if ( v20->field_0 >= (double)v23->field_0 )
Ritor1
parents:
diff changeset
1415 break;
Ritor1
parents:
diff changeset
1416 v23->pNext = v20->pNext;
Ritor1
parents:
diff changeset
1417 v20->pNext->pPrev = v23;
Ritor1
parents:
diff changeset
1418 v23->pPrev->pNext = v20;
Ritor1
parents:
diff changeset
1419 v20->pPrev = v23->pPrev;
Ritor1
parents:
diff changeset
1420 v20->pNext = v23;
Ritor1
parents:
diff changeset
1421 v23->pPrev = v20;
Ritor1
parents:
diff changeset
1422 }
Ritor1
parents:
diff changeset
1423 v20 = v21;
Ritor1
parents:
diff changeset
1424 if ( v21 == &stru_80C9A4 )
Ritor1
parents:
diff changeset
1425 goto LABEL_50;
Ritor1
parents:
diff changeset
1426 }
Ritor1
parents:
diff changeset
1427 }
Ritor1
parents:
diff changeset
1428 }
Ritor1
parents:
diff changeset
1429 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
1430
Ritor1
parents:
diff changeset
1431 //----- (00487355) --------------------------------------------------------
Ritor1
parents:
diff changeset
1432 bool OutdoorCamera::_487355()
Ritor1
parents:
diff changeset
1433 {
Ritor1
parents:
diff changeset
1434 int v0; // esi@1
Ritor1
parents:
diff changeset
1435 stru148 *v1; // edi@2
Ritor1
parents:
diff changeset
1436 bool result; // eax@3
Ritor1
parents:
diff changeset
1437
Ritor1
parents:
diff changeset
1438 v0 = 0;
Ritor1
parents:
diff changeset
1439 if ( pOutdoorCamera->numStru148s > 0 )
Ritor1
parents:
diff changeset
1440 {
Ritor1
parents:
diff changeset
1441 v1 = array_77EC08;
Ritor1
parents:
diff changeset
1442 do
Ritor1
parents:
diff changeset
1443 {
Ritor1
parents:
diff changeset
1444 result = pGame->pLightmapBuilder->_45D3C7(v1);
Ritor1
parents:
diff changeset
1445 ++v0;
Ritor1
parents:
diff changeset
1446 ++v1;
Ritor1
parents:
diff changeset
1447 }
Ritor1
parents:
diff changeset
1448 while ( v0 < pOutdoorCamera->numStru148s );
Ritor1
parents:
diff changeset
1449 }
Ritor1
parents:
diff changeset
1450 return result;
Ritor1
parents:
diff changeset
1451 }
Ritor1
parents:
diff changeset
1452
Ritor1
parents:
diff changeset
1453 //----- (00487DA9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1454 void __cdecl sub_487DA9()
Ritor1
parents:
diff changeset
1455 {
Ritor1
parents:
diff changeset
1456 char *v0; // eax@1
Ritor1
parents:
diff changeset
1457
Ritor1
parents:
diff changeset
1458 v0 = &array_77EC08[0].field_108;
Ritor1
parents:
diff changeset
1459 do
Ritor1
parents:
diff changeset
1460 {
Ritor1
parents:
diff changeset
1461 *v0 = 0;
Ritor1
parents:
diff changeset
1462 v0 += 268;
Ritor1
parents:
diff changeset
1463 }
Ritor1
parents:
diff changeset
1464 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] );
Ritor1
parents:
diff changeset
1465 }
Ritor1
parents:
diff changeset
1466
Ritor1
parents:
diff changeset
1467 //----- (00487DBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1468 void Software_ResetNewEdges()
Ritor1
parents:
diff changeset
1469 {
Ritor1
parents:
diff changeset
1470 int v0; // ecx@1
Ritor1
parents:
diff changeset
1471 Edge **v1; // eax@1
Ritor1
parents:
diff changeset
1472 signed int v2; // eax@3
Ritor1
parents:
diff changeset
1473
Ritor1
parents:
diff changeset
1474 v0 = 0;
Ritor1
parents:
diff changeset
1475 v1 = ptr_80CA10;
Ritor1
parents:
diff changeset
1476 do
Ritor1
parents:
diff changeset
1477 {
Ritor1
parents:
diff changeset
1478 ++v0;
Ritor1
parents:
diff changeset
1479 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge;
Ritor1
parents:
diff changeset
1480 *v1 = 0;
Ritor1
parents:
diff changeset
1481 ++v1;
Ritor1
parents:
diff changeset
1482 }
Ritor1
parents:
diff changeset
1483 while ( (signed int)v1 < (signed int)&unk_80D190 );
Ritor1
parents:
diff changeset
1484 v2 = 2000;
Ritor1
parents:
diff changeset
1485 do
Ritor1
parents:
diff changeset
1486 {
Ritor1
parents:
diff changeset
1487 pSurfs->field_22 = 0;
Ritor1
parents:
diff changeset
1488 --v2;
Ritor1
parents:
diff changeset
1489 }
Ritor1
parents:
diff changeset
1490 while ( v2 );
Ritor1
parents:
diff changeset
1491 }
Ritor1
parents:
diff changeset
1492 // 4EC3EC: using guessed type Edge defaultEdge;
Ritor1
parents:
diff changeset
1493
Ritor1
parents:
diff changeset
1494 //----- (0048958E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1495 stru12_MemoryBlock::stru12_MemoryBlock(int a2)
Ritor1
parents:
diff changeset
1496 {
Ritor1
parents:
diff changeset
1497 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
1498 void *v3; // eax@1
Ritor1
parents:
diff changeset
1499 void *v4; // ecx@1
Ritor1
parents:
diff changeset
1500 stru12_MemoryBlock *result; // eax@1
Ritor1
parents:
diff changeset
1501
Ritor1
parents:
diff changeset
1502 v2 = this;
Ritor1
parents:
diff changeset
1503 v3 = operator new(8 * a2 + 16);
Ritor1
parents:
diff changeset
1504 v2->pBlockBase = v3;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
1505 v4 = (char *)v3 + PID_TYPE(-(signed int)v3);
0
Ritor1
parents:
diff changeset
1506 result = v2;
Ritor1
parents:
diff changeset
1507 v2->pAlignedBlock = v4;
Ritor1
parents:
diff changeset
1508 }
Ritor1
parents:
diff changeset
1509
Ritor1
parents:
diff changeset
1510 //----- (004895B7) --------------------------------------------------------
Ritor1
parents:
diff changeset
1511 stru12::stru12(stru11 *pStru11)
Ritor1
parents:
diff changeset
1512 {
Ritor1
parents:
diff changeset
1513 stru12 *v2; // esi@1
Ritor1
parents:
diff changeset
1514
Ritor1
parents:
diff changeset
1515 v2 = this;
Ritor1
parents:
diff changeset
1516 this->field_44 = 0x41000000u;
Ritor1
parents:
diff changeset
1517 this->field_4C = 0x46000000u;
Ritor1
parents:
diff changeset
1518 //this->vdestructor_ptr = stru12::_4898E6;
Ritor1
parents:
diff changeset
1519 this->field_48 = 0;
Ritor1
parents:
diff changeset
1520 this->field_50 = 0;
Ritor1
parents:
diff changeset
1521 this->field_54 = 0x33D6BF95u;
Ritor1
parents:
diff changeset
1522 this->field_58 = 0;
Ritor1
parents:
diff changeset
1523
Ritor1
parents:
diff changeset
1524 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1525 v2->pMemBlocks[i] = new stru12_MemoryBlock(640);
Ritor1
parents:
diff changeset
1526 }
Ritor1
parents:
diff changeset
1527
Ritor1
parents:
diff changeset
1528 //----- (00489810) --------------------------------------------------------
Ritor1
parents:
diff changeset
1529 stru12::~stru12()
Ritor1
parents:
diff changeset
1530 {
Ritor1
parents:
diff changeset
1531 for (int i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1532 delete pMemBlocks[i];
Ritor1
parents:
diff changeset
1533 }
Ritor1
parents:
diff changeset
1534
Ritor1
parents:
diff changeset
1535 //----- (004898BF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1536 stru12_MemoryBlock::~stru12_MemoryBlock()
Ritor1
parents:
diff changeset
1537 {
Ritor1
parents:
diff changeset
1538 stru12_MemoryBlock *v2; // esi@1
Ritor1
parents:
diff changeset
1539 void *v3; // ST00_4@1
Ritor1
parents:
diff changeset
1540
Ritor1
parents:
diff changeset
1541 v2 = this;
Ritor1
parents:
diff changeset
1542 v3 = this->pBlockBase;
Ritor1
parents:
diff changeset
1543 this->pAlignedBlock = 0;
Ritor1
parents:
diff changeset
1544 free(v3);
Ritor1
parents:
diff changeset
1545 v2->pBlockBase = 0;
Ritor1
parents:
diff changeset
1546 /*if ( a2 & 1 )
Ritor1
parents:
diff changeset
1547 free(v2);*/
Ritor1
parents:
diff changeset
1548 }
Ritor1
parents:
diff changeset
1549
Ritor1
parents:
diff changeset
1550 //----- (004898E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1551 void stru12::_4898E6()
Ritor1
parents:
diff changeset
1552 {
Ritor1
parents:
diff changeset
1553 void *v1; // eax@1
Ritor1
parents:
diff changeset
1554 void *v2; // edx@1
Ritor1
parents:
diff changeset
1555 char *v3; // edi@2
Ritor1
parents:
diff changeset
1556 double v4; // st7@2
Ritor1
parents:
diff changeset
1557 char *v5; // ebx@2
Ritor1
parents:
diff changeset
1558 double v6; // st6@3
Ritor1
parents:
diff changeset
1559 double v7; // st5@3
Ritor1
parents:
diff changeset
1560 double v8; // st4@3
Ritor1
parents:
diff changeset
1561 int v9; // esi@3
Ritor1
parents:
diff changeset
1562 double v10; // st3@3
Ritor1
parents:
diff changeset
1563 float v11; // ST34_4@5
Ritor1
parents:
diff changeset
1564 double v12; // st6@10
Ritor1
parents:
diff changeset
1565 double v13; // ST0C_8@10
Ritor1
parents:
diff changeset
1566 char *v14; // [sp+14h] [bp-44h]@2
Ritor1
parents:
diff changeset
1567 char *v15; // [sp+18h] [bp-40h]@2
Ritor1
parents:
diff changeset
1568 char *v16; // [sp+1Ch] [bp-3Ch]@2
Ritor1
parents:
diff changeset
1569 char *v17; // [sp+20h] [bp-38h]@2
Ritor1
parents:
diff changeset
1570 char *v18; // [sp+24h] [bp-34h]@2
Ritor1
parents:
diff changeset
1571 float v19; // [sp+30h] [bp-28h]@3
Ritor1
parents:
diff changeset
1572 float v20; // [sp+38h] [bp-20h]@3
Ritor1
parents:
diff changeset
1573 char *v21; // [sp+3Ch] [bp-1Ch]@2
Ritor1
parents:
diff changeset
1574 int v22; // [sp+40h] [bp-18h]@1
Ritor1
parents:
diff changeset
1575 char *v23; // [sp+44h] [bp-14h]@2
Ritor1
parents:
diff changeset
1576 char *v24; // [sp+48h] [bp-10h]@2
Ritor1
parents:
diff changeset
1577 int v25; // [sp+4Ch] [bp-Ch]@2
Ritor1
parents:
diff changeset
1578 float v26; // [sp+50h] [bp-8h]@3
Ritor1
parents:
diff changeset
1579 float v27; // [sp+54h] [bp-4h]@3
Ritor1
parents:
diff changeset
1580
731
de482c901171 Moved unused CPU detection stuff to a separate file.
Nomad
parents: 730
diff changeset
1581 __debugbreak();
0
Ritor1
parents:
diff changeset
1582 v22 = 0;
Ritor1
parents:
diff changeset
1583 v1 = this->pMemBlocks[1]->pAlignedBlock;
Ritor1
parents:
diff changeset
1584 v2 = this->pMemBlocks[6]->pAlignedBlock;
Ritor1
parents:
diff changeset
1585 if ( this->field_8C > 0 )
Ritor1
parents:
diff changeset
1586 {
Ritor1
parents:
diff changeset
1587 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
1588 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1);
Ritor1
parents:
diff changeset
1589 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1590 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1591 v25 = (int)v1 - (int)v2;
Ritor1
parents:
diff changeset
1592 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1593 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1594 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1595 v4 = 1.0;
Ritor1
parents:
diff changeset
1596 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1597 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1598 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2);
Ritor1
parents:
diff changeset
1599 do
Ritor1
parents:
diff changeset
1600 {
Ritor1
parents:
diff changeset
1601 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x;
Ritor1
parents:
diff changeset
1602 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y;
Ritor1
parents:
diff changeset
1603 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z;
Ritor1
parents:
diff changeset
1604 v7 = pIndoorCamera->fRotationYCosine;
Ritor1
parents:
diff changeset
1605 v8 = pIndoorCamera->fRotationYSine;
Ritor1
parents:
diff changeset
1606 v20 = pIndoorCamera->fRotationXCosine;
Ritor1
parents:
diff changeset
1607 v19 = pIndoorCamera->fRotationXSine;
Ritor1
parents:
diff changeset
1608 v9 = (int)((char *)v2 + (int)v21);
Ritor1
parents:
diff changeset
1609 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26;
Ritor1
parents:
diff changeset
1610 if ( pIndoorCamera->sRotationX )
Ritor1
parents:
diff changeset
1611 {
Ritor1
parents:
diff changeset
1612 v11 = v10;
Ritor1
parents:
diff changeset
1613 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6;
Ritor1
parents:
diff changeset
1614 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
1615 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19;
Ritor1
parents:
diff changeset
1616 }
Ritor1
parents:
diff changeset
1617 else
Ritor1
parents:
diff changeset
1618 {
Ritor1
parents:
diff changeset
1619 *(float *)v9 = v10;
Ritor1
parents:
diff changeset
1620 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26;
Ritor1
parents:
diff changeset
1621 *(float *)((char *)v2 + (int)v5) = v6;
Ritor1
parents:
diff changeset
1622 }
Ritor1
parents:
diff changeset
1623 if ( *(float *)v9 >= 8.0 )
Ritor1
parents:
diff changeset
1624 {
Ritor1
parents:
diff changeset
1625 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 )
Ritor1
parents:
diff changeset
1626 {
Ritor1
parents:
diff changeset
1627 *(int *)v2 = 0;
Ritor1
parents:
diff changeset
1628 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad;
Ritor1
parents:
diff changeset
1629 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX
Ritor1
parents:
diff changeset
1630 - v12 * *(float *)((char *)v2 + (int)v3);
Ritor1
parents:
diff changeset
1631 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY
Ritor1
parents:
diff changeset
1632 - v12 * *(float *)((char *)v2 + (int)v5);
Ritor1
parents:
diff changeset
1633 *(float *)((char *)v2 + (int)v16) = v4
Ritor1
parents:
diff changeset
1634 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist);
Ritor1
parents:
diff changeset
1635 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001);
Ritor1
parents:
diff changeset
1636 v13 = *(float *)v9 + 6.7553994e15;
Ritor1
parents:
diff changeset
1637 v4 = 1.0;
Ritor1
parents:
diff changeset
1638 *(int *)((char *)v2 + (int)v14) = LODWORD(v13);
Ritor1
parents:
diff changeset
1639 }
Ritor1
parents:
diff changeset
1640 else
Ritor1
parents:
diff changeset
1641 {
Ritor1
parents:
diff changeset
1642 *(int *)v2 = 2;
Ritor1
parents:
diff changeset
1643 }
Ritor1
parents:
diff changeset
1644 }
Ritor1
parents:
diff changeset
1645 else
Ritor1
parents:
diff changeset
1646 {
Ritor1
parents:
diff changeset
1647 *(int *)v2 = 1;
Ritor1
parents:
diff changeset
1648 }
Ritor1
parents:
diff changeset
1649 ++v22;
Ritor1
parents:
diff changeset
1650 v2 = (char *)v2 + 4;
Ritor1
parents:
diff changeset
1651 }
Ritor1
parents:
diff changeset
1652 while ( v22 < this->field_8C );
Ritor1
parents:
diff changeset
1653 }
Ritor1
parents:
diff changeset
1654 this->field_8C = 0;
Ritor1
parents:
diff changeset
1655 }
Ritor1
parents:
diff changeset
1656
Ritor1
parents:
diff changeset
1657 //----- (0048A959) --------------------------------------------------------
Ritor1
parents:
diff changeset
1658 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
Ritor1
parents:
diff changeset
1659 {
Ritor1
parents:
diff changeset
1660 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
Ritor1
parents:
diff changeset
1661 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
Ritor1
parents:
diff changeset
1662 b = (uColor & 0x000000FF) / 255.0f;
Ritor1
parents:
diff changeset
1663
Ritor1
parents:
diff changeset
1664 float h, s, v;
Ritor1
parents:
diff changeset
1665 RGB2HSV(&h, &s, r, g, b, &v);
Ritor1
parents:
diff changeset
1666
Ritor1
parents:
diff changeset
1667 if ( h_replace != -1.0 )
Ritor1
parents:
diff changeset
1668 h = h_replace;
Ritor1
parents:
diff changeset
1669 if ( s_replace != -1.0 )
Ritor1
parents:
diff changeset
1670 s = s_replace;
Ritor1
parents:
diff changeset
1671 if ( v_replace != -1.0 )
Ritor1
parents:
diff changeset
1672 v = v_replace;
Ritor1
parents:
diff changeset
1673 HSV2RGB(&r, &g, &b, h, s, v);
Ritor1
parents:
diff changeset
1674
Ritor1
parents:
diff changeset
1675 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) |
Ritor1
parents:
diff changeset
1676 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) |
Ritor1
parents:
diff changeset
1677 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF);
Ritor1
parents:
diff changeset
1678 }
Ritor1
parents:
diff changeset
1679
Ritor1
parents:
diff changeset
1680 //----- (0048B561) --------------------------------------------------------
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1681 int fixpoint_from_float(float val)
0
Ritor1
parents:
diff changeset
1682 {
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1683 // float X.Yf -> int XXXX YYYY
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1684 int left = floorf((val - 0.5f) + 0.5f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1685 int right = floorf((val - left) * 65536.0f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
1686 return (left << 16) | right;
0
Ritor1
parents:
diff changeset
1687 }
Ritor1
parents:
diff changeset
1688
Ritor1
parents:
diff changeset
1689 //----- (00491E3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1690 void __cdecl sub_491E3A()
Ritor1
parents:
diff changeset
1691 {
Ritor1
parents:
diff changeset
1692 Player *v0; // ebx@1
Ritor1
parents:
diff changeset
1693 signed int v1; // esi@3
Ritor1
parents:
diff changeset
1694 char *v2; // eax@4
Ritor1
parents:
diff changeset
1695 unsigned int v3; // eax@7
Ritor1
parents:
diff changeset
1696 unsigned int v4; // edx@8
Ritor1
parents:
diff changeset
1697 char *v5; // ecx@9
Ritor1
parents:
diff changeset
1698 int v6; // edi@17
Ritor1
parents:
diff changeset
1699 Texture *v7; // ebx@18
Ritor1
parents:
diff changeset
1700 struct IDirect3DTexture2 **v8; // eax@19
Ritor1
parents:
diff changeset
1701 struct IDirect3DTexture2 *v9; // eax@20
Ritor1
parents:
diff changeset
1702 struct IDirectDrawSurface **v10; // eax@22
Ritor1
parents:
diff changeset
1703 struct IDirectDrawSurface *v11; // eax@23
Ritor1
parents:
diff changeset
1704 int v12; // eax@26
Ritor1
parents:
diff changeset
1705
Ritor1
parents:
diff changeset
1706 v0 = pParty->pPlayers;
Ritor1
parents:
diff changeset
1707 do
Ritor1
parents:
diff changeset
1708 {
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1709 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
1710 {
Ritor1
parents:
diff changeset
1711 v1 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1712 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1713 {
Ritor1
parents:
diff changeset
1714 LABEL_7:
Ritor1
parents:
diff changeset
1715 v3 = 0;
Ritor1
parents:
diff changeset
1716 }
Ritor1
parents:
diff changeset
1717 else
Ritor1
parents:
diff changeset
1718 {
Ritor1
parents:
diff changeset
1719 v2 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1720 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 )
0
Ritor1
parents:
diff changeset
1721 {
Ritor1
parents:
diff changeset
1722 ++v1;
Ritor1
parents:
diff changeset
1723 v2 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1724 if ( v1 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1725 goto LABEL_7;
Ritor1
parents:
diff changeset
1726 }
Ritor1
parents:
diff changeset
1727 v3 = v1;
Ritor1
parents:
diff changeset
1728 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1729 pSoundList->UnloadSound(v3, 1);
0
Ritor1
parents:
diff changeset
1730 v4 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1731 if ( (signed int)pSoundList->sNumSounds <= 0 )
0
Ritor1
parents:
diff changeset
1732 {
Ritor1
parents:
diff changeset
1733 LABEL_12:
Ritor1
parents:
diff changeset
1734 v4 = 0;
Ritor1
parents:
diff changeset
1735 }
Ritor1
parents:
diff changeset
1736 else
Ritor1
parents:
diff changeset
1737 {
Ritor1
parents:
diff changeset
1738 v5 = (char *)&pSoundList->pSounds->uSoundID;
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
1739 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 )
0
Ritor1
parents:
diff changeset
1740 {
Ritor1
parents:
diff changeset
1741 ++v4;
Ritor1
parents:
diff changeset
1742 v5 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1743 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds )
0
Ritor1
parents:
diff changeset
1744 goto LABEL_12;
Ritor1
parents:
diff changeset
1745 }
Ritor1
parents:
diff changeset
1746 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
1747 pSoundList->UnloadSound(v4, 1);
0
Ritor1
parents:
diff changeset
1748 }
Ritor1
parents:
diff changeset
1749 ++v0;
Ritor1
parents:
diff changeset
1750 }
Ritor1
parents:
diff changeset
1751 while ( (signed int)v0 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
1752 v6 = pIcons_LOD->uNumLoadedFiles - 1;
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1753 if ( v6 >= pIcons_LOD->pFacesLock )
0
Ritor1
parents:
diff changeset
1754 {
Ritor1
parents:
diff changeset
1755 v7 = &pIcons_LOD->pTextures[v6];
Ritor1
parents:
diff changeset
1756 do
Ritor1
parents:
diff changeset
1757 {
Ritor1
parents:
diff changeset
1758 v7->Release();
Ritor1
parents:
diff changeset
1759 v8 = pIcons_LOD->pHardwareTextures;
Ritor1
parents:
diff changeset
1760 if ( v8 )
Ritor1
parents:
diff changeset
1761 {
Ritor1
parents:
diff changeset
1762 v9 = v8[v6];
Ritor1
parents:
diff changeset
1763 if ( v9 )
Ritor1
parents:
diff changeset
1764 {
Ritor1
parents:
diff changeset
1765 v9->Release();
Ritor1
parents:
diff changeset
1766 pIcons_LOD->pHardwareTextures[v6] = 0;
Ritor1
parents:
diff changeset
1767 }
Ritor1
parents:
diff changeset
1768 }
Ritor1
parents:
diff changeset
1769 v10 = pIcons_LOD->pHardwareSurfaces;
Ritor1
parents:
diff changeset
1770 if ( v10 )
Ritor1
parents:
diff changeset
1771 {
Ritor1
parents:
diff changeset
1772 v11 = v10[v6];
Ritor1
parents:
diff changeset
1773 if ( v11 )
Ritor1
parents:
diff changeset
1774 {
Ritor1
parents:
diff changeset
1775 v11->Release();
Ritor1
parents:
diff changeset
1776 pIcons_LOD->pHardwareSurfaces[v6] = 0;
Ritor1
parents:
diff changeset
1777 }
Ritor1
parents:
diff changeset
1778 }
Ritor1
parents:
diff changeset
1779 --v6;
Ritor1
parents:
diff changeset
1780 --v7;
Ritor1
parents:
diff changeset
1781 }
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1782 while ( v6 >= pIcons_LOD->pFacesLock );
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1783 }
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1784 v12 = pIcons_LOD->pFacesLock;
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
1785 pIcons_LOD->pFacesLock = 0;
0
Ritor1
parents:
diff changeset
1786 pIcons_LOD->uNumLoadedFiles = v12;
Ritor1
parents:
diff changeset
1787 }
Ritor1
parents:
diff changeset
1788 // 4ED498: using guessed type char byte_4ED498;
Ritor1
parents:
diff changeset
1789
Ritor1
parents:
diff changeset
1790 //----- (0049387A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1791 int CycleCharacter(unsigned int _this)
Ritor1
parents:
diff changeset
1792 {
Ritor1
parents:
diff changeset
1793 signed int result; // eax@1
Ritor1
parents:
diff changeset
1794 signed int v2; // ecx@2
Ritor1
parents:
diff changeset
1795 signed int v3; // ecx@8
Ritor1
parents:
diff changeset
1796
Ritor1
parents:
diff changeset
1797 result = uActiveCharacter;
Ritor1
parents:
diff changeset
1798 if ( _this )
Ritor1
parents:
diff changeset
1799 {
Ritor1
parents:
diff changeset
1800 v2 = 0;
Ritor1
parents:
diff changeset
1801 while ( 1 )
Ritor1
parents:
diff changeset
1802 {
Ritor1
parents:
diff changeset
1803 --result;
Ritor1
parents:
diff changeset
1804 if ( result < 1 )
Ritor1
parents:
diff changeset
1805 result = 4;
Ritor1
parents:
diff changeset
1806 if ( !pPlayers[result]->uTimeToRecovery )
Ritor1
parents:
diff changeset
1807 break;
Ritor1
parents:
diff changeset
1808 ++v2;
Ritor1
parents:
diff changeset
1809 if ( v2 >= 4 )
Ritor1
parents:
diff changeset
1810 return uActiveCharacter;
Ritor1
parents:
diff changeset
1811 }
Ritor1
parents:
diff changeset
1812 }
Ritor1
parents:
diff changeset
1813 else
Ritor1
parents:
diff changeset
1814 {
Ritor1
parents:
diff changeset
1815 v3 = 0;
Ritor1
parents:
diff changeset
1816 while ( 1 )
Ritor1
parents:
diff changeset
1817 {
Ritor1
parents:
diff changeset
1818 ++result;
Ritor1
parents:
diff changeset
1819 if ( result > 4 )
Ritor1
parents:
diff changeset
1820 result = 1;
Ritor1
parents:
diff changeset
1821 if ( !pPlayers[result]->uTimeToRecovery )
Ritor1
parents:
diff changeset
1822 break;
Ritor1
parents:
diff changeset
1823 ++v3;
Ritor1
parents:
diff changeset
1824 if ( v3 >= 4 )
Ritor1
parents:
diff changeset
1825 return uActiveCharacter;
Ritor1
parents:
diff changeset
1826 }
Ritor1
parents:
diff changeset
1827 }
Ritor1
parents:
diff changeset
1828 return result;
Ritor1
parents:
diff changeset
1829 }
Ritor1
parents:
diff changeset
1830 //----- (004938D1) --------------------------------------------------------
Ritor1
parents:
diff changeset
1831 void __fastcall Rest(unsigned int uHoursToSleep)
Ritor1
parents:
diff changeset
1832 {
Ritor1
parents:
diff changeset
1833 unsigned int v1; // esi@1
Ritor1
parents:
diff changeset
1834 double v2; // st7@3
Ritor1
parents:
diff changeset
1835 Player **v3; // esi@3
Ritor1
parents:
diff changeset
1836
Ritor1
parents:
diff changeset
1837 v1 = uHoursToSleep;
Ritor1
parents:
diff changeset
1838 if ( uHoursToSleep > 240 )
Ritor1
parents:
diff changeset
1839 InitializeActors();
Ritor1
parents:
diff changeset
1840 v2 = (double)(7680 * v1) * 0.033333335;
Ritor1
parents:
diff changeset
1841 pParty->uTimePlayed += (signed __int64)v2;
Ritor1
parents:
diff changeset
1842 v3 = &pPlayers[1];
Ritor1
parents:
diff changeset
1843 do
Ritor1
parents:
diff changeset
1844 {
Ritor1
parents:
diff changeset
1845 (*v3)->Recover((signed __int64)v2);
Ritor1
parents:
diff changeset
1846 ++v3;
Ritor1
parents:
diff changeset
1847 }
Ritor1
parents:
diff changeset
1848 while ( (signed int)v3 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
1849 _494035_timed_effects__water_walking_damage__etc();
Ritor1
parents:
diff changeset
1850 }
Ritor1
parents:
diff changeset
1851
Ritor1
parents:
diff changeset
1852 //----- (00493938) --------------------------------------------------------
Ritor1
parents:
diff changeset
1853 int __cdecl _493938_regenerate()
Ritor1
parents:
diff changeset
1854 {
Ritor1
parents:
diff changeset
1855 int v0; // edi@1
Ritor1
parents:
diff changeset
1856 signed __int64 v1; // qax@1
Ritor1
parents:
diff changeset
1857 int v2; // ecx@1
Ritor1
parents:
diff changeset
1858 int result; // eax@1
Ritor1
parents:
diff changeset
1859 int v4; // eax@2
Ritor1
parents:
diff changeset
1860 int v5; // edi@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1861 int *v6; // ecx@5
0
Ritor1
parents:
diff changeset
1862 char v7; // sf@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1863 int *v8; // ecx@10
0
Ritor1
parents:
diff changeset
1864 int v9; // edi@15
Ritor1
parents:
diff changeset
1865 signed int v10; // eax@15
Ritor1
parents:
diff changeset
1866 __int16 *v11; // edx@16
Ritor1
parents:
diff changeset
1867 int v12; // eax@20
Ritor1
parents:
diff changeset
1868 int v13; // ebx@20
Ritor1
parents:
diff changeset
1869 unsigned int *v14; // esi@21
Ritor1
parents:
diff changeset
1870 unsigned int v15; // ecx@21
Ritor1
parents:
diff changeset
1871 unsigned int v16; // eax@21
Ritor1
parents:
diff changeset
1872 int v17; // edx@21
Ritor1
parents:
diff changeset
1873 int v18; // eax@21
Ritor1
parents:
diff changeset
1874 signed int v19; // eax@21
Ritor1
parents:
diff changeset
1875 signed int v20; // ebx@25
Ritor1
parents:
diff changeset
1876 Player *v21; // esi@25
Ritor1
parents:
diff changeset
1877 ITEM_EQUIP_TYPE v22; // edi@30
Ritor1
parents:
diff changeset
1878 //int v23; // edx@31
Ritor1
parents:
diff changeset
1879 signed int v24; // ecx@32
Ritor1
parents:
diff changeset
1880 signed int v25; // eax@33
Ritor1
parents:
diff changeset
1881 int v26; // eax@35
Ritor1
parents:
diff changeset
1882 int v27; // eax@36
Ritor1
parents:
diff changeset
1883 int v28; // eax@37
Ritor1
parents:
diff changeset
1884 int v29; // eax@40
Ritor1
parents:
diff changeset
1885 int v30; // eax@41
Ritor1
parents:
diff changeset
1886 signed int v31; // ecx@53
Ritor1
parents:
diff changeset
1887 char *v32; // eax@53
Ritor1
parents:
diff changeset
1888 char *v33; // edi@82
Ritor1
parents:
diff changeset
1889 int v34; // ecx@88
Ritor1
parents:
diff changeset
1890 int v35; // eax@88
Ritor1
parents:
diff changeset
1891 char *v36; // edi@99
Ritor1
parents:
diff changeset
1892 int v37; // edi@104
Ritor1
parents:
diff changeset
1893 int v38; // edi@106
Ritor1
parents:
diff changeset
1894 int v39; // edi@111
Ritor1
parents:
diff changeset
1895 int v40; // ecx@113
Ritor1
parents:
diff changeset
1896 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
1897 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
0
Ritor1
parents:
diff changeset
1898 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
Ritor1
parents:
diff changeset
1899 int v44; // [sp+210h] [bp-20h]@22
Ritor1
parents:
diff changeset
1900 int v45; // [sp+214h] [bp-1Ch]@25
Ritor1
parents:
diff changeset
1901 int v46; // [sp+218h] [bp-18h]@25
Ritor1
parents:
diff changeset
1902 int v47; // [sp+21Ch] [bp-14h]@25
Ritor1
parents:
diff changeset
1903 int v48; // [sp+220h] [bp-10h]@25
Ritor1
parents:
diff changeset
1904 int v49; // [sp+224h] [bp-Ch]@24
Ritor1
parents:
diff changeset
1905 int v50; // [sp+228h] [bp-8h]@25
Ritor1
parents:
diff changeset
1906 int v51; // [sp+22Ch] [bp-4h]@2
Ritor1
parents:
diff changeset
1907
Ritor1
parents:
diff changeset
1908 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
Ritor1
parents:
diff changeset
1909 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375);
Ritor1
parents:
diff changeset
1910 v2 = (signed int)v1 / 60;
Ritor1
parents:
diff changeset
1911 result = (signed int)v1 / 60 + 5;
Ritor1
parents:
diff changeset
1912 if ( v0 >= result )
Ritor1
parents:
diff changeset
1913 {
Ritor1
parents:
diff changeset
1914 v51 = 0;
Ritor1
parents:
diff changeset
1915 v4 = (v0 - v2) / 5;
Ritor1
parents:
diff changeset
1916 if (pParty->FlyActive())
Ritor1
parents:
diff changeset
1917 {
Ritor1
parents:
diff changeset
1918 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
1919 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1920 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1921 { // colliding with something in the air - fall down
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1922 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1923 //__debugbreak();
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1924 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
1925 v7 = *v6 < v5;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1926 *v6 -= v5;
0
Ritor1
parents:
diff changeset
1927 if ( v7 )
Ritor1
parents:
diff changeset
1928 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1929 *v6 = 0;
0
Ritor1
parents:
diff changeset
1930 pParty->uFlags &= 0xFFFFFFBFu;
Ritor1
parents:
diff changeset
1931 pParty->bFlying = 0;
Ritor1
parents:
diff changeset
1932 v51 = 1;
Ritor1
parents:
diff changeset
1933 }
Ritor1
parents:
diff changeset
1934 }
Ritor1
parents:
diff changeset
1935 }
Ritor1
parents:
diff changeset
1936 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1937
0
Ritor1
parents:
diff changeset
1938 if (pParty->WaterWalkActive())
Ritor1
parents:
diff changeset
1939 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1940 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1941 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1942 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1943 { // taking on water
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1944 //__debugbreak();
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1945 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
1946 v7 = *v8 < v4;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1947 *v8 -= v4;
0
Ritor1
parents:
diff changeset
1948 if ( v7 )
Ritor1
parents:
diff changeset
1949 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
1950 *v8 = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1951 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
0
Ritor1
parents:
diff changeset
1952 v51 = 1;
Ritor1
parents:
diff changeset
1953 }
Ritor1
parents:
diff changeset
1954 }
Ritor1
parents:
diff changeset
1955 }
Ritor1
parents:
diff changeset
1956 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
1957
0
Ritor1
parents:
diff changeset
1958 if (pParty->ImmolationActive())
Ritor1
parents:
diff changeset
1959 {
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1960 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
1961 v9 = 0;
Ritor1
parents:
diff changeset
1962 a3.z = 0;
Ritor1
parents:
diff changeset
1963 a3.y = 0;
Ritor1
parents:
diff changeset
1964 a3.x = 0;
Ritor1
parents:
diff changeset
1965 a1.stru_24.Reset();
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1966 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1967 a1.spell_skill = pParty->ImmolationSkillLevel();
0
Ritor1
parents:
diff changeset
1968 v10 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1969 a1.uType = 1070;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1970 a1.spell_id = SPELL_FIRE_IMMOLATION;
0
Ritor1
parents:
diff changeset
1971 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
1972 {
Ritor1
parents:
diff changeset
1973 LABEL_19:
Ritor1
parents:
diff changeset
1974 LOWORD(v10) = 0;
Ritor1
parents:
diff changeset
1975 }
Ritor1
parents:
diff changeset
1976 else
Ritor1
parents:
diff changeset
1977 {
Ritor1
parents:
diff changeset
1978 v11 = &pObjectList->pObjects->uObjectID;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 917
diff changeset
1979 while ( stru_4E3ACC[8].uType != *v11 )
0
Ritor1
parents:
diff changeset
1980 {
Ritor1
parents:
diff changeset
1981 ++v10;
Ritor1
parents:
diff changeset
1982 v11 += 28;
Ritor1
parents:
diff changeset
1983 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
1984 goto LABEL_19;
Ritor1
parents:
diff changeset
1985 }
Ritor1
parents:
diff changeset
1986 }
Ritor1
parents:
diff changeset
1987 a1.uObjectDescID = v10;
Ritor1
parents:
diff changeset
1988 a1.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
1989 v12 = 8 * pParty->pPartyBuffs[10].uCaster;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
1990 LOBYTE(v12) = v12 | OBJECT_Player;
0
Ritor1
parents:
diff changeset
1991 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
1992 a1.uSectorID = 0;
Ritor1
parents:
diff changeset
1993 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
1994 a1.spell_caster_pid = v12;
0
Ritor1
parents:
diff changeset
1995 a1.uFacing = 0;
Ritor1
parents:
diff changeset
1996 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
1997 v13 = sub_46A89E((int)v41, 100, 307);
Ritor1
parents:
diff changeset
1998 if ( v13 > 0 )
Ritor1
parents:
diff changeset
1999 {
Ritor1
parents:
diff changeset
2000 do
Ritor1
parents:
diff changeset
2001 {
Ritor1
parents:
diff changeset
2002 v14 = (unsigned int *)&v41[4 * v9];
Ritor1
parents:
diff changeset
2003 v15 = *v14;
Ritor1
parents:
diff changeset
2004 v16 = *v14;
Ritor1
parents:
diff changeset
2005 a1.vPosition.x = pActors[v16].vPosition.x;
Ritor1
parents:
diff changeset
2006 v17 = pActors[v16].vPosition.y;
Ritor1
parents:
diff changeset
2007 a1.vPosition.z = pActors[v16].vPosition.z;
Ritor1
parents:
diff changeset
2008 v18 = 8 * v15;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
2009 LOBYTE(v18) = PID(OBJECT_Actor,v15);
0
Ritor1
parents:
diff changeset
2010 a1.vPosition.y = v17;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
2011 a1.spell_target_pid = v18;
0
Ritor1
parents:
diff changeset
2012 v19 = a1.Create(0, 0, 0, 0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
2013 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3);
0
Ritor1
parents:
diff changeset
2014 ++v9;
Ritor1
parents:
diff changeset
2015 }
Ritor1
parents:
diff changeset
2016 while ( v9 < v13 );
Ritor1
parents:
diff changeset
2017 }
Ritor1
parents:
diff changeset
2018 }
Ritor1
parents:
diff changeset
2019 v44 = 0;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
2020 if (PartyHasDragon())
0
Ritor1
parents:
diff changeset
2021 v44 = 1;
Ritor1
parents:
diff changeset
2022 v49 = 0;
Ritor1
parents:
diff changeset
2023 LABEL_25:
Ritor1
parents:
diff changeset
2024 v20 = 0;
Ritor1
parents:
diff changeset
2025 v21 = &pParty->pPlayers[v49];
Ritor1
parents:
diff changeset
2026 v50 = 0;
Ritor1
parents:
diff changeset
2027 v47 = 0;
Ritor1
parents:
diff changeset
2028 v45 = 0;
Ritor1
parents:
diff changeset
2029 v48 = 0;
Ritor1
parents:
diff changeset
2030 v46 = 0;
255
0a37a56e9f02 sprintfex & classes enum
Nomad
parents: 254
diff changeset
2031 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK )
0
Ritor1
parents:
diff changeset
2032 v50 = 1;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
2033 if ( v21->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
2034 v48 = 1;
Ritor1
parents:
diff changeset
2035 v22 = (ITEM_EQUIP_TYPE)0;
Ritor1
parents:
diff changeset
2036 while ( 1 )
Ritor1
parents:
diff changeset
2037 {
Ritor1
parents:
diff changeset
2038 if ( v21->HasItemEquipped(v22) )
Ritor1
parents:
diff changeset
2039 {
Ritor1
parents:
diff changeset
2040 //v23 = v21->pEquipment.pIndices;
Ritor1
parents:
diff changeset
2041 auto _idx = v21->pEquipment.pIndices[v22];
Ritor1
parents:
diff changeset
2042 v24 = v21->pInventoryItems[_idx].uItemID;
Ritor1
parents:
diff changeset
2043 if ( v24 > 134 )
Ritor1
parents:
diff changeset
2044 {
Ritor1
parents:
diff changeset
2045 if ( v24 == 529 )
Ritor1
parents:
diff changeset
2046 goto LABEL_43;
Ritor1
parents:
diff changeset
2047 if ( v24 == 535 )
Ritor1
parents:
diff changeset
2048 goto LABEL_44;
Ritor1
parents:
diff changeset
2049 if ( v24 == 515 )
Ritor1
parents:
diff changeset
2050 {
Ritor1
parents:
diff changeset
2051 v47 = 1;
Ritor1
parents:
diff changeset
2052 }
Ritor1
parents:
diff changeset
2053 else
Ritor1
parents:
diff changeset
2054 {
Ritor1
parents:
diff changeset
2055 if ( v24 == 532 )
Ritor1
parents:
diff changeset
2056 goto LABEL_50;
Ritor1
parents:
diff changeset
2057 }
Ritor1
parents:
diff changeset
2058 }
Ritor1
parents:
diff changeset
2059 else
Ritor1
parents:
diff changeset
2060 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
2061 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
2062 if ( v25 <= 50 )
Ritor1
parents:
diff changeset
2063 {
Ritor1
parents:
diff changeset
2064 if ( v25 != 50 )
Ritor1
parents:
diff changeset
2065 {
Ritor1
parents:
diff changeset
2066 v26 = v25 - 37;
Ritor1
parents:
diff changeset
2067 if ( v26 )
Ritor1
parents:
diff changeset
2068 {
Ritor1
parents:
diff changeset
2069 v27 = v26 - 1;
Ritor1
parents:
diff changeset
2070 if ( !v27 )
Ritor1
parents:
diff changeset
2071 goto LABEL_50;
Ritor1
parents:
diff changeset
2072 v28 = v27 - 6;
Ritor1
parents:
diff changeset
2073 if ( v28 )
Ritor1
parents:
diff changeset
2074 {
Ritor1
parents:
diff changeset
2075 if ( v28 != 3 )
Ritor1
parents:
diff changeset
2076 goto LABEL_51;
Ritor1
parents:
diff changeset
2077 LABEL_50:
Ritor1
parents:
diff changeset
2078 v50 = 1;
Ritor1
parents:
diff changeset
2079 goto LABEL_51;
Ritor1
parents:
diff changeset
2080 }
Ritor1
parents:
diff changeset
2081 }
Ritor1
parents:
diff changeset
2082 }
Ritor1
parents:
diff changeset
2083 LABEL_44:
Ritor1
parents:
diff changeset
2084 v20 = 1;
Ritor1
parents:
diff changeset
2085 goto LABEL_51;
Ritor1
parents:
diff changeset
2086 }
Ritor1
parents:
diff changeset
2087 v29 = v25 - 54;
Ritor1
parents:
diff changeset
2088 if ( !v29 )
Ritor1
parents:
diff changeset
2089 goto LABEL_44;
Ritor1
parents:
diff changeset
2090 v30 = v29 - 1;
Ritor1
parents:
diff changeset
2091 if ( !v30 )
Ritor1
parents:
diff changeset
2092 goto LABEL_50;
Ritor1
parents:
diff changeset
2093 if ( v30 == 11 )
Ritor1
parents:
diff changeset
2094 {
Ritor1
parents:
diff changeset
2095 LABEL_43:
Ritor1
parents:
diff changeset
2096 v20 = 1;
Ritor1
parents:
diff changeset
2097 v50 = 1;
Ritor1
parents:
diff changeset
2098 goto LABEL_51;
Ritor1
parents:
diff changeset
2099 }
Ritor1
parents:
diff changeset
2100 }
Ritor1
parents:
diff changeset
2101 }
Ritor1
parents:
diff changeset
2102 LABEL_51:
Ritor1
parents:
diff changeset
2103 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1);
Ritor1
parents:
diff changeset
2104 if ( (signed int)v22 >= 16 )
Ritor1
parents:
diff changeset
2105 {
Ritor1
parents:
diff changeset
2106 if ( v48 )
Ritor1
parents:
diff changeset
2107 {
Ritor1
parents:
diff changeset
2108 v31 = 0;
Ritor1
parents:
diff changeset
2109 v32 = (char *)v21->pInventoryItems;
Ritor1
parents:
diff changeset
2110 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 )
Ritor1
parents:
diff changeset
2111 {
Ritor1
parents:
diff changeset
2112 ++v31;
Ritor1
parents:
diff changeset
2113 v32 += 36;
Ritor1
parents:
diff changeset
2114 if ( v31 >= 138 )
Ritor1
parents:
diff changeset
2115 goto LABEL_59;
Ritor1
parents:
diff changeset
2116 }
Ritor1
parents:
diff changeset
2117 v48 = 0;
Ritor1
parents:
diff changeset
2118 v45 = 1;
Ritor1
parents:
diff changeset
2119 }
Ritor1
parents:
diff changeset
2120 LABEL_59:
Ritor1
parents:
diff changeset
2121 if ( v21->pConditions[17] )
Ritor1
parents:
diff changeset
2122 v46 = 1;
Ritor1
parents:
diff changeset
2123 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2124 {
Ritor1
parents:
diff changeset
2125 ++v21->sHealth;
Ritor1
parents:
diff changeset
2126 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
2127 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
2128 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
2129 {
Ritor1
parents:
diff changeset
2130 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2131 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2132 }
Ritor1
parents:
diff changeset
2133 v51 = 1;
Ritor1
parents:
diff changeset
2134 }
Ritor1
parents:
diff changeset
2135 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0
Ritor1
parents:
diff changeset
2136 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime))
Ritor1
parents:
diff changeset
2137 && !v21->pConditions[14]
Ritor1
parents:
diff changeset
2138 && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2139 {
Ritor1
parents:
diff changeset
2140 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower;
Ritor1
parents:
diff changeset
2141 if ( v21->sHealth > v21->GetMaxHealth() )
Ritor1
parents:
diff changeset
2142 v21->sHealth = v21->GetMaxHealth();
Ritor1
parents:
diff changeset
2143 if ( v21->pConditions[13] && v21->sHealth > 0 )
Ritor1
parents:
diff changeset
2144 {
Ritor1
parents:
diff changeset
2145 LODWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2146 HIDWORD(v21->pConditions[13]) = 0;
Ritor1
parents:
diff changeset
2147 }
Ritor1
parents:
diff changeset
2148 v51 = 1;
Ritor1
parents:
diff changeset
2149 }
Ritor1
parents:
diff changeset
2150 if ( v50 )
Ritor1
parents:
diff changeset
2151 {
Ritor1
parents:
diff changeset
2152 v33 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
2153 ++*(int *)v33;
Ritor1
parents:
diff changeset
2154 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
2155 *(int *)v33 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
2156 v51 = 1;
Ritor1
parents:
diff changeset
2157 }
Ritor1
parents:
diff changeset
2158 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2159 {
Ritor1
parents:
diff changeset
2160 v34 = LODWORD(v21->pConditions[13]);
Ritor1
parents:
diff changeset
2161 --v21->sHealth;
Ritor1
parents:
diff changeset
2162 v35 = v21->sHealth;
Ritor1
parents:
diff changeset
2163 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 )
Ritor1
parents:
diff changeset
2164 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2165 if ( v35 < 1 )
Ritor1
parents:
diff changeset
2166 {
Ritor1
parents:
diff changeset
2167 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
Ritor1
parents:
diff changeset
2168 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2169 {
Ritor1
parents:
diff changeset
2170 v21->pConditions[13] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2171 }
Ritor1
parents:
diff changeset
2172 else
Ritor1
parents:
diff changeset
2173 {
Ritor1
parents:
diff changeset
2174 if ( !v21->pConditions[14] )
Ritor1
parents:
diff changeset
2175 v21->pConditions[14] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2176 }
Ritor1
parents:
diff changeset
2177 }
Ritor1
parents:
diff changeset
2178 v51 = 1;
Ritor1
parents:
diff changeset
2179 }
Ritor1
parents:
diff changeset
2180 if ( v45 )
Ritor1
parents:
diff changeset
2181 {
Ritor1
parents:
diff changeset
2182 v36 = (char *)&v21->sMana;
Ritor1
parents:
diff changeset
2183 ++*(int *)v36;
Ritor1
parents:
diff changeset
2184 if ( v21->sMana > v21->GetMaxMana() )
Ritor1
parents:
diff changeset
2185 *(int *)v36 = v21->GetMaxMana();
Ritor1
parents:
diff changeset
2186 }
Ritor1
parents:
diff changeset
2187 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2188 {
Ritor1
parents:
diff changeset
2189 v37 = v21->sHealth;
Ritor1
parents:
diff changeset
2190 if ( v37 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
2191 v21->sHealth = v37 - 2;
Ritor1
parents:
diff changeset
2192 v38 = v21->sMana;
Ritor1
parents:
diff changeset
2193 if ( v38 > v21->GetMaxMana() / 2 )
Ritor1
parents:
diff changeset
2194 v21->sMana = v38 - 2;
Ritor1
parents:
diff changeset
2195 }
Ritor1
parents:
diff changeset
2196 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] )
Ritor1
parents:
diff changeset
2197 {
Ritor1
parents:
diff changeset
2198 v39 = v21->sHealth;
Ritor1
parents:
diff changeset
2199 if ( v39 > v21->GetMaxHealth() / 2 )
Ritor1
parents:
diff changeset
2200 v21->sHealth = v39 - 1;
Ritor1
parents:
diff changeset
2201 v40 = v21->sMana;
Ritor1
parents:
diff changeset
2202 if ( v40 > 0 )
Ritor1
parents:
diff changeset
2203 v21->sMana = v40 - 1;
Ritor1
parents:
diff changeset
2204 }
Ritor1
parents:
diff changeset
2205 ++v49;
Ritor1
parents:
diff changeset
2206 if ( v49 >= 4 )
Ritor1
parents:
diff changeset
2207 {
Ritor1
parents:
diff changeset
2208 result = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2209 pParty->uLastRegenerationTime = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
2210 if ( !viewparams->bRedrawGameUI )
Ritor1
parents:
diff changeset
2211 {
Ritor1
parents:
diff changeset
2212 result = v51;
Ritor1
parents:
diff changeset
2213 viewparams->bRedrawGameUI = v51;
Ritor1
parents:
diff changeset
2214 }
Ritor1
parents:
diff changeset
2215 return result;
Ritor1
parents:
diff changeset
2216 }
Ritor1
parents:
diff changeset
2217 goto LABEL_25;
Ritor1
parents:
diff changeset
2218 }
Ritor1
parents:
diff changeset
2219 }
Ritor1
parents:
diff changeset
2220 }
Ritor1
parents:
diff changeset
2221 return result;
Ritor1
parents:
diff changeset
2222 }
Ritor1
parents:
diff changeset
2223
Ritor1
parents:
diff changeset
2224 //----- (00493F79) --------------------------------------------------------
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2225 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
0
Ritor1
parents:
diff changeset
2226 {
Ritor1
parents:
diff changeset
2227 signed __int64 v2; // ST2C_8@1
Ritor1
parents:
diff changeset
2228 signed __int64 v3; // qax@1
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2229 //signed __int64 v4; // ST1C_8@1
0
Ritor1
parents:
diff changeset
2230 unsigned __int64 v5; // qax@1
Ritor1
parents:
diff changeset
2231 unsigned int v6; // ebx@1
Ritor1
parents:
diff changeset
2232
Ritor1
parents:
diff changeset
2233 v2 = (signed __int64)((double)a2 * 0.234375);
Ritor1
parents:
diff changeset
2234 v3 = v2 / 60 / 60;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2235 //v4 = v3;
0
Ritor1
parents:
diff changeset
2236 v5 = (unsigned int)v3 / 0x18;
Ritor1
parents:
diff changeset
2237 v6 = (unsigned int)(v5 / 7) >> 2;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2238 _this->field_0_expire_second = v2 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2239 _this->field_4_expire_minute = v2 / 60 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2240 _this->field_8_expire_hour = v3 % 24;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2241 _this->field_10_expire_week = v5 / 7 & 3;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2242 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
2243 _this->field_14_exprie_month = v6 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
2244 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
2245 }
Ritor1
parents:
diff changeset
2246
Ritor1
parents:
diff changeset
2247 //----- (00494035) --------------------------------------------------------
1031
f93d17337113 UI stuff.
Nomad
parents: 1029
diff changeset
2248 void _494035_timed_effects__water_walking_damage__etc()
0
Ritor1
parents:
diff changeset
2249 {
Ritor1
parents:
diff changeset
2250 signed __int64 v0; // qax@1
Ritor1
parents:
diff changeset
2251 signed __int64 v1; // ST30_8@1
Ritor1
parents:
diff changeset
2252 signed __int64 v2; // ST38_8@1
Ritor1
parents:
diff changeset
2253 unsigned __int64 v3; // qax@1
Ritor1
parents:
diff changeset
2254 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
2255 //signed int v5; // eax@4
Ritor1
parents:
diff changeset
2256 //char *v6; // ecx@5
Ritor1
parents:
diff changeset
2257 //Player *v7; // esi@8
Ritor1
parents:
diff changeset
2258 //char *v8; // ecx@12
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2259 //Player *pPlayer; // esi@15
0
Ritor1
parents:
diff changeset
2260 //void *v10; // esi@25
Ritor1
parents:
diff changeset
2261 unsigned int v11; // ecx@27
Ritor1
parents:
diff changeset
2262 signed int v12; // edi@29
Ritor1
parents:
diff changeset
2263 Player *v13; // ecx@30
Ritor1
parents:
diff changeset
2264 Player *v14; // esi@35
Ritor1
parents:
diff changeset
2265 double v15; // st7@35
Ritor1
parents:
diff changeset
2266 Player **v16; // esi@43
Ritor1
parents:
diff changeset
2267 Player *v17; // edi@44
Ritor1
parents:
diff changeset
2268 double v18; // st7@44
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2269 //float v19; // ST28_4@48
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2270 //double v20; // ST38_8@48
0
Ritor1
parents:
diff changeset
2271 Player *v21; // esi@51
Ritor1
parents:
diff changeset
2272 signed int v22; // edi@53
Ritor1
parents:
diff changeset
2273 int v23; // eax@59
Ritor1
parents:
diff changeset
2274 int v24; // ecx@60
Ritor1
parents:
diff changeset
2275 int v25; // eax@63
Ritor1
parents:
diff changeset
2276 int v26; // ecx@64
Ritor1
parents:
diff changeset
2277 int v27; // eax@67
Ritor1
parents:
diff changeset
2278 int v28; // ecx@68
Ritor1
parents:
diff changeset
2279 int v29; // eax@71
Ritor1
parents:
diff changeset
2280 int v30; // ecx@72
Ritor1
parents:
diff changeset
2281 int v31; // eax@75
Ritor1
parents:
diff changeset
2282 int v32; // ecx@76
Ritor1
parents:
diff changeset
2283 int v33; // eax@79
Ritor1
parents:
diff changeset
2284 int v34; // ecx@80
Ritor1
parents:
diff changeset
2285 int v35; // eax@83
Ritor1
parents:
diff changeset
2286 int v36; // ecx@84
Ritor1
parents:
diff changeset
2287 int v37; // eax@87
Ritor1
parents:
diff changeset
2288 int v38; // ecx@88
Ritor1
parents:
diff changeset
2289 int v39; // eax@91
Ritor1
parents:
diff changeset
2290 int v40; // ecx@92
Ritor1
parents:
diff changeset
2291 int v41; // eax@95
Ritor1
parents:
diff changeset
2292 int v42; // ecx@96
Ritor1
parents:
diff changeset
2293 bool v43; // ebx@102
Ritor1
parents:
diff changeset
2294 //SpellBuff *v44; // edi@104
Ritor1
parents:
diff changeset
2295 //signed int v45; // ebp@104
Ritor1
parents:
diff changeset
2296 bool v46; // edi@111
Ritor1
parents:
diff changeset
2297 //SpellBuff *v47; // esi@113
Ritor1
parents:
diff changeset
2298 //Player **v48; // esi@119
Ritor1
parents:
diff changeset
2299 //signed int v49; // edi@121
Ritor1
parents:
diff changeset
2300 //char *v50; // esi@122
Ritor1
parents:
diff changeset
2301 signed int v51; // edx@128
Ritor1
parents:
diff changeset
2302 signed int v52; // ecx@130
Ritor1
parents:
diff changeset
2303 int v53; // eax@131
Ritor1
parents:
diff changeset
2304 Player *v54; // eax@141
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2305 //unsigned int v55; // [sp-8h] [bp-38h]@18
0
Ritor1
parents:
diff changeset
2306 unsigned int v56; // [sp-8h] [bp-38h]@55
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2307 //int v57; // [sp-4h] [bp-34h]@18
0
Ritor1
parents:
diff changeset
2308 int v58; // [sp-4h] [bp-34h]@33
Ritor1
parents:
diff changeset
2309 int v59; // [sp-4h] [bp-34h]@55
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2310 //unsigned int v60; // [sp+10h] [bp-20h]@1
0
Ritor1
parents:
diff changeset
2311 unsigned int v61; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
2312 Player **v62; // [sp+14h] [bp-1Ch]@50
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2313 //unsigned int a2; // [sp+18h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
2314 signed int a2a; // [sp+18h] [bp-18h]@47
Ritor1
parents:
diff changeset
2315 signed int v65; // [sp+1Ch] [bp-14h]@47
Ritor1
parents:
diff changeset
2316
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2317 //a2 = pParty->uCurrentHour;
0
Ritor1
parents:
diff changeset
2318 v61 = pParty->uDaysPlayed;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2319 //auto prev_time = pEventTimer->uTimeElapsed;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2320 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2321 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60;
0
Ritor1
parents:
diff changeset
2322 v1 = v0;
Ritor1
parents:
diff changeset
2323 v0 /= 60i64;
Ritor1
parents:
diff changeset
2324 v2 = v0;
Ritor1
parents:
diff changeset
2325 v3 = (unsigned int)v0 / 24;
Ritor1
parents:
diff changeset
2326 v4 = (unsigned int)(v3 / 7) >> 2;
Ritor1
parents:
diff changeset
2327 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
Ritor1
parents:
diff changeset
2328 pParty->uCurrentMinute = v1 % 60;
Ritor1
parents:
diff changeset
2329 pParty->uCurrentMonthWeek = v3 / 7 & 3;
Ritor1
parents:
diff changeset
2330 pParty->uCurrentHour = v2 % 24;
Ritor1
parents:
diff changeset
2331 pParty->uDaysPlayed = (unsigned int)v3 % 28;
Ritor1
parents:
diff changeset
2332 pParty->uCurrentMonth = v4 % 12;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
2333 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2334 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns
0
Ritor1
parents:
diff changeset
2335 {
Ritor1
parents:
diff changeset
2336 pParty->pHirelings[0].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2337 pParty->pHirelings[1].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2338
Ritor1
parents:
diff changeset
2339 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
Ritor1
parents:
diff changeset
2340 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
2341
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2342 ++pParty->days_played_without_rest;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2343 if (pParty->days_played_without_rest > 1)
0
Ritor1
parents:
diff changeset
2344 {
Ritor1
parents:
diff changeset
2345 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2346 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0);
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2347
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2348 if (pParty->uNumFoodRations)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2349 Party::TakeFood(1);
0
Ritor1
parents:
diff changeset
2350 else
Ritor1
parents:
diff changeset
2351 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2352 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
2353
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2354 if (pParty->days_played_without_rest > 3)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2355 for (uint i = 0; i < 4; ++i)
0
Ritor1
parents:
diff changeset
2356 {
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2357 auto player = pParty->pPlayers + i;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2358
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2359 player->Zero();
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2360
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2361 if (!player->Pertified() && !player->Eradicated() && !player->Dead())
0
Ritor1
parents:
diff changeset
2362 {
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
2363 if (rand() % 100 < 5 * pParty->days_played_without_rest)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2364 player->SetCondition(Player::Condition_Dead, 0);
767
45615cacad31 Fog fixed
Nomad
parents: 766
diff changeset
2365 if (rand() % 100 < 10 * pParty->days_played_without_rest)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2366 player->SetCondition(Player::Condition_Insane, 0);
0
Ritor1
parents:
diff changeset
2367 }
Ritor1
parents:
diff changeset
2368 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2369 }
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2370 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
Ritor1
parents:
diff changeset
2371 pOutdoor->SetFog();
Ritor1
parents:
diff changeset
2372
Ritor1
parents:
diff changeset
2373 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
2374 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
2375 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
2376
0
Ritor1
parents:
diff changeset
2377 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2378 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )
Ritor1
parents:
diff changeset
2379 {
Ritor1
parents:
diff changeset
2380 v12 = 1;
Ritor1
parents:
diff changeset
2381 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128;
Ritor1
parents:
diff changeset
2382 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2383 while ( 1 )
Ritor1
parents:
diff changeset
2384 {
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1037
diff changeset
2385 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
99
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
2386 || pPlayers[v12]->HasEnchantedItemEquipped(71)
b7ff791b1333 spells tab fix, small fixes
zipi
parents: 90
diff changeset
2387 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
2388 {
Ritor1
parents:
diff changeset
2389 v58 = 0;
Ritor1
parents:
diff changeset
2390 }
Ritor1
parents:
diff changeset
2391 else
Ritor1
parents:
diff changeset
2392 {
Ritor1
parents:
diff changeset
2393 v58 = 0;
Ritor1
parents:
diff changeset
2394 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) )
Ritor1
parents:
diff changeset
2395 {
Ritor1
parents:
diff changeset
2396 v14 = pPlayers[v12];
Ritor1
parents:
diff changeset
2397 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1;
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2398 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
2399 if ( pParty->uFlags & 4 )
Ritor1
parents:
diff changeset
2400 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
2401 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]);
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
2402 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
2403 }
Ritor1
parents:
diff changeset
2404 goto LABEL_39;
Ritor1
parents:
diff changeset
2405 }
Ritor1
parents:
diff changeset
2406 v13 = pPlayers[v12];
Ritor1
parents:
diff changeset
2407 }
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2408 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
0
Ritor1
parents:
diff changeset
2409 LABEL_39:
Ritor1
parents:
diff changeset
2410 ++v12;
Ritor1
parents:
diff changeset
2411 if ( v12 > 4 )
Ritor1
parents:
diff changeset
2412 {
Ritor1
parents:
diff changeset
2413 v11 = LODWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2414 break;
Ritor1
parents:
diff changeset
2415 }
Ritor1
parents:
diff changeset
2416 }
Ritor1
parents:
diff changeset
2417 }
Ritor1
parents:
diff changeset
2418 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) )
Ritor1
parents:
diff changeset
2419 {
Ritor1
parents:
diff changeset
2420 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2421 pParty->field_6FC = v11 + 128;
Ritor1
parents:
diff changeset
2422 v16 = &pPlayers[1];
Ritor1
parents:
diff changeset
2423 do
Ritor1
parents:
diff changeset
2424 {
Ritor1
parents:
diff changeset
2425 v17 = *v16;
Ritor1
parents:
diff changeset
2426 v18 = (double)(*v16)->GetMaxHealth() * 0.1;
1036
7f8be9f9769e player recieve damage
Gloval
parents: 1033
diff changeset
2427 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
2428 if ( pParty->uFlags & 0x200 )
Ritor1
parents:
diff changeset
2429 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
2430 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]);
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
2431 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
2432 }
Ritor1
parents:
diff changeset
2433 ++v16;
Ritor1
parents:
diff changeset
2434 }
Ritor1
parents:
diff changeset
2435 while ( (signed int)v16 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
2436 }
Ritor1
parents:
diff changeset
2437 _493938_regenerate();
Ritor1
parents:
diff changeset
2438 v65 = 4;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2439 a2a = pEventTimer->uTimeElapsed;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2440 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2441 {
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2442 //v19 = (double)(signed int)prev_time * 0.5;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2443 //v20 = v19 + 6.7553994e15;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2444 a2a *= 0.5f;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2445 if (a2a < 1)
0
Ritor1
parents:
diff changeset
2446 a2a = 1;
Ritor1
parents:
diff changeset
2447 }
Ritor1
parents:
diff changeset
2448 v62 = &pPlayers[1];
Ritor1
parents:
diff changeset
2449 do
Ritor1
parents:
diff changeset
2450 {
Ritor1
parents:
diff changeset
2451 v21 = *v62;
Ritor1
parents:
diff changeset
2452 if ( (*v62)->uTimeToRecovery )
Ritor1
parents:
diff changeset
2453 v21->Recover(a2a);
Ritor1
parents:
diff changeset
2454 v22 = v21->sHealth;
Ritor1
parents:
diff changeset
2455 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1
Ritor1
parents:
diff changeset
2456 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2457 {
Ritor1
parents:
diff changeset
2458 if ( v22 >= 1 )
Ritor1
parents:
diff changeset
2459 goto LABEL_59;
Ritor1
parents:
diff changeset
2460 v59 = 0;
Ritor1
parents:
diff changeset
2461 v56 = 13;
Ritor1
parents:
diff changeset
2462 }
Ritor1
parents:
diff changeset
2463 else
Ritor1
parents:
diff changeset
2464 {
Ritor1
parents:
diff changeset
2465 v59 = 0;
Ritor1
parents:
diff changeset
2466 v56 = 14;
Ritor1
parents:
diff changeset
2467 }
Ritor1
parents:
diff changeset
2468 v21->SetCondition(v56, v59);
Ritor1
parents:
diff changeset
2469 LABEL_59:
Ritor1
parents:
diff changeset
2470 v23 = (int)&v21->field_E0;
Ritor1
parents:
diff changeset
2471 if ( v21->field_E0 )
Ritor1
parents:
diff changeset
2472 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2473 v24 = *(int *)v23 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2474 if ( v24 > 0 )
Ritor1
parents:
diff changeset
2475 {
Ritor1
parents:
diff changeset
2476 *(int *)v23 = v24;
Ritor1
parents:
diff changeset
2477 }
Ritor1
parents:
diff changeset
2478 else
Ritor1
parents:
diff changeset
2479 {
Ritor1
parents:
diff changeset
2480 *(int *)v23 = 0;
Ritor1
parents:
diff changeset
2481 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2482 }
Ritor1
parents:
diff changeset
2483 }
Ritor1
parents:
diff changeset
2484 v25 = (int)&v21->field_E4;
Ritor1
parents:
diff changeset
2485 if ( v21->field_E4 )
Ritor1
parents:
diff changeset
2486 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2487 v26 = *(int *)v25 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2488 if ( v26 > 0 )
Ritor1
parents:
diff changeset
2489 {
Ritor1
parents:
diff changeset
2490 *(int *)v25 = v26;
Ritor1
parents:
diff changeset
2491 }
Ritor1
parents:
diff changeset
2492 else
Ritor1
parents:
diff changeset
2493 {
Ritor1
parents:
diff changeset
2494 *(int *)v25 = 0;
Ritor1
parents:
diff changeset
2495 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2496 }
Ritor1
parents:
diff changeset
2497 }
Ritor1
parents:
diff changeset
2498 v27 = (int)&v21->field_E8;
Ritor1
parents:
diff changeset
2499 if ( v21->field_E8 )
Ritor1
parents:
diff changeset
2500 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2501 v28 = *(int *)v27 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2502 if ( v28 > 0 )
Ritor1
parents:
diff changeset
2503 {
Ritor1
parents:
diff changeset
2504 *(int *)v27 = v28;
Ritor1
parents:
diff changeset
2505 }
Ritor1
parents:
diff changeset
2506 else
Ritor1
parents:
diff changeset
2507 {
Ritor1
parents:
diff changeset
2508 *(int *)v27 = 0;
Ritor1
parents:
diff changeset
2509 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2510 }
Ritor1
parents:
diff changeset
2511 }
Ritor1
parents:
diff changeset
2512 v29 = (int)&v21->field_EC;
Ritor1
parents:
diff changeset
2513 if ( v21->field_EC )
Ritor1
parents:
diff changeset
2514 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2515 v30 = *(int *)v29 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2516 if ( v30 > 0 )
Ritor1
parents:
diff changeset
2517 {
Ritor1
parents:
diff changeset
2518 *(int *)v29 = v30;
Ritor1
parents:
diff changeset
2519 }
Ritor1
parents:
diff changeset
2520 else
Ritor1
parents:
diff changeset
2521 {
Ritor1
parents:
diff changeset
2522 *(int *)v29 = 0;
Ritor1
parents:
diff changeset
2523 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2524 }
Ritor1
parents:
diff changeset
2525 }
Ritor1
parents:
diff changeset
2526 v31 = (int)&v21->field_F0;
Ritor1
parents:
diff changeset
2527 if ( v21->field_F0 )
Ritor1
parents:
diff changeset
2528 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2529 v32 = *(int *)v31 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2530 if ( v32 > 0 )
Ritor1
parents:
diff changeset
2531 {
Ritor1
parents:
diff changeset
2532 *(int *)v31 = v32;
Ritor1
parents:
diff changeset
2533 }
Ritor1
parents:
diff changeset
2534 else
Ritor1
parents:
diff changeset
2535 {
Ritor1
parents:
diff changeset
2536 *(int *)v31 = 0;
Ritor1
parents:
diff changeset
2537 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2538 }
Ritor1
parents:
diff changeset
2539 }
Ritor1
parents:
diff changeset
2540 v33 = (int)&v21->field_F4;
Ritor1
parents:
diff changeset
2541 if ( v21->field_F4 )
Ritor1
parents:
diff changeset
2542 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2543 v34 = *(int *)v33 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2544 if ( v34 > 0 )
Ritor1
parents:
diff changeset
2545 {
Ritor1
parents:
diff changeset
2546 *(int *)v33 = v34;
Ritor1
parents:
diff changeset
2547 }
Ritor1
parents:
diff changeset
2548 else
Ritor1
parents:
diff changeset
2549 {
Ritor1
parents:
diff changeset
2550 *(int *)v33 = 0;
Ritor1
parents:
diff changeset
2551 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2552 }
Ritor1
parents:
diff changeset
2553 }
Ritor1
parents:
diff changeset
2554 v35 = (int)&v21->field_F8;
Ritor1
parents:
diff changeset
2555 if ( v21->field_F8 )
Ritor1
parents:
diff changeset
2556 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2557 v36 = *(int *)v35 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2558 if ( v36 > 0 )
Ritor1
parents:
diff changeset
2559 {
Ritor1
parents:
diff changeset
2560 *(int *)v35 = v36;
Ritor1
parents:
diff changeset
2561 }
Ritor1
parents:
diff changeset
2562 else
Ritor1
parents:
diff changeset
2563 {
Ritor1
parents:
diff changeset
2564 *(int *)v35 = 0;
Ritor1
parents:
diff changeset
2565 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2566 }
Ritor1
parents:
diff changeset
2567 }
Ritor1
parents:
diff changeset
2568 v37 = (int)&v21->field_FC;
Ritor1
parents:
diff changeset
2569 if ( v21->field_FC )
Ritor1
parents:
diff changeset
2570 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2571 v38 = *(int *)v37 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2572 if ( v38 > 0 )
Ritor1
parents:
diff changeset
2573 {
Ritor1
parents:
diff changeset
2574 *(int *)v37 = v38;
Ritor1
parents:
diff changeset
2575 }
Ritor1
parents:
diff changeset
2576 else
Ritor1
parents:
diff changeset
2577 {
Ritor1
parents:
diff changeset
2578 *(int *)v37 = 0;
Ritor1
parents:
diff changeset
2579 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2580 }
Ritor1
parents:
diff changeset
2581 }
Ritor1
parents:
diff changeset
2582 v39 = (int)&v21->field_100;
Ritor1
parents:
diff changeset
2583 if ( v21->field_100 )
Ritor1
parents:
diff changeset
2584 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2585 v40 = *(int *)v39 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2586 if ( v40 > 0 )
Ritor1
parents:
diff changeset
2587 {
Ritor1
parents:
diff changeset
2588 *(int *)v39 = v40;
Ritor1
parents:
diff changeset
2589 }
Ritor1
parents:
diff changeset
2590 else
Ritor1
parents:
diff changeset
2591 {
Ritor1
parents:
diff changeset
2592 *(int *)v39 = 0;
Ritor1
parents:
diff changeset
2593 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2594 }
Ritor1
parents:
diff changeset
2595 }
Ritor1
parents:
diff changeset
2596 v41 = (int)&v21->field_104;
Ritor1
parents:
diff changeset
2597 if ( v21->field_104 )
Ritor1
parents:
diff changeset
2598 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
2599 v42 = *(int *)v41 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
2600 if ( v42 > 0 )
Ritor1
parents:
diff changeset
2601 {
Ritor1
parents:
diff changeset
2602 *(int *)v41 = v42;
Ritor1
parents:
diff changeset
2603 }
Ritor1
parents:
diff changeset
2604 else
Ritor1
parents:
diff changeset
2605 {
Ritor1
parents:
diff changeset
2606 *(int *)v41 = 0;
Ritor1
parents:
diff changeset
2607 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2608 }
Ritor1
parents:
diff changeset
2609 }
Ritor1
parents:
diff changeset
2610 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] )
Ritor1
parents:
diff changeset
2611 --v65;
Ritor1
parents:
diff changeset
2612 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0;
Ritor1
parents:
diff changeset
2613
Ritor1
parents:
diff changeset
2614 for (uint k = 0; k < 24; ++k)
Ritor1
parents:
diff changeset
2615 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
2616
Ritor1
parents:
diff changeset
2617 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
2618 v21->SetCondition(1u, 0);
Ritor1
parents:
diff changeset
2619 ++v62;
Ritor1
parents:
diff changeset
2620 }
Ritor1
parents:
diff changeset
2621 while ( (signed int)v62 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
2622 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0;
Ritor1
parents:
diff changeset
2623
Ritor1
parents:
diff changeset
2624 for (uint i = 0; i < 20; ++i)
Ritor1
parents:
diff changeset
2625 {
Ritor1
parents:
diff changeset
2626 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1)
Ritor1
parents:
diff changeset
2627 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2628 }
Ritor1
parents:
diff changeset
2629
Ritor1
parents:
diff changeset
2630 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
2631 {
Ritor1
parents:
diff changeset
2632 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
2633 pParty->pPlayers[i].SetCondition(1, 0);
Ritor1
parents:
diff changeset
2634 }
Ritor1
parents:
diff changeset
2635
Ritor1
parents:
diff changeset
2636 for (uint i = 0; i < 2; ++i)
Ritor1
parents:
diff changeset
2637 {
Ritor1
parents:
diff changeset
2638 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]];
Ritor1
parents:
diff changeset
2639 if (pBuf->uExpireTime == 0)
Ritor1
parents:
diff changeset
2640 continue;
Ritor1
parents:
diff changeset
2641
Ritor1
parents:
diff changeset
2642 if ( !(pBuf->uFlags & 1) )
Ritor1
parents:
diff changeset
2643 {
Ritor1
parents:
diff changeset
2644 if (!pPlayers[pBuf->uCaster]->CanAct())
Ritor1
parents:
diff changeset
2645 {
Ritor1
parents:
diff changeset
2646 pBuf->Reset();
Ritor1
parents:
diff changeset
2647 if (dword_4EE07C[i] == 7 )
Ritor1
parents:
diff changeset
2648 pParty->bFlying = false;
Ritor1
parents:
diff changeset
2649 }
Ritor1
parents:
diff changeset
2650 }
Ritor1
parents:
diff changeset
2651 }
Ritor1
parents:
diff changeset
2652
Ritor1
parents:
diff changeset
2653 v51 = v65;
Ritor1
parents:
diff changeset
2654 if ( v65 )
Ritor1
parents:
diff changeset
2655 goto LABEL_135;
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2656 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
2657 {
Ritor1
parents:
diff changeset
2658 v52 = (signed int)&pPlayers[1];
Ritor1
parents:
diff changeset
2659 while ( 1 )
Ritor1
parents:
diff changeset
2660 {
Ritor1
parents:
diff changeset
2661 v53 = *(int *)v52;
Ritor1
parents:
diff changeset
2662 if ( *(_QWORD *)(*(int *)v52 + 16) )
Ritor1
parents:
diff changeset
2663 break;
Ritor1
parents:
diff changeset
2664 v52 += 4;
Ritor1
parents:
diff changeset
2665 if ( v52 > (signed int)&pPlayers[4] )
Ritor1
parents:
diff changeset
2666 goto LABEL_135;
Ritor1
parents:
diff changeset
2667 }
Ritor1
parents:
diff changeset
2668 *(int *)(v53 + 16) = 0;
Ritor1
parents:
diff changeset
2669 *(int *)(v53 + 20) = 0;
Ritor1
parents:
diff changeset
2670 v51 = 1;
Ritor1
parents:
diff changeset
2671 LABEL_135:
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2672 if ( pCurrentScreen != SCREEN_REST
0
Ritor1
parents:
diff changeset
2673 && (!v51 || dword_5C35C0) )
981
a6ef7125f6e4 Autonotes & GameState
Nomad
parents: 978
diff changeset
2674 uGameState = GAME_STATE_PARTY_DIED;
0
Ritor1
parents:
diff changeset
2675 }
Ritor1
parents:
diff changeset
2676 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
2677 {
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
2678 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
2679 {
Ritor1
parents:
diff changeset
2680 v54 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
2681 if ( v54->pConditions[2]
Ritor1
parents:
diff changeset
2682 || v54->pConditions[12]
Ritor1
parents:
diff changeset
2683 || v54->pConditions[13]
Ritor1
parents:
diff changeset
2684 || v54->pConditions[14]
Ritor1
parents:
diff changeset
2685 || v54->pConditions[15]
Ritor1
parents:
diff changeset
2686 || v54->pConditions[16] )
Ritor1
parents:
diff changeset
2687 {
Ritor1
parents:
diff changeset
2688 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
2689 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2690 }
Ritor1
parents:
diff changeset
2691 }
Ritor1
parents:
diff changeset
2692 }
Ritor1
parents:
diff changeset
2693 }
Ritor1
parents:
diff changeset
2694
Ritor1
parents:
diff changeset
2695 //----- (00494820) --------------------------------------------------------
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2696 unsigned int __fastcall _494820_training_time(unsigned int a1)
0
Ritor1
parents:
diff changeset
2697 {
Ritor1
parents:
diff changeset
2698 signed int v1; // eax@1
Ritor1
parents:
diff changeset
2699
Ritor1
parents:
diff changeset
2700 v1 = 5;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2701 if ( a1 % 24 >= 5 )
0
Ritor1
parents:
diff changeset
2702 v1 = 29;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
2703 return v1 - a1 % 24;
0
Ritor1
parents:
diff changeset
2704 }
Ritor1
parents:
diff changeset
2705
Ritor1
parents:
diff changeset
2706 //----- (00494836) --------------------------------------------------------
Ritor1
parents:
diff changeset
2707 int stru339_spell_sound::_494836(int uSoundID, int a6)
Ritor1
parents:
diff changeset
2708 {
Ritor1
parents:
diff changeset
2709 int v3; // esi@1
Ritor1
parents:
diff changeset
2710 int result; // eax@1
Ritor1
parents:
diff changeset
2711 stru339_spell_sound *v5; // ebx@1
Ritor1
parents:
diff changeset
2712 int *v6; // edi@2
Ritor1
parents:
diff changeset
2713 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
2714 int v8; // [sp+Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
2715 int v9; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
2716 int a2a; // [sp+1Ch] [bp+8h]@1
Ritor1
parents:
diff changeset
2717
Ritor1
parents:
diff changeset
2718 v3 = 0;
Ritor1
parents:
diff changeset
2719 result = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
2720 v5 = this;
Ritor1
parents:
diff changeset
2721 a2a = word_4EE088_sound_ids[uSoundID];
Ritor1
parents:
diff changeset
2722 if ( result )
Ritor1
parents:
diff changeset
2723 {
Ritor1
parents:
diff changeset
2724 v9 = 0;
Ritor1
parents:
diff changeset
2725 v6 = this->pSoundsOffsets;
Ritor1
parents:
diff changeset
2726 do
Ritor1
parents:
diff changeset
2727 {
Ritor1
parents:
diff changeset
2728 v7 = a2a++;
Ritor1
parents:
diff changeset
2729 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6);
Ritor1
parents:
diff changeset
2730 if ( !result )
Ritor1
parents:
diff changeset
2731 break;
Ritor1
parents:
diff changeset
2732 a6 += 4;
Ritor1
parents:
diff changeset
2733 result = v8 + 256;
Ritor1
parents:
diff changeset
2734 *v6 = v3;
Ritor1
parents:
diff changeset
2735 v3 += result;
Ritor1
parents:
diff changeset
2736 ++v9;
Ritor1
parents:
diff changeset
2737 *(v6 - 2) = result;
Ritor1
parents:
diff changeset
2738 ++v6;
Ritor1
parents:
diff changeset
2739 }
Ritor1
parents:
diff changeset
2740 while ( v9 < 2 );
Ritor1
parents:
diff changeset
2741 }
Ritor1
parents:
diff changeset
2742 return result;
Ritor1
parents:
diff changeset
2743 }
Ritor1
parents:
diff changeset
2744 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
2745
Ritor1
parents:
diff changeset
2746 //----- (00494AED) --------------------------------------------------------
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2747 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
0
Ritor1
parents:
diff changeset
2748 {
Ritor1
parents:
diff changeset
2749 unsigned int _uNumFrames; // edx@1
Ritor1
parents:
diff changeset
2750 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
2751 PlayerFrame *v4; // ecx@2
Ritor1
parents:
diff changeset
2752
Ritor1
parents:
diff changeset
2753 _uNumFrames = this->uNumFrames;
Ritor1
parents:
diff changeset
2754 result = 0;
Ritor1
parents:
diff changeset
2755 if ( (signed int)this->uNumFrames <= 0 )
Ritor1
parents:
diff changeset
2756 {
Ritor1
parents:
diff changeset
2757 LABEL_5:
Ritor1
parents:
diff changeset
2758 result = 0;
Ritor1
parents:
diff changeset
2759 }
Ritor1
parents:
diff changeset
2760 else
Ritor1
parents:
diff changeset
2761 {
Ritor1
parents:
diff changeset
2762 v4 = this->pFrames;
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2763 while ( v4->expression != expression )
0
Ritor1
parents:
diff changeset
2764 {
Ritor1
parents:
diff changeset
2765 ++result;
Ritor1
parents:
diff changeset
2766 ++v4;
Ritor1
parents:
diff changeset
2767 if ( (signed int)result >= (signed int)_uNumFrames )
Ritor1
parents:
diff changeset
2768 goto LABEL_5;
Ritor1
parents:
diff changeset
2769 }
Ritor1
parents:
diff changeset
2770 }
Ritor1
parents:
diff changeset
2771 return result;
Ritor1
parents:
diff changeset
2772 }
Ritor1
parents:
diff changeset
2773
Ritor1
parents:
diff changeset
2774 //----- (00494B10) --------------------------------------------------------
Ritor1
parents:
diff changeset
2775 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
2776 {
Ritor1
parents:
diff changeset
2777 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
2778 PlayerFrame *v4; // edi@1
Ritor1
parents:
diff changeset
2779 PlayerFrame *v5; // ecx@1
Ritor1
parents:
diff changeset
2780 __int16 v6; // dx@2
Ritor1
parents:
diff changeset
2781 int v7; // edx@3
Ritor1
parents:
diff changeset
2782 char *i; // eax@3
Ritor1
parents:
diff changeset
2783 int v9; // ecx@5
Ritor1
parents:
diff changeset
2784 PlayerFrame *result; // eax@6
Ritor1
parents:
diff changeset
2785
Ritor1
parents:
diff changeset
2786 v3 = uFramesetID;
Ritor1
parents:
diff changeset
2787 v4 = this->pFrames;
Ritor1
parents:
diff changeset
2788 v5 = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2789 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
2790 {
Ritor1
parents:
diff changeset
2791 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6;
Ritor1
parents:
diff changeset
2792 for ( i = (char *)&v5->uAnimTime; ; i += 10 )
Ritor1
parents:
diff changeset
2793 {
Ritor1
parents:
diff changeset
2794 v9 = *(short *)i;
Ritor1
parents:
diff changeset
2795 if ( v7 <= v9 )
Ritor1
parents:
diff changeset
2796 break;
Ritor1
parents:
diff changeset
2797 v7 -= v9;
Ritor1
parents:
diff changeset
2798 ++v3;
Ritor1
parents:
diff changeset
2799 }
Ritor1
parents:
diff changeset
2800 result = &v4[v3];
Ritor1
parents:
diff changeset
2801 }
Ritor1
parents:
diff changeset
2802 else
Ritor1
parents:
diff changeset
2803 {
Ritor1
parents:
diff changeset
2804 result = &v4[uFramesetID];
Ritor1
parents:
diff changeset
2805 }
Ritor1
parents:
diff changeset
2806 return result;
Ritor1
parents:
diff changeset
2807 }
Ritor1
parents:
diff changeset
2808
Ritor1
parents:
diff changeset
2809 //----- (00494B5E) --------------------------------------------------------
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2810 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
0
Ritor1
parents:
diff changeset
2811 {
Ritor1
parents:
diff changeset
2812 PlayerFrameTable *v4; // edi@1
Ritor1
parents:
diff changeset
2813 int v5; // esi@1
Ritor1
parents:
diff changeset
2814 int v6; // eax@2
Ritor1
parents:
diff changeset
2815
Ritor1
parents:
diff changeset
2816 v4 = this;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2817 v5 = a4 + *pAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2818 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
2819 {
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2820 *pAnimTime = v5;
0
Ritor1
parents:
diff changeset
2821 }
Ritor1
parents:
diff changeset
2822 else
Ritor1
parents:
diff changeset
2823 {
Ritor1
parents:
diff changeset
2824 v6 = rand() % 4 + 21;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2825 *pFramesetID = v6;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2826 *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
2827 }
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
2828 return &v4->pFrames[*pFramesetID];
0
Ritor1
parents:
diff changeset
2829 }
Ritor1
parents:
diff changeset
2830
Ritor1
parents:
diff changeset
2831 //----- (00494BC3) --------------------------------------------------------
Ritor1
parents:
diff changeset
2832 void PlayerFrameTable::ToFile()
Ritor1
parents:
diff changeset
2833 {
Ritor1
parents:
diff changeset
2834 PlayerFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
2835 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
2836 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
2837
Ritor1
parents:
diff changeset
2838 auto Str = this;
Ritor1
parents:
diff changeset
2839
Ritor1
parents:
diff changeset
2840 v1 = Str;
Ritor1
parents:
diff changeset
2841 v2 = fopen("data\\dpft.bin", "wb");
Ritor1
parents:
diff changeset
2842 v3 = v2;
Ritor1
parents:
diff changeset
2843 if ( !v2 )
Ritor1
parents:
diff changeset
2844 Abortf("Unable to save dpft.bin!");
Ritor1
parents:
diff changeset
2845 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
2846 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
Ritor1
parents:
diff changeset
2847 fclose(v3);
Ritor1
parents:
diff changeset
2848 }
Ritor1
parents:
diff changeset
2849
Ritor1
parents:
diff changeset
2850 //----- (00494C0F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2851 void PlayerFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
2852 {
Ritor1
parents:
diff changeset
2853 uNumFrames = *(int *)pSerialized;
Ritor1
parents:
diff changeset
2854 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames");
Ritor1
parents:
diff changeset
2855 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames);
Ritor1
parents:
diff changeset
2856 }
Ritor1
parents:
diff changeset
2857
Ritor1
parents:
diff changeset
2858 //----- (00494C5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2859 int PlayerFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
2860 {
Ritor1
parents:
diff changeset
2861 PlayerFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
2862 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
2863 int v4; // esi@3
Ritor1
parents:
diff changeset
2864 void *v5; // eax@10
Ritor1
parents:
diff changeset
2865 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
2866 char *i; // eax@12
Ritor1
parents:
diff changeset
2867 __int16 v8; // ax@15
Ritor1
parents:
diff changeset
2868 const char *v9; // ST10_4@15
Ritor1
parents:
diff changeset
2869 unsigned __int16 v10; // ax@15
Ritor1
parents:
diff changeset
2870 const char *v11; // ST0C_4@15
Ritor1
parents:
diff changeset
2871 int j; // esi@15
Ritor1
parents:
diff changeset
2872 int v13; // eax@17
Ritor1
parents:
diff changeset
2873 int v14; // edx@22
Ritor1
parents:
diff changeset
2874 int v15; // ecx@23
Ritor1
parents:
diff changeset
2875 int v16; // eax@24
Ritor1
parents:
diff changeset
2876 signed int k; // eax@27
Ritor1
parents:
diff changeset
2877 PlayerFrame *v18; // edx@28
Ritor1
parents:
diff changeset
2878 int v19; // esi@28
Ritor1
parents:
diff changeset
2879 int l; // ecx@29
Ritor1
parents:
diff changeset
2880 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
2881 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
2882 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
2883 int v25; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
2884 int v26; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
2885 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
2886 int Argsa; // [sp+30Ch] [bp+8h]@28
Ritor1
parents:
diff changeset
2887
Ritor1
parents:
diff changeset
2888 v2 = this;
Ritor1
parents:
diff changeset
2889 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
2890 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
2891 File = v3;
Ritor1
parents:
diff changeset
2892 if ( !v3 )
Ritor1
parents:
diff changeset
2893 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
2894 v4 = 0;
Ritor1
parents:
diff changeset
2895 v25 = 0;
Ritor1
parents:
diff changeset
2896 v26 = 1;
Ritor1
parents:
diff changeset
2897 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
2898 {
Ritor1
parents:
diff changeset
2899 do
Ritor1
parents:
diff changeset
2900 {
Ritor1
parents:
diff changeset
2901 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
2902 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
2903 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2904 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2905 if ( v24.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
2906 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
Ritor1
parents:
diff changeset
2907 ++v25;
Ritor1
parents:
diff changeset
2908 }
Ritor1
parents:
diff changeset
2909 ++v26;
Ritor1
parents:
diff changeset
2910 }
Ritor1
parents:
diff changeset
2911 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
2912 v4 = v25;
Ritor1
parents:
diff changeset
2913 }
Ritor1
parents:
diff changeset
2914 v2->uNumFrames = v4;
Ritor1
parents:
diff changeset
2915 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames");
Ritor1
parents:
diff changeset
2916 v2->pFrames = (PlayerFrame *)v5;
Ritor1
parents:
diff changeset
2917 if ( !v5 )
Ritor1
parents:
diff changeset
2918 Abortf("PlayerFrameTable::load - Out of Memory!");
Ritor1
parents:
diff changeset
2919 v6 = File;
Ritor1
parents:
diff changeset
2920 v2->uNumFrames = 0;
Ritor1
parents:
diff changeset
2921 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
2922 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
2923 {
Ritor1
parents:
diff changeset
2924 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
2925 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
2926 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
2927 {
Ritor1
parents:
diff changeset
2928 v8 = atoi(v24.pProperties[0]);
Ritor1
parents:
diff changeset
2929 v9 = v24.pProperties[1];
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
2930 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8;
0
Ritor1
parents:
diff changeset
2931 v10 = atoi(v9);
Ritor1
parents:
diff changeset
2932 v11 = v24.pProperties[2];
Ritor1
parents:
diff changeset
2933 v2->pFrames[v2->uNumFrames].uTextureID = v10;
Ritor1
parents:
diff changeset
2934 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11);
Ritor1
parents:
diff changeset
2935 v2->pFrames[v2->uNumFrames].uAnimLength = 0;
Ritor1
parents:
diff changeset
2936 v2->pFrames[v2->uNumFrames].uFlags = 0;
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
2937 for ( j = 3; j < v24.uPropCount; ++j )
0
Ritor1
parents:
diff changeset
2938 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
2939 if ( !_stricmp(v24.pProperties[j], "New") )
0
Ritor1
parents:
diff changeset
2940 {
Ritor1
parents:
diff changeset
2941 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags;
Ritor1
parents:
diff changeset
2942 *(char *)v13 |= 4u;
Ritor1
parents:
diff changeset
2943 }
Ritor1
parents:
diff changeset
2944 }
Ritor1
parents:
diff changeset
2945 ++v2->uNumFrames;
Ritor1
parents:
diff changeset
2946 }
Ritor1
parents:
diff changeset
2947 }
Ritor1
parents:
diff changeset
2948 fclose(File);
Ritor1
parents:
diff changeset
2949 v14 = 0;
Ritor1
parents:
diff changeset
2950 if ( (signed int)(v2->uNumFrames - 1) > 0 )
Ritor1
parents:
diff changeset
2951 {
Ritor1
parents:
diff changeset
2952 v15 = 0;
Ritor1
parents:
diff changeset
2953 do
Ritor1
parents:
diff changeset
2954 {
Ritor1
parents:
diff changeset
2955 v16 = (int)&v2->pFrames[v15];
Ritor1
parents:
diff changeset
2956 if ( !(*(char *)(v16 + 18) & 4) )
Ritor1
parents:
diff changeset
2957 *(char *)(v16 + 8) |= 1u;
Ritor1
parents:
diff changeset
2958 ++v14;
Ritor1
parents:
diff changeset
2959 ++v15;
Ritor1
parents:
diff changeset
2960 }
Ritor1
parents:
diff changeset
2961 while ( v14 < (signed int)(v2->uNumFrames - 1) );
Ritor1
parents:
diff changeset
2962 }
Ritor1
parents:
diff changeset
2963 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 )
Ritor1
parents:
diff changeset
2964 {
Ritor1
parents:
diff changeset
2965 v18 = v2->pFrames;
Ritor1
parents:
diff changeset
2966 Argsa = (int)&v18[k];
Ritor1
parents:
diff changeset
2967 v19 = *(short *)(Argsa + 4);
Ritor1
parents:
diff changeset
2968 if ( *(char *)(Argsa + 8) & 1 )
Ritor1
parents:
diff changeset
2969 {
Ritor1
parents:
diff changeset
2970 ++k;
Ritor1
parents:
diff changeset
2971 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 )
Ritor1
parents:
diff changeset
2972 {
Ritor1
parents:
diff changeset
2973 v19 += *(short *)(l + 4);
Ritor1
parents:
diff changeset
2974 ++k;
Ritor1
parents:
diff changeset
2975 }
Ritor1
parents:
diff changeset
2976 LOWORD(v19) = v18[k].uAnimTime + v19;
Ritor1
parents:
diff changeset
2977 }
Ritor1
parents:
diff changeset
2978 ++k;
Ritor1
parents:
diff changeset
2979 }
Ritor1
parents:
diff changeset
2980 return 1;
Ritor1
parents:
diff changeset
2981 }
Ritor1
parents:
diff changeset
2982
Ritor1
parents:
diff changeset
2983 //----- (00494F3A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2984 unsigned int IconFrameTable::FindIcon(const char *pIconName)
Ritor1
parents:
diff changeset
2985 {
Ritor1
parents:
diff changeset
2986 IconFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
2987 int v3; // ebx@1
Ritor1
parents:
diff changeset
2988 unsigned int uID; // edi@1
Ritor1
parents:
diff changeset
2989 unsigned int result; // eax@4
Ritor1
parents:
diff changeset
2990
Ritor1
parents:
diff changeset
2991 v2 = this;
Ritor1
parents:
diff changeset
2992 v3 = 0;
Ritor1
parents:
diff changeset
2993 uID = 0;
Ritor1
parents:
diff changeset
2994 if ( (signed int)this->uNumIcons <= 0 )
Ritor1
parents:
diff changeset
2995 {
Ritor1
parents:
diff changeset
2996 LABEL_4:
Ritor1
parents:
diff changeset
2997 result = 0;
Ritor1
parents:
diff changeset
2998 }
Ritor1
parents:
diff changeset
2999 else
Ritor1
parents:
diff changeset
3000 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3001 while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) )
0
Ritor1
parents:
diff changeset
3002 {
Ritor1
parents:
diff changeset
3003 ++uID;
Ritor1
parents:
diff changeset
3004 ++v3;
Ritor1
parents:
diff changeset
3005 if ( (signed int)uID >= (signed int)v2->uNumIcons )
Ritor1
parents:
diff changeset
3006 goto LABEL_4;
Ritor1
parents:
diff changeset
3007 }
Ritor1
parents:
diff changeset
3008 result = uID;
Ritor1
parents:
diff changeset
3009 }
Ritor1
parents:
diff changeset
3010 return result;
Ritor1
parents:
diff changeset
3011 }
Ritor1
parents:
diff changeset
3012
Ritor1
parents:
diff changeset
3013 //----- (00494F70) --------------------------------------------------------
Ritor1
parents:
diff changeset
3014 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
3015 {
Ritor1
parents:
diff changeset
3016 IconFrame *v3; // edi@1
Ritor1
parents:
diff changeset
3017 IconFrame *v4; // ecx@1
Ritor1
parents:
diff changeset
3018 __int16 v5; // dx@2
Ritor1
parents:
diff changeset
3019 int v6; // edx@3
Ritor1
parents:
diff changeset
3020 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
3021 char *i; // ecx@3
Ritor1
parents:
diff changeset
3022 int v9; // esi@5
Ritor1
parents:
diff changeset
3023 IconFrame *result; // eax@6
Ritor1
parents:
diff changeset
3024
Ritor1
parents:
diff changeset
3025 v3 = this->pIcons;
Ritor1
parents:
diff changeset
3026 v4 = &v3[uIconID];
Ritor1
parents:
diff changeset
3027 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
3028 {
Ritor1
parents:
diff changeset
3029 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5;
Ritor1
parents:
diff changeset
3030 v7 = uIconID;
Ritor1
parents:
diff changeset
3031 for ( i = (char *)&v4->uAnimTime; ; i += 32 )
Ritor1
parents:
diff changeset
3032 {
Ritor1
parents:
diff changeset
3033 v9 = *(short *)i;
Ritor1
parents:
diff changeset
3034 if ( v6 <= v9 )
Ritor1
parents:
diff changeset
3035 break;
Ritor1
parents:
diff changeset
3036 v6 -= v9;
Ritor1
parents:
diff changeset
3037 ++v7;
Ritor1
parents:
diff changeset
3038 }
Ritor1
parents:
diff changeset
3039 result = &v3[v7];
Ritor1
parents:
diff changeset
3040 }
Ritor1
parents:
diff changeset
3041 else
Ritor1
parents:
diff changeset
3042 {
Ritor1
parents:
diff changeset
3043 result = &v3[uIconID];
Ritor1
parents:
diff changeset
3044 }
Ritor1
parents:
diff changeset
3045 return result;
Ritor1
parents:
diff changeset
3046 }
Ritor1
parents:
diff changeset
3047
Ritor1
parents:
diff changeset
3048 //----- (00494FBF) --------------------------------------------------------
Ritor1
parents:
diff changeset
3049 void IconFrameTable::InitializeAnimation(unsigned int uIconID)
Ritor1
parents:
diff changeset
3050 {
Ritor1
parents:
diff changeset
3051 IconFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
3052 unsigned int v3; // edi@3
Ritor1
parents:
diff changeset
3053 const char *i; // eax@3
Ritor1
parents:
diff changeset
3054 IconFrame *v5; // eax@5
Ritor1
parents:
diff changeset
3055
Ritor1
parents:
diff changeset
3056 v2 = this;
Ritor1
parents:
diff changeset
3057 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 )
Ritor1
parents:
diff changeset
3058 {
Ritor1
parents:
diff changeset
3059 v3 = uIconID;
Ritor1
parents:
diff changeset
3060 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName )
Ritor1
parents:
diff changeset
3061 {
Ritor1
parents:
diff changeset
3062 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
3063 v5 = v2->pIcons;
Ritor1
parents:
diff changeset
3064 if ( !(v5[v3].uFlags & 1) )
Ritor1
parents:
diff changeset
3065 break;
Ritor1
parents:
diff changeset
3066 ++v3;
Ritor1
parents:
diff changeset
3067 }
Ritor1
parents:
diff changeset
3068 }
Ritor1
parents:
diff changeset
3069 }
Ritor1
parents:
diff changeset
3070
Ritor1
parents:
diff changeset
3071 //----- (0049500A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3072 void IconFrameTable::ToFile()
Ritor1
parents:
diff changeset
3073 {
Ritor1
parents:
diff changeset
3074 IconFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
3075 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
3076 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
3077
Ritor1
parents:
diff changeset
3078 auto Str = this;
Ritor1
parents:
diff changeset
3079
Ritor1
parents:
diff changeset
3080 v1 = Str;
Ritor1
parents:
diff changeset
3081 v2 = fopen("data\\dift.bin", "wb");
Ritor1
parents:
diff changeset
3082 v3 = v2;
Ritor1
parents:
diff changeset
3083 if ( !v2 )
Ritor1
parents:
diff changeset
3084 Abortf("Unable to save dift.bin!");
Ritor1
parents:
diff changeset
3085 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
3086 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3);
Ritor1
parents:
diff changeset
3087 fclose(v3);
Ritor1
parents:
diff changeset
3088 }
Ritor1
parents:
diff changeset
3089
Ritor1
parents:
diff changeset
3090 //----- (00495056) --------------------------------------------------------
Ritor1
parents:
diff changeset
3091 void IconFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
3092 {
Ritor1
parents:
diff changeset
3093 uNumIcons = *(int *)pSerialized;
Ritor1
parents:
diff changeset
3094 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames");
Ritor1
parents:
diff changeset
3095 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons);
Ritor1
parents:
diff changeset
3096 }
Ritor1
parents:
diff changeset
3097
Ritor1
parents:
diff changeset
3098 //----- (0049509D) --------------------------------------------------------
Ritor1
parents:
diff changeset
3099 int IconFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
3100 {
Ritor1
parents:
diff changeset
3101 IconFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
3102 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
3103 int v4; // esi@3
Ritor1
parents:
diff changeset
3104 void *v5; // eax@10
Ritor1
parents:
diff changeset
3105 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
3106 char *i; // eax@12
Ritor1
parents:
diff changeset
3107 const char *v8; // ST00_4@15
Ritor1
parents:
diff changeset
3108 int v9; // eax@16
Ritor1
parents:
diff changeset
3109 int v10; // edx@20
Ritor1
parents:
diff changeset
3110 int v11; // ecx@21
Ritor1
parents:
diff changeset
3111 int v12; // eax@22
Ritor1
parents:
diff changeset
3112 signed int j; // edx@25
Ritor1
parents:
diff changeset
3113 IconFrame *v14; // ecx@26
Ritor1
parents:
diff changeset
3114 int v15; // esi@26
Ritor1
parents:
diff changeset
3115 int k; // eax@27
Ritor1
parents:
diff changeset
3116 signed int result; // eax@11
Ritor1
parents:
diff changeset
3117 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
3118 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
3119 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
3120 int v21; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
3121 int v22; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
3122 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
3123 int Argsa; // [sp+30Ch] [bp+8h]@26
Ritor1
parents:
diff changeset
3124
Ritor1
parents:
diff changeset
3125 v2 = this;
Ritor1
parents:
diff changeset
3126 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
3127 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
3128 File = v3;
Ritor1
parents:
diff changeset
3129 if ( !v3 )
Ritor1
parents:
diff changeset
3130 Abortf("IconFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
3131 v4 = 0;
Ritor1
parents:
diff changeset
3132 v21 = 0;
Ritor1
parents:
diff changeset
3133 v22 = 1;
Ritor1
parents:
diff changeset
3134 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
3135 {
Ritor1
parents:
diff changeset
3136 do
Ritor1
parents:
diff changeset
3137 {
Ritor1
parents:
diff changeset
3138 *strchr(&Buf, 10) = 0;
Ritor1
parents:
diff changeset
3139 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
3140 if ( v20.uPropCount && *v20.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3141 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
3142 if ( v20.uPropCount < 3 )
0
Ritor1
parents:
diff changeset
3143 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22);
Ritor1
parents:
diff changeset
3144 ++v21;
Ritor1
parents:
diff changeset
3145 }
Ritor1
parents:
diff changeset
3146 ++v22;
Ritor1
parents:
diff changeset
3147 }
Ritor1
parents:
diff changeset
3148 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
3149 v4 = v21;
Ritor1
parents:
diff changeset
3150 }
Ritor1
parents:
diff changeset
3151 v2->uNumIcons = v4;
Ritor1
parents:
diff changeset
3152 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames");
Ritor1
parents:
diff changeset
3153 v2->pIcons = (IconFrame *)v5;
Ritor1
parents:
diff changeset
3154 if ( v5 )
Ritor1
parents:
diff changeset
3155 {
Ritor1
parents:
diff changeset
3156 v6 = File;
Ritor1
parents:
diff changeset
3157 v2->uNumIcons = 0;
Ritor1
parents:
diff changeset
3158 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
3159 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
3160 {
Ritor1
parents:
diff changeset
3161 *strchr(&Buf, 10) = 0;
Ritor1
parents:
diff changeset
3162 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
3163 if ( v20.uPropCount && *v20.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
3164 {
Ritor1
parents:
diff changeset
3165 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]);
Ritor1
parents:
diff changeset
3166 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]);
Ritor1
parents:
diff changeset
3167 v8 = v20.pProperties[2];
Ritor1
parents:
diff changeset
3168 v2->pIcons[v2->uNumIcons].uFlags = 0;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
3169 if ( !_stricmp(v8, "new") )
0
Ritor1
parents:
diff changeset
3170 {
Ritor1
parents:
diff changeset
3171 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags;
Ritor1
parents:
diff changeset
3172 *(char *)v9 |= 4u;
Ritor1
parents:
diff changeset
3173 }
Ritor1
parents:
diff changeset
3174 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]);
Ritor1
parents:
diff changeset
3175 v2->pIcons[v2->uNumIcons].uAnimLength = 0;
Ritor1
parents:
diff changeset
3176 v2->pIcons[v2->uNumIcons++].uTextureID = 0;
Ritor1
parents:
diff changeset
3177 }
Ritor1
parents:
diff changeset
3178 }
Ritor1
parents:
diff changeset
3179 fclose(File);
Ritor1
parents:
diff changeset
3180 v10 = 0;
Ritor1
parents:
diff changeset
3181 if ( (signed int)(v2->uNumIcons - 1) > 0 )
Ritor1
parents:
diff changeset
3182 {
Ritor1
parents:
diff changeset
3183 v11 = 0;
Ritor1
parents:
diff changeset
3184 do
Ritor1
parents:
diff changeset
3185 {
Ritor1
parents:
diff changeset
3186 v12 = (int)&v2->pIcons[v11];
Ritor1
parents:
diff changeset
3187 if ( !(*(char *)(v12 + 60) & 4) )
Ritor1
parents:
diff changeset
3188 *(char *)(v12 + 28) |= 1u;
Ritor1
parents:
diff changeset
3189 ++v10;
Ritor1
parents:
diff changeset
3190 ++v11;
Ritor1
parents:
diff changeset
3191 }
Ritor1
parents:
diff changeset
3192 while ( v10 < (signed int)(v2->uNumIcons - 1) );
Ritor1
parents:
diff changeset
3193 }
Ritor1
parents:
diff changeset
3194 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 )
Ritor1
parents:
diff changeset
3195 {
Ritor1
parents:
diff changeset
3196 v14 = v2->pIcons;
Ritor1
parents:
diff changeset
3197 Argsa = (int)&v14[j];
Ritor1
parents:
diff changeset
3198 v15 = *(short *)(Argsa + 24);
Ritor1
parents:
diff changeset
3199 if ( *(char *)(Argsa + 28) & 1 )
Ritor1
parents:
diff changeset
3200 {
Ritor1
parents:
diff changeset
3201 ++j;
Ritor1
parents:
diff changeset
3202 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 )
Ritor1
parents:
diff changeset
3203 {
Ritor1
parents:
diff changeset
3204 v15 += *(short *)(k + 24);
Ritor1
parents:
diff changeset
3205 ++j;
Ritor1
parents:
diff changeset
3206 }
Ritor1
parents:
diff changeset
3207 LOWORD(v15) = v14[j].uAnimTime + v15;
Ritor1
parents:
diff changeset
3208 }
Ritor1
parents:
diff changeset
3209 ++j;
Ritor1
parents:
diff changeset
3210 }
Ritor1
parents:
diff changeset
3211 result = 1;
Ritor1
parents:
diff changeset
3212 }
Ritor1
parents:
diff changeset
3213 else
Ritor1
parents:
diff changeset
3214 {
Ritor1
parents:
diff changeset
3215 fclose(File);
Ritor1
parents:
diff changeset
3216 result = 0;
Ritor1
parents:
diff changeset
3217 }
Ritor1
parents:
diff changeset
3218 return result;
Ritor1
parents:
diff changeset
3219 }
Ritor1
parents:
diff changeset
3220
Ritor1
parents:
diff changeset
3221 //----- (00495366) --------------------------------------------------------
Ritor1
parents:
diff changeset
3222 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2)
Ritor1
parents:
diff changeset
3223 {
Ritor1
parents:
diff changeset
3224 int v2; // edi@1
Ritor1
parents:
diff changeset
3225 int v3; // edx@2
Ritor1
parents:
diff changeset
3226 int v4; // esi@3
Ritor1
parents:
diff changeset
3227 int v5; // ebx@5
Ritor1
parents:
diff changeset
3228 signed int v7; // [sp+Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
3229 signed int v8; // [sp+10h] [bp-10h]@1
Ritor1
parents:
diff changeset
3230 int **v9; // [sp+14h] [bp-Ch]@4
Ritor1
parents:
diff changeset
3231 signed int v10; // [sp+18h] [bp-8h]@3
Ritor1
parents:
diff changeset
3232 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
3233
Ritor1
parents:
diff changeset
3234 v2 = a1;
Ritor1
parents:
diff changeset
3235 v11 = a2;
Ritor1
parents:
diff changeset
3236 v8 = 0;
Ritor1
parents:
diff changeset
3237 v7 = 0;
Ritor1
parents:
diff changeset
3238 if ( dword_AE336C == a1 )
Ritor1
parents:
diff changeset
3239 {
Ritor1
parents:
diff changeset
3240 v3 = dword_AE3370;
Ritor1
parents:
diff changeset
3241 }
Ritor1
parents:
diff changeset
3242 else
Ritor1
parents:
diff changeset
3243 {
Ritor1
parents:
diff changeset
3244 v4 = a2;
Ritor1
parents:
diff changeset
3245 dword_AE336C = a1;
Ritor1
parents:
diff changeset
3246 v10 = 0;
Ritor1
parents:
diff changeset
3247 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 )
Ritor1
parents:
diff changeset
3248 goto LABEL_17;
Ritor1
parents:
diff changeset
3249 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4);
Ritor1
parents:
diff changeset
3250 do
Ritor1
parents:
diff changeset
3251 {
Ritor1
parents:
diff changeset
3252 v5 = tolower(*(char *)*v9);
Ritor1
parents:
diff changeset
3253 if ( v5 == tolower(v2) )
Ritor1
parents:
diff changeset
3254 {
Ritor1
parents:
diff changeset
3255 if ( v8 )
Ritor1
parents:
diff changeset
3256 v7 = v10;
Ritor1
parents:
diff changeset
3257 else
Ritor1
parents:
diff changeset
3258 v8 = v10;
Ritor1
parents:
diff changeset
3259 }
Ritor1
parents:
diff changeset
3260 ++v10;
Ritor1
parents:
diff changeset
3261 v9 += 2;
Ritor1
parents:
diff changeset
3262 }
Ritor1
parents:
diff changeset
3263 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] );
Ritor1
parents:
diff changeset
3264 if ( v8 && v8 != v7 )
Ritor1
parents:
diff changeset
3265 v3 = v8 + rand() % (v7 - v8);
Ritor1
parents:
diff changeset
3266 else
Ritor1
parents:
diff changeset
3267 LABEL_17:
Ritor1
parents:
diff changeset
3268 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
Ritor1
parents:
diff changeset
3269 }
Ritor1
parents:
diff changeset
3270 dword_AE3370 = v3;
Ritor1
parents:
diff changeset
3271 return pNPCStats->pNPCNames[0][v11 + 2 * v3];
Ritor1
parents:
diff changeset
3272 }
Ritor1
parents:
diff changeset
3273 // AE336C: using guessed type int dword_AE336C;
Ritor1
parents:
diff changeset
3274 // AE3370: using guessed type int dword_AE3370;
Ritor1
parents:
diff changeset
3275
Ritor1
parents:
diff changeset
3276 //----- (00495430) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
3277 char * GetReputationString( signed int a1 )
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
3278 {
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3279 if (a1 >= 25)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3280 return pGlobalTXT_LocalizationStrings[379]; // Hated
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3281 else if (a1 >= 6)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3282 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3283 else if (a1 >= -5)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3284 return pGlobalTXT_LocalizationStrings[399]; // Neutral;
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3285 else if (a1 >= -24)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3286 return pGlobalTXT_LocalizationStrings[402]; // Friendly
0
Ritor1
parents:
diff changeset
3287 else
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
3288 return pGlobalTXT_LocalizationStrings[434]; // Respected;
0
Ritor1
parents:
diff changeset
3289 }
Ritor1
parents:
diff changeset
3290
Ritor1
parents:
diff changeset
3291 //----- (00495461) --------------------------------------------------------
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3292 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
0
Ritor1
parents:
diff changeset
3293 {
Ritor1
parents:
diff changeset
3294 unsigned __int8 v6; // bl@1
Ritor1
parents:
diff changeset
3295 Player *pPlayer; // ebx@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3296 //NPCData *v9; // eax@4
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3297 //size_t v10; // eax@6
0
Ritor1
parents:
diff changeset
3298 char *v11; // esi@7
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3299 //int v12; // edx@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3300 //ItemGen *v13; // edi@7
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3301 //char v14; // cl@8
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3302 //char *v15; // ecx@10
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3303 //int v16; // edx@10
0
Ritor1
parents:
diff changeset
3304 int v17; // eax@10
Ritor1
parents:
diff changeset
3305 signed __int64 v18; // qax@18
Ritor1
parents:
diff changeset
3306 unsigned int v19; // edi@32
Ritor1
parents:
diff changeset
3307 unsigned __int8 *v20; // ebx@32
Ritor1
parents:
diff changeset
3308 int v21; // ecx@34
Ritor1
parents:
diff changeset
3309 __int16 v22; // ax@34
Ritor1
parents:
diff changeset
3310 int v23; // edx@39
Ritor1
parents:
diff changeset
3311 int v24; // eax@39
Ritor1
parents:
diff changeset
3312 int v25; // eax@45
Ritor1
parents:
diff changeset
3313 float *v26; // esi@68
Ritor1
parents:
diff changeset
3314 float v27; // ST18_4@68
Ritor1
parents:
diff changeset
3315 signed int v28; // eax@68
Ritor1
parents:
diff changeset
3316 int v29; // eax@68
Ritor1
parents:
diff changeset
3317 float v30; // ST18_4@72
Ritor1
parents:
diff changeset
3318 signed int v31; // eax@72
Ritor1
parents:
diff changeset
3319 float v32; // ST18_4@74
Ritor1
parents:
diff changeset
3320 signed int v33; // eax@74
Ritor1
parents:
diff changeset
3321 double v34; // st7@75
Ritor1
parents:
diff changeset
3322 float v35; // ST18_4@76
Ritor1
parents:
diff changeset
3323 signed int v36; // eax@76
Ritor1
parents:
diff changeset
3324 float *v37; // esi@78
Ritor1
parents:
diff changeset
3325 float v38; // ST18_4@78
Ritor1
parents:
diff changeset
3326 int v39; // eax@78
Ritor1
parents:
diff changeset
3327 float v40; // ST18_4@82
Ritor1
parents:
diff changeset
3328 int v41; // eax@82
Ritor1
parents:
diff changeset
3329 float v42; // ST18_4@83
Ritor1
parents:
diff changeset
3330 int v43; // eax@83
Ritor1
parents:
diff changeset
3331 float v44; // ST18_4@85
Ritor1
parents:
diff changeset
3332 int v45; // eax@85
Ritor1
parents:
diff changeset
3333 const char *v46; // eax@86
Ritor1
parents:
diff changeset
3334 unsigned int v47; // eax@87
Ritor1
parents:
diff changeset
3335 float v48; // ST18_4@97
Ritor1
parents:
diff changeset
3336 __int64 v49; // ST14_8@107
Ritor1
parents:
diff changeset
3337 int v50; // eax@107
Ritor1
parents:
diff changeset
3338 int v51; // eax@108
Ritor1
parents:
diff changeset
3339 Player *v52; // eax@109
Ritor1
parents:
diff changeset
3340 int v53; // [sp-4h] [bp-13Ch]@107
Ritor1
parents:
diff changeset
3341 int v54; // [sp+0h] [bp-138h]@107
Ritor1
parents:
diff changeset
3342 __int16 v55[56]; // [sp+10h] [bp-128h]@34
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3343 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3344 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
0
Ritor1
parents:
diff changeset
3345 char a1[100]; // [sp+B8h] [bp-80h]@3
Ritor1
parents:
diff changeset
3346 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3347 //size_t v60; // [sp+120h] [bp-18h]@3
249
Nomad
parents: 248
diff changeset
3348 //Player *v61; // [sp+124h] [bp-14h]@3
Nomad
parents: 248
diff changeset
3349 //char *Str; // [sp+128h] [bp-10h]@1
0
Ritor1
parents:
diff changeset
3350 int v63; // [sp+12Ch] [bp-Ch]@32
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3351 //int v64; // [sp+130h] [bp-8h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3352 //NPCData *v65; // [sp+134h] [bp-4h]@6
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3353 //int packed;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3354
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3355
0
Ritor1
parents:
diff changeset
3356
Ritor1
parents:
diff changeset
3357 v6 = uPlayerID;
249
Nomad
parents: 248
diff changeset
3358 //Str = lpsz;
0
Ritor1
parents:
diff changeset
3359 if ( IsBadStringPtrA(lpsz, 1u) )
Ritor1
parents:
diff changeset
3360 return "Invalid String Passed";
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3361
0
Ritor1
parents:
diff changeset
3362 a1[0] = 0;
Ritor1
parents:
diff changeset
3363 pPlayer = &pParty->pPlayers[v6];
949
Nomad
parents: 948
diff changeset
3364 v59 = TargetColor(255, 255, 155);
249
Nomad
parents: 248
diff changeset
3365 //v61 = pPlayer;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3366 memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3367
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3368 NPCData *npc = nullptr;
0
Ritor1
parents:
diff changeset
3369 if ( dword_5C35D4 )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
3370 {
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
3371 //__debugbreak(); // fix
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
3372 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
3373 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3374 else
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
3375 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3376 //v65 = v9;
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3377 //v10 = 0;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3378 //v64 = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3379
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3380 //int i = 0;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3381 //if ( (signed int)v60 > 0 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3382 v11 = a4;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3383
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3384 auto len = strlen(lpsz);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3385 for (int i = 0, dst = 0; i < len; ++i)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3386 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3387 //v12 = v64;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3388 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3389 //while ( 1 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3390 //{
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3391 char c = lpsz[i];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3392 if (c != '%')
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3393 pTmpBuf2[dst++] = c;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3394 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3395 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3396 //v15 = &lpsz[v12 + 1];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3397 //v16 = (unsigned __int8)lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3398 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3399 //v17 = packed - 528;// 10 * '0' + '0'
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3400 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
3401
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3402 switch ( v17 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3403 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3404 case 1:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3405 v11 = npc->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3406 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3407 case 2:
0
Ritor1
parents:
diff changeset
3408 v11 = pPlayer->pName;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3409 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3410 case 3:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3411 case 4:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3412 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3413 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3414 case 5:
0
Ritor1
parents:
diff changeset
3415 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
Ritor1
parents:
diff changeset
3416 v11 = pGlobalTXT_LocalizationStrings[397];// "evening"
Ritor1
parents:
diff changeset
3417 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
Ritor1
parents:
diff changeset
3418 {
Ritor1
parents:
diff changeset
3419 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB )
Ritor1
parents:
diff changeset
3420 {
Ritor1
parents:
diff changeset
3421 if ( v18 < 20 )
Ritor1
parents:
diff changeset
3422 v11 = pGlobalTXT_LocalizationStrings[396];// "day"
Ritor1
parents:
diff changeset
3423 }
Ritor1
parents:
diff changeset
3424 else
Ritor1
parents:
diff changeset
3425 {
Ritor1
parents:
diff changeset
3426 v11 = pGlobalTXT_LocalizationStrings[395];// "morning"
Ritor1
parents:
diff changeset
3427 }
Ritor1
parents:
diff changeset
3428 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3429 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3430 case 6:
0
Ritor1
parents:
diff changeset
3431 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
3432 v11 = pGlobalTXT_LocalizationStrings[387];// "lady"
Ritor1
parents:
diff changeset
3433 else
Ritor1
parents:
diff changeset
3434 v11 = pGlobalTXT_LocalizationStrings[385];// "sir"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3435 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3436 case 7:
0
Ritor1
parents:
diff changeset
3437 if ( pPlayer->uSex )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3438 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3439 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3440 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3441 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3442 case 8:
0
Ritor1
parents:
diff changeset
3443 v19 = 0;
Ritor1
parents:
diff changeset
3444 v63 = 0;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3445 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
0
Ritor1
parents:
diff changeset
3446 do
Ritor1
parents:
diff changeset
3447 {
Ritor1
parents:
diff changeset
3448 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) )
Ritor1
parents:
diff changeset
3449 {
Ritor1
parents:
diff changeset
3450 v21 = v63;
Ritor1
parents:
diff changeset
3451 v22 = word_4EE150[v19];
Ritor1
parents:
diff changeset
3452 ++v63;
Ritor1
parents:
diff changeset
3453 v55[v21] = v22;
Ritor1
parents:
diff changeset
3454 }
Ritor1
parents:
diff changeset
3455 ++v19;
Ritor1
parents:
diff changeset
3456 }
Ritor1
parents:
diff changeset
3457 while ( v19 < 28 );
Ritor1
parents:
diff changeset
3458 if ( v63 )
Ritor1
parents:
diff changeset
3459 {
Ritor1
parents:
diff changeset
3460 v23 = rand() % v63;
Ritor1
parents:
diff changeset
3461 v24 = dword_A74CDC;
Ritor1
parents:
diff changeset
3462 if ( dword_A74CDC == -1 )
Ritor1
parents:
diff changeset
3463 {
Ritor1
parents:
diff changeset
3464 v24 = v23;
Ritor1
parents:
diff changeset
3465 dword_A74CDC = v23;
Ritor1
parents:
diff changeset
3466 }
492
Gloval
parents: 487
diff changeset
3467 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
0
Ritor1
parents:
diff changeset
3468 }
Ritor1
parents:
diff changeset
3469 else
Ritor1
parents:
diff changeset
3470 {
Ritor1
parents:
diff changeset
3471 v11 = (char *)pNPCTopics[55].pText;
Ritor1
parents:
diff changeset
3472 }
249
Nomad
parents: 248
diff changeset
3473 //pPlayer = v61;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3474 //v13 = a3;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3475 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3476 case 9:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3477 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3478 v11 = pGlobalTXT_LocalizationStrings[384];// "her"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3479 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3480 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3481 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3482 case 10:
0
Ritor1
parents:
diff changeset
3483 if ( pPlayer->uSex )
Ritor1
parents:
diff changeset
3484 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
Ritor1
parents:
diff changeset
3485 else
Ritor1
parents:
diff changeset
3486 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord"
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3487 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3488 case 11:
0
Ritor1
parents:
diff changeset
3489 v25 = GetPartyReputation();
Ritor1
parents:
diff changeset
3490 goto LABEL_46;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3491 case 12:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3492 v25 = npc->rep;
0
Ritor1
parents:
diff changeset
3493 LABEL_46:
Ritor1
parents:
diff changeset
3494 if ( v25 >= 25 )
Ritor1
parents:
diff changeset
3495 {
Ritor1
parents:
diff changeset
3496 v11 = pGlobalTXT_LocalizationStrings[379];
Ritor1
parents:
diff changeset
3497 }
Ritor1
parents:
diff changeset
3498 else
Ritor1
parents:
diff changeset
3499 {
Ritor1
parents:
diff changeset
3500 if ( v25 < 6 )
Ritor1
parents:
diff changeset
3501 {
Ritor1
parents:
diff changeset
3502 if ( v25 >= -5 )
Ritor1
parents:
diff changeset
3503 {
Ritor1
parents:
diff changeset
3504 v11 = pGlobalTXT_LocalizationStrings[399];
Ritor1
parents:
diff changeset
3505 }
Ritor1
parents:
diff changeset
3506 else
Ritor1
parents:
diff changeset
3507 {
Ritor1
parents:
diff changeset
3508 if ( v25 < -24 )
Ritor1
parents:
diff changeset
3509 v11 = pGlobalTXT_LocalizationStrings[434];
Ritor1
parents:
diff changeset
3510 else
Ritor1
parents:
diff changeset
3511 v11 = pGlobalTXT_LocalizationStrings[402];
Ritor1
parents:
diff changeset
3512 }
Ritor1
parents:
diff changeset
3513 }
Ritor1
parents:
diff changeset
3514 else
Ritor1
parents:
diff changeset
3515 {
Ritor1
parents:
diff changeset
3516 v11 = pGlobalTXT_LocalizationStrings[392];
Ritor1
parents:
diff changeset
3517 }
Ritor1
parents:
diff changeset
3518 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3519 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3520 case 13:
0
Ritor1
parents:
diff changeset
3521 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3522 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3523 case 14:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3524 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3525 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3526 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3527 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3528 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3529 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3530 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3531
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3532 case 15:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3533 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3534 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3535 _continue_strcat:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3536 strcat(pTmpBuf2, v11);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3537 dst = strlen(pTmpBuf2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3538 //v64 += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3539 i += 2;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3540 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3541 break;
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 case 16:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3544 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3545 if ( npc->uSex )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3546 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3547 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3548 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3549 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3550 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3551 case 17:
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 pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3554 if (!pay_percentage)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3555 pay_percentage = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3556
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3557 sprintf(a1, "%lu", pay_percentage);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3558 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3559 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3560 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3561
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3562 case 18:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3563 case 19:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3564 case 20:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3565 case 21:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3566 case 22:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3567 case 26:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3568 _continue_strncpy:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3569 strncpy(a1, lpsz + i + 1, 2);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3570 v51 = atoi(a1);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3571 sprintf(a1, "%lu", v51);
0
Ritor1
parents:
diff changeset
3572 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3573 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3574
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3575 case 23:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3576 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3577 v47 = pMapStats->GetMapInfo(pCurrentMapName);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3578 if ( v47 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3579 v11 = pMapStats->pInfos[v47].pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3580 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3581 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
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 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3584 case 24:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3585 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3586 v46 = a3->GetDisplayName();
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3587 sprintf(a1, format_4E2D80, v59, v46);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3588 v11 = a1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3589 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3590 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3591
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3592
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3593 case 25:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3594 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3595 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3596 v38 = *v37;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3597 v39 = a3->GetValue();
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3598 v29 = pPlayer->_4B8233(v39, v38);
0
Ritor1
parents:
diff changeset
3599 switch ( a5 )
Ritor1
parents:
diff changeset
3600 {
Ritor1
parents:
diff changeset
3601 case 3:
Ritor1
parents:
diff changeset
3602 v44 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3603 v45 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3604 v29 = pPlayer->_4B8213(v45, v44);
Ritor1
parents:
diff changeset
3605 break;
Ritor1
parents:
diff changeset
3606 case 4:
Ritor1
parents:
diff changeset
3607 v29 = pPlayer->_4B824B(*v37);
Ritor1
parents:
diff changeset
3608 break;
Ritor1
parents:
diff changeset
3609 case 5:
Ritor1
parents:
diff changeset
3610 v42 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3611 v43 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3612 v29 = pPlayer->_4B8265(v43, v42);
Ritor1
parents:
diff changeset
3613 break;
Ritor1
parents:
diff changeset
3614 case 6:
Ritor1
parents:
diff changeset
3615 v40 = *v37;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3616 v41 = a3->GetValue();
0
Ritor1
parents:
diff changeset
3617 v29 = pPlayer->_4B8213(v41, v40) / 2;
Ritor1
parents:
diff changeset
3618 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3619 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3620 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3621 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3622
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3623 case 27:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3624 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3625 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
0
Ritor1
parents:
diff changeset
3626 v27 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3627 v28 = a3->GetValue();
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
3628 v29 = pPlayer->GetBuyingPrice(v28, v27);
0
Ritor1
parents:
diff changeset
3629 if ( a5 == 3 )
Ritor1
parents:
diff changeset
3630 {
Ritor1
parents:
diff changeset
3631 v35 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3632 v36 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
3633 v29 = pPlayer->GetPriceSell(v36, v35);
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
3634 if (a3->Broken())
0
Ritor1
parents:
diff changeset
3635 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3636 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
3637 }
Ritor1
parents:
diff changeset
3638 if ( a5 != 4 )
Ritor1
parents:
diff changeset
3639 {
Ritor1
parents:
diff changeset
3640 if ( a5 == 5 )
Ritor1
parents:
diff changeset
3641 {
Ritor1
parents:
diff changeset
3642 v32 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3643 v33 = a3->GetValue();
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
3644 v29 = pPlayer->GetPriceRepair(v33, v32);
0
Ritor1
parents:
diff changeset
3645 }
Ritor1
parents:
diff changeset
3646 else
Ritor1
parents:
diff changeset
3647 {
Ritor1
parents:
diff changeset
3648 if ( a5 == 6 )
Ritor1
parents:
diff changeset
3649 {
Ritor1
parents:
diff changeset
3650 v30 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3651 v31 = a3->GetValue();
917
ae9e2a339b09 disappear items fix
Ritor1
parents: 916
diff changeset
3652 v29 = pPlayer->GetPriceSell(v31, v30) / 2;
315
2a09e1d6fc8f Some 0041D895 GameUI_DrawItemInfo overhaul
Nomad
parents: 304
diff changeset
3653 if (a3->Broken())
0
Ritor1
parents:
diff changeset
3654 v29 = 1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3655 if (!v29)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3656 v29 = 1;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3657 goto _continue_sprintf;
0
Ritor1
parents:
diff changeset
3658 }
Ritor1
parents:
diff changeset
3659 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3660 _continue_sprintf:
0
Ritor1
parents:
diff changeset
3661 sprintf(a1, "%lu", v29);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3662 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3663 goto _continue_strcat;
0
Ritor1
parents:
diff changeset
3664 }
Ritor1
parents:
diff changeset
3665 v34 = *v26;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3666
0
Ritor1
parents:
diff changeset
3667 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
3668 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3669 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3670 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3671
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3672 case 28:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3673 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3674 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3675 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3676 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3677 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3678
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3679 case 29:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3680 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3681 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3682 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3683 v48 = v34;
916
897b10712a1a UIShop_Buy_Identify_Repair little clean and rename
Ritor1
parents: 909
diff changeset
3684 v29 = pPlayer->GetPriceIdentification(v48);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3685 goto _continue_sprintf;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3686 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3687
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3688 case 30:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3689 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3690 if ( !a6 )
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 sub_493F79(&v57, *a6);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3693 v54 = v57.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3694 v53 = v57.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3695 v50 = v57.field_14_exprie_month;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3696 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3697 v11 = a1;
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 31:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3702 case 32:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3703 case 33:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3704 case 34:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3705 v52 = &pParty->pPlayers[v17 - 31];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3706 v11 = v52->pName;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3707 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3708
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3709 default:
0
Ritor1
parents:
diff changeset
3710 if ( v17 <= 50 || v17 > 70 )
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3711 goto _continue_strncpy;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3712 if ( v17 - 51 >= 20 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3713 goto _continue_strcat;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3714 v49 = pParty->field_3C._s_times[v17-51];
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
3715
0
Ritor1
parents:
diff changeset
3716 sub_493F79(&v56, v49);
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3717 v54 = v56.field_18_expire_year;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3718 v53 = v56.field_C_expire_day + 1;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
3719 v50 = v56.field_14_exprie_month;
0
Ritor1
parents:
diff changeset
3720 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
250
83f85ab6079a sprintfex fix
Nomad
parents: 249
diff changeset
3721 v11 = a1;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3722 goto _continue_strcat;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3723 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
3724 }
0
Ritor1
parents:
diff changeset
3725 }
Ritor1
parents:
diff changeset
3726 return pTmpBuf2;
Ritor1
parents:
diff changeset
3727 }
Ritor1
parents:
diff changeset
3728
Ritor1
parents:
diff changeset
3729 //----- (0049B04D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3730 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
0
Ritor1
parents:
diff changeset
3731 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3732 //stru154 *v3; // edi@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3733 //signed int v4; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3734 //signed int result; // eax@9
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3735 //signed int v6; // [sp-8h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
3736 Vec3_float_ v; // [sp+4h] [bp-Ch]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3737 float v7;
0
Ritor1
parents:
diff changeset
3738
Ritor1
parents:
diff changeset
3739 v.x = 0.0;
Ritor1
parents:
diff changeset
3740 v.y = 0.0;
Ritor1
parents:
diff changeset
3741 v.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3742 GetFacePlane(a2, a3, &v, &v7);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3743
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3744 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3745 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3746 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3747 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3748 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
3749 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3750 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3751
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3752 face_plane.vNormal.x = v.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3753 face_plane.vNormal.y = v.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3754 face_plane.vNormal.z = v.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3755 face_plane.dist = v7;
0
Ritor1
parents:
diff changeset
3756 }
Ritor1
parents:
diff changeset
3757
Ritor1
parents:
diff changeset
3758 //----- (0049B0C9) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3759 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
0
Ritor1
parents:
diff changeset
3760 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3761 if (fabsf(pNormal->z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3762 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3763 else if (fabsf(pNormal->x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3764 fabsf(pNormal->y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3765 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
3766 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3767 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3768
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3769 face_plane.vNormal.x = pNormal->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3770 face_plane.dist = dist;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3771 face_plane.vNormal.y = pNormal->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3772 face_plane.vNormal.z = pNormal->z;
0
Ritor1
parents:
diff changeset
3773 }
Ritor1
parents:
diff changeset
3774
Ritor1
parents:
diff changeset
3775 //----- (0049B13D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3776 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
0
Ritor1
parents:
diff changeset
3777 {
Ritor1
parents:
diff changeset
3778 ODMFace *v5; // ebx@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3779 //int v6; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3780 //unsigned __int16 *v7; // ebx@2
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3781 //Vec3_int_ *v8; // eax@3
0
Ritor1
parents:
diff changeset
3782 Vec3_int_ *v9; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3783 //double v10; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3784 //int v11; // ecx@3
0
Ritor1
parents:
diff changeset
3785 Vec3_int_ *v12; // ecx@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3786 //double v13; // st7@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3787 //double v14; // st6@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3788 //double v15; // st5@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3789 //int v16; // ecx@3
0
Ritor1
parents:
diff changeset
3790 Vec3_int_ *v17; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3791 //double v18; // st5@3
0
Ritor1
parents:
diff changeset
3792 Vec3_float_ *v19; // eax@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3793 //int result; // eax@8
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3794 //float v21; // ecx@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3795 //double v22; // st7@10
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3796 //double v23; // st6@10
0
Ritor1
parents:
diff changeset
3797 Vec3_float_ v2; // [sp+4h] [bp-64h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3798 //float v25; // [sp+18h] [bp-50h]@3
0
Ritor1
parents:
diff changeset
3799 float v26; // [sp+1Ch] [bp-4Ch]@3
Ritor1
parents:
diff changeset
3800 float v27; // [sp+20h] [bp-48h]@3
Ritor1
parents:
diff changeset
3801 float v28; // [sp+24h] [bp-44h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3802 //float v29; // [sp+2Ch] [bp-3Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3803 //float v30; // [sp+30h] [bp-38h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3804 //float v31; // [sp+34h] [bp-34h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3805 //float v32; // [sp+38h] [bp-30h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3806 //float v33; // [sp+3Ch] [bp-2Ch]@3
0
Ritor1
parents:
diff changeset
3807 Vec3_float_ v1; // [sp+40h] [bp-28h]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3808 //float v35; // [sp+4Ch] [bp-1Ch]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3809 //float v36; // [sp+50h] [bp-18h]@3
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3810 //float v37; // [sp+54h] [bp-14h]@3
0
Ritor1
parents:
diff changeset
3811 Vec3_float_ v38; // [sp+58h] [bp-10h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3812 //int v39; // [sp+64h] [bp-4h]@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3813
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3814 //v39 = 0;
0
Ritor1
parents:
diff changeset
3815 v1.x = 0.0;
Ritor1
parents:
diff changeset
3816 v5 = pFace;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3817 //v6 = pFace->uNumVertices;
0
Ritor1
parents:
diff changeset
3818 v1.y = 0.0;
Ritor1
parents:
diff changeset
3819 v1.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3820
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3821 if (pFace->uNumVertices >= 2)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3822 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3823 int i = 0;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3824 while ( i < pFace->uNumVertices - 2 )
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3825 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3826 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3827 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3828 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
1093
c59ac5ea63f5 * stru154::GetFacePlane mistake fixed
zipi
parents: 1080
diff changeset
3829 i++;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3830 v1.x = v12->x - v9->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3831 v26 = v17->x - v12->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3832 v1.y = v12->y - v9->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3833 v27 = v17->y - v12->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3834 v1.z = v12->z - v9->z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3835 v28 = v17->z - v12->z;
0
Ritor1
parents:
diff changeset
3836 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
Ritor1
parents:
diff changeset
3837 v38.x = v19->x;
Ritor1
parents:
diff changeset
3838 v38.y = v19->y;
Ritor1
parents:
diff changeset
3839 v38.z = v19->z;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3840 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3841 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3842 v38.Normalize();
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3843
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3844 pOutNormal->x = v38.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3845 pOutNormal->y = v38.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3846 pOutNormal->z = v38.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3847
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3848 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3849 return;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3850 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3851 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3852 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3853
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3854 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3855 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3856 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
3857 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
0
Ritor1
parents:
diff changeset
3858 }
Ritor1
parents:
diff changeset
3859
Ritor1
parents:
diff changeset
3860 //----- (0049D700) --------------------------------------------------------
Ritor1
parents:
diff changeset
3861 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
Ritor1
parents:
diff changeset
3862 {
Ritor1
parents:
diff changeset
3863 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
3864 int v2; // ecx@1
Ritor1
parents:
diff changeset
3865 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
3866
Ritor1
parents:
diff changeset
3867 v1 = uDim;
Ritor1
parents:
diff changeset
3868 v2 = 0;
Ritor1
parents:
diff changeset
3869 v3 = v1 - 1;
Ritor1
parents:
diff changeset
3870 while ( v3 & 1 )
Ritor1
parents:
diff changeset
3871 {
Ritor1
parents:
diff changeset
3872 v3 >>= 1;
Ritor1
parents:
diff changeset
3873 ++v2;
Ritor1
parents:
diff changeset
3874 }
Ritor1
parents:
diff changeset
3875 return v3 == 0 ? v2 : 0;
Ritor1
parents:
diff changeset
3876 }
Ritor1
parents:
diff changeset
3877
Ritor1
parents:
diff changeset
3878 //----- (004A19D8) --------------------------------------------------------
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3879 unsigned int BlendColors(unsigned int a1, unsigned int a2)
0
Ritor1
parents:
diff changeset
3880 {
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3881 /*signed __int64 v2; // ST10_8@1
0
Ritor1
parents:
diff changeset
3882 double v3; // st7@1
Ritor1
parents:
diff changeset
3883 float v4; // ST24_4@1
Ritor1
parents:
diff changeset
3884 double v5; // ST10_8@1
Ritor1
parents:
diff changeset
3885 int v6; // ST1C_4@1
Ritor1
parents:
diff changeset
3886 float v7; // ST24_4@1
Ritor1
parents:
diff changeset
3887 double v8; // ST10_8@1
Ritor1
parents:
diff changeset
3888 unsigned __int8 v9; // ST20_1@1
Ritor1
parents:
diff changeset
3889 float v10; // ST24_4@1
Ritor1
parents:
diff changeset
3890 double v11; // ST10_8@1
Ritor1
parents:
diff changeset
3891 float v12; // ST24_4@1
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3892 double v13; // ST08_8@1*/
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3893
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3894 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3895 (a2 >> 24) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3896 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3897 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3898 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3899 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f),
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3900 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f *
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3901 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f);
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3902 return (alpha << 24) | (red << 16) | (green << 8) | blue;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3903 /*v2 = a1 >> 24;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3904 v3 = (double)v2 / 255.0f;
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3905 HIDWORD(v2) = 0;
0
Ritor1
parents:
diff changeset
3906 LODWORD(v2) = a2 >> 24;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3907 v4 = v3 * (double)v2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
3908 v5 = v4 + 6.7553994e15;
Ritor1
parents:
diff changeset
3909 v6 = LODWORD(v5);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3910 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0;
0
Ritor1
parents:
diff changeset
3911 v8 = v7 + 6.7553994e15;
Ritor1
parents:
diff changeset
3912 v9 = LOBYTE(v8);
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3913 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
3914 v11 = v10 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3915 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
0
Ritor1
parents:
diff changeset
3916 v13 = v12 + 6.7553994e15;
737
225d92620998 004A19D8 refactored
Nomad
parents: 735
diff changeset
3917 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
0
Ritor1
parents:
diff changeset
3918 }
Ritor1
parents:
diff changeset
3919
Ritor1
parents:
diff changeset
3920 //----- (004A46E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
3921 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
3922 {
Ritor1
parents:
diff changeset
3923 int v5; // eax@1
Ritor1
parents:
diff changeset
3924 int z; // eax@1
Ritor1
parents:
diff changeset
3925 unsigned int v7; // eax@9
Ritor1
parents:
diff changeset
3926 unsigned int v8; // ecx@9
Ritor1
parents:
diff changeset
3927 int v9; // eax@9
Ritor1
parents:
diff changeset
3928 unsigned int v10; // eax@10
Ritor1
parents:
diff changeset
3929 int *v11; // esi@10
Ritor1
parents:
diff changeset
3930 int *v12; // edi@10
Ritor1
parents:
diff changeset
3931 int v13; // ecx@10
Ritor1
parents:
diff changeset
3932 int v14; // edx@10
Ritor1
parents:
diff changeset
3933 unsigned int v15; // eax@22
Ritor1
parents:
diff changeset
3934 int *v16; // esi@22
Ritor1
parents:
diff changeset
3935 int *v17; // edi@22
Ritor1
parents:
diff changeset
3936 int v18; // ecx@22
Ritor1
parents:
diff changeset
3937 int v19; // edx@22
Ritor1
parents:
diff changeset
3938 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9
Ritor1
parents:
diff changeset
3939 int *pTargetZ; // [sp+10h] [bp-4h]@9
Ritor1
parents:
diff changeset
3940 unsigned int v22; // [sp+1Ch] [bp+8h]@9
Ritor1
parents:
diff changeset
3941 signed int v23; // [sp+20h] [bp+Ch]@1
Ritor1
parents:
diff changeset
3942
Ritor1
parents:
diff changeset
3943 v5 = a4;
Ritor1
parents:
diff changeset
3944 v23 = _z >> 16;
Ritor1
parents:
diff changeset
3945 z = x + v5;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3946 if ( z >= (signed int)pViewport->uViewportTL_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3947 && (signed int)x <= (signed int)pViewport->uViewportBR_X
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3948 && y >= (signed int)pViewport->uViewportTL_Y
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3949 && y <= (signed int)pViewport->uViewportBR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3950 {
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3951 if ( (signed int)x < (signed int)pViewport->uViewportTL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3952 x = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3953 if ( z > (signed int)pViewport->uViewportBR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
3954 z = pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
3955 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
3956 v22 = z - x;
Ritor1
parents:
diff changeset
3957 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y];
Ritor1
parents:
diff changeset
3958 v7 = lightColor >> 3;
Ritor1
parents:
diff changeset
3959 v8 = lightColor & 0xF0;
Ritor1
parents:
diff changeset
3960 v9 = v7 & 0x1E0000;
Ritor1
parents:
diff changeset
3961 if ( pRenderer->uTargetGBits == 5 )
Ritor1
parents:
diff changeset
3962 {
Ritor1
parents:
diff changeset
3963 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4;
Ritor1
parents:
diff changeset
3964 v11 = (int *)pTarget;
Ritor1
parents:
diff changeset
3965 v12 = pTargetZ;
Ritor1
parents:
diff changeset
3966 v13 = v22;
Ritor1
parents:
diff changeset
3967 v14 = (v10 << 16) | v10;
Ritor1
parents:
diff changeset
3968 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
3969 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
3970 {
Ritor1
parents:
diff changeset
3971 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
3972 if ( z > v23 )
Ritor1
parents:
diff changeset
3973 {
Ritor1
parents:
diff changeset
3974 z = v14 + ((*pTarget & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
3975 *pTarget = z;
Ritor1
parents:
diff changeset
3976 }
Ritor1
parents:
diff changeset
3977 v13 = v22 - 1;
Ritor1
parents:
diff changeset
3978 v11 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
3979 v12 = pTargetZ + 1;
Ritor1
parents:
diff changeset
3980 }
Ritor1
parents:
diff changeset
3981 while ( v13 != 1 )
Ritor1
parents:
diff changeset
3982 {
Ritor1
parents:
diff changeset
3983 if ( v13 < 1 )
Ritor1
parents:
diff changeset
3984 return z;
Ritor1
parents:
diff changeset
3985 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
3986 if ( z <= v23 )
Ritor1
parents:
diff changeset
3987 {
Ritor1
parents:
diff changeset
3988 v13 -= 2;
Ritor1
parents:
diff changeset
3989 ++v11;
Ritor1
parents:
diff changeset
3990 v12 += 2;
Ritor1
parents:
diff changeset
3991 }
Ritor1
parents:
diff changeset
3992 else
Ritor1
parents:
diff changeset
3993 {
Ritor1
parents:
diff changeset
3994 v12 += 2;
Ritor1
parents:
diff changeset
3995 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1);
Ritor1
parents:
diff changeset
3996 v13 -= 2;
Ritor1
parents:
diff changeset
3997 *v11 = z;
Ritor1
parents:
diff changeset
3998 ++v11;
Ritor1
parents:
diff changeset
3999 }
Ritor1
parents:
diff changeset
4000 }
Ritor1
parents:
diff changeset
4001 z = (unsigned int)*v12 >> 16;
Ritor1
parents:
diff changeset
4002 if ( z > v23 )
Ritor1
parents:
diff changeset
4003 {
Ritor1
parents:
diff changeset
4004 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1);
Ritor1
parents:
diff changeset
4005 *(short *)v11 = z;
Ritor1
parents:
diff changeset
4006 }
Ritor1
parents:
diff changeset
4007 }
Ritor1
parents:
diff changeset
4008 else
Ritor1
parents:
diff changeset
4009 {
Ritor1
parents:
diff changeset
4010 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4;
Ritor1
parents:
diff changeset
4011 v16 = (int *)pTarget;
Ritor1
parents:
diff changeset
4012 v17 = pTargetZ;
Ritor1
parents:
diff changeset
4013 v18 = v22;
Ritor1
parents:
diff changeset
4014 v19 = (v15 << 16) | v15;
Ritor1
parents:
diff changeset
4015 z = (unsigned __int8)pTarget & 2;
Ritor1
parents:
diff changeset
4016 if ( (unsigned __int8)pTarget & 2 )
Ritor1
parents:
diff changeset
4017 {
Ritor1
parents:
diff changeset
4018 z = (unsigned int)*pTargetZ >> 16;
Ritor1
parents:
diff changeset
4019 if ( z > v23 )
Ritor1
parents:
diff changeset
4020 {
Ritor1
parents:
diff changeset
4021 z = v19 + ((*pTarget & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
4022 *pTarget = z;
Ritor1
parents:
diff changeset
4023 }
Ritor1
parents:
diff changeset
4024 v18 = v22 - 1;
Ritor1
parents:
diff changeset
4025 v16 = (int *)(pTarget + 1);
Ritor1
parents:
diff changeset
4026 v17 = pTargetZ + 1;
Ritor1
parents:
diff changeset
4027 }
Ritor1
parents:
diff changeset
4028 while ( v18 != 1 )
Ritor1
parents:
diff changeset
4029 {
Ritor1
parents:
diff changeset
4030 if ( v18 < 1 )
Ritor1
parents:
diff changeset
4031 return z;
Ritor1
parents:
diff changeset
4032 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
4033 if ( z <= v23 )
Ritor1
parents:
diff changeset
4034 {
Ritor1
parents:
diff changeset
4035 v18 -= 2;
Ritor1
parents:
diff changeset
4036 ++v16;
Ritor1
parents:
diff changeset
4037 v17 += 2;
Ritor1
parents:
diff changeset
4038 }
Ritor1
parents:
diff changeset
4039 else
Ritor1
parents:
diff changeset
4040 {
Ritor1
parents:
diff changeset
4041 v17 += 2;
Ritor1
parents:
diff changeset
4042 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1);
Ritor1
parents:
diff changeset
4043 v18 -= 2;
Ritor1
parents:
diff changeset
4044 *v16 = z;
Ritor1
parents:
diff changeset
4045 ++v16;
Ritor1
parents:
diff changeset
4046 }
Ritor1
parents:
diff changeset
4047 }
Ritor1
parents:
diff changeset
4048 z = (unsigned int)*v17 >> 16;
Ritor1
parents:
diff changeset
4049 if ( z > v23 )
Ritor1
parents:
diff changeset
4050 {
Ritor1
parents:
diff changeset
4051 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1);
Ritor1
parents:
diff changeset
4052 *(short *)v16 = z;
Ritor1
parents:
diff changeset
4053 }
Ritor1
parents:
diff changeset
4054 }
Ritor1
parents:
diff changeset
4055 }
Ritor1
parents:
diff changeset
4056 return z;
Ritor1
parents:
diff changeset
4057 }
Ritor1
parents:
diff changeset
4058
Ritor1
parents:
diff changeset
4059 //----- (004A57E9) --------------------------------------------------------
Ritor1
parents:
diff changeset
4060 void __cdecl Present_ColorKey()
Ritor1
parents:
diff changeset
4061 {
Ritor1
parents:
diff changeset
4062 HRESULT v0; // eax@3
Ritor1
parents:
diff changeset
4063 HRESULT v1; // eax@3
Ritor1
parents:
diff changeset
4064 HRESULT v2; // eax@3
Ritor1
parents:
diff changeset
4065 HRESULT v3; // eax@3
Ritor1
parents:
diff changeset
4066 HRESULT v4; // eax@3
Ritor1
parents:
diff changeset
4067 RECT a2; // [sp+4h] [bp-14h]@3
Ritor1
parents:
diff changeset
4068 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
4069
Ritor1
parents:
diff changeset
4070 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
4071 {
Ritor1
parents:
diff changeset
4072 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
4073 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4074 a2.bottom = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4075 a2.left = 0;
Ritor1
parents:
diff changeset
4076 a2.top = 0;
Ritor1
parents:
diff changeset
4077 a2.right = 640;
Ritor1
parents:
diff changeset
4078 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u));
Ritor1
parents:
diff changeset
4079 a2.right = 640;
Ritor1
parents:
diff changeset
4080 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4081 a2.top = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4082 a2.bottom = 480;
Ritor1
parents:
diff changeset
4083 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
4084 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4085 pViewport->uViewportBR_Y + 1,
0
Ritor1
parents:
diff changeset
4086 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4087 &a2,
Ritor1
parents:
diff changeset
4088 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4089 a2.right = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4090 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4091 a2.left = 0;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4092 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4093 ErrD3D(pRenderer->pBackBuffer4->BltFast(
Ritor1
parents:
diff changeset
4094 0,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4095 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4096 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4097 &a2,
Ritor1
parents:
diff changeset
4098 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4099 a2.left = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4100 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4101 a2.right = 640;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4102 a2.bottom = pViewport->uViewportBR_Y + 1;
0
Ritor1
parents:
diff changeset
4103 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4104 pViewport->uViewportBR_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4105 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4106 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4107 &a2,
Ritor1
parents:
diff changeset
4108 16u));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4109 a2.right = pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4110 a2.bottom = pViewport->uViewportBR_Y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4111 a2.left = pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4112 a2.top = pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
4113 ErrD3D(pRenderer->pBackBuffer4->BltFast(
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4114 pViewport->uViewportTL_X,
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4115 pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
4116 pRenderer->pColorKeySurface4,
Ritor1
parents:
diff changeset
4117 &a2,
Ritor1
parents:
diff changeset
4118 17u));
Ritor1
parents:
diff changeset
4119 }
Ritor1
parents:
diff changeset
4120 }
Ritor1
parents:
diff changeset
4121 }
Ritor1
parents:
diff changeset
4122
Ritor1
parents:
diff changeset
4123 //----- (004A597D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4124 void Present_NoColorKey()
Ritor1
parents:
diff changeset
4125 {
Ritor1
parents:
diff changeset
4126 //unsigned __int16 *v0; // eax@4
Ritor1
parents:
diff changeset
4127 unsigned __int16 *v1; // esi@4
Ritor1
parents:
diff changeset
4128 void *v2; // edi@4
Ritor1
parents:
diff changeset
4129 //signed int v4; // ebx@4
Ritor1
parents:
diff changeset
4130 //signed int v5; // ebx@6
Ritor1
parents:
diff changeset
4131 //void *v6; // edi@7
Ritor1
parents:
diff changeset
4132 //const void *v7; // esi@7
Ritor1
parents:
diff changeset
4133 signed int v8; // ebx@8
Ritor1
parents:
diff changeset
4134 int v9; // eax@10
Ritor1
parents:
diff changeset
4135 unsigned int v10; // esi@10
Ritor1
parents:
diff changeset
4136 unsigned __int32 v11; // edi@10
Ritor1
parents:
diff changeset
4137 //int v12; // ecx@10
Ritor1
parents:
diff changeset
4138 unsigned int v13; // ebx@10
Ritor1
parents:
diff changeset
4139 int v14; // eax@11
Ritor1
parents:
diff changeset
4140 int v15; // eax@13
Ritor1
parents:
diff changeset
4141 int v16; // eax@14
Ritor1
parents:
diff changeset
4142 int v17; // eax@16
Ritor1
parents:
diff changeset
4143 HRESULT v18; // eax@22
Ritor1
parents:
diff changeset
4144 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
Ritor1
parents:
diff changeset
4145 int v20; // [sp+88h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
4146 int v21; // [sp+8Ch] [bp-18h]@10
Ritor1
parents:
diff changeset
4147 __int32 v22; // [sp+90h] [bp-14h]@10
Ritor1
parents:
diff changeset
4148 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
Ritor1
parents:
diff changeset
4149 unsigned int v24; // [sp+98h] [bp-Ch]@4
Ritor1
parents:
diff changeset
4150 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
4151 //LPVOID v26; // [sp+A0h] [bp-4h]@4
Ritor1
parents:
diff changeset
4152
Ritor1
parents:
diff changeset
4153 if ( !pRenderer->uNumSceneBegins )
Ritor1
parents:
diff changeset
4154 {
Ritor1
parents:
diff changeset
4155 if ( pRenderer->field_40110 )
Ritor1
parents:
diff changeset
4156 {
Ritor1
parents:
diff changeset
4157 memset(&Dst, 0, 0x7Cu);
Ritor1
parents:
diff changeset
4158 Dst.dwSize = 124;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4159 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
0
Ritor1
parents:
diff changeset
4160 {
Ritor1
parents:
diff changeset
4161 //v26 = Dst.lpSurface;
Ritor1
parents:
diff changeset
4162 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
4163 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask |
Ritor1
parents:
diff changeset
4164 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16);
Ritor1
parents:
diff changeset
4165 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4166 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
Ritor1
parents:
diff changeset
4167 v1 = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4168 v2 = Dst.lpSurface;
Ritor1
parents:
diff changeset
4169
Ritor1
parents:
diff changeset
4170
Ritor1
parents:
diff changeset
4171 /*for (uint y = 0; y < 480; ++y)
Ritor1
parents:
diff changeset
4172 {
Ritor1
parents:
diff changeset
4173 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
Ritor1
parents:
diff changeset
4174 for (uint x = 0; x < 640; ++x)
Ritor1
parents:
diff changeset
4175 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
Ritor1
parents:
diff changeset
4176 }*/
Ritor1
parents:
diff changeset
4177
Ritor1
parents:
diff changeset
4178 auto pSrc = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
4179 auto pDst = (__int16 *)Dst.lpSurface;
Ritor1
parents:
diff changeset
4180
Ritor1
parents:
diff changeset
4181 for (uint y = 0; y < 8; ++y)
Ritor1
parents:
diff changeset
4182 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4183
Ritor1
parents:
diff changeset
4184 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
4185
Ritor1
parents:
diff changeset
4186 for (uint y = 8; y < 352; ++y)
Ritor1
parents:
diff changeset
4187 {
Ritor1
parents:
diff changeset
4188 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4189 pSrc + y * 640, 8 * sizeof(__int16));
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
4190 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2,
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
4191 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
0
Ritor1
parents:
diff changeset
4192 }
Ritor1
parents:
diff changeset
4193
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
4194 for (uint y = 352; y < 480; ++y)
0
Ritor1
parents:
diff changeset
4195 memcpy(pDst + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4196 pSrc + y * 640, 640 * sizeof(__int16));
Ritor1
parents:
diff changeset
4197
Ritor1
parents:
diff changeset
4198
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4199 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
4200 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)];
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4201 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
4202 //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
4203 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1);
0
Ritor1
parents:
diff changeset
4204 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1);
Ritor1
parents:
diff changeset
4205 v22 = 4 * ((Dst.lPitch / 4) + v9);
Ritor1
parents:
diff changeset
4206 v21 = 4 * v9 + 1280;
Ritor1
parents:
diff changeset
4207
121
3471df3713e2 Teal line at game's viewport bottom fix
Nomad
parents: 112
diff changeset
4208 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
0
Ritor1
parents:
diff changeset
4209 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
Ritor1
parents:
diff changeset
4210 v10 = (int)pSrc_x1y1;
Ritor1
parents:
diff changeset
4211 v11 = (int)pDst_x1y1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4212 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
0
Ritor1
parents:
diff changeset
4213 v13 = v24;
Ritor1
parents:
diff changeset
4214
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4215 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
0
Ritor1
parents:
diff changeset
4216 {
Ritor1
parents:
diff changeset
4217 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
Ritor1
parents:
diff changeset
4218 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
693
e0a1fccc89b1 map render fixes
Gloval
parents: 690
diff changeset
4219 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
0
Ritor1
parents:
diff changeset
4220 {
Ritor1
parents:
diff changeset
4221 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
Ritor1
parents:
diff changeset
4222 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
Ritor1
parents:
diff changeset
4223 }
Ritor1
parents:
diff changeset
4224 }
Ritor1
parents:
diff changeset
4225
Ritor1
parents:
diff changeset
4226 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
4227
Ritor1
parents:
diff changeset
4228 /* while ( 1 )
Ritor1
parents:
diff changeset
4229 {
Ritor1
parents:
diff changeset
4230 while ( 1 )
Ritor1
parents:
diff changeset
4231 {
Ritor1
parents:
diff changeset
4232 v14 = *(int *)v10;
Ritor1
parents:
diff changeset
4233 v10 += 4;
Ritor1
parents:
diff changeset
4234 if ( v14 == v13 )
Ritor1
parents:
diff changeset
4235 break;
Ritor1
parents:
diff changeset
4236 if ( (short)v14 == (short)v13 )
Ritor1
parents:
diff changeset
4237 {
Ritor1
parents:
diff changeset
4238 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000;
Ritor1
parents:
diff changeset
4239 v11 += 4;
Ritor1
parents:
diff changeset
4240 --uHalfWidth;
Ritor1
parents:
diff changeset
4241 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4242 goto LABEL_21;
Ritor1
parents:
diff changeset
4243 }
Ritor1
parents:
diff changeset
4244 else
Ritor1
parents:
diff changeset
4245 {
Ritor1
parents:
diff changeset
4246 v15 = __ROL__(v14, 16);
Ritor1
parents:
diff changeset
4247 if ( (short)v15 == (short)v13 )
Ritor1
parents:
diff changeset
4248 {
Ritor1
parents:
diff changeset
4249 v17 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
4250 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17;
Ritor1
parents:
diff changeset
4251 v11 += 4;
Ritor1
parents:
diff changeset
4252 --uHalfWidth;
Ritor1
parents:
diff changeset
4253 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4254 goto LABEL_21;
Ritor1
parents:
diff changeset
4255 }
Ritor1
parents:
diff changeset
4256 else
Ritor1
parents:
diff changeset
4257 {
Ritor1
parents:
diff changeset
4258 v16 = __ROR__(v15, 16);
Ritor1
parents:
diff changeset
4259 *(int *)v11 = v16;
Ritor1
parents:
diff changeset
4260 v11 += 4;
Ritor1
parents:
diff changeset
4261 --uHalfWidth;
Ritor1
parents:
diff changeset
4262 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4263 goto LABEL_21;
Ritor1
parents:
diff changeset
4264 }
Ritor1
parents:
diff changeset
4265 }
Ritor1
parents:
diff changeset
4266 }
Ritor1
parents:
diff changeset
4267 v11 += 4;
Ritor1
parents:
diff changeset
4268 --uHalfWidth;
Ritor1
parents:
diff changeset
4269 if ( !uHalfWidth )
Ritor1
parents:
diff changeset
4270 {
Ritor1
parents:
diff changeset
4271 LABEL_21:
Ritor1
parents:
diff changeset
4272 v10 += v21;
Ritor1
parents:
diff changeset
4273 v11 += v22;
Ritor1
parents:
diff changeset
4274 uHalfWidth = v20;
Ritor1
parents:
diff changeset
4275 if ( !--uNumLines )
Ritor1
parents:
diff changeset
4276 {
Ritor1
parents:
diff changeset
4277 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
Ritor1
parents:
diff changeset
4278 return;
Ritor1
parents:
diff changeset
4279 }
Ritor1
parents:
diff changeset
4280 }
Ritor1
parents:
diff changeset
4281 }*/
Ritor1
parents:
diff changeset
4282 }
Ritor1
parents:
diff changeset
4283 }
Ritor1
parents:
diff changeset
4284 }
Ritor1
parents:
diff changeset
4285 }
Ritor1
parents:
diff changeset
4286
Ritor1
parents:
diff changeset
4287 //----- (004A7063) --------------------------------------------------------
Ritor1
parents:
diff changeset
4288 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2)
Ritor1
parents:
diff changeset
4289 {
Ritor1
parents:
diff changeset
4290 float v2; // ST1C_4@1
Ritor1
parents:
diff changeset
4291 double v3; // ST14_8@1
Ritor1
parents:
diff changeset
4292 signed int v4; // ebx@1
Ritor1
parents:
diff changeset
4293 float v5; // ST1C_4@1
Ritor1
parents:
diff changeset
4294 double v6; // ST14_8@1
Ritor1
parents:
diff changeset
4295 signed int v7; // edi@1
Ritor1
parents:
diff changeset
4296 double v8; // ST0C_8@1
Ritor1
parents:
diff changeset
4297 signed int v9; // esi@1
Ritor1
parents:
diff changeset
4298 signed int v10; // ecx@1
Ritor1
parents:
diff changeset
4299 double v12; // [sp+8h] [bp-18h]@1
Ritor1
parents:
diff changeset
4300 unsigned __int64 v13; // [sp+18h] [bp-8h]@1
Ritor1
parents:
diff changeset
4301
Ritor1
parents:
diff changeset
4302 v2 = (double)(uDiffuse >> 24) * a2;
Ritor1
parents:
diff changeset
4303 v3 = v2 + 6.7553994e15;
Ritor1
parents:
diff changeset
4304 v4 = LODWORD(v3);
Ritor1
parents:
diff changeset
4305 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2;
Ritor1
parents:
diff changeset
4306 v6 = v5 + 6.7553994e15;
Ritor1
parents:
diff changeset
4307 v7 = LODWORD(v6);
Ritor1
parents:
diff changeset
4308 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2;
Ritor1
parents:
diff changeset
4309 v8 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
4310 v13 = __PAIR__(LODWORD(v6), LODWORD(v8));
Ritor1
parents:
diff changeset
4311 v9 = LODWORD(v8);
Ritor1
parents:
diff changeset
4312 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2;
Ritor1
parents:
diff changeset
4313 v12 = *((float *)&v6 + 1) + 6.7553994e15;
Ritor1
parents:
diff changeset
4314 v10 = LODWORD(v12);
Ritor1
parents:
diff changeset
4315 if ( v4 > 255 )
Ritor1
parents:
diff changeset
4316 v4 = 255;
Ritor1
parents:
diff changeset
4317 if ( v4 < 0 )
Ritor1
parents:
diff changeset
4318 v4 = 0;
Ritor1
parents:
diff changeset
4319 if ( SHIDWORD(v13) > 255 )
Ritor1
parents:
diff changeset
4320 v7 = 255;
Ritor1
parents:
diff changeset
4321 if ( v7 < 0 )
Ritor1
parents:
diff changeset
4322 v7 = 0;
Ritor1
parents:
diff changeset
4323 if ( (signed int)v13 > 255 )
Ritor1
parents:
diff changeset
4324 v9 = 255;
Ritor1
parents:
diff changeset
4325 if ( v9 < 0 )
Ritor1
parents:
diff changeset
4326 v9 = 0;
Ritor1
parents:
diff changeset
4327 if ( SLODWORD(v12) > 255 )
Ritor1
parents:
diff changeset
4328 v10 = 255;
Ritor1
parents:
diff changeset
4329 if ( v10 < 0 )
Ritor1
parents:
diff changeset
4330 v10 = 0;
Ritor1
parents:
diff changeset
4331 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
4332 }
Ritor1
parents:
diff changeset
4333
Ritor1
parents:
diff changeset
4334 //----- (004AD504) --------------------------------------------------------
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4335 int __fastcall sub_4AD504(signed int sFaceID)
0
Ritor1
parents:
diff changeset
4336 {
Ritor1
parents:
diff changeset
4337 int result; // eax@1
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4338 signed int v2; // ebx@1
0
Ritor1
parents:
diff changeset
4339 BLVFace *v3; // esi@3
Ritor1
parents:
diff changeset
4340 Texture *v4; // edi@6
Ritor1
parents:
diff changeset
4341 int v5; // eax@7
Ritor1
parents:
diff changeset
4342 int v6; // edx@7
Ritor1
parents:
diff changeset
4343 int v7; // ecx@7
Ritor1
parents:
diff changeset
4344 int v8; // ebx@8
Ritor1
parents:
diff changeset
4345 int v9; // eax@8
Ritor1
parents:
diff changeset
4346 int v10; // ebx@8
Ritor1
parents:
diff changeset
4347 unsigned int v11; // ebx@9
Ritor1
parents:
diff changeset
4348 int v12; // esi@10
Ritor1
parents:
diff changeset
4349 int v13; // eax@13
Ritor1
parents:
diff changeset
4350 unsigned __int16 *v14; // eax@13
Ritor1
parents:
diff changeset
4351 unsigned int v15; // eax@14
Ritor1
parents:
diff changeset
4352 unsigned __int16 *v16; // ebx@14
Ritor1
parents:
diff changeset
4353 int v17; // eax@15
Ritor1
parents:
diff changeset
4354 int v18; // ebx@15
Ritor1
parents:
diff changeset
4355 int v19; // esi@15
Ritor1
parents:
diff changeset
4356 int v20; // ecx@15
Ritor1
parents:
diff changeset
4357 int v21; // eax@15
Ritor1
parents:
diff changeset
4358 stru193_math *v22; // ebx@15
Ritor1
parents:
diff changeset
4359 int v23; // eax@15
Ritor1
parents:
diff changeset
4360 char *v24; // esi@16
Ritor1
parents:
diff changeset
4361 int v25; // eax@18
Ritor1
parents:
diff changeset
4362 int v26; // eax@18
Ritor1
parents:
diff changeset
4363 int v27; // eax@20
Ritor1
parents:
diff changeset
4364 signed int v28; // esi@20
Ritor1
parents:
diff changeset
4365 signed int v29; // edx@20
Ritor1
parents:
diff changeset
4366 signed int v30; // esi@20
Ritor1
parents:
diff changeset
4367 signed int v31; // edi@20
Ritor1
parents:
diff changeset
4368 int v32; // esi@20
Ritor1
parents:
diff changeset
4369 int v33; // eax@26
Ritor1
parents:
diff changeset
4370 int *v34; // esi@27
Ritor1
parents:
diff changeset
4371 unsigned __int16 *v35; // edi@27
Ritor1
parents:
diff changeset
4372 unsigned int v36; // edx@27
Ritor1
parents:
diff changeset
4373 int v37; // ebx@27
Ritor1
parents:
diff changeset
4374 char v38; // cl@27
Ritor1
parents:
diff changeset
4375 char v39; // ch@27
Ritor1
parents:
diff changeset
4376 int v40; // ebx@29
Ritor1
parents:
diff changeset
4377 int v41; // edx@29
Ritor1
parents:
diff changeset
4378 unsigned int v42; // ebx@30
Ritor1
parents:
diff changeset
4379 int v43; // edx@30
Ritor1
parents:
diff changeset
4380 int v44; // eax@33
Ritor1
parents:
diff changeset
4381 int *v45; // esi@34
Ritor1
parents:
diff changeset
4382 unsigned __int16 *v46; // edi@34
Ritor1
parents:
diff changeset
4383 unsigned int v47; // edx@34
Ritor1
parents:
diff changeset
4384 int v48; // ebx@34
Ritor1
parents:
diff changeset
4385 char v49; // cl@34
Ritor1
parents:
diff changeset
4386 char v50; // ch@34
Ritor1
parents:
diff changeset
4387 int v51; // ebx@36
Ritor1
parents:
diff changeset
4388 int v52; // edx@36
Ritor1
parents:
diff changeset
4389 unsigned __int16 v53; // bx@37
Ritor1
parents:
diff changeset
4390 int v54; // edx@37
Ritor1
parents:
diff changeset
4391 int v55; // eax@40
Ritor1
parents:
diff changeset
4392 int v56; // eax@41
Ritor1
parents:
diff changeset
4393 int *v57; // esi@42
Ritor1
parents:
diff changeset
4394 unsigned __int16 *v58; // edi@42
Ritor1
parents:
diff changeset
4395 unsigned int v59; // edx@42
Ritor1
parents:
diff changeset
4396 int v60; // ebx@42
Ritor1
parents:
diff changeset
4397 char v61; // cl@42
Ritor1
parents:
diff changeset
4398 char v62; // ch@42
Ritor1
parents:
diff changeset
4399 unsigned int v63; // ebx@44
Ritor1
parents:
diff changeset
4400 int v64; // edx@44
Ritor1
parents:
diff changeset
4401 unsigned int v65; // ebx@44
Ritor1
parents:
diff changeset
4402 int v66; // edx@44
Ritor1
parents:
diff changeset
4403 unsigned int v67; // ebx@45
Ritor1
parents:
diff changeset
4404 int v68; // edx@45
Ritor1
parents:
diff changeset
4405 int v69; // ebx@45
Ritor1
parents:
diff changeset
4406 int v70; // edx@45
Ritor1
parents:
diff changeset
4407 int v71; // eax@48
Ritor1
parents:
diff changeset
4408 int *v72; // esi@49
Ritor1
parents:
diff changeset
4409 unsigned __int16 *v73; // edi@49
Ritor1
parents:
diff changeset
4410 unsigned int v74; // edx@49
Ritor1
parents:
diff changeset
4411 int v75; // ebx@49
Ritor1
parents:
diff changeset
4412 char v76; // cl@49
Ritor1
parents:
diff changeset
4413 char v77; // ch@49
Ritor1
parents:
diff changeset
4414 unsigned int v78; // ebx@51
Ritor1
parents:
diff changeset
4415 int v79; // edx@51
Ritor1
parents:
diff changeset
4416 unsigned int v80; // ebx@51
Ritor1
parents:
diff changeset
4417 int v81; // edx@51
Ritor1
parents:
diff changeset
4418 unsigned int v82; // ebx@52
Ritor1
parents:
diff changeset
4419 int v83; // edx@52
Ritor1
parents:
diff changeset
4420 int v84; // ebx@52
Ritor1
parents:
diff changeset
4421 int v85; // edx@52
Ritor1
parents:
diff changeset
4422 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9
Ritor1
parents:
diff changeset
4423 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9
Ritor1
parents:
diff changeset
4424 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9
Ritor1
parents:
diff changeset
4425 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9
Ritor1
parents:
diff changeset
4426 int v90; // [sp+1Ch] [bp-88h]@20
Ritor1
parents:
diff changeset
4427 BLVFace *v91; // [sp+20h] [bp-84h]@3
Ritor1
parents:
diff changeset
4428 int v92; // [sp+24h] [bp-80h]@7
Ritor1
parents:
diff changeset
4429 int i; // [sp+28h] [bp-7Ch]@7
Ritor1
parents:
diff changeset
4430 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9
Ritor1
parents:
diff changeset
4431 unsigned int v95; // [sp+30h] [bp-74h]@1
Ritor1
parents:
diff changeset
4432 Texture *v96; // [sp+34h] [bp-70h]@6
Ritor1
parents:
diff changeset
4433 int v97; // [sp+38h] [bp-6Ch]@15
Ritor1
parents:
diff changeset
4434 unsigned int v98; // [sp+3Ch] [bp-68h]@9
Ritor1
parents:
diff changeset
4435 int v99; // [sp+40h] [bp-64h]@9
Ritor1
parents:
diff changeset
4436 int v100; // [sp+44h] [bp-60h]@24
Ritor1
parents:
diff changeset
4437 int v101; // [sp+48h] [bp-5Ch]@10
Ritor1
parents:
diff changeset
4438 int v102; // [sp+4Ch] [bp-58h]@20
Ritor1
parents:
diff changeset
4439 int v103; // [sp+50h] [bp-54h]@20
Ritor1
parents:
diff changeset
4440 int v104; // [sp+54h] [bp-50h]@9
Ritor1
parents:
diff changeset
4441 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20
Ritor1
parents:
diff changeset
4442 int v106; // [sp+5Ch] [bp-48h]@24
Ritor1
parents:
diff changeset
4443 int v107; // [sp+60h] [bp-44h]@20
Ritor1
parents:
diff changeset
4444 int v108; // [sp+64h] [bp-40h]@20
Ritor1
parents:
diff changeset
4445 int v109; // [sp+68h] [bp-3Ch]@20
Ritor1
parents:
diff changeset
4446 int v110; // [sp+6Ch] [bp-38h]@15
Ritor1
parents:
diff changeset
4447 int v111; // [sp+70h] [bp-34h]@20
Ritor1
parents:
diff changeset
4448 int a1; // [sp+74h] [bp-30h]@12
Ritor1
parents:
diff changeset
4449 int a2; // [sp+78h] [bp-2Ch]@9
Ritor1
parents:
diff changeset
4450 int *v114; // [sp+7Ch] [bp-28h]@16
Ritor1
parents:
diff changeset
4451 int v115; // [sp+80h] [bp-24h]@18
Ritor1
parents:
diff changeset
4452 int v116; // [sp+84h] [bp-20h]@7
Ritor1
parents:
diff changeset
4453 unsigned int v117; // [sp+88h] [bp-1Ch]@15
Ritor1
parents:
diff changeset
4454 unsigned int v118; // [sp+8Ch] [bp-18h]@24
Ritor1
parents:
diff changeset
4455 int *v119; // [sp+90h] [bp-14h]@13
Ritor1
parents:
diff changeset
4456 int v120; // [sp+94h] [bp-10h]@15
Ritor1
parents:
diff changeset
4457 unsigned int v121; // [sp+98h] [bp-Ch]@15
Ritor1
parents:
diff changeset
4458 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
4459 unsigned int v123; // [sp+A0h] [bp-4h]@13
Ritor1
parents:
diff changeset
4460
Ritor1
parents:
diff changeset
4461 result = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4462 v2 = sFaceID;
0
Ritor1
parents:
diff changeset
4463 v95 = pRenderer->uTargetSurfacePitch;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4464 if ( sFaceID >= 0 )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4465 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4466 if ( sFaceID < (signed int)pIndoor->uNumFaces )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4467 {
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4468 v3 = &pIndoor->pFaces[sFaceID];
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4469 v91 = &pIndoor->pFaces[sFaceID];
0
Ritor1
parents:
diff changeset
4470 if ( !pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4471 {
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
4472 result = sub_423B5D(sFaceID);
0
Ritor1
parents:
diff changeset
4473 if ( result )
Ritor1
parents:
diff changeset
4474 {
Ritor1
parents:
diff changeset
4475 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
Ritor1
parents:
diff changeset
4476 if ( result )
Ritor1
parents:
diff changeset
4477 {
Ritor1
parents:
diff changeset
4478 result = (int)v3->GetTexture();
Ritor1
parents:
diff changeset
4479 v4 = (Texture *)result;
Ritor1
parents:
diff changeset
4480 v96 = (Texture *)result;
Ritor1
parents:
diff changeset
4481 if ( result )
Ritor1
parents:
diff changeset
4482 {
Ritor1
parents:
diff changeset
4483 v5 = *(short *)(result + 38);
Ritor1
parents:
diff changeset
4484 LOBYTE(v3->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
4485 v92 = v5;
Ritor1
parents:
diff changeset
4486 sub_4AE5F1(v2);
Ritor1
parents:
diff changeset
4487 ++pBLVRenderParams->field_84;
Ritor1
parents:
diff changeset
4488 v6 = stru_F8AD28.pDeltaUV[0];
Ritor1
parents:
diff changeset
4489 v116 = stru_F8AD28.pDeltaUV[1];
Ritor1
parents:
diff changeset
4490 v7 = 0;
Ritor1
parents:
diff changeset
4491 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 )
Ritor1
parents:
diff changeset
4492 {
Ritor1
parents:
diff changeset
4493 v8 = v116;
Ritor1
parents:
diff changeset
4494 stru_F8AD28._blv_lights_xs[v7] += v6;
Ritor1
parents:
diff changeset
4495 v9 = 4 * v7 + 16297672;
Ritor1
parents:
diff changeset
4496 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++];
Ritor1
parents:
diff changeset
4497 }
Ritor1
parents:
diff changeset
4498 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1);
Ritor1
parents:
diff changeset
4499 result = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4500 a2 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4501 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
4502 v99 = 640 * stru_F8A590._viewport_space_y;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
4503 v86 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
4504 v87 = v4->pLevelOfDetail1;
Ritor1
parents:
diff changeset
4505 v88 = v4->pLevelOfDetail2;
Ritor1
parents:
diff changeset
4506 v89 = v4->pLevelOfDetail3;
Ritor1
parents:
diff changeset
4507 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
4508 v104 = 2 * pBLVRenderParams->field_0_timer_;
Ritor1
parents:
diff changeset
4509 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4510 {
Ritor1
parents:
diff changeset
4511 v12 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4512 v101 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4513 while ( 1 )
Ritor1
parents:
diff changeset
4514 {
Ritor1
parents:
diff changeset
4515 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12);
Ritor1
parents:
diff changeset
4516 sub_4AE313(a1, result, &stru_F81018.field_0);
Ritor1
parents:
diff changeset
4517 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4518 {
Ritor1
parents:
diff changeset
4519 v15 = v95 * (v12 - pBLVRenderParams->uViewportY);
Ritor1
parents:
diff changeset
4520 v119 = &pBLVRenderParams->pTargetZBuffer[2
Ritor1
parents:
diff changeset
4521 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12)
Ritor1
parents:
diff changeset
4522 + 320 * (v12 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
4523 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4524 v16 = &pBLVRenderParams->pRenderTarget[v15
Ritor1
parents:
diff changeset
4525 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12)
Ritor1
parents:
diff changeset
4526 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4527 v14 = &pBLVRenderParams->pRenderTarget[v15
Ritor1
parents:
diff changeset
4528 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)
Ritor1
parents:
diff changeset
4529 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
4530 v123 = (unsigned int)v16;
Ritor1
parents:
diff changeset
4531 }
Ritor1
parents:
diff changeset
4532 else
Ritor1
parents:
diff changeset
4533 {
Ritor1
parents:
diff changeset
4534 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12);
Ritor1
parents:
diff changeset
4535 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99];
Ritor1
parents:
diff changeset
4536 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11];
Ritor1
parents:
diff changeset
4537 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)];
Ritor1
parents:
diff changeset
4538 }
Ritor1
parents:
diff changeset
4539 v117 = (unsigned int)v14;
Ritor1
parents:
diff changeset
4540 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0);
Ritor1
parents:
diff changeset
4541 v18 = stru_F81018.field_0.field_10;
Ritor1
parents:
diff changeset
4542 LOWORD(v17) = 0;
Ritor1
parents:
diff changeset
4543 v97 = stru_F8AD28.field_0 | v17;
Ritor1
parents:
diff changeset
4544 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8));
Ritor1
parents:
diff changeset
4545 v19 = stru_F81018.field_0.field_4 >> i;
Ritor1
parents:
diff changeset
4546 v20 = 11 - v18;
Ritor1
parents:
diff changeset
4547 v116 = stru_F81018.field_0.field_8 >> i;
Ritor1
parents:
diff changeset
4548 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18);
Ritor1
parents:
diff changeset
4549 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
4550 v122 = (unsigned __int16 *)v20;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4551 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
4552 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122));
0
Ritor1
parents:
diff changeset
4553 v120 = v116 + 4 * v23;
Ritor1
parents:
diff changeset
4554 if ( v123 < v117 )
Ritor1
parents:
diff changeset
4555 {
Ritor1
parents:
diff changeset
4556 v24 = (char *)&stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
4557 v114 = &stru_F81018.field_34.field_8;
Ritor1
parents:
diff changeset
4558 a1 += 16;
Ritor1
parents:
diff changeset
4559 while ( 1 )
Ritor1
parents:
diff changeset
4560 {
Ritor1
parents:
diff changeset
4561 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8));
Ritor1
parents:
diff changeset
4562 v25 = *((int *)v24 - 2);
Ritor1
parents:
diff changeset
4563 LOWORD(v25) = 0;
Ritor1
parents:
diff changeset
4564 v115 = v97;
Ritor1
parents:
diff changeset
4565 v26 = stru_F8AD28.field_0 | v25;
Ritor1
parents:
diff changeset
4566 if ( v97 <= (unsigned int)v26 )
Ritor1
parents:
diff changeset
4567 v115 = v26;
Ritor1
parents:
diff changeset
4568 v97 = v26;
Ritor1
parents:
diff changeset
4569 v27 = *((int *)v24 - 11);
Ritor1
parents:
diff changeset
4570 v28 = *((int *)v24 - 1);
Ritor1
parents:
diff changeset
4571 v105 = (&v86)[4 * v27];
Ritor1
parents:
diff changeset
4572 v111 = v27 + 16;
Ritor1
parents:
diff changeset
4573 v29 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
4574 v109 = v27 + v27 + 16 - v4->uWidthLn2;
Ritor1
parents:
diff changeset
4575 v107 = v29 >> v27;
Ritor1
parents:
diff changeset
4576 v30 = v28 >> i;
Ritor1
parents:
diff changeset
4577 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16);
Ritor1
parents:
diff changeset
4578 v31 = *v114 >> i;
Ritor1
parents:
diff changeset
4579 v122 = (unsigned __int16 *)(11 - v27);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4580 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27)));
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 321
diff changeset
4581 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122));
0
Ritor1
parents:
diff changeset
4582 v108 = (signed int)(v116 - v121) >> 4;
Ritor1
parents:
diff changeset
4583 v103 = (v90 - v120) >> 4;
Ritor1
parents:
diff changeset
4584 v32 = v123 + 32;
Ritor1
parents:
diff changeset
4585 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4586 v32 = v123 + 64;
Ritor1
parents:
diff changeset
4587 if ( v32 > v117 )
Ritor1
parents:
diff changeset
4588 v32 = v117;
Ritor1
parents:
diff changeset
4589 v118 = v32;
Ritor1
parents:
diff changeset
4590 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1));
Ritor1
parents:
diff changeset
4591 v106 = (signed int)(v32 - v123) >> 1;
Ritor1
parents:
diff changeset
4592 if ( v110 >> 16 == v100 >> 16 )
Ritor1
parents:
diff changeset
4593 {
Ritor1
parents:
diff changeset
4594 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1);
Ritor1
parents:
diff changeset
4595 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4596 {
Ritor1
parents:
diff changeset
4597 v44 = v123;
Ritor1
parents:
diff changeset
4598 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4599 {
Ritor1
parents:
diff changeset
4600 v45 = v119;
Ritor1
parents:
diff changeset
4601 v46 = v122;
Ritor1
parents:
diff changeset
4602 v47 = v121;
Ritor1
parents:
diff changeset
4603 v48 = v120;
Ritor1
parents:
diff changeset
4604 v49 = v111;
Ritor1
parents:
diff changeset
4605 v50 = v109;
Ritor1
parents:
diff changeset
4606 if ( v106 & 2 )
Ritor1
parents:
diff changeset
4607 {
Ritor1
parents:
diff changeset
4608 *v119 = v115;
Ritor1
parents:
diff changeset
4609 v45 -= 2;
Ritor1
parents:
diff changeset
4610 v44 = v123 + 4;
Ritor1
parents:
diff changeset
4611 goto LABEL_37;
Ritor1
parents:
diff changeset
4612 }
Ritor1
parents:
diff changeset
4613 do
Ritor1
parents:
diff changeset
4614 {
Ritor1
parents:
diff changeset
4615 v44 += 8;
Ritor1
parents:
diff changeset
4616 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50));
Ritor1
parents:
diff changeset
4617 v52 = v115;
Ritor1
parents:
diff changeset
4618 LOWORD(v51) = v46[v51];
Ritor1
parents:
diff changeset
4619 *v45 = v115;
Ritor1
parents:
diff changeset
4620 v45[1] = v52;
Ritor1
parents:
diff changeset
4621 v45[640] = v52;
Ritor1
parents:
diff changeset
4622 v45[641] = v52;
Ritor1
parents:
diff changeset
4623 *(short *)(v44 - 8) = v51;
Ritor1
parents:
diff changeset
4624 *(short *)(v44 - 6) = v51;
Ritor1
parents:
diff changeset
4625 *(short *)(v44 + 1272) = v51;
Ritor1
parents:
diff changeset
4626 *(short *)(v44 + 1274) = v51;
Ritor1
parents:
diff changeset
4627 v45[2] = v52;
Ritor1
parents:
diff changeset
4628 v45[3] = v52;
Ritor1
parents:
diff changeset
4629 v45[642] = v52;
Ritor1
parents:
diff changeset
4630 v45[643] = v52;
Ritor1
parents:
diff changeset
4631 v121 += v108;
Ritor1
parents:
diff changeset
4632 v120 += v103;
Ritor1
parents:
diff changeset
4633 v47 = v121;
Ritor1
parents:
diff changeset
4634 v48 = v120;
Ritor1
parents:
diff changeset
4635 LABEL_37:
Ritor1
parents:
diff changeset
4636 v45 += 4;
Ritor1
parents:
diff changeset
4637 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))];
Ritor1
parents:
diff changeset
4638 v54 = v108;
Ritor1
parents:
diff changeset
4639 *(short *)(v44 - 4) = v53;
Ritor1
parents:
diff changeset
4640 *(short *)(v44 - 2) = v53;
Ritor1
parents:
diff changeset
4641 *(short *)(v44 + 1276) = v53;
Ritor1
parents:
diff changeset
4642 *(short *)(v44 + 1278) = v53;
Ritor1
parents:
diff changeset
4643 v121 += v54;
Ritor1
parents:
diff changeset
4644 v120 += v103;
Ritor1
parents:
diff changeset
4645 v47 = v121;
Ritor1
parents:
diff changeset
4646 v48 = v120;
Ritor1
parents:
diff changeset
4647 }
Ritor1
parents:
diff changeset
4648 while ( v44 < v118 );
Ritor1
parents:
diff changeset
4649 v123 = v44;
Ritor1
parents:
diff changeset
4650 v119 = v45;
Ritor1
parents:
diff changeset
4651 }
Ritor1
parents:
diff changeset
4652 }
Ritor1
parents:
diff changeset
4653 else
Ritor1
parents:
diff changeset
4654 {
Ritor1
parents:
diff changeset
4655 v33 = v123;
Ritor1
parents:
diff changeset
4656 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4657 {
Ritor1
parents:
diff changeset
4658 v34 = v119;
Ritor1
parents:
diff changeset
4659 v35 = v122;
Ritor1
parents:
diff changeset
4660 v36 = v121;
Ritor1
parents:
diff changeset
4661 v37 = v120;
Ritor1
parents:
diff changeset
4662 v38 = v111;
Ritor1
parents:
diff changeset
4663 v39 = v109;
Ritor1
parents:
diff changeset
4664 if ( v106 & 1 )
Ritor1
parents:
diff changeset
4665 {
Ritor1
parents:
diff changeset
4666 *v119 = v115;
Ritor1
parents:
diff changeset
4667 --v34;
Ritor1
parents:
diff changeset
4668 v33 = v123 + 2;
Ritor1
parents:
diff changeset
4669 goto LABEL_30;
Ritor1
parents:
diff changeset
4670 }
Ritor1
parents:
diff changeset
4671 do
Ritor1
parents:
diff changeset
4672 {
Ritor1
parents:
diff changeset
4673 v33 += 4;
Ritor1
parents:
diff changeset
4674 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
4675 v41 = v115;
Ritor1
parents:
diff changeset
4676 LOWORD(v40) = v35[v40];
Ritor1
parents:
diff changeset
4677 *v34 = v115;
Ritor1
parents:
diff changeset
4678 *(short *)(v33 - 4) = v40;
Ritor1
parents:
diff changeset
4679 v34[1] = v41;
Ritor1
parents:
diff changeset
4680 v121 += v108;
Ritor1
parents:
diff changeset
4681 v120 += v103;
Ritor1
parents:
diff changeset
4682 v36 = v121;
Ritor1
parents:
diff changeset
4683 v37 = v120;
Ritor1
parents:
diff changeset
4684 LABEL_30:
Ritor1
parents:
diff changeset
4685 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39));
Ritor1
parents:
diff changeset
4686 v34 += 2;
Ritor1
parents:
diff changeset
4687 v43 = v108;
Ritor1
parents:
diff changeset
4688 *(short *)(v33 - 2) = v35[*(char *)v42];
Ritor1
parents:
diff changeset
4689 v121 += v43;
Ritor1
parents:
diff changeset
4690 v120 += v103;
Ritor1
parents:
diff changeset
4691 v36 = v121;
Ritor1
parents:
diff changeset
4692 v37 = v120;
Ritor1
parents:
diff changeset
4693 }
Ritor1
parents:
diff changeset
4694 while ( v33 < v118 );
Ritor1
parents:
diff changeset
4695 v123 = v33;
Ritor1
parents:
diff changeset
4696 v119 = v34;
Ritor1
parents:
diff changeset
4697 }
Ritor1
parents:
diff changeset
4698 }
Ritor1
parents:
diff changeset
4699 }
Ritor1
parents:
diff changeset
4700 else
Ritor1
parents:
diff changeset
4701 {
Ritor1
parents:
diff changeset
4702 v55 = v110 - ((v100 - v110) >> 4);
Ritor1
parents:
diff changeset
4703 v110 = (v100 - v110) >> 4;
Ritor1
parents:
diff changeset
4704 v122 = (unsigned __int16 *)v55;
Ritor1
parents:
diff changeset
4705 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
4706 {
Ritor1
parents:
diff changeset
4707 v71 = v123;
Ritor1
parents:
diff changeset
4708 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4709 {
Ritor1
parents:
diff changeset
4710 v72 = v119;
Ritor1
parents:
diff changeset
4711 v73 = v94;
Ritor1
parents:
diff changeset
4712 v74 = v121;
Ritor1
parents:
diff changeset
4713 v75 = v120;
Ritor1
parents:
diff changeset
4714 v76 = v111;
Ritor1
parents:
diff changeset
4715 v77 = v109;
Ritor1
parents:
diff changeset
4716 if ( v106 & 2 )
Ritor1
parents:
diff changeset
4717 {
Ritor1
parents:
diff changeset
4718 *v119 = v115;
Ritor1
parents:
diff changeset
4719 v72 += 2;
Ritor1
parents:
diff changeset
4720 v71 = v123 + 4;
Ritor1
parents:
diff changeset
4721 goto LABEL_52;
Ritor1
parents:
diff changeset
4722 }
Ritor1
parents:
diff changeset
4723 do
Ritor1
parents:
diff changeset
4724 {
Ritor1
parents:
diff changeset
4725 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
4726 v79 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4727 v71 += 8;
Ritor1
parents:
diff changeset
4728 v122 = (unsigned __int16 *)v79;
Ritor1
parents:
diff changeset
4729 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78];
Ritor1
parents:
diff changeset
4730 v81 = v115;
Ritor1
parents:
diff changeset
4731 LOWORD(v80) = v73[v80];
Ritor1
parents:
diff changeset
4732 *v72 = v115;
Ritor1
parents:
diff changeset
4733 v72[1] = v81;
Ritor1
parents:
diff changeset
4734 v72[640] = v81;
Ritor1
parents:
diff changeset
4735 v72[641] = v81;
Ritor1
parents:
diff changeset
4736 *(short *)(v71 - 8) = v80;
Ritor1
parents:
diff changeset
4737 *(short *)(v71 - 6) = v80;
Ritor1
parents:
diff changeset
4738 *(short *)(v71 + 1272) = v80;
Ritor1
parents:
diff changeset
4739 *(short *)(v71 + 1274) = v80;
Ritor1
parents:
diff changeset
4740 v72[2] = v81;
Ritor1
parents:
diff changeset
4741 v72[3] = v81;
Ritor1
parents:
diff changeset
4742 v72[642] = v81;
Ritor1
parents:
diff changeset
4743 v72[643] = v81;
Ritor1
parents:
diff changeset
4744 v121 += v108;
Ritor1
parents:
diff changeset
4745 v120 += v103;
Ritor1
parents:
diff changeset
4746 v74 = v121;
Ritor1
parents:
diff changeset
4747 v75 = v120;
Ritor1
parents:
diff changeset
4748 v72 += 4;
Ritor1
parents:
diff changeset
4749 LABEL_52:
Ritor1
parents:
diff changeset
4750 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77);
Ritor1
parents:
diff changeset
4751 v83 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4752 v84 = v105[v82];
Ritor1
parents:
diff changeset
4753 v122 = (unsigned __int16 *)v83;
Ritor1
parents:
diff changeset
4754 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84];
Ritor1
parents:
diff changeset
4755 v85 = v108;
Ritor1
parents:
diff changeset
4756 *(short *)(v71 - 4) = v84;
Ritor1
parents:
diff changeset
4757 *(short *)(v71 - 2) = v84;
Ritor1
parents:
diff changeset
4758 *(short *)(v71 + 1276) = v84;
Ritor1
parents:
diff changeset
4759 *(short *)(v71 + 1278) = v84;
Ritor1
parents:
diff changeset
4760 v121 += v85;
Ritor1
parents:
diff changeset
4761 v120 += v103;
Ritor1
parents:
diff changeset
4762 v74 = v121;
Ritor1
parents:
diff changeset
4763 v75 = v120;
Ritor1
parents:
diff changeset
4764 }
Ritor1
parents:
diff changeset
4765 while ( v71 < v118 );
Ritor1
parents:
diff changeset
4766 v123 = v71;
Ritor1
parents:
diff changeset
4767 v119 = v72;
Ritor1
parents:
diff changeset
4768 }
Ritor1
parents:
diff changeset
4769 }
Ritor1
parents:
diff changeset
4770 else
Ritor1
parents:
diff changeset
4771 {
Ritor1
parents:
diff changeset
4772 v56 = v123;
Ritor1
parents:
diff changeset
4773 if ( v123 < v118 )
Ritor1
parents:
diff changeset
4774 {
Ritor1
parents:
diff changeset
4775 v57 = v119;
Ritor1
parents:
diff changeset
4776 v58 = v94;
Ritor1
parents:
diff changeset
4777 v59 = v121;
Ritor1
parents:
diff changeset
4778 v60 = v120;
Ritor1
parents:
diff changeset
4779 v61 = v111;
Ritor1
parents:
diff changeset
4780 v62 = v109;
Ritor1
parents:
diff changeset
4781 if ( v106 & 1 )
Ritor1
parents:
diff changeset
4782 {
Ritor1
parents:
diff changeset
4783 *v119 = v115;
Ritor1
parents:
diff changeset
4784 ++v57;
Ritor1
parents:
diff changeset
4785 v56 = v123 + 2;
Ritor1
parents:
diff changeset
4786 goto LABEL_45;
Ritor1
parents:
diff changeset
4787 }
Ritor1
parents:
diff changeset
4788 do
Ritor1
parents:
diff changeset
4789 {
Ritor1
parents:
diff changeset
4790 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
4791 v64 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4792 v56 += 4;
Ritor1
parents:
diff changeset
4793 v122 = (unsigned __int16 *)v64;
Ritor1
parents:
diff changeset
4794 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63];
Ritor1
parents:
diff changeset
4795 v66 = v115;
Ritor1
parents:
diff changeset
4796 LOWORD(v65) = v58[v65];
Ritor1
parents:
diff changeset
4797 *v57 = v115;
Ritor1
parents:
diff changeset
4798 *(short *)(v56 - 4) = v65;
Ritor1
parents:
diff changeset
4799 v57[1] = v66;
Ritor1
parents:
diff changeset
4800 v121 += v108;
Ritor1
parents:
diff changeset
4801 v120 += v103;
Ritor1
parents:
diff changeset
4802 v59 = v121;
Ritor1
parents:
diff changeset
4803 v60 = v120;
Ritor1
parents:
diff changeset
4804 v57 += 2;
Ritor1
parents:
diff changeset
4805 LABEL_45:
Ritor1
parents:
diff changeset
4806 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62);
Ritor1
parents:
diff changeset
4807 v68 = (int)((char *)v122 + v110);
Ritor1
parents:
diff changeset
4808 v69 = v105[v67];
Ritor1
parents:
diff changeset
4809 v122 = (unsigned __int16 *)v68;
Ritor1
parents:
diff changeset
4810 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69];
Ritor1
parents:
diff changeset
4811 v70 = v108;
Ritor1
parents:
diff changeset
4812 *(short *)(v56 - 2) = v69;
Ritor1
parents:
diff changeset
4813 v121 += v70;
Ritor1
parents:
diff changeset
4814 v120 += v103;
Ritor1
parents:
diff changeset
4815 v59 = v121;
Ritor1
parents:
diff changeset
4816 v60 = v120;
Ritor1
parents:
diff changeset
4817 }
Ritor1
parents:
diff changeset
4818 while ( v56 < v118 );
Ritor1
parents:
diff changeset
4819 v123 = v56;
Ritor1
parents:
diff changeset
4820 v119 = v57;
Ritor1
parents:
diff changeset
4821 }
Ritor1
parents:
diff changeset
4822 }
Ritor1
parents:
diff changeset
4823 }
Ritor1
parents:
diff changeset
4824 v114 += 13;
Ritor1
parents:
diff changeset
4825 v110 = v100;
Ritor1
parents:
diff changeset
4826 a1 += 16;
Ritor1
parents:
diff changeset
4827 v4 = v96;
Ritor1
parents:
diff changeset
4828 v121 = v116;
Ritor1
parents:
diff changeset
4829 v120 = v90;
Ritor1
parents:
diff changeset
4830 if ( v123 >= v117 )
Ritor1
parents:
diff changeset
4831 break;
Ritor1
parents:
diff changeset
4832 v24 = (char *)v114;
Ritor1
parents:
diff changeset
4833 v22 = stru_5C6E00;
Ritor1
parents:
diff changeset
4834 }
Ritor1
parents:
diff changeset
4835 }
Ritor1
parents:
diff changeset
4836 ++a2;
Ritor1
parents:
diff changeset
4837 v98 += v95;
Ritor1
parents:
diff changeset
4838 result = a2;
Ritor1
parents:
diff changeset
4839 v101 += 2;
Ritor1
parents:
diff changeset
4840 v99 += 640;
Ritor1
parents:
diff changeset
4841 if ( a2 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4842 break;
Ritor1
parents:
diff changeset
4843 v12 = v101;
Ritor1
parents:
diff changeset
4844 result = a2;
Ritor1
parents:
diff changeset
4845 v11 = v98;
Ritor1
parents:
diff changeset
4846 }
Ritor1
parents:
diff changeset
4847 }
Ritor1
parents:
diff changeset
4848 }
Ritor1
parents:
diff changeset
4849 }
Ritor1
parents:
diff changeset
4850 }
Ritor1
parents:
diff changeset
4851 }
Ritor1
parents:
diff changeset
4852 }
Ritor1
parents:
diff changeset
4853 }
Ritor1
parents:
diff changeset
4854 return result;
Ritor1
parents:
diff changeset
4855 }
Ritor1
parents:
diff changeset
4856 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
4857
Ritor1
parents:
diff changeset
4858 //----- (004ADD1D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4859 void __fastcall sub_4ADD1D(int uFaceID)
Ritor1
parents:
diff changeset
4860 {
Ritor1
parents:
diff changeset
4861 int v1; // edi@1
Ritor1
parents:
diff changeset
4862 BLVFace *v2; // esi@3
Ritor1
parents:
diff changeset
4863 signed int v3; // ebx@4
Ritor1
parents:
diff changeset
4864 Texture *v4; // edi@9
Ritor1
parents:
diff changeset
4865 signed int v5; // eax@9
Ritor1
parents:
diff changeset
4866 char *v6; // edi@12
Ritor1
parents:
diff changeset
4867 signed int v7; // eax@15
Ritor1
parents:
diff changeset
4868 unsigned int v8; // eax@16
Ritor1
parents:
diff changeset
4869 __int16 v9; // cx@19
Ritor1
parents:
diff changeset
4870 unsigned __int8 *v10; // eax@19
Ritor1
parents:
diff changeset
4871 unsigned __int16 *v11; // eax@19
Ritor1
parents:
diff changeset
4872 int v12; // edi@19
Ritor1
parents:
diff changeset
4873 int v13; // ebx@20
Ritor1
parents:
diff changeset
4874 stru352 *v14; // esi@20
Ritor1
parents:
diff changeset
4875 DWORD v15; // eax@22
Ritor1
parents:
diff changeset
4876 signed int v16; // ecx@22
Ritor1
parents:
diff changeset
4877 signed int v17; // ST68_4@22
Ritor1
parents:
diff changeset
4878 int v18; // eax@22
Ritor1
parents:
diff changeset
4879 int v19; // ecx@22
Ritor1
parents:
diff changeset
4880 unsigned int v20; // esi@23
Ritor1
parents:
diff changeset
4881 int v21; // edi@23
Ritor1
parents:
diff changeset
4882 int v22; // eax@23
Ritor1
parents:
diff changeset
4883 int *v23; // ebx@24
Ritor1
parents:
diff changeset
4884 int v24; // edx@24
Ritor1
parents:
diff changeset
4885 int v25; // ebx@25
Ritor1
parents:
diff changeset
4886 unsigned __int16 v26; // cx@25
Ritor1
parents:
diff changeset
4887 int v27; // edx@26
Ritor1
parents:
diff changeset
4888 unsigned __int16 v28; // cx@26
Ritor1
parents:
diff changeset
4889 unsigned __int8 v29; // sf@27
Ritor1
parents:
diff changeset
4890 unsigned __int8 v30; // of@27
Ritor1
parents:
diff changeset
4891 unsigned int v31; // esi@29
Ritor1
parents:
diff changeset
4892 int v32; // edi@29
Ritor1
parents:
diff changeset
4893 unsigned __int16 *v33; // eax@29
Ritor1
parents:
diff changeset
4894 int *v34; // ebx@30
Ritor1
parents:
diff changeset
4895 int v35; // edx@30
Ritor1
parents:
diff changeset
4896 int v36; // ebx@31
Ritor1
parents:
diff changeset
4897 unsigned __int16 v37; // cx@31
Ritor1
parents:
diff changeset
4898 int v38; // edx@32
Ritor1
parents:
diff changeset
4899 unsigned __int16 v39; // cx@32
Ritor1
parents:
diff changeset
4900 Texture *v40; // [sp-10h] [bp-6Ch]@16
Ritor1
parents:
diff changeset
4901 int v41; // [sp-Ch] [bp-68h]@15
Ritor1
parents:
diff changeset
4902 unsigned int v42; // [sp+10h] [bp-4Ch]@1
Ritor1
parents:
diff changeset
4903 signed int v43; // [sp+14h] [bp-48h]@12
Ritor1
parents:
diff changeset
4904 signed int v44; // [sp+14h] [bp-48h]@22
Ritor1
parents:
diff changeset
4905 int v45; // [sp+1Ch] [bp-40h]@22
Ritor1
parents:
diff changeset
4906 int v46; // [sp+20h] [bp-3Ch]@22
Ritor1
parents:
diff changeset
4907 int v47; // [sp+24h] [bp-38h]@19
Ritor1
parents:
diff changeset
4908 char v48; // [sp+28h] [bp-34h]@19
Ritor1
parents:
diff changeset
4909 int v49; // [sp+2Ch] [bp-30h]@19
Ritor1
parents:
diff changeset
4910 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19
Ritor1
parents:
diff changeset
4911 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19
Ritor1
parents:
diff changeset
4912 int v52; // [sp+38h] [bp-24h]@22
Ritor1
parents:
diff changeset
4913 int v53; // [sp+3Ch] [bp-20h]@22
Ritor1
parents:
diff changeset
4914 signed int v54; // [sp+40h] [bp-1Ch]@12
Ritor1
parents:
diff changeset
4915 int v55; // [sp+40h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
4916 int v56; // [sp+44h] [bp-18h]@20
Ritor1
parents:
diff changeset
4917 stru352 *i; // [sp+48h] [bp-14h]@20
Ritor1
parents:
diff changeset
4918 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23
Ritor1
parents:
diff changeset
4919 int v59; // [sp+50h] [bp-Ch]@4
Ritor1
parents:
diff changeset
4920 int v60; // [sp+50h] [bp-Ch]@19
Ritor1
parents:
diff changeset
4921 int v61; // [sp+54h] [bp-8h]@22
Ritor1
parents:
diff changeset
4922 int *v62; // [sp+58h] [bp-4h]@23
Ritor1
parents:
diff changeset
4923 int *v63; // [sp+58h] [bp-4h]@29
Ritor1
parents:
diff changeset
4924
Ritor1
parents:
diff changeset
4925 v1 = uFaceID;
Ritor1
parents:
diff changeset
4926 v42 = pRenderer->uTargetSurfacePitch;
Ritor1
parents:
diff changeset
4927 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces )
Ritor1
parents:
diff changeset
4928 {
Ritor1
parents:
diff changeset
4929 v2 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
4930 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4931 {
Ritor1
parents:
diff changeset
4932 v3 = sub_424579(uFaceID, &stru_F8AD28);
Ritor1
parents:
diff changeset
4933 v59 = v3;
Ritor1
parents:
diff changeset
4934 }
Ritor1
parents:
diff changeset
4935 else
Ritor1
parents:
diff changeset
4936 {
Ritor1
parents:
diff changeset
4937 v59 = sub_423B5D(uFaceID);
Ritor1
parents:
diff changeset
4938 v3 = v59;
Ritor1
parents:
diff changeset
4939 }
Ritor1
parents:
diff changeset
4940 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
Ritor1
parents:
diff changeset
4941 {
Ritor1
parents:
diff changeset
4942 v4 = v2->GetTexture();
Ritor1
parents:
diff changeset
4943 v5 = 0;
Ritor1
parents:
diff changeset
4944 if ( v4 )
Ritor1
parents:
diff changeset
4945 {
Ritor1
parents:
diff changeset
4946 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
4947 {
Ritor1
parents:
diff changeset
4948 if ( v3 > 0 )
Ritor1
parents:
diff changeset
4949 {
Ritor1
parents:
diff changeset
4950 v54 = v3;
Ritor1
parents:
diff changeset
4951 v43 = v3;
Ritor1
parents:
diff changeset
4952 v6 = (char *)&array_507D30[0].v;
Ritor1
parents:
diff changeset
4953 do
Ritor1
parents:
diff changeset
4954 {
Ritor1
parents:
diff changeset
4955 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1);
Ritor1
parents:
diff changeset
4956 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6;
Ritor1
parents:
diff changeset
4957 v6 += 48;
Ritor1
parents:
diff changeset
4958 --v54;
Ritor1
parents:
diff changeset
4959 }
Ritor1
parents:
diff changeset
4960 while ( v54 );
Ritor1
parents:
diff changeset
4961 v3 = v59;
Ritor1
parents:
diff changeset
4962 v5 = v43;
Ritor1
parents:
diff changeset
4963 }
Ritor1
parents:
diff changeset
4964 v7 = v5;
Ritor1
parents:
diff changeset
4965 v41 = stru_F8AD28.field_0;
Ritor1
parents:
diff changeset
4966 array_507D30[v7].u = array_507D30[v7].u * 0.25;
Ritor1
parents:
diff changeset
4967 array_507D30[v7].v = array_507D30[v7].v * 0.25;
Ritor1
parents:
diff changeset
4968 if ( BYTE1(v2->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
4969 {
Ritor1
parents:
diff changeset
4970 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
4971 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_);
Ritor1
parents:
diff changeset
4972 }
Ritor1
parents:
diff changeset
4973 else
Ritor1
parents:
diff changeset
4974 {
Ritor1
parents:
diff changeset
4975 v40 = v2->GetTexture();
Ritor1
parents:
diff changeset
4976 v8 = v2->uBitmapID;
Ritor1
parents:
diff changeset
4977 }
Ritor1
parents:
diff changeset
4978 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0);
Ritor1
parents:
diff changeset
4979 }
Ritor1
parents:
diff changeset
4980 else
Ritor1
parents:
diff changeset
4981 {
Ritor1
parents:
diff changeset
4982 v49 = v4->uWidthMinus1;
Ritor1
parents:
diff changeset
4983 v47 = v4->uHeightMinus1 << 16;
Ritor1
parents:
diff changeset
4984 v9 = 16 - v4->uWidthLn2;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 706
diff changeset
4985 v10 = v4->pLevelOfDetail0_prolly_alpha_mask;
0
Ritor1
parents:
diff changeset
4986 LOBYTE(v2->uAttributes) |= 0x80u;
Ritor1
parents:
diff changeset
4987 v48 = v9;
Ritor1
parents:
diff changeset
4988 v50 = v10;
Ritor1
parents:
diff changeset
4989 sub_4AF412();
Ritor1
parents:
diff changeset
4990 ++pBLVRenderParams->uNumFacesRenderedThisFrame;
Ritor1
parents:
diff changeset
4991 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1);
Ritor1
parents:
diff changeset
4992 v12 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4993 v51 = v11;
Ritor1
parents:
diff changeset
4994 v60 = stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4995 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
4996 {
Ritor1
parents:
diff changeset
4997 v13 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
4998 v14 = &stru_F83B80[stru_F8A590._viewport_space_y];
Ritor1
parents:
diff changeset
4999 v55 = 2 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5000 v56 = 640 * stru_F8A590._viewport_space_y;
Ritor1
parents:
diff changeset
5001 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i )
Ritor1
parents:
diff changeset
5002 {
Ritor1
parents:
diff changeset
5003 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12);
Ritor1
parents:
diff changeset
5004 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16);
Ritor1
parents:
diff changeset
5005 v15 = GetTickCount();
Ritor1
parents:
diff changeset
5006 v16 = v14->field_0;
Ritor1
parents:
diff changeset
5007 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11;
Ritor1
parents:
diff changeset
5008 v45 = v14->field_4 >> 3;
Ritor1
parents:
diff changeset
5009 v44 = v16 >> 3;
Ritor1
parents:
diff changeset
5010 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3;
Ritor1
parents:
diff changeset
5011 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5012 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
5013 v18 = v14->field_28;
Ritor1
parents:
diff changeset
5014 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13);
Ritor1
parents:
diff changeset
5015 LOWORD(v18) = 0;
Ritor1
parents:
diff changeset
5016 v46 = stru_F8AD28.field_0 | v18;
Ritor1
parents:
diff changeset
5017 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19;
Ritor1
parents:
diff changeset
5018 if ( LOBYTE(viewparams->field_20) )
Ritor1
parents:
diff changeset
5019 {
Ritor1
parents:
diff changeset
5020 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
5021 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5022 v31 = v44;
Ritor1
parents:
diff changeset
5023 v32 = v45;
Ritor1
parents:
diff changeset
5024 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
5025 + 2 * v19
Ritor1
parents:
diff changeset
5026 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5027 if ( v61 & 1 )
Ritor1
parents:
diff changeset
5028 {
Ritor1
parents:
diff changeset
5029 --v61;
Ritor1
parents:
diff changeset
5030 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY)
Ritor1
parents:
diff changeset
5031 + 2 * v19
Ritor1
parents:
diff changeset
5032 - pBLVRenderParams->uViewportX
Ritor1
parents:
diff changeset
5033 - 2];
Ritor1
parents:
diff changeset
5034 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY))
Ritor1
parents:
diff changeset
5035 - pBLVRenderParams->uViewportX];
Ritor1
parents:
diff changeset
5036 v35 = v46;
Ritor1
parents:
diff changeset
5037 v63 += 2;
Ritor1
parents:
diff changeset
5038 goto LABEL_32;
Ritor1
parents:
diff changeset
5039 }
Ritor1
parents:
diff changeset
5040 while ( 1 )
Ritor1
parents:
diff changeset
5041 {
Ritor1
parents:
diff changeset
5042 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
5043 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
5044 v61 -= 2;
Ritor1
parents:
diff changeset
5045 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
5046 break;
Ritor1
parents:
diff changeset
5047 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48));
Ritor1
parents:
diff changeset
5048 v31 += v52;
Ritor1
parents:
diff changeset
5049 v37 = v51[v36];
Ritor1
parents:
diff changeset
5050 v32 += v53;
Ritor1
parents:
diff changeset
5051 v34 = v63;
Ritor1
parents:
diff changeset
5052 v35 = v46;
Ritor1
parents:
diff changeset
5053 *v33 = v37;
Ritor1
parents:
diff changeset
5054 v33[1] = v37;
Ritor1
parents:
diff changeset
5055 v33[640] = v37;
Ritor1
parents:
diff changeset
5056 v33[641] = v37;
Ritor1
parents:
diff changeset
5057 v63 += 4;
Ritor1
parents:
diff changeset
5058 v34[2] = v46;
Ritor1
parents:
diff changeset
5059 v34[3] = v46;
Ritor1
parents:
diff changeset
5060 v34[642] = v46;
Ritor1
parents:
diff changeset
5061 v34[643] = v46;
Ritor1
parents:
diff changeset
5062 LABEL_32:
Ritor1
parents:
diff changeset
5063 *v34 = v35;
Ritor1
parents:
diff changeset
5064 v34[1] = v35;
Ritor1
parents:
diff changeset
5065 v34[640] = v35;
Ritor1
parents:
diff changeset
5066 v34[641] = v35;
Ritor1
parents:
diff changeset
5067 v38 = v49 & (v31 >> 16);
Ritor1
parents:
diff changeset
5068 v33 += 4;
Ritor1
parents:
diff changeset
5069 v31 += v52;
Ritor1
parents:
diff changeset
5070 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))];
Ritor1
parents:
diff changeset
5071 v32 += v53;
Ritor1
parents:
diff changeset
5072 *(v33 - 2) = v39;
Ritor1
parents:
diff changeset
5073 *(v33 - 1) = v39;
Ritor1
parents:
diff changeset
5074 v33[638] = v39;
Ritor1
parents:
diff changeset
5075 v33[639] = v39;
Ritor1
parents:
diff changeset
5076 }
Ritor1
parents:
diff changeset
5077 }
Ritor1
parents:
diff changeset
5078 else
Ritor1
parents:
diff changeset
5079 {
Ritor1
parents:
diff changeset
5080 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch];
Ritor1
parents:
diff changeset
5081 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
5082 v20 = v44;
Ritor1
parents:
diff changeset
5083 v21 = v45;
Ritor1
parents:
diff changeset
5084 v22 = (int)v58;
Ritor1
parents:
diff changeset
5085 if ( v61 & 1 )
Ritor1
parents:
diff changeset
5086 {
Ritor1
parents:
diff changeset
5087 --v61;
Ritor1
parents:
diff changeset
5088 v22 = (int)(v58 - 1);
Ritor1
parents:
diff changeset
5089 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19];
Ritor1
parents:
diff changeset
5090 v24 = v46;
Ritor1
parents:
diff changeset
5091 ++v62;
Ritor1
parents:
diff changeset
5092 goto LABEL_26;
Ritor1
parents:
diff changeset
5093 }
Ritor1
parents:
diff changeset
5094 while ( 1 )
Ritor1
parents:
diff changeset
5095 {
Ritor1
parents:
diff changeset
5096 v30 = __OFSUB__(v61, 2);
Ritor1
parents:
diff changeset
5097 v29 = v61 - 2 < 0;
Ritor1
parents:
diff changeset
5098 v61 -= 2;
Ritor1
parents:
diff changeset
5099 if ( v29 ^ v30 )
Ritor1
parents:
diff changeset
5100 break;
Ritor1
parents:
diff changeset
5101 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48));
Ritor1
parents:
diff changeset
5102 v20 += v52;
Ritor1
parents:
diff changeset
5103 v26 = v51[v25];
Ritor1
parents:
diff changeset
5104 v21 += v53;
Ritor1
parents:
diff changeset
5105 v23 = v62;
Ritor1
parents:
diff changeset
5106 v24 = v46;
Ritor1
parents:
diff changeset
5107 *(short *)v22 = v26;
Ritor1
parents:
diff changeset
5108 v62 += 2;
Ritor1
parents:
diff changeset
5109 v23[1] = v46;
Ritor1
parents:
diff changeset
5110 LABEL_26:
Ritor1
parents:
diff changeset
5111 *v23 = v24;
Ritor1
parents:
diff changeset
5112 v27 = v49 & (v20 >> 16);
Ritor1
parents:
diff changeset
5113 v22 += 4;
Ritor1
parents:
diff changeset
5114 v20 += v52;
Ritor1
parents:
diff changeset
5115 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))];
Ritor1
parents:
diff changeset
5116 v21 += v53;
Ritor1
parents:
diff changeset
5117 *(short *)(v22 - 2) = v28;
Ritor1
parents:
diff changeset
5118 }
Ritor1
parents:
diff changeset
5119 }
Ritor1
parents:
diff changeset
5120 ++v60;
Ritor1
parents:
diff changeset
5121 ++i;
Ritor1
parents:
diff changeset
5122 v56 += 640;
Ritor1
parents:
diff changeset
5123 v55 += 2;
Ritor1
parents:
diff changeset
5124 if ( v60 > stru_F8A590._viewport_space_w )
Ritor1
parents:
diff changeset
5125 break;
Ritor1
parents:
diff changeset
5126 v13 = v55;
Ritor1
parents:
diff changeset
5127 v12 = v60;
Ritor1
parents:
diff changeset
5128 }
Ritor1
parents:
diff changeset
5129 }
Ritor1
parents:
diff changeset
5130 }
Ritor1
parents:
diff changeset
5131 }
Ritor1
parents:
diff changeset
5132 }
Ritor1
parents:
diff changeset
5133 }
Ritor1
parents:
diff changeset
5134 }
Ritor1
parents:
diff changeset
5135
Ritor1
parents:
diff changeset
5136 //----- (004AE1E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
5137 int __fastcall sub_4AE1E7(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
5138 {
Ritor1
parents:
diff changeset
5139 int v3; // ebx@1
Ritor1
parents:
diff changeset
5140 int v4; // edi@1
Ritor1
parents:
diff changeset
5141 int v5; // esi@1
Ritor1
parents:
diff changeset
5142 signed __int64 v6; // qtt@3
Ritor1
parents:
diff changeset
5143 int v7; // esi@3
Ritor1
parents:
diff changeset
5144 int v8; // eax@5
Ritor1
parents:
diff changeset
5145 int result; // eax@5
Ritor1
parents:
diff changeset
5146 int v10; // edx@5
Ritor1
parents:
diff changeset
5147 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
5148 int v12; // [sp+1Ch] [bp+8h]@2
Ritor1
parents:
diff changeset
5149
Ritor1
parents:
diff changeset
5150 v3 = pBLVRenderParams->uViewportCenterY - a3;
Ritor1
parents:
diff changeset
5151 v4 = pBLVRenderParams->uViewportCenterX - a2;
Ritor1
parents:
diff changeset
5152 v11 = a1;
Ritor1
parents:
diff changeset
5153 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y
Ritor1
parents:
diff changeset
5154 + stru_F8AD28.field_7C
Ritor1
parents:
diff changeset
5155 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5156 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) )
Ritor1
parents:
diff changeset
5157 {
Ritor1
parents:
diff changeset
5158 LODWORD(v6) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
5159 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
5160 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x);
Ritor1
parents:
diff changeset
5161 }
Ritor1
parents:
diff changeset
5162 else
Ritor1
parents:
diff changeset
5163 {
Ritor1
parents:
diff changeset
5164 v7 = 1073741824;
Ritor1
parents:
diff changeset
5165 }
Ritor1
parents:
diff changeset
5166 v8 = stru_F8AD28.vec_9C.z;
Ritor1
parents:
diff changeset
5167 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z
Ritor1
parents:
diff changeset
5168 + stru_F8AD28.vec_8C.x
Ritor1
parents:
diff changeset
5169 + v4 * stru_F8AD28.vec_8C.y)
Ritor1
parents:
diff changeset
5170 * (signed __int64)v7) >> 16)
Ritor1
parents:
diff changeset
5171 + stru_F8AD28.field_98;
Ritor1
parents:
diff changeset
5172 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16;
Ritor1
parents:
diff changeset
5173 v10 = result + stru_F8AD28.field_A8;
Ritor1
parents:
diff changeset
5174 stru_F83B80[v11].field_28 = v7;
Ritor1
parents:
diff changeset
5175 stru_F83B80[v11].field_4 = v10;
Ritor1
parents:
diff changeset
5176 return result;
Ritor1
parents:
diff changeset
5177 }
Ritor1
parents:
diff changeset
5178
Ritor1
parents:
diff changeset
5179 //----- (004AE313) --------------------------------------------------------
Ritor1
parents:
diff changeset
5180 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p)
Ritor1
parents:
diff changeset
5181 {
Ritor1
parents:
diff changeset
5182 int _dy; // ebx@1
Ritor1
parents:
diff changeset
5183 int _dx; // edi@1
Ritor1
parents:
diff changeset
5184 int v5; // ecx@1
Ritor1
parents:
diff changeset
5185 int v6; // esi@1
Ritor1
parents:
diff changeset
5186 int v7; // ST18_4@2
Ritor1
parents:
diff changeset
5187 signed __int64 v8; // qtt@3
Ritor1
parents:
diff changeset
5188 unsigned int v9; // ecx@3
Ritor1
parents:
diff changeset
5189 int result; // eax@8
Ritor1
parents:
diff changeset
5190 int v11; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
5191
Ritor1
parents:
diff changeset
5192 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y;
Ritor1
parents:
diff changeset
5193 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x;
Ritor1
parents:
diff changeset
5194 ++pBLVRenderParams->field_88;
Ritor1
parents:
diff changeset
5195 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C;
Ritor1
parents:
diff changeset
5196 v6 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5197 v11 = v5 + _dx * stru_F8AD28.vec_80.x;
Ritor1
parents:
diff changeset
5198 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) )
Ritor1
parents:
diff changeset
5199 {
Ritor1
parents:
diff changeset
5200 LODWORD(v8) = stru_F8AD28.vec_80.z << 16;
Ritor1
parents:
diff changeset
5201 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16;
Ritor1
parents:
diff changeset
5202 v9 = v8 / v11;
Ritor1
parents:
diff changeset
5203 }
Ritor1
parents:
diff changeset
5204 else
Ritor1
parents:
diff changeset
5205 {
Ritor1
parents:
diff changeset
5206 v9 = 0x40000000u;
Ritor1
parents:
diff changeset
5207 }
Ritor1
parents:
diff changeset
5208 if ( (signed int)v9 >= stru_F8AD28.field_34 )
Ritor1
parents:
diff changeset
5209 p->field_0 = v9;
Ritor1
parents:
diff changeset
5210 else
Ritor1
parents:
diff changeset
5211 p->field_0 = stru_F8AD28.field_34;
Ritor1
parents:
diff changeset
5212 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
5213 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
5214 + stru_F8AD28.field_98
Ritor1
parents:
diff changeset
5215 + (stru_F8AD28.pDeltaUV[0] << 16);
Ritor1
parents:
diff changeset
5216 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
5217 * (signed __int64)(signed int)v9) >> 16)
Ritor1
parents:
diff changeset
5218 + stru_F8AD28.field_A8
Ritor1
parents:
diff changeset
5219 + (stru_F8AD28.pDeltaUV[1] << 16);
Ritor1
parents:
diff changeset
5220 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16);
Ritor1
parents:
diff changeset
5221 if ( result < 369620 || bUseLoResSprites )
Ritor1
parents:
diff changeset
5222 {
Ritor1
parents:
diff changeset
5223 if ( result < 184810 )
Ritor1
parents:
diff changeset
5224 p->field_10 = result > 92405;
Ritor1
parents:
diff changeset
5225 else
Ritor1
parents:
diff changeset
5226 p->field_10 = 2;
Ritor1
parents:
diff changeset
5227 }
Ritor1
parents:
diff changeset
5228 else
Ritor1
parents:
diff changeset
5229 {
Ritor1
parents:
diff changeset
5230 p->field_10 = 3;
Ritor1
parents:
diff changeset
5231 }
Ritor1
parents:
diff changeset
5232 return result;
Ritor1
parents:
diff changeset
5233 }
Ritor1
parents:
diff changeset
5234
Ritor1
parents:
diff changeset
5235 //----- (004AE491) --------------------------------------------------------
Ritor1
parents:
diff changeset
5236 int __fastcall sub_4AE491(signed int a1, signed int a2)
Ritor1
parents:
diff changeset
5237 {
Ritor1
parents:
diff changeset
5238 signed int v2; // eax@1
Ritor1
parents:
diff changeset
5239 signed int v3; // edi@1
Ritor1
parents:
diff changeset
5240 int v4; // ecx@1
Ritor1
parents:
diff changeset
5241 int v5; // esi@2
Ritor1
parents:
diff changeset
5242 int v6; // eax@2
Ritor1
parents:
diff changeset
5243 int v7; // ebx@2
Ritor1
parents:
diff changeset
5244 unsigned int v8; // ecx@2
Ritor1
parents:
diff changeset
5245 int v9; // edx@5
Ritor1
parents:
diff changeset
5246 int v10; // edx@7
Ritor1
parents:
diff changeset
5247 unsigned int v11; // eax@8
Ritor1
parents:
diff changeset
5248 int v13; // [sp+4h] [bp-18h]@2
Ritor1
parents:
diff changeset
5249 int v14; // [sp+8h] [bp-14h]@2
Ritor1
parents:
diff changeset
5250 signed int v15; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
5251 int v16; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
5252 int v17; // [sp+18h] [bp-4h]@1
Ritor1
parents:
diff changeset
5253
Ritor1
parents:
diff changeset
5254 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
5255 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38);
Ritor1
parents:
diff changeset
5256 v17 = stru_F8AD28.uCurrentAmbientLightLevel;
Ritor1
parents:
diff changeset
5257 v4 = 0;
Ritor1
parents:
diff changeset
5258 v15 = v2;
Ritor1
parents:
diff changeset
5259 v16 = 0;
Ritor1
parents:
diff changeset
5260 if ( stru_F8AD28.uNumLightsApplied > 0 )
Ritor1
parents:
diff changeset
5261 {
Ritor1
parents:
diff changeset
5262 do
Ritor1
parents:
diff changeset
5263 {
Ritor1
parents:
diff changeset
5264 v5 = v16;
Ritor1
parents:
diff changeset
5265 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]);
Ritor1
parents:
diff changeset
5266 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]);
Ritor1
parents:
diff changeset
5267 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
5268 v7 = v13;
Ritor1
parents:
diff changeset
5269 v8 = v14;
Ritor1
parents:
diff changeset
5270 if ( v6 < v13 )
Ritor1
parents:
diff changeset
5271 {
Ritor1
parents:
diff changeset
5272 v6 = v13;
Ritor1
parents:
diff changeset
5273 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16];
Ritor1
parents:
diff changeset
5274 }
Ritor1
parents:
diff changeset
5275 if ( v6 < v14 )
Ritor1
parents:
diff changeset
5276 {
Ritor1
parents:
diff changeset
5277 v9 = v6;
Ritor1
parents:
diff changeset
5278 v6 = v14;
Ritor1
parents:
diff changeset
5279 v8 = v9;
Ritor1
parents:
diff changeset
5280 }
Ritor1
parents:
diff changeset
5281 if ( v7 < (signed int)v8 )
Ritor1
parents:
diff changeset
5282 {
Ritor1
parents:
diff changeset
5283 v10 = v8;
Ritor1
parents:
diff changeset
5284 v8 = v7;
Ritor1
parents:
diff changeset
5285 v7 = v10;
Ritor1
parents:
diff changeset
5286 }
Ritor1
parents:
diff changeset
5287 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6;
Ritor1
parents:
diff changeset
5288 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] )
Ritor1
parents:
diff changeset
5289 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536);
Ritor1
parents:
diff changeset
5290 ++v16;
Ritor1
parents:
diff changeset
5291 v2 = v15;
Ritor1
parents:
diff changeset
5292 }
Ritor1
parents:
diff changeset
5293 while ( v16 < stru_F8AD28.uNumLightsApplied );
Ritor1
parents:
diff changeset
5294 v4 = 0;
Ritor1
parents:
diff changeset
5295 }
Ritor1
parents:
diff changeset
5296 if ( stru_F8AD28.field_3E4 != v4 )
Ritor1
parents:
diff changeset
5297 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4);
Ritor1
parents:
diff changeset
5298 if ( v17 >= v4 )
Ritor1
parents:
diff changeset
5299 {
Ritor1
parents:
diff changeset
5300 if ( v17 > 2031616 )
Ritor1
parents:
diff changeset
5301 v17 = 2031616;
Ritor1
parents:
diff changeset
5302 }
Ritor1
parents:
diff changeset
5303 else
Ritor1
parents:
diff changeset
5304 {
Ritor1
parents:
diff changeset
5305 v17 = v4;
Ritor1
parents:
diff changeset
5306 }
Ritor1
parents:
diff changeset
5307 ++pBLVRenderParams->field_8C;
Ritor1
parents:
diff changeset
5308 return v17;
Ritor1
parents:
diff changeset
5309 }
Ritor1
parents:
diff changeset
5310 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
Ritor1
parents:
diff changeset
5311
Ritor1
parents:
diff changeset
5312 //----- (004AE5F1) --------------------------------------------------------
Ritor1
parents:
diff changeset
5313 void __fastcall sub_4AE5F1(unsigned int uFaceID)
Ritor1
parents:
diff changeset
5314 {
Ritor1
parents:
diff changeset
5315 BLVFace *v1; // esi@1
Ritor1
parents:
diff changeset
5316 BLVFaceExtra *v2; // ebx@1
Ritor1
parents:
diff changeset
5317 int v3; // eax@1
Ritor1
parents:
diff changeset
5318 int v4; // edi@1
Ritor1
parents:
diff changeset
5319 Texture *v5; // edi@1
Ritor1
parents:
diff changeset
5320 int v6; // eax@1
Ritor1
parents:
diff changeset
5321 unsigned int v7; // eax@1
Ritor1
parents:
diff changeset
5322 unsigned int v8; // ecx@1
Ritor1
parents:
diff changeset
5323 unsigned int v9; // eax@1
Ritor1
parents:
diff changeset
5324 unsigned int v10; // ecx@5
Ritor1
parents:
diff changeset
5325 int v11; // edi@10
Ritor1
parents:
diff changeset
5326 int v12; // ecx@10
Ritor1
parents:
diff changeset
5327 int v13; // eax@10
Ritor1
parents:
diff changeset
5328 int v14; // edx@10
Ritor1
parents:
diff changeset
5329 int v15; // ebx@12
Ritor1
parents:
diff changeset
5330 double v16; // st7@16
Ritor1
parents:
diff changeset
5331 int v17; // eax@16
Ritor1
parents:
diff changeset
5332 char *v18; // ebx@17
Ritor1
parents:
diff changeset
5333 int v19; // ecx@19
Ritor1
parents:
diff changeset
5334 int v20; // eax@19
Ritor1
parents:
diff changeset
5335 int v21; // edx@21
Ritor1
parents:
diff changeset
5336 int v22; // eax@23
Ritor1
parents:
diff changeset
5337 int v23; // ST04_4@26
Ritor1
parents:
diff changeset
5338 int v24; // edi@26
Ritor1
parents:
diff changeset
5339 double v25; // st6@26
Ritor1
parents:
diff changeset
5340 int v26; // eax@26
Ritor1
parents:
diff changeset
5341 double v27; // st6@26
Ritor1
parents:
diff changeset
5342 int v28; // ecx@26
Ritor1
parents:
diff changeset
5343 char v29; // al@26
Ritor1
parents:
diff changeset
5344 int v30; // edx@28
Ritor1
parents:
diff changeset
5345 int v31; // ecx@28
Ritor1
parents:
diff changeset
5346 BLVLightMM7 *v32; // ecx@32
Ritor1
parents:
diff changeset
5347 int v33; // edi@33
Ritor1
parents:
diff changeset
5348 int v34; // edx@33
Ritor1
parents:
diff changeset
5349 int v35; // eax@33
Ritor1
parents:
diff changeset
5350 int v36; // edi@35
Ritor1
parents:
diff changeset
5351 int v37; // edx@37
Ritor1
parents:
diff changeset
5352 int v38; // ebx@39
Ritor1
parents:
diff changeset
5353 int v39; // edi@42
Ritor1
parents:
diff changeset
5354 int v40; // eax@42
Ritor1
parents:
diff changeset
5355 char *v41; // ebx@45
Ritor1
parents:
diff changeset
5356 signed int v42; // ecx@47
Ritor1
parents:
diff changeset
5357 int v43; // edi@47
Ritor1
parents:
diff changeset
5358 int v44; // eax@49
Ritor1
parents:
diff changeset
5359 int v45; // edx@51
Ritor1
parents:
diff changeset
5360 int v46; // eax@53
Ritor1
parents:
diff changeset
5361 int v47; // ST04_4@55
Ritor1
parents:
diff changeset
5362 int v48; // edi@55
Ritor1
parents:
diff changeset
5363 double v49; // st6@55
Ritor1
parents:
diff changeset
5364 int v50; // eax@55
Ritor1
parents:
diff changeset
5365 double v51; // st6@55
Ritor1
parents:
diff changeset
5366 int v52; // eax@55
Ritor1
parents:
diff changeset
5367 int v53; // ecx@57
Ritor1
parents:
diff changeset
5368 int v54; // ecx@58
Ritor1
parents:
diff changeset
5369 int v55; // ecx@59
Ritor1
parents:
diff changeset
5370 int v56; // edx@62
Ritor1
parents:
diff changeset
5371 int v57; // ecx@62
Ritor1
parents:
diff changeset
5372 int v58; // eax@63
Ritor1
parents:
diff changeset
5373 int v59; // edx@64
Ritor1
parents:
diff changeset
5374 int v60; // ecx@67
Ritor1
parents:
diff changeset
5375 int v61; // edx@67
Ritor1
parents:
diff changeset
5376 int v62; // eax@68
Ritor1
parents:
diff changeset
5377 int v63; // edx@69
Ritor1
parents:
diff changeset
5378 signed int v64; // ecx@72
Ritor1
parents:
diff changeset
5379 double v65; // st7@75
Ritor1
parents:
diff changeset
5380 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9
Ritor1
parents:
diff changeset
5381 Vec3_int_ v67; // [sp+18h] [bp-28h]@9
Ritor1
parents:
diff changeset
5382 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
5383 int v69; // [sp+28h] [bp-18h]@10
Ritor1
parents:
diff changeset
5384 int v70; // [sp+2Ch] [bp-14h]@10
Ritor1
parents:
diff changeset
5385 int X; // [sp+30h] [bp-10h]@10
Ritor1
parents:
diff changeset
5386 int v72; // [sp+34h] [bp-Ch]@10
Ritor1
parents:
diff changeset
5387 int v73; // [sp+38h] [bp-8h]@10
Ritor1
parents:
diff changeset
5388 int v74; // [sp+3Ch] [bp-4h]@10
Ritor1
parents:
diff changeset
5389
Ritor1
parents:
diff changeset
5390 v1 = &pIndoor->pFaces[uFaceID];
Ritor1
parents:
diff changeset
5391 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID];
Ritor1
parents:
diff changeset
5392 v3 = v1->uBitmapID;
Ritor1
parents:
diff changeset
5393 v4 = v1->uBitmapID;
Ritor1
parents:
diff changeset
5394 v68 = v2;
Ritor1
parents:
diff changeset
5395 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0);
Ritor1
parents:
diff changeset
5396 v6 = 8 * uFaceID;
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
5397 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID);
0
Ritor1
parents:
diff changeset
5398 stru_F8AD28.field_0 = v6;
Ritor1
parents:
diff changeset
5399 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x;
Ritor1
parents:
diff changeset
5400 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
5401 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z;
Ritor1
parents:
diff changeset
5402 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist;
Ritor1
parents:
diff changeset
5403 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU;
Ritor1
parents:
diff changeset
5404 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV;
Ritor1
parents:
diff changeset
5405 v7 = GetTickCount();
Ritor1
parents:
diff changeset
5406 v8 = v1->uAttributes;
Ritor1
parents:
diff changeset
5407 v9 = v7 >> 3;
Ritor1
parents:
diff changeset
5408 if ( v8 & 4 )
Ritor1
parents:
diff changeset
5409 {
Ritor1
parents:
diff changeset
5410 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
5411 }
Ritor1
parents:
diff changeset
5412 else
Ritor1
parents:
diff changeset
5413 {
Ritor1
parents:
diff changeset
5414 if ( v8 & 0x20 )
Ritor1
parents:
diff changeset
5415 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1;
Ritor1
parents:
diff changeset
5416 }
Ritor1
parents:
diff changeset
5417 v10 = v1->uAttributes;
Ritor1
parents:
diff changeset
5418 if ( BYTE1(v10) & 8 )
Ritor1
parents:
diff changeset
5419 {
Ritor1
parents:
diff changeset
5420 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
5421 }
Ritor1
parents:
diff changeset
5422 else
Ritor1
parents:
diff changeset
5423 {
Ritor1
parents:
diff changeset
5424 if ( v10 & 0x40 )
Ritor1
parents:
diff changeset
5425 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1;
Ritor1
parents:
diff changeset
5426 }
Ritor1
parents:
diff changeset
5427 v1->_get_normals(&v67, &v66);
Ritor1
parents:
diff changeset
5428 stru_F8AD28.vec_14.x = v67.x;
Ritor1
parents:
diff changeset
5429 stru_F8AD28.vec_14.y = v67.y;
Ritor1
parents:
diff changeset
5430 stru_F8AD28.vec_14.z = v67.z;
Ritor1
parents:
diff changeset
5431 stru_F8AD28.vec_20.x = v66.x;
Ritor1
parents:
diff changeset
5432 stru_F8AD28.vec_20.y = v66.y;
Ritor1
parents:
diff changeset
5433 stru_F8AD28.vec_20.z = v66.z;
Ritor1
parents:
diff changeset
5434 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22;
Ritor1
parents:
diff changeset
5435 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
5436 {
Ritor1
parents:
diff changeset
5437 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5438 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74;
Ritor1
parents:
diff changeset
5439 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5440 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X;
Ritor1
parents:
diff changeset
5441 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5442 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5443 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5444 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5445 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5446 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
5447 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5448 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5449 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
5450 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5451 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5452 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5453 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5454 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5455 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5456 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5457 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70;
Ritor1
parents:
diff changeset
5458 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5459 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16;
Ritor1
parents:
diff changeset
5460 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5461 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5462 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5463 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5464 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5465 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5466 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5467 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5468 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5469 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5470 v73 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5471 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5472 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70;
Ritor1
parents:
diff changeset
5473 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
Ritor1
parents:
diff changeset
5474 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5475 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5476 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5477 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5478 }
Ritor1
parents:
diff changeset
5479 else
Ritor1
parents:
diff changeset
5480 {
Ritor1
parents:
diff changeset
5481 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5482 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5483 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5484 - v70;
Ritor1
parents:
diff changeset
5485 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
5486 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5487 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5488 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5489 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5490 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5491 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5492 - v70;
Ritor1
parents:
diff changeset
5493 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
5494 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5495 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5496 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5497 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5498 - v70;
Ritor1
parents:
diff changeset
5499 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16;
Ritor1
parents:
diff changeset
5500 v14 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5501 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
5502 v13 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5503 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5504 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5505 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5506 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5507 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5508 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5509 v70 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5510 }
Ritor1
parents:
diff changeset
5511 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
5512 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z
Ritor1
parents:
diff changeset
5513 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
5514 + stru_F8AD28.plane_4.vNormal.y * v13
Ritor1
parents:
diff changeset
5515 + stru_F8AD28.plane_4.vNormal.x * v14;
Ritor1
parents:
diff changeset
5516 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5517 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
5518 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5519 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
5520 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
5521 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
5522 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
5523 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
5524 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
5525 v15 = v70;
Ritor1
parents:
diff changeset
5526 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16;
Ritor1
parents:
diff changeset
5527 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
5528 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70);
Ritor1
parents:
diff changeset
5529 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
5530 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
5531 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16;
Ritor1
parents:
diff changeset
5532 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16;
Ritor1
parents:
diff changeset
5533 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16;
Ritor1
parents:
diff changeset
5534 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
5535 stru_F8AD28.field_A8 = -(X
Ritor1
parents:
diff changeset
5536 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16)
Ritor1
parents:
diff changeset
5537 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16));
Ritor1
parents:
diff changeset
5538 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 )
Ritor1
parents:
diff changeset
5539 {
Ritor1
parents:
diff changeset
5540 stru_F8AD28.field_3E4 = 1;
Ritor1
parents:
diff changeset
5541 stru_F8AD28.field_3E8 = *(int *)&v68->field_4;
Ritor1
parents:
diff changeset
5542 stru_F8AD28.field_3EC = *(int *)&v68->field_8;
Ritor1
parents:
diff changeset
5543 stru_F8AD28.field_3F0 = v68->field_1E;
Ritor1
parents:
diff changeset
5544 stru_F8AD28.field_3F4 = v68->field_20;
Ritor1
parents:
diff changeset
5545 }
Ritor1
parents:
diff changeset
5546 else
Ritor1
parents:
diff changeset
5547 {
Ritor1
parents:
diff changeset
5548 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
5549 }
Ritor1
parents:
diff changeset
5550 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5551 v17 = 116 * v1->uSectorID;
Ritor1
parents:
diff changeset
5552 v69 = v17;
Ritor1
parents:
diff changeset
5553 v74 = 0;
Ritor1
parents:
diff changeset
5554 v73 = 0;
Ritor1
parents:
diff changeset
5555 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16;
Ritor1
parents:
diff changeset
5556 v70 = pMobileLightsStack->uNumLightsActive;
Ritor1
parents:
diff changeset
5557 if ( pMobileLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
5558 {
Ritor1
parents:
diff changeset
5559 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
5560 do
Ritor1
parents:
diff changeset
5561 {
Ritor1
parents:
diff changeset
5562 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
5563 break;
Ritor1
parents:
diff changeset
5564 v19 = *((short *)v18 + 2);
Ritor1
parents:
diff changeset
5565 v20 = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
5566 if ( v20 > v1->pBounding.x1 - v19 )
Ritor1
parents:
diff changeset
5567 {
Ritor1
parents:
diff changeset
5568 if ( v20 < v19 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5569 {
Ritor1
parents:
diff changeset
5570 v21 = *(short *)v18;
Ritor1
parents:
diff changeset
5571 if ( v21 > v1->pBounding.y1 - v19 )
Ritor1
parents:
diff changeset
5572 {
Ritor1
parents:
diff changeset
5573 if ( v21 < v19 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5574 {
Ritor1
parents:
diff changeset
5575 v22 = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
5576 if ( v22 > v1->pBounding.z1 - v19 )
Ritor1
parents:
diff changeset
5577 {
Ritor1
parents:
diff changeset
5578 if ( v22 < v19 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5579 {
Ritor1
parents:
diff changeset
5580 X = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5581 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
5582 + v21 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
5583 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents:
diff changeset
5584 if ( X <= v19 )
Ritor1
parents:
diff changeset
5585 {
Ritor1
parents:
diff changeset
5586 v23 = X;
Ritor1
parents:
diff changeset
5587 v24 = v74;
Ritor1
parents:
diff changeset
5588 stru_F8AD28._blv_lights_radii[v74] = v19;
Ritor1
parents:
diff changeset
5589 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19;
Ritor1
parents:
diff changeset
5590 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16;
Ritor1
parents:
diff changeset
5591 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1);
Ritor1
parents:
diff changeset
5592 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18;
Ritor1
parents:
diff changeset
5593 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1);
Ritor1
parents:
diff changeset
5594 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6];
Ritor1
parents:
diff changeset
5595 v25 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5596 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7];
Ritor1
parents:
diff changeset
5597 v26 = (unsigned __int8)v18[8];
Ritor1
parents:
diff changeset
5598 *(float *)(v24 * 4 + 16297992) = v25;
Ritor1
parents:
diff changeset
5599 v27 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
5600 v68 = (BLVFaceExtra *)v26;
Ritor1
parents:
diff changeset
5601 *(float *)(v24 * 4 + 16298072) = v27 * v16;
Ritor1
parents:
diff changeset
5602 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5603 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5604 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23);
Ritor1
parents:
diff changeset
5605 v28 = v74;
Ritor1
parents:
diff changeset
5606 v29 = v18[9];
Ritor1
parents:
diff changeset
5607 ++v74;
Ritor1
parents:
diff changeset
5608 stru_F8AD28._blv_lights_types[v28] = v29;
Ritor1
parents:
diff changeset
5609 }
Ritor1
parents:
diff changeset
5610 }
Ritor1
parents:
diff changeset
5611 }
Ritor1
parents:
diff changeset
5612 }
Ritor1
parents:
diff changeset
5613 }
Ritor1
parents:
diff changeset
5614 }
Ritor1
parents:
diff changeset
5615 }
Ritor1
parents:
diff changeset
5616 ++v73;
Ritor1
parents:
diff changeset
5617 v18 += 18;
Ritor1
parents:
diff changeset
5618 v17 = v69;
Ritor1
parents:
diff changeset
5619 }
Ritor1
parents:
diff changeset
5620 while ( v73 < v70 );
Ritor1
parents:
diff changeset
5621 }
Ritor1
parents:
diff changeset
5622 v30 = 0;
Ritor1
parents:
diff changeset
5623 v73 = 0;
Ritor1
parents:
diff changeset
5624 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
5625 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17);
Ritor1
parents:
diff changeset
5626 if ( v31 > 0 )
Ritor1
parents:
diff changeset
5627 {
Ritor1
parents:
diff changeset
5628 while ( v74 < 20 )
Ritor1
parents:
diff changeset
5629 {
Ritor1
parents:
diff changeset
5630 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)];
Ritor1
parents:
diff changeset
5631 if ( !(v32->uAtributes & 8) )
Ritor1
parents:
diff changeset
5632 {
Ritor1
parents:
diff changeset
5633 v33 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
5634 v34 = v32->vPosition.x;
Ritor1
parents:
diff changeset
5635 X = v32->uBrightness;
Ritor1
parents:
diff changeset
5636 v35 = v32->uRadius;
Ritor1
parents:
diff changeset
5637 v68 = (BLVFaceExtra *)v32->uRadius;
Ritor1
parents:
diff changeset
5638 if ( v34 > v33 - v35 )
Ritor1
parents:
diff changeset
5639 {
Ritor1
parents:
diff changeset
5640 if ( v34 < v35 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5641 {
Ritor1
parents:
diff changeset
5642 v36 = v32->vPosition.y;
Ritor1
parents:
diff changeset
5643 if ( v36 > v1->pBounding.y1 - v35 )
Ritor1
parents:
diff changeset
5644 {
Ritor1
parents:
diff changeset
5645 if ( v36 < v35 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5646 {
Ritor1
parents:
diff changeset
5647 v37 = v32->vPosition.z;
Ritor1
parents:
diff changeset
5648 if ( v37 > v1->pBounding.z1 - v35 )
Ritor1
parents:
diff changeset
5649 {
Ritor1
parents:
diff changeset
5650 if ( v37 < v35 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5651 {
Ritor1
parents:
diff changeset
5652 v38 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5653 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
5654 + v37 * v1->pFacePlane_old.vNormal.z
Ritor1
parents:
diff changeset
5655 + v36 * v1->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents:
diff changeset
5656 if ( v38 >= 0 )
Ritor1
parents:
diff changeset
5657 {
Ritor1
parents:
diff changeset
5658 if ( v38 <= v35 && v35 )
Ritor1
parents:
diff changeset
5659 {
Ritor1
parents:
diff changeset
5660 v39 = v74;
Ritor1
parents:
diff changeset
5661 stru_F8AD28._blv_lights_radii[v74] = v35;
Ritor1
parents:
diff changeset
5662 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68;
Ritor1
parents:
diff changeset
5663 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16;
Ritor1
parents:
diff changeset
5664 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x;
Ritor1
parents:
diff changeset
5665 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y;
Ritor1
parents:
diff changeset
5666 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z;
Ritor1
parents:
diff changeset
5667 v68 = (BLVFaceExtra *)v32->uRed;
Ritor1
parents:
diff changeset
5668 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5669 v68 = (BLVFaceExtra *)v32->uGreen;
Ritor1
parents:
diff changeset
5670 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5671 v68 = (BLVFaceExtra *)v32->uBlue;
Ritor1
parents:
diff changeset
5672 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5673 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5674 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38);
Ritor1
parents:
diff changeset
5675 v40 = v74++;
Ritor1
parents:
diff changeset
5676 stru_F8AD28._blv_lights_types[v40] = 1;
Ritor1
parents:
diff changeset
5677 }
Ritor1
parents:
diff changeset
5678 }
Ritor1
parents:
diff changeset
5679 }
Ritor1
parents:
diff changeset
5680 }
Ritor1
parents:
diff changeset
5681 }
Ritor1
parents:
diff changeset
5682 }
Ritor1
parents:
diff changeset
5683 }
Ritor1
parents:
diff changeset
5684 }
Ritor1
parents:
diff changeset
5685 }
Ritor1
parents:
diff changeset
5686 v30 = v73++ + 1;
Ritor1
parents:
diff changeset
5687 if ( v73 >= v70 )
Ritor1
parents:
diff changeset
5688 break;
Ritor1
parents:
diff changeset
5689 v17 = v69;
Ritor1
parents:
diff changeset
5690 }
Ritor1
parents:
diff changeset
5691 }
Ritor1
parents:
diff changeset
5692 v73 = 0;
Ritor1
parents:
diff changeset
5693 if ( pStationaryLightsStack->uNumLightsActive > 0 )
Ritor1
parents:
diff changeset
5694 {
Ritor1
parents:
diff changeset
5695 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y;
Ritor1
parents:
diff changeset
5696 do
Ritor1
parents:
diff changeset
5697 {
Ritor1
parents:
diff changeset
5698 if ( v74 >= 20 )
Ritor1
parents:
diff changeset
5699 break;
Ritor1
parents:
diff changeset
5700 v42 = *((short *)v41 + 2);
Ritor1
parents:
diff changeset
5701 v43 = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
5702 if ( v43 > v1->pBounding.x1 - v42 )
Ritor1
parents:
diff changeset
5703 {
Ritor1
parents:
diff changeset
5704 if ( v43 < v42 + v1->pBounding.x2 )
Ritor1
parents:
diff changeset
5705 {
Ritor1
parents:
diff changeset
5706 v44 = *(short *)v41;
Ritor1
parents:
diff changeset
5707 if ( v44 > v1->pBounding.y1 - v42 )
Ritor1
parents:
diff changeset
5708 {
Ritor1
parents:
diff changeset
5709 if ( v44 < v42 + v1->pBounding.y2 )
Ritor1
parents:
diff changeset
5710 {
Ritor1
parents:
diff changeset
5711 v45 = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
5712 if ( v45 > v1->pBounding.z1 - v42 )
Ritor1
parents:
diff changeset
5713 {
Ritor1
parents:
diff changeset
5714 if ( v45 < v42 + v1->pBounding.z2 )
Ritor1
parents:
diff changeset
5715 {
Ritor1
parents:
diff changeset
5716 v46 = (v1->pFacePlane_old.dist
Ritor1
parents:
diff changeset
5717 + *(short *)v41 * v1->pFacePlane_old.vNormal.y
Ritor1
parents:
diff changeset
5718 + v43 * v1->pFacePlane_old.vNormal.x
Ritor1
parents:
diff changeset
5719 + v45 * v1->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents:
diff changeset
5720 v69 = v46;
Ritor1
parents:
diff changeset
5721 if ( v46 >= 0 )
Ritor1
parents:
diff changeset
5722 {
Ritor1
parents:
diff changeset
5723 if ( v46 <= v42 )
Ritor1
parents:
diff changeset
5724 {
Ritor1
parents:
diff changeset
5725 v47 = v69;
Ritor1
parents:
diff changeset
5726 v48 = v74;
Ritor1
parents:
diff changeset
5727 stru_F8AD28._blv_lights_radii[v74] = v42;
Ritor1
parents:
diff changeset
5728 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42;
Ritor1
parents:
diff changeset
5729 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1);
Ritor1
parents:
diff changeset
5730 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41;
Ritor1
parents:
diff changeset
5731 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1);
Ritor1
parents:
diff changeset
5732 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6];
Ritor1
parents:
diff changeset
5733 v49 = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5734 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7];
Ritor1
parents:
diff changeset
5735 v50 = (unsigned __int8)v41[8];
Ritor1
parents:
diff changeset
5736 stru_F8AD28._blv_lights_rs[v48] = v49;
Ritor1
parents:
diff changeset
5737 v51 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
5738 v68 = (BLVFaceExtra *)v50;
Ritor1
parents:
diff changeset
5739 stru_F8AD28._blv_lights_gs[v48] = v51 * v16;
Ritor1
parents:
diff changeset
5740 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16;
Ritor1
parents:
diff changeset
5741 v16 = 0.0039215689;
Ritor1
parents:
diff changeset
5742 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47);
Ritor1
parents:
diff changeset
5743 v52 = v74++;
Ritor1
parents:
diff changeset
5744 stru_F8AD28._blv_lights_types[v52] = 1;
Ritor1
parents:
diff changeset
5745 }
Ritor1
parents:
diff changeset
5746 }
Ritor1
parents:
diff changeset
5747 }
Ritor1
parents:
diff changeset
5748 }
Ritor1
parents:
diff changeset
5749 }
Ritor1
parents:
diff changeset
5750 }
Ritor1
parents:
diff changeset
5751 }
Ritor1
parents:
diff changeset
5752 }
Ritor1
parents:
diff changeset
5753 ++v73;
Ritor1
parents:
diff changeset
5754 v41 += 12;
Ritor1
parents:
diff changeset
5755 }
Ritor1
parents:
diff changeset
5756 while ( v73 < pStationaryLightsStack->uNumLightsActive );
Ritor1
parents:
diff changeset
5757 }
Ritor1
parents:
diff changeset
5758 stru_F8AD28.uNumLightsApplied = v74;
Ritor1
parents:
diff changeset
5759 v53 = v1->pBounding.x2;
Ritor1
parents:
diff changeset
5760 if ( pBLVRenderParams->vPartyPos.x <= v53 )
Ritor1
parents:
diff changeset
5761 {
Ritor1
parents:
diff changeset
5762 v55 = v1->pBounding.x1;
Ritor1
parents:
diff changeset
5763 if ( pBLVRenderParams->vPartyPos.x >= v55 )
Ritor1
parents:
diff changeset
5764 v54 = 0;
Ritor1
parents:
diff changeset
5765 else
Ritor1
parents:
diff changeset
5766 v54 = v55 - pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5767 }
Ritor1
parents:
diff changeset
5768 else
Ritor1
parents:
diff changeset
5769 {
Ritor1
parents:
diff changeset
5770 v54 = pBLVRenderParams->vPartyPos.x - v53;
Ritor1
parents:
diff changeset
5771 }
Ritor1
parents:
diff changeset
5772 v56 = v1->pBounding.y2;
Ritor1
parents:
diff changeset
5773 v57 = v54 * v54;
Ritor1
parents:
diff changeset
5774 if ( pBLVRenderParams->vPartyPos.y <= v56 )
Ritor1
parents:
diff changeset
5775 {
Ritor1
parents:
diff changeset
5776 v59 = v1->pBounding.y1;
Ritor1
parents:
diff changeset
5777 if ( pBLVRenderParams->vPartyPos.y >= v59 )
Ritor1
parents:
diff changeset
5778 v58 = 0;
Ritor1
parents:
diff changeset
5779 else
Ritor1
parents:
diff changeset
5780 v58 = v59 - pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5781 }
Ritor1
parents:
diff changeset
5782 else
Ritor1
parents:
diff changeset
5783 {
Ritor1
parents:
diff changeset
5784 v58 = pBLVRenderParams->vPartyPos.y - v56;
Ritor1
parents:
diff changeset
5785 }
Ritor1
parents:
diff changeset
5786 v60 = v58 * v58 + v57;
Ritor1
parents:
diff changeset
5787 v61 = v1->pBounding.z2;
Ritor1
parents:
diff changeset
5788 if ( pBLVRenderParams->vPartyPos.z <= v61 )
Ritor1
parents:
diff changeset
5789 {
Ritor1
parents:
diff changeset
5790 v63 = v1->pBounding.z1;
Ritor1
parents:
diff changeset
5791 if ( pBLVRenderParams->vPartyPos.z >= v63 )
Ritor1
parents:
diff changeset
5792 v62 = 0;
Ritor1
parents:
diff changeset
5793 else
Ritor1
parents:
diff changeset
5794 v62 = v63 - pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5795 }
Ritor1
parents:
diff changeset
5796 else
Ritor1
parents:
diff changeset
5797 {
Ritor1
parents:
diff changeset
5798 v62 = pBLVRenderParams->vPartyPos.z - v61;
Ritor1
parents:
diff changeset
5799 }
Ritor1
parents:
diff changeset
5800 v64 = v62 * v62 + v60;
Ritor1
parents:
diff changeset
5801 if ( v64 )
295
640a176c030f sub_42ECB5
Nomad
parents: 267
diff changeset
5802 stru_F8AD28.field_34 = integer_sqrt(v64) << 16;
0
Ritor1
parents:
diff changeset
5803 else
Ritor1
parents:
diff changeset
5804 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
5805 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y);
Ritor1
parents:
diff changeset
5806 v65 = (double)(signed int)v68;
Ritor1
parents:
diff changeset
5807 if ( v65 >= 655.36 )
Ritor1
parents:
diff changeset
5808 {
Ritor1
parents:
diff changeset
5809 if ( v65 >= 26214.4 )
Ritor1
parents:
diff changeset
5810 {
Ritor1
parents:
diff changeset
5811 if ( v65 >= 45875.2 )
Ritor1
parents:
diff changeset
5812 {
Ritor1
parents:
diff changeset
5813 stru_F8AD28.field_44 = 8;
Ritor1
parents:
diff changeset
5814 stru_F8AD28.field_48 = 3;
Ritor1
parents:
diff changeset
5815 }
Ritor1
parents:
diff changeset
5816 else
Ritor1
parents:
diff changeset
5817 {
Ritor1
parents:
diff changeset
5818 stru_F8AD28.field_44 = 16;
Ritor1
parents:
diff changeset
5819 stru_F8AD28.field_48 = 4;
Ritor1
parents:
diff changeset
5820 }
Ritor1
parents:
diff changeset
5821 }
Ritor1
parents:
diff changeset
5822 else
Ritor1
parents:
diff changeset
5823 {
Ritor1
parents:
diff changeset
5824 stru_F8AD28.field_44 = 32;
Ritor1
parents:
diff changeset
5825 stru_F8AD28.field_48 = 5;
Ritor1
parents:
diff changeset
5826 }
Ritor1
parents:
diff changeset
5827 }
Ritor1
parents:
diff changeset
5828 else
Ritor1
parents:
diff changeset
5829 {
Ritor1
parents:
diff changeset
5830 stru_F8AD28.field_44 = 64;
Ritor1
parents:
diff changeset
5831 stru_F8AD28.field_48 = 6;
Ritor1
parents:
diff changeset
5832 }
Ritor1
parents:
diff changeset
5833 }
Ritor1
parents:
diff changeset
5834 // 519AB4: using guessed type int uNumStationaryLightsApplied;
Ritor1
parents:
diff changeset
5835
Ritor1
parents:
diff changeset
5836 //----- (004AF412) --------------------------------------------------------
Ritor1
parents:
diff changeset
5837 int __cdecl sub_4AF412()
Ritor1
parents:
diff changeset
5838 {
Ritor1
parents:
diff changeset
5839 int v0; // ST20_4@2
Ritor1
parents:
diff changeset
5840 int v1; // ST20_4@2
Ritor1
parents:
diff changeset
5841 int v2; // ST20_4@2
Ritor1
parents:
diff changeset
5842 int v3; // esi@2
Ritor1
parents:
diff changeset
5843 int v4; // ST20_4@2
Ritor1
parents:
diff changeset
5844 int v5; // ecx@2
Ritor1
parents:
diff changeset
5845 int v6; // ebx@2
Ritor1
parents:
diff changeset
5846 int v7; // edi@2
Ritor1
parents:
diff changeset
5847 int v8; // edx@2
Ritor1
parents:
diff changeset
5848 int v9; // eax@2
Ritor1
parents:
diff changeset
5849 int result; // eax@4
Ritor1
parents:
diff changeset
5850
Ritor1
parents:
diff changeset
5851 stru_F8AD28.plane_4.vNormal.z = -65536;
Ritor1
parents:
diff changeset
5852 stru_F8AD28.vec_20.y = -65536;
Ritor1
parents:
diff changeset
5853 stru_F8AD28.plane_4.vNormal.x = 0;
Ritor1
parents:
diff changeset
5854 stru_F8AD28.plane_4.vNormal.y = 0;
Ritor1
parents:
diff changeset
5855 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16;
Ritor1
parents:
diff changeset
5856 stru_F8AD28.vec_14.x = 65536;
Ritor1
parents:
diff changeset
5857 stru_F8AD28.vec_14.y = 0;
Ritor1
parents:
diff changeset
5858 stru_F8AD28.vec_14.z = 0;
Ritor1
parents:
diff changeset
5859 stru_F8AD28.vec_20.x = 0;
Ritor1
parents:
diff changeset
5860 stru_F8AD28.vec_20.z = 0;
Ritor1
parents:
diff changeset
5861 stru_F8AD28.uDefaultAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
5862 if ( pBLVRenderParams->sPartyRotX )
Ritor1
parents:
diff changeset
5863 {
Ritor1
parents:
diff changeset
5864 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5865 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5866 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
5867 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
5868 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
5869 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5870 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5871 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5872 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5873 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5874 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z
Ritor1
parents:
diff changeset
5875 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5876 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5877 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5878 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
5879 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
5880 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5881 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5882 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5883 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5884 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5885 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5886 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
5887 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
5888 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5889 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5890 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
Ritor1
parents:
diff changeset
5891 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
Ritor1
parents:
diff changeset
5892 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5893 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5894 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5895 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5896 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
5897 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
5898 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5899 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16)
Ritor1
parents:
diff changeset
5900 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16);
Ritor1
parents:
diff changeset
5901 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5902 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5903 }
Ritor1
parents:
diff changeset
5904 else
Ritor1
parents:
diff changeset
5905 {
Ritor1
parents:
diff changeset
5906 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5907 * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5908 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5909 * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5910 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z;
Ritor1
parents:
diff changeset
5911 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x
Ritor1
parents:
diff changeset
5912 * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5913 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y
Ritor1
parents:
diff changeset
5914 * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5915 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5916 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5917 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z;
Ritor1
parents:
diff changeset
5918 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5919 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5920 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
Ritor1
parents:
diff changeset
5921 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
Ritor1
parents:
diff changeset
5922 v8 = pBLVRenderParams->vPartyPos.y;
Ritor1
parents:
diff changeset
5923 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
Ritor1
parents:
diff changeset
5924 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
Ritor1
parents:
diff changeset
5925 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z;
Ritor1
parents:
diff changeset
5926 v9 = pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5927 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5928 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x;
Ritor1
parents:
diff changeset
5929 v6 = pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5930 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y
Ritor1
parents:
diff changeset
5931 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x);
Ritor1
parents:
diff changeset
5932 v7 = -65536 * pBLVRenderParams->vPartyPos.z;
Ritor1
parents:
diff changeset
5933 }
Ritor1
parents:
diff changeset
5934 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x;
Ritor1
parents:
diff changeset
5935 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8
Ritor1
parents:
diff changeset
5936 + stru_F8AD28.plane_4.dist
Ritor1
parents:
diff changeset
5937 + stru_F8AD28.plane_4.vNormal.x * v9
Ritor1
parents:
diff changeset
5938 + stru_F8AD28.plane_4.vNormal.z * v6;
Ritor1
parents:
diff changeset
5939 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5940 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16;
Ritor1
parents:
diff changeset
5941 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44)
Ritor1
parents:
diff changeset
5942 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16;
Ritor1
parents:
diff changeset
5943 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x;
Ritor1
parents:
diff changeset
5944 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y;
Ritor1
parents:
diff changeset
5945 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16;
Ritor1
parents:
diff changeset
5946 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16;
Ritor1
parents:
diff changeset
5947 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x;
Ritor1
parents:
diff changeset
5948 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
5949 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
5950 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
5951 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16;
Ritor1
parents:
diff changeset
5952 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16;
Ritor1
parents:
diff changeset
5953 result = 0;
Ritor1
parents:
diff changeset
5954 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16)
Ritor1
parents:
diff changeset
5955 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16)
Ritor1
parents:
diff changeset
5956 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16));
Ritor1
parents:
diff changeset
5957 stru_F8AD28.field_38 = 0;
Ritor1
parents:
diff changeset
5958 stru_F8AD28.field_3E4 = 0;
Ritor1
parents:
diff changeset
5959 stru_F8AD28.uCurrentAmbientLightLevel = 0;
Ritor1
parents:
diff changeset
5960 stru_F8AD28.uNumLightsApplied = 0;
Ritor1
parents:
diff changeset
5961 stru_F8AD28.field_34 = 0;
Ritor1
parents:
diff changeset
5962 return result;
Ritor1
parents:
diff changeset
5963 }
Ritor1
parents:
diff changeset
5964
Ritor1
parents:
diff changeset
5965 //----- (004B1447) --------------------------------------------------------
Ritor1
parents:
diff changeset
5966 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
Ritor1
parents:
diff changeset
5967 {
Ritor1
parents:
diff changeset
5968 signed int v3; // esi@1
Ritor1
parents:
diff changeset
5969 char v4; // sf@8
Ritor1
parents:
diff changeset
5970 int v5; // eax@8
Ritor1
parents:
diff changeset
5971 unsigned __int64 v6; // qax@12
Ritor1
parents:
diff changeset
5972 DDM_DLV_Header *v7; // eax@14
Ritor1
parents:
diff changeset
5973 Player **v8; // edi@18
Ritor1
parents:
diff changeset
5974 Player *result; // eax@19
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
5975 //char *v10; // esi@20
0
Ritor1
parents:
diff changeset
5976
Ritor1
parents:
diff changeset
5977 v3 = 0;
Ritor1
parents:
diff changeset
5978 if ( a2 )
Ritor1
parents:
diff changeset
5979 {
Ritor1
parents:
diff changeset
5980 if ( a2 != 1 )
Ritor1
parents:
diff changeset
5981 {
Ritor1
parents:
diff changeset
5982 if ( a2 == 2 )
Ritor1
parents:
diff changeset
5983 v3 = 2;
Ritor1
parents:
diff changeset
5984 goto LABEL_13;
Ritor1
parents:
diff changeset
5985 }
Ritor1
parents:
diff changeset
5986 v3 = 2;
Ritor1
parents:
diff changeset
5987 }
Ritor1
parents:
diff changeset
5988 else
Ritor1
parents:
diff changeset
5989 {
Ritor1
parents:
diff changeset
5990 v3 = 1;
Ritor1
parents:
diff changeset
5991 }
Ritor1
parents:
diff changeset
5992 if ( pParty->uFine < 4000000 )
Ritor1
parents:
diff changeset
5993 {
Ritor1
parents:
diff changeset
5994 v4 = a3 + pParty->uFine < 0;
Ritor1
parents:
diff changeset
5995 v5 = a3 + pParty->uFine;
Ritor1
parents:
diff changeset
5996 pParty->uFine += a3;
Ritor1
parents:
diff changeset
5997 if ( v4 )
Ritor1
parents:
diff changeset
5998 {
Ritor1
parents:
diff changeset
5999 v5 = 0;
Ritor1
parents:
diff changeset
6000 pParty->uFine = 0;
Ritor1
parents:
diff changeset
6001 }
Ritor1
parents:
diff changeset
6002 if ( v5 > 4000000 )
Ritor1
parents:
diff changeset
6003 pParty->uFine = 4000000;
Ritor1
parents:
diff changeset
6004 }
487
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6005
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6006 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640;
d5da524ec901 shop entering fixed
Gloval
parents: 484
diff changeset
6007
0
Ritor1
parents:
diff changeset
6008 LABEL_13:
463
f7b91ef98ab2 shopgenerators done, except config tables
Gloval
parents: 462
diff changeset
6009 pParty->InTheShopFlags[a1] = 1;
0
Ritor1
parents:
diff changeset
6010 if ( v3 )
Ritor1
parents:
diff changeset
6011 {
Ritor1
parents:
diff changeset
6012 v7 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
6013 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
6014 v7 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
6015 v7->uReputation += v3;
Ritor1
parents:
diff changeset
6016 if ( v7->uReputation > 10000 )
Ritor1
parents:
diff changeset
6017 v7->uReputation = 10000;
Ritor1
parents:
diff changeset
6018 }
Ritor1
parents:
diff changeset
6019 v8 = &pPlayers[1];
Ritor1
parents:
diff changeset
6020 do
Ritor1
parents:
diff changeset
6021 {
Ritor1
parents:
diff changeset
6022 result = *v8;
Ritor1
parents:
diff changeset
6023 if ( pParty->uFine )
Ritor1
parents:
diff changeset
6024 {
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6025 //v10 = result->_guilds_member_bits;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6026 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
0
Ritor1
parents:
diff changeset
6027 if ( !(short)result )
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6028 __debugbreak();
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 493
diff changeset
6029 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
0
Ritor1
parents:
diff changeset
6030 }
Ritor1
parents:
diff changeset
6031 ++v8;
Ritor1
parents:
diff changeset
6032 }
Ritor1
parents:
diff changeset
6033 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
6034 return result;
Ritor1
parents:
diff changeset
6035 }
Ritor1
parents:
diff changeset
6036
Ritor1
parents:
diff changeset
6037 //----- (004B1523) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
6038 void __thiscall sub_4B1523(int *_this)
0
Ritor1
parents:
diff changeset
6039 {
Ritor1
parents:
diff changeset
6040 int v1; // esi@1
Ritor1
parents:
diff changeset
6041 int v2; // edx@1
Ritor1
parents:
diff changeset
6042 unsigned int v3; // eax@2
Ritor1
parents:
diff changeset
6043 int v4; // eax@4
Ritor1
parents:
diff changeset
6044 LONG v5; // ecx@4
Ritor1
parents:
diff changeset
6045 int v6; // eax@10
Ritor1
parents:
diff changeset
6046 char *v7; // ST44_4@12
Ritor1
parents:
diff changeset
6047 unsigned __int16 v8; // ax@12
Ritor1
parents:
diff changeset
6048 GUIWindow a1; // [sp+Ch] [bp-68h]@4
Ritor1
parents:
diff changeset
6049 unsigned int v11; // [sp+60h] [bp-14h]@1
Ritor1
parents:
diff changeset
6050 POINT a2; // [sp+64h] [bp-10h]@1
Ritor1
parents:
diff changeset
6051 int v13; // [sp+6Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
6052 int v14; // [sp+70h] [bp-4h]@4
Ritor1
parents:
diff changeset
6053
Ritor1
parents:
diff changeset
6054 v1 = *_this - 399;
Ritor1
parents:
diff changeset
6055 v2 = (*_this - 400) % 11 + 1;
Ritor1
parents:
diff changeset
6056 v11 = 4 * (*_this - 400) / 11;
Ritor1
parents:
diff changeset
6057 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
Ritor1
parents:
diff changeset
6058 if ( pMouse->GetCursorPos(&a2)->y <= 320 )
Ritor1
parents:
diff changeset
6059 v3 = pMouse->GetCursorPos(&a2)->y + 30;
Ritor1
parents:
diff changeset
6060 else
Ritor1
parents:
diff changeset
6061 v3 = 30;
Ritor1
parents:
diff changeset
6062 a1.Hint = 0;
Ritor1
parents:
diff changeset
6063 a1.uFrameY = v3;
Ritor1
parents:
diff changeset
6064 a1.uFrameWidth = 328;
Ritor1
parents:
diff changeset
6065 a1.uFrameHeight = 68;
Ritor1
parents:
diff changeset
6066 a1.uFrameX = 90;
Ritor1
parents:
diff changeset
6067 a1.uFrameZ = 417;
Ritor1
parents:
diff changeset
6068 a1.uFrameW = v3 + 67;
Ritor1
parents:
diff changeset
6069 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
Ritor1
parents:
diff changeset
6070 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
Ritor1
parents:
diff changeset
6071 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
Ritor1
parents:
diff changeset
6072 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
Ritor1
parents:
diff changeset
6073 v5 = a2.y;
Ritor1
parents:
diff changeset
6074 if ( v14 > a2.y )
Ritor1
parents:
diff changeset
6075 v5 = v14;
Ritor1
parents:
diff changeset
6076 if ( v13 > v5 )
Ritor1
parents:
diff changeset
6077 v5 = v13;
Ritor1
parents:
diff changeset
6078 if ( v4 > v5 )
Ritor1
parents:
diff changeset
6079 v5 = v4;
262
Ritor1
parents: 250
diff changeset
6080 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
6081 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal"
Ritor1
parents: 250
diff changeset
6082 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert"
Ritor1
parents: 250
diff changeset
6083 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master"
Ritor1
parents: 250
diff changeset
6084 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand"
Ritor1
parents: 250
diff changeset
6085 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
0
Ritor1
parents:
diff changeset
6086 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
Ritor1
parents:
diff changeset
6087 a1.uFrameHeight += v6;
Ritor1
parents:
diff changeset
6088 if ( (signed int)a1.uFrameHeight < 150 )
Ritor1
parents:
diff changeset
6089 a1.uFrameHeight = 150;
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
6090 a1.uFrameWidth = game_viewport_width;
0
Ritor1
parents:
diff changeset
6091 a1.DrawMessageBox(0);
Ritor1
parents:
diff changeset
6092 a1.uFrameWidth -= 12;
Ritor1
parents:
diff changeset
6093 a1.uFrameHeight -= 12;
Ritor1
parents:
diff changeset
6094 v7 = pSpellStats->pInfos[v1].pName;
Ritor1
parents:
diff changeset
6095 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
Ritor1
parents:
diff changeset
6096 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
949
Nomad
parents: 948
diff changeset
6097 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
0
Ritor1
parents:
diff changeset
6098 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
Ritor1
parents:
diff changeset
6099 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
Ritor1
parents:
diff changeset
6100 a1.uFrameZ = a1.uFrameX + 107;
Ritor1
parents:
diff changeset
6101 a1.uFrameWidth = 108;
Ritor1
parents:
diff changeset
6102 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
Ritor1
parents:
diff changeset
6103 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
6104 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3);
0
Ritor1
parents:
diff changeset
6105 }
Ritor1
parents:
diff changeset
6106
Ritor1
parents:
diff changeset
6107 //----- (004B1784) --------------------------------------------------------
Ritor1
parents:
diff changeset
6108 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
Ritor1
parents:
diff changeset
6109 {
Ritor1
parents:
diff changeset
6110 Player *pPlayer; // ebx@1
Ritor1
parents:
diff changeset
6111 bool result; // eax@2
Ritor1
parents:
diff changeset
6112 unsigned __int16 v2; // ST0C_2@3
Ritor1
parents:
diff changeset
6113 int v3; // eax@3
Ritor1
parents:
diff changeset
6114 GUIWindow v4; // [sp+4h] [bp-54h]@3
Ritor1
parents:
diff changeset
6115
Ritor1
parents:
diff changeset
6116 pPlayer = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
6117 if ( pPlayer->CanAct() )
Ritor1
parents:
diff changeset
6118 {
Ritor1
parents:
diff changeset
6119 pDialogueWindow->pNumPresenceButton = dword_F8B1E0;
Ritor1
parents:
diff changeset
6120 result = 1;
Ritor1
parents:
diff changeset
6121 }
Ritor1
parents:
diff changeset
6122 else
Ritor1
parents:
diff changeset
6123 {
Ritor1
parents:
diff changeset
6124 pDialogueWindow->pNumPresenceButton = 0;
Ritor1
parents:
diff changeset
6125 memcpy(&v4, pPrimaryWindow, sizeof(v4));
Ritor1
parents:
diff changeset
6126 v4.uFrameX = 483;
Ritor1
parents:
diff changeset
6127 v4.uFrameWidth = 148;
Ritor1
parents:
diff changeset
6128 v4.uFrameZ = 334;
Ritor1
parents:
diff changeset
6129 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);//
Ritor1
parents:
diff changeset
6130 // "%s is in no condition to %s"
Ritor1
parents:
diff changeset
6131 // "do anything"
949
Nomad
parents: 948
diff changeset
6132 v2 = TargetColor(255, 255, 0x9Bu);
0
Ritor1
parents:
diff changeset
6133 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0);
Ritor1
parents:
diff changeset
6134 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
6135 result = 0;
Ritor1
parents:
diff changeset
6136 }
Ritor1
parents:
diff changeset
6137 return result;
Ritor1
parents:
diff changeset
6138 }
Ritor1
parents:
diff changeset
6139 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
6140
Ritor1
parents:
diff changeset
6141 //----- (004B1A2D) --------------------------------------------------------
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6142 void __cdecl ShowPopupShopItem()
0
Ritor1
parents:
diff changeset
6143 {
Ritor1
parents:
diff changeset
6144 POINT *v1; // esi@5
Ritor1
parents:
diff changeset
6145 unsigned int v2; // eax@5
Ritor1
parents:
diff changeset
6146 int v3; // ecx@5
Ritor1
parents:
diff changeset
6147 POINT *v4; // esi@12
Ritor1
parents:
diff changeset
6148 int v5; // eax@12
Ritor1
parents:
diff changeset
6149 unsigned int v6; // eax@13
Ritor1
parents:
diff changeset
6150 ItemGen *v7; // ecx@13
Ritor1
parents:
diff changeset
6151 signed int v8; // esi@17
Ritor1
parents:
diff changeset
6152 unsigned int v9; // eax@19
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6153 POINT v10; // [sp+8h] [bp-44h]@12
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6154 POINT v11; // [sp+10h] [bp-3Ch]@12
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6155 POINT v12; // [sp+18h] [bp-34h]@18
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6156 POINT v13; // [sp+20h] [bp-2Ch]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6157 POINT v14; // [sp+28h] [bp-24h]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6158 POINT v15; // [sp+30h] [bp-1Ch]@17
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6159 POINT v16; // [sp+38h] [bp-14h]@5
0
Ritor1
parents:
diff changeset
6160 POINT a2; // [sp+40h] [bp-Ch]@5
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6161
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6162 if ( in_current_building_type <= 0 )
0
Ritor1
parents:
diff changeset
6163 return;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6164 if ( in_current_building_type <= BildingType_AlchemistShop )
0
Ritor1
parents:
diff changeset
6165 {
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6166 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6167 {
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6168 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
0
Ritor1
parents:
diff changeset
6169 return;
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6170 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
0
Ritor1
parents:
diff changeset
6171 {
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6172 v8 = pMouse->GetCursorPos(&v15)->x - 14;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6173 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5);
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6174 if ( pMouse->GetCursorPos(&v13)->x <= 13
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6175 || pMouse->GetCursorPos(&v12)->x >= 462
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6176 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 )
0
Ritor1
parents:
diff changeset
6177 return;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6178 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]);
0
Ritor1
parents:
diff changeset
6179 return;
Ritor1
parents:
diff changeset
6180 }
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6181 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
0
Ritor1
parents:
diff changeset
6182 return;
Ritor1
parents:
diff changeset
6183 }
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6184 v4 = pMouse->GetCursorPos(&v11);
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6185 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF;
0
Ritor1
parents:
diff changeset
6186 if ( !v5 )
Ritor1
parents:
diff changeset
6187 return;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6188 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
0
Ritor1
parents:
diff changeset
6189 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
6190 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6191 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1];
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6192 GameUI_DrawItemInfo(v7);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6193 return;
0
Ritor1
parents:
diff changeset
6194 }
874
231523a39203 Buy books(first)
Ritor1
parents: 862
diff changeset
6195 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
0
Ritor1
parents:
diff changeset
6196 {
Ritor1
parents:
diff changeset
6197 v1 = pMouse->GetCursorPos(&a2);
475
77430756f06a fix show info item in shop
Gloval
parents: 473
diff changeset
6198 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];
0
Ritor1
parents:
diff changeset
6199 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6200 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6201 if ( v5 )
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6202 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
0
Ritor1
parents:
diff changeset
6203 }
Ritor1
parents:
diff changeset
6204 }
Ritor1
parents:
diff changeset
6205 // F8B198: using guessed type int dword_F8B198;
Ritor1
parents:
diff changeset
6206 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
6207
Ritor1
parents:
diff changeset
6208 //----- (004B1BDB) --------------------------------------------------------
Ritor1
parents:
diff changeset
6209 void __stdcall RestAndHeal(__int64 uNumMinutes)
Ritor1
parents:
diff changeset
6210 {
Ritor1
parents:
diff changeset
6211 signed __int64 v1; // ST2C_8@1
Ritor1
parents:
diff changeset
6212 signed __int64 v2; // qax@1
Ritor1
parents:
diff changeset
6213 signed __int64 v3; // ST1C_8@1
Ritor1
parents:
diff changeset
6214 unsigned __int64 v4; // qax@1
Ritor1
parents:
diff changeset
6215 unsigned int v5; // ebx@1
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6216 Player *v6; // ebx@1
0
Ritor1
parents:
diff changeset
6217
Ritor1
parents:
diff changeset
6218 pParty->pHirelings[0].bHasUsedTheAbility = 0;
Ritor1
parents:
diff changeset
6219 pParty->pHirelings[1].bHasUsedTheAbility = 0;
Ritor1
parents:
diff changeset
6220 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335);
Ritor1
parents:
diff changeset
6221 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
Ritor1
parents:
diff changeset
6222 v2 = v1 / 60 / 60;
Ritor1
parents:
diff changeset
6223 v3 = v2;
Ritor1
parents:
diff changeset
6224 v4 = (unsigned int)v2 / 0x18;
Ritor1
parents:
diff changeset
6225 v5 = (unsigned int)(v4 / 7) >> 2;
Ritor1
parents:
diff changeset
6226 pParty->uCurrentTimeSecond = v1 % 60;
Ritor1
parents:
diff changeset
6227 pParty->uCurrentMinute = v1 / 60 % 60;
Ritor1
parents:
diff changeset
6228 pParty->uCurrentHour = v3 % 24;
Ritor1
parents:
diff changeset
6229 pParty->uCurrentMonthWeek = v4 / 7 & 3;
Ritor1
parents:
diff changeset
6230 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C;
Ritor1
parents:
diff changeset
6231 pParty->uCurrentMonth = v5 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
6232 pParty->uCurrentYear = v5 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
6233 pParty->RestAndHeal();
Ritor1
parents:
diff changeset
6234 dword_507B94 = 1;
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6235 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
0
Ritor1
parents:
diff changeset
6236 do
Ritor1
parents:
diff changeset
6237 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6238 v6->uTimeToRecovery = 0;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6239 memset(&v6->uTimeToRecovery, 0, 4u);
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6240 ++v6;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6241 }
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
6242 while ( v6 <= &pParty->pPlayers[3] );
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
6243 pParty->UpdatePlayersAndHirelingsEmotions();
0
Ritor1
parents:
diff changeset
6244 }
Ritor1
parents:
diff changeset
6245 // 507B94: using guessed type int dword_507B94;
Ritor1
parents:
diff changeset
6246
Ritor1
parents:
diff changeset
6247 //----- (004B1D27) --------------------------------------------------------
Ritor1
parents:
diff changeset
6248 void __cdecl sub_4B1D27()
Ritor1
parents:
diff changeset
6249 {
Ritor1
parents:
diff changeset
6250 int v0; // edx@2
Ritor1
parents:
diff changeset
6251 unsigned int v1; // ecx@7
Ritor1
parents:
diff changeset
6252 signed int v2; // edi@10
Ritor1
parents:
diff changeset
6253 int v3; // esi@10
Ritor1
parents:
diff changeset
6254 __int16 v4; // ax@15
Ritor1
parents:
diff changeset
6255 signed int v5; // edi@20
Ritor1
parents:
diff changeset
6256 int v6; // esi@20
Ritor1
parents:
diff changeset
6257 int v7[4]; // [sp+Ch] [bp-10h]@12
Ritor1
parents:
diff changeset
6258
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6259 if ( in_current_building_type > 0 )
0
Ritor1
parents:
diff changeset
6260 {
Ritor1
parents:
diff changeset
6261 v0 = 3;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6262 if ( in_current_building_type > BildingType_MagicShop )
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6263 {
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6264 if ( in_current_building_type == BildingType_Bank )
0
Ritor1
parents:
diff changeset
6265 {
Ritor1
parents:
diff changeset
6266 if ( !dword_F8B1E4 )
Ritor1
parents:
diff changeset
6267 return;
Ritor1
parents:
diff changeset
6268 }
Ritor1
parents:
diff changeset
6269 else
Ritor1
parents:
diff changeset
6270 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6271 if ( in_current_building_type != BildingType_Temple )
0
Ritor1
parents:
diff changeset
6272 return;
Ritor1
parents:
diff changeset
6273 }
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6274 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6275 PlayHouseSound(v1, (HouseSoundID)v0);
0
Ritor1
parents:
diff changeset
6276 return;
Ritor1
parents:
diff changeset
6277 }
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
6278 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6279 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed )
0
Ritor1
parents:
diff changeset
6280 {
Ritor1
parents:
diff changeset
6281 if ( pParty->uNumGold <= 0x2710 )
Ritor1
parents:
diff changeset
6282 {
Ritor1
parents:
diff changeset
6283 if ( !dword_F8B1E4 )
Ritor1
parents:
diff changeset
6284 return;
Ritor1
parents:
diff changeset
6285 v0 = 4;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6286 PlayHouseSound(v1, (HouseSoundID)v0);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6287 return;
0
Ritor1
parents:
diff changeset
6288 }
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
6289 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3));
0
Ritor1
parents:
diff changeset
6290 if ( !dword_F8B1E4 && !qword_A750D8 )
Ritor1
parents:
diff changeset
6291 {
Ritor1
parents:
diff changeset
6292 v5 = 0;
Ritor1
parents:
diff changeset
6293 v6 = 1;
Ritor1
parents:
diff changeset
6294 do
Ritor1
parents:
diff changeset
6295 {
Ritor1
parents:
diff changeset
6296 if ( pPlayers[v6]->CanAct() )
Ritor1
parents:
diff changeset
6297 v7[v5++] = v6;
Ritor1
parents:
diff changeset
6298 ++v6;
Ritor1
parents:
diff changeset
6299 }
Ritor1
parents:
diff changeset
6300 while ( v6 <= 4 );
Ritor1
parents:
diff changeset
6301 if ( v5 )
Ritor1
parents:
diff changeset
6302 {
Ritor1
parents:
diff changeset
6303 qword_A750D8 = 256i64;
Ritor1
parents:
diff changeset
6304 word_A750E0 = 80;
Ritor1
parents:
diff changeset
6305 v4 = LOWORD(v7[rand() % v5]);
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6306 word_A750E2 = v4;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
6307 return;
0
Ritor1
parents:
diff changeset
6308 }
Ritor1
parents:
diff changeset
6309 }
Ritor1
parents:
diff changeset
6310 }
Ritor1
parents:
diff changeset
6311 else
Ritor1
parents:
diff changeset
6312 {
Ritor1
parents:
diff changeset
6313 if ( !qword_A750D8 )
Ritor1
parents:
diff changeset
6314 {
Ritor1
parents:
diff changeset
6315 v2 = 0;
Ritor1
parents:
diff changeset
6316 v3 = 1;
Ritor1
parents:
diff changeset
6317 do
Ritor1
parents:
diff changeset
6318 {
Ritor1
parents:
diff changeset
6319 if ( pPlayers[v3]->CanAct() )
Ritor1
parents:
diff changeset
6320 v7[v2++] = v3;
Ritor1
parents:
diff changeset
6321 ++v3;
Ritor1
parents:
diff changeset
6322 }
Ritor1
parents:
diff changeset
6323 while ( v3 <= 4 );
Ritor1
parents:
diff changeset
6324 if ( v2 )
Ritor1
parents:
diff changeset
6325 {
Ritor1
parents:
diff changeset
6326 qword_A750D8 = 256i64;
Ritor1
parents:
diff changeset
6327 word_A750E0 = 80;
Ritor1
parents:
diff changeset
6328 v4 = LOWORD(v7[rand() % v2]);
Ritor1
parents:
diff changeset
6329 word_A750E2 = v4;
Ritor1
parents:
diff changeset
6330 return;
Ritor1
parents:
diff changeset
6331 }
Ritor1
parents:
diff changeset
6332 }
Ritor1
parents:
diff changeset
6333 }
Ritor1
parents:
diff changeset
6334 }
Ritor1
parents:
diff changeset
6335 }
Ritor1
parents:
diff changeset
6336
Ritor1
parents:
diff changeset
6337 //----- (004B1ECE) --------------------------------------------------------
Ritor1
parents:
diff changeset
6338 void __cdecl sub_4B1ECE()
Ritor1
parents:
diff changeset
6339 {
Ritor1
parents:
diff changeset
6340 __int16 *v0; // edi@1
Ritor1
parents:
diff changeset
6341 int v1; // ebx@3
Ritor1
parents:
diff changeset
6342 Player *v2; // esi@3
Ritor1
parents:
diff changeset
6343 int v3; // eax@4
Ritor1
parents:
diff changeset
6344 signed int v4; // eax@9
Ritor1
parents:
diff changeset
6345 int v5; // ebx@11
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6346 Player *v6; // esi@13
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6347 ItemGen *v7; // eax@14
0
Ritor1
parents:
diff changeset
6348 signed int v8; // edi@14
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6349 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
0
Ritor1
parents:
diff changeset
6350 signed int v10; // [sp+10h] [bp-8h]@13
Ritor1
parents:
diff changeset
6351 int v11; // [sp+14h] [bp-4h]@1
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6352 Player *v12; // [sp+14h] [bp-4h]@11
0
Ritor1
parents:
diff changeset
6353
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6354 contract_approved = 0;
0
Ritor1
parents:
diff changeset
6355 v11 = 0;
Ritor1
parents:
diff changeset
6356 uDialogueType = 84;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6357 current_npc_text = (char *)pNPCTopics[667].pText;
0
Ritor1
parents:
diff changeset
6358 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
Ritor1
parents:
diff changeset
6359 while ( 1 )
Ritor1
parents:
diff changeset
6360 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6361 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
0
Ritor1
parents:
diff changeset
6362 {
Ritor1
parents:
diff changeset
6363 v1 = 0;
Ritor1
parents:
diff changeset
6364 v2 = pParty->pPlayers;
Ritor1
parents:
diff changeset
6365 do
Ritor1
parents:
diff changeset
6366 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6367 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1));
0
Ritor1
parents:
diff changeset
6368 if ( v3 )
Ritor1
parents:
diff changeset
6369 break;
Ritor1
parents:
diff changeset
6370 ++v2;
Ritor1
parents:
diff changeset
6371 ++v1;
Ritor1
parents:
diff changeset
6372 }
Ritor1
parents:
diff changeset
6373 while ( (signed int)v2 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
6374 if ( v1 == 4 )
Ritor1
parents:
diff changeset
6375 break;
Ritor1
parents:
diff changeset
6376 }
Ritor1
parents:
diff changeset
6377 ++v11;
Ritor1
parents:
diff changeset
6378 v0 += 2;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6379 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6380 break;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6381 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6382 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6383 {
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6384 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6385 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6386 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6387 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6388 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6389 if ( contract_approved == 601 )
0
Ritor1
parents:
diff changeset
6390 {
Ritor1
parents:
diff changeset
6391 v5 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6392 v12 = pParty->pPlayers;//[0].uClass;
0
Ritor1
parents:
diff changeset
6393 v9 = 0;
Ritor1
parents:
diff changeset
6394 while ( 1 )
Ritor1
parents:
diff changeset
6395 {
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
6396 if ( v12->classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
6397 {
Ritor1
parents:
diff changeset
6398 v10 = 0;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6399 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A;
0
Ritor1
parents:
diff changeset
6400 do
Ritor1
parents:
diff changeset
6401 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6402 v7 = v6->pInventoryItems;
0
Ritor1
parents:
diff changeset
6403 v8 = 138;
Ritor1
parents:
diff changeset
6404 do
Ritor1
parents:
diff changeset
6405 {
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6406 if ( v7->uItemID == 601 )
0
Ritor1
parents:
diff changeset
6407 {
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6408 if ( !v7->uHolderPlayer )
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6409 v9 = v7;
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6410 if ( v7->uHolderPlayer == v5 )
0
Ritor1
parents:
diff changeset
6411 v10 = 1;
Ritor1
parents:
diff changeset
6412 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6413 ++v7;
0
Ritor1
parents:
diff changeset
6414 --v8;
Ritor1
parents:
diff changeset
6415 }
Ritor1
parents:
diff changeset
6416 while ( v8 );
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6417 ++v6;
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6418 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6419 while ( v6 <= &pParty->pPlayers[3] );
0
Ritor1
parents:
diff changeset
6420 if ( !v10 )
Ritor1
parents:
diff changeset
6421 break;
Ritor1
parents:
diff changeset
6422 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6423 ++v12;
0
Ritor1
parents:
diff changeset
6424 ++v5;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
6425 if ( v12 > &pParty->pPlayers[3] )
0
Ritor1
parents:
diff changeset
6426 return;
Ritor1
parents:
diff changeset
6427 }
Ritor1
parents:
diff changeset
6428 if ( v9 )
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
6429 v9->uHolderPlayer = v5;
0
Ritor1
parents:
diff changeset
6430 }
Ritor1
parents:
diff changeset
6431 }
Ritor1
parents:
diff changeset
6432 // 4F08EC: using guessed type int dword_4F08EC[];
Ritor1
parents:
diff changeset
6433 // 722B3C: using guessed type int dword_722B3C;
Ritor1
parents:
diff changeset
6434 // 722B44: using guessed type int dword_722B44;
Ritor1
parents:
diff changeset
6435 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
6436
Ritor1
parents:
diff changeset
6437 //----- (004B2001) --------------------------------------------------------
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6438 void __fastcall ClickNPCTopic(signed int uMessageParam)
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6439 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6440 //signed int v1; // eax@1
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6441 NPCData *pCurrentNPCInfo; // ebp@1
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6442 int pEventNumber; // ecx@8
0
Ritor1
parents:
diff changeset
6443 Player *v4; // esi@20
467
Ritor1
parents: 460
diff changeset
6444 //int v5; // eax@28
Ritor1
parents: 460
diff changeset
6445 //int v6; // eax@31
Ritor1
parents: 460
diff changeset
6446 //int v7; // eax@34
Ritor1
parents: 460
diff changeset
6447 //int v8; // eax@37
Ritor1
parents: 460
diff changeset
6448 //int v9; // eax@40
Ritor1
parents: 460
diff changeset
6449 //unsigned int v10; // eax@43
0
Ritor1
parents:
diff changeset
6450 char *v12; // eax@53
Ritor1
parents:
diff changeset
6451 char *v13; // eax@56
Ritor1
parents:
diff changeset
6452 char *v14; // eax@57
Ritor1
parents:
diff changeset
6453 char *v15; // eax@58
467
Ritor1
parents: 460
diff changeset
6454 //unsigned int v16; // ebp@62
0
Ritor1
parents:
diff changeset
6455 char *v17; // ecx@63
Ritor1
parents:
diff changeset
6456 char *v18; // eax@65
Ritor1
parents:
diff changeset
6457 const char *v19; // ecx@68
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6458 //unsigned int v20; // eax@69
467
Ritor1
parents: 460
diff changeset
6459 signed int pPrice; // ecx@70
0
Ritor1
parents:
diff changeset
6460 char *v22; // [sp-Ch] [bp-18h]@73
467
Ritor1
parents: 460
diff changeset
6461 //int v23; // [sp-8h] [bp-14h]@49
0
Ritor1
parents:
diff changeset
6462 char *v24; // [sp-8h] [bp-14h]@73
467
Ritor1
parents: 460
diff changeset
6463 //int v25; // [sp-4h] [bp-10h]@49
Ritor1
parents: 460
diff changeset
6464
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6465 uDialogueType = uMessageParam + 1;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6466 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
467
Ritor1
parents: 460
diff changeset
6467 if ( uMessageParam <= 24 )
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6468 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6469 switch ( uMessageParam )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6470 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6471 case 13:
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6472 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6473 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
6474 NPCHireableDialogPrepare();
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6475 dialogue_show_profession_details = false;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6476 goto _return;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6477 case 19:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6478 pEventNumber = pCurrentNPCInfo->evt_A;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6479 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6480 case 20:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6481 pEventNumber = pCurrentNPCInfo->evt_B;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6482 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6483 case 21:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6484 pEventNumber = pCurrentNPCInfo->evt_C;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6485 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6486 case 22:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6487 pEventNumber = pCurrentNPCInfo->evt_D;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6488 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6489 case 23:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6490 pEventNumber = pCurrentNPCInfo->evt_E;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6491 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6492 case 24:
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6493 pEventNumber = pCurrentNPCInfo->evt_F;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6494 break;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6495 default:
467
Ritor1
parents: 460
diff changeset
6496 goto _return;
Ritor1
parents: 460
diff changeset
6497 }
Ritor1
parents: 460
diff changeset
6498 /*switch ( pEventNumber )
Ritor1
parents: 460
diff changeset
6499 {
Ritor1
parents: 460
diff changeset
6500 case 139:
Ritor1
parents: 460
diff changeset
6501 sub_4B1ECE();
Ritor1
parents: 460
diff changeset
6502 goto _return;
Ritor1
parents: 460
diff changeset
6503 case 311:
Ritor1
parents: 460
diff changeset
6504 sub_4BBA85_bounties();
Ritor1
parents: 460
diff changeset
6505 goto _return;
Ritor1
parents: 460
diff changeset
6506 }*/
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6507 if ( pEventNumber < 200 || pEventNumber > 310 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6508 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6509 if ( pEventNumber < 400 || pEventNumber > 410 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6510 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6511 if ( pEventNumber == 139 )
0
Ritor1
parents:
diff changeset
6512 {
Ritor1
parents:
diff changeset
6513 sub_4B1ECE();
Ritor1
parents:
diff changeset
6514 }
Ritor1
parents:
diff changeset
6515 else
Ritor1
parents:
diff changeset
6516 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6517 if ( pEventNumber == 311 )
0
Ritor1
parents:
diff changeset
6518 {
Ritor1
parents:
diff changeset
6519 sub_4BBA85_bounties();
Ritor1
parents:
diff changeset
6520 }
Ritor1
parents:
diff changeset
6521 else
Ritor1
parents:
diff changeset
6522 {
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6523 current_npc_text = 0;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
6524 activeLevelDecoration = (LevelDecoration*)1;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6525 EventProcessor(pEventNumber, 0, 1);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
6526 activeLevelDecoration = NULL;
0
Ritor1
parents:
diff changeset
6527 }
Ritor1
parents:
diff changeset
6528 }
Ritor1
parents:
diff changeset
6529 }
Ritor1
parents:
diff changeset
6530 else
Ritor1
parents:
diff changeset
6531 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6532 dword_F8B1D8 = uMessageParam;
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6533 DrawJoinGuildWindow(pEventNumber - 400);
0
Ritor1
parents:
diff changeset
6534 }
Ritor1
parents:
diff changeset
6535 }
Ritor1
parents:
diff changeset
6536 else
Ritor1
parents:
diff changeset
6537 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6538 sub_4B3FE5(pEventNumber);
0
Ritor1
parents:
diff changeset
6539 }
Ritor1
parents:
diff changeset
6540 goto _return;
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6541 }
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6542 if ( uMessageParam != 76 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6543 {
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6544 if ( uMessageParam == 77 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6545 {
467
Ritor1
parents: 460
diff changeset
6546 //v16 = pCurrentNPCInfo->uProfession;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6547 if (dialogue_show_profession_details)
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6548 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
0
Ritor1
parents:
diff changeset
6549 else
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6550 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6551 current_npc_text = v17;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
6552 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6553 dialogue_show_profession_details = ~dialogue_show_profession_details;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6554 current_npc_text = v18;
0
Ritor1
parents:
diff changeset
6555 }
Ritor1
parents:
diff changeset
6556 else
Ritor1
parents:
diff changeset
6557 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6558 if ( uMessageParam == 79 )
0
Ritor1
parents:
diff changeset
6559 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6560 if ( contract_approved )
0
Ritor1
parents:
diff changeset
6561 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6562 Party::TakeGold(gold_transaction_amount);
0
Ritor1
parents:
diff changeset
6563 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
6564 {
492
Gloval
parents: 487
diff changeset
6565 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6566 *(short *)v12 &= 0x3Fu;
Ritor1
parents:
diff changeset
6567 switch ( dword_F8B1B0 )
Ritor1
parents:
diff changeset
6568 {
Ritor1
parents:
diff changeset
6569 case 2:
492
Gloval
parents: 487
diff changeset
6570 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6571 *v15 |= 0x40u;
Ritor1
parents:
diff changeset
6572 break;
Ritor1
parents:
diff changeset
6573 case 3:
492
Gloval
parents: 487
diff changeset
6574 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6575 *v14 |= 0x80u;
Ritor1
parents:
diff changeset
6576 break;
Ritor1
parents:
diff changeset
6577 case 4:
492
Gloval
parents: 487
diff changeset
6578 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
0
Ritor1
parents:
diff changeset
6579 v13[1] |= 1u;
Ritor1
parents:
diff changeset
6580 break;
Ritor1
parents:
diff changeset
6581 }
187
49728858c35e On player voices
Nomad
parents: 180
diff changeset
6582 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
0
Ritor1
parents:
diff changeset
6583 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6584 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6585 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6586 {
990
087a9af8e0ec MessageParam
Ritor1
parents: 981
diff changeset
6587 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
6588 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6589 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6590 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6591 }*/
0
Ritor1
parents:
diff changeset
6592 }
Ritor1
parents:
diff changeset
6593 }
Ritor1
parents:
diff changeset
6594 else
Ritor1
parents:
diff changeset
6595 {
492
Gloval
parents: 487
diff changeset
6596 if ( uMessageParam == 82 && contract_approved ) //join guild
0
Ritor1
parents:
diff changeset
6597 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6598 Party::TakeGold(gold_transaction_amount);
0
Ritor1
parents:
diff changeset
6599 v4 = pParty->pPlayers;
Ritor1
parents:
diff changeset
6600 do
Ritor1
parents:
diff changeset
6601 {
492
Gloval
parents: 487
diff changeset
6602 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
0
Ritor1
parents:
diff changeset
6603 ++v4;
Ritor1
parents:
diff changeset
6604 }
Ritor1
parents:
diff changeset
6605 while ( (signed int)v4 < (signed int)pParty->pHirelings );
Ritor1
parents:
diff changeset
6606 switch ( dword_F8B1D8 )
Ritor1
parents:
diff changeset
6607 {
Ritor1
parents:
diff changeset
6608 case 19:
467
Ritor1
parents: 460
diff changeset
6609 pEventNumber = pCurrentNPCInfo->evt_A;
Ritor1
parents: 460
diff changeset
6610 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6611 pCurrentNPCInfo->evt_A = 0;
0
Ritor1
parents:
diff changeset
6612 break;
Ritor1
parents:
diff changeset
6613 case 20:
467
Ritor1
parents: 460
diff changeset
6614 pEventNumber = pCurrentNPCInfo->evt_B;
Ritor1
parents: 460
diff changeset
6615 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6616 pCurrentNPCInfo->evt_B = 0;
0
Ritor1
parents:
diff changeset
6617 break;
Ritor1
parents:
diff changeset
6618 case 21:
467
Ritor1
parents: 460
diff changeset
6619 pEventNumber = pCurrentNPCInfo->evt_C;
Ritor1
parents: 460
diff changeset
6620 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6621 pCurrentNPCInfo->evt_C = 0;
0
Ritor1
parents:
diff changeset
6622 break;
Ritor1
parents:
diff changeset
6623 case 22:
467
Ritor1
parents: 460
diff changeset
6624 pEventNumber = pCurrentNPCInfo->evt_D;
Ritor1
parents: 460
diff changeset
6625 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6626 pCurrentNPCInfo->evt_D = 0;
0
Ritor1
parents:
diff changeset
6627 break;
Ritor1
parents:
diff changeset
6628 case 23:
467
Ritor1
parents: 460
diff changeset
6629 pEventNumber = pCurrentNPCInfo->evt_E;
Ritor1
parents: 460
diff changeset
6630 if ( pEventNumber >= 400 && pEventNumber <= 416 )
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6631 pCurrentNPCInfo->evt_E = 0;
0
Ritor1
parents:
diff changeset
6632 break;
Ritor1
parents:
diff changeset
6633 case 24:
467
Ritor1
parents: 460
diff changeset
6634 pEventNumber = pCurrentNPCInfo->evt_F;
Ritor1
parents: 460
diff changeset
6635 if ( pEventNumber >= 400 && pEventNumber <= 416)
Ritor1
parents: 460
diff changeset
6636 pCurrentNPCInfo->evt_F = 0;
0
Ritor1
parents:
diff changeset
6637 break;
Ritor1
parents:
diff changeset
6638 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6639 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6640 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6641 {
990
087a9af8e0ec MessageParam
Ritor1
parents: 981
diff changeset
6642 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
6643 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6644 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6645 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6646 }*/
467
Ritor1
parents: 460
diff changeset
6647 //v11 = uActiveCharacter;
0
Ritor1
parents:
diff changeset
6648 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
6649 {
467
Ritor1
parents: 460
diff changeset
6650 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
0
Ritor1
parents:
diff changeset
6651 goto _return;
Ritor1
parents:
diff changeset
6652 }
Ritor1
parents:
diff changeset
6653 }
Ritor1
parents:
diff changeset
6654 }
Ritor1
parents:
diff changeset
6655 }
Ritor1
parents:
diff changeset
6656 goto _return;
Ritor1
parents:
diff changeset
6657 }
Ritor1
parents:
diff changeset
6658 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
Ritor1
parents:
diff changeset
6659 {
467
Ritor1
parents: 460
diff changeset
6660 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
0
Ritor1
parents:
diff changeset
6661 goto _return;
Ritor1
parents:
diff changeset
6662 }
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6663 if ( pCurrentNPCInfo->uProfession != 51 )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6664 {
467
Ritor1
parents: 460
diff changeset
6665 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice;
Ritor1
parents: 460
diff changeset
6666 if ( pParty->uNumGold < pPrice )
Ritor1
parents: 460
diff changeset
6667 {
Ritor1
parents: 460
diff changeset
6668 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6669 dialogue_show_profession_details = false;
0
Ritor1
parents:
diff changeset
6670 uDialogueType = 13;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6671 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText;
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
6672 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
6673 if ( uActiveCharacter )
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
6674 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
467
Ritor1
parents: 460
diff changeset
6675 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
Ritor1
parents: 460
diff changeset
6676 goto _return;
Ritor1
parents: 460
diff changeset
6677 }
Ritor1
parents: 460
diff changeset
6678 Party::TakeGold(pPrice);
0
Ritor1
parents:
diff changeset
6679 }
147
c70fea5013aa 12.02.13
Ritor1
parents: 112
diff changeset
6680 //LOBYTE(v2->uFlags) |= 0x80u;
655
6a2d29c21d09 Margaret disappear fixed
zipi
parents: 652
diff changeset
6681 pCurrentNPCInfo->uFlags |= 128;
0
Ritor1
parents:
diff changeset
6682 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
6683 pParty->CountHirelings();
0
Ritor1
parents:
diff changeset
6684 if ( pParty->pHirelings[0].pName )
Ritor1
parents:
diff changeset
6685 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6686 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6687 v24 = pCurrentNPCInfo->pName;
0
Ritor1
parents:
diff changeset
6688 v22 = pParty->pHireling2Name;
Ritor1
parents:
diff changeset
6689 }
Ritor1
parents:
diff changeset
6690 else
Ritor1
parents:
diff changeset
6691 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6692 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu);
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
6693 v24 = pCurrentNPCInfo->pName;
0
Ritor1
parents:
diff changeset
6694 v22 = pParty->pHireling1Name;
Ritor1
parents:
diff changeset
6695 }
Ritor1
parents:
diff changeset
6696 strcpy(v22, v24);
Ritor1
parents:
diff changeset
6697 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
6698 pParty->CountHirelings();
480
d4ea191229ff BildingType
Ritor1
parents: 475
diff changeset
6699 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
6700 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6701
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6702 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6703 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
0
Ritor1
parents:
diff changeset
6704 {
990
087a9af8e0ec MessageParam
Ritor1
parents: 981
diff changeset
6705 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
6706 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
6707 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
6708 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
6709 }*/
0
Ritor1
parents:
diff changeset
6710 if ( uActiveCharacter )
467
Ritor1
parents: 460
diff changeset
6711 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
0
Ritor1
parents:
diff changeset
6712 _return:
460
62ca9e2e1432 little fix
Ritor1
parents: 459
diff changeset
6713 pVideoPlayer->_4BF5B2();//HouseVideo
0
Ritor1
parents:
diff changeset
6714 }
Ritor1
parents:
diff changeset
6715
Ritor1
parents:
diff changeset
6716 //----- (004B254D) --------------------------------------------------------
Ritor1
parents:
diff changeset
6717 char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
Ritor1
parents:
diff changeset
6718 {
955
Ritor1
parents: 917
diff changeset
6719 //Player *v1; // esi@1
0
Ritor1
parents:
diff changeset
6720 int v2; // edx@1
Ritor1
parents:
diff changeset
6721 int v3; // ecx@1
Ritor1
parents:
diff changeset
6722 int v4; // edi@1
955
Ritor1
parents: 917
diff changeset
6723 int pClassType; // eax@7
0
Ritor1
parents:
diff changeset
6724 int v6; // eax@7
Ritor1
parents:
diff changeset
6725 int v7; // ebx@7
955
Ritor1
parents: 917
diff changeset
6726 //int v8; // ebx@8
0
Ritor1
parents:
diff changeset
6727 signed int v9; // esi@8
Ritor1
parents:
diff changeset
6728 int v10; // eax@8
Ritor1
parents:
diff changeset
6729 char *v11; // ecx@8
Ritor1
parents:
diff changeset
6730 int v12; // edi@9
Ritor1
parents:
diff changeset
6731 char *v13; // edx@9
Ritor1
parents:
diff changeset
6732 signed int v14; // edi@10
Ritor1
parents:
diff changeset
6733 unsigned int v16; // eax@29
955
Ritor1
parents: 917
diff changeset
6734 //int v17; // eax@36
0
Ritor1
parents:
diff changeset
6735 char v18; // cl@46
Ritor1
parents:
diff changeset
6736 __int16 v19; // dx@56
Ritor1
parents:
diff changeset
6737 int v20; // eax@60
955
Ritor1
parents: 917
diff changeset
6738 //char *v21; // [sp-Ch] [bp-38h]@82
Ritor1
parents: 917
diff changeset
6739 //const char *v22; // [sp-8h] [bp-34h]@21
Ritor1
parents: 917
diff changeset
6740 //unsigned int v23; // [sp-8h] [bp-34h]@38
Ritor1
parents: 917
diff changeset
6741 //char *v24; // [sp-8h] [bp-34h]@82
0
Ritor1
parents:
diff changeset
6742 char *v25; // [sp-4h] [bp-30h]@14
955
Ritor1
parents: 917
diff changeset
6743 //int v26; // [sp-4h] [bp-30h]@38
Ritor1
parents: 917
diff changeset
6744 //int v27; // [sp-4h] [bp-30h]@82
0
Ritor1
parents:
diff changeset
6745 char v28[4]; // [sp+Ch] [bp-20h]@9
Ritor1
parents:
diff changeset
6746 int v29; // [sp+10h] [bp-1Ch]@13
Ritor1
parents:
diff changeset
6747 int v30; // [sp+14h] [bp-18h]@15
Ritor1
parents:
diff changeset
6748 int v31; // [sp+18h] [bp-14h]@16
Ritor1
parents:
diff changeset
6749 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7
955
Ritor1
parents: 917
diff changeset
6750 //int v33; // [sp+20h] [bp-Ch]@7
0
Ritor1
parents:
diff changeset
6751 int v34; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
6752 char *v35; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
6753
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6754 contract_approved = 0;
0
Ritor1
parents:
diff changeset
6755 v2 = (_this - 200) % 3;
Ritor1
parents:
diff changeset
6756 v3 = (_this - 200) / 3;
Ritor1
parents:
diff changeset
6757 v4 = v2;
Ritor1
parents:
diff changeset
6758 v35 = (char *)pNPCTopics[127].pText;
492
Gloval
parents: 487
diff changeset
6759 dword_F8B1AC_award_bit_number = v3;
0
Ritor1
parents:
diff changeset
6760 if ( v2 )
Ritor1
parents:
diff changeset
6761 {
Ritor1
parents:
diff changeset
6762 if ( v2 == 1 )
Ritor1
parents:
diff changeset
6763 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6764 gold_transaction_amount = 5000;
0
Ritor1
parents:
diff changeset
6765 dword_F8B1B0 = 3;
Ritor1
parents:
diff changeset
6766 }
Ritor1
parents:
diff changeset
6767 else
Ritor1
parents:
diff changeset
6768 {
Ritor1
parents:
diff changeset
6769 if ( v2 == 2 )
Ritor1
parents:
diff changeset
6770 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6771 gold_transaction_amount = 8000;
0
Ritor1
parents:
diff changeset
6772 dword_F8B1B0 = 4;
Ritor1
parents:
diff changeset
6773 }
Ritor1
parents:
diff changeset
6774 }
Ritor1
parents:
diff changeset
6775 }
Ritor1
parents:
diff changeset
6776 else
Ritor1
parents:
diff changeset
6777 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6778 gold_transaction_amount = 2000;
0
Ritor1
parents:
diff changeset
6779 dword_F8B1B0 = 2;
Ritor1
parents:
diff changeset
6780 }
955
Ritor1
parents: 917
diff changeset
6781 pClassType = pPlayers[uActiveCharacter]->classType;
Ritor1
parents: 917
diff changeset
6782 //v33 = pClassType;
Ritor1
parents: 917
diff changeset
6783 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3];
Ritor1
parents: 917
diff changeset
6784 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3];
0
Ritor1
parents:
diff changeset
6785 v7 = a1[0] & 0x3F;
Ritor1
parents:
diff changeset
6786 v34 = v2 + 2;
Ritor1
parents:
diff changeset
6787 if ( v6 < v2 + 2 )
Ritor1
parents:
diff changeset
6788 {
955
Ritor1
parents: 917
diff changeset
6789 //v8 = v33;
0
Ritor1
parents:
diff changeset
6790 v9 = 0;
955
Ritor1
parents: 917
diff changeset
6791 v10 = pClassType - pClassType % 4;
Ritor1
parents: 917
diff changeset
6792 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3];
0
Ritor1
parents:
diff changeset
6793 do
Ritor1
parents:
diff changeset
6794 {
Ritor1
parents:
diff changeset
6795 v12 = (unsigned __int8)*v11;
Ritor1
parents:
diff changeset
6796 v13 = &v28[4 * v9];
Ritor1
parents:
diff changeset
6797 *(int *)v13 = 0;
Ritor1
parents:
diff changeset
6798 if ( v12 < v34 )
Ritor1
parents:
diff changeset
6799 {
Ritor1
parents:
diff changeset
6800 v14 = 1;
Ritor1
parents:
diff changeset
6801 }
Ritor1
parents:
diff changeset
6802 else
Ritor1
parents:
diff changeset
6803 {
Ritor1
parents:
diff changeset
6804 v14 = 1;
Ritor1
parents:
diff changeset
6805 *(int *)v13 = 1;
Ritor1
parents:
diff changeset
6806 }
Ritor1
parents:
diff changeset
6807 ++v9;
Ritor1
parents:
diff changeset
6808 v11 += 37;
Ritor1
parents:
diff changeset
6809 }
Ritor1
parents:
diff changeset
6810 while ( v9 < 4 );
Ritor1
parents:
diff changeset
6811 if ( v29 == v14 )
Ritor1
parents:
diff changeset
6812 {
Ritor1
parents:
diff changeset
6813 v25 = pClassNames[v10 + 1];
Ritor1
parents:
diff changeset
6814 }
Ritor1
parents:
diff changeset
6815 else
Ritor1
parents:
diff changeset
6816 {
955
Ritor1
parents: 917
diff changeset
6817 if ( v30 == v14 )//crash
0
Ritor1
parents:
diff changeset
6818 {
Ritor1
parents:
diff changeset
6819 if ( v31 == v14 )
Ritor1
parents:
diff changeset
6820 {
955
Ritor1
parents: 917
diff changeset
6821 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà.
0
Ritor1
parents:
diff changeset
6822 return pTmpBuf;
Ritor1
parents:
diff changeset
6823 }
Ritor1
parents:
diff changeset
6824 v25 = pClassNames[v10 + 2];
Ritor1
parents:
diff changeset
6825 }
Ritor1
parents:
diff changeset
6826 else
Ritor1
parents:
diff changeset
6827 {
Ritor1
parents:
diff changeset
6828 if ( v31 != v14 )
Ritor1
parents:
diff changeset
6829 {
955
Ritor1
parents: 917
diff changeset
6830 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s.
Ritor1
parents: 917
diff changeset
6831 return pTmpBuf;
0
Ritor1
parents:
diff changeset
6832 }
Ritor1
parents:
diff changeset
6833 v25 = pClassNames[v10 + 3];
Ritor1
parents:
diff changeset
6834 }
Ritor1
parents:
diff changeset
6835 }
955
Ritor1
parents: 917
diff changeset
6836 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà.
0
Ritor1
parents:
diff changeset
6837 return pTmpBuf;
Ritor1
parents:
diff changeset
6838 }
955
Ritor1
parents: 917
diff changeset
6839 if ( !pPlayers[uActiveCharacter]->CanAct() )
0
Ritor1
parents:
diff changeset
6840 return (char *)pNPCTopics[122].pText;
Ritor1
parents:
diff changeset
6841 if ( !v7 )
Ritor1
parents:
diff changeset
6842 return (char *)pNPCTopics[131].pText;
Ritor1
parents:
diff changeset
6843 v16 = SkillToMastery(a1[0]);
Ritor1
parents:
diff changeset
6844 if ( (signed int)v16 > v4 + 1 )
Ritor1
parents:
diff changeset
6845 return (char *)pNPCTopics[v4 + 128].pText;
Ritor1
parents:
diff changeset
6846 if ( v34 != 2 )
Ritor1
parents:
diff changeset
6847 {
Ritor1
parents:
diff changeset
6848 if ( v34 == 3 )
Ritor1
parents:
diff changeset
6849 {
Ritor1
parents:
diff changeset
6850 if ( (signed int)v16 >= 2 && v7 >= 7 )
Ritor1
parents:
diff changeset
6851 {
492
Gloval
parents: 487
diff changeset
6852 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
6853 {
Ritor1
parents:
diff changeset
6854 case 12:
Ritor1
parents:
diff changeset
6855 case 13:
Ritor1
parents:
diff changeset
6856 case 14:
Ritor1
parents:
diff changeset
6857 case 15:
Ritor1
parents:
diff changeset
6858 case 16:
Ritor1
parents:
diff changeset
6859 case 17:
Ritor1
parents:
diff changeset
6860 case 18:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6861 gold_transaction_amount = 4000;
0
Ritor1
parents:
diff changeset
6862 goto LABEL_42;
Ritor1
parents:
diff changeset
6863 case 19:
Ritor1
parents:
diff changeset
6864 v19 = 114;
955
Ritor1
parents: 917
diff changeset
6865 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
Ritor1
parents: 917
diff changeset
6866 return v35;
Ritor1
parents: 917
diff changeset
6867 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6868 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6869 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6870 case 20:
Ritor1
parents:
diff changeset
6871 v19 = 110;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
6872 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
0
Ritor1
parents:
diff changeset
6873 return v35;
955
Ritor1
parents: 917
diff changeset
6874 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6875 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6876 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6877 case 22:
955
Ritor1
parents: 917
diff changeset
6878 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower();
Ritor1
parents: 917
diff changeset
6879 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
6880 return v35;
Ritor1
parents: 917
diff changeset
6881 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6882 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6883 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6884 case 24:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6885 gold_transaction_amount = 2500;
955
Ritor1
parents: 917
diff changeset
6886 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance();
0
Ritor1
parents:
diff changeset
6887 if ( v20 < 50 )
Ritor1
parents:
diff changeset
6888 return v35;
955
Ritor1
parents: 917
diff changeset
6889 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6890 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6891 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6892 case 36:
Ritor1
parents: 917
diff changeset
6893 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence();
Ritor1
parents: 917
diff changeset
6894 if ( v20 < 50 )
Ritor1
parents: 917
diff changeset
6895 return v35;
Ritor1
parents: 917
diff changeset
6896 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6897 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6898 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6899 case 21:
Ritor1
parents:
diff changeset
6900 case 23:
Ritor1
parents:
diff changeset
6901 case 25:
Ritor1
parents:
diff changeset
6902 case 26:
Ritor1
parents:
diff changeset
6903 case 29:
Ritor1
parents:
diff changeset
6904 case 32:
Ritor1
parents:
diff changeset
6905 case 34:
Ritor1
parents:
diff changeset
6906 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6907 gold_transaction_amount = 2500;
0
Ritor1
parents:
diff changeset
6908 goto LABEL_42;
Ritor1
parents:
diff changeset
6909 case 8:
Ritor1
parents:
diff changeset
6910 case 9:
Ritor1
parents:
diff changeset
6911 case 10:
Ritor1
parents:
diff changeset
6912 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6913 gold_transaction_amount = 3000;
0
Ritor1
parents:
diff changeset
6914 goto LABEL_42;
Ritor1
parents:
diff changeset
6915 case 7:
955
Ritor1
parents: 917
diff changeset
6916 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
6917 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6918 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6919 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6920 default:
Ritor1
parents: 917
diff changeset
6921 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6922 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6923 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6924 }
955
Ritor1
parents: 917
diff changeset
6925 gold_transaction_amount = 0;
Ritor1
parents: 917
diff changeset
6926 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6927 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6928 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6929 }
Ritor1
parents:
diff changeset
6930 }
Ritor1
parents:
diff changeset
6931 else
Ritor1
parents:
diff changeset
6932 {
Ritor1
parents:
diff changeset
6933 if ( v34 != 4 )
Ritor1
parents:
diff changeset
6934 {
955
Ritor1
parents: 917
diff changeset
6935 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6936 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6937 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6938 }
Ritor1
parents:
diff changeset
6939 if ( (signed int)v16 >= 3 && v7 >= 10 )
Ritor1
parents:
diff changeset
6940 {
492
Gloval
parents: 487
diff changeset
6941 switch ( dword_F8B1AC_award_bit_number )
0
Ritor1
parents:
diff changeset
6942 {
Ritor1
parents:
diff changeset
6943 case 19:
955
Ritor1
parents: 917
diff changeset
6944 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 )
Ritor1
parents: 917
diff changeset
6945 {
Ritor1
parents: 917
diff changeset
6946 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6947 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6948 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6949 }
Ritor1
parents: 917
diff changeset
6950 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 )
Ritor1
parents: 917
diff changeset
6951 {
Ritor1
parents: 917
diff changeset
6952 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6953 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6954 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6955 }
Ritor1
parents: 917
diff changeset
6956 return v35;
0
Ritor1
parents:
diff changeset
6957 case 20:
955
Ritor1
parents: 917
diff changeset
6958 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 )
Ritor1
parents: 917
diff changeset
6959 {
Ritor1
parents: 917
diff changeset
6960 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6961 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6962 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6963 }
Ritor1
parents: 917
diff changeset
6964 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 )
Ritor1
parents: 917
diff changeset
6965 {
Ritor1
parents: 917
diff changeset
6966 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6967 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6968 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6969 }
0
Ritor1
parents:
diff changeset
6970 return v35;
Ritor1
parents:
diff changeset
6971 case 30:
955
Ritor1
parents: 917
diff changeset
6972 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]);
0
Ritor1
parents:
diff changeset
6973 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents:
diff changeset
6974 return v35;
955
Ritor1
parents: 917
diff changeset
6975 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6976 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6977 goto LABEL_42;
Ritor1
parents: 917
diff changeset
6978 case 31:
Ritor1
parents: 917
diff changeset
6979 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]);
Ritor1
parents: 917
diff changeset
6980 if ( (v18 & 0x3Fu) < 0xA )
Ritor1
parents: 917
diff changeset
6981 return v35;
Ritor1
parents: 917
diff changeset
6982 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
6983 goto LABEL_79;
Ritor1
parents: 917
diff changeset
6984 goto LABEL_42;
0
Ritor1
parents:
diff changeset
6985 case 21:
Ritor1
parents:
diff changeset
6986 case 23:
Ritor1
parents:
diff changeset
6987 case 24:
Ritor1
parents:
diff changeset
6988 case 25:
Ritor1
parents:
diff changeset
6989 case 26:
Ritor1
parents:
diff changeset
6990 case 29:
Ritor1
parents:
diff changeset
6991 case 32:
Ritor1
parents:
diff changeset
6992 case 34:
Ritor1
parents:
diff changeset
6993 case 35:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
6994 gold_transaction_amount = 6000;
0
Ritor1
parents:
diff changeset
6995 goto LABEL_42;
Ritor1
parents:
diff changeset
6996 case 8:
Ritor1
parents:
diff changeset
6997 case 9:
Ritor1
parents:
diff changeset
6998 case 10:
Ritor1
parents:
diff changeset
6999 case 11:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7000 gold_transaction_amount = 7000;
0
Ritor1
parents:
diff changeset
7001 goto LABEL_42;
Ritor1
parents:
diff changeset
7002 case 7:
Ritor1
parents:
diff changeset
7003 break;
955
Ritor1
parents: 917
diff changeset
7004 default:
Ritor1
parents: 917
diff changeset
7005 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7006 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7007 goto LABEL_42;
0
Ritor1
parents:
diff changeset
7008 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7009 gold_transaction_amount = 0;
955
Ritor1
parents: 917
diff changeset
7010 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7011 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7012 goto LABEL_42;
0
Ritor1
parents:
diff changeset
7013 }
Ritor1
parents:
diff changeset
7014 }
Ritor1
parents:
diff changeset
7015 return v35;
Ritor1
parents:
diff changeset
7016 }
Ritor1
parents:
diff changeset
7017 if ( v7 < 4 )
Ritor1
parents:
diff changeset
7018 return v35;
492
Gloval
parents: 487
diff changeset
7019 if ( dword_F8B1AC_award_bit_number > 27 )
Gloval
parents: 487
diff changeset
7020 {
Gloval
parents: 487
diff changeset
7021 if ( dword_F8B1AC_award_bit_number != 29
Gloval
parents: 487
diff changeset
7022 && dword_F8B1AC_award_bit_number != 32
Gloval
parents: 487
diff changeset
7023 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) )
0
Ritor1
parents:
diff changeset
7024 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7025 if ( !gold_transaction_amount )
0
Ritor1
parents:
diff changeset
7026 goto LABEL_79;
Ritor1
parents:
diff changeset
7027 goto LABEL_42;
Ritor1
parents:
diff changeset
7028 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7029 gold_transaction_amount = 500;
955
Ritor1
parents: 917
diff changeset
7030 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7031 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7032 goto LABEL_42;
0
Ritor1
parents:
diff changeset
7033 }
492
Gloval
parents: 487
diff changeset
7034 if ( dword_F8B1AC_award_bit_number >= 23 )
955
Ritor1
parents: 917
diff changeset
7035 {
Ritor1
parents: 917
diff changeset
7036 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
7037 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7038 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7039 goto LABEL_42;
Ritor1
parents: 917
diff changeset
7040 }
492
Gloval
parents: 487
diff changeset
7041 if ( dword_F8B1AC_award_bit_number == 7 )
0
Ritor1
parents:
diff changeset
7042 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7043 gold_transaction_amount = 0;
0
Ritor1
parents:
diff changeset
7044 goto LABEL_79;
Ritor1
parents:
diff changeset
7045 }
492
Gloval
parents: 487
diff changeset
7046 if ( dword_F8B1AC_award_bit_number <= 7 )
955
Ritor1
parents: 917
diff changeset
7047 {
Ritor1
parents: 917
diff changeset
7048 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7049 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7050 goto LABEL_42;
Ritor1
parents: 917
diff changeset
7051 }
492
Gloval
parents: 487
diff changeset
7052 if ( dword_F8B1AC_award_bit_number > 18 )
Gloval
parents: 487
diff changeset
7053 {
Gloval
parents: 487
diff changeset
7054 if ( dword_F8B1AC_award_bit_number != 21 )
955
Ritor1
parents: 917
diff changeset
7055 {
Ritor1
parents: 917
diff changeset
7056 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7057 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7058 goto LABEL_42;
Ritor1
parents: 917
diff changeset
7059 }
Ritor1
parents: 917
diff changeset
7060 gold_transaction_amount = 500;
Ritor1
parents: 917
diff changeset
7061 if ( !gold_transaction_amount )
Ritor1
parents: 917
diff changeset
7062 goto LABEL_79;
Ritor1
parents: 917
diff changeset
7063 goto LABEL_42;
0
Ritor1
parents:
diff changeset
7064 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7065 gold_transaction_amount = 1000;
0
Ritor1
parents:
diff changeset
7066 LABEL_42:
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7067 if ( gold_transaction_amount > pParty->uNumGold )
0
Ritor1
parents:
diff changeset
7068 return (char *)pNPCTopics[124].pText;
Ritor1
parents:
diff changeset
7069 LABEL_79:
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7070 contract_approved = 1;
0
Ritor1
parents:
diff changeset
7071 if ( v34 == 2 )
Ritor1
parents:
diff changeset
7072 {
955
Ritor1
parents: 917
diff changeset
7073 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ]
Ritor1
parents: 917
diff changeset
7074 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò
Ritor1
parents: 917
diff changeset
7075 return pTmpBuf2;
0
Ritor1
parents:
diff changeset
7076 }
Ritor1
parents:
diff changeset
7077 if ( v34 == 3 )
Ritor1
parents:
diff changeset
7078 {
955
Ritor1
parents: 917
diff changeset
7079 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
Ritor1
parents: 917
diff changeset
7080 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð
Ritor1
parents: 917
diff changeset
7081 return pTmpBuf2;
0
Ritor1
parents:
diff changeset
7082 }
Ritor1
parents:
diff changeset
7083 if ( v34 == 4 )
955
Ritor1
parents: 917
diff changeset
7084 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
Ritor1
parents: 917
diff changeset
7085 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð
0
Ritor1
parents:
diff changeset
7086 return pTmpBuf2;
Ritor1
parents:
diff changeset
7087 }
Ritor1
parents:
diff changeset
7088
Ritor1
parents:
diff changeset
7089 //----- (004B29F2) --------------------------------------------------------
492
Gloval
parents: 487
diff changeset
7090 const char * ContractSelectText( int pEventCode )
Gloval
parents: 487
diff changeset
7091 {
Gloval
parents: 487
diff changeset
7092 static const int dialogue_base=110;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7093 contract_approved = 0;
492
Gloval
parents: 487
diff changeset
7094 dword_F8B1AC_award_bit_number = pEventCode + 50;
Gloval
parents: 487
diff changeset
7095 gold_transaction_amount = price_for_membership[pEventCode];
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7096 if ( pPlayers[uActiveCharacter]->CanAct() )
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7097 {
492
Gloval
parents: 487
diff changeset
7098 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) )
Gloval
parents: 487
diff changeset
7099 {
Gloval
parents: 487
diff changeset
7100 return pNPCTopics[dialogue_base+13].pText;
0
Ritor1
parents:
diff changeset
7101 }
Ritor1
parents:
diff changeset
7102 else
Ritor1
parents:
diff changeset
7103 {
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
7104 if ( gold_transaction_amount <= pParty->uNumGold )
0
Ritor1
parents:
diff changeset
7105 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7106 contract_approved = 1;
492
Gloval
parents: 487
diff changeset
7107 return pNPCTopics[pEventCode + dialogue_base].pText;
0
Ritor1
parents:
diff changeset
7108 }
Ritor1
parents:
diff changeset
7109 else
Ritor1
parents:
diff changeset
7110 {
492
Gloval
parents: 487
diff changeset
7111 return pNPCTopics[dialogue_base+14].pText;
0
Ritor1
parents:
diff changeset
7112 }
Ritor1
parents:
diff changeset
7113 }
Ritor1
parents:
diff changeset
7114 }
Ritor1
parents:
diff changeset
7115 else
Ritor1
parents:
diff changeset
7116 {
492
Gloval
parents: 487
diff changeset
7117 return pNPCTopics[dialogue_base+12].pText;
0
Ritor1
parents:
diff changeset
7118 }
Ritor1
parents:
diff changeset
7119 }
Ritor1
parents:
diff changeset
7120
Ritor1
parents:
diff changeset
7121 //----- (004B2A74) --------------------------------------------------------
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7122 void SimpleHouseAndBoatsDialog()
0
Ritor1
parents:
diff changeset
7123 {
Ritor1
parents:
diff changeset
7124 char *v0; // esi@3
Ritor1
parents:
diff changeset
7125 char *v1; // ST1C_4@3
Ritor1
parents:
diff changeset
7126 char *v2; // eax@3
Ritor1
parents:
diff changeset
7127 const char *v3; // ST1C_4@5
Ritor1
parents:
diff changeset
7128 int v4; // eax@5
Ritor1
parents:
diff changeset
7129 unsigned int i; // eax@5
Ritor1
parents:
diff changeset
7130 NPCData *v6; // esi@6
Ritor1
parents:
diff changeset
7131 unsigned __int16 v7; // bx@6
Ritor1
parents:
diff changeset
7132 unsigned int v8; // eax@6
Ritor1
parents:
diff changeset
7133 int v9; // eax@11
Ritor1
parents:
diff changeset
7134 unsigned int v10; // ecx@12
Ritor1
parents:
diff changeset
7135 int v11; // eax@12
Ritor1
parents:
diff changeset
7136 int v12; // esi@12
Ritor1
parents:
diff changeset
7137 char *v13; // eax@12
Ritor1
parents:
diff changeset
7138 GUIWindow *v14; // ebx@13
Ritor1
parents:
diff changeset
7139 char *v15; // esi@14
Ritor1
parents:
diff changeset
7140 GUIButton *v16; // eax@15
Ritor1
parents:
diff changeset
7141 unsigned int v17; // ecx@15
Ritor1
parents:
diff changeset
7142 int v18; // ecx@17
Ritor1
parents:
diff changeset
7143 int v19; // ecx@18
Ritor1
parents:
diff changeset
7144 int v20; // ecx@19
Ritor1
parents:
diff changeset
7145 int v21; // ecx@20
Ritor1
parents:
diff changeset
7146 int v22; // ecx@21
Ritor1
parents:
diff changeset
7147 unsigned int v23; // ecx@23
Ritor1
parents:
diff changeset
7148 int v24; // ecx@35
Ritor1
parents:
diff changeset
7149 int v25; // ecx@36
Ritor1
parents:
diff changeset
7150 int v26; // ecx@37
Ritor1
parents:
diff changeset
7151 int v27; // ecx@38
Ritor1
parents:
diff changeset
7152 int v28; // ecx@39
Ritor1
parents:
diff changeset
7153 char *v29; // esi@42
Ritor1
parents:
diff changeset
7154 unsigned int v30; // ST20_4@42
Ritor1
parents:
diff changeset
7155 int v31; // ST1C_4@42
Ritor1
parents:
diff changeset
7156 unsigned int v32; // eax@42
Ritor1
parents:
diff changeset
7157 char *v33; // eax@43
Ritor1
parents:
diff changeset
7158 int v34; // esi@51
Ritor1
parents:
diff changeset
7159 int v35; // eax@51
Ritor1
parents:
diff changeset
7160 unsigned int v36; // edi@51
Ritor1
parents:
diff changeset
7161 GUIButton *v37; // eax@52
Ritor1
parents:
diff changeset
7162 int v38; // eax@52
Ritor1
parents:
diff changeset
7163 signed int v39; // ecx@54
Ritor1
parents:
diff changeset
7164 int v40; // edi@57
Ritor1
parents:
diff changeset
7165 GUIButton *v41; // eax@60
Ritor1
parents:
diff changeset
7166 GUIButton *v42; // esi@60
Ritor1
parents:
diff changeset
7167 const char *v43; // ebx@60
Ritor1
parents:
diff changeset
7168 int v44; // eax@60
Ritor1
parents:
diff changeset
7169 unsigned int v45; // ecx@60
Ritor1
parents:
diff changeset
7170 unsigned __int16 v46; // ax@60
Ritor1
parents:
diff changeset
7171 GUIFont *v47; // ebx@64
Ritor1
parents:
diff changeset
7172 int v48; // esi@64
Ritor1
parents:
diff changeset
7173 char *v49; // eax@66
Ritor1
parents:
diff changeset
7174 GUIWindow w; // [sp+Ch] [bp-110h]@64
Ritor1
parents:
diff changeset
7175 GUIWindow v52; // [sp+60h] [bp-BCh]@13
Ritor1
parents:
diff changeset
7176 GUIWindow a1; // [sp+B4h] [bp-68h]@1
Ritor1
parents:
diff changeset
7177 unsigned int v54; // [sp+108h] [bp-14h]@14
Ritor1
parents:
diff changeset
7178 int v55; // [sp+10Ch] [bp-10h]@6
Ritor1
parents:
diff changeset
7179 int v56; // [sp+110h] [bp-Ch]@13
Ritor1
parents:
diff changeset
7180 char *pInString; // [sp+114h] [bp-8h]@12
Ritor1
parents:
diff changeset
7181 NPCData *v58; // [sp+118h] [bp-4h]@6
Ritor1
parents:
diff changeset
7182
Ritor1
parents:
diff changeset
7183 memcpy(&a1, pDialogueWindow, sizeof(a1));
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7184 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
0
Ritor1
parents:
diff changeset
7185 {
Ritor1
parents:
diff changeset
7186 v0 = pMapStats->pInfos[uHouse_ExitPic].pName;
Ritor1
parents:
diff changeset
7187 v1 = pMapStats->pInfos[uHouse_ExitPic].pName;
Ritor1
parents:
diff changeset
7188 a1.uFrameX = 493;
Ritor1
parents:
diff changeset
7189 a1.uFrameWidth = 126;
Ritor1
parents:
diff changeset
7190 a1.uFrameZ = 366;
Ritor1
parents:
diff changeset
7191 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u);
Ritor1
parents:
diff changeset
7192 a1.uFrameX = 483;
Ritor1
parents:
diff changeset
7193 a1.uFrameWidth = 148;
Ritor1
parents:
diff changeset
7194 a1.uFrameZ = 334;
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 431
diff changeset
7195 v2 = pTransitionStrings[uHouse_ExitPic];
0
Ritor1
parents:
diff changeset
7196 if ( !v2 )
Ritor1
parents:
diff changeset
7197 {
721
Ritor1
parents: 720
diff changeset
7198 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
0
Ritor1
parents:
diff changeset
7199 v2 = pTmpBuf;
Ritor1
parents:
diff changeset
7200 }
Ritor1
parents:
diff changeset
7201 v3 = v2;
Ritor1
parents:
diff changeset
7202 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0);
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7203 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u);
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7204 return;
0
Ritor1
parents:
diff changeset
7205 }
Ritor1
parents:
diff changeset
7206 a1.uFrameWidth -= 10;
Ritor1
parents:
diff changeset
7207 a1.uFrameZ -= 10;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7208 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
0
Ritor1
parents:
diff changeset
7209 v6 = v58;
949
Nomad
parents: 948
diff changeset
7210 v55 = TargetColor(0xE1u, 0xCDu, 0x23u);
Nomad
parents: 948
diff changeset
7211 v7 = TargetColor(0x15u, 0x99u, 0xE9u);
0
Ritor1
parents:
diff changeset
7212 v8 = v6->uProfession;
Ritor1
parents:
diff changeset
7213 if ( v8 )
264
fb890fb66cad ^Pi[%s]%s
Ritor1
parents: 263
diff changeset
7214 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
0
Ritor1
parents:
diff changeset
7215 else
Ritor1
parents:
diff changeset
7216 strcpy(pTmpBuf, v6->pName);
Ritor1
parents:
diff changeset
7217 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
7218 if ( !dword_591080 )
Ritor1
parents:
diff changeset
7219 {
Ritor1
parents:
diff changeset
7220 if ( !uDialogueType )
Ritor1
parents:
diff changeset
7221 {
Ritor1
parents:
diff changeset
7222 v9 = v6->greet;
Ritor1
parents:
diff changeset
7223 if ( v9 )
Ritor1
parents:
diff changeset
7224 {
Ritor1
parents:
diff changeset
7225 v10 = v6->uFlags;
819
9359c114f98c More on screenshot
Nomad
parents: 816
diff changeset
7226 a1.uFrameWidth = game_viewport_width;
0
Ritor1
parents:
diff changeset
7227 a1.uFrameZ = 452;
Ritor1
parents:
diff changeset
7228 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9);
Ritor1
parents:
diff changeset
7229 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0);
Ritor1
parents:
diff changeset
7230 v12 = v11 + 7;
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7231 pRenderer->_4A6A68(8, 352 - (v11 + 7),
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7232 pIcons_LOD->GetTexture(uTextureID_Leather),
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7233 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7));
0
Ritor1
parents:
diff changeset
7234 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
Ritor1
parents:
diff changeset
7235 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0);
Ritor1
parents:
diff changeset
7236 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
Ritor1
parents:
diff changeset
7237 }
Ritor1
parents:
diff changeset
7238 }
Ritor1
parents:
diff changeset
7239 }
Ritor1
parents:
diff changeset
7240 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7241 memcpy(&v52, pDialogueWindow, sizeof(v52));
Ritor1
parents:
diff changeset
7242 v52.uFrameX = 483;
Ritor1
parents:
diff changeset
7243 v52.uFrameWidth = 148;
Ritor1
parents:
diff changeset
7244 v52.uFrameZ = 334;
Ritor1
parents:
diff changeset
7245 v56 = v52.pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7246 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
Ritor1
parents:
diff changeset
7247 {
348
5bc2df838558 small fix, decompiler error
zipi
parents: 342
diff changeset
7248 v15 = "";//(char *)v54;
0
Ritor1
parents:
diff changeset
7249 while ( 1 )
Ritor1
parents:
diff changeset
7250 {
Ritor1
parents:
diff changeset
7251 v16 = v52.GetControl(v56);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7252 v17 = v16->msg_param;
0
Ritor1
parents:
diff changeset
7253 pInString = (char *)v16;
Ritor1
parents:
diff changeset
7254 if ( (signed int)v17 > 24 )
Ritor1
parents:
diff changeset
7255 {
Ritor1
parents:
diff changeset
7256 v24 = v17 - 76;
Ritor1
parents:
diff changeset
7257 if ( !v24 )
Ritor1
parents:
diff changeset
7258 {
Ritor1
parents:
diff changeset
7259 v15 = pGlobalTXT_LocalizationStrings[406];
Ritor1
parents:
diff changeset
7260 goto LABEL_49;
Ritor1
parents:
diff changeset
7261 }
Ritor1
parents:
diff changeset
7262 v25 = v24 - 1;
Ritor1
parents:
diff changeset
7263 if ( !v25 )
Ritor1
parents:
diff changeset
7264 {
Ritor1
parents:
diff changeset
7265 v15 = pGlobalTXT_LocalizationStrings[407];
Ritor1
parents:
diff changeset
7266 goto LABEL_49;
Ritor1
parents:
diff changeset
7267 }
Ritor1
parents:
diff changeset
7268 v26 = v25 - 2;
Ritor1
parents:
diff changeset
7269 if ( !v26 )
Ritor1
parents:
diff changeset
7270 {
Ritor1
parents:
diff changeset
7271 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C);
Ritor1
parents:
diff changeset
7272 LABEL_44:
Ritor1
parents:
diff changeset
7273 v15 = v33;
Ritor1
parents:
diff changeset
7274 LABEL_45:
Ritor1
parents:
diff changeset
7275 v16 = (GUIButton *)pInString;
Ritor1
parents:
diff changeset
7276 goto LABEL_49;
Ritor1
parents:
diff changeset
7277 }
Ritor1
parents:
diff changeset
7278 v27 = v26 - 3;
Ritor1
parents:
diff changeset
7279 if ( !v27 )
Ritor1
parents:
diff changeset
7280 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7281 v33 = (char *)ContractSelectText((int)v52.ptr_1C);
0
Ritor1
parents:
diff changeset
7282 goto LABEL_44;
Ritor1
parents:
diff changeset
7283 }
Ritor1
parents:
diff changeset
7284 v28 = v27 - 1;
Ritor1
parents:
diff changeset
7285 if ( !v28 )
Ritor1
parents:
diff changeset
7286 {
Ritor1
parents:
diff changeset
7287 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0;
949
Nomad
parents: 948
diff changeset
7288 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
0
Ritor1
parents:
diff changeset
7289 v31 = *(int *)v29;
949
Nomad
parents: 948
diff changeset
7290 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
1033
3a5c8df8381d * UI cleans and moves
Nomad
parents: 1031
diff changeset
7291 sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30);
3a5c8df8381d * UI cleans and moves
Nomad
parents: 1031
diff changeset
7292 sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7293 current_npc_text = pTmpBuf2;
0
Ritor1
parents:
diff changeset
7294 v15 = "";
Ritor1
parents:
diff changeset
7295 goto LABEL_45;
Ritor1
parents:
diff changeset
7296 }
Ritor1
parents:
diff changeset
7297 if ( v28 != 10 )
Ritor1
parents:
diff changeset
7298 goto LABEL_41;
Ritor1
parents:
diff changeset
7299 }
Ritor1
parents:
diff changeset
7300 else
Ritor1
parents:
diff changeset
7301 {
Ritor1
parents:
diff changeset
7302 if ( v17 == 24 )
Ritor1
parents:
diff changeset
7303 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7304 v23 = v58->evt_F;
0
Ritor1
parents:
diff changeset
7305 LABEL_33:
81
377535d6e366 structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents: 66
diff changeset
7306 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
0
Ritor1
parents:
diff changeset
7307 if ( !v15 )
Ritor1
parents:
diff changeset
7308 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7309 v16->msg_param = 0;
0
Ritor1
parents:
diff changeset
7310 v15 = "";
Ritor1
parents:
diff changeset
7311 }
Ritor1
parents:
diff changeset
7312 goto LABEL_49;
Ritor1
parents:
diff changeset
7313 }
Ritor1
parents:
diff changeset
7314 v18 = v17 - 13;
Ritor1
parents:
diff changeset
7315 if ( v18 )
Ritor1
parents:
diff changeset
7316 {
Ritor1
parents:
diff changeset
7317 v19 = v18 - 6;
Ritor1
parents:
diff changeset
7318 if ( !v19 )
Ritor1
parents:
diff changeset
7319 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7320 v23 = v58->evt_A;
0
Ritor1
parents:
diff changeset
7321 goto LABEL_33;
Ritor1
parents:
diff changeset
7322 }
Ritor1
parents:
diff changeset
7323 v20 = v19 - 1;
Ritor1
parents:
diff changeset
7324 if ( !v20 )
Ritor1
parents:
diff changeset
7325 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7326 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb];
0
Ritor1
parents:
diff changeset
7327 if ( !v15 )
Ritor1
parents:
diff changeset
7328 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7329 v16->msg_param = 0;
0
Ritor1
parents:
diff changeset
7330 v15 = "";
Ritor1
parents:
diff changeset
7331 }
Ritor1
parents:
diff changeset
7332 if ( uDialogueType != 84 )
Ritor1
parents:
diff changeset
7333 goto LABEL_49;
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7334 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7335 sprintf(pTmpBuf2, current_npc_text, pTmpBuf);
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7336 current_npc_text = pTmpBuf2;
0
Ritor1
parents:
diff changeset
7337 goto LABEL_45;
Ritor1
parents:
diff changeset
7338 }
Ritor1
parents:
diff changeset
7339 v21 = v20 - 1;
Ritor1
parents:
diff changeset
7340 if ( !v21 )
Ritor1
parents:
diff changeset
7341 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7342 v23 = v58->evt_C;
0
Ritor1
parents:
diff changeset
7343 goto LABEL_33;
Ritor1
parents:
diff changeset
7344 }
Ritor1
parents:
diff changeset
7345 v22 = v21 - 1;
Ritor1
parents:
diff changeset
7346 if ( !v22 )
Ritor1
parents:
diff changeset
7347 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7348 v23 = v58->evt_D;
0
Ritor1
parents:
diff changeset
7349 goto LABEL_33;
Ritor1
parents:
diff changeset
7350 }
Ritor1
parents:
diff changeset
7351 if ( v22 == 1 )
Ritor1
parents:
diff changeset
7352 {
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7353 v23 = v58->evt_E;
0
Ritor1
parents:
diff changeset
7354 goto LABEL_33;
Ritor1
parents:
diff changeset
7355 }
Ritor1
parents:
diff changeset
7356 LABEL_41:
Ritor1
parents:
diff changeset
7357 v15 = "";
Ritor1
parents:
diff changeset
7358 goto LABEL_49;
Ritor1
parents:
diff changeset
7359 }
Ritor1
parents:
diff changeset
7360 v15 = pGlobalTXT_LocalizationStrings[122];
Ritor1
parents:
diff changeset
7361 }
Ritor1
parents:
diff changeset
7362 LABEL_49:
Ritor1
parents:
diff changeset
7363 strcpy(v16->pButtonName, v15);
Ritor1
parents:
diff changeset
7364 ++v56;
Ritor1
parents:
diff changeset
7365 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton )
Ritor1
parents:
diff changeset
7366 {
Ritor1
parents:
diff changeset
7367 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7368 break;
Ritor1
parents:
diff changeset
7369 }
Ritor1
parents:
diff changeset
7370 }
Ritor1
parents:
diff changeset
7371 }
Ritor1
parents:
diff changeset
7372 v34 = 0;
949
Nomad
parents: 948
diff changeset
7373 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu);
Nomad
parents: 948
diff changeset
7374 v35 = TargetColor(0xE1u, 0xCDu, 0x23u);
0
Ritor1
parents:
diff changeset
7375 v36 = v14->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7376 v55 = v35;
Ritor1
parents:
diff changeset
7377 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
Ritor1
parents:
diff changeset
7378 + pDialogueWindow->pStartingPosActiveItem )
Ritor1
parents:
diff changeset
7379 {
Ritor1
parents:
diff changeset
7380 v37 = v14->GetControl(v36);
Ritor1
parents:
diff changeset
7381 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
Ritor1
parents:
diff changeset
7382 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7383 v34 += v38;
Ritor1
parents:
diff changeset
7384 ++v36;
Ritor1
parents:
diff changeset
7385 }
Ritor1
parents:
diff changeset
7386 v39 = v14->pNumPresenceButton;
Ritor1
parents:
diff changeset
7387 if ( v39 )
Ritor1
parents:
diff changeset
7388 {
Ritor1
parents:
diff changeset
7389 v58 = (NPCData *)((174 - v34) / v39);
Ritor1
parents:
diff changeset
7390 if ( (signed int)v58 > 32 )
Ritor1
parents:
diff changeset
7391 v58 = (NPCData *)32;
Ritor1
parents:
diff changeset
7392 pInString = (char *)2;
Ritor1
parents:
diff changeset
7393 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138;
Ritor1
parents:
diff changeset
7394 v56 = v14->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7395 i = v56;
Ritor1
parents:
diff changeset
7396 if ( (signed int)i < (signed int)(i + v39) )
Ritor1
parents:
diff changeset
7397 {
Ritor1
parents:
diff changeset
7398 while ( 1 )
Ritor1
parents:
diff changeset
7399 {
Ritor1
parents:
diff changeset
7400 v41 = v14->GetControl(i);
Ritor1
parents:
diff changeset
7401 v42 = v41;
Ritor1
parents:
diff changeset
7402 v43 = v41->pButtonName;
Ritor1
parents:
diff changeset
7403 v41->uY = (unsigned int)((char *)v58 + v40);
Ritor1
parents:
diff changeset
7404 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0);
Ritor1
parents:
diff changeset
7405 v45 = v42->uY;
Ritor1
parents:
diff changeset
7406 v42->uHeight = v44;
Ritor1
parents:
diff changeset
7407 v40 = v45 + v44 - 1;
Ritor1
parents:
diff changeset
7408 v42->uW = v40;
Ritor1
parents:
diff changeset
7409 v46 = v55;
Ritor1
parents:
diff changeset
7410 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString )
Ritor1
parents:
diff changeset
7411 v46 = v54;
Ritor1
parents:
diff changeset
7412 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u);
Ritor1
parents:
diff changeset
7413 v14 = pDialogueWindow;
Ritor1
parents:
diff changeset
7414 ++pInString;
Ritor1
parents:
diff changeset
7415 ++v56;
Ritor1
parents:
diff changeset
7416 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
7417 if ( v56 >= (signed int)i )
Ritor1
parents:
diff changeset
7418 break;
Ritor1
parents:
diff changeset
7419 i = v56;
Ritor1
parents:
diff changeset
7420 }
Ritor1
parents:
diff changeset
7421 }
Ritor1
parents:
diff changeset
7422 }
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7423 if ( current_npc_text )
0
Ritor1
parents:
diff changeset
7424 {
Ritor1
parents:
diff changeset
7425 w.uFrameWidth = 458;
Ritor1
parents:
diff changeset
7426 w.uFrameZ = 457;
Ritor1
parents:
diff changeset
7427 v47 = pFontArrus;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7428 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
0
Ritor1
parents:
diff changeset
7429 if ( 352 - v48 < 8 )
Ritor1
parents:
diff changeset
7430 {
Ritor1
parents:
diff changeset
7431 v47 = pFontCreate;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7432 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
0
Ritor1
parents:
diff changeset
7433 }
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7434 pRenderer->_4A6A68(8, 352 - v48,
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7435 pIcons_LOD->GetTexture(uTextureID_Leather),
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
7436 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48);
0
Ritor1
parents:
diff changeset
7437 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428);
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7438 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0);
762
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7439 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0);
cf2fbac6edc9 Misc cleaning
Nomad
parents: 758
diff changeset
7440 }
0
Ritor1
parents:
diff changeset
7441 }
Ritor1
parents:
diff changeset
7442
Ritor1
parents:
diff changeset
7443 //----- (004B36CC) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7444 void CreateButtonInColumn( int column_pos, unsigned int control_id )
782
c47efaf23642 more tidy
zipi
parents: 775
diff changeset
7445 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7446 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0);
0
Ritor1
parents:
diff changeset
7447 }
Ritor1
parents:
diff changeset
7448
Ritor1
parents:
diff changeset
7449 //----- (004B3A72) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7450 void sub_4B3A72( int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7451 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7452 int num_buttons; // esi@1
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7453
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7454 num_buttons = 0;
0
Ritor1
parents:
diff changeset
7455 if ( a1 == 21 )
Ritor1
parents:
diff changeset
7456 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7457 CreateButtonInColumn(0, 0x66u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7458 num_buttons = 2;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7459 CreateButtonInColumn(1, 0x67u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7460 if ( pParty->HasItem(651) ) //Arcomage Deck
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7461 {
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7462 num_buttons = 3;
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7463 CreateButtonInColumn(2, 0x68u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7464 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7465 }
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7466 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2);
0
Ritor1
parents:
diff changeset
7467 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7468 }
Ritor1
parents:
diff changeset
7469 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7470
Ritor1
parents:
diff changeset
7471 //----- (004B3AD4) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7472 void sub_4B3AD4( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7473 {
0
Ritor1
parents:
diff changeset
7474 if ( a1 > 0 )
Ritor1
parents:
diff changeset
7475 {
Ritor1
parents:
diff changeset
7476 if ( a1 <= 3 )
Ritor1
parents:
diff changeset
7477 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7478 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7479 CreateButtonInColumn(1, 4u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7480 CreateButtonInColumn(2, 5u);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7481 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2);
0
Ritor1
parents:
diff changeset
7482 }
Ritor1
parents:
diff changeset
7483 if ( a1 == 4 )
Ritor1
parents:
diff changeset
7484 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7485 CreateButtonInColumn(0, 3u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7486 CreateButtonInColumn(1, 4u);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7487 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2);
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7488 }
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7489 }
0
Ritor1
parents:
diff changeset
7490 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7491 }
Ritor1
parents:
diff changeset
7492 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7493
Ritor1
parents:
diff changeset
7494 //----- (004B3B42) --------------------------------------------------------
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7495 void sub_4B3B42( signed int a1 )
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7496 {
0
Ritor1
parents:
diff changeset
7497 int v1; // ecx@18
Ritor1
parents:
diff changeset
7498 int v2; // ecx@19
Ritor1
parents:
diff changeset
7499 int v3; // ecx@20
Ritor1
parents:
diff changeset
7500 signed int v4; // esi@22
Ritor1
parents:
diff changeset
7501 signed int v5; // eax@22
Ritor1
parents:
diff changeset
7502 unsigned int v6; // edx@24
Ritor1
parents:
diff changeset
7503 int v7; // ecx@24
Ritor1
parents:
diff changeset
7504 int result; // eax@43
Ritor1
parents:
diff changeset
7505 int v9; // [sp-10h] [bp-14h]@28
Ritor1
parents:
diff changeset
7506 int v10; // [sp-Ch] [bp-10h]@28
Ritor1
parents:
diff changeset
7507 int v11; // [sp-8h] [bp-Ch]@28
Ritor1
parents:
diff changeset
7508 unsigned int v12; // [sp-4h] [bp-8h]@4
Ritor1
parents:
diff changeset
7509 unsigned int v13; // [sp-4h] [bp-8h]@5
Ritor1
parents:
diff changeset
7510 unsigned int v14; // [sp-4h] [bp-8h]@9
Ritor1
parents:
diff changeset
7511 unsigned int v15; // [sp-4h] [bp-8h]@10
Ritor1
parents:
diff changeset
7512 unsigned int v16; // [sp-4h] [bp-8h]@14
Ritor1
parents:
diff changeset
7513 int v17; // [sp-4h] [bp-8h]@28
Ritor1
parents:
diff changeset
7514
Ritor1
parents:
diff changeset
7515 if ( a1 > 13 )
Ritor1
parents:
diff changeset
7516 {
Ritor1
parents:
diff changeset
7517 if ( a1 > 22 )
Ritor1
parents:
diff changeset
7518 {
Ritor1
parents:
diff changeset
7519 if ( a1 == 23 )
Ritor1
parents:
diff changeset
7520 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7521 CreateButtonInColumn(0, 0xAu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7522 CreateButtonInColumn(1, 0xBu);
0
Ritor1
parents:
diff changeset
7523 v14 = 96;
Ritor1
parents:
diff changeset
7524 LABEL_41:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7525 CreateButtonInColumn(2, v14);
0
Ritor1
parents:
diff changeset
7526 v17 = 2;
Ritor1
parents:
diff changeset
7527 v11 = 0;
Ritor1
parents:
diff changeset
7528 v10 = 1;
Ritor1
parents:
diff changeset
7529 v9 = 3;
Ritor1
parents:
diff changeset
7530 goto LABEL_42;
Ritor1
parents:
diff changeset
7531 }
Ritor1
parents:
diff changeset
7532 if ( a1 <= 26 )
Ritor1
parents:
diff changeset
7533 goto LABEL_43;
Ritor1
parents:
diff changeset
7534 if ( a1 > 28 )
Ritor1
parents:
diff changeset
7535 {
Ritor1
parents:
diff changeset
7536 if ( a1 != 30 )
Ritor1
parents:
diff changeset
7537 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7538 CreateButtonInColumn(0, 0x11u);
0
Ritor1
parents:
diff changeset
7539 v16 = 96;
Ritor1
parents:
diff changeset
7540 goto LABEL_37;
Ritor1
parents:
diff changeset
7541 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7542 CreateButtonInColumn(0, 0x69u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7543 CreateButtonInColumn(1, 0x6Au);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7544 CreateButtonInColumn(2, 0x6Bu);
0
Ritor1
parents:
diff changeset
7545 v12 = 108;
Ritor1
parents:
diff changeset
7546 }
Ritor1
parents:
diff changeset
7547 else
Ritor1
parents:
diff changeset
7548 {
Ritor1
parents:
diff changeset
7549 if ( a1 == 22 )
Ritor1
parents:
diff changeset
7550 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7551 CreateButtonInColumn(0, 7u);
0
Ritor1
parents:
diff changeset
7552 v16 = 8;
Ritor1
parents:
diff changeset
7553 goto LABEL_37;
Ritor1
parents:
diff changeset
7554 }
Ritor1
parents:
diff changeset
7555 v1 = a1 - 14;
Ritor1
parents:
diff changeset
7556 if ( !v1 )
Ritor1
parents:
diff changeset
7557 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7558 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7559 CreateButtonInColumn(1, 0x30u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7560 CreateButtonInColumn(2, 0x31u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7561 CreateButtonInColumn(3, 0x32u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7562 CreateButtonInColumn(4, 0x33u);
0
Ritor1
parents:
diff changeset
7563 v17 = 2;
Ritor1
parents:
diff changeset
7564 v11 = 0;
Ritor1
parents:
diff changeset
7565 v10 = 1;
Ritor1
parents:
diff changeset
7566 v9 = 5;
Ritor1
parents:
diff changeset
7567 goto LABEL_42;
Ritor1
parents:
diff changeset
7568 }
Ritor1
parents:
diff changeset
7569 v2 = v1 - 1;
Ritor1
parents:
diff changeset
7570 if ( v2 )
Ritor1
parents:
diff changeset
7571 {
Ritor1
parents:
diff changeset
7572 v3 = v2 - 2;
Ritor1
parents:
diff changeset
7573 if ( v3 )
Ritor1
parents:
diff changeset
7574 {
Ritor1
parents:
diff changeset
7575 if ( v3 != 4 )
Ritor1
parents:
diff changeset
7576 goto LABEL_43;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7577 CreateButtonInColumn(0, 0xFu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7578 CreateButtonInColumn(1, 0x10u);
0
Ritor1
parents:
diff changeset
7579 v4 = 3;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7580 CreateButtonInColumn(2, 0x60u);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
7581 v5 = (signed int)window_SpeakInHouse->ptr_1C;
0
Ritor1
parents:
diff changeset
7582 if ( v5 < 108 || v5 > 120 )
Ritor1
parents:
diff changeset
7583 goto LABEL_28;
Ritor1
parents:
diff changeset
7584 v4 = 4;
Ritor1
parents:
diff changeset
7585 v6 = 101;
Ritor1
parents:
diff changeset
7586 v7 = 3;
Ritor1
parents:
diff changeset
7587 }
Ritor1
parents:
diff changeset
7588 else
Ritor1
parents:
diff changeset
7589 {
Ritor1
parents:
diff changeset
7590 v4 = 1;
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7591 CreateButtonInColumn(0, 0x63u);
0
Ritor1
parents:
diff changeset
7592 if ( !pParty->uFine )
Ritor1
parents:
diff changeset
7593 {
Ritor1
parents:
diff changeset
7594 LABEL_28:
Ritor1
parents:
diff changeset
7595 v17 = 2;
Ritor1
parents:
diff changeset
7596 v11 = 0;
Ritor1
parents:
diff changeset
7597 v10 = 1;
Ritor1
parents:
diff changeset
7598 v9 = v4;
Ritor1
parents:
diff changeset
7599 LABEL_42:
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7600 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17);
0
Ritor1
parents:
diff changeset
7601 goto LABEL_43;
Ritor1
parents:
diff changeset
7602 }
Ritor1
parents:
diff changeset
7603 v4 = 2;
Ritor1
parents:
diff changeset
7604 v7 = 1;
Ritor1
parents:
diff changeset
7605 v6 = 100;
Ritor1
parents:
diff changeset
7606 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7607 CreateButtonInColumn(v7, v6);
0
Ritor1
parents:
diff changeset
7608 goto LABEL_28;
Ritor1
parents:
diff changeset
7609 }
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7610 CreateButtonInColumn(0, 0x12u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7611 CreateButtonInColumn(1, 0x34u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7612 CreateButtonInColumn(2, 0x35u);
0
Ritor1
parents:
diff changeset
7613 v12 = 54;
Ritor1
parents:
diff changeset
7614 }
Ritor1
parents:
diff changeset
7615 LABEL_39:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7616 CreateButtonInColumn(3, v12);
0
Ritor1
parents:
diff changeset
7617 v17 = 2;
Ritor1
parents:
diff changeset
7618 v11 = 0;
Ritor1
parents:
diff changeset
7619 v10 = 1;
Ritor1
parents:
diff changeset
7620 v9 = 4;
Ritor1
parents:
diff changeset
7621 goto LABEL_42;
Ritor1
parents:
diff changeset
7622 }
Ritor1
parents:
diff changeset
7623 if ( a1 == 13 )
Ritor1
parents:
diff changeset
7624 {
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7625 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7626 v16 = 56;
Ritor1
parents:
diff changeset
7627 LABEL_37:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7628 CreateButtonInColumn(1, v16);
0
Ritor1
parents:
diff changeset
7629 v17 = 2;
Ritor1
parents:
diff changeset
7630 v11 = 0;
Ritor1
parents:
diff changeset
7631 v10 = 1;
Ritor1
parents:
diff changeset
7632 v9 = 2;
Ritor1
parents:
diff changeset
7633 goto LABEL_42;
Ritor1
parents:
diff changeset
7634 }
Ritor1
parents:
diff changeset
7635 switch ( a1 )
Ritor1
parents:
diff changeset
7636 {
Ritor1
parents:
diff changeset
7637 case 1:
Ritor1
parents:
diff changeset
7638 case 2:
Ritor1
parents:
diff changeset
7639 case 3:
Ritor1
parents:
diff changeset
7640 case 4:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7641 CreateButtonInColumn(0, 2u);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7642 CreateButtonInColumn(1, 0x5Fu);
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7643 CreateButtonInColumn(2, 0x5Eu);
0
Ritor1
parents:
diff changeset
7644 v12 = 96;
Ritor1
parents:
diff changeset
7645 goto LABEL_39;
Ritor1
parents:
diff changeset
7646 case 5:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7647 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7648 v13 = 48;
Ritor1
parents:
diff changeset
7649 goto LABEL_9;
Ritor1
parents:
diff changeset
7650 case 6:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7651 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7652 v13 = 49;
Ritor1
parents:
diff changeset
7653 goto LABEL_9;
Ritor1
parents:
diff changeset
7654 case 7:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7655 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7656 v13 = 50;
Ritor1
parents:
diff changeset
7657 goto LABEL_9;
Ritor1
parents:
diff changeset
7658 case 8:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7659 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7660 v13 = 51;
Ritor1
parents:
diff changeset
7661 LABEL_9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7662 CreateButtonInColumn(1, v13);
0
Ritor1
parents:
diff changeset
7663 v14 = 72;
Ritor1
parents:
diff changeset
7664 goto LABEL_41;
Ritor1
parents:
diff changeset
7665 case 9:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7666 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7667 v15 = 52;
Ritor1
parents:
diff changeset
7668 goto LABEL_13;
Ritor1
parents:
diff changeset
7669 case 10:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7670 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7671 v15 = 53;
Ritor1
parents:
diff changeset
7672 goto LABEL_13;
Ritor1
parents:
diff changeset
7673 case 11:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7674 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7675 v15 = 54;
Ritor1
parents:
diff changeset
7676 LABEL_13:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7677 CreateButtonInColumn(1, v15);
0
Ritor1
parents:
diff changeset
7678 v14 = 61;
Ritor1
parents:
diff changeset
7679 goto LABEL_41;
Ritor1
parents:
diff changeset
7680 case 12:
473
7f1b00901cf7 Skill learning menu in shops
Gloval
parents: 471
diff changeset
7681 CreateButtonInColumn(0, 0x12u);
0
Ritor1
parents:
diff changeset
7682 v16 = 55;
Ritor1
parents:
diff changeset
7683 goto LABEL_37;
Ritor1
parents:
diff changeset
7684 default:
Ritor1
parents:
diff changeset
7685 break;
Ritor1
parents:
diff changeset
7686 }
Ritor1
parents:
diff changeset
7687 LABEL_43:
Ritor1
parents:
diff changeset
7688 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7689 }
Ritor1
parents:
diff changeset
7690 // F8B1E0: using guessed type int dword_F8B1E0;
Ritor1
parents:
diff changeset
7691
Ritor1
parents:
diff changeset
7692 //----- (004B3E1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7693 void __cdecl sub_4B3E1E()
Ritor1
parents:
diff changeset
7694 {
Ritor1
parents:
diff changeset
7695 NPCData *v0; // ST40_4@1
Ritor1
parents:
diff changeset
7696 signed int v1; // edi@1
165
Ritor1
parents: 152
diff changeset
7697 //GUIWindow *v2; // ecx@1
0
Ritor1
parents:
diff changeset
7698
167
90521fb9766c NPCDialogue fix
Ritor1
parents: 165
diff changeset
7699 __debugbreak();
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
7700 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0
Ritor1
parents:
diff changeset
7701 v1 = 0;
Ritor1
parents:
diff changeset
7702 pDialogueWindow->eWindowType = WINDOW_MainMenu;
Ritor1
parents:
diff changeset
7703 pDialogueWindow->Release();
165
Ritor1
parents: 152
diff changeset
7704 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7705 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
0
Ritor1
parents:
diff changeset
7706 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7707 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
0
Ritor1
parents:
diff changeset
7708 v1 = 1;
Ritor1
parents:
diff changeset
7709 }
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7710 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7711 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
0
Ritor1
parents:
diff changeset
7712 }
Ritor1
parents:
diff changeset
7713
Ritor1
parents:
diff changeset
7714 //----- (004B3EF0) --------------------------------------------------------
492
Gloval
parents: 487
diff changeset
7715 void DrawJoinGuildWindow( int pEventCode )
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7716 {
467
Ritor1
parents: 460
diff changeset
7717 uDialogueType = 81;//enum JoinGuildDialog
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7718 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText;
492
Gloval
parents: 487
diff changeset
7719 ContractSelectText(pEventCode);
0
Ritor1
parents:
diff changeset
7720 pDialogueWindow->Release();
492
Gloval
parents: 487
diff changeset
7721 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0);
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7722 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7723 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7724 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7725 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7726 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7727 }
Ritor1
parents:
diff changeset
7728 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
7729
Ritor1
parents:
diff changeset
7730 //----- (004B3FE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
7731 void __fastcall sub_4B3FE5(int a4)
Ritor1
parents:
diff changeset
7732 {
Ritor1
parents:
diff changeset
7733 int v1; // edi@1
Ritor1
parents:
diff changeset
7734 char *v2; // edi@1
Ritor1
parents:
diff changeset
7735
Ritor1
parents:
diff changeset
7736 v1 = a4;
Ritor1
parents:
diff changeset
7737 uDialogueType = 78;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
7738 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
0
Ritor1
parents:
diff changeset
7739 _4B254D_SkillMasteryTeacher(a4);
Ritor1
parents:
diff changeset
7740 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7741 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
Ritor1
parents:
diff changeset
7742 v2 = "";
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7743 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7744 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7745 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7746 if ( contract_approved )
0
Ritor1
parents:
diff changeset
7747 v2 = pGlobalTXT_LocalizationStrings[535];
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7748 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7749 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7750 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7751 }
Ritor1
parents:
diff changeset
7752 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
7753 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
7754
Ritor1
parents:
diff changeset
7755 //----- (004B40E6) --------------------------------------------------------
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7756 void NPCHireableDialogPrepare()
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7757 {
0
Ritor1
parents:
diff changeset
7758 signed int v0; // ebx@1
Ritor1
parents:
diff changeset
7759 NPCData *v1; // edi@1
Ritor1
parents:
diff changeset
7760
Ritor1
parents:
diff changeset
7761 v0 = 0;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7762 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
0
Ritor1
parents:
diff changeset
7763 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7764 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7765 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7766 pGlobalTXT_LocalizationStrings[34], //"Cancel"
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7767 pIcons_LOD->GetTexture(uExitCancelTextureId),
0
Ritor1
parents:
diff changeset
7768 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7769 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
7770 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
0
Ritor1
parents:
diff changeset
7771 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7772 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0,
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7773 pGlobalTXT_LocalizationStrings[407], 0);//"More Information"
0
Ritor1
parents:
diff changeset
7774 v0 = 1;
Ritor1
parents:
diff changeset
7775 }
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7776 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0,
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
7777 pGlobalTXT_LocalizationStrings[406], 0); //"Hire"
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7778 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7779 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
7780 }
Ritor1
parents:
diff changeset
7781
Ritor1
parents:
diff changeset
7782 //----- (004B4224) --------------------------------------------------------
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7783 void _4B4224_UpdateNPCTopics( int _this )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7784 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7785 int num_menu_buttons; // ebx@1
0
Ritor1
parents:
diff changeset
7786 int i; // ebp@5
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7787 // signed int v4; // ebp@9
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7788 int v6; // eax@16
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7789 int v8; // eax@21
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7790 int v10; // eax@26
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7791 int v12; // eax@31
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7792 int v14; // eax@36
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7793 int v16; // eax@41
0
Ritor1
parents:
diff changeset
7794 NPCData *v17; // [sp+10h] [bp-4h]@4
Ritor1
parents:
diff changeset
7795
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7796 num_menu_buttons = 0;
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7797 pDialogueNPCCount = (_this + 1);
0
Ritor1
parents:
diff changeset
7798 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
Ritor1
parents:
diff changeset
7799 {
Ritor1
parents:
diff changeset
7800 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7801 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
809
7bb33867d2cb Pv[] in sprintfex
Ritor1
parents: 796
diff changeset
7802 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7803 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel"
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7804 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7805 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0);
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7806 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0);
0
Ritor1
parents:
diff changeset
7807 }
Ritor1
parents:
diff changeset
7808 else
Ritor1
parents:
diff changeset
7809 {
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7810 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)];
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
7811 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER )
0
Ritor1
parents:
diff changeset
7812 {
Ritor1
parents:
diff changeset
7813 pDialogueWindow->Release();
Ritor1
parents:
diff changeset
7814 }
Ritor1
parents:
diff changeset
7815 else
Ritor1
parents:
diff changeset
7816 {
Ritor1
parents:
diff changeset
7817 for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
697
2dfb67633b01 GUIButton Release
zipi
parents: 693
diff changeset
7818 ((GUIButton *)HouseNPCData[i + 7])->Release();
0
Ritor1
parents:
diff changeset
7819 }
Ritor1
parents:
diff changeset
7820 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7821 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0,
0
Ritor1
parents:
diff changeset
7822 pGlobalTXT_LocalizationStrings[74],// "End Conversation"
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
7823 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7824 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
459
a7869569e912 HouseNPCData
Ritor1
parents: 458
diff changeset
7825 if ( pDialogueNPCCount == 1 && dword_591080 )
0
Ritor1
parents:
diff changeset
7826 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
7827 sub_4B3B42(in_current_building_type);
0
Ritor1
parents:
diff changeset
7828 }
Ritor1
parents:
diff changeset
7829 else
Ritor1
parents:
diff changeset
7830 {
Ritor1
parents:
diff changeset
7831 if ( v17->joins )
Ritor1
parents:
diff changeset
7832 {
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7833 num_menu_buttons = 1;
858
Ritor1
parents: 849
diff changeset
7834 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0);
0
Ritor1
parents:
diff changeset
7835 }
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7836 if ( v17->evt_A)
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7837 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7838 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7839 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7840 v6 = NPC_EventProcessor(v17->evt_A);
0
Ritor1
parents:
diff changeset
7841 if ( v6 == 1 || v6 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7842 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7843 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7844 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7845 if ( v17->evt_B )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7846 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7847 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7848 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7849 v8 = NPC_EventProcessor(v17->evt_B);
0
Ritor1
parents:
diff changeset
7850 if ( v8 == 1 || v8 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7851 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7852 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7853 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7854 if ( v17->evt_C )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7855 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7856 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7857 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7858 v10 = NPC_EventProcessor(v17->evt_C);
0
Ritor1
parents:
diff changeset
7859 if ( v10 == 1 || v10 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7860 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7861 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7862 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7863
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7864 if ( v17->evt_D )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7865 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7866 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7867 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7868 v12 = NPC_EventProcessor(v17->evt_D);
0
Ritor1
parents:
diff changeset
7869 if ( v12 == 1 || v12 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7870 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7871 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7872 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7873 if ( v17->evt_E )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7874 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7875 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7876 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7877 v14 = NPC_EventProcessor(v17->evt_E);
0
Ritor1
parents:
diff changeset
7878 if ( v14 == 1 || v14 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7879 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7880 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7881 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7882 if ( v17->evt_F )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7883 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7884 if ( num_menu_buttons < 4 )
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7885 {
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7886 v16 = NPC_EventProcessor(v17->evt_F);
0
Ritor1
parents:
diff changeset
7887 if ( v16 == 1 || v16 == 2 )
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
7888 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0);
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7889 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7890 }
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
7891 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2);
0
Ritor1
parents:
diff changeset
7892 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
7893 }
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
7894 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
423
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7895 }
88c30918eef7 NPC_EventProcessor
Gloval
parents: 414
diff changeset
7896
0
Ritor1
parents:
diff changeset
7897 }
Ritor1
parents:
diff changeset
7898
Ritor1
parents:
diff changeset
7899 //----- (004B46A5) --------------------------------------------------------
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
7900 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 )
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
7901 {
0
Ritor1
parents:
diff changeset
7902 int v4; // eax@1
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
7903 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
7904 v4 = pFontLucida->AlignText_Center(450, Str);
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
7905 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0);
0
Ritor1
parents:
diff changeset
7906 }
Ritor1
parents:
diff changeset
7907
Ritor1
parents:
diff changeset
7908 //----- (004B46F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
7909 int __fastcall sub_4B46F8(int a1)
Ritor1
parents:
diff changeset
7910 {
Ritor1
parents:
diff changeset
7911 int v1; // eax@1
Ritor1
parents:
diff changeset
7912 int i; // edx@1
Ritor1
parents:
diff changeset
7913
Ritor1
parents:
diff changeset
7914 v1 = 0;
Ritor1
parents:
diff changeset
7915 for ( i = 0; i < a1; ++i )
Ritor1
parents:
diff changeset
7916 v1 += i + 1;
Ritor1
parents:
diff changeset
7917 return 1000 * v1;
Ritor1
parents:
diff changeset
7918 }
Ritor1
parents:
diff changeset
7919
Ritor1
parents:
diff changeset
7920 //----- (004BC49B) --------------------------------------------------------
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
7921 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
7922 {
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7923 //unsigned int v1; // esi@1
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7924 NPCData *speakingNPC; // ebp@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7925 //unsigned int v3; // eax@1
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7926 int npc_event_id; // ecx@10
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7927 signed int v5; // edi@14
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7928 char *v6; // esi@15
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7929 const char *v7; // ecx@22
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7930 signed int v8; // edi@37
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7931 //unsigned int v9; // eax@56
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7932 unsigned int v10; // ecx@57
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7933 void *v11; // [sp-Ch] [bp-1Ch]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7934 int v12; // [sp-8h] [bp-18h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7935 char *v13; // [sp-8h] [bp-18h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7936 size_t v14; // [sp-4h] [bp-14h]@46
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7937 const char *v15; // [sp-4h] [bp-14h]@60
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7938
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7939 //v1 = _this;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7940 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 519
diff changeset
7941 //v3 = v1;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7942 uDialogueType = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7943 if (!speakingNPC->uFlags)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7944 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7945 speakingNPC->uFlags = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7946 //v3 = uDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7947 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7948
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7949 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7950 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7951 dialogue_show_profession_details = ~dialogue_show_profession_details;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7952 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7953 else if(newDialogueType == DIALOGUE_76)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7954 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7955 if (speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7956 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7957 v8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7958 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7959 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7960 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7961 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7962 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7963 ++v8;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7964 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7965 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7966 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7967 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7968 if( v8 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7969 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7970 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
7971 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7972 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7973 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7974 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7975 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
7976 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7977 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7978 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7979 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7980 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7981 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
7982 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7983 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7984 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7985 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7986 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7987 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7988 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7989 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7990 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full""
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7991 ShowStatusBarString(v7, 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7992 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7993 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7994 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7995 //v9 = v2->uProfession;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7996 if ( speakingNPC->uProfession != 51 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7997 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7998 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
7999 if ( pParty->uNumGold < v10 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8000 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8001 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8002 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8003 uDialogueType = 13;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8004 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8005 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8006 v7 = pGlobalTXT_LocalizationStrings[155];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8007 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8008 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8009 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8010 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8011 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8012 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8013 Party::TakeGold(v10);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8014 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8015 LOBYTE(speakingNPC->uFlags) |= 0x80u;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8016 if ( pParty->pHirelings[0].pName )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8017 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8018 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8019 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8020 v13 = pParty->pHireling2Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8021 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8022 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8023 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8024 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8025 v15 = speakingNPC->pName;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8026 v13 = pParty->pHireling1Name;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8027 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8028 strcpy(v13, v15);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8029 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8030 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8031
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8032 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8033
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8034 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8035 pDialogue_SpeakingActor->uAIState = Removed;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8036 if ( uActiveCharacter )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8037 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8038 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8039 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8040 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8041 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8042 ArenaFight();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8043 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8044 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8045 else if(newDialogueType == DIALOGUE_9)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8046 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8047 if ( !sub_4BB756(speakingNPC->uProfession) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8048 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8049 if ( speakingNPC->uProfession != 41 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8050 speakingNPC->bHasUsedTheAbility = 1;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8051
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8052 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8053 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8054 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8055 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8056 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!"
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8057 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8058 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8059 else if(newDialogueType == DIALOGUE_13)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8060 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8061 if (!speakingNPC->Hired())
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8062 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8063 sub_4B3E1E();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8064 dialogue_show_profession_details = false;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8065 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8066 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8067 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8068 v5 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8069 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8070 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8071 v6 = (char *)pNPCStats->pNewNPCData;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8072 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8073 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8074 ++v5;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8075 v6 += 76;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8076 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8077 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8078 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8079 if ( v5 < (signed int)pNPCStats->uNumNewNPCs )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8080 v6[8] &= 0x7Fu;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8081 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
8082 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8083 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8084 v11 = pParty->pHirelings;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8085 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8086 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
8087 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8088 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8089 v11 = &pParty->pHirelings[1];
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8090 memset(v11, 0, sizeof(NPCData));
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8091 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8092 pParty->field_709 = 0;
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
8093 pParty->CountHirelings();
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8094 dword_591084 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8095 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8096 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8097 return;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8098 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8099 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8100 else if(newDialogueType >= 19 && newDialogueType <= 24)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8101 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8102 switch(newDialogueType)
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8103 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8104 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8105 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8106 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8107 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8108 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8109 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8110 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8111 if ( (npc_event_id >= 200) && (npc_event_id <= 310) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8112 sub_4B3FE5(npc_event_id); //200-310
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8113 else if (( npc_event_id >= 400) && (npc_event_id <= 410) )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8114 { //400-410
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8115 dword_F8B1D8 = newDialogueType;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8116 DrawJoinGuildWindow(npc_event_id - 400);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8117 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8118 else
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8119 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8120 switch ( npc_event_id )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8121 {
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8122 case 139:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8123 sub_4B1ECE();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8124 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8125 case 311:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8126 sub_4BBA85_bounties();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8127 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8128 case 399:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8129 sub_4BBCDD();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8130 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8131 default:
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8132 activeLevelDecoration = (LevelDecoration*)1;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
8133 current_npc_text = 0;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8134 EventProcessor(npc_event_id, 0, 1);
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8135 activeLevelDecoration = NULL;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8136 break;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8137 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8138 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8139 }
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8140 if ( !dword_7241C8 )
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8141 pGame->Draw();
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8142 dword_7241C8 = 0;
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
8143 }
0
Ritor1
parents:
diff changeset
8144
Ritor1
parents:
diff changeset
8145 //----- (004BDAAF) --------------------------------------------------------
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8146 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx)
0
Ritor1
parents:
diff changeset
8147 {
Ritor1
parents:
diff changeset
8148 int v6; // edx@8
Ritor1
parents:
diff changeset
8149 int v7; // edx@9
Ritor1
parents:
diff changeset
8150 int v8; // edx@10
Ritor1
parents:
diff changeset
8151 unsigned __int8 v9; // zf@16
Ritor1
parents:
diff changeset
8152 char v10; // sf@16
Ritor1
parents:
diff changeset
8153 unsigned __int8 v11; // of@16
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8154 bool test;
0
Ritor1
parents:
diff changeset
8155
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8156 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771)
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8157 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen())
0
Ritor1
parents:
diff changeset
8158 return 0;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8159 switch( p2DEvents[_2da_idx - 1].uType )
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8160 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8161 case BildingType_WeaponShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8162 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8163 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8164 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8165 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8166 case BildingType_ArmorShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8167 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8168 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8169 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8170 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8171 case BildingType_MagicShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8172 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8173 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8174 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8175 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8176 case BildingType_AlchemistShop:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8177 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8178 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8179 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8180 || (signed int)item->uItemID < 740) && item->uItemID != 771);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8181 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8182 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8183 default:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8184 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8185 test = false;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8186 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8187 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
8188 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8189 return test;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8190 /*
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8191 if ( p2DEvents[a2 - 1].uType == 1 )
0
Ritor1
parents:
diff changeset
8192 {
Ritor1
parents:
diff changeset
8193 v11 = __OFSUB__(v5, 2);
Ritor1
parents:
diff changeset
8194 v9 = v5 == 2;
Ritor1
parents:
diff changeset
8195 v10 = v5 - 2 < 0;
Ritor1
parents:
diff changeset
8196 goto LABEL_23;
Ritor1
parents:
diff changeset
8197 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8198 if ( p2DEvents[a2 - 1].uType > 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8199 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8200 if ( p2DEvents[a2 - 1].uType == 3 )
0
Ritor1
parents:
diff changeset
8201 {
Ritor1
parents:
diff changeset
8202 if ( pItemsTable->pItems[v4].uSkillType != 38 )
Ritor1
parents:
diff changeset
8203 return v5 == 16;
Ritor1
parents:
diff changeset
8204 return 1;
Ritor1
parents:
diff changeset
8205 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8206 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 )
0
Ritor1
parents:
diff changeset
8207 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8208 if ( p2DEvents[a2 - 1].uType == 4)
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8209 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8210 if ( v5 < 13 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8211 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8212 if ( v5 <= 14 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8213 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8214 if ( v5 != 17 || (signed int)v3 < 740 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8215 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8216 v11 = __OFSUB__(v3, 771);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8217 v9 = v3 == 771;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8218 v10 = ((v3 - 771) & 0x80000000u) != 0;
0
Ritor1
parents:
diff changeset
8219 LABEL_23:
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8220 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8221 return 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8222 return 1;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8223 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8224 }
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8225 if ( p2DEvents[a2 - 1].uType == 2 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8226 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8227 if ( v5 >= 3 )
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8228 {
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8229 v11 = __OFSUB__(v5, 9);
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8230 v9 = v5 == 9;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8231 v10 = v5 - 9 < 0;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8232 goto LABEL_23;
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8233 }
0
Ritor1
parents:
diff changeset
8234 }
Ritor1
parents:
diff changeset
8235 return 0;
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
8236 */
0
Ritor1
parents:
diff changeset
8237 }
Ritor1
parents:
diff changeset
8238
Ritor1
parents:
diff changeset
8239 //----- (004B6478) --------------------------------------------------------
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8240 void sub_4B6478()
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8241 {
0
Ritor1
parents:
diff changeset
8242 GUIWindow *v0; // ebx@1
Ritor1
parents:
diff changeset
8243 Player *v1; // edi@1
Ritor1
parents:
diff changeset
8244 unsigned int v2; // eax@1
Ritor1
parents:
diff changeset
8245 signed int v3; // esi@1
Ritor1
parents:
diff changeset
8246 int v4; // ebx@1
Ritor1
parents:
diff changeset
8247 unsigned int v5; // esi@5
Ritor1
parents:
diff changeset
8248 int v6; // edi@6
Ritor1
parents:
diff changeset
8249 int result; // eax@13
Ritor1
parents:
diff changeset
8250 GUIWindow *v8; // ebx@17
Ritor1
parents:
diff changeset
8251 int v9; // eax@17
Ritor1
parents:
diff changeset
8252 int v10; // ecx@17
Ritor1
parents:
diff changeset
8253 unsigned int v11; // ecx@18
Ritor1
parents:
diff changeset
8254 int v12; // eax@20
Ritor1
parents:
diff changeset
8255 int v13; // eax@21
Ritor1
parents:
diff changeset
8256 GUIButton *v14; // esi@27
Ritor1
parents:
diff changeset
8257 int v15; // ecx@27
Ritor1
parents:
diff changeset
8258 unsigned int v16; // eax@28
Ritor1
parents:
diff changeset
8259 const char *v17; // ebx@29
Ritor1
parents:
diff changeset
8260 int v18; // eax@29
Ritor1
parents:
diff changeset
8261 unsigned int v19; // ecx@29
Ritor1
parents:
diff changeset
8262 int v20; // eax@29
Ritor1
parents:
diff changeset
8263 unsigned __int16 v21; // ax@29
Ritor1
parents:
diff changeset
8264 unsigned __int16 v22; // ST14_2@36
Ritor1
parents:
diff changeset
8265 int v23; // eax@36
Ritor1
parents:
diff changeset
8266 const char *v24; // ST18_4@37
Ritor1
parents:
diff changeset
8267 unsigned __int16 v25; // ST14_2@37
Ritor1
parents:
diff changeset
8268 int v26; // eax@37
Ritor1
parents:
diff changeset
8269 int v27; // [sp-4h] [bp-80h]@8
Ritor1
parents:
diff changeset
8270 GUIWindow v28; // [sp+Ch] [bp-70h]@1
Ritor1
parents:
diff changeset
8271 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
Ritor1
parents:
diff changeset
8272 unsigned int v30; // [sp+64h] [bp-18h]@1
Ritor1
parents:
diff changeset
8273 int v31; // [sp+68h] [bp-14h]@1
Ritor1
parents:
diff changeset
8274 int v32; // [sp+6Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
8275 int v33; // [sp+70h] [bp-Ch]@17
Ritor1
parents:
diff changeset
8276 int v34; // [sp+74h] [bp-8h]@17
Ritor1
parents:
diff changeset
8277 int v35; // [sp+78h] [bp-4h]@17
Ritor1
parents:
diff changeset
8278
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8279 v0 = window_SpeakInHouse;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 328
diff changeset
8280 memcpy(&v28, window_SpeakInHouse, sizeof(v28));
0
Ritor1
parents:
diff changeset
8281 v1 = pPlayers[uActiveCharacter];
Ritor1
parents:
diff changeset
8282 v28.uFrameX = 483;
Ritor1
parents:
diff changeset
8283 v28.uFrameWidth = 148;
Ritor1
parents:
diff changeset
8284 v28.uFrameZ = 334;
949
Nomad
parents: 948
diff changeset
8285 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
Nomad
parents: 948
diff changeset
8286 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
0
Ritor1
parents:
diff changeset
8287 v2 = 52 * (unsigned int)v0->ptr_1C;
Ritor1
parents:
diff changeset
8288 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
Ritor1
parents:
diff changeset
8289 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
Ritor1
parents:
diff changeset
8290 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
Ritor1
parents:
diff changeset
8291 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
Ritor1
parents:
diff changeset
8292 v4 = v3 * (100 - v1->GetMerchant()) / 100;
Ritor1
parents:
diff changeset
8293 v32 = v4;
Ritor1
parents:
diff changeset
8294 if ( v4 < v3 / 3 )
Ritor1
parents:
diff changeset
8295 {
Ritor1
parents:
diff changeset
8296 v4 = v3 / 3;
Ritor1
parents:
diff changeset
8297 v32 = v3 / 3;
Ritor1
parents:
diff changeset
8298 }
749
f39fbeb65b28 Fixed bought items not disappearing from Armourer.
Nomad
parents: 747
diff changeset
8299 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
0
Ritor1
parents:
diff changeset
8300 {
Ritor1
parents:
diff changeset
8301 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
Ritor1
parents:
diff changeset
8302 {
Ritor1
parents:
diff changeset
8303 v5 = 0;
Ritor1
parents:
diff changeset
8304
Ritor1
parents:
diff changeset
8305 __debugbreak();
Ritor1
parents:
diff changeset
8306 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
Ritor1
parents:
diff changeset
8307 // or
Ritor1
parents:
diff changeset
8308 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
Ritor1
parents:
diff changeset
8309 // or
Ritor1
parents:
diff changeset
8310 //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
8311 __debugbreak(); // whacky condition - fix
0
Ritor1
parents:
diff changeset
8312 if (false
Ritor1
parents:
diff changeset
8313 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
8314 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
0
Ritor1
parents:
diff changeset
8315 {
Ritor1
parents:
diff changeset
8316 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
8317 }
Ritor1
parents:
diff changeset
8318 else
Ritor1
parents:
diff changeset
8319 {
Ritor1
parents:
diff changeset
8320 if ( pParty->uNumGold < v4 )
Ritor1
parents:
diff changeset
8321 {
Ritor1
parents:
diff changeset
8322 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
Ritor1
parents:
diff changeset
8323 v27 = 4;
Ritor1
parents:
diff changeset
8324 }
Ritor1
parents:
diff changeset
8325 else
Ritor1
parents:
diff changeset
8326 {
Ritor1
parents:
diff changeset
8327 Party::TakeGold(v4);
Ritor1
parents:
diff changeset
8328 *(short *)v6 = 1;
Ritor1
parents:
diff changeset
8329 v27 = 2;
Ritor1
parents:
diff changeset
8330 }
735
6daaa2f18d0d Fixed some house sounds & shop-related stuff
Nomad
parents: 734
diff changeset
8331 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
0
Ritor1
parents:
diff changeset
8332 }
Ritor1
parents:
diff changeset
8333 }
Ritor1
parents:
diff changeset
8334 else
Ritor1
parents:
diff changeset
8335 {
Ritor1
parents:
diff changeset
8336 v5 = 0;
Ritor1
parents:
diff changeset
8337 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8338 /*result = pMessageQueue_50CBD0->uNumMessages;
0
Ritor1
parents:
diff changeset
8339 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
Ritor1
parents:
diff changeset
8340 {
990
087a9af8e0ec MessageParam
Ritor1
parents: 981
diff changeset
8341 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
8342 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
Ritor1
parents:
diff changeset
8343 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
Ritor1
parents:
diff changeset
8344 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
Ritor1
parents:
diff changeset
8345 ++pMessageQueue_50CBD0->uNumMessages;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8346 }*/
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 435
diff changeset
8347 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8348 return; // void func
0
Ritor1
parents:
diff changeset
8349 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
8350 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
8351 {
Ritor1
parents:
diff changeset
8352 v24 = pNPCTopics[171].pText;
Ritor1
parents:
diff changeset
8353 v25 = v31;
Ritor1
parents:
diff changeset
8354 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
Ritor1
parents:
diff changeset
8355 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
Ritor1
parents:
diff changeset
8356 pDialogueWindow->pNumPresenceButton = 0;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8357 return ;
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8358 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8359
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8360 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8361 return;
0
Ritor1
parents:
diff changeset
8362 v8 = pDialogueWindow;
Ritor1
parents:
diff changeset
8363 v33 = 0;
Ritor1
parents:
diff changeset
8364 v34 = 0;
Ritor1
parents:
diff changeset
8365 v29 = pDialogueWindow;
Ritor1
parents:
diff changeset
8366 v9 = pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8367 v10 = v9 + pDialogueWindow->pNumPresenceButton;
Ritor1
parents:
diff changeset
8368 v35 = pDialogueWindow->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8369 if ( v9 >= v10 )
Ritor1
parents:
diff changeset
8370 goto LABEL_40;
Ritor1
parents:
diff changeset
8371 do
Ritor1
parents:
diff changeset
8372 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
8373 v11 = v8->GetControl(v35)->msg_param - 36;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8374 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
0
Ritor1
parents:
diff changeset
8375 {
Ritor1
parents:
diff changeset
8376 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
Ritor1
parents:
diff changeset
8377 v33 += v12;
Ritor1
parents:
diff changeset
8378 ++v34;
Ritor1
parents:
diff changeset
8379 }
Ritor1
parents:
diff changeset
8380 v13 = v8->pStartingPosActiveItem;
Ritor1
parents:
diff changeset
8381 ++v35;
Ritor1
parents:
diff changeset
8382 }
Ritor1
parents:
diff changeset
8383 while ( v35 < v8->pNumPresenceButton + v13 );
Ritor1
parents:
diff changeset
8384 if ( !v34 )
Ritor1
parents:
diff changeset
8385 {
Ritor1
parents:
diff changeset
8386 LABEL_40:
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8387 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
0
Ritor1
parents:
diff changeset
8388 strcat(pTmpBuf, "\n \n");
Ritor1
parents:
diff changeset
8389 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
Ritor1
parents:
diff changeset
8390 v22 = v31;
Ritor1
parents:
diff changeset
8391 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8392 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8393 return;
0
Ritor1
parents:
diff changeset
8394 }
Ritor1
parents:
diff changeset
8395 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
Ritor1
parents:
diff changeset
8396 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
Ritor1
parents:
diff changeset
8397 v32 = (149 - v33) / v34;
Ritor1
parents:
diff changeset
8398 if ( (149 - v33) / v34 > 32 )
Ritor1
parents:
diff changeset
8399 v32 = 32;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8400
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8401 v35 = v8->pStartingPosActiveItem;
0
Ritor1
parents:
diff changeset
8402 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8403 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
0
Ritor1
parents:
diff changeset
8404 {
Ritor1
parents:
diff changeset
8405 v33 = 2;
Ritor1
parents:
diff changeset
8406 do
Ritor1
parents:
diff changeset
8407 {
Ritor1
parents:
diff changeset
8408 v14 = v8->GetControl(v35);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
8409 v15 = v14->msg_param - 36;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 130
diff changeset
8410 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
0
Ritor1
parents:
diff changeset
8411 {
Ritor1
parents:
diff changeset
8412 v16 = 0;
Ritor1
parents:
diff changeset
8413 if ( !v1->pActiveSkills[v15] )
Ritor1
parents:
diff changeset
8414 {
Ritor1
parents:
diff changeset
8415 v17 = pSkillNames[v15];
Ritor1
parents:
diff changeset
8416 v14->uY = v32 + v34;
Ritor1
parents:
diff changeset
8417 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
Ritor1
parents:
diff changeset
8418 v19 = v14->uY;
Ritor1
parents:
diff changeset
8419 v14->uHeight = v18;
Ritor1
parents:
diff changeset
8420 v20 = v19 + v18 - 1;
Ritor1
parents:
diff changeset
8421 v14->uW = v20;
Ritor1
parents:
diff changeset
8422 v34 = v20;
Ritor1
parents:
diff changeset
8423 v21 = v31;
Ritor1
parents:
diff changeset
8424 if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
Ritor1
parents:
diff changeset
8425 v21 = v30;
Ritor1
parents:
diff changeset
8426 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
Ritor1
parents:
diff changeset
8427 goto LABEL_34;
Ritor1
parents:
diff changeset
8428 }
Ritor1
parents:
diff changeset
8429 }
Ritor1
parents:
diff changeset
8430 else
Ritor1
parents:
diff changeset
8431 {
Ritor1
parents:
diff changeset
8432 v16 = 0;
Ritor1
parents:
diff changeset
8433 }
Ritor1
parents:
diff changeset
8434 v14->uW = v16;
Ritor1
parents:
diff changeset
8435 v14->uHeight = v16;
Ritor1
parents:
diff changeset
8436 v14->uY = v16;
Ritor1
parents:
diff changeset
8437 LABEL_34:
Ritor1
parents:
diff changeset
8438 v8 = v29;
Ritor1
parents:
diff changeset
8439 ++v35;
Ritor1
parents:
diff changeset
8440 ++v33;
711
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8441 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8442 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8443 }
a5e587c8e30e some cleaning
Gloval
parents: 706
diff changeset
8444 return;
0
Ritor1
parents:
diff changeset
8445 }
Ritor1
parents:
diff changeset
8446
Ritor1
parents:
diff changeset
8447 //----- (00405CFF) --------------------------------------------------------
Ritor1
parents:
diff changeset
8448 void stru262_TurnBased::End(bool bPlaySound)
Ritor1
parents:
diff changeset
8449 {
Ritor1
parents:
diff changeset
8450 stru262_TurnBased *v2; // edi@1
Ritor1
parents:
diff changeset
8451 int v3; // ebx@1
Ritor1
parents:
diff changeset
8452 int v4; // esi@1
Ritor1
parents:
diff changeset
8453 unsigned __int8 v5; // zf@1
Ritor1
parents:
diff changeset
8454 unsigned __int8 v6; // sf@1
Ritor1
parents:
diff changeset
8455 TurnBased_QueueElem *v7; // ecx@2
Ritor1
parents:
diff changeset
8456 unsigned __int16 *pAttributes; // ecx@7
Ritor1
parents:
diff changeset
8457 size_t v9; // edx@7
Ritor1
parents:
diff changeset
8458 unsigned __int16 v10; // ax@8
Ritor1
parents:
diff changeset
8459 TurnBased_QueueElem *v11; // ebx@12
Ritor1
parents:
diff changeset
8460 ObjectType objType; // eax@13
Ritor1
parents:
diff changeset
8461 int objID; // esi@13
Ritor1
parents:
diff changeset
8462 int v14; // [sp+Ch] [bp-4h]@11
Ritor1
parents:
diff changeset
8463
Ritor1
parents:
diff changeset
8464 v2 = this;
Ritor1
parents:
diff changeset
8465 v3 = 0;
Ritor1
parents:
diff changeset
8466 v4 = 0;
Ritor1
parents:
diff changeset
8467 v5 = this->uActorQueueSize == 0;
Ritor1
parents:
diff changeset
8468 v6 = this->uActorQueueSize < 0;
Ritor1
parents:
diff changeset
8469 this->field_4 = 0;
Ritor1
parents:
diff changeset
8470 if ( !(v6 | v5) )
Ritor1
parents:
diff changeset
8471 {
Ritor1
parents:
diff changeset
8472 v7 = this->pQueue;
Ritor1
parents:
diff changeset
8473 do
Ritor1
parents:
diff changeset
8474 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
8475 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor )
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
8476 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu;
0
Ritor1
parents:
diff changeset
8477 ++v4;
Ritor1
parents:
diff changeset
8478 ++v7;
Ritor1
parents:
diff changeset
8479 }
Ritor1
parents:
diff changeset
8480 while ( v4 < v2->uActorQueueSize );
Ritor1
parents:
diff changeset
8481 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
8482 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
8483 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
8484 pAttributes = &pSpriteObjects[0].uAttributes;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
8485 v9 = uNumSpriteObjects;
0
Ritor1
parents:
diff changeset
8486 do
Ritor1
parents:
diff changeset
8487 {
Ritor1
parents:
diff changeset
8488 v10 = *pAttributes;
Ritor1
parents:
diff changeset
8489 if ( *pAttributes & 4 )
Ritor1
parents:
diff changeset
8490 {
Ritor1
parents:
diff changeset
8491 LOBYTE(v10) = v10 & 0xFB;
Ritor1
parents:
diff changeset
8492 *pAttributes = v10;
Ritor1
parents:
diff changeset
8493 }
Ritor1
parents:
diff changeset
8494 pAttributes += 56;
Ritor1
parents:
diff changeset
8495 --v9;
Ritor1
parents:
diff changeset
8496 }
Ritor1
parents:
diff changeset
8497 while ( v9 );
Ritor1
parents:
diff changeset
8498 }
Ritor1
parents:
diff changeset
8499 v14 = 0;
Ritor1
parents:
diff changeset
8500 if ( v2->uActorQueueSize > 0 )
Ritor1
parents:
diff changeset
8501 {
Ritor1
parents:
diff changeset
8502 v11 = v2->pQueue;
Ritor1
parents:
diff changeset
8503 do
Ritor1
parents:
diff changeset
8504 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
8505 objType = (ObjectType)PID_TYPE(v11->uPackedID);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
8506 objID = PID_ID(v11->uPackedID);
0
Ritor1
parents:
diff changeset
8507 if ( objType == OBJECT_Player )
Ritor1
parents:
diff changeset
8508 {
Ritor1
parents:
diff changeset
8509 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333);
Ritor1
parents:
diff changeset
8510 }
Ritor1
parents:
diff changeset
8511 else
Ritor1
parents:
diff changeset
8512 {
Ritor1
parents:
diff changeset
8513 if ( objType == OBJECT_Actor )
Ritor1
parents:
diff changeset
8514 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333);
Ritor1
parents:
diff changeset
8515 }
Ritor1
parents:
diff changeset
8516 ++v14;
Ritor1
parents:
diff changeset
8517 ++v11;
Ritor1
parents:
diff changeset
8518 }
Ritor1
parents:
diff changeset
8519 while ( v14 < v2->uActorQueueSize );
Ritor1
parents:
diff changeset
8520 v3 = 0;
Ritor1
parents:
diff changeset
8521 }
Ritor1
parents:
diff changeset
8522 pAudioPlayer->StopChannels(-1, -1);
Ritor1
parents:
diff changeset
8523 if ( bPlaySound != v3 )
Ritor1
parents:
diff changeset
8524 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3);
Ritor1
parents:
diff changeset
8525 pTurnEngine->field_18 &= 0xFFFFFFFDu;
Ritor1
parents:
diff changeset
8526 pEventTimer->StopGameTime();
Ritor1
parents:
diff changeset
8527 dword_50C994 = v3;
Ritor1
parents:
diff changeset
8528 dword_50C998_turnbased_icon_1A = v3;
Ritor1
parents:
diff changeset
8529 }
Ritor1
parents:
diff changeset
8530 // 50C994: using guessed type int dword_50C994;
Ritor1
parents:
diff changeset
8531 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
Ritor1
parents:
diff changeset
8532
Ritor1
parents:
diff changeset
8533 //----- (00405E14) --------------------------------------------------------
Ritor1
parents:
diff changeset
8534 void stru262_TurnBased::_405E14()
Ritor1
parents:
diff changeset
8535 {
Ritor1
parents:
diff changeset
8536 stru262_TurnBased *v1; // esi@1
Ritor1
parents:
diff changeset
8537 int v2; // ecx@1
Ritor1
parents:
diff changeset
8538 SpellBuff *v3; // edi@2
Ritor1
parents:
diff changeset
8539 Actor *v4; // ebx@3
Ritor1
parents:
diff changeset
8540 signed int v5; // edx@20
Ritor1
parents:
diff changeset
8541 AIDirection *v6; // esi@21
Ritor1
parents:
diff changeset
8542 int v7; // eax@21
Ritor1
parents:
diff changeset
8543 int v8; // eax@21
Ritor1
parents:
diff changeset
8544 int v9; // eax@22
Ritor1
parents:
diff changeset
8545 int v10; // eax@23
Ritor1
parents:
diff changeset
8546 int v11; // eax@37
Ritor1
parents:
diff changeset
8547 int v12; // eax@44
Ritor1
parents:
diff changeset
8548 AIDirection a3; // [sp+4h] [bp-68h]@21
Ritor1
parents:
diff changeset
8549 AIDirection v14; // [sp+20h] [bp-4Ch]@21
Ritor1
parents:
diff changeset
8550 AIDirection v15; // [sp+3Ch] [bp-30h]@21
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8551 Actor *v16; // [sp+58h] [bp-14h]@2
0
Ritor1
parents:
diff changeset
8552 int v17; // [sp+5Ch] [bp-10h]@6
Ritor1
parents:
diff changeset
8553 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1
Ritor1
parents:
diff changeset
8554 int v19; // [sp+64h] [bp-8h]@8
Ritor1
parents:
diff changeset
8555 unsigned int v20; // [sp+68h] [bp-4h]@1
Ritor1
parents:
diff changeset
8556
Ritor1
parents:
diff changeset
8557 v1 = this;
Ritor1
parents:
diff changeset
8558 v2 = 0;
Ritor1
parents:
diff changeset
8559 v18 = v1;
Ritor1
parents:
diff changeset
8560 v20 = 0;
Ritor1
parents:
diff changeset
8561 if ( (signed int)uNumActors > 0 )
Ritor1
parents:
diff changeset
8562 {
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8563 //v3 = pActors;//[0].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8564 v16 = pActors;//[0].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8565 v3 = v16->pActorBuffs;
0
Ritor1
parents:
diff changeset
8566 do
Ritor1
parents:
diff changeset
8567 {
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8568 v4 = v16;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8569 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 )
0
Ritor1
parents:
diff changeset
8570 v17 = v2;
Ritor1
parents:
diff changeset
8571 else
Ritor1
parents:
diff changeset
8572 v17 = 1;
Ritor1
parents:
diff changeset
8573 v19 = v2;
Ritor1
parents:
diff changeset
8574 do
Ritor1
parents:
diff changeset
8575 {
Ritor1
parents:
diff changeset
8576 if ( v19 != 10 )
Ritor1
parents:
diff changeset
8577 {
Ritor1
parents:
diff changeset
8578 v3->_4585CA(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
8579 v2 = 0;
Ritor1
parents:
diff changeset
8580 }
Ritor1
parents:
diff changeset
8581 ++v19;
Ritor1
parents:
diff changeset
8582 ++v3;
Ritor1
parents:
diff changeset
8583 }
Ritor1
parents:
diff changeset
8584 while ( v19 < 22 );
Ritor1
parents:
diff changeset
8585 if ( v17 != v2
Ritor1
parents:
diff changeset
8586 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2
Ritor1
parents:
diff changeset
8587 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) )
Ritor1
parents:
diff changeset
8588 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight;
Ritor1
parents:
diff changeset
8589 if ( !(v4->uAttributes & 0x80) )
Ritor1
parents:
diff changeset
8590 {
Ritor1
parents:
diff changeset
8591 if ( !v4->pActorBuffs[5].uExpireTime )
Ritor1
parents:
diff changeset
8592 {
Ritor1
parents:
diff changeset
8593 if ( !v4->pActorBuffs[6].uExpireTime )
Ritor1
parents:
diff changeset
8594 {
Ritor1
parents:
diff changeset
8595 v5 = v4->uCurrentActionLength;
Ritor1
parents:
diff changeset
8596 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed;
Ritor1
parents:
diff changeset
8597 if ( (signed int)v4->uCurrentActionTime >= v5 )
Ritor1
parents:
diff changeset
8598 {
417
55684f4eda73 Actor::SelectTarget & ai_near_actors_targets_pid
Nomad
parents: 414
diff changeset
8599 v17 = ai_near_actors_targets_pid[v20];
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
8600 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2);
0
Ritor1
parents:
diff changeset
8601 v7 = v4->uAIState;
Ritor1
parents:
diff changeset
8602 memcpy(&v15, v6, sizeof(v15));
Ritor1
parents:
diff changeset
8603 v8 = v7 - 4;
Ritor1
parents:
diff changeset
8604 memcpy(&v14, &v15, sizeof(v14));
Ritor1
parents:
diff changeset
8605 if ( v8 )
Ritor1
parents:
diff changeset
8606 {
Ritor1
parents:
diff changeset
8607 v9 = v8 - 1;
Ritor1
parents:
diff changeset
8608 if ( v9 )
Ritor1
parents:
diff changeset
8609 {
Ritor1
parents:
diff changeset
8610 v10 = v9 - 6;
Ritor1
parents:
diff changeset
8611 if ( v10 )
Ritor1
parents:
diff changeset
8612 {
Ritor1
parents:
diff changeset
8613 if ( v10 != 8 )
414
d8b3056df4e2 AI_Bored
Nomad
parents: 410
diff changeset
8614 Actor::AI_StandOrBored(v20, v17, 32, &v14);
0
Ritor1
parents:
diff changeset
8615 }
Ritor1
parents:
diff changeset
8616 }
Ritor1
parents:
diff changeset
8617 }
Ritor1
parents:
diff changeset
8618 else
Ritor1
parents:
diff changeset
8619 {
Ritor1
parents:
diff changeset
8620 v4->uCurrentActionTime = 0;
Ritor1
parents:
diff changeset
8621 v4->uCurrentActionLength = 0;
Ritor1
parents:
diff changeset
8622 v4->uAIState = Dead;
Ritor1
parents:
diff changeset
8623 v4->UpdateAnimation();
Ritor1
parents:
diff changeset
8624 }
Ritor1
parents:
diff changeset
8625 v1 = v18;
Ritor1
parents:
diff changeset
8626 v2 = 0;
Ritor1
parents:
diff changeset
8627 }
Ritor1
parents:
diff changeset
8628 }
Ritor1
parents:
diff changeset
8629 }
Ritor1
parents:
diff changeset
8630 }
Ritor1
parents:
diff changeset
8631 ++v20;
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8632 v3 = v16[1].pActorBuffs;
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
8633 ++v16;
0
Ritor1
parents:
diff changeset
8634 }
Ritor1
parents:
diff changeset
8635 while ( (signed int)v20 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
8636 }
Ritor1
parents:
diff changeset
8637 if ( v1->field_4 == 1 )
Ritor1
parents:
diff changeset
8638 {
Ritor1
parents:
diff changeset
8639 v12 = v1->field_8;
Ritor1
parents:
diff changeset
8640 if ( v12 == 64 )
Ritor1
parents:
diff changeset
8641 {
Ritor1
parents:
diff changeset
8642 v1->_406A63();
Ritor1
parents:
diff changeset
8643 }
Ritor1
parents:
diff changeset
8644 else
Ritor1
parents:
diff changeset
8645 {
Ritor1
parents:
diff changeset
8646 if ( v12 > v2 )
Ritor1
parents:
diff changeset
8647 {
Ritor1
parents:
diff changeset
8648 v1->_406B9F();
Ritor1
parents:
diff changeset
8649 }
Ritor1
parents:
diff changeset
8650 else
Ritor1
parents:
diff changeset
8651 {
Ritor1
parents:
diff changeset
8652 v1->_406AFE();
Ritor1
parents:
diff changeset
8653 v1->field_10 = 100;
Ritor1
parents:
diff changeset
8654 }
Ritor1
parents:
diff changeset
8655 }
Ritor1
parents:
diff changeset
8656 v1->field_8 -= pEventTimer->uTimeElapsed;
Ritor1
parents:
diff changeset
8657 return;
Ritor1
parents:
diff changeset
8658 }
Ritor1
parents:
diff changeset
8659 if ( v1->field_4 == 2 )
Ritor1
parents:
diff changeset
8660 {
Ritor1
parents:
diff changeset
8661 if ( !(v1->field_18 & 1) )
Ritor1
parents:
diff changeset
8662 {
Ritor1
parents:
diff changeset
8663 v11 = v1->field_10;
Ritor1
parents:
diff changeset
8664 if ( v11 == 100 )
Ritor1
parents:
diff changeset
8665 {
Ritor1
parents:
diff changeset
8666 v1->StartTurn();
Ritor1
parents:
diff changeset
8667 LABEL_39:
Ritor1
parents:
diff changeset
8668 v1->_40652A();
Ritor1
parents:
diff changeset
8669 return;
Ritor1
parents:
diff changeset
8670 }
Ritor1
parents:
diff changeset
8671 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 )
Ritor1
parents:
diff changeset
8672 {
Ritor1
parents:
diff changeset
8673 v1->_4065B0();
Ritor1
parents:
diff changeset
8674 goto LABEL_39;
Ritor1
parents:
diff changeset
8675 }
Ritor1
parents:
diff changeset
8676 }
Ritor1
parents:
diff changeset
8677 v1->NextTurn();
Ritor1
parents:
diff changeset
8678 return;
Ritor1
parents:
diff changeset
8679 }
Ritor1
parents:
diff changeset
8680 if ( v1->field_4 == 3 )
Ritor1
parents:
diff changeset
8681 {
Ritor1
parents:
diff changeset
8682 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 )
Ritor1
parents:
diff changeset
8683 {
Ritor1
parents:
diff changeset
8684 v1->field_18 &= 0xFFFFFFF7u;
Ritor1
parents:
diff changeset
8685 v1->field_4 = 1;
Ritor1
parents:
diff changeset
8686 v1->field_8 = 64;
Ritor1
parents:
diff changeset
8687 }
Ritor1
parents:
diff changeset
8688 else
Ritor1
parents:
diff changeset
8689 {
Ritor1
parents:
diff changeset
8690 v1->_406FA8();
Ritor1
parents:
diff changeset
8691 }
Ritor1
parents:
diff changeset
8692 }
Ritor1
parents:
diff changeset
8693 }
Ritor1
parents:
diff changeset
8694
Ritor1
parents:
diff changeset
8695 //----- (0043FDED) --------------------------------------------------------
Ritor1
parents:
diff changeset
8696 void PrepareActorRenderList_BLV()
Ritor1
parents:
diff changeset
8697 {
Ritor1
parents:
diff changeset
8698 RenderBillboard *v0; // esi@0
Ritor1
parents:
diff changeset
8699 unsigned __int16 v3; // ax@3
Ritor1
parents:
diff changeset
8700 unsigned int v4; // eax@5
Ritor1
parents:
diff changeset
8701 unsigned __int16 v5; // cx@5
Ritor1
parents:
diff changeset
8702 int v6; // esi@5
Ritor1
parents:
diff changeset
8703 unsigned int v7; // eax@7
Ritor1
parents:
diff changeset
8704 int v8; // eax@10
Ritor1
parents:
diff changeset
8705 SpriteFrame *v9; // eax@16
Ritor1
parents:
diff changeset
8706 SpriteFrame *v10; // ebx@18
Ritor1
parents:
diff changeset
8707 //int *v11; // eax@18
Ritor1
parents:
diff changeset
8708 int v12; // ecx@28
Ritor1
parents:
diff changeset
8709 //IndoorCameraD3D **v14; // eax@36
Ritor1
parents:
diff changeset
8710 double v15; // st7@36
Ritor1
parents:
diff changeset
8711 float v16; // eax@36
Ritor1
parents:
diff changeset
8712 //double v17; // ST30_8@36
Ritor1
parents:
diff changeset
8713 signed __int64 v18; // qtt@36
Ritor1
parents:
diff changeset
8714 int v19; // ST5C_4@36
Ritor1
parents:
diff changeset
8715 signed __int64 v20; // qtt@37
Ritor1
parents:
diff changeset
8716 int v21; // ST5C_4@37
Ritor1
parents:
diff changeset
8717 signed __int16 v22; // cx@39
Ritor1
parents:
diff changeset
8718 int v23; // ST50_4@40
Ritor1
parents:
diff changeset
8719 signed int v24; // ecx@40
Ritor1
parents:
diff changeset
8720 int v25; // edx@44
Ritor1
parents:
diff changeset
8721 __int16 v26; // ax@44
Ritor1
parents:
diff changeset
8722 //MonsterDesc *v27; // edx@44
Ritor1
parents:
diff changeset
8723 //int v28; // ecx@44
Ritor1
parents:
diff changeset
8724 unsigned __int8 v29; // zf@44
Ritor1
parents:
diff changeset
8725 unsigned __int8 v30; // sf@44
Ritor1
parents:
diff changeset
8726 unsigned int v31; // [sp-8h] [bp-5Ch]@15
Ritor1
parents:
diff changeset
8727 int v32; // [sp+1Ch] [bp-38h]@5
Ritor1
parents:
diff changeset
8728 int a3; // [sp+20h] [bp-34h]@5
Ritor1
parents:
diff changeset
8729 int a2; // [sp+24h] [bp-30h]@5
Ritor1
parents:
diff changeset
8730 int a1a; // [sp+28h] [bp-2Ch]@5
Ritor1
parents:
diff changeset
8731 __int16 a5; // [sp+2Ch] [bp-28h]@5
Ritor1
parents:
diff changeset
8732 int a5a; // [sp+2Ch] [bp-28h]@36
Ritor1
parents:
diff changeset
8733 int a5b; // [sp+2Ch] [bp-28h]@40
Ritor1
parents:
diff changeset
8734 __int16 v41; // [sp+3Ch] [bp-18h]@18
Ritor1
parents:
diff changeset
8735 int a6; // [sp+40h] [bp-14h]@34
Ritor1
parents:
diff changeset
8736 int v43; // [sp+44h] [bp-10h]@34
Ritor1
parents:
diff changeset
8737 int z; // [sp+48h] [bp-Ch]@32
Ritor1
parents:
diff changeset
8738 signed int y; // [sp+4Ch] [bp-8h]@32
Ritor1
parents:
diff changeset
8739 int x; // [sp+50h] [bp-4h]@32
Ritor1
parents:
diff changeset
8740
Ritor1
parents:
diff changeset
8741 for (uint i = 0; i < uNumActors; ++i)
Ritor1
parents:
diff changeset
8742 {
Ritor1
parents:
diff changeset
8743 auto p = pActors + i;
Ritor1
parents:
diff changeset
8744
Ritor1
parents:
diff changeset
8745 if (p->uAIState == Removed ||
Ritor1
parents:
diff changeset
8746 p->uAIState == Disabled)
Ritor1
parents:
diff changeset
8747 continue;
Ritor1
parents:
diff changeset
8748
Ritor1
parents:
diff changeset
8749 a5 = p->uSectorID;
Ritor1
parents:
diff changeset
8750 a2 = p->vPosition.y;
Ritor1
parents:
diff changeset
8751 a1a = p->vPosition.x;
Ritor1
parents:
diff changeset
8752 a3 = p->vPosition.z;
Ritor1
parents:
diff changeset
8753 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y);
Ritor1
parents:
diff changeset
8754 LOWORD(v0) = p->uYawAngle;
Ritor1
parents:
diff changeset
8755 v5 = p->uCurrentActionAnimation;
Ritor1
parents:
diff changeset
8756 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7;
Ritor1
parents:
diff changeset
8757 v32 = v6;
Ritor1
parents:
diff changeset
8758 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
8759 {
Ritor1
parents:
diff changeset
8760 if ( v5 == 1 )
Ritor1
parents:
diff changeset
8761 {
Ritor1
parents:
diff changeset
8762 v7 = pMiscTimer->uTotalGameTimeElapsed;
Ritor1
parents:
diff changeset
8763 goto LABEL_10;
Ritor1
parents:
diff changeset
8764 }
Ritor1
parents:
diff changeset
8765 }
Ritor1
parents:
diff changeset
8766 else
Ritor1
parents:
diff changeset
8767 {
Ritor1
parents:
diff changeset
8768 if ( v5 == 1 )
Ritor1
parents:
diff changeset
8769 {
Ritor1
parents:
diff changeset
8770 v7 = pBLVRenderParams->field_0_timer_;
Ritor1
parents:
diff changeset
8771 LABEL_10:
Ritor1
parents:
diff changeset
8772 v8 = i * 32 + v7;
Ritor1
parents:
diff changeset
8773 goto LABEL_12;
Ritor1
parents:
diff changeset
8774 }
Ritor1
parents:
diff changeset
8775 }
Ritor1
parents:
diff changeset
8776 v8 = p->uCurrentActionTime;
Ritor1
parents:
diff changeset
8777 LABEL_12:
Ritor1
parents:
diff changeset
8778 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 )
Ritor1
parents:
diff changeset
8779 v8 = 0;
Ritor1
parents:
diff changeset
8780 v31 = p->pSpriteIDs[v5];
Ritor1
parents:
diff changeset
8781 if (p->uAIState == Resurrected)
Ritor1
parents:
diff changeset
8782 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8);
Ritor1
parents:
diff changeset
8783 else
Ritor1
parents:
diff changeset
8784 v9 = pSpriteFrameTable->GetFrame(v31, v8);
Ritor1
parents:
diff changeset
8785 v41 = 0;
Ritor1
parents:
diff changeset
8786 v10 = v9;
Ritor1
parents:
diff changeset
8787 //v11 = (int *)v9->uFlags;
Ritor1
parents:
diff changeset
8788 if (v9->uFlags & 2)
Ritor1
parents:
diff changeset
8789 v41 = 2;
Ritor1
parents:
diff changeset
8790 if (v9->uFlags & 0x40000)
Ritor1
parents:
diff changeset
8791 v41 |= 0x40u;
Ritor1
parents:
diff changeset
8792 if (v9->uFlags & 0x20000)
Ritor1
parents:
diff changeset
8793 LOBYTE(v41) = v41 | 0x80;
Ritor1
parents:
diff changeset
8794 v0 = (RenderBillboard *)(256 << v6);
Ritor1
parents:
diff changeset
8795 if ( (unsigned int)v0 & v9->uFlags)
Ritor1
parents:
diff changeset
8796 v41 |= 4u;
Ritor1
parents:
diff changeset
8797 if ( v10->uGlowRadius )
Ritor1
parents:
diff changeset
8798 {
Ritor1
parents:
diff changeset
8799 //LOBYTE(v11) = byte_4E94D3;
Ritor1
parents:
diff changeset
8800 pMobileLightsStack->AddLight(
Ritor1
parents:
diff changeset
8801 a1a,
Ritor1
parents:
diff changeset
8802 a2,
Ritor1
parents:
diff changeset
8803 a3,
Ritor1
parents:
diff changeset
8804 a5,
Ritor1
parents:
diff changeset
8805 v10->uGlowRadius,
Ritor1
parents:
diff changeset
8806 0xFFu,
Ritor1
parents:
diff changeset
8807 0xFFu,
Ritor1
parents:
diff changeset
8808 0xFFu,
Ritor1
parents:
diff changeset
8809 byte_4E94D3);
Ritor1
parents:
diff changeset
8810 }
Ritor1
parents:
diff changeset
8811 v12 = 0;
Ritor1
parents:
diff changeset
8812 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 )
Ritor1
parents:
diff changeset
8813 continue;
Ritor1
parents:
diff changeset
8814 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID)
Ritor1
parents:
diff changeset
8815 {
Ritor1
parents:
diff changeset
8816 ++v12;
Ritor1
parents:
diff changeset
8817 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors )
Ritor1
parents:
diff changeset
8818 goto _continue;
Ritor1
parents:
diff changeset
8819 }
Ritor1
parents:
diff changeset
8820 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1)
Ritor1
parents:
diff changeset
8821 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) )
Ritor1
parents:
diff changeset
8822 continue;
Ritor1
parents:
diff changeset
8823 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6);
Ritor1
parents:
diff changeset
8824 v0 = &pBillboardRenderList[uNumBillboardsToDraw];
Ritor1
parents:
diff changeset
8825 if (uNumBillboardsToDraw >= 500)
Ritor1
parents:
diff changeset
8826 break;
Ritor1
parents:
diff changeset
8827 ++uNumBillboardsToDraw;
Ritor1
parents:
diff changeset
8828 ++uNumSpritesDrawnThisFrame;
Ritor1
parents:
diff changeset
8829 p->uAttributes |= 8u;
Ritor1
parents:
diff changeset
8830 v29 = pRenderer->pRenderD3D == 0;
Ritor1
parents:
diff changeset
8831 v0->uHwSpriteID = v10->pHwSpriteIDs[v32];
Ritor1
parents:
diff changeset
8832 v0->uPalette = v10->uPaletteIndex;
Ritor1
parents:
diff changeset
8833 v0->uIndoorSectorID = a5;
Ritor1
parents:
diff changeset
8834 if ( v29 )
Ritor1
parents:
diff changeset
8835 {
Ritor1
parents:
diff changeset
8836 LODWORD(v20) = pBLVRenderParams->field_40 << 16;
Ritor1
parents:
diff changeset
8837 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16;
Ritor1
parents:
diff changeset
8838 v21 = v20 / x;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8839 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16;
0
Ritor1
parents:
diff changeset
8840 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16;
Ritor1
parents:
diff changeset
8841 }
Ritor1
parents:
diff changeset
8842 else
Ritor1
parents:
diff changeset
8843 {
Ritor1
parents:
diff changeset
8844 //v14 = &pGame->pIndoorCameraD3D;
Ritor1
parents:
diff changeset
8845 v0->fov_x = pGame->pIndoorCameraD3D->fov_x;
Ritor1
parents:
diff changeset
8846 v15 = pGame->pIndoorCameraD3D->fov_y;
Ritor1
parents:
diff changeset
8847 v16 = v0->fov_x;
Ritor1
parents:
diff changeset
8848 v0->fov_y = v15;
Ritor1
parents:
diff changeset
8849 //v17 = v16 + 6.7553994e15;
Ritor1
parents:
diff changeset
8850 LODWORD(v18) = 0;
Ritor1
parents:
diff changeset
8851 HIDWORD(v18) = floorf(v16 + 0.5f);
Ritor1
parents:
diff changeset
8852 v19 = v18 / x;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8853 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16;
0
Ritor1
parents:
diff changeset
8854 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16;
Ritor1
parents:
diff changeset
8855 }
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8856 v0->_screenspace_y_scaler_packedfloat = a5a;
0
Ritor1
parents:
diff changeset
8857 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 )
Ritor1
parents:
diff changeset
8858 {
Ritor1
parents:
diff changeset
8859 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 )
Ritor1
parents:
diff changeset
8860 {
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8861 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
8862 goto LABEL_43;
Ritor1
parents:
diff changeset
8863 }
Ritor1
parents:
diff changeset
8864 }
Ritor1
parents:
diff changeset
8865 else
Ritor1
parents:
diff changeset
8866 {
Ritor1
parents:
diff changeset
8867 v22 = p->pActorBuffs[3].uPower;
Ritor1
parents:
diff changeset
8868 if ( v22 )
Ritor1
parents:
diff changeset
8869 {
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8870 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
8871 v24 = p->pActorBuffs[3].uPower;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8872 v0->_screenspace_x_scaler_packedfloat = v23;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8873 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16;
0
Ritor1
parents:
diff changeset
8874 LABEL_43:
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 141
diff changeset
8875 v0->_screenspace_y_scaler_packedfloat = a5b;
0
Ritor1
parents:
diff changeset
8876 goto LABEL_44;
Ritor1
parents:
diff changeset
8877 }
Ritor1
parents:
diff changeset
8878 }
Ritor1
parents:
diff changeset
8879 LABEL_44:
Ritor1
parents:
diff changeset
8880 HIWORD(v25) = HIWORD(x);
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
8881 v0->world_x = a1a;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
8882 v0->world_y = a2;
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 425
diff changeset
8883 v0->world_z = a3;
0
Ritor1
parents:
diff changeset
8884 v0->uScreenSpaceX = v43;
Ritor1
parents:
diff changeset
8885 v0->uScreenSpaceY = a6;
Ritor1
parents:
diff changeset
8886 LOWORD(v25) = 0;
Ritor1
parents:
diff changeset
8887 LOBYTE(v26) = v41;
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
8888
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
8889 //v0->sZValue = v25 + (PID(OBJECT_Actor,i));
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
8890 v0->actual_z = HIWORD(x);
862
f4394e320312 * PID mistake fixed
zipi
parents: 860
diff changeset
8891 v0->object_pid = PID(OBJECT_Actor,i);
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 190
diff changeset
8892
0
Ritor1
parents:
diff changeset
8893 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0;
Ritor1
parents:
diff changeset
8894 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0;
Ritor1
parents:
diff changeset
8895 v0->field_1E = v41;
Ritor1
parents:
diff changeset
8896 v0->pSpriteFrame = v10;
Ritor1
parents:
diff changeset
8897 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor;
Ritor1
parents:
diff changeset
8898 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) )
Ritor1
parents:
diff changeset
8899 {
Ritor1
parents:
diff changeset
8900 HIBYTE(v26) = HIBYTE(v41) | 1;
Ritor1
parents:
diff changeset
8901 v0->field_1E = v26;
Ritor1
parents:
diff changeset
8902 }
Ritor1
parents:
diff changeset
8903
Ritor1
parents:
diff changeset
8904 _continue:
Ritor1
parents:
diff changeset
8905 ;
Ritor1
parents:
diff changeset
8906 }
Ritor1
parents:
diff changeset
8907 }
Ritor1
parents:
diff changeset
8908
Ritor1
parents:
diff changeset
8909 //----- (00444732) --------------------------------------------------------
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8910 char *GetEventHintString(unsigned int uEventID)
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8911 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8912 signed int event_index; // edx@1
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8913 int event_pos; // esi@4
0
Ritor1
parents:
diff changeset
8914 char *result; // eax@6
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8915 unsigned int str_index; // eax@9
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8916 int i; // esi@11
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8917 _evt_raw* test_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8918 _evt_raw* last_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8919
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8920 event_index = 0;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8921 if ( uLevelEVT_NumEvents <= 0 )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8922 return NULL;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8923
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8924 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
0
Ritor1
parents:
diff changeset
8925 while ( 1 )
Ritor1
parents:
diff changeset
8926 {
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8927 if ( pLevelEVT_Index[event_index].uEventID == uEventID )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8928 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8929 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8930 last_evt=test_evt;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8931 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8932 if ( test_evt->_e_type == EVENT_MouseOver )
0
Ritor1
parents:
diff changeset
8933 break;
Ritor1
parents:
diff changeset
8934 }
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8935 ++event_index;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8936 if ( event_index >= uLevelEVT_NumEvents )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8937 return NULL;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8938 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8939 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8940 if ( test_evt->_e_type== EVENT_SpeakInHouse )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8941 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8942 str_index = EVT_DWORD(test_evt->v5);
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8943 result = (char *)p2DEvents[str_index - 1].pName;
0
Ritor1
parents:
diff changeset
8944 }
Ritor1
parents:
diff changeset
8945 else
Ritor1
parents:
diff changeset
8946 {
428
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8947 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8948 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8949 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8950 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8951 if ( test_evt->_e_type == EVENT_SpeakInHouse )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8952 {
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8953 str_index = EVT_DWORD(test_evt->v5);
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8954 if ( str_index < 600 )
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8955 return (char *)p2DEvents[str_index - 1].pName;
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8956 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8957 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8958 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8959 }
24936a5ff8ca level hints
Gloval
parents: 425
diff changeset
8960
0
Ritor1
parents:
diff changeset
8961 return result;
Ritor1
parents:
diff changeset
8962 }