comparison mm7_3.cpp @ 248:37dcbe8f3cca

Dialogue stuff
author Nomad
date Mon, 18 Feb 2013 07:11:43 +0200
parents e9fabaf75628
children e22e2357c8b3 d1af3319bc44 c3bfe1eb3de7
comparison
equal deleted inserted replaced
247:fb8a876f41e1 248:37dcbe8f3cca
4702 4702
4703 return result; 4703 return result;
4704 } 4704 }
4705 4705
4706 //----- (00476387) -------------------------------------------------------- 4706 //----- (00476387) --------------------------------------------------------
4707 bool __cdecl sub_476387() 4707 bool PartyHasDragon()
4708 { 4708 {
4709 return (pNPCStats->pNewNPCData[57].uFlags & 0x80) != 0; 4709 return pNPCStats->pNewNPCData[57].Hired();
4710 } 4710 }
4711 4711
4712 //----- (00476395) -------------------------------------------------------- 4712 //----- (00476395) --------------------------------------------------------
4713 //0x26 Wizard eye at skill level 2 4713 //0x26 Wizard eye at skill level 2
4714 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession) 4714 bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession)
16219 NPCData *pNPC; // ebx@2 16219 NPCData *pNPC; // ebx@2
16220 int v1; // eax@2 16220 int v1; // eax@2
16221 unsigned __int16 v2; // di@2 16221 unsigned __int16 v2; // di@2
16222 //unsigned int v3; // eax@2 16222 //unsigned int v3; // eax@2
16223 char *v4; // esi@3 16223 char *v4; // esi@3
16224 int v5; // eax@11 16224 //int v5; // eax@11
16225 char *v6; // ecx@13 16225 char *v6; // ecx@13
16226 char *v7; // eax@16 16226 char *v7; // eax@16
16227 unsigned int v8; // edi@19 16227 unsigned int v8; // edi@19
16228 char *v9; // ecx@27 16228 char *v9; // ecx@27
16229 char *v10; // eax@29 16229 char *v10; // eax@29
16277 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); 16277 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
16278 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); 16278 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
16279 pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); 16279 pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0));
16280 pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); 16280 pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0));
16281 pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]); 16281 pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]);
16282 if ( pNPC->uProfession ) 16282
16283 { 16283 if (pNPC->uProfession)
16284 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s 16284 {
16285 assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames)); // sometimes buffer overflows; errors emerge both here and in dialogue text
16286 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s
16285 } 16287 }
16286 else 16288 else
16287 {
16288 strcpy(pTmpBuf, pNPC->pName); 16289 strcpy(pTmpBuf, pNPC->pName);
16289 } 16290
16290 v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); 16291 v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3);
16291 pParty->GetPartyFame(); 16292 pParty->GetPartyFame();
16292 if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME ) 16293
16293 { 16294 switch (uDialogueType)
16294 if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET ) 16295 {
16295 { 16296 case DIALOGUE_PROFESSION_DETAILS:
16296 pWindow.uFrameWidth = 460; 16297 {
16297 pWindow.uFrameZ = 452; 16298 if (dialogue_show_profession_details)
16298 pOutString = pFontArrus;
16299 v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:"
16300 if ( 352 - v12 < 8 )
16301 {
16302 pOutString = pFontCreate;
16303 v12 = pFontCreate->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;
16304 }
16305 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16306 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16307 pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428);
16308 v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0);
16309 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
16310 }
16311 else if ( uDialogueType == DIALOGUE_ARENA_REWARD )
16312 {
16313 sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
16314 pInString = v4;
16315 pWindow.uFrameWidth = 460;
16316 pWindow.uFrameZ = 452;
16317 pOutString = pFontArrus;
16318 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16319 if ( 352 - v12 < 8 )
16320 {
16321 pOutString = pFontCreate;
16322 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16323 }
16324 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16325 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16326 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16327 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16328 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16329 }
16330 else if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON )
16331 {
16332 pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
16333 pWindow.uFrameWidth = 460;
16334 pWindow.uFrameZ = 452;
16335 pOutString = pFontArrus;
16336 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16337 if ( 352 - v12 < 8 )
16338 {
16339 pOutString = pFontCreate;
16340 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16341 }
16342 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16343 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16344 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16345 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16346 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16347 }
16348 }
16349 else
16350 {
16351 if ( uDialogueType == DIALOGUE_ARENA_WELCOME )
16352 {
16353 v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
16354 pInString = v7;
16355 pWindow.uFrameWidth = 460;
16356 pWindow.uFrameZ = 452;
16357 pOutString = pFontArrus;
16358 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16359 if ( 352 - v12 < 8 )
16360 {
16361 pOutString = pFontCreate;
16362 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16363 }
16364 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16365 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16366 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16367 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16368 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16369 }
16370 else if ( uDialogueType == DIALOGUE_13 )
16371 {
16372 v5 = 5 * pNPC->uProfession;
16373 v6 = (char *)*(&pNPCStats->field_13A64 + v5);
16374 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16375 pInString = v7;
16376 pWindow.uFrameWidth = 460;
16377 pWindow.uFrameZ = 452;
16378 pOutString = pFontArrus;
16379 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16380 if ( 352 - v12 < 8 )
16381 {
16382 pOutString = pFontCreate;
16383 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16384 }
16385 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16386 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16387 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16388 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16389 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16390 }
16391 else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_77 || byte_5B0938[0]) )
16392 {
16393 if ( (signed int)uDialogueType > DIALOGUE_24 && uDialogueType == DIALOGUE_77 )
16394 {
16395 v5 = 5 * pNPC->uProfession;
16396 if ( byte_F8B1EC )
16397 { 16299 {
16398 v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession); 16300 v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pBenefits;
16399 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16301 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16400 pInString = v7; 16302 pInString = v7;
16401 pWindow.uFrameWidth = 460; 16303 pWindow.uFrameWidth = 460;
16402 pWindow.uFrameZ = 452; 16304 pWindow.uFrameZ = 452;
16403 pOutString = pFontArrus; 16305 pOutString = pFontArrus;
16405 if ( 352 - v12 < 8 ) 16307 if ( 352 - v12 < 8 )
16406 { 16308 {
16407 pOutString = pFontCreate; 16309 pOutString = pFontCreate;
16408 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; 16310 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16409 } 16311 }
16410 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16312 if (uTextureID_Leather != -1)
16411 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16313 pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
16412 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16314 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16413 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); 16315 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16414 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); 16316 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16415 } 16317 }
16416 else if ( pNPC->uFlags & 0x80 ) 16318 else if (pNPC->Hired())
16417 { 16319 {
16418 v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); 16320 v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pDismissText;
16419 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16321 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16420 pInString = v7; 16322 pInString = v7;
16421 pWindow.uFrameWidth = 460; 16323 pWindow.uFrameWidth = 460;
16422 pWindow.uFrameZ = 452; 16324 pWindow.uFrameZ = 452;
16423 pOutString = pFontArrus; 16325 pOutString = pFontArrus;
16425 if ( 352 - v12 < 8 ) 16327 if ( 352 - v12 < 8 )
16426 { 16328 {
16427 pOutString = pFontCreate; 16329 pOutString = pFontCreate;
16428 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; 16330 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16429 } 16331 }
16430 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16332 if (uTextureID_Leather != -1)
16431 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16333 pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
16432 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16334 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16433 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); 16335 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16434 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); 16336 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16435 } 16337 }
16436 else 16338 else
16437 { 16339 {
16438 v6 = (char *)*(&pNPCStats->field_13A64 + v5); 16340 v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText;
16439 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); 16341 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16440 pInString = v7; 16342 pInString = v7;
16441 pWindow.uFrameWidth = 460; 16343 pWindow.uFrameWidth = 460;
16442 pWindow.uFrameZ = 452; 16344 pWindow.uFrameZ = 452;
16443 pOutString = pFontArrus; 16345 pOutString = pFontArrus;
16445 if ( 352 - v12 < 8 ) 16347 if ( 352 - v12 < 8 )
16446 { 16348 {
16447 pOutString = pFontCreate; 16349 pOutString = pFontCreate;
16448 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; 16350 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16449 } 16351 }
16450 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16352 if (uTextureID_Leather != -1)
16451 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16353 pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
16452 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16354 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16453 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); 16355 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16454 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); 16356 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16455 } 16357 }
16456 } 16358 }
16457 else 16359 break;
16360 }
16361
16362 if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME )
16363 {
16364 if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET )
16365 {
16366 pWindow.uFrameWidth = 460;
16367 pWindow.uFrameZ = 452;
16368 pOutString = pFontArrus;
16369 v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:"
16370 if ( 352 - v12 < 8 )
16371 {
16372 pOutString = pFontCreate;
16373 v12 = pFontCreate->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;
16374 }
16375 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16376 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16377 pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428);
16378 v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0);
16379 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0);
16380 }
16381 else if ( uDialogueType == DIALOGUE_ARENA_REWARD )
16382 {
16383 sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
16384 pInString = v4;
16385 pWindow.uFrameWidth = 460;
16386 pWindow.uFrameZ = 452;
16387 pOutString = pFontArrus;
16388 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16389 if ( 352 - v12 < 8 )
16390 {
16391 pOutString = pFontCreate;
16392 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16393 }
16394 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16395 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16396 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16397 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16398 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16399 }
16400 else if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON )
16401 {
16402 pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
16403 pWindow.uFrameWidth = 460;
16404 pWindow.uFrameZ = 452;
16405 pOutString = pFontArrus;
16406 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16407 if ( 352 - v12 < 8 )
16408 {
16409 pOutString = pFontCreate;
16410 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16411 }
16412 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16413 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16414 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16415 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16416 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16417 }
16418 }
16419 else
16420 {
16421 if ( uDialogueType == DIALOGUE_ARENA_WELCOME )
16422 {
16423 v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
16424 pInString = v7;
16425 pWindow.uFrameWidth = 460;
16426 pWindow.uFrameZ = 452;
16427 pOutString = pFontArrus;
16428 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16429 if ( 352 - v12 < 8 )
16430 {
16431 pOutString = pFontCreate;
16432 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16433 }
16434 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16435 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16436 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16437 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16438 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16439 }
16440 else if ( uDialogueType == DIALOGUE_13 )
16441 {
16442 v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText;
16443 v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
16444 pInString = v7;
16445 pWindow.uFrameWidth = 460;
16446 pWindow.uFrameZ = 452;
16447 pOutString = pFontArrus;
16448 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16449 if ( 352 - v12 < 8 )
16450 {
16451 pOutString = pFontCreate;
16452 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16453 }
16454 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16455 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16456 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16457 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16458 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16459 }
16460 else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_PROFESSION_DETAILS || byte_5B0938[0]) )
16461 {
16462 if ((signed int)uDialogueType <= DIALOGUE_23)
16458 { 16463 {
16459 v7 = (char *)ptr_F8B1E8; 16464 v7 = (char *)ptr_F8B1E8;
16460 pInString = v7; 16465 pInString = v7;
16461 pWindow.uFrameWidth = 460; 16466 pWindow.uFrameWidth = 460;
16462 pWindow.uFrameZ = 452; 16467 pWindow.uFrameZ = 452;
16465 if ( 352 - v12 < 8 ) 16470 if ( 352 - v12 < 8 )
16466 { 16471 {
16467 pOutString = pFontCreate; 16472 pOutString = pFontCreate;
16468 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; 16473 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16469 } 16474 }
16470 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16475 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0),
16471 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16476 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
16472 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16477 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16473 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); 16478 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16474 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); 16479 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16475 } 16480 }
16504 } 16509 }
16505 else 16510 else
16506 { 16511 {
16507 if ( *(int *)v54 == 2 ) 16512 if ( *(int *)v54 == 2 )
16508 { 16513 {
16509 if ( pNPC->uFlags & 0x80 ) 16514 if (pNPC->Hired())
16510 v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pDismissText; 16515 v9 = pNPCStats->pProfessions[pNPC->uProfession].pDismissText;
16511 else 16516 else
16512 v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed" 16517 v9 = pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed"
16513 pInString = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); 16518 pInString = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0);
16514 if ( pInString != NULL ) 16519 if ( pInString != NULL )
16515 { 16520 {
16516 pWindow.uFrameWidth = 460; 16521 pWindow.uFrameWidth = 460;
16517 pWindow.uFrameZ = 452; 16522 pWindow.uFrameZ = 452;
16520 if ( 352 - v12 < 8 ) 16525 if ( 352 - v12 < 8 )
16521 { 16526 {
16522 pOutString = pFontCreate; 16527 pOutString = pFontCreate;
16523 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; 16528 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
16524 } 16529 }
16525 pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), 16530 if (uTextureID_Leather != -1)
16526 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); 16531 pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
16527 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); 16532 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
16528 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); 16533 v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
16529 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); 16534 pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
16530 } 16535 }
16531 } 16536 }
16549 if ( v16 > 88 ) 16554 if ( v16 > 88 )
16550 { 16555 {
16551 v24 = ""; 16556 v24 = "";
16552 } 16557 }
16553 else if ( v16 == 88 ) 16558 else if ( v16 == 88 )
16554 v24 = pGlobalTXT_LocalizationStrings[581]; 16559 v24 = pGlobalTXT_LocalizationStrings[581]; // Lord
16555 else if ( v16 == 87 ) 16560 else if ( v16 == 87 )
16556 v24 = pGlobalTXT_LocalizationStrings[580]; 16561 v24 = pGlobalTXT_LocalizationStrings[580]; // Knight
16557 else if ( v16 == 86 ) 16562 else if ( v16 == 86 )
16558 v24 = pGlobalTXT_LocalizationStrings[579]; 16563 v24 = pGlobalTXT_LocalizationStrings[579]; // Squire
16559 else if ( v16 == 85 ) 16564 else if ( v16 == 85 )
16560 v24 = pGlobalTXT_LocalizationStrings[578]; 16565 v24 = pGlobalTXT_LocalizationStrings[578]; // Page
16561 else if ( v16 == 77 ) 16566 else if ( v16 == 77 )
16562 v24 = pGlobalTXT_LocalizationStrings[407]; 16567 v24 = pGlobalTXT_LocalizationStrings[407]; // Details
16563 else if ( v16 == 76 ) 16568 else if ( v16 == 76 )
16564 { 16569 {
16565 if ( pNPC->uFlags & 0x80 ) 16570 if (pNPC->Hired())
16566 { 16571 {
16567 sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); 16572 sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
16568 v24 = pTmpBuf; 16573 v24 = pTmpBuf;
16569 } 16574 }
16570 else 16575 else
16571 v24 = pGlobalTXT_LocalizationStrings[406]; 16576 v24 = pGlobalTXT_LocalizationStrings[406]; // Hire
16572 } 16577 }
16573 else if ( v16 == 24 ) 16578 else if ( v16 == 24 )
16574 { 16579 {
16575 v23 = pNPC->evtf; 16580 v23 = pNPC->evtf;
16576 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; 16581 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
16632 v15->uControlParam = 0; 16637 v15->uControlParam = 0;
16633 } 16638 }
16634 } 16639 }
16635 else if ( v16 == 13 ) 16640 else if ( v16 == 13 )
16636 { 16641 {
16637 if ( pNPC->uFlags & 0x80 ) 16642 if (pNPC->Hired())
16638 { 16643 {
16639 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); 16644 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
16640 v24 = pTmpBuf; 16645 v24 = pTmpBuf;
16641 } 16646 }
16642 else 16647 else
16643 v24 = pGlobalTXT_LocalizationStrings[122]; 16648 v24 = pGlobalTXT_LocalizationStrings[122]; // Join
16644 } 16649 }
16645 else 16650 else
16646 v24 = ""; 16651 v24 = "";
16647 16652
16648 16653
16839 16844
16840 if (pNPCStats->uNumNewNPCs > 0) 16845 if (pNPCStats->uNumNewNPCs > 0)
16841 { 16846 {
16842 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i) 16847 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i)
16843 { 16848 {
16844 if (pNPCStats->pNewNPCData[i].uFlags & 0x80) 16849 if (pNPCStats->pNewNPCData[i].Hired())
16845 { 16850 {
16846 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) 16851 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
16847 { 16852 {
16848 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) 16853 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
16849 pTmpBuf[v4++] = i + 2; 16854 pTmpBuf[v4++] = i + 2;
16925 { 16930 {
16926 v9 = pNPCStats->pNewNPCData; 16931 v9 = pNPCStats->pNewNPCData;
16927 v16 = &pTmpBuf[v6]; 16932 v16 = &pTmpBuf[v6];
16928 do 16933 do
16929 { 16934 {
16930 if ( v9->uFlags & 0x80 16935 if ( v9->Hired()
16931 && (!pParty->pHirelings[0].pName || strcmp(v9->pName, pParty->pHirelings[0].pName)) 16936 && (!pParty->pHirelings[0].pName || strcmp(v9->pName, pParty->pHirelings[0].pName))
16932 && (!pParty->pHirelings[1].pName || strcmp(v9->pName, pParty->pHirelings[1].pName)) ) 16937 && (!pParty->pHirelings[1].pName || strcmp(v9->pName, pParty->pHirelings[1].pName)) )
16933 { 16938 {
16934 v10 = (int)v16++; 16939 v10 = (int)v16++;
16935 *(char *)v10 = v17 + 2; 16940 *(char *)v10 = v17 + 2;
16991 { 16996 {
16992 v7 = &pTmpBuf[v4]; 16997 v7 = &pTmpBuf[v4];
16993 v8 = pNPCStats->pNewNPCData; 16998 v8 = pNPCStats->pNewNPCData;
16994 do 16999 do
16995 { 17000 {
16996 if ( v8->uFlags & 0x80 && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) ) 17001 if (v8->Hired() && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) )
16997 { 17002 {
16998 if ( !pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName) ) 17003 if ( !pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName) )
16999 *v7++ = v1 + 2; 17004 *v7++ = v1 + 2;
17000 } 17005 }
17001 ++v1; 17006 ++v1;
20109 pParty->field_70A = 0; 20114 pParty->field_70A = 0;
20110 20115
20111 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) 20116 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
20112 { 20117 {
20113 auto npc = pNPCStats->pNewNPCData + i; 20118 auto npc = pNPCStats->pNewNPCData + i;
20114 if (npc->uFlags & 0x80 && 20119 if (npc->Hired() &&
20115 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName))) 20120 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)))
20116 { 20121 {
20117 if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) 20122 if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))
20118 ++pParty->field_70A; 20123 ++pParty->field_70A;
20119 } 20124 }