comparison mm7_2.cpp @ 109:62772029b56d

Слияние
author Ritor1
date Tue, 06 Nov 2012 10:07:35 +0600
parents d543bd89a31e 3b5267621a5b
children 430786d916d6
comparison
equal deleted inserted replaced
108:d543bd89a31e 109:62772029b56d
1 #include <io.h> 1 #include <io.h>
2 #include <direct.h> 2 #include <direct.h>
3 #include <assert.h>
3 4
4 #include "MapInfo.h" 5 #include "MapInfo.h"
5 #include "Game.h" 6 #include "Game.h"
6 #include "GUIWindow.h" 7 #include "GUIWindow.h"
7 #include "GUIButton.h" 8 #include "GUIButton.h"
143 _this.uFrameX = 483; 144 _this.uFrameX = 483;
144 _this.uFrameWidth = 148; 145 _this.uFrameWidth = 148;
145 _this.uFrameZ = 334; 146 _this.uFrameZ = 334;
146 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 147 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
147 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 148 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
148 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); 149 sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
149 _this.DrawText2(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); 150 _this.DrawText2(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
150 if ( dword_F8B19C == 1 ) 151 if ( dword_F8B19C == 1 )
151 { 152 {
152 v11 = 1; 153 v11 = 1;
153 pOutString = 0; 154 pOutString = 0;
204 if ( dword_F8B19C != 100 ) 205 if ( dword_F8B19C != 100 )
205 return; 206 return;
206 v0 = ptr_507BC0; 207 v0 = ptr_507BC0;
207 if ( ptr_507BC0->field_40 == 1 ) 208 if ( ptr_507BC0->field_40 == 1 )
208 { 209 {
209 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); 210 sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
210 _this.DrawText2(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); 211 _this.DrawText2(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
211 _this.DrawText2(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 212 _this.DrawText2(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
212 v3 = pFontArrus; 213 v3 = pFontArrus;
213 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 214 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
214 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); 215 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
255 } 256 }
256 v5 = &pMonsterStats->pInfos[word_F8B1A0]; 257 v5 = &pMonsterStats->pInfos[word_F8B1A0];
257 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 258 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
258 v7 = v5->pName; 259 v7 = v5->pName;
259 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 260 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
260 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); 261 sprintfex(pTmpBuf, &byte_4F0F98, v8, v7, v6);
261 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); 262 sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
262 ptr_F8B1E8 = pTmpBuf2; 263 ptr_F8B1E8 = pTmpBuf2;
263 memcpy(&a1, pDialogueWindow, sizeof(a1)); 264 memcpy(&a1, pDialogueWindow, sizeof(a1));
264 w.uFrameWidth = 458; 265 w.uFrameWidth = 458;
265 w.uFrameZ = 457; 266 w.uFrameZ = 457;
266 pOutString = pFontArrus; 267 pOutString = pFontArrus;
308 _this.uFrameX = 483; 309 _this.uFrameX = 483;
309 _this.uFrameWidth = 148; 310 _this.uFrameWidth = 148;
310 _this.uFrameZ = 334; 311 _this.uFrameZ = 334;
311 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 312 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
312 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 313 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
313 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); 314 sprintfex(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
314 _this.DrawText2(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); 315 _this.DrawText2(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
315 if ( dword_F8B19C != 1 ) 316 if ( dword_F8B19C != 1 )
316 { 317 {
317 if ( dword_F8B19C == 7 ) 318 if ( dword_F8B19C == 7 )
318 { 319 {
392 goto LABEL_15; 393 goto LABEL_15;
393 } 394 }
394 v11 = pGlobalTXT_LocalizationStrings[112]; 395 v11 = pGlobalTXT_LocalizationStrings[112];
395 v10 = pGlobalTXT_LocalizationStrings[244]; 396 v10 = pGlobalTXT_LocalizationStrings[244];
396 } 397 }
397 sprintf(pTmpBuf, "%s\n%s", v10, v11); 398 sprintfex(pTmpBuf, "%s\n%s", v10, v11);
398 _this.DrawText2(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); 399 _this.DrawText2(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
399 _this.DrawText2(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 400 _this.DrawText2(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
400 v4 = pFontArrus; 401 v4 = pFontArrus;
401 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 402 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
402 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); 403 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
679 ++v10; 680 ++v10;
680 } 681 }
681 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); 682 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton );
682 if ( v86 ) 683 if ( v86 )
683 { 684 {
684 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); 685 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString);
685 v79.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 686 v79.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
686 pOutString = (GUIFont *)((149 - v89) / v86); 687 pOutString = (GUIFont *)((149 - v89) / v86);
687 if ( (149 - v89) / v86 > 32 ) 688 if ( (149 - v89) / v86 > 32 )
688 pOutString = (GUIFont *)32; 689 pOutString = (GUIFont *)32;
689 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; 690 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162;
729 } 730 }
730 return; 731 return;
731 } 732 }
732 } 733 }
733 v26 = pTmpBuf; 734 v26 = pTmpBuf;
734 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]); 735 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->uClass]);
735 strcat(pTmpBuf, "\n \n"); 736 strcat(pTmpBuf, "\n \n");
736 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 737 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
737 goto LABEL_97; 738 goto LABEL_97;
738 } 739 }
739 *(_QWORD *)Str = pParty->uNumFoodRations; 740 *(_QWORD *)Str = pParty->uNumFoodRations;
768 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 769 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
769 return; 770 return;
770 v28 = *(int *)v84; 771 v28 = *(int *)v84;
771 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 772 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
772 v28 = v81; 773 v28 = v81;
773 sprintf(&Dest, format_4E2DC8, v28); 774 sprintfex(&Dest, format_4E2DC8, v28);
774 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); 775 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
775 strcat(&Dest, pTmpBuf2); 776 strcat(&Dest, pTmpBuf2);
776 v90 = pFontArrus->CalcTextHeight(&Dest, &v79, 0, 0); 777 v90 = pFontArrus->CalcTextHeight(&Dest, &v79, 0, 0);
777 strcat(&Dest, "\n \n"); 778 strcat(&Dest, "\n \n");
778 v29 = *(int *)v84; 779 v29 = *(int *)v84;
779 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) 780 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
780 v29 = v81; 781 v29 = v81;
781 sprintf(&a1, format_4E2DC8, v29); 782 sprintfex(&a1, format_4E2DC8, v29);
782 sprintf(pTmpBuf2, 783 sprintfex(pTmpBuf2,
783 pGlobalTXT_LocalizationStrings[86], 784 pGlobalTXT_LocalizationStrings[86],
784 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], 785 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C],
785 (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier, 786 (signed __int64)p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier,
786 v83); 787 v83);
787 strcat(&a1, pTmpBuf2); 788 strcat(&a1, pTmpBuf2);
788 v88 = pFontArrus->CalcTextHeight(&a1, &v79, 0, 0); 789 v88 = pFontArrus->CalcTextHeight(&a1, &v79, 0, 0);
789 strcat(&a1, "\n \n"); 790 strcat(&a1, "\n \n");
790 v30 = *(int *)v84; 791 v30 = *(int *)v84;
791 if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) 792 if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
792 v30 = v81; 793 v30 = v81;
793 sprintf(&v77, format_4E2DC8, v30); 794 sprintfex(&v77, format_4E2DC8, v30);
794 strcat(&v77, pGlobalTXT_LocalizationStrings[160]); 795 strcat(&v77, pGlobalTXT_LocalizationStrings[160]);
795 v82 = pFontArrus->CalcTextHeight(&v77, &v79, 0, 0); 796 v82 = pFontArrus->CalcTextHeight(&v77, &v79, 0, 0);
796 strcat(&v77, "\n \n"); 797 strcat(&v77, "\n \n");
797 v75 = 0; 798 v75 = 0;
798 v87 = 0; 799 v87 = 0;
800 if ( v31 >= 108 && v31 <= 120 ) 801 if ( v31 >= 108 && v31 <= 120 )
801 { 802 {
802 v32 = *(int *)v84; 803 v32 = *(int *)v84;
803 if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) 804 if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
804 v32 = v81; 805 v32 = v81;
805 sprintf(&v75, format_4E2DC8, v32); 806 sprintfex(&v75, format_4E2DC8, v32);
806 strcat(&v75, pGlobalTXT_LocalizationStrings[611]); 807 strcat(&v75, pGlobalTXT_LocalizationStrings[611]);
807 v87 = pFontArrus->CalcTextHeight(&v75, &v79, 0, 0); 808 v87 = pFontArrus->CalcTextHeight(&v75, &v79, 0, 0);
808 } 809 }
809 v33 = pDialogueWindow; 810 v33 = pDialogueWindow;
810 Str[1] = (char *)pDialogueWindow; 811 Str[1] = (char *)pDialogueWindow;
814 v37 = -pDialogueWindow->pNumPresenceButton < 0; 815 v37 = -pDialogueWindow->pNumPresenceButton < 0;
815 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; 816 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
816 if ( !(v37 ^ __OFSUB__(v34, v35)) ) 817 if ( !(v37 ^ __OFSUB__(v34, v35)) )
817 { 818 {
818 LABEL_75: 819 LABEL_75:
819 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); 820 sprintfex(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
820 v71 = 3; 821 v71 = 3;
821 v69 = pTmpBuf; 822 v69 = pTmpBuf;
822 v67 = 0; 823 v67 = 0;
823 v66 = 146; 824 v66 = 146;
824 LABEL_98: 825 LABEL_98:
950 { 951 {
951 v6 = v1 > 3; 952 v6 = v1 > 3;
952 v7 = v6 + 2 * v2 - 30; 953 v7 = v6 + 2 * v2 - 30;
953 v2 = (signed int)v0->ptr_1C; 954 v2 = (signed int)v0->ptr_1C;
954 v4 = word_4F0498[5 * v7]; 955 v4 = word_4F0498[5 * v7];
955 v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10]; 956 __debugbreak();
957 //things happen around word_4F0400 actually
958 //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10];
956 goto LABEL_13; 959 goto LABEL_13;
957 } 960 }
958 if ( v2 <= 41 ) 961 if ( v2 <= 41 )
959 { 962 {
960 v4 = word_4F0576[v2]; 963 v4 = word_4F0576[v2];
1213 } 1216 }
1214 while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); 1217 while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem );
1215 if ( !v109 ) 1218 if ( !v109 )
1216 { 1219 {
1217 LABEL_105: 1220 LABEL_105:
1218 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); 1221 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
1219 strcat(pTmpBuf, "\n \n"); 1222 strcat(pTmpBuf, "\n \n");
1220 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 1223 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
1221 v7 = pTmpBuf; 1224 v7 = pTmpBuf;
1222 v86 = 3; 1225 v86 = 3;
1223 v84 = pTmpBuf; 1226 v84 = pTmpBuf;
1225 v80 = 0; 1228 v80 = 0;
1226 v78 = 0; 1229 v78 = 0;
1227 v77 = &v101; 1230 v77 = &v101;
1228 goto LABEL_15; 1231 goto LABEL_15;
1229 } 1232 }
1230 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); 1233 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108);
1231 v101.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 1234 v101.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
1232 v108 = (149 - v106.y) / (signed int)v109; 1235 v108 = (149 - v106.y) / (signed int)v109;
1233 if ( (149 - v106.y) / (signed int)v109 > 32 ) 1236 if ( (149 - v106.y) / (signed int)v109 > 32 )
1234 v108 = 32; 1237 v108 = 32;
1235 result = (char *)v30->pStartingPosActiveItem; 1238 result = (char *)v30->pStartingPosActiveItem;
1952 ++v6; 1955 ++v6;
1953 } 1956 }
1954 while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); 1957 while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem );
1955 if ( v114 ) 1958 if ( v114 )
1956 { 1959 {
1957 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); 1960 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111);
1958 v104.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 1961 v104.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
1959 v111 = (const char **)((signed int)(149 - v112) / v114); 1962 v111 = (const char **)((signed int)(149 - v112) / v114);
1960 if ( (signed int)(149 - v112) / v114 > 32 ) 1963 if ( (signed int)(149 - v112) / v114 > 32 )
1961 v111 = (const char **)32; 1964 v111 = (const char **)32;
1962 result = (POINT *)v2->pStartingPosActiveItem; 1965 result = (POINT *)v2->pStartingPosActiveItem;
2002 while ( (signed int)v112 < (signed int)result ); 2005 while ( (signed int)v112 < (signed int)result );
2003 } 2006 }
2004 return result; 2007 return result;
2005 } 2008 }
2006 } 2009 }
2007 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]); 2010 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->uClass]);
2008 strcat(pTmpBuf, "\n \n"); 2011 strcat(pTmpBuf, "\n \n");
2009 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 2012 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
2010 v21 = pTmpBuf; 2013 v21 = pTmpBuf;
2011 v92 = 3; 2014 v92 = 3;
2012 v90 = pTmpBuf; 2015 v90 = pTmpBuf;
2546 ++v39; 2549 ++v39;
2547 } 2550 }
2548 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); 2551 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
2549 if ( v153 ) 2552 if ( v153 )
2550 { 2553 {
2551 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); 2554 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
2552 v144.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 2555 v144.DrawText2(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
2553 _this = (Player *)((149 - v152) / v153); 2556 _this = (Player *)((149 - v152) / v153);
2554 if ( (149 - v152) / v153 > 32 ) 2557 if ( (149 - v152) / v153 > 32 )
2555 _this = (Player *)32; 2558 _this = (Player *)32;
2556 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; 2559 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
2595 while ( v152 < v54 ); 2598 while ( v152 < v54 );
2596 } 2599 }
2597 return; 2600 return;
2598 } 2601 }
2599 } 2602 }
2600 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]); 2603 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->uClass]);
2601 strcat(pTmpBuf, "\n \n"); 2604 strcat(pTmpBuf, "\n \n");
2602 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 2605 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
2603 v11 = 0; 2606 v11 = 0;
2604 v36 = pTmpBuf; 2607 v36 = pTmpBuf;
2605 v123 = 3; 2608 v123 = 3;
3836 } 3839 }
3837 LABEL_11: 3840 LABEL_11:
3838 dword_F8B19C = v55; 3841 dword_F8B19C = v55;
3839 if ( v3 < 19 ) 3842 if ( v3 < 19 )
3840 { 3843 {
3841 v9 = pIcons_LOD->LoadTexture((&off_4F03B8)[4 * v3], TEXTURE_16BIT_PALETTE); 3844 v9 = pIcons_LOD->LoadTexture(off_4F03B8[v3], TEXTURE_16BIT_PALETTE);
3842 v3 = dword_F8B198; 3845 v3 = dword_F8B198;
3843 dword_F8B164 = &pIcons_LOD->pTextures[v9]; 3846 dword_F8B164 = &pIcons_LOD->pTextures[v9];
3844 LABEL_13: 3847 LABEL_13:
3845 v8 = ptr_507BC0; 3848 v8 = ptr_507BC0;
3846 } 3849 }
5152 v20 = 0; 5155 v20 = 0;
5153 for ( i = (int)pParty->pPlayers[0].pName; ; v3 = (char *)i ) 5156 for ( i = (int)pParty->pPlayers[0].pName; ; v3 = (char *)i )
5154 { 5157 {
5155 v4 = pClassNames[(unsigned __int8)v3[17]]; 5158 v4 = pClassNames[(unsigned __int8)v3[17]];
5156 v5 = ((Player *)(v3 - 168))->GetBaseLevel(); 5159 v5 = ((Player *)(v3 - 168))->GetBaseLevel();
5157 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4); 5160 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4);
5158 pWindow.DrawText2( 5161 pWindow.DrawText2(
5159 pFont, 5162 pFont,
5160 1u, 5163 1u,
5161 v20 * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 5164 v20 * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46,
5162 1u, 5165 1u,
5179 if ( v18 != 1 ) 5182 if ( v18 != 1 )
5180 v8 = pGlobalTXT_LocalizationStrings[148]; 5183 v8 = pGlobalTXT_LocalizationStrings[148];
5181 v9 = pGlobalTXT_LocalizationStrings[245]; 5184 v9 = pGlobalTXT_LocalizationStrings[245];
5182 if ( v14 != 1 ) 5185 if ( v14 != 1 )
5183 v9 = pGlobalTXT_LocalizationStrings[132]; 5186 v9 = pGlobalTXT_LocalizationStrings[132];
5184 sprintf(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); 5187 sprintfex(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
5185 strcat(pTmpBuf, pTmpBuf2); 5188 strcat(pTmpBuf, pTmpBuf2);
5186 pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u); 5189 pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u);
5187 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23); 5190 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23);
5188 pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u); 5191 pWindow.DrawText2(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u);
5189 BYTE1(dword_6BE364_game_settings_1) |= 0x40u; 5192 BYTE1(dword_6BE364_game_settings_1) |= 0x40u;
5190 pRenderer->EndScene(); 5193 pRenderer->EndScene();
5191 pRenderer->Present(); 5194 pRenderer->Present();
5192 if ( pRenderer->pRenderD3D ) 5195 if ( pRenderer->pRenderD3D )
7499 7502
7500 7503
7501 7504
7502 7505
7503 //----- (0044F57C) -------------------------------------------------------- 7506 //----- (0044F57C) --------------------------------------------------------
7504 void *__fastcall SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *a2, int a3, int a4, int a5) 7507 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
7505 { 7508 {
7506 MapInfo *v5; // esi@1 7509 //MapInfo *v5; // esi@1
7507 SpawnPointMM7 *v6; // ebx@1 7510 //SpawnPointMM7 *v6; // ebx@1
7508 void *result; // eax@2 7511 int v7; // eax@2
7509 char v8; // zf@5 7512 char v8; // zf@5
7510 int v9; // edi@9 7513 int v9; // edi@9
7511 int v10; // eax@9 7514 int v10; // eax@9
7512 int v11; // ecx@9 7515 int v11; // ecx@9
7513 int v12; // edx@9 7516 int v12; // edx@9
7538 int v37; // eax@51 7541 int v37; // eax@51
7539 int v38; // eax@52 7542 int v38; // eax@52
7540 int v39; // edi@52 7543 int v39; // edi@52
7541 std::string v40; // [sp-18h] [bp-100h]@60 7544 std::string v40; // [sp-18h] [bp-100h]@60
7542 void *v41; // [sp-14h] [bp-FCh]@50 7545 void *v41; // [sp-14h] [bp-FCh]@50
7543 void *v42; // [sp-10h] [bp-F8h]@50 7546 //void *v42; // [sp-10h] [bp-F8h]@50
7544 size_t v43; // [sp-Ch] [bp-F4h]@50 7547 //size_t v43; // [sp-Ch] [bp-F4h]@50
7545 const char *v44; // [sp-8h] [bp-F0h]@13 7548 const char *v44; // [sp-8h] [bp-F0h]@13
7546 char *v45; // [sp-4h] [bp-ECh]@9 7549 char *v45; // [sp-4h] [bp-ECh]@9
7547 char Str; // [sp+Ch] [bp-DCh]@60 7550 char Str[32]; // [sp+Ch] [bp-DCh]@60
7548 char Str2; // [sp+2Ch] [bp-BCh]@29 7551 char Str2[120]; // [sp+2Ch] [bp-BCh]@29
7549 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 7552 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52
7550 void *Src; // [sp+A8h] [bp-40h]@50 7553 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50
7551 int v50; // [sp+ACh] [bp-3Ch]@47 7554 int v50; // [sp+ACh] [bp-3Ch]@47
7552 char Source; // [sp+B0h] [bp-38h]@20 7555 char Source[32]; // [sp+B0h] [bp-38h]@20
7553 int v52; // [sp+D0h] [bp-18h]@34 7556 int v52; // [sp+D0h] [bp-18h]@34
7554 void *v53; // [sp+D4h] [bp-14h]@34 7557 int v53; // [sp+D4h] [bp-14h]@34
7555 int v54; // [sp+D8h] [bp-10h]@32 7558 int v54; // [sp+D8h] [bp-10h]@32
7556 int v55; // [sp+DCh] [bp-Ch]@32 7559 int v55; // [sp+DCh] [bp-Ch]@32
7557 int v56; // [sp+E0h] [bp-8h]@8 7560 int v56; // [sp+E0h] [bp-8h]@8
7558 int v57; // [sp+E4h] [bp-4h]@1 7561 int v57; // [sp+E4h] [bp-4h]@1
7559 7562
7563 //auto a2 = spawn;
7564
7560 v57 = 0; 7565 v57 = 0;
7561 v5 = pMapInfo; 7566 //v5 = pMapInfo;
7562 v6 = a2; 7567 //v6 = spawn;
7563 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7568 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7564 result = (void *)pOutdoor->ddm.field_C_alert; 7569 v7 = pOutdoor->ddm.field_C_alert;
7570 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
7571 v7 = pIndoor->dlv.field_C_alert;
7565 else 7572 else
7566 result = (void *)(uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0); 7573 v7 = 0;
7567 if ( result ) 7574
7568 { 7575 if (v7)
7569 v8 = (a2->uAttributes & 1) == 0; 7576 v8 = (spawn->uAttributes & 1) == 0;
7570 }
7571 else 7577 else
7572 { 7578 v8 = (spawn->uAttributes & 1) == 1;
7573 result = (void *)(a2->uAttributes & 1); 7579
7574 v8 = (char)result == 1; 7580 if (v8)
7575 } 7581 return;
7576 if ( !v8 ) 7582
7577 { 7583 //result = (void *)(spawn->uIndex - 1);
7578 result = (void *)(a2->uIndex - 1); 7584 v56 = 1;
7579 v56 = 1; 7585 switch (spawn->uIndex - 1)
7580 switch ( (int)result ) 7586 {
7581 { 7587 case 0u:
7582 case 0u:
7583 v9 = pMapInfo->uEncounterMonster1AtLeast; 7588 v9 = pMapInfo->uEncounterMonster1AtLeast;
7584 v10 = rand(); 7589 v10 = rand();
7585 v11 = v5->uEncounterMonster1AtMost; 7590 v11 = pMapInfo->uEncounterMonster1AtMost;
7586 v45 = v5->pEncounterMonster1Texture; 7591 v45 = pMapInfo->pEncounterMonster1Texture;
7587 v12 = v10 % (v11 - v9 + 1); 7592 v12 = v10 % (v11 - v9 + 1);
7588 v13 = v5->field_34; 7593 v13 = pMapInfo->field_34;
7589 goto LABEL_20; 7594 goto LABEL_20;
7590 case 3u: 7595
7596 case 3u:
7591 v45 = pMapInfo->pEncounterMonster1Texture; 7597 v45 = pMapInfo->pEncounterMonster1Texture;
7592 goto LABEL_13;
7593 case 4u:
7594 v45 = pMapInfo->pEncounterMonster2Texture;
7595 goto LABEL_13;
7596 case 5u:
7597 v45 = pMapInfo->pEncounterMonster3Texture;
7598 LABEL_13:
7599 v44 = "%s A"; 7598 v44 = "%s A";
7600 goto LABEL_25; 7599 goto LABEL_25;
7601 case 1u: 7600
7601 case 4u:
7602 v45 = pMapInfo->pEncounterMonster2Texture;
7603 v44 = "%s A";
7604 goto LABEL_25;
7605
7606 case 5u:
7607 v45 = pMapInfo->pEncounterMonster3Texture;
7608 v44 = "%s A";
7609 goto LABEL_25;
7610
7611 case 1u:
7602 v9 = pMapInfo->uEncounterMonster2AtLeast; 7612 v9 = pMapInfo->uEncounterMonster2AtLeast;
7603 v14 = rand(); 7613 v14 = rand();
7604 v15 = v5->uEncounterMonster2AtMost; 7614 v15 = pMapInfo->uEncounterMonster2AtMost;
7605 v45 = v5->pEncounterMonster2Texture; 7615 v45 = pMapInfo->pEncounterMonster2Texture;
7606 v12 = v14 % (v15 - v9 + 1); 7616 v12 = v14 % (v15 - v9 + 1);
7607 v13 = v5->field_37; 7617 v13 = pMapInfo->field_37;
7608 goto LABEL_20; 7618 goto LABEL_20;
7609 case 6u: 7619
7620 case 6u:
7610 v45 = pMapInfo->pEncounterMonster1Texture; 7621 v45 = pMapInfo->pEncounterMonster1Texture;
7611 goto LABEL_18;
7612 case 7u:
7613 v45 = pMapInfo->pEncounterMonster2Texture;
7614 goto LABEL_18;
7615 case 8u:
7616 v45 = pMapInfo->pEncounterMonster3Texture;
7617 LABEL_18:
7618 v44 = "%s B"; 7622 v44 = "%s B";
7619 goto LABEL_25; 7623 goto LABEL_25;
7620 case 2u: 7624
7625 case 7u:
7626 v45 = pMapInfo->pEncounterMonster2Texture;
7627 v44 = "%s B";
7628 goto LABEL_25;
7629
7630 case 8u:
7631 v45 = pMapInfo->pEncounterMonster3Texture;
7632 v44 = "%s B";
7633 goto LABEL_25;
7634
7635 case 2u:
7621 v9 = pMapInfo->uEncounterMonster3AtLeast; 7636 v9 = pMapInfo->uEncounterMonster3AtLeast;
7622 v16 = rand(); 7637 v16 = rand();
7623 v17 = v5->uEncounterMonster3AtMost; 7638 v17 = pMapInfo->uEncounterMonster3AtMost;
7624 v45 = v5->pEncounterMonster3Texture; 7639 v45 = pMapInfo->pEncounterMonster3Texture;
7625 v12 = v16 % (v17 - v9 + 1); 7640 v12 = v16 % (v17 - v9 + 1);
7626 v13 = v5->field_3A; 7641 v13 = pMapInfo->field_3A;
7627 LABEL_20: 7642 LABEL_20:
7628 v57 = v13; 7643 v57 = v13;
7629 v56 = v9 + v12; 7644 v56 = v9 + v12;
7630 result = strcpy(&Source, v45); 7645 strcpy(Source, v45);
7631 goto LABEL_26; 7646 goto LABEL_26;
7632 case 9u: 7647
7648 case 9u:
7633 v45 = pMapInfo->pEncounterMonster1Texture; 7649 v45 = pMapInfo->pEncounterMonster1Texture;
7634 goto LABEL_24; 7650 v44 = "%s C";
7635 case 0xAu: 7651 goto LABEL_25;
7652
7653 case 0xAu:
7636 v45 = pMapInfo->pEncounterMonster2Texture; 7654 v45 = pMapInfo->pEncounterMonster2Texture;
7637 goto LABEL_24; 7655 v44 = "%s C";
7638 case 0xBu: 7656 goto LABEL_25;
7657
7658 case 0xBu:
7639 v45 = pMapInfo->pEncounterMonster3Texture; 7659 v45 = pMapInfo->pEncounterMonster3Texture;
7640 LABEL_24:
7641 v44 = "%s C"; 7660 v44 = "%s C";
7642 LABEL_25: 7661 LABEL_25:
7643 result = (void *)sprintf(&Source, v44, v45); 7662 sprintf(Source, v44, v45);
7644 LABEL_26: 7663 LABEL_26:
7645 if ( Source == 48 ) 7664 if (Source[0] == '0')
7646 return result; 7665 return;
7666
7647 v57 += a3; 7667 v57 += a3;
7648 if ( v57 > 4 ) 7668 if ( v57 > 4 )
7649 v57 = 4; 7669 v57 = 4;
7650 strcpy(&Str2, &Source); 7670 strcpy(Str2, Source);
7651 if ( a4 ) 7671 if ( a4 )
7652 v56 = a4; 7672 v56 = a4;
7653 v18 = v56; 7673 v18 = v56;
7654 result = (void *)(v56 + uNumActors);
7655 if ( (signed int)(v56 + uNumActors) >= 500 ) 7674 if ( (signed int)(v56 + uNumActors) >= 500 )
7656 return result; 7675 return;
7657 v19 = v6->vPosition.x; 7676 v19 = spawn->vPosition.x;
7658 v20 = v6->vPosition.y; 7677 v20 = spawn->vPosition.y;
7659 v21 = v6->vPosition.z; 7678 v21 = spawn->vPosition.z;
7660 v54 = 0; 7679 v54 = 0;
7661 v55 = v19; 7680 v55 = v19;
7662 a4 = v20; 7681 a4 = v20;
7663 a3 = v21; 7682 a3 = v21;
7664 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7683 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7665 v54 = pIndoor->GetSector(v19, v20, v21); 7684 v54 = pIndoor->GetSector(v19, v20, v21);
7666 v53 = 0; 7685 v53 = 0;
7667 result = (void *)((((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64);
7668 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; 7686 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
7669 if ( v18 <= 0 ) 7687 if ( v18 <= 0 )
7670 return result; 7688 return;
7671 break; 7689 break;
7672 default: 7690 default:
7673 return result; 7691 return;
7674 } 7692 }
7675 do 7693
7676 { 7694 for (uint i = v53; i < v56; ++i)
7695 {
7677 v22 = &pActors[uNumActors]; 7696 v22 = &pActors[uNumActors];
7678 pActors[uNumActors].Reset(); 7697 pActors[uNumActors].Reset();
7679 if ( v57 ) 7698 if ( v57 )
7680 { 7699 {
7681 v23 = rand() % 100; 7700 v23 = rand() % 100;
7690 { 7709 {
7691 v24 = 1; 7710 v24 = 1;
7692 } 7711 }
7693 if ( v24 == 1 ) 7712 if ( v24 == 1 )
7694 { 7713 {
7695 v45 = &Source; 7714 v45 = Source;
7696 v44 = "%s A"; 7715 v44 = "%s A";
7697 } 7716 }
7698 else 7717 else
7699 { 7718 {
7700 if ( v24 == 2 ) 7719 if ( v24 == 2 )
7701 { 7720 {
7702 v45 = &Source; 7721 v45 = Source;
7703 v44 = "%s B"; 7722 v44 = "%s B";
7704 } 7723 }
7705 else 7724 else
7706 { 7725 {
7707 if ( v24 != 3 ) 7726 if ( v24 != 3 )
7708 goto LABEL_58; 7727 goto LABEL_58;
7709 v45 = &Source; 7728 v45 = Source;
7710 v44 = "%s C"; 7729 v44 = "%s C";
7711 } 7730 }
7712 } 7731 }
7713 sprintf(&Str2, v44, v45); 7732 sprintf(Str2, v44, v45);
7714 } 7733 }
7715 v26 = pMonsterList->GetMonsterByName(&Str2); 7734 v26 = pMonsterList->GetMonsterByName(Str2);
7716 v50 = (signed __int16)v26; 7735 v50 = (signed __int16)v26;
7717 v45 = &Str2; 7736 v45 = Str2;
7718 if ( (signed __int16)v26 == -1 ) 7737 if ( (signed __int16)v26 == -1 )
7719 { 7738 {
7720 sprintf(&Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45); 7739 sprintfex(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45);
7721 MessageBoxA(nullptr, &Str, nullptr, 0); 7740 MessageBoxA(nullptr, Str, nullptr, 0);
7722 ExitProcess(0); 7741 ExitProcess(0);
7723 } 7742 }
7724 v27 = &pMonsterList->pMonsters[(signed __int16)v26]; 7743 v27 = &pMonsterList->pMonsters[(signed __int16)v26];
7725 v28 = pMonsterStats->_4563FF(v45); 7744 v28 = pMonsterStats->_4563FF(v45);
7726 if ( !v28 ) 7745 if ( !v28 )
7727 v28 = 1; 7746 v28 = 1;
7728 Src = (char *)&pMonsterStats + 88 * v28; 7747 Src = &pMonsterStats->pInfos[v28];
7729 strcpy(v22->pActorName, *(const char **)Src); 7748 strcpy(v22->pActorName, Src->pName);
7730 v43 = 88; 7749 //v43 = 88;
7731 v42 = Src; 7750 //v42 = Src;
7732 v29 = *((short *)Src + 32); 7751 v29 = Src->uHP;
7733 v41 = &v22->pMonsterInfo; 7752 v41 = &v22->pMonsterInfo;
7734 v22->sCurrentHP = v29; 7753 v22->sCurrentHP = v29;
7735 memcpy(v41, v42, v43); 7754 assert(sizeof(MonsterInfo) == 88);
7755 memcpy(v41, Src, sizeof(MonsterInfo));
7736 v22->word_000086_some_monster_id = v50 + 1; 7756 v22->word_000086_some_monster_id = v50 + 1;
7737 v22->uActorRadius = v27->uMonsterRadius; 7757 v22->uActorRadius = v27->uMonsterRadius;
7738 v22->uActorHeight = v27->uMonsterHeight; 7758 v22->uActorHeight = v27->uMonsterHeight;
7739 v22->uMovementSpeed = v27->uMovementSpeed; 7759 v22->uMovementSpeed = v27->uMovementSpeed;
7740 v30 = v55; 7760 v30 = v55;
7746 v22->vPosition.y = v31; 7766 v22->vPosition.y = v31;
7747 v45 = 0; 7767 v45 = 0;
7748 v22->vInitialPosition.z = a3; 7768 v22->vInitialPosition.z = a3;
7749 v22->vPosition.z = a3; 7769 v22->vPosition.z = a3;
7750 v22->uSectorID = v54; 7770 v22->uSectorID = v54;
7751 v22->uGroup = v6->uGroup; 7771 v22->uGroup = spawn->uGroup;
7752 v22->PrepareSprites((char)v45); 7772 v22->PrepareSprites((char)v45);
7753 v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 7773 v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
7754 v32 = rand(); 7774 v32 = rand();
7755 v33 = v32 % 2048; 7775 v33 = v32 % 2048;
7756 v34 = stru_5C6E00->SinCos(v32 % 2048); 7776 v34 = stru_5C6E00->SinCos(v32 % 2048);
7757 a4 = v34; 7777 a4 = v34;
7758 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; 7778 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16;
7759 v55 = a3 + v6->vPosition.x; 7779 v55 = a3 + spawn->vPosition.x;
7760 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); 7780 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi);
7761 a4 = v35; 7781 a4 = v35;
7762 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; 7782 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16;
7763 a4 = a3 + v6->vPosition.y; 7783 a4 = a3 + spawn->vPosition.y;
7764 v36 = v6->vPosition.z; 7784 v36 = spawn->vPosition.z;
7765 a3 = v6->vPosition.z; 7785 a3 = spawn->vPosition.z;
7766 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 7786 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
7767 goto LABEL_55; 7787 goto LABEL_55;
7768 v37 = pIndoor->GetSector(v55, a4, v36); 7788 v37 = pIndoor->GetSector(v55, a4, v36);
7769 if ( v37 == v54 ) 7789 if ( v37 == v54 )
7770 { 7790 {
7782 goto LABEL_58; 7802 goto LABEL_58;
7783 } 7803 }
7784 } 7804 }
7785 } 7805 }
7786 LABEL_58: 7806 LABEL_58:
7787 v53 = (char *)v53 + 1; 7807 ;
7788 result = v53; 7808 //v53 = (char *)v53 + 1;
7789 } 7809 //result = v53;
7790 while ( (signed int)v53 < v56 ); 7810 }
7791 } 7811 //while ( (signed int)v53 < v56 );
7792 return result;
7793 } 7812 }
7794 7813
7795 7814
7796 7815
7797 7816
7952 __int16 v30; // ax@35 7971 __int16 v30; // ax@35
7953 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 7972 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1
7954 int v32; // [sp+7Ch] [bp-Ch]@1 7973 int v32; // [sp+7Ch] [bp-Ch]@1
7955 int v33; // [sp+80h] [bp-8h]@1 7974 int v33; // [sp+80h] [bp-8h]@1
7956 int v34; // [sp+84h] [bp-4h]@1 7975 int v34; // [sp+84h] [bp-4h]@1
7976
7977 __debugbreak();
7957 7978
7958 auto a1 = this; 7979 auto a1 = this;
7959 7980
7960 v2 = a1; 7981 v2 = a1;
7961 v3 = a2; 7982 v3 = a2;
8617 } 8638 }
8618 return result; 8639 return result;
8619 } 8640 }
8620 8641
8621 //----- (00450AAA) -------------------------------------------------------- 8642 //----- (00450AAA) --------------------------------------------------------
8622 void *__cdecl RespawnGlobalDecorations() 8643 void RespawnGlobalDecorations()
8623 { 8644 {
8624 signed int v0; // edi@1 8645 memset(stru_5E4C90._decor_events, 0, 125);
8625 void *result; // eax@1 8646
8626 signed int v2; // ebx@1 8647 uint decorEventIdx = 0;
8627 LevelDecoration *v3; // esi@2 8648 for (uint i = 0; i < uNumLevelDecorations; ++i)
8628 8649 {
8629 v0 = 0; 8650 auto decor = pLevelDecorations + i;
8630 result = memset(stru_5E4C90.field_4B, 0, 0x7Du); 8651
8631 v2 = 0; 8652 if (!decor->field_16_event_id)
8632 if ( (signed int)uNumLevelDecorations > 0 ) 8653 {
8633 { 8654 if (decor->IsInteractive())
8634 v3 = pLevelDecorations; 8655 {
8635 do 8656 if (decorEventIdx < 124)
8636 { 8657 {
8637 if ( !v3->field_16_event_id ) 8658 decor->_idx_in_stru123 = decorEventIdx + 75;
8638 { 8659 stru_5E4C90._decor_events[decorEventIdx++] = decor->GetGlobalEvent();
8639 result = (void *)v3->IsInteractive(); 8660 }
8640 if ( result ) 8661 }
8641 { 8662 }
8642 if ( v0 < 124 ) 8663 }
8643 {
8644 v3->field_1C = v0 + 75;
8645 stru_5E4C90.field_4B[v0++] = v3->GetGlobalEvent();
8646 }
8647 }
8648 }
8649 ++v2;
8650 ++v3;
8651 }
8652 while ( v2 < (signed int)uNumLevelDecorations );
8653 }
8654 return result;
8655 } 8664 }
8656 8665
8657 //----- (00450B0A) -------------------------------------------------------- 8666 //----- (00450B0A) --------------------------------------------------------
8658 bool __fastcall SpawnActor(unsigned int uMonsterID) 8667 bool __fastcall SpawnActor(unsigned int uMonsterID)
8659 { 8668 {
10286 if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") ) 10295 if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") )
10287 { 10296 {
10288 v7 = 44; 10297 v7 = 44;
10289 goto LABEL_71; 10298 goto LABEL_71;
10290 } 10299 }
10291 if ( !_strcmpi(*(const char **)(v2 + 4), off_4E876C) ) 10300 if ( !_strcmpi(*(const char **)(v2 + 4), "Ice") )
10292 { 10301 {
10293 v7 = 26; 10302 v7 = 26;
10294 goto LABEL_71; 10303 goto LABEL_71;
10295 } 10304 }
10296 if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") ) 10305 if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") )
10328 v7 = 65; 10337 v7 = 65;
10329 goto LABEL_71; 10338 goto LABEL_71;
10330 } 10339 }
10331 if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") ) 10340 if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") )
10332 { 10341 {
10333 sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); 10342 sprintfex(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4));
10334 MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); 10343 MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
10335 result = 0; 10344 result = 0;
10336 goto LABEL_76; 10345 goto LABEL_76;
10337 } 10346 }
10338 v7 = 73; 10347 v7 = 73;
10539 { 10548 {
10540 if ( _strcmpi(v1, "ARROWF") ) 10549 if ( _strcmpi(v1, "ARROWF") )
10541 { 10550 {
10542 if ( _strcmpi(v1, "FIRE") ) 10551 if ( _strcmpi(v1, "FIRE") )
10543 { 10552 {
10544 if ( _strcmpi(v1, off_4E887C) ) 10553 if ( _strcmpi(v1, "AIR") )
10545 { 10554 {
10546 if ( _strcmpi(v1, "WATER") ) 10555 if ( _strcmpi(v1, "WATER") )
10547 { 10556 {
10548 if ( _strcmpi(v1, "EARTH") ) 10557 if ( _strcmpi(v1, "EARTH") )
10549 { 10558 {
10931 strcpy(&Dest, v42.pProperties[10]); 10940 strcpy(&Dest, v42.pProperties[10]);
10932 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); 10941 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41));
10933 for ( j = 0; j < v41.field_0; ++j ) 10942 for ( j = 0; j < v41.field_0; ++j )
10934 { 10943 {
10935 v27 = v41.pProperties[j]; 10944 v27 = v41.pProperties[j];
10936 if ( _strcmpi(v41.pProperties[j], off_4E8CB8) ) 10945 if ( _strcmpi(v41.pProperties[j], "NBM") )
10937 { 10946 {
10938 if ( _strcmpi(v27, "Invisible") ) 10947 if ( _strcmpi(v27, "Invisible") )
10939 { 10948 {
10940 if ( _strcmpi(v27, "FS") ) 10949 if ( _strcmpi(v27, "FS") )
10941 { 10950 {
11715 11724
11716 11725
11717 //----- (0046086A) -------------------------------------------------------- 11726 //----- (0046086A) --------------------------------------------------------
11718 bool Autosave() 11727 bool Autosave()
11719 { 11728 {
11720 int flag; // esi@3 11729 int v0; // esi@3
11721 //int i; // eax@4 11730 int v1; // eax@4
11722 //int v2; // edx@5 11731 int v2; // edx@5
11723 FILE *v3; // eax@7 11732 FILE *v3; // eax@7
11724 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 11733 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
11725 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 11734 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
11726 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9 11735 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9
11727 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 11736 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
11728 //unsigned int v9; // [sp+16Ch] [bp-Ch]@5 11737 unsigned int v9; // [sp+16Ch] [bp-Ch]@5
11729 void *pSave; // [sp+170h] [bp-8h]@3 11738 void *pSave; // [sp+170h] [bp-8h]@3
11730 unsigned int v11; // [sp+174h] [bp-4h]@5 11739 unsigned int v11; // [sp+174h] [bp-4h]@5
11731 11740
11732 if ( pVideoPlayer->AnyMovieLoaded() ) 11741 if ( pVideoPlayer->AnyMovieLoaded() )
11733 pVideoPlayer->Unload(); 11742 pVideoPlayer->Unload();
11734 flag = 0; 11743 v0 = 0;
11735 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0); 11744 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0);
11736 pNew_LOD->CloseWriteFile(); 11745 pNew_LOD->CloseWriteFile();
11737 remove("data\\new.lod"); 11746 remove("data\\new.lod");
11738 this_.Reset(); 11747 this_.Reset();
11739 strcpy(this_.LodVersion, "MMVII"); 11748 strcpy(this_.array_000004, "MMVII");
11740 strcpy(this_.LodDescription, "newmaps for MMVII"); 11749 strcpy(this_.array_000054, "newmaps for MMVII");
11741 this_.dword_0000A4 = 100; 11750 this_.dword_0000A4 = 100;
11742 this_.dword_0000A8 = 0; 11751 this_.dword_0000A8 = 0;
11743 a3.pFilename[0] = 0;
11744 a3.uOfsetFromSubindicesStart = 0;
11745 a3.uDataSize = 0;
11746 a3.uNumSubIndices = 0;
11747 a3.dword_000018 = 0; 11752 a3.dword_000018 = 0;
11748 a3.word_00001E = 0; 11753 a3.word_00001E = 0;
11749 strcpy(a3.pFilename, "current"); 11754 strcpy(a3.pFilename, "current");
11750 pNew_LOD->_461492(&this_, &a3, "data\\new.lod"); 11755 pNew_LOD->_461492(&this_, &a3, "data\\new.lod");
11751 if ( pNew_LOD->LoadFile("data\\new.lod", 0) ) 11756 if ( pNew_LOD->LoadFile("data\\new.lod", 0) )
11752 { 11757 {
11753 pNew_LOD->CreateTempFile(); 11758 pNew_LOD->CreateTempFile();
11754 pNew_LOD->uNumSubIndices = 0; 11759 pNew_LOD->uNumSubIndices = 0;
11755 pDir.Reset(); 11760 pDir.Reset();
11756 for (int i = pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i) 11761 v1 = (signed int)pGames_LOD->uNumSubIndices / 2;
11757 { 11762 if ( (signed int)pGames_LOD->uNumSubIndices / 2 < (signed int)pGames_LOD->uNumSubIndices )
11758 memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir)); 11763 {
11759 v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1); 11764 v2 = 32 * v1;
11760 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1u, v3); 11765 v11 = 32 * v1;
11761 pNew_LOD->AppendDirectory(&pDir, pSave); 11766 v9 = pGames_LOD->uNumSubIndices - v1;
11767 while ( 1 )
11768 {
11769 memcpy(&pDir, (char *)pGames_LOD->pSubIndices + v2, sizeof(pDir));
11770 v3 = pGames_LOD->FindContainer((const char *)pGames_LOD->pSubIndices + v2, 1);
11771 fread(pSave, pGames_LOD->pSubIndices[v11 / 0x20].uDataSize, 1u, v3);
11772 pNew_LOD->AppendDirectory(&pDir, pSave);
11773 v11 += 32;
11774 --v9;
11775 if ( !v9 )
11776 break;
11777 v2 = v11;
11778 }
11779 v0 = 0;
11762 } 11780 }
11763 v7.Reset(); 11781 v7.Reset();
11764 strcpy(pSavegameHeader->pLocationName, "out01.odm"); 11782 strcpy(pSavegameHeader->pLocationName, "out01.odm");
11765 strcpy((char *)&v7, "header.bin"); 11783 strcpy((char *)&v7, "header.bin");
11766 v7.uDataSize = 100; 11784 v7.uDataSize = 100;
11767 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader); 11785 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader);
11768 pNew_LOD->Save(); 11786 pNew_LOD->Save();
11769 pParty->vPrevPosition.y = flag; 11787 pParty->vPrevPosition.y = v0;
11770 pParty->vPrevPosition.x = 12552; 11788 pParty->vPrevPosition.x = 12552;
11771 pParty->vPosition.x = 12552; 11789 pParty->vPosition.x = 12552;
11772 pParty->vPosition.z = flag; 11790 pParty->vPosition.z = v0;
11773 pParty->uFallStartY = flag; 11791 pParty->uFallStartY = v0;
11774 pParty->sPrevRotationX = flag; 11792 pParty->sPrevRotationX = v0;
11775 pParty->sRotationX = flag; 11793 pParty->sRotationX = v0;
11776 pParty->vPrevPosition.z = 1816; 11794 pParty->vPrevPosition.z = 1816;
11777 pParty->vPosition.y = 1816; 11795 pParty->vPosition.y = 1816;
11778 flag = 1; 11796 v0 = 1;
11779 pParty->sPrevRotationY = 512; 11797 pParty->sPrevRotationY = 512;
11780 pParty->sRotationY = 512; 11798 pParty->sRotationY = 512;
11781 SaveGame(1, (__int16 *)1); 11799 SaveGame(1, (__int16 *)1);
11782 } 11800 }
11783 pAllocator->FreeChunk(pSave); 11801 pAllocator->FreeChunk(pSave);
11784 return flag; 11802 return v0;
11785 } 11803 }
11786 11804
11787 11805
11788 //----- (004610AA) -------------------------------------------------------- 11806 //----- (004610AA) --------------------------------------------------------
11789 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) 11807 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2)
13518 srand(GetTickCount()); 13536 srand(GetTickCount());
13519 /*GetDiskFreeSpaceA(0, &SectorsPerCluster, &BytesPerSector, &hdc, &TotalNumberOfClusters); 13537 /*GetDiskFreeSpaceA(0, &SectorsPerCluster, &BytesPerSector, &hdc, &TotalNumberOfClusters);
13520 v4 = hdc * BytesPerSector * SectorsPerCluster; 13538 v4 = hdc * BytesPerSector * SectorsPerCluster;
13521 if ( (unsigned int)v4 < 0x1E00000 ) 13539 if ( (unsigned int)v4 < 0x1E00000 )
13522 { 13540 {
13523 sprintf( 13541 sprintfex(
13524 pTmpBuf, 13542 pTmpBuf,
13525 "Due to Window Virtual Memory requirements Might and Magic VII\nrequires 30MB of free hard drive space to operate properly.\n\nAvailable on Current Drive = %luk", 13543 "Due to Window Virtual Memory requirements Might and Magic VII\nrequires 30MB of free hard drive space to operate properly.\n\nAvailable on Current Drive = %luk",
13526 (unsigned int)v4 / 1024i64); 13544 (unsigned int)v4 / 1024i64);
13527 v41 = 48; 13545 v41 = 48;
13528 v40 = "More Hard Drive Space Required"; 13546 v40 = "More Hard Drive Space Required";
14003 /*do 14021 /*do
14004 { 14022 {
14005 v11 = 1; 14023 v11 = 1;
14006 do 14024 do
14007 { 14025 {
14008 sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", v10, v11); 14026 sprintfex(pTmpBuf, "data\\lloyd%d%d.pcx", v10, v11);
14009 remove(pTmpBuf); 14027 remove(pTmpBuf);
14010 ++v11; 14028 ++v11;
14011 } 14029 }
14012 while ( v11 < 6 ); 14030 while ( v11 < 6 );
14013 ++v10; 14031 ++v10;
14286 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32 14304 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32
14287 //char pIniFilename[120]; // [sp+10Ch] [bp-7Ch]@1 14305 //char pIniFilename[120]; // [sp+10Ch] [bp-7Ch]@1
14288 unsigned int v9; // [sp+184h] [bp-4h]@28 14306 unsigned int v9; // [sp+184h] [bp-4h]@28
14289 14307
14290 //_getcwd(v5, 120); 14308 //_getcwd(v5, 120);
14291 //sprintf(pIniFilename, "%s\\mm6.ini", v5); 14309 //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
14292 viewparams = new ViewingParams; 14310 viewparams = new ViewingParams;
14293 viewparams->uScreenX = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); 14311 viewparams->uScreenX = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
14294 viewparams->uScreenY = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); 14312 viewparams->uScreenY = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
14295 viewparams->uScreenZ = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); 14313 viewparams->uScreenZ = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
14296 viewparams->uScreenW = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); 14314 viewparams->uScreenW = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
14958 v5 = 1; 14976 v5 = 1;
14959 goto LABEL_176; 14977 goto LABEL_176;
14960 } 14978 }
14961 } 14979 }
14962 LABEL_174: 14980 LABEL_174:
14963 sprintf(&Src, "Unknown DirectDraw/Direct3D error number %X", v4); 14981 sprintfex(&Src, "Unknown DirectDraw/Direct3D error number %X", v4);
14964 v13 = strlen(&Src); 14982 v13 = strlen(&Src);
14965 v12 = &Src; 14983 v12 = &Src;
14966 goto LABEL_175; 14984 goto LABEL_175;
14967 } 14985 }
14968 if ( v4 > -2005532492 ) 14986 if ( v4 > -2005532492 )
15151 a1.uFrameHeight -= 12; 15169 a1.uFrameHeight -= 12;
15152 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; 15170 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
15153 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; 15171 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
15154 v1 = pItemsTable->pItems[(unsigned int)ptr_507BC4->ptr_1C + 700].pName; 15172 v1 = pItemsTable->pItems[(unsigned int)ptr_507BC4->ptr_1C + 700].pName;
15155 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 15173 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
15156 sprintf(pTmpBuf, format_4E2D80, v2, v1); 15174 sprintfex(pTmpBuf, format_4E2D80, v2, v1);
15157 a1.DrawText2(pFontCreate, 0, 0, 0, pTmpBuf, 3u); 15175 a1.DrawText2(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
15158 return a1.DrawText( 15176 return a1.DrawText(
15159 pFontSmallnum, 15177 pFontSmallnum,
15160 1, 15178 1,
15161 LOBYTE(pFontCreate->uFontHeight) - 3, 15179 LOBYTE(pFontCreate->uFontHeight) - 3,
15847 else 15865 else
15848 { 15866 {
15849 if ( pParty->pPickedItem.uItemID ) 15867 if ( pParty->pPickedItem.uItemID )
15850 return 1; 15868 return 1;
15851 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; 15869 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
15852 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24); 15870 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
15853 ShowStatusBarString(pTmpBuf2, 2u); 15871 ShowStatusBarString(pTmpBuf2, 2u);
15854 if ( v19->uItemID == 506 ) 15872 if ( v19->uItemID == 506 )
15855 _449B7E_toggle_bit(pParty->_award_bits, 184, 1u); 15873 _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
15856 if ( v19->uItemID == 455 ) 15874 if ( v19->uItemID == 455 )
15857 _449B7E_toggle_bit(pParty->_award_bits, 185, 1u); 15875 _449B7E_toggle_bit(pParty->_award_bits, 185, 1u);
15913 } 15931 }
15914 else 15932 else
15915 { 15933 {
15916 if ( !pLevelDecorations[a1 >> 3].IsInteractive() ) 15934 if ( !pLevelDecorations[a1 >> 3].IsInteractive() )
15917 return 1; 15935 return 1;
15918 v10 = v8->field_1C; 15936 v10 = v8->_idx_in_stru123;
15919 v24 = 1; 15937 v24 = 1;
15920 v11 = stru_5E4C90.field_0[v10] + 380; 15938 v11 = stru_5E4C90._decor_events[v10 - 75] + 380;
15921 _5C3420_pDecoration = v8; 15939 _5C3420_pDecoration = v8;
15922 EventProcessor(v11, 0, 1); 15940 EventProcessor(v11, 0, 1);
15923 _5C3420_pDecoration = 0; 15941 _5C3420_pDecoration = 0;
15924 } 15942 }
15925 break; 15943 break;
16385 if ( !v23 ) 16403 if ( !v23 )
16386 return v19; 16404 return v19;
16387 goto LABEL_36; 16405 goto LABEL_36;
16388 } 16406 }
16389 if ( v25->IsInteractive() ) 16407 if ( v25->IsInteractive() )
16390 v24 = pNPCTopics[stru_5E4C90.field_0[v26->field_1C] + 379].pTopic; 16408 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
16391 else 16409 else
16392 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; 16410 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20;
16393 LABEL_51: 16411 LABEL_51:
16394 sub_41C0B8_set_status_string(v24); 16412 sub_41C0B8_set_status_string(v24);
16395 return v19; 16413 return v19;