comparison mm7_2.cpp @ 576:1bd8758f50b8

Слияние
author Ritor1
date Mon, 04 Mar 2013 09:22:38 +0600
parents 0ca16f606be8
children b8339415fa98 9caf59edb1ee
comparison
equal deleted inserted replaced
575:cf366ba68de5 576:1bd8758f50b8
19 #include "Allocator.h" 19 #include "Allocator.h"
20 #include "Events.h" 20 #include "Events.h"
21 #include "Viewport.h" 21 #include "Viewport.h"
22 #include "FrameTableInc.h" 22 #include "FrameTableInc.h"
23 #include "Math.h" 23 #include "Math.h"
24 #include "LayingItem.h" 24 #include "SpriteObject.h"
25 #include "ObjectList.h" 25 #include "ObjectList.h"
26 #include "Chest.h" 26 #include "Chest.h"
27 #include "PaletteManager.h" 27 #include "PaletteManager.h"
28 #include "DecorationList.h" 28 #include "DecorationList.h"
29 #include "SaveLoad.h" 29 #include "SaveLoad.h"
30 #include "stru123.h" 30 #include "stru123.h"
31 #include "stru287.h" 31 #include "stru287.h"
32 #include "stru176.h"
32 #include "Time.h" 33 #include "Time.h"
33 #include "IconFrameTable.h" 34 #include "IconFrameTable.h"
34 #include "GUIProgressBar.h" 35 #include "GUIProgressBar.h"
35 #include "Bink_Smacker.h" 36 #include "Bink_Smacker.h"
36 #include "TileFrameTable.h" 37 #include "TileFrameTable.h"
51 #include "stru159.h" 52 #include "stru159.h"
52 #include "Log.h" 53 #include "Log.h"
53 #include "texts.h" 54 #include "texts.h"
54 55
55 #include "mm7_data.h" 56 #include "mm7_data.h"
57 #include "MM7.h"
56 58
57 59
58 //----- (004B4F4F) -------------------------------------------------------- 60 //----- (004B4F4F) --------------------------------------------------------
59 char *__cdecl JailDialog() 61 char *__cdecl JailDialog()
60 { 62 {
146 _this.uFrameZ = 334; 148 _this.uFrameZ = 334;
147 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 149 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
148 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 150 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
149 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); 151 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
150 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); 152 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
151 if ( dword_F8B19C == 1 ) 153 switch(dword_F8B19C)
152 { 154 {
153 v11 = 1; 155 case 1:
154 pOutString = 0; 156 {
155 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; 157 v11 = 1;
156 if ( pParty->uFine ) 158 pOutString = 0;
157 { 159 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
158 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; 160 if ( pParty->uFine )
159 v11 = 2; 161 {
160 } 162 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
161 for ( i = 0; i < v11; ++i ) 163 v11 = 2;
162 { 164 }
163 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); 165 for ( i = 0; i < v11; ++i )
164 pOutString = (GUIFont *)((char *)pOutString + v13); 166 {
165 } 167 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
166 v29 = (100 - (signed int)pOutString) / v11; 168 pOutString = (GUIFont *)((char *)pOutString + v13);
167 v14 = pDialogueWindow; 169 }
168 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; 170 v29 = (100 - (signed int)pOutString) / v11;
169 v16 = v15 - HIDWORD(v15); 171 v14 = pDialogueWindow;
170 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; 172 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
171 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; 173 v16 = v15 - HIDWORD(v15);
172 v17 = (v16 >> 1) - v29 / 2 + 158; 174 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
173 v18 = -pDialogueWindow->pNumPresenceButton < 0; 175 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
174 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; 176 v17 = (v16 >> 1) - v29 / 2 + 158;
175 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) 177 v18 = -pDialogueWindow->pNumPresenceButton < 0;
176 { 178 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
177 v31 = 2; 179 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
178 v19 = pShopOptions; 180 {
179 do 181 v31 = 2;
180 { 182 v19 = pShopOptions;
181 v20 = v14->GetControl((unsigned int)pOutString); 183 do
182 v21 = v20; 184 {
183 v20->uY = v29 + v17; 185 v20 = v14->GetControl((unsigned int)pOutString);
184 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); 186 v21 = v20;
185 v23 = v21->uY; 187 v20->uY = v29 + v17;
186 v21->uHeight = v22; 188 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
187 v17 = v23 + v22 - 1; 189 v23 = v21->uY;
188 v21->uW = v17; 190 v21->uHeight = v22;
189 v24 = v30; 191 v17 = v23 + v22 - 1;
190 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) 192 v21->uW = v17;
191 v24 = v28; 193 v24 = v30;
192 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); 194 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
193 v14 = pDialogueWindow; 195 v24 = v28;
194 ++v31; 196 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
195 ++v19; 197 v14 = pDialogueWindow;
196 pOutString = (GUIFont *)((char *)pOutString + 1); 198 ++v31;
197 } 199 ++v19;
198 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 200 pOutString = (GUIFont *)((char *)pOutString + 1);
199 } 201 }
200 } 202 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
201 else 203 }
202 { 204 break;
203 if ( dword_F8B19C != 99 ) 205 }
204 { 206 case 99:
205 if ( dword_F8B19C != 100 ) 207 {
206 return; 208 v5 = &pMonsterStats->pInfos[word_F8B1A0];
207 v0 = window_SpeakInHouse; 209 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
208 if ( window_SpeakInHouse->field_40 == 1 ) 210 v7 = v5->pName;
209 { 211 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
210 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); 212 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
211 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); 213 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
212 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 214 ptr_F8B1E8 = pTmpBuf2;
213 v3 = pFontArrus; 215 memcpy(&a1, pDialogueWindow, sizeof(a1));
214 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 216 w.uFrameWidth = 458;
215 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); 217 w.uFrameZ = 457;
216 return; 218 pOutString = pFontArrus;
217 } 219 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
218 if ( window_SpeakInHouse->field_40 == 2 ) 220 if ( 352 - v9 < 8 )
219 { 221 {
220 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 222 pOutString = pFontCreate;
221 v2 = v1; 223 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
222 if ( v1 <= 0 ) 224 }
223 { 225
224 LABEL_8: 226 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
225 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 227 pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
226 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 228 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
227 { 229 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
228 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 230 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
229 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 231 break;
230 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 232 }
231 ++pMessageQueue_50CBD0->uNumMessages; 233 case 100:
232 }*/ 234 {
233 return; 235 v0 = window_SpeakInHouse;
234 } 236 if ( window_SpeakInHouse->field_40 == 1 )
235 if ( v1 > pParty->uNumGold ) 237 {
236 { 238 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
237 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 239 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
238 v2 = pParty->uNumGold; 240 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
239 } 241 v3 = pFontArrus;
240 if ( v2 > pParty->uFine ) 242 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
241 v2 = pParty->uFine; 243 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
242 Party::TakeGold(v2); 244 return;
243 pParty->uFine -= v2; 245 }
244 if ( pParty->uFine < 0 ) 246 if ( window_SpeakInHouse->field_40 == 2 )
245 pParty->uFine = 0; 247 {
246 if ( uActiveCharacter ) 248 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
247 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); 249 v2 = v1;
248 v0 = window_SpeakInHouse; 250 if ( v1 <= 0 )
249 } 251 {
250 else 252 //LABEL_8:
251 { 253 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
252 if ( window_SpeakInHouse->field_40 != 3 ) 254 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
253 return; 255 {
254 } 256 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
255 v0->field_40 = 0; 257 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
256 goto LABEL_8; 258 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
257 } 259 ++pMessageQueue_50CBD0->uNumMessages;
258 v5 = &pMonsterStats->pInfos[word_F8B1A0]; 260 }*/
259 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 261 return;
260 v7 = v5->pName; 262 }
261 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 263 if ( v1 > pParty->uNumGold )
262 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); 264 {
263 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); 265 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
264 ptr_F8B1E8 = pTmpBuf2; 266 v2 = pParty->uNumGold;
265 memcpy(&a1, pDialogueWindow, sizeof(a1)); 267 }
266 w.uFrameWidth = 458; 268 if ( v2 > pParty->uFine )
267 w.uFrameZ = 457; 269 v2 = pParty->uFine;
268 pOutString = pFontArrus; 270 Party::TakeGold(v2);
269 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; 271 pParty->uFine -= v2;
270 if ( 352 - v9 < 8 ) 272 if ( pParty->uFine < 0 )
271 { 273 pParty->uFine = 0;
272 pOutString = pFontCreate; 274 if ( uActiveCharacter )
273 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; 275 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
274 } 276 v0 = window_SpeakInHouse;
275 277 }
276 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); 278 if ( window_SpeakInHouse->field_40 == 3 )
277 pRenderer->_4A6A68( 279 {
278 8u, 280 v0->field_40 = 0;
279 352 - v9, 281 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
280 pTex, 282 }
281 (pTex ? pTex->uTextureHeight : 26) - v9); 283 break;
282 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); 284 }
283 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); 285 default:
284 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); 286 {
285 } 287 break;
288 }
289 }
290 return;
286 } 291 }
287 // F8B19C: using guessed type int dword_F8B19C; 292 // F8B19C: using guessed type int dword_F8B19C;
288 // F8B1A0: using guessed type __int16 word_F8B1A0; 293 // F8B1A0: using guessed type __int16 word_F8B1A0;
289 294
290 //----- (004B7D7E) -------------------------------------------------------- 295 //----- (004B7D7E) --------------------------------------------------------
312 _this.uFrameZ = 334; 317 _this.uFrameZ = 334;
313 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 318 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
314 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 319 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
315 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); 320 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
316 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); 321 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
317 if ( dword_F8B19C != 1 ) 322 switch(dword_F8B19C)
318 { 323 {
319 if ( dword_F8B19C == 7 ) 324 case 1:
320 { 325 {
321 v0 = window_SpeakInHouse; 326 v8 = v14[0];
322 if ( window_SpeakInHouse->field_40 != 1 ) 327 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
323 { 328 v8 = v13[0];
324 v1 = window_SpeakInHouse->field_40 - 2; 329 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
325 if ( window_SpeakInHouse->field_40 == 2 ) 330 v9 = v14[0];
326 { 331 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
327 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 332 v9 = v13[0];
328 v7 = v6; 333 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
329 if ( !v6 ) 334 break;
330 { 335 }
331 LABEL_17: 336 case 7:
332 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 337 {
333 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 338 v0 = window_SpeakInHouse;
334 { 339 if ( window_SpeakInHouse->field_40 != 1 )
335 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 340 {
336 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 341 v1 = window_SpeakInHouse->field_40 - 2;
337 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 342 if ( window_SpeakInHouse->field_40 == 2 )
338 ++pMessageQueue_50CBD0->uNumMessages; 343 {
339 }*/ 344 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
340 return; 345 v7 = v6;
341 } 346 if ( !v6 )
342 if ( v6 > pParty->uNumGold ) 347 {
343 { 348 //LABEL_17:
344 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 349 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
345 v7 = pParty->uNumGold; 350 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
346 } 351 {
347 if ( v7 ) 352 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
348 { 353 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
349 Party::TakeGold(v7); 354 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
350 pParty->uNumGoldInBank += v7; 355 ++pMessageQueue_50CBD0->uNumMessages;
351 if ( uActiveCharacter ) 356 }*/
352 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); 357 return;
353 } 358 }
354 v0 = window_SpeakInHouse; 359 if ( v6 > pParty->uNumGold )
355 LABEL_16: 360 {
356 v0->field_40 = 0; 361 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
357 goto LABEL_17; 362 v7 = pParty->uNumGold;
358 } 363 }
359 LABEL_15: 364 if ( v7 )
360 if ( v1 != 1 ) 365 {
361 return; 366 Party::TakeGold(v7);
362 goto LABEL_16; 367 pParty->uNumGoldInBank += v7;
363 } 368 if ( uActiveCharacter )
364 v11 = pGlobalTXT_LocalizationStrings[112]; 369 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
365 v10 = pGlobalTXT_LocalizationStrings[60]; 370 }
366 } 371 v0 = window_SpeakInHouse;
367 else 372 v0->field_40 = 0;
368 { 373 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
369 if ( dword_F8B19C != 8 ) 374 return;
370 return; 375 }
371 v0 = window_SpeakInHouse; 376 if ( v1 != 1 )
372 if ( window_SpeakInHouse->field_40 != 1 ) 377 return;
373 { 378 v0->field_40 = 0;
374 v1 = window_SpeakInHouse->field_40 - 2; 379 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
375 if ( window_SpeakInHouse->field_40 == 2 ) 380 return;
376 { 381 }
377 window_SpeakInHouse->field_40 = 0; 382 v11 = pGlobalTXT_LocalizationStrings[112];
378 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 383 v10 = pGlobalTXT_LocalizationStrings[60];
379 v3 = v2; 384 sprintf(pTmpBuf, "%s\n%s", v10, v11);
380 if ( v2 ) 385 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
381 { 386 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
382 if ( v2 > pParty->uNumGoldInBank ) 387 v4 = pFontArrus;
383 { 388 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
384 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 389 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
385 v3 = pParty->uNumGoldInBank; 390 break;
386 } 391 }
387 if ( v3 ) 392
388 { 393 case 8:
389 Party::SetGold(pParty->uNumGold + v3); 394 {
390 pParty->uNumGoldInBank -= v3; 395 v0 = window_SpeakInHouse;
391 } 396 if ( window_SpeakInHouse->field_40 != 1 )
392 } 397 {
393 goto LABEL_17; 398 v1 = window_SpeakInHouse->field_40 - 2;
394 } 399 if ( window_SpeakInHouse->field_40 == 2 )
395 goto LABEL_15; 400 {
396 } 401 window_SpeakInHouse->field_40 = 0;
397 v11 = pGlobalTXT_LocalizationStrings[112]; 402 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
398 v10 = pGlobalTXT_LocalizationStrings[244]; 403 v3 = v2;
399 } 404 if ( v2 )
400 sprintf(pTmpBuf, "%s\n%s", v10, v11); 405 {
401 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); 406 if ( v2 > pParty->uNumGoldInBank )
402 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 407 {
403 v4 = pFontArrus; 408 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
404 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 409 v3 = pParty->uNumGoldInBank;
405 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); 410 }
406 return; 411 if ( v3 )
407 } 412 {
408 v8 = v14[0]; 413 Party::SetGold(pParty->uNumGold + v3);
409 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 414 pParty->uNumGoldInBank -= v3;
410 v8 = v13[0]; 415 }
411 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); 416 }
412 v9 = v14[0]; 417 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
413 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) 418 return;
414 v9 = v13[0]; 419 }
415 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); 420 if ( v1 != 1 )
421 return;
422 v0->field_40 = 0;
423 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
424 return;
425 }
426 v11 = pGlobalTXT_LocalizationStrings[112];
427 v10 = pGlobalTXT_LocalizationStrings[244];
428 sprintf(pTmpBuf, "%s\n%s", v10, v11);
429 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
430 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
431 v4 = pFontArrus;
432 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
433 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
434 return;
435 break;
436 }
437
438 default:
439 {
440 break;
441 }
442 }
416 } 443 }
417 // F8B19C: using guessed type int dword_F8B19C; 444 // F8B19C: using guessed type int dword_F8B19C;
418 445
419 //----- (004B8285) -------------------------------------------------------- 446 //----- (004B8285) --------------------------------------------------------
420 void __cdecl TavernDialog() 447 void __cdecl TavernDialog()
541 if ( v7 <= 0 ) 568 if ( v7 <= 0 )
542 { 569 {
543 v7 = 1; 570 v7 = 1;
544 v83 = 1; 571 v83 = 1;
545 } 572 }
546 if ( dword_F8B19C > 101 ) 573 switch(dword_F8B19C)
547 { 574 {
548 if ( dword_F8B19C == 102 ) 575 case 102:
549 { 576 {
550 v65 = pFontArrus; 577 v65 = pFontArrus;
551 pOutString = pFontArrus; 578 pOutString = pFontArrus;
552 strcpy(pTmpBuf, pNPCTopics[354].pText); 579 strcpy(pTmpBuf, pNPCTopics[354].pText);
553 v78.uFrameWidth = 460; 580 v78.uFrameWidth = 460;
554 v78.uFrameZ = 452; 581 v78.uFrameZ = 452;
555 v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; 582 v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7;
556 if ( 352 - v62 < 8 ) 583 if ( 352 - v62 < 8 )
557 { 584 {
558 pOutString = pFontCreate; 585 pOutString = pFontCreate;
559 v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; 586 v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7;
560 } 587 }
561 588
562 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); 589 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
563 pRenderer->_4A6A68( 590 pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62);
564 8u, 591
565 352 - v62, 592 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
566 pTex, 593 v73 = 0;
567 (pTex ? pTex->uTextureHeight : 26) - v62); 594 v70 = 0;
568 595 v68 = 0;
569 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); 596 v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0);
570 v73 = 0; 597 v64 = pOutString;
571 v70 = 0; 598 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
572 v68 = 0; 599 break;
573 v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); 600 }
574 v64 = pOutString; 601 case 103:
575 } 602 {
576 else 603 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
577 { 604 v78.uFrameWidth = 460;
578 if ( dword_F8B19C != 103 ) 605 v78.uFrameZ = 452;
579 { 606 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0);
580 if ( dword_F8B19C != 104 || pArcomageGame->bGameInProgress == 1 ) 607 v62 = v61 + 7;
608
609 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
610 pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
611
612 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
613 v73 = 0;
614 v70 = 0;
615 v68 = 0;
616 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0);
617 v64 = pFontArrus;
618 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
619 break;
620 }
621 case 104:
622 {
623 if ( pArcomageGame->bGameInProgress == 1 )
581 return; 624 return;
582 v26 = pTmpBuf; 625 v26 = pTmpBuf;
583 if ( pArcomageGame->uGameResult ) 626 if ( pArcomageGame->uGameResult )
584 { 627 {
585 if ( pArcomageGame->uGameResult == 1 ) 628 if ( pArcomageGame->uGameResult == 1 )
590 else 633 else
591 { 634 {
592 v72 = pGlobalTXT_LocalizationStrings[639];// A tie! 635 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
593 } 636 }
594 strcpy(pTmpBuf, v72); 637 strcpy(pTmpBuf, v72);
595 LABEL_97: 638 //LABEL_97:
596 v71 = 3; 639 v71 = 3;
597 v69 = v26; 640 v69 = v26;
598 v67 = v84[0]; 641 v67 = v84[0];
599 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; 642 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138;
600 goto LABEL_98; 643 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
601 } 644 break;
602 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); 645 }
603 v78.uFrameWidth = 460; 646 case 15:
604 v78.uFrameZ = 452; 647 {
605 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0);
606 v62 = v61 + 7;
607
608 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
609 pRenderer->_4A6A68(
610 8u,
611 352 - (v61 + 7),
612 pTex,
613 (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
614
615 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
616 v73 = 0;
617 v70 = 0;
618 v68 = 0;
619 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0);
620 v64 = pFontArrus;
621 }
622 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
623 return;
624 }
625 if ( dword_F8B19C != 101 )
626 {
627 if ( dword_F8B19C != 1 )
628 {
629 if ( dword_F8B19C == 15 )
630 {
631 if ( pParty->uNumGold >= (unsigned int)pOutString ) 648 if ( pParty->uNumGold >= (unsigned int)pOutString )
632 { 649 {
633 Party::TakeGold((unsigned int)pOutString); 650 Party::TakeGold((unsigned int)pOutString);
634 v27 = (int)window_SpeakInHouse->ptr_1C; 651 v27 = (int)window_SpeakInHouse->ptr_1C;
635 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 652 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
648 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; 665 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
649 //LABEL_51: 666 //LABEL_51:
650 ++pMessageQueue_50CBD0->uNumMessages; 667 ++pMessageQueue_50CBD0->uNumMessages;
651 return; 668 return;
652 } 669 }
653 } 670 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
654 else 671 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
655 { 672 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
656 if ( dword_F8B19C != 16 ) 673 break;
657 { 674 }
658 if ( dword_F8B19C != 96 || !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 675 case 96:
659 return; 676 {
660 v8 = pDialogueWindow; 677 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
661 *(float *)&v89 = 0.0; 678 return;
662 679 v8 = pDialogueWindow;
663 //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 680 *(float *)&v89 = 0.0;
664 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 681
665 682 //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
666 pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); 683 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
667 if ( (signed int)pOutString < v9 / 3 ) 684
668 pOutString = (GUIFont *)(v9 / 3); 685 pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100);
669 v10 = v8->pStartingPosActiveItem; 686 if ( (signed int)pOutString < v9 / 3 )
670 v11 = v10 + v8->pNumPresenceButton; 687 pOutString = (GUIFont *)(v9 / 3);
671 v86 = 0; 688 v10 = v8->pStartingPosActiveItem;
672 if ( (signed int)v10 < v11 ) 689 v11 = v10 + v8->pNumPresenceButton;
673 { 690 v86 = 0;
674 do 691 if ( (signed int)v10 < v11 )
675 { 692 {
676 v12 = v8->GetControl(v10)->uControlParam - 36; 693 do
677 if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) 694 {
678 { 695 v12 = v8->GetControl(v10)->uControlParam - 36;
679 v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); 696 if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] )
680 v89 += v13; 697 {
681 ++v86; 698 v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0);
682 } 699 v89 += v13;
683 ++v10; 700 ++v86;
684 } 701 }
685 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); 702 ++v10;
686 if ( v86 ) 703 }
687 { 704 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton );
688 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); 705 if ( v86 )
689 v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 706 {
690 pOutString = (GUIFont *)((149 - v89) / v86); 707 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString);
691 if ( (149 - v89) / v86 > 32 ) 708 v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
692 pOutString = (GUIFont *)32; 709 pOutString = (GUIFont *)((149 - v89) / v86);
693 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; 710 if ( (149 - v89) / v86 > 32 )
694 v89 = v8->pStartingPosActiveItem; 711 pOutString = (GUIFont *)32;
695 v83 = v14; 712 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162;
696 if ( v89 < v89 + v8->pNumPresenceButton ) 713 v89 = v8->pStartingPosActiveItem;
697 { 714 v83 = v14;
698 v86 = 2; 715 if ( v89 < v89 + v8->pNumPresenceButton )
699 do 716 {
700 { 717 v86 = 2;
701 v15 = v8->GetControl(v89); 718 do
702 v16 = v15; 719 {
703 v17 = v15->uControlParam - 36; 720 v15 = v8->GetControl(v89);
704 if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) 721 v16 = v15;
705 { 722 v17 = v15->uControlParam - 36;
706 v16->uW = 0; 723 if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] )
707 v16->uHeight = 0; 724 {
708 v16->uY = 0; 725 v16->uW = 0;
709 } 726 v16->uHeight = 0;
710 else 727 v16->uY = 0;
711 { 728 }
712 v18 = pSkillNames[v17]; 729 else
713 v16->uY = (unsigned int)((char *)pOutString + v83); 730 {
714 Str[1] = v18; 731 v18 = pSkillNames[v17];
715 v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); 732 v16->uY = (unsigned int)((char *)pOutString + v83);
716 v20 = v16->uY; 733 Str[1] = v18;
717 v21 = v86; 734 v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0);
718 v16->uHeight = v19; 735 v20 = v16->uY;
719 v22 = v19 + v20 - 1; 736 v21 = v86;
720 v16->uW = v22; 737 v16->uHeight = v19;
721 v83 = v22; 738 v22 = v19 + v20 - 1;
722 v23 = v84[0]; 739 v16->uW = v22;
723 if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) 740 v83 = v22;
724 v23 = v81; 741 v23 = v84[0];
725 v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); 742 if ( pDialogueWindow->pCurrentPosActiveItem != v21 )
726 } 743 v23 = v81;
727 v24 = v8->pNumPresenceButton; 744 v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u);
728 ++v89; 745 }
729 v25 = v8->pStartingPosActiveItem + v24; 746 v24 = v8->pNumPresenceButton;
730 ++v86; 747 ++v89;
731 } 748 v25 = v8->pStartingPosActiveItem + v24;
732 while ( v89 < v25 ); 749 ++v86;
733 } 750 }
734 return; 751 while ( v89 < v25 );
735 } 752 }
736 } 753 return;
737 v26 = pTmpBuf; 754 }
738 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); 755 }
739 strcat(pTmpBuf, "\n \n"); 756 v26 = pTmpBuf;
740 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 757 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]);
741 goto LABEL_97; 758 strcat(pTmpBuf, "\n \n");
742 } 759 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
760 v71 = 3;
761 v69 = v26;
762 v67 = v84[0];
763 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138;
764 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
765 return;
766 break;
767 }
768 case 16:
769 {
743 *(_QWORD *)Str = pParty->uNumFoodRations; 770 *(_QWORD *)Str = pParty->uNumFoodRations;
744 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) 771 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
745 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) 772 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
746 { 773 {
747 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); 774 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u);
748 if ( uActiveCharacter ) 775 if ( uActiveCharacter )
749 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); 776 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
750 goto LABEL_43; 777 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
778 return;
751 } 779 }
752 if ( pParty->uNumGold >= v7 ) 780 if ( pParty->uNumGold >= v7 )
753 { 781 {
754 Party::TakeGold(v7); 782 Party::TakeGold(v7);
755 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 783 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
756 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 784 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
757 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); 785 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
758 v5 = 1; 786 v5 = 1;
759 LABEL_43: 787 //LABEL_43:
760 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); 788 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
761 return; 789 return;
762 //goto LABEL_51; 790 //goto LABEL_51;
763 } 791 }
764 } 792 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
765 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 793 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
766 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); 794 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
767 goto LABEL_43; 795 break;
768 } 796 }
769 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 797 case 1:
770 return; 798 {
771 v28 = *(int *)v84; 799 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
772 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 800 return;
773 v28 = v81; 801 v28 = *(int *)v84;
774 sprintf(Dest, format_4E2DC8, v28); 802 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
775 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); 803 v28 = v81;
776 strcat(Dest, pTmpBuf2); 804 sprintf(Dest, format_4E2DC8, v28);
777 v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); 805 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
778 strcat(Dest, "\n \n"); 806 strcat(Dest, pTmpBuf2);
779 v29 = *(int *)v84; 807 v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0);
780 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) 808 strcat(Dest, "\n \n");
781 v29 = v81; 809 v29 = *(int *)v84;
782 sprintf(a1, format_4E2DC8, v29); 810 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
783 sprintf(pTmpBuf2, 811 v29 = v81;
784 pGlobalTXT_LocalizationStrings[86], 812 sprintf(a1, format_4E2DC8, v29);
785 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], 813 sprintf(pTmpBuf2,
786 (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, 814 pGlobalTXT_LocalizationStrings[86],
787 v83); 815 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C],
788 strcat(a1, pTmpBuf2); 816 (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
789 v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); 817 v83);
790 strcat(a1, "\n \n"); 818 strcat(a1, pTmpBuf2);
791 v30 = *(int *)v84; 819 v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0);
792 if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) 820 strcat(a1, "\n \n");
793 v30 = v81; 821 v30 = *(int *)v84;
794 sprintf(v77, format_4E2DC8, v30); 822 if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
795 strcat(v77, pGlobalTXT_LocalizationStrings[160]); 823 v30 = v81;
796 v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); 824 sprintf(v77, format_4E2DC8, v30);
797 strcat(v77, "\n \n"); 825 strcat(v77, pGlobalTXT_LocalizationStrings[160]);
798 v75[0] = 0; 826 v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0);
799 v87 = 0; 827 strcat(v77, "\n \n");
800 v31 = (signed int)window_SpeakInHouse->ptr_1C; 828 v75[0] = 0;
801 if ( v31 >= 108 && v31 <= 120 ) 829 v87 = 0;
802 { 830 v31 = (signed int)window_SpeakInHouse->ptr_1C;
803 v32 = *(int *)v84; 831 if ( v31 >= 108 && v31 <= 120 )
804 if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) 832 {
805 v32 = v81; 833 v32 = *(int *)v84;
806 sprintf(v75, format_4E2DC8, v32); 834 if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
807 strcat(v75, pGlobalTXT_LocalizationStrings[611]); 835 v32 = v81;
808 v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); 836 sprintf(v75, format_4E2DC8, v32);
809 } 837 strcat(v75, pGlobalTXT_LocalizationStrings[611]);
810 v33 = pDialogueWindow; 838 v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0);
811 Str[1] = (char *)pDialogueWindow; 839 }
812 v34 = pDialogueWindow->pStartingPosActiveItem; 840 v33 = pDialogueWindow;
813 v35 = v34 + pDialogueWindow->pNumPresenceButton; 841 Str[1] = (char *)pDialogueWindow;
814 v36 = LOBYTE(pFontArrus->uFontHeight) - 3; 842 v34 = pDialogueWindow->pStartingPosActiveItem;
815 v37 = -pDialogueWindow->pNumPresenceButton < 0; 843 v35 = v34 + pDialogueWindow->pNumPresenceButton;
816 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; 844 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
817 if ( !(v37 ^ __OFSUB__(v34, v35)) ) 845 v37 = -pDialogueWindow->pNumPresenceButton < 0;
818 { 846 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
819 LABEL_75: 847 if ( !(v37 ^ __OFSUB__(v34, v35)) )
820 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); 848 {
821 v71 = 3; 849 //LABEL_75:
822 v69 = pTmpBuf; 850 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
823 v67 = 0; 851 v71 = 3;
824 v66 = 146; 852 v69 = pTmpBuf;
825 LABEL_98: 853 v67 = 0;
826 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); 854 v66 = 146;
827 return; 855 //LABEL_98:
828 } 856 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
829 while ( 1 ) 857 return;
830 { 858 }
831 v38 = v33->GetControl((unsigned int)pOutString); 859 while ( 1 )
832 if ( v38->uControlParam == 15 ) 860 {
833 { 861 v38 = v33->GetControl((unsigned int)pOutString);
834 v46 = v90; 862 if ( v38->uControlParam == 15 )
835 v38->uHeight = v90; 863 {
836 v38->uY = 146; 864 v46 = v90;
837 v41 = v46 + 145; 865 v38->uHeight = v90;
838 goto LABEL_73; 866 v38->uY = 146;
839 } 867 v41 = v46 + 145;
840 if ( v38->uControlParam == 16 ) 868 v38->uW = v41;
841 { 869 }
842 v44 = v88; 870 else if ( v38->uControlParam == 16 )
843 v45 = v90 + v36 + 146; 871 {
844 v38->uHeight = v88; 872 v44 = v88;
845 v38->uY = v45; 873 v45 = v90 + v36 + 146;
846 v41 = v45 + v44 - 1; 874 v38->uHeight = v88;
847 goto LABEL_73; 875 v38->uY = v45;
848 } 876 v41 = v45 + v44 - 1;
849 if ( v38->uControlParam == 96 ) 877 v38->uW = v41;
850 break; 878 }
851 if ( v38->uControlParam == 101 ) 879 else if ( v38->uControlParam == 96 )
852 { 880 {
853 v39 = v90 + 3 * v36 + v87 + v88 + 146; 881 v42 = v90 + v88 + 2 * v36 + 146;
854 v33 = (GUIWindow *)Str[1]; 882 v43 = v82;
855 v40 = v87; 883 v38->uY = v42;
856 v38->uHeight = v87; 884 v38->uHeight = v43;
857 v38->uY = v39; 885 v41 = v43 + v42 - 1;
858 v41 = v39 + v40 - 1; 886 v38->uW = v41;
859 LABEL_73: 887 }
860 v38->uW = v41; 888 else if ( v38->uControlParam == 101 )
861 } 889 {
862 v47 = v33->pStartingPosActiveItem; 890 v39 = v90 + 3 * v36 + v87 + v88 + 146;
863 pOutString = (GUIFont *)((char *)pOutString + 1); 891 v33 = (GUIWindow *)Str[1];
864 if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) 892 v40 = v87;
865 goto LABEL_75; 893 v38->uHeight = v87;
866 } 894 v38->uY = v39;
867 v42 = v90 + v88 + 2 * v36 + 146; 895 v41 = v39 + v40 - 1;
868 v43 = v82; 896 //LABEL_73:
869 v38->uY = v42; 897 v38->uW = v41;
870 v38->uHeight = v43; 898 }
871 v41 = v43 + v42 - 1; 899 v47 = v33->pStartingPosActiveItem;
872 goto LABEL_73; 900 pOutString = (GUIFont *)((char *)pOutString + 1);
873 } 901 if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 )
874 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 902 {
875 { 903 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
876 v48 = 2; 904 v71 = 3;
877 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; 905 v69 = pTmpBuf;
878 pOutString = 0; 906 v67 = 0;
879 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; 907 v66 = 146;
880 if ( pParty->HasItem(0x28Bu) ) 908 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
881 { 909 return;
882 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; 910 }
883 v48 = 3; 911 }
884 } 912 break;
885 for ( i = 0; i < v48; ++i ) 913 }
886 { 914 case 101:
887 v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); 915 {
888 pOutString = (GUIFont *)((char *)pOutString + v50); 916 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
889 } 917 {
890 v86 = (174 - (signed int)pOutString) / v48; 918 v48 = 2;
891 v51 = pDialogueWindow; 919 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
892 v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; 920 pOutString = 0;
893 v53 = v52 - HIDWORD(v52); 921 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
894 LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; 922 if ( pParty->HasItem(0x28Bu) )
895 HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; 923 {
896 v54 = (v53 >> 1) - v86 / 2 + 138; 924 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
897 v37 = -pDialogueWindow->pNumPresenceButton < 0; 925 v48 = 3;
898 v89 = pDialogueWindow->pStartingPosActiveItem; 926 }
899 if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) 927 for ( i = 0; i < v48; ++i )
900 { 928 {
901 v85 = (Player *)2; 929 v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0);
902 pOutString = (GUIFont *)pShopOptions; 930 pOutString = (GUIFont *)((char *)pOutString + v50);
903 do 931 }
904 { 932 v86 = (174 - (signed int)pOutString) / v48;
905 v55 = v51->GetControl(v89); 933 v51 = pDialogueWindow;
906 v56 = (const char **)pOutString; 934 v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString;
907 v55->uY = v86 + v54; 935 v53 = v52 - HIDWORD(v52);
908 v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); 936 LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem;
909 v58 = v55->uY; 937 HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton;
910 v59 = v85; 938 v54 = (v53 >> 1) - v86 / 2 + 138;
911 v55->uHeight = v57; 939 v37 = -pDialogueWindow->pNumPresenceButton < 0;
912 v54 = v57 + v58 - 1; 940 v89 = pDialogueWindow->pStartingPosActiveItem;
913 v55->uW = v54; 941 if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) )
914 v60 = v84[0]; 942 {
915 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) 943 v85 = (Player *)2;
916 v60 = v81; 944 pOutString = (GUIFont *)pShopOptions;
917 v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); 945 do
918 v51 = pDialogueWindow; 946 {
919 v85 = (Player *)((char *)v85 + 1); 947 v55 = v51->GetControl(v89);
920 pOutString = (GUIFont *)((char *)pOutString + 4); 948 v56 = (const char **)pOutString;
921 ++v89; 949 v55->uY = v86 + v54;
922 } 950 v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0);
923 while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 951 v58 = v55->uY;
924 } 952 v59 = v85;
953 v55->uHeight = v57;
954 v54 = v57 + v58 - 1;
955 v55->uW = v54;
956 v60 = v84[0];
957 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 )
958 v60 = v81;
959 v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u);
960 v51 = pDialogueWindow;
961 v85 = (Player *)((char *)v85 + 1);
962 pOutString = (GUIFont *)((char *)pOutString + 4);
963 ++v89;
964 }
965 while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
966 }
967 }
968 break;
969 }
970 default:
971 {
972 break;
973 }
925 } 974 }
926 } 975 }
927 976
928 977
929 //----- (004B910F) -------------------------------------------------------- 978 //----- (004B910F) --------------------------------------------------------
1665 v104.uFrameX = 483; 1714 v104.uFrameX = 483;
1666 v104.uFrameWidth = 148; 1715 v104.uFrameWidth = 148;
1667 v104.uFrameZ = 334; 1716 v104.uFrameZ = 334;
1668 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1717 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
1669 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 1718 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
1670 if ( dword_F8B19C == 1 ) 1719 switch(dword_F8B19C)
1671 { 1720 {
1672 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1721 case 1:
1673 if ( result ) 1722 {
1674 { 1723 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1675 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; 1724 if ( result )
1676 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; 1725 {
1677 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; 1726 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
1678 v72 = 0; 1727 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
1679 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; 1728 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
1680 v73 = pShopOptions; 1729 v72 = 0;
1681 do 1730 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
1682 { 1731 v73 = pShopOptions;
1683 v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); 1732 do
1684 ++v73; 1733 {
1685 v72 += v74; 1734 v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0);
1686 } 1735 ++v73;
1687 while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); 1736 v72 += v74;
1688 v75 = pDialogueWindow; 1737 }
1689 Str = (char *)((174 - v72) / 4); 1738 while ( (signed int)v73 < (signed int)&unk_F8B1C8 );
1690 result = (POINT *)pDialogueWindow->pStartingPosActiveItem; 1739 v75 = pDialogueWindow;
1691 v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); 1740 Str = (char *)((174 - v72) / 4);
1692 v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; 1741 result = (POINT *)pDialogueWindow->pStartingPosActiveItem;
1693 v28 = -pDialogueWindow->pNumPresenceButton < 0; 1742 v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton);
1694 v112 = pDialogueWindow->pStartingPosActiveItem; 1743 v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138;
1695 if ( v28 ^ __OFSUB__((int)result, v76) ) 1744 v28 = -pDialogueWindow->pNumPresenceButton < 0;
1696 { 1745 v112 = pDialogueWindow->pStartingPosActiveItem;
1697 _this = (Player *)2; 1746 if ( v28 ^ __OFSUB__((int)result, v76) )
1698 v111 = (const char **)pShopOptions; 1747 {
1699 do 1748 _this = (Player *)2;
1700 { 1749 v111 = (const char **)pShopOptions;
1701 v78 = v75->GetControl(v112); 1750 do
1702 v79 = v111; 1751 {
1703 v78->uY = (unsigned int)&Str[v77]; 1752 v78 = v75->GetControl(v112);
1704 v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); 1753 v79 = v111;
1705 v81 = v78->uY; 1754 v78->uY = (unsigned int)&Str[v77];
1706 v82 = _this; 1755 v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0);
1707 v78->uHeight = v80; 1756 v81 = v78->uY;
1708 v77 = v81 + v80 - 1; 1757 v82 = _this;
1709 v78->uW = v77; 1758 v78->uHeight = v80;
1710 v83 = v106; 1759 v77 = v81 + v80 - 1;
1711 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) 1760 v78->uW = v77;
1712 v83 = v108; 1761 v83 = v106;
1713 v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); 1762 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 )
1714 v75 = pDialogueWindow; 1763 v83 = v108;
1715 _this = (Player *)((char *)_this + 1); 1764 v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u);
1716 ++v111; 1765 v75 = pDialogueWindow;
1717 ++v112; 1766 _this = (Player *)((char *)_this + 1);
1718 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); 1767 ++v111;
1719 } 1768 ++v112;
1720 while ( (signed int)v112 < (signed int)result ); 1769 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
1721 } 1770 }
1722 } 1771 while ( (signed int)v112 < (signed int)result );
1723 } 1772 }
1724 else 1773 }
1725 { 1774 return result;
1726 if ( dword_F8B19C != 2 ) 1775 }
1727 { 1776 case 3:
1728 if ( dword_F8B19C == 3 ) 1777 {
1729 {
1730 draw_leather(); 1778 draw_leather();
1731 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1779 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1732 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); 1780 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
1733 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1781 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1734 if ( !result 1782 if ( !result
1746 v44 = (int)window_SpeakInHouse->ptr_1C; 1794 v44 = (int)window_SpeakInHouse->ptr_1C;
1747 v113 = uActiveCharacter - 1; 1795 v113 = uActiveCharacter - 1;
1748 v45 = _this->_490EEE(v87, 4, v44, 3); 1796 v45 = _this->_490EEE(v87, 4, v44, 3);
1749 v39 = v113; 1797 v39 = v113;
1750 v38 = (char *)pMerchantsSellPhrases[v45]; 1798 v38 = (char *)pMerchantsSellPhrases[v45];
1751 goto LABEL_45; 1799 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93);
1752 } 1800 v92 = 3;
1753 if ( dword_F8B19C == 4 ) 1801 v90 = v21;
1754 { 1802 v88 = v108;
1755 draw_leather(); 1803 v86 = v3;
1804 v85 = v3;
1805 v84 = &v104;
1806 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
1807 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
1808 }
1809 case 4:
1810 {
1811 draw_leather();
1756 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1812 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1757 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); 1813 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
1758 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1814 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1759 if ( !result 1815 if ( !result
1760 || (v36 = pMouse->GetCursorPos(&a2)->x - 14, 1816 || (v36 = pMouse->GetCursorPos(&a2)->x - 14,
1774 v41 = (int)window_SpeakInHouse->ptr_1C; 1830 v41 = (int)window_SpeakInHouse->ptr_1C;
1775 v113 = uActiveCharacter - 1; 1831 v113 = uActiveCharacter - 1;
1776 v42 = _this->_490EEE(v37, 4, v41, 4); 1832 v42 = _this->_490EEE(v37, 4, v41, 4);
1777 v39 = v113; 1833 v39 = v113;
1778 v38 = (char *)pMerchantsIdentifyPhrases[v42]; 1834 v38 = (char *)pMerchantsIdentifyPhrases[v42];
1779 goto LABEL_45; 1835 }
1780 } 1836 else
1781 v89 = window_SpeakInHouse->ptr_1C; 1837 {
1782 v38 = "%24"; 1838 v89 = window_SpeakInHouse->ptr_1C;
1783 v87 = v37; 1839 v38 = "%24";
1784 LABEL_44: 1840 v87 = v37;
1785 v39 = uActiveCharacter - 1; 1841 v39 = uActiveCharacter - 1;
1786 LABEL_45: 1842 }
1787 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); 1843 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93);
1788 v92 = 3; 1844 v92 = 3;
1789 v90 = v21; 1845 v90 = v21;
1790 v88 = v108; 1846 v88 = v108;
1791 v86 = v3; 1847 v86 = v3;
1792 v85 = v3; 1848 v85 = v3;
1793 v84 = &v104; 1849 v84 = &v104;
1794 goto LABEL_46; 1850 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
1795 } 1851 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
1796 if ( dword_F8B19C == 94 ) 1852 }
1797 { 1853 case 94:
1798 draw_leather(); 1854 {
1855 draw_leather();
1799 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1856 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1800 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; 1857 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
1801 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; 1858 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
1802 v22 = 0; 1859 v22 = 0;
1803 v23 = pShopOptions; 1860 v23 = pShopOptions;
1842 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); 1899 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
1843 } 1900 }
1844 while ( (signed int)v112 < (signed int)result ); 1901 while ( (signed int)v112 < (signed int)result );
1845 } 1902 }
1846 return result; 1903 return result;
1847 } 1904 }
1848 if ( dword_F8B19C != 95 ) 1905 case 2:
1849 { 1906 {
1850 result = (POINT *)(dword_F8B19C - 96); 1907 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
1851 if ( dword_F8B19C != 96 1908 v3 = 0;
1852 || (result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) == 0 ) 1909 v114 = 0;
1853 return result; 1910 do
1911 {
1912 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
1913 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
1914 {
1915 v46 = ItemsInShopTexture[v114];
1916 v47 = 152 - v46->uTextureHeight;
1917 if ( (signed int)v47 < 1 )
1918 v47 = 0;
1919 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
1920 if ( v114 )
1921 {
1922 if ( v114 == 5 )
1923 {
1924 v49 = ItemsInShopTexture[5]->uTextureWidth;
1925 if ( (signed int)v48 > 457 - v49 )
1926 v48 = 457 - v49;
1927 }
1928 }
1929 else if ( (signed int)v48 < 18 )
1930 v48 = 18;
1931 pRenderer->DrawTextureTransparent(v48, v47, v46);
1932 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
1933 }
1934 ++v114;
1935 }
1936 while ( v114 < 6 );
1937 v114 = 0;
1938 do
1939 {
1940 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
1941 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
1942 {
1943 v50 = ItemsInShopTexture[v114 + 6];
1944 v51 = 308 - v50->uTextureHeight;
1945 if ( (signed int)v51 < 1 )
1946 v51 = 0;
1947 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
1948 if ( v114 )
1949 {
1950 if ( v114 == 5 )
1951 {
1952 v53 = ItemsInShopTexture[11]->uTextureWidth;
1953 if ( (signed int)v52 > 457 - v53 )
1954 v52 = 457 - v53;
1955 }
1956 }
1957 else
1958 {
1959 if ( (signed int)v52 < 18 )
1960 v52 = 18;
1961 }
1962 pRenderer->DrawTextureTransparent(v52, v51, v50);
1963 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
1964 }
1965 ++v114;
1966 }
1967 while ( v114 < 6 );
1968 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1969 if ( result )
1970 {
1971 v62 = 0;
1972 v109 = 0;
1973 do
1974 {
1975 // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
1976 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
1977 ++v109;
1978 ++v62;
1979 }
1980 while ( v62 < 12 );
1981 v63 = GetAsyncKeyState(17);
1982 v64 = _this->CanSteal();
1983 Str = (char *)v64;
1984 if ( v63 && v64 )
1985 {
1986 v65 = pGlobalTXT_LocalizationStrings[185];
1987 }
1988 else if ( dword_F8B19C == 2 )
1989 {
1990 v65 = pGlobalTXT_LocalizationStrings[195];
1991 }
1992 else
1993 {
1994 v65 = pGlobalTXT_LocalizationStrings[196];
1995 }
1996 DrawTextAtStatusBar(v65, 0);
1997 if ( !v109 )
1998 {
1999 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
2000 return 0;
2001 }
2002 v66 = pMouse->GetCursorPos(&v98);
2003 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]);
2004 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
2005 {
2006 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
2007 v109 = v67;
2008 v68 = (int)window_SpeakInHouse->ptr_1C;
2009 // v69 = 9 * (v67 + 12 * v68);
2010 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
2011 if ( dword_F8B19C != 2 )
2012 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
2013 if ( !v63 || !Str )
2014 {
2015 v93 = 0;
2016 v91 = 2;
2017 v89 = window_SpeakInHouse->ptr_1C;
2018 v87 = v70;
2019 v113 = uActiveCharacter - 1;
2020 v71 = _this->_490EEE(v70, 4, v68, 2);
2021 v39 = v113;
2022 v38 = (char *)pMerchantsBuyPhrases[v71];
2023 }
2024 else
2025 {
2026 v38 = pGlobalTXT_LocalizationStrings[181];
2027 v93 = 0;
2028 v91 = 2;
2029 v89 = window_SpeakInHouse->ptr_1C;
2030 v87 = v70;
2031 v39 = uActiveCharacter - 1;
2032 }
2033 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93);
2034 v92 = 3;
2035 v90 = v21;
2036 v88 = v108;
2037 v86 = v3;
2038 v85 = v3;
2039 v84 = &v104;
2040 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
2041 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
2042 }
2043 }
2044 return result;
2045 }
2046 case 95:
2047 {
2048 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
2049 v3 = 0;
2050 v114 = 0;
2051 do
2052 {
2053 //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
2054 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
2055 {
2056 v54 = ItemsInShopTexture[v114];
2057 v55 = 152 - v54->uTextureHeight;
2058 if ( (signed int)v55 < 1 )
2059 v55 = 0;
2060 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
2061 if ( v114 )
2062 {
2063 if ( v114 == 5 )
2064 {
2065 v57 = ItemsInShopTexture[5]->uTextureWidth;
2066 if ( (signed int)v56 > 457 - v57 )
2067 v56 = 457 - v57;
2068 }
2069 }
2070 else
2071 {
2072 if ( (signed int)v56 < 18 )
2073 v56 = 18;
2074 }
2075 pRenderer->DrawTextureTransparent(v56, v55, v54);
2076 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
2077 }
2078 ++v114;
2079 }
2080 while ( v114 < 6 );
2081 v114 = 0;
2082 do
2083 {
2084 // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak
2085 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
2086 {
2087 v58 = ItemsInShopTexture[v114 + 6];
2088 v59 = 308 - v58->uTextureHeight;
2089 if ( (signed int)v59 < 1 )
2090 v59 = 0;
2091 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
2092 if ( v114 )
2093 {
2094 if ( v114 == 5 )
2095 {
2096 v61 = ItemsInShopTexture[11]->uTextureWidth;
2097 if ( (signed int)v60 > 457 - v61 )
2098 v60 = 457 - v61;
2099 }
2100 }
2101 else
2102 {
2103 if ( (signed int)v60 < 18 )
2104 v60 = 18;
2105 }
2106 pRenderer->DrawTextureTransparent(v60, v59, v58);
2107 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
2108 }
2109 ++v114;
2110 }
2111 while ( v114 < 6 );
2112 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
2113 if ( result )
2114 {
2115 v62 = 0;
2116 v109 = 0;
2117 do
2118 {
2119 //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
2120 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
2121 ++v109;
2122 ++v62;
2123 }
2124 while ( v62 < 12 );
2125 v63 = GetAsyncKeyState(17);
2126 v64 = _this->CanSteal();
2127 Str = (char *)v64;
2128 if ( v63 && v64 )
2129 {
2130 v65 = pGlobalTXT_LocalizationStrings[185];
2131 }
2132 else
2133 {
2134 v65 = pGlobalTXT_LocalizationStrings[195];
2135 if ( dword_F8B19C != 2 )
2136 v65 = pGlobalTXT_LocalizationStrings[196];
2137 }
2138 DrawTextAtStatusBar(v65, 0);
2139 if ( !v109 )
2140 {
2141 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
2142 return 0;
2143 }
2144 v66 = pMouse->GetCursorPos(&v98);
2145 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]);
2146 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
2147 {
2148 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
2149 v109 = v67;
2150 v68 = (int)window_SpeakInHouse->ptr_1C;
2151 // v69 = 9 * (v67 + 12 * v68);
2152 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
2153 if ( dword_F8B19C != 2 )
2154 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
2155 if ( !v63 || !Str )
2156 {
2157 v93 = 0;
2158 v91 = 2;
2159 v89 = window_SpeakInHouse->ptr_1C;
2160 v87 = v70;
2161 v113 = uActiveCharacter - 1;
2162 v71 = _this->_490EEE(v70, 4, v68, 2);
2163 v39 = v113;
2164 v38 = (char *)pMerchantsBuyPhrases[v71];
2165 }
2166 else
2167 {
2168 v38 = pGlobalTXT_LocalizationStrings[181];
2169 v93 = 0;
2170 v91 = 2;
2171 v89 = window_SpeakInHouse->ptr_1C;
2172 v87 = v70;
2173 v39 = uActiveCharacter - 1;
2174 }
2175 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93);
2176 v92 = 3;
2177 v90 = v21;
2178 v88 = v108;
2179 v86 = v3;
2180 v85 = v3;
2181 v84 = &v104;
2182 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
2183 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
2184 }
2185 }
2186 return result;
2187 }
2188 case 96:
2189 {
2190 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
2191 return 0;
1854 v2 = pDialogueWindow; 2192 v2 = pDialogueWindow;
1855 v3 = 0; 2193 v3 = 0;
1856 v4 = window_SpeakInHouse->ptr_1C; 2194 v4 = window_SpeakInHouse->ptr_1C;
1857 v112 = 0; 2195 v112 = 0;
1858 //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); 2196 //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0);
1937 v90 = pTmpBuf; 2275 v90 = pTmpBuf;
1938 v88 = v106; 2276 v88 = v106;
1939 v86 = 0; 2277 v86 = 0;
1940 v85 = 0; 2278 v85 = 0;
1941 v84 = &v104; 2279 v84 = &v104;
1942 LABEL_46:
1943 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); 2280 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
1944 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); 2281 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
1945 } 2282 }
1946 } 2283 default:
1947 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 2284 {
1948 v3 = 0; 2285 return (POINT *)dword_F8B19C - 96;
1949 v114 = 0; 2286 }
1950 if ( dword_F8B19C == 2 ) 2287 }
1951 {
1952 do
1953 {
1954 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
1955 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID);
1956 {
1957 v46 = ItemsInShopTexture[v114];
1958 v47 = 152 - v46->uTextureHeight;
1959 if ( (signed int)v47 < 1 )
1960 v47 = 0;
1961 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
1962 if ( v114 )
1963 {
1964 if ( v114 == 5 )
1965 {
1966 v49 = ItemsInShopTexture[5]->uTextureWidth;
1967 if ( (signed int)v48 > 457 - v49 )
1968 v48 = 457 - v49;
1969 }
1970 }
1971 else
1972 {
1973 if ( (signed int)v48 < 18 )
1974 v48 = 18;
1975 }
1976 pRenderer->DrawTextureTransparent(v48, v47, v46);
1977 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
1978 }
1979 ++v114;
1980 }
1981 while ( v114 < 6 );
1982 v114 = 0;
1983 do
1984 {
1985 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
1986 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID);
1987 {
1988 v50 = ItemsInShopTexture[v114 + 6];
1989 v51 = 308 - v50->uTextureHeight;
1990 if ( (signed int)v51 < 1 )
1991 v51 = 0;
1992 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
1993 if ( v114 )
1994 {
1995 if ( v114 == 5 )
1996 {
1997 v53 = ItemsInShopTexture[11]->uTextureWidth;
1998 if ( (signed int)v52 > 457 - v53 )
1999 v52 = 457 - v53;
2000 }
2001 }
2002 else
2003 {
2004 if ( (signed int)v52 < 18 )
2005 v52 = 18;
2006 }
2007 pRenderer->DrawTextureTransparent(v52, v51, v50);
2008 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
2009 }
2010 ++v114;
2011 }
2012 while ( v114 < 6 );
2013 }
2014 else
2015 {
2016 do
2017 {
2018 //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
2019 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
2020 {
2021 v54 = ItemsInShopTexture[v114];
2022 v55 = 152 - v54->uTextureHeight;
2023 if ( (signed int)v55 < 1 )
2024 v55 = 0;
2025 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
2026 if ( v114 )
2027 {
2028 if ( v114 == 5 )
2029 {
2030 v57 = ItemsInShopTexture[5]->uTextureWidth;
2031 if ( (signed int)v56 > 457 - v57 )
2032 v56 = 457 - v57;
2033 }
2034 }
2035 else
2036 {
2037 if ( (signed int)v56 < 18 )
2038 v56 = 18;
2039 }
2040 pRenderer->DrawTextureTransparent(v56, v55, v54);
2041 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
2042 }
2043 ++v114;
2044 }
2045 while ( v114 < 6 );
2046 v114 = 0;
2047 do
2048 {
2049 // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak
2050 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid
2051 {
2052 v58 = ItemsInShopTexture[v114 + 6];
2053 v59 = 308 - v58->uTextureHeight;
2054 if ( (signed int)v59 < 1 )
2055 v59 = 0;
2056 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
2057 if ( v114 )
2058 {
2059 if ( v114 == 5 )
2060 {
2061 v61 = ItemsInShopTexture[11]->uTextureWidth;
2062 if ( (signed int)v60 > 457 - v61 )
2063 v60 = 457 - v61;
2064 }
2065 }
2066 else
2067 {
2068 if ( (signed int)v60 < 18 )
2069 v60 = 18;
2070 }
2071 pRenderer->DrawTextureTransparent(v60, v59, v58);
2072 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
2073 }
2074 ++v114;
2075 }
2076 while ( v114 < 6 );
2077 }
2078 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
2079 if ( result )
2080 {
2081 v62 = 0;
2082 v109 = 0;
2083 if ( dword_F8B19C == 2 )
2084 {
2085 do
2086 {
2087 // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
2088 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID);
2089 ++v109;
2090 ++v62;
2091 }
2092 while ( v62 < 12 );
2093 }
2094 else
2095 {
2096 do
2097 {
2098 //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
2099 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
2100 ++v109;
2101 ++v62;
2102 }
2103 while ( v62 < 12 );
2104 }
2105 v63 = GetAsyncKeyState(17);
2106 v64 = _this->CanSteal();
2107 Str = (char *)v64;
2108 if ( v63 && v64 )
2109 {
2110 v65 = pGlobalTXT_LocalizationStrings[185];
2111 }
2112 else
2113 {
2114 v65 = pGlobalTXT_LocalizationStrings[195];
2115 if ( dword_F8B19C != 2 )
2116 v65 = pGlobalTXT_LocalizationStrings[196];
2117 }
2118 DrawTextAtStatusBar(v65, 0);
2119 if ( !v109 )
2120 {
2121 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
2122 return 0;
2123 }
2124 v66 = pMouse->GetCursorPos(&v98);
2125 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]);
2126 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
2127 {
2128 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
2129 v109 = v67;
2130 v68 = (int)window_SpeakInHouse->ptr_1C;
2131 // v69 = 9 * (v67 + 12 * v68);
2132 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
2133 if ( dword_F8B19C != 2 )
2134 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
2135 if ( !v63 || !Str )
2136 {
2137 v93 = 0;
2138 v91 = 2;
2139 v89 = window_SpeakInHouse->ptr_1C;
2140 v87 = v70;
2141 v113 = uActiveCharacter - 1;
2142 v71 = _this->_490EEE(v70, 4, v68, 2);
2143 v39 = v113;
2144 v38 = (char *)pMerchantsBuyPhrases[v71];
2145 goto LABEL_45;
2146 }
2147 v38 = pGlobalTXT_LocalizationStrings[181];
2148 v93 = 0;
2149 v91 = 2;
2150 v89 = window_SpeakInHouse->ptr_1C;
2151 v87 = v70;
2152 goto LABEL_44;
2153 }
2154 }
2155 }
2156 return result;
2157 } 2288 }
2158 2289
2159 2290
2160 //----- (004BA928) -------------------------------------------------------- 2291 //----- (004BA928) --------------------------------------------------------
2161 void __cdecl ArmorShopDialog() 2292 void __cdecl ArmorShopDialog()
2187 unsigned __int8 v24; // sf@24 2318 unsigned __int8 v24; // sf@24
2188 GUIButton *v25; // eax@26 2319 GUIButton *v25; // eax@26
2189 GUIButton *v26; // esi@26 2320 GUIButton *v26; // esi@26
2190 int v27; // eax@26 2321 int v27; // eax@26
2191 unsigned int v28; // ecx@26 2322 unsigned int v28; // ecx@26
2192 Player *v29; // edx@26 2323 int v29; // edx@26
2193 unsigned __int16 v30; // ax@26 2324 unsigned __int16 v30; // ax@26
2194 signed int v31; // esi@31 2325 signed int v31; // esi@31
2195 unsigned int v32; // eax@33 2326 unsigned int v32; // eax@33
2196 int v33; // eax@34 2327 int v33; // eax@34
2197 int v34; // ST08_4@35 2328 int v34; // ST08_4@35
2356 v25 = v20->GetControl(v152); 2487 v25 = v20->GetControl(v152);
2357 v26 = v25; 2488 v26 = v25;
2358 v25->uY = v146 + v23; 2489 v25->uY = v146 + v23;
2359 v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); 2490 v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0);
2360 v28 = v26->uY; 2491 v28 = v26->uY;
2361 v29 = _this; 2492 v29 = th;
2362 v26->uHeight = v27; 2493 v26->uHeight = v27;
2363 v23 = v28 + v27 - 1; 2494 v23 = v28 + v27 - 1;
2364 v26->uW = v23; 2495 v26->uW = v23;
2365 v30 = v147; 2496 v30 = v147;
2366 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v29 ) 2497 if ( pDialogueWindow->pCurrentPosActiveItem != v29 )
2367 v30 = v148; 2498 v30 = v148;
2368 v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); 2499 v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u);
2369 v20 = pDialogueWindow; 2500 v20 = pDialogueWindow;
2370 ++th; 2501 ++th;
2371 ++v16; 2502 ++v16;
3155 3286
3156 uDialogueType = 83; 3287 uDialogueType = 83;
3157 pDialogueWindow->Release(); 3288 pDialogueWindow->Release();
3158 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); 3289 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0);
3159 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" 3290 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
3160 (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); 3291 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
3161 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); 3292 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
3162 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); 3293 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0);
3163 pDialogueWindow->_41D08F(1, 1, 0, 2); 3294 pDialogueWindow->_41D08F(1, 1, 0, 2);
3164 dword_F8B19C = -1; 3295 dword_F8B19C = -1;
3165 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); 3296 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
3297 } 3428 }
3298 pDialogueWindow->pControlsHead = 0; 3429 pDialogueWindow->pControlsHead = 0;
3299 pDialogueWindow->pControlsTail = 0; 3430 pDialogueWindow->pControlsTail = 0;
3300 pDialogueWindow->uNumControls = 0; 3431 pDialogueWindow->uNumControls = 0;
3301 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 3432 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],
3302 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); 3433 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
3303 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0); 3434 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0);
3304 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0); 3435 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0);
3305 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0); 3436 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0);
3306 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x58u, 0, "", 0); 3437 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x58u, 0, "", 0);
3307 pDialogueWindow->_41D08F(4, 1, 0, 1); 3438 pDialogueWindow->_41D08F(4, 1, 0, 1);
3681 { 3812 {
3682 pDialogueWindow->Release(); 3813 pDialogueWindow->Release();
3683 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); 3814 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
3684 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, 3815 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0,
3685 pGlobalTXT_LocalizationStrings[74], //"End Conversation" 3816 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
3686 (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : NULL), 3817 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : NULL),
3687 0); 3818 0);
3688 return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); 3819 return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0);
3689 } 3820 }
3690 3821
3691 //----- (004BCACC) -------------------------------------------------------- 3822 //----- (004BCACC) --------------------------------------------------------
3728 Player *v35; // edi@227 3859 Player *v35; // edi@227
3729 signed int v36; // esi@227 3860 signed int v36; // esi@227
3730 int v37; // ecx@227 3861 int v37; // ecx@227
3731 int v38; // esi@230 3862 int v38; // esi@230
3732 int v39; // edx@235 3863 int v39; // edx@235
3733 void *v40; // edi@243 3864 int v40; // edi@243
3734 unsigned __int64 v41; // qax@243 3865 unsigned __int64 v41; // qax@243
3735 void *v42; // eax@244 3866 void *v42; // eax@244
3736 signed int v43; // edi@244 3867 signed int v43; // edi@244
3737 int v44; // edx@244 3868 int v44; // edx@244
3738 int v45; // eax@246 3869 int v45; // eax@246
4186 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) 4317 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
4187 { 4318 {
4188 GenerateStandartShopItems(); 4319 GenerateStandartShopItems();
4189 GenerateSpecialShopItems(); 4320 GenerateSpecialShopItems();
4190 v8 = window_SpeakInHouse; 4321 v8 = window_SpeakInHouse;
4191 v40 = window_SpeakInHouse->ptr_1C; 4322 v40 = window_SpeakInHouse->par1C;
4192 //v3 = dword_F8B198; 4323 //v3 = dword_F8B198;
4193 v41 = pParty->uTimePlayed 4324 v41 = pParty->uTimePlayed
4194 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) 4325 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
4195 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) 4326 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
4196 * 0.033333335); 4327 * 0.033333335);
4197 pParty->field_3C.field_50[2 * (int)v40] = v41; 4328 pParty->field_3C.field_50[v40] = v41;
4198 pParty->field_3C.field_50[2 * (int)v40 + 1] = HIDWORD(v41); 4329
4199 } 4330 }
4200 v42 = v8->ptr_1C; 4331 v42 = v8->ptr_1C;
4201 v43 = 0; 4332 v43 = 0;
4202 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; 4333 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
4203 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; 4334 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
4302 4433
4303 if ( pMessageQueue_50CBD0->uNumMessages ) 4434 if ( pMessageQueue_50CBD0->uNumMessages )
4304 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 4435 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
4305 pKeyActionMap->_459ED1(3); 4436 pKeyActionMap->_459ED1(3);
4306 pKeyActionMap->ResetKeys(); 4437 pKeyActionMap->ResetKeys();
4307 GlobalEventInfo = 0; 4438 activeLevelDecoration = NULL;
4308 ptr_F8B1E8 = 0; 4439 ptr_F8B1E8 = 0;
4309 if ( pDialogueNPCCount ) 4440 if ( pDialogueNPCCount )
4310 { 4441 {
4311 v0 = dword_F8B19C; 4442 v0 = dword_F8B19C;
4312 if ( dword_F8B19C != 2 4443 if ( dword_F8B19C != 2
7870 unsigned __int16 v26; // ax@33 8001 unsigned __int16 v26; // ax@33
7871 //int v27; // ecx@35 8002 //int v27; // ecx@35
7872 //int v28; // eax@35 8003 //int v28; // eax@35
7873 //int v29; // esi@35 8004 //int v29; // esi@35
7874 //__int16 v30; // ax@35 8005 //__int16 v30; // ax@35
7875 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 8006 SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1
7876 //int v32; // [sp+7Ch] [bp-Ch]@1 8007 //int v32; // [sp+7Ch] [bp-Ch]@1
7877 //int v33; // [sp+80h] [bp-8h]@1 8008 //int v33; // [sp+80h] [bp-8h]@1
7878 int v34; // [sp+84h] [bp-4h]@1 8009 int v34; // [sp+84h] [bp-4h]@1
7879 8010
7880 //auto a1 = this; 8011 //auto a1 = this;
7930 if ( a2->uIndex != 6 ) 8061 if ( a2->uIndex != 6 )
7931 { 8062 {
7932 LABEL_20: 8063 LABEL_20:
7933 v15 = 0; 8064 v15 = 0;
7934 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; 8065 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
7935 a1a.uItemType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; 8066 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
7936 if ( (signed int)pObjectList->uNumObjects <= 0 ) 8067 if ( (signed int)pObjectList->uNumObjects <= 0 )
7937 { 8068 {
7938 LABEL_24: 8069 LABEL_24:
7939 v18 = 0; 8070 v18 = 0;
7940 } 8071 }
7975 result = a1a.stru_24.GenerateArtifact(); 8106 result = a1a.stru_24.GenerateArtifact();
7976 if ( !result ) 8107 if ( !result )
7977 return result; 8108 return result;
7978 v23 = 0; 8109 v23 = 0;
7979 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; 8110 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
7980 a1a.uItemType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; 8111 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
7981 if ( (signed int)pObjectList->uNumObjects <= 0 ) 8112 if ( (signed int)pObjectList->uNumObjects <= 0 )
7982 { 8113 {
7983 LABEL_33: 8114 LABEL_33:
7984 v26 = 0; 8115 v26 = 0;
7985 } 8116 }
8023 int v7; // esi@1 8154 int v7; // esi@1
8024 signed int v8; // edi@1 8155 signed int v8; // edi@1
8025 unsigned __int16 v9; // cx@1 8156 unsigned __int16 v9; // cx@1
8026 char *v10; // edx@2 8157 char *v10; // edx@2
8027 unsigned __int16 v11; // ax@5 8158 unsigned __int16 v11; // ax@5
8028 LayingItem a1; // [sp+8h] [bp-70h]@1 8159 SpriteObject a1; // [sp+8h] [bp-70h]@1
8029 8160
8030 v6 = ecx0; 8161 v6 = ecx0;
8031 v7 = a2; 8162 v7 = a2;
8032 pItemsTable->GenerateItem(v6, v7, &a1.stru_24); 8163 pItemsTable->GenerateItem(v6, v7, &a1.stru_24);
8033 v8 = 0; 8164 v8 = 0;
8034 v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; 8165 v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
8035 a1.uItemType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; 8166 a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
8036 if ( (signed int)pObjectList->uNumObjects <= 0 ) 8167 if ( (signed int)pObjectList->uNumObjects <= 0 )
8037 { 8168 {
8038 LABEL_5: 8169 LABEL_5:
8039 v11 = 0; 8170 v11 = 0;
8040 } 8171 }
9326 MapStats *v2; // esi@1 9457 MapStats *v2; // esi@1
9327 unsigned int v3; // edi@1 9458 unsigned int v3; // edi@1
9328 const char **v4; // ebx@2 9459 const char **v4; // ebx@2
9329 unsigned int result; // eax@6 9460 unsigned int result; // eax@6
9330 9461
9331 v2 = this;
9332 v3 = 1; 9462 v3 = 1;
9333 if ( (signed int)this->uNumMaps <= 1 ) 9463 if ( (signed int)uNumMaps <= 1 )
9334 { 9464 return 0;
9335 LABEL_6: 9465
9336 result = 0; 9466 while ( !*this->pInfos[v3].pFilename || _strcmpi(this->pInfos[v3].pFilename, Str2) )
9337 }
9338 else
9339 {
9340 v4 = (const char **)&this->pInfos[1].pFilename;
9341 while ( !*v4 || _strcmpi(*v4, Str2) )
9342 { 9467 {
9343 ++v3; 9468 ++v3;
9344 v4 += 17; 9469 if ( (signed int)v3 >= (signed int)uNumMaps )
9345 if ( (signed int)v3 >= (signed int)v2->uNumMaps ) 9470 return 0;
9346 goto LABEL_6; 9471 }
9347 } 9472 return v3;
9348 result = v3; 9473
9349 }
9350 return result;
9351 } 9474 }
9352 9475
9353 //----- (004547E4) -------------------------------------------------------- 9476 //----- (004547E4) --------------------------------------------------------
9354 void FactionTable::Initialize() 9477 void FactionTable::Initialize()
9355 { 9478 {
12213 _strrev(Str1); 12336 _strrev(Str1);
12214 strtok(Str1, "."); 12337 strtok(Str1, ".");
12215 _strrev(Str1); 12338 _strrev(Str1);
12216 12339
12217 for (uint i = 0; i < 1000; ++i) 12340 for (uint i = 0; i < 1000; ++i)
12218 pLayingItems[i].uObjectDescID = 0; 12341 pSpriteObjects[i].uObjectDescID = 0;
12219 12342
12220 v5 = pMapStats->GetMapInfo(pCurrentMapName); 12343 v5 = pMapStats->GetMapInfo(pCurrentMapName);
12221 bUnderwater = 0; 12344 bUnderwater = 0;
12222 uLevelMapStatsID = v5; 12345 uLevelMapStatsID = v5;
12223 pGame->uFlags2 &= 0xFFFFFFF7u; 12346 pGame->uFlags2 &= 0xFFFFFFF7u;
13126 13249
13127 13250
13128 13251
13129 13252
13130 13253
13254 void IntegrityTest()
13255 {
13256 assert(sizeof(RenderVertexSoft) == 0x30);
13257 assert(sizeof(RenderBillboard) == 0x34);
13258 assert(sizeof(Texture) == 0x48);
13259 assert(sizeof(RGBTexture) == 0x28);
13260 assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4); // + virtual dtor ptr
13261 assert(sizeof(AudioPlayer) == 0xC84);
13262 assert(sizeof(SoundDesc) == 0x78);
13263 assert(sizeof(stru339_spell_sound) == 0xAFD8);
13264 assert(sizeof(VideoPlayer) == 0x108 + 4);
13265 assert(sizeof(MovieHeader) == 0x2C);
13266 assert(sizeof(DecorationDesc) == 0x54);
13267 assert(sizeof(ObjectDesc) == 0x38);
13268 assert(sizeof(OverlayDesc) == 0x8);
13269 assert(sizeof(ChestDesc) == 0x24);
13270 assert(sizeof(TileDesc) == 0x1A);
13271 assert(sizeof(MonsterDesc) == 0x98);
13272 assert(sizeof(Timer) == 0x28);
13273 assert(sizeof(OtherOverlay) == 0x14);
13274 assert(sizeof(ItemGen) == 0x24);
13275 assert(sizeof(SpriteObject) == 0x70);
13276 assert(sizeof(ItemDesc) == 0x30);
13277 assert(sizeof(ItemsTable) == 0x117A0);
13278 assert(sizeof(Chest) == 0x14CC);
13279 assert(sizeof(MapInfo) == 0x44);
13280 assert(sizeof(SpellInfo) == 0x24);
13281 assert(sizeof(SpellData) == 0x14);
13282 assert(sizeof(SpellBuff) == 0x10);
13283 assert(sizeof(AIDirection) == 0x1C);
13284 assert(sizeof(ActorJob) == 0xC);
13285 assert(sizeof(Actor) == 0x344);
13286 assert(sizeof(LevelDecoration) == 0x20);
13287 assert(sizeof(KeyboardActionMapping) == 0x20C);
13288 assert(sizeof(UIAnimation) == 0xD);
13289 assert(sizeof(SpawnPointMM7) == 0x18);
13290 assert(sizeof(ODMFace) == 0x134);
13291 assert(sizeof(BSPNode) == 0x8);
13292 assert(sizeof(BSPModel) == 0xBC);
13293 assert(sizeof(OutdoorLocation) == 0x1C28C);
13294 assert(sizeof(BLVFace) == 0x60);
13295 assert(sizeof(BLVFaceExtra) == 0x24);
13296 assert(sizeof(BLVSector) == 0x74);
13297 assert(sizeof(BLVLightMM7) == 0x10);
13298 assert(sizeof(BLVDoor) == 0x50);
13299 assert(sizeof(IndoorLocation) == 0x690);
13300 assert(sizeof(OutdoorCamera) == 0x74);
13301 assert(sizeof(Mouse) == 0x114);
13302 assert(sizeof(Particle_) == 0x68);
13303 assert(sizeof(Particle) == 0x68);
13304 assert(sizeof(ParticleEngine) == 0xE430);
13305 assert(sizeof(Lightmap) == 0xC1C);
13306 assert(sizeof(LightmapBuilder) == 0x3CBC38);
13307 assert(sizeof(Vis_SelectionList) == 0x2008);
13308 assert(sizeof(Vis) == 0x20D0);
13309 assert(sizeof(PlayerBuffAnim) == 0x10);
13310 assert(sizeof(ProjectileAnim) == 0x1C);
13311 assert(sizeof(stru6) == 0x5F8);
13312 assert(sizeof(IndoorCameraD3D_Vec3) == 0x10);
13313 assert(sizeof(IndoorCameraD3D_Vec4) == 0x18); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3
13314 assert(sizeof(IndoorCameraD3D) == 0x1A1384);
13315 assert(sizeof(StationaryLight) == 0xC);
13316 assert(sizeof(LightsStack_StationaryLight_) == 0x12C8);
13317 assert(sizeof(MobileLight) == 0x12);
13318 assert(sizeof(LightsStack_MobileLight_) == 0x1C28);
13319 assert(sizeof(Game) == 0xE78);
13320 assert(sizeof(stru141) == 0xA8);
13321 assert(sizeof(ActionQueue) == 0x7C);
13322 assert(sizeof(NPCData) == 0x4C);
13323 assert(sizeof(NPCStats) == 0x17FFC);
13324 assert(sizeof(BspRenderer) == 0x53740);
13325 assert(sizeof(PaletteManager) == 0x267AF0);
13326 assert(sizeof(ViewingParams) == 0x26C);
13327 assert(sizeof(IndoorCamera) == 0x50);
13328 assert(sizeof(Bloodsplat) == 0x28);
13329 assert(sizeof(BloodsplatContainer) == 0xA0C);
13330 assert(sizeof(stru167) == 0x18);
13331 assert(sizeof(EventIndex) == 0xC);
13332 assert(sizeof(_2devent) == 0x34);
13333 assert(sizeof(stru176) == 0x20);
13334 assert(sizeof(SavegameHeader) == 0x64);
13335 assert(sizeof(SavegameList) == 0x3138);
13336 assert(sizeof(StorylineText) == 0x168);
13337 assert(sizeof(FactionTable) == 0x1EF1);
13338 assert(sizeof(Decal) == 0xC20);
13339 assert(sizeof(DecalBuilder) == 0x30C038);
13340 assert(sizeof(MonsterInfo) == 0x58);
13341 assert(sizeof(MonsterStats) == 0x5BA0);
13342 assert(sizeof(RenderD3D) == 0x148);
13343 assert(sizeof(Render) == 0x129844);
13344 assert(sizeof(Player) == 0x1B3C);
13345 assert(sizeof(Party_stru0) == 0x678);
13346 assert(sizeof(Party) == 0x16238);
13347 assert(sizeof(GUIButton) == 0xBC);
13348 assert(sizeof(GUIWindow) == 0x54);
13349 assert(sizeof(GUIProgressBar) == 0x1B8);
13350 assert(sizeof(GUIFont) == 0x1020);
13351 assert(sizeof(stru262_TurnBased) == 0x40);
13352 assert(sizeof(ArcomageGame) == 0xFA);
13353 assert(sizeof(stru277) == 0x14);
13354 assert(sizeof(ArcomageCard) == 0x6C);
13355 assert(sizeof(stru320) == 0x3FC);
13356 assert(sizeof(TravelInfo) == 0x20);
13357 assert(sizeof(stru336) == 0x798);
13358 }
13359
13131 bool new_sky = false; 13360 bool new_sky = false;
13132 13361
13133 //----- (00462C94) -------------------------------------------------------- 13362 //----- (00462C94) --------------------------------------------------------
13134 bool MM_Main(const wchar_t *pCmdLine) 13363 bool MM_Main(const wchar_t *pCmdLine)
13135 { 13364 {
13143 unsigned int v12; // ecx@56 13372 unsigned int v12; // ecx@56
13144 HANDLE v13; // eax@68 13373 HANDLE v13; // eax@68
13145 unsigned int startms; // [sp+8h] [bp-24h]@55 13374 unsigned int startms; // [sp+8h] [bp-24h]@55
13146 RECT Rect; // [sp+Ch] [bp-20h]@15 13375 RECT Rect; // [sp+Ch] [bp-20h]@15
13147 int a2[4]; // [sp+1Ch] [bp-10h]@15 13376 int a2[4]; // [sp+1Ch] [bp-10h]@15
13148 13377
13378 IntegrityTest();
13149 char test[1024]; 13379 char test[1024];
13150 //sprintfex(test, "^Pi[%s]: ^R[;;]", ""); 13380 sprintfex(test, "^Pi[%s]: ^R[;;]", "");
13381
13151 13382
13152 if (pCmdLine && *pCmdLine) 13383 if (pCmdLine && *pCmdLine)
13153 { 13384 {
13154 if (wcsstr(pCmdLine, L"-usedefs")) 13385 if (wcsstr(pCmdLine, L"-usedefs"))
13155 bDebugResouces = 1; 13386 bDebugResouces = 1;
14937 { 15168 {
14938 case OBJECT_Item: // take the item 15169 case OBJECT_Item: // take the item
14939 v17 = a1 >> 3; 15170 v17 = a1 >> 3;
14940 v26 = a1 >> 3; 15171 v26 = a1 >> 3;
14941 v18 = a1 >> 3; 15172 v18 = a1 >> 3;
14942 if ( pObjectList->pObjects[pLayingItems[v18].uObjectDescID].uFlags & 0x10 15173 if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10
14943 || v17 >= 1000 15174 || v17 >= 1000
14944 || !pLayingItems[v18].uObjectDescID ) 15175 || !pSpriteObjects[v18].uObjectDescID )
14945 return 1; 15176 return 1;
14946 v19 = &pLayingItems[v18].stru_24; 15177 v19 = &pSpriteObjects[v18].stru_24;
14947 v20 = pLayingItems[v18].stru_24.uItemID; 15178 v20 = pSpriteObjects[v18].stru_24.uItemID;
14948 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) 15179 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD)
14949 { 15180 {
14950 party_finds_gold(v19->uSpecEnchantmentType, 0); 15181 party_finds_gold(v19->uSpecEnchantmentType, 0);
14951 viewparams->bRedrawGameUI = 1; 15182 viewparams->bRedrawGameUI = 1;
14952 v21 = v17; 15183 v21 = v17;
14964 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); 15195 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
14965 if ( !pParty->AddItem(v19) ) 15196 if ( !pParty->AddItem(v19) )
14966 pParty->SetHoldingItem(v19); 15197 pParty->SetHoldingItem(v19);
14967 v21 = v26; 15198 v21 = v26;
14968 } 15199 }
14969 LayingItem::OnItemPickup(v21); 15200 SpriteObject::OnInteraction(v21);
14970 break; 15201 break;
14971 15202
14972 case OBJECT_Actor: 15203 case OBJECT_Actor:
14973 v12 = a1 >> 3; 15204 v12 = a1 >> 3;
14974 v13 = &pActors[a1 >> 3]; 15205 v13 = &pActors[a1 >> 3];
15026 if ( !pLevelDecorations[a1 >> 3].IsInteractive() ) 15257 if ( !pLevelDecorations[a1 >> 3].IsInteractive() )
15027 return 1; 15258 return 1;
15028 v10 = v8->_idx_in_stru123; 15259 v10 = v8->_idx_in_stru123;
15029 v24 = 1; 15260 v24 = 1;
15030 v11 = stru_5E4C90._decor_events[v10 - 75] + 380; 15261 v11 = stru_5E4C90._decor_events[v10 - 75] + 380;
15031 GlobalEventInfo = (int)v8; 15262 activeLevelDecoration = v8;
15032 EventProcessor(v11, 0, 1); 15263 EventProcessor(v11, 0, 1);
15033 GlobalEventInfo = 0; 15264 activeLevelDecoration = NULL;
15034 } 15265 }
15035 break; 15266 break;
15036 15267
15037 default: 15268 default:
15038 if ( (a1 & 7) != OBJECT_BModel) 15269 if ( (a1 & 7) != OBJECT_BModel)
15440 v20 = (dword_720020_zvalues[v18] & 0xFFFFu) >> 3; 15671 v20 = (dword_720020_zvalues[v18] & 0xFFFFu) >> 3;
15441 if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Item) 15672 if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Item)
15442 { 15673 {
15443 if ( v20 >= 0x3E8 ) 15674 if ( v20 >= 0x3E8 )
15444 return 0; 15675 return 0;
15445 if ( !(pLayingItems[v20].uAttributes & 0x10) ) 15676 if ( !(pSpriteObjects[v20].uAttributes & 0x10) )
15446 { 15677 {
15447 v23 = pLayingItems[v20].stru_24.GetDisplayName(); 15678 v23 = pSpriteObjects[v20].stru_24.GetDisplayName();
15448 LABEL_36: 15679 LABEL_36:
15449 v24 = v23; 15680 v24 = v23;
15450 goto LABEL_51; 15681 goto LABEL_51;
15451 } 15682 }
15452 goto LABEL_41; 15683 goto LABEL_41;
15589 15820
15590 15821
15591 15822
15592 15823
15593 //----- (0046BEF1) -------------------------------------------------------- 15824 //----- (0046BEF1) --------------------------------------------------------
15594 void LayingItem::_46BEF1_apply_spells() 15825 void SpriteObject::_46BEF1_apply_spells()
15595 { 15826 {
15596 LayingItem *v1; // edi@1 15827 SpriteObject *v1; // edi@1
15597 Actor *v2; // esi@2 15828 Actor *v2; // esi@2
15598 __int16 v3; // fps@4 15829 __int16 v3; // fps@4
15599 unsigned __int8 v4; // c0@4 15830 unsigned __int8 v4; // c0@4
15600 unsigned __int8 v5; // c3@4 15831 unsigned __int8 v5; // c3@4
15601 signed int v6; // [sp+8h] [bp-4h]@1 15832 signed int v6; // [sp+8h] [bp-4h]@1
15633 15864
15634 15865
15635 //----- (0046BFFA) -------------------------------------------------------- 15866 //----- (0046BFFA) --------------------------------------------------------
15636 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) 15867 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)
15637 { 15868 {
15638 LayingItem *v2; // esi@1 15869 SpriteObject *v2; // esi@1
15639 ObjectDesc *v3; // ebx@1 15870 ObjectDesc *v3; // ebx@1
15640 unsigned __int16 v5; // cx@9 15871 unsigned __int16 v5; // cx@9
15641 unsigned __int16 v6; // cx@14 15872 unsigned __int16 v6; // cx@14
15642 signed int v7; // edx@14 15873 signed int v7; // edx@14
15643 unsigned int v8; // eax@19 15874 unsigned int v8; // eax@19
15786 int v151; // [sp+24h] [bp-8h]@1 16017 int v151; // [sp+24h] [bp-8h]@1
15787 signed int v152; // [sp+24h] [bp-8h]@208 16018 signed int v152; // [sp+24h] [bp-8h]@208
15788 unsigned int v153; // [sp+28h] [bp-4h]@1 16019 unsigned int v153; // [sp+28h] [bp-4h]@1
15789 16020
15790 v153 = uLayingItemID; 16021 v153 = uLayingItemID;
15791 v2 = &pLayingItems[uLayingItemID]; 16022 v2 = &pSpriteObjects[uLayingItemID];
15792 v3 = &pObjectList->pObjects[v2->uObjectDescID]; 16023 v3 = &pObjectList->pObjects[v2->uObjectDescID];
15793 v145 = a2; 16024 v145 = a2;
15794 v151 = a2 & 7; 16025 v151 = a2 & 7;
15795 if ( (a2 & 7) == OBJECT_Actor) 16026 if ( (a2 & 7) == OBJECT_Actor)
15796 { 16027 {
15811 v2->uAttributes = v5 & 0xFFFB; 16042 v2->uAttributes = v5 & 0xFFFB;
15812 } 16043 }
15813 } 16044 }
15814 if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player) 16045 if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player)
15815 BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u; 16046 BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u;
15816 v6 = v2->uItemType; 16047 v6 = v2->uType;
15817 v7 = v2->uItemType; 16048 v7 = v2->uType;
15818 if ( v7 > 3060 ) 16049 if ( v7 > 3060 )
15819 { 16050 {
15820 if ( v7 > 6090 ) 16051 if ( v7 > 6090 )
15821 { 16052 {
15822 if ( v7 > 8090 ) 16053 if ( v7 > 8090 )
15831 return 0; 16062 return 0;
15832 LABEL_191: 16063 LABEL_191:
15833 v98 = v6 + 1; 16064 v98 = v6 + 1;
15834 v99 = pObjectList->uNumObjects; 16065 v99 = pObjectList->uNumObjects;
15835 v32 = 0; 16066 v32 = 0;
15836 v2->uItemType = v98; 16067 v2->uType = v98;
15837 v146 = 0; 16068 v146 = 0;
15838 if ( (signed int)v99 > 0 ) 16069 if ( (signed int)v99 > 0 )
15839 { 16070 {
15840 v144 = (char *)&pObjectList->pObjects->uObjectID; 16071 v144 = (char *)&pObjectList->pObjects->uObjectID;
15841 while ( v98 != *(short *)v144 ) 16072 while ( v98 != *(short *)v144 )
15875 v2->_46BEF1_apply_spells(); 16106 v2->_46BEF1_apply_spells();
15876 LABEL_233: 16107 LABEL_233:
15877 if ( !v138 ) 16108 if ( !v138 )
15878 { 16109 {
15879 v109 = pObjectList->uNumObjects; 16110 v109 = pObjectList->uNumObjects;
15880 ++v2->uItemType; 16111 ++v2->uType;
15881 v110 = 0; 16112 v110 = 0;
15882 if ( (signed int)v109 <= 0 ) 16113 if ( (signed int)v109 <= 0 )
15883 { 16114 {
15884 LABEL_238: 16115 LABEL_238:
15885 v112 = 0; 16116 v112 = 0;
15886 } 16117 }
15887 else 16118 else
15888 { 16119 {
15889 v111 = (char *)&pObjectList->pObjects->uObjectID; 16120 v111 = (char *)&pObjectList->pObjects->uObjectID;
15890 while ( v2->uItemType != *(short *)v111 ) 16121 while ( v2->uType != *(short *)v111 )
15891 { 16122 {
15892 ++v110; 16123 ++v110;
15893 v111 += 56; 16124 v111 += 56;
15894 if ( v110 >= (signed int)v109 ) 16125 if ( v110 >= (signed int)v109 )
15895 goto LABEL_238; 16126 goto LABEL_238;
15896 } 16127 }
15897 v112 = v110; 16128 v112 = v110;
15898 } 16129 }
15899 v2->uObjectDescID = v112; 16130 v2->uObjectDescID = v112;
15900 if ( !v112 ) 16131 if ( !v112 )
15901 LayingItem::OnItemPickup(v153); 16132 SpriteObject::OnInteraction(v153);
15902 v2->vVelocity.z = 0; 16133 v2->vVelocity.z = 0;
15903 v2->vVelocity.y = 0; 16134 v2->vVelocity.y = 0;
15904 v2->vVelocity.x = 0; 16135 v2->vVelocity.x = 0;
15905 v2->uSpriteFrameID = 0; 16136 v2->uSpriteFrameID = 0;
15906 v113 = v2->uSoundID; 16137 v113 = v2->uSoundID;
15919 v126 = v115; 16150 v126 = v115;
15920 v116 = v143; 16151 v116 = v143;
15921 goto LABEL_269; 16152 goto LABEL_269;
15922 } 16153 }
15923 LABEL_246: 16154 LABEL_246:
15924 LayingItem::OnItemPickup(v153); 16155 SpriteObject::OnInteraction(v153);
15925 return 0; 16156 return 0;
15926 } 16157 }
15927 v106 = v145; 16158 v106 = v145;
15928 v150 = 0; 16159 v150 = 0;
15929 v139 = v106 >> 3; 16160 v139 = v106 >> 3;
15964 { 16195 {
15965 v108 = v139; 16196 v108 = v139;
15966 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) 16197 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) )
15967 { 16198 {
15968 v138 = 0; 16199 v138 = 0;
15969 if ( v2->uItemType == 8030 ) 16200 if ( v2->uType == 8030 )
15970 { 16201 {
15971 pActors[v108].uAIState = Standing; 16202 pActors[v108].uAIState = Standing;
15972 pActors[v108].UpdateAnimation(); 16203 pActors[v108].UpdateAnimation();
15973 } 16204 }
15974 pActors[v108].pActorBuffs[v136].Apply( 16205 pActors[v108].pActorBuffs[v136].Apply(
16000 { 16231 {
16001 if ( v151 == 3 16232 if ( v151 == 3
16002 && MonsterStats::BelongsToSupertype(pActors[v145 >> 3].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) 16233 && MonsterStats::BelongsToSupertype(pActors[v145 >> 3].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
16003 sub_43A97E(v153, v145); 16234 sub_43A97E(v153, v145);
16004 v93 = pObjectList->uNumObjects; 16235 v93 = pObjectList->uNumObjects;
16005 ++v2->uItemType; 16236 ++v2->uType;
16006 v9 = 0; 16237 v9 = 0;
16007 v52 = 0; 16238 v52 = 0;
16008 if ( (signed int)v93 > 0 ) 16239 if ( (signed int)v93 > 0 )
16009 { 16240 {
16010 v94 = (char *)&pObjectList->pObjects->uObjectID; 16241 v94 = (char *)&pObjectList->pObjects->uObjectID;
16011 while ( v2->uItemType != *(short *)v94 ) 16242 while ( v2->uType != *(short *)v94 )
16012 { 16243 {
16013 ++v52; 16244 ++v52;
16014 v94 += 56; 16245 v94 += 56;
16015 if ( v52 >= (signed int)v93 ) 16246 if ( v52 >= (signed int)v93 )
16016 goto LABEL_181; 16247 goto LABEL_181;
16046 v55 = pObjectList->uNumObjects; 16277 v55 = pObjectList->uNumObjects;
16047 v9 = 0; 16278 v9 = 0;
16048 v56 = 0; 16279 v56 = 0;
16049 v44 = pObjectList->uNumObjects == 0; 16280 v44 = pObjectList->uNumObjects == 0;
16050 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16281 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16051 v2->uItemType = v54; 16282 v2->uType = v54;
16052 if ( v20 | v44 ) 16283 if ( v20 | v44 )
16053 { 16284 {
16054 LABEL_102: 16285 LABEL_102:
16055 v58 = 0; 16286 v58 = 0;
16056 } 16287 }
16066 } 16297 }
16067 v58 = v56; 16298 v58 = v56;
16068 } 16299 }
16069 v2->uObjectDescID = v58; 16300 v2->uObjectDescID = v58;
16070 if ( !v58 ) 16301 if ( !v58 )
16071 LayingItem::OnItemPickup(v153); 16302 SpriteObject::OnInteraction(v153);
16072 v14 = v153; 16303 v14 = v153;
16073 v2->vVelocity.z = 0; 16304 v2->vVelocity.z = 0;
16074 v2->vVelocity.y = 0; 16305 v2->vVelocity.y = 0;
16075 v2->vVelocity.x = 0; 16306 v2->vVelocity.x = 0;
16076 v2->uSpriteFrameID = 0; 16307 v2->uSpriteFrameID = 0;
16102 v60 = pObjectList->uNumObjects; 16333 v60 = pObjectList->uNumObjects;
16103 v9 = 0; 16334 v9 = 0;
16104 v61 = 0; 16335 v61 = 0;
16105 v44 = pObjectList->uNumObjects == 0; 16336 v44 = pObjectList->uNumObjects == 0;
16106 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16337 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16107 v2->uItemType = v59; 16338 v2->uType = v59;
16108 if ( v20 | v44 ) 16339 if ( v20 | v44 )
16109 { 16340 {
16110 LABEL_111: 16341 LABEL_111:
16111 v63 = 0; 16342 v63 = 0;
16112 } 16343 }
16122 } 16353 }
16123 v63 = v61; 16354 v63 = v61;
16124 } 16355 }
16125 v2->uObjectDescID = v63; 16356 v2->uObjectDescID = v63;
16126 if ( !v63 ) 16357 if ( !v63 )
16127 LayingItem::OnItemPickup(v153); 16358 SpriteObject::OnInteraction(v153);
16128 v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; 16359 v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
16129 v44 = v2->field_50 == 4; 16360 v44 = v2->field_50 == 4;
16130 v2->vVelocity.z = 0; 16361 v2->vVelocity.z = 0;
16131 v2->vVelocity.y = 0; 16362 v2->vVelocity.y = 0;
16132 v2->vVelocity.x = 0; 16363 v2->vVelocity.x = 0;
16145 while ( v141 ); 16376 while ( v141 );
16146 } 16377 }
16147 LABEL_160: 16378 LABEL_160:
16148 v14 = v153; 16379 v14 = v153;
16149 LABEL_34: 16380 LABEL_34:
16150 LayingItem::OnItemPickup(v14); 16381 SpriteObject::OnInteraction(v14);
16151 goto LABEL_35; 16382 goto LABEL_35;
16152 } 16383 }
16153 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) 16384 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) )
16154 return 1; 16385 return 1;
16155 v67 = v6 + 1; 16386 v67 = v6 + 1;
16156 v68 = pObjectList->uNumObjects; 16387 v68 = pObjectList->uNumObjects;
16157 v69 = 0; 16388 v69 = 0;
16158 v44 = pObjectList->uNumObjects == 0; 16389 v44 = pObjectList->uNumObjects == 0;
16159 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16390 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16160 v2->uItemType = v67; 16391 v2->uType = v67;
16161 if ( v20 | v44 ) 16392 if ( v20 | v44 )
16162 { 16393 {
16163 LABEL_128: 16394 LABEL_128:
16164 v71 = 0; 16395 v71 = 0;
16165 } 16396 }
16175 } 16406 }
16176 v71 = v69; 16407 v71 = v69;
16177 } 16408 }
16178 v2->uObjectDescID = v71; 16409 v2->uObjectDescID = v71;
16179 if ( !v71 ) 16410 if ( !v71 )
16180 LayingItem::OnItemPickup(v153); 16411 SpriteObject::OnInteraction(v153);
16181 v134 = 0; 16412 v134 = 0;
16182 v72 = v153; 16413 v72 = v153;
16183 v132 = 0; 16414 v132 = 0;
16184 LABEL_132: 16415 LABEL_132:
16185 v73 = v2->vPosition.z; 16416 v73 = v2->vPosition.z;
16211 v85 = pObjectList->uNumObjects; 16442 v85 = pObjectList->uNumObjects;
16212 v9 = 0; 16443 v9 = 0;
16213 v86 = 0; 16444 v86 = 0;
16214 v44 = pObjectList->uNumObjects == 0; 16445 v44 = pObjectList->uNumObjects == 0;
16215 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16446 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16216 v2->uItemType = v84; 16447 v2->uType = v84;
16217 if ( v20 | v44 ) 16448 if ( v20 | v44 )
16218 { 16449 {
16219 LABEL_155: 16450 LABEL_155:
16220 v88 = 0; 16451 v88 = 0;
16221 } 16452 }
16231 } 16462 }
16232 v88 = v86; 16463 v88 = v86;
16233 } 16464 }
16234 v2->uObjectDescID = v88; 16465 v2->uObjectDescID = v88;
16235 if ( !v88 ) 16466 if ( !v88 )
16236 LayingItem::OnItemPickup(v153); 16467 SpriteObject::OnInteraction(v153);
16237 v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; 16468 v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
16238 v2->vVelocity.z = 0; 16469 v2->vVelocity.z = 0;
16239 v2->vVelocity.y = 0; 16470 v2->vVelocity.y = 0;
16240 v2->vVelocity.x = 0; 16471 v2->vVelocity.x = 0;
16241 v142 = v89; 16472 v142 = v89;
16258 v80 = pObjectList->uNumObjects; 16489 v80 = pObjectList->uNumObjects;
16259 v66 = 0; 16490 v66 = 0;
16260 v81 = 0; 16491 v81 = 0;
16261 v44 = pObjectList->uNumObjects == 0; 16492 v44 = pObjectList->uNumObjects == 0;
16262 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16493 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16263 v2->uItemType = 4091; 16494 v2->uType = 4091;
16264 if ( v20 | v44 ) 16495 if ( v20 | v44 )
16265 { 16496 {
16266 LABEL_144: 16497 LABEL_144:
16267 v83 = 0; 16498 v83 = 0;
16268 } 16499 }
16278 } 16509 }
16279 v83 = v81; 16510 v83 = v81;
16280 } 16511 }
16281 v2->uObjectDescID = v83; 16512 v2->uObjectDescID = v83;
16282 if ( !v83 ) 16513 if ( !v83 )
16283 LayingItem::OnItemPickup(v153); 16514 SpriteObject::OnInteraction(v153);
16284 v134 = 0; 16515 v134 = 0;
16285 v72 = v153; 16516 v72 = v153;
16286 v132 = v2->field_61; 16517 v132 = v2->field_61;
16287 goto LABEL_132; 16518 goto LABEL_132;
16288 } 16519 }
16300 { 16531 {
16301 if ( v7 == 555 ) 16532 if ( v7 == 555 )
16302 { 16533 {
16303 sub_43A97E(v153, v145); 16534 sub_43A97E(v153, v145);
16304 v23 = pObjectList->uNumObjects; 16535 v23 = pObjectList->uNumObjects;
16305 ++v2->uItemType; 16536 ++v2->uType;
16306 v18 = 0; 16537 v18 = 0;
16307 v24 = 0; 16538 v24 = 0;
16308 if ( (signed int)v23 <= 0 ) 16539 if ( (signed int)v23 <= 0 )
16309 { 16540 {
16310 LABEL_41: 16541 LABEL_41:
16311 v22 = 0; 16542 v22 = 0;
16312 } 16543 }
16313 else 16544 else
16314 { 16545 {
16315 v25 = (char *)&pObjectList->pObjects->uObjectID; 16546 v25 = (char *)&pObjectList->pObjects->uObjectID;
16316 while ( v2->uItemType != *(short *)v25 ) 16547 while ( v2->uType != *(short *)v25 )
16317 { 16548 {
16318 ++v24; 16549 ++v24;
16319 v25 += 56; 16550 v25 += 56;
16320 if ( v24 >= (signed int)v23 ) 16551 if ( v24 >= (signed int)v23 )
16321 goto LABEL_41; 16552 goto LABEL_41;
16323 v22 = v24; 16554 v22 = v24;
16324 } 16555 }
16325 LABEL_42: 16556 LABEL_42:
16326 v2->uObjectDescID = v22; 16557 v2->uObjectDescID = v22;
16327 if ( v22 == v18 ) 16558 if ( v22 == v18 )
16328 LayingItem::OnItemPickup(v153); 16559 SpriteObject::OnInteraction(v153);
16329 v2->vVelocity.z = v18; 16560 v2->vVelocity.z = v18;
16330 v2->vVelocity.y = v18; 16561 v2->vVelocity.y = v18;
16331 v2->vVelocity.x = v18; 16562 v2->vVelocity.x = v18;
16332 v2->uSpriteFrameID = v18; 16563 v2->uSpriteFrameID = v18;
16333 } 16564 }
16344 case 530: 16575 case 530:
16345 case 535: 16576 case 535:
16346 case 540: 16577 case 540:
16347 sub_43A97E(v153, v145); 16578 sub_43A97E(v153, v145);
16348 v8 = pObjectList->uNumObjects; 16579 v8 = pObjectList->uNumObjects;
16349 ++v2->uItemType; 16580 ++v2->uType;
16350 v9 = 0; 16581 v9 = 0;
16351 v10 = 0; 16582 v10 = 0;
16352 if ( (signed int)v8 <= 0 ) 16583 if ( (signed int)v8 <= 0 )
16353 goto LABEL_23; 16584 goto LABEL_23;
16354 v11 = (char *)&pObjectList->pObjects->uObjectID; 16585 v11 = (char *)&pObjectList->pObjects->uObjectID;
16369 v17 = pObjectList->uNumObjects; 16600 v17 = pObjectList->uNumObjects;
16370 v18 = 0; 16601 v18 = 0;
16371 v19 = 0; 16602 v19 = 0;
16372 v44 = pObjectList->uNumObjects == 0; 16603 v44 = pObjectList->uNumObjects == 0;
16373 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16604 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16374 v2->uItemType = 600; 16605 v2->uType = 600;
16375 if ( v20 | v44 ) 16606 if ( v20 | v44 )
16376 goto LABEL_41; 16607 goto LABEL_41;
16377 v21 = (char *)&pObjectList->pObjects->uObjectID; 16608 v21 = (char *)&pObjectList->pObjects->uObjectID;
16378 while ( *(short *)v21 != 600 ) 16609 while ( *(short *)v21 != 600 )
16379 { 16610 {
16385 v22 = v19; 16616 v22 = v19;
16386 goto LABEL_42; 16617 goto LABEL_42;
16387 default: 16618 default:
16388 return 0; 16619 return 0;
16389 } 16620 }
16390 while ( v2->uItemType != *(short *)v11 ) 16621 while ( v2->uType != *(short *)v11 )
16391 { 16622 {
16392 ++v10; 16623 ++v10;
16393 v11 += 56; 16624 v11 += 56;
16394 if ( v10 >= (signed int)v8 ) 16625 if ( v10 >= (signed int)v8 )
16395 { 16626 {
16400 } 16631 }
16401 v12 = v10; 16632 v12 = v10;
16402 LABEL_24: 16633 LABEL_24:
16403 v2->uObjectDescID = v12; 16634 v2->uObjectDescID = v12;
16404 if ( !v12 ) 16635 if ( !v12 )
16405 LayingItem::OnItemPickup(v153); 16636 SpriteObject::OnInteraction(v153);
16406 v44 = v2->uItemType == 555; 16637 v44 = v2->uType == 555;
16407 v2->vVelocity.z = 0; 16638 v2->vVelocity.z = 0;
16408 v2->vVelocity.y = 0; 16639 v2->vVelocity.y = 0;
16409 v2->vVelocity.x = 0; 16640 v2->vVelocity.x = 0;
16410 v2->uSpriteFrameID = 0; 16641 v2->uSpriteFrameID = 0;
16411 if ( !v44 ) 16642 if ( !v44 )
16431 return 0; 16662 return 0;
16432 } 16663 }
16433 LABEL_93: 16664 LABEL_93:
16434 sub_43A97E(v153, v145); 16665 sub_43A97E(v153, v145);
16435 v51 = pObjectList->uNumObjects; 16666 v51 = pObjectList->uNumObjects;
16436 ++v2->uItemType; 16667 ++v2->uType;
16437 v9 = 0; 16668 v9 = 0;
16438 v52 = 0; 16669 v52 = 0;
16439 if ( (signed int)v51 > 0 ) 16670 if ( (signed int)v51 > 0 )
16440 { 16671 {
16441 v53 = (char *)&pObjectList->pObjects->uObjectID; 16672 v53 = (char *)&pObjectList->pObjects->uObjectID;
16442 while ( v2->uItemType != *(short *)v53 ) 16673 while ( v2->uType != *(short *)v53 )
16443 { 16674 {
16444 ++v52; 16675 ++v52;
16445 v53 += 56; 16676 v53 += 56;
16446 if ( v52 >= (signed int)v51 ) 16677 if ( v52 >= (signed int)v51 )
16447 goto LABEL_181; 16678 goto LABEL_181;
16451 LABEL_181: 16682 LABEL_181:
16452 v95 = 0; 16683 v95 = 0;
16453 LABEL_182: 16684 LABEL_182:
16454 v2->uObjectDescID = v95; 16685 v2->uObjectDescID = v95;
16455 if ( v95 == (short)v9 ) 16686 if ( v95 == (short)v9 )
16456 LayingItem::OnItemPickup(v153); 16687 SpriteObject::OnInteraction(v153);
16457 v96 = v2->uSoundID; 16688 v96 = v2->uSoundID;
16458 v2->vVelocity.z = v9; 16689 v2->vVelocity.z = v9;
16459 v2->vVelocity.y = v9; 16690 v2->vVelocity.y = v9;
16460 v2->vVelocity.x = v9; 16691 v2->vVelocity.x = v9;
16461 v2->uSpriteFrameID = v9; 16692 v2->uSpriteFrameID = v9;
16476 { 16707 {
16477 v33 = pObjectList->uNumObjects; 16708 v33 = pObjectList->uNumObjects;
16478 v34 = 0; 16709 v34 = 0;
16479 v44 = pObjectList->uNumObjects == 0; 16710 v44 = pObjectList->uNumObjects == 0;
16480 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16711 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16481 v2->uItemType = 601; 16712 v2->uType = 601;
16482 if ( v20 | v44 ) 16713 if ( v20 | v44 )
16483 { 16714 {
16484 LABEL_69: 16715 LABEL_69:
16485 v36 = 0; 16716 v36 = 0;
16486 } 16717 }
16496 } 16727 }
16497 v36 = v34; 16728 v36 = v34;
16498 } 16729 }
16499 v2->uObjectDescID = v36; 16730 v2->uObjectDescID = v36;
16500 if ( !v36 ) 16731 if ( !v36 )
16501 LayingItem::OnItemPickup(v153); 16732 SpriteObject::OnInteraction(v153);
16502 v37 = v2->vPosition.z; 16733 v37 = v2->vPosition.z;
16503 v2->vVelocity.z = 0; 16734 v2->vVelocity.z = 0;
16504 v38 = 8 * v153; 16735 v38 = 8 * v153;
16505 v39 = v2->vPosition.y; 16736 v39 = v2->vPosition.y;
16506 LOBYTE(v38) = 8 * v153 | 2; 16737 LOBYTE(v38) = 8 * v153 | 2;
16536 if ( v151 != 3 ) 16767 if ( v151 != 3 )
16537 { 16768 {
16538 v30 = v6 + 1; 16769 v30 = v6 + 1;
16539 v31 = pObjectList->uNumObjects; 16770 v31 = pObjectList->uNumObjects;
16540 v32 = 0; 16771 v32 = 0;
16541 v2->uItemType = v30; 16772 v2->uType = v30;
16542 v146 = 0; 16773 v146 = 0;
16543 if ( (signed int)v31 > 0 ) 16774 if ( (signed int)v31 > 0 )
16544 { 16775 {
16545 v140 = (char *)&pObjectList->pObjects->uObjectID; 16776 v140 = (char *)&pObjectList->pObjects->uObjectID;
16546 while ( v30 != *(short *)v140 ) 16777 while ( v30 != *(short *)v140 )
16553 LABEL_80: 16784 LABEL_80:
16554 v46 = v146; 16785 v46 = v146;
16555 LABEL_196: 16786 LABEL_196:
16556 v2->uObjectDescID = v46; 16787 v2->uObjectDescID = v46;
16557 if ( v46 == (short)v32 ) 16788 if ( v46 == (short)v32 )
16558 LayingItem::OnItemPickup(v153); 16789 SpriteObject::OnInteraction(v153);
16559 v100 = v2->field_61; 16790 v100 = v2->field_61;
16560 v101 = v2->vPosition.z; 16791 v101 = v2->vPosition.z;
16561 v2->uSpriteFrameID = v32; 16792 v2->uSpriteFrameID = v32;
16562 v102 = 8 * v153; 16793 v102 = 8 * v153;
16563 v103 = v2->vPosition.y; 16794 v103 = v2->vPosition.y;
16598 return 1; 16829 return 1;
16599 if ( v151 != 2 ) 16830 if ( v151 != 2 )
16600 { 16831 {
16601 sub_43A97E(v153, v145); 16832 sub_43A97E(v153, v145);
16602 v122 = pObjectList->uNumObjects; 16833 v122 = pObjectList->uNumObjects;
16603 ++v2->uItemType; 16834 ++v2->uType;
16604 v52 = 0; 16835 v52 = 0;
16605 if ( (signed int)v122 > 0 ) 16836 if ( (signed int)v122 > 0 )
16606 { 16837 {
16607 v123 = (char *)&pObjectList->pObjects->uObjectID; 16838 v123 = (char *)&pObjectList->pObjects->uObjectID;
16608 while ( v2->uItemType != *(short *)v123 ) 16839 while ( v2->uType != *(short *)v123 )
16609 { 16840 {
16610 ++v52; 16841 ++v52;
16611 v123 += 56; 16842 v123 += 56;
16612 if ( v52 >= (signed int)v122 ) 16843 if ( v52 >= (signed int)v122 )
16613 goto LABEL_181; 16844 goto LABEL_181;
16621 v117 = v6 + 1; 16852 v117 = v6 + 1;
16622 v118 = pObjectList->uNumObjects; 16853 v118 = pObjectList->uNumObjects;
16623 v119 = 0; 16854 v119 = 0;
16624 v44 = pObjectList->uNumObjects == 0; 16855 v44 = pObjectList->uNumObjects == 0;
16625 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 16856 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
16626 v2->uItemType = v117; 16857 v2->uType = v117;
16627 if ( v20 | v44 ) 16858 if ( v20 | v44 )
16628 { 16859 {
16629 LABEL_255: 16860 LABEL_255:
16630 v121 = 0; 16861 v121 = 0;
16631 } 16862 }
16641 } 16872 }
16642 v121 = v119; 16873 v121 = v119;
16643 } 16874 }
16644 v2->uObjectDescID = v121; 16875 v2->uObjectDescID = v121;
16645 if ( !v121 ) 16876 if ( !v121 )
16646 LayingItem::OnItemPickup(v153); 16877 SpriteObject::OnInteraction(v153);
16647 v2->vVelocity.z = 0; 16878 v2->vVelocity.z = 0;
16648 v2->vVelocity.y = 0; 16879 v2->vVelocity.y = 0;
16649 v2->vVelocity.x = 0; 16880 v2->vVelocity.x = 0;
16650 v2->uSpriteFrameID = 0; 16881 v2->uSpriteFrameID = 0;
16651 LABEL_27: 16882 LABEL_27: